Revision f230a1cf deps/v8/src/mips/full-codegen-mips.cc

View differences:

deps/v8/src/mips/full-codegen-mips.cc
171 171
  FrameScope frame_scope(masm_, StackFrame::MANUAL);
172 172

  
173 173
  info->set_prologue_offset(masm_->pc_offset());
174
  // The following three instructions must remain together and unmodified for
175
  // code aging to work properly.
176
  __ Push(ra, fp, cp, a1);
177
  __ nop(Assembler::CODE_AGE_SEQUENCE_NOP);
178
  // Adjust fp to point to caller's fp.
179
  __ Addu(fp, sp, Operand(2 * kPointerSize));
174
  __ Prologue(BUILD_FUNCTION_FRAME);
180 175
  info->AddNoFrameRange(0, masm_->pc_offset());
181 176

  
182 177
  { Comment cmnt(masm_, "[ Allocate locals");
......
1653 1648
  __ li(a0, Operand(Smi::FromInt(flags)));
1654 1649
  int properties_count = constant_properties->length() / 2;
1655 1650
  if ((FLAG_track_double_fields && expr->may_store_doubles()) ||
1656
      expr->depth() > 1) {
1657
    __ Push(a3, a2, a1, a0);
1658
    __ CallRuntime(Runtime::kCreateObjectLiteral, 4);
1659
  } else if (Serializer::enabled() || flags != ObjectLiteral::kFastElements ||
1651
      expr->depth() > 1 || Serializer::enabled() ||
1652
      flags != ObjectLiteral::kFastElements ||
1660 1653
      properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
1661 1654
    __ Push(a3, a2, a1, a0);
1662
    __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4);
1655
    __ CallRuntime(Runtime::kCreateObjectLiteral, 4);
1663 1656
  } else {
1664 1657
    FastCloneShallowObjectStub stub(properties_count);
1665 1658
    __ CallStub(&stub);
......
3613 3606
  ZoneList<Expression*>* args = expr->arguments();
3614 3607
  ASSERT_EQ(args->length(), 1);
3615 3608

  
3616
  // Load the argument on the stack and call the stub.
3617
  VisitForStackValue(args->at(0));
3609
  // Load the argument into a0 and call the stub.
3610
  VisitForAccumulatorValue(args->at(0));
3611
  __ mov(a0, result_register());
3618 3612

  
3619 3613
  NumberToStringStub stub;
3620 3614
  __ CallStub(&stub);
......
4926 4920

  
4927 4921
#undef __
4928 4922

  
4923

  
4924
void BackEdgeTable::PatchAt(Code* unoptimized_code,
4925
                            Address pc,
4926
                            BackEdgeState target_state,
4927
                            Code* replacement_code) {
4928
  static const int kInstrSize = Assembler::kInstrSize;
4929
  Address branch_address = pc - 6 * kInstrSize;
4930
  CodePatcher patcher(branch_address, 1);
4931

  
4932
  switch (target_state) {
4933
    case INTERRUPT:
4934
      // slt at, a3, zero_reg (in case of count based interrupts)
4935
      // beq at, zero_reg, ok
4936
      // lui t9, <interrupt stub address> upper
4937
      // ori t9, <interrupt stub address> lower
4938
      // jalr t9
4939
      // nop
4940
      // ok-label ----- pc_after points here
4941
      patcher.masm()->slt(at, a3, zero_reg);
4942
      break;
4943
    case ON_STACK_REPLACEMENT:
4944
    case OSR_AFTER_STACK_CHECK:
4945
      // addiu at, zero_reg, 1
4946
      // beq at, zero_reg, ok  ;; Not changed
4947
      // lui t9, <on-stack replacement address> upper
4948
      // ori t9, <on-stack replacement address> lower
4949
      // jalr t9  ;; Not changed
4950
      // nop  ;; Not changed
4951
      // ok-label ----- pc_after points here
4952
      patcher.masm()->addiu(at, zero_reg, 1);
4953
      break;
4954
  }
4955
  Address pc_immediate_load_address = pc - 4 * kInstrSize;
4956
  // Replace the stack check address in the load-immediate (lui/ori pair)
4957
  // with the entry address of the replacement code.
4958
  Assembler::set_target_address_at(pc_immediate_load_address,
4959
                                   replacement_code->entry());
4960

  
4961
  unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch(
4962
      unoptimized_code, pc_immediate_load_address, replacement_code);
4963
}
4964

  
4965

  
4966
BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState(
4967
    Isolate* isolate,
4968
    Code* unoptimized_code,
4969
    Address pc) {
4970
  static const int kInstrSize = Assembler::kInstrSize;
4971
  Address branch_address = pc - 6 * kInstrSize;
4972
  Address pc_immediate_load_address = pc - 4 * kInstrSize;
4973

  
4974
  ASSERT(Assembler::IsBeq(Assembler::instr_at(pc - 5 * kInstrSize)));
4975
  if (!Assembler::IsAddImmediate(Assembler::instr_at(branch_address))) {
4976
    ASSERT(reinterpret_cast<uint32_t>(
4977
        Assembler::target_address_at(pc_immediate_load_address)) ==
4978
           reinterpret_cast<uint32_t>(
4979
               isolate->builtins()->InterruptCheck()->entry()));
4980
    return INTERRUPT;
4981
  }
4982

  
4983
  ASSERT(Assembler::IsAddImmediate(Assembler::instr_at(branch_address)));
4984

  
4985
  if (reinterpret_cast<uint32_t>(
4986
      Assembler::target_address_at(pc_immediate_load_address)) ==
4987
          reinterpret_cast<uint32_t>(
4988
              isolate->builtins()->OnStackReplacement()->entry())) {
4989
    return ON_STACK_REPLACEMENT;
4990
  }
4991

  
4992
  ASSERT(reinterpret_cast<uint32_t>(
4993
      Assembler::target_address_at(pc_immediate_load_address)) ==
4994
         reinterpret_cast<uint32_t>(
4995
             isolate->builtins()->OsrAfterStackCheck()->entry()));
4996
  return OSR_AFTER_STACK_CHECK;
4997
}
4998

  
4999

  
4929 5000
} }  // namespace v8::internal
4930 5001

  
4931 5002
#endif  // V8_TARGET_ARCH_MIPS

Also available in: Unified diff