| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 } else if (op->IsDoubleRegister()) { | 502 } else if (op->IsDoubleRegister()) { |
| 503 Abort(kToOperandIsDoubleRegisterUnimplemented); | 503 Abort(kToOperandIsDoubleRegisterUnimplemented); |
| 504 return Operand::Zero(); | 504 return Operand::Zero(); |
| 505 } | 505 } |
| 506 // Stack slots not implemented, use ToMemOperand instead. | 506 // Stack slots not implemented, use ToMemOperand instead. |
| 507 UNREACHABLE(); | 507 UNREACHABLE(); |
| 508 return Operand::Zero(); | 508 return Operand::Zero(); |
| 509 } | 509 } |
| 510 | 510 |
| 511 | 511 |
| 512 static int ArgumentsOffsetWithoutFrame(int index) { | |
| 513 ASSERT(index < 0); | |
| 514 return -(index + 1) * kPointerSize; | |
| 515 } | |
| 516 | |
| 517 | |
| 518 MemOperand LCodeGen::ToMemOperand(LOperand* op) const { | 512 MemOperand LCodeGen::ToMemOperand(LOperand* op) const { |
| 519 ASSERT(!op->IsRegister()); | 513 ASSERT(!op->IsRegister()); |
| 520 ASSERT(!op->IsDoubleRegister()); | 514 ASSERT(!op->IsDoubleRegister()); |
| 521 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); | 515 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); |
| 522 if (NeedsEagerFrame()) { | 516 return MemOperand(fp, StackSlotOffset(op->index())); |
| 523 return MemOperand(fp, StackSlotOffset(op->index())); | |
| 524 } else { | |
| 525 // Retrieve parameter without eager stack-frame relative to the | |
| 526 // stack-pointer. | |
| 527 return MemOperand(sp, ArgumentsOffsetWithoutFrame(op->index())); | |
| 528 } | |
| 529 } | 517 } |
| 530 | 518 |
| 531 | 519 |
| 532 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const { | 520 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const { |
| 533 ASSERT(op->IsDoubleStackSlot()); | 521 ASSERT(op->IsDoubleStackSlot()); |
| 534 if (NeedsEagerFrame()) { | 522 return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize); |
| 535 return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize); | |
| 536 } else { | |
| 537 // Retrieve parameter without eager stack-frame relative to the | |
| 538 // stack-pointer. | |
| 539 return MemOperand( | |
| 540 sp, ArgumentsOffsetWithoutFrame(op->index()) + kPointerSize); | |
| 541 } | |
| 542 } | 523 } |
| 543 | 524 |
| 544 | 525 |
| 545 void LCodeGen::WriteTranslation(LEnvironment* environment, | 526 void LCodeGen::WriteTranslation(LEnvironment* environment, |
| 546 Translation* translation) { | 527 Translation* translation) { |
| 547 if (environment == NULL) return; | 528 if (environment == NULL) return; |
| 548 | 529 |
| 549 // The translation includes one command per value in the environment. | 530 // The translation includes one command per value in the environment. |
| 550 int translation_size = environment->translation_size(); | 531 int translation_size = environment->translation_size(); |
| 551 // The output frame height does not include the parameters. | 532 // The output frame height does not include the parameters. |
| (...skipping 3567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4119 } | 4100 } |
| 4120 | 4101 |
| 4121 | 4102 |
| 4122 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 4103 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
| 4123 ASSERT(ToRegister(instr->context()).is(cp)); | 4104 ASSERT(ToRegister(instr->context()).is(cp)); |
| 4124 ASSERT(ToRegister(instr->function()).is(r1)); | 4105 ASSERT(ToRegister(instr->function()).is(r1)); |
| 4125 ASSERT(ToRegister(instr->result()).is(r0)); | 4106 ASSERT(ToRegister(instr->result()).is(r0)); |
| 4126 | 4107 |
| 4127 int arity = instr->arity(); | 4108 int arity = instr->arity(); |
| 4128 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 4109 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
| 4129 if (instr->hydrogen()->IsTailCall()) { | 4110 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 4130 if (NeedsEagerFrame()) __ mov(sp, fp); | |
| 4131 __ Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); | |
| 4132 } else { | |
| 4133 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | |
| 4134 } | |
| 4135 } | 4111 } |
| 4136 | 4112 |
| 4137 | 4113 |
| 4138 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 4114 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
| 4139 ASSERT(ToRegister(instr->context()).is(cp)); | 4115 ASSERT(ToRegister(instr->context()).is(cp)); |
| 4140 ASSERT(ToRegister(instr->result()).is(r0)); | 4116 ASSERT(ToRegister(instr->result()).is(r0)); |
| 4141 | 4117 |
| 4142 int arity = instr->arity(); | 4118 int arity = instr->arity(); |
| 4143 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; | 4119 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; |
| 4144 Handle<Code> ic = | 4120 Handle<Code> ic = |
| (...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5934 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5910 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
| 5935 __ ldr(result, FieldMemOperand(scratch, | 5911 __ ldr(result, FieldMemOperand(scratch, |
| 5936 FixedArray::kHeaderSize - kPointerSize)); | 5912 FixedArray::kHeaderSize - kPointerSize)); |
| 5937 __ bind(&done); | 5913 __ bind(&done); |
| 5938 } | 5914 } |
| 5939 | 5915 |
| 5940 | 5916 |
| 5941 #undef __ | 5917 #undef __ |
| 5942 | 5918 |
| 5943 } } // namespace v8::internal | 5919 } } // namespace v8::internal |
| OLD | NEW |