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 |
512 MemOperand LCodeGen::ToMemOperand(LOperand* op) const { | 518 MemOperand LCodeGen::ToMemOperand(LOperand* op) const { |
513 ASSERT(!op->IsRegister()); | 519 ASSERT(!op->IsRegister()); |
514 ASSERT(!op->IsDoubleRegister()); | 520 ASSERT(!op->IsDoubleRegister()); |
515 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); | 521 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); |
516 return MemOperand(fp, StackSlotOffset(op->index())); | 522 if (NeedsEagerFrame()) { |
| 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 } |
517 } | 529 } |
518 | 530 |
519 | 531 |
520 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const { | 532 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const { |
521 ASSERT(op->IsDoubleStackSlot()); | 533 ASSERT(op->IsDoubleStackSlot()); |
522 return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize); | 534 if (NeedsEagerFrame()) { |
| 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 } |
523 } | 542 } |
524 | 543 |
525 | 544 |
526 void LCodeGen::WriteTranslation(LEnvironment* environment, | 545 void LCodeGen::WriteTranslation(LEnvironment* environment, |
527 Translation* translation) { | 546 Translation* translation) { |
528 if (environment == NULL) return; | 547 if (environment == NULL) return; |
529 | 548 |
530 // The translation includes one command per value in the environment. | 549 // The translation includes one command per value in the environment. |
531 int translation_size = environment->translation_size(); | 550 int translation_size = environment->translation_size(); |
532 // The output frame height does not include the parameters. | 551 // The output frame height does not include the parameters. |
(...skipping 3567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4100 } | 4119 } |
4101 | 4120 |
4102 | 4121 |
4103 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 4122 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
4104 ASSERT(ToRegister(instr->context()).is(cp)); | 4123 ASSERT(ToRegister(instr->context()).is(cp)); |
4105 ASSERT(ToRegister(instr->function()).is(r1)); | 4124 ASSERT(ToRegister(instr->function()).is(r1)); |
4106 ASSERT(ToRegister(instr->result()).is(r0)); | 4125 ASSERT(ToRegister(instr->result()).is(r0)); |
4107 | 4126 |
4108 int arity = instr->arity(); | 4127 int arity = instr->arity(); |
4109 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 4128 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
4110 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 4129 if (instr->hydrogen()->IsTailCall()) { |
| 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 } |
4111 } | 4135 } |
4112 | 4136 |
4113 | 4137 |
4114 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 4138 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
4115 ASSERT(ToRegister(instr->context()).is(cp)); | 4139 ASSERT(ToRegister(instr->context()).is(cp)); |
4116 ASSERT(ToRegister(instr->result()).is(r0)); | 4140 ASSERT(ToRegister(instr->result()).is(r0)); |
4117 | 4141 |
4118 int arity = instr->arity(); | 4142 int arity = instr->arity(); |
4119 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; | 4143 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; |
4120 Handle<Code> ic = | 4144 Handle<Code> ic = |
(...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5910 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5934 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5911 __ ldr(result, FieldMemOperand(scratch, | 5935 __ ldr(result, FieldMemOperand(scratch, |
5912 FixedArray::kHeaderSize - kPointerSize)); | 5936 FixedArray::kHeaderSize - kPointerSize)); |
5913 __ bind(&done); | 5937 __ bind(&done); |
5914 } | 5938 } |
5915 | 5939 |
5916 | 5940 |
5917 #undef __ | 5941 #undef __ |
5918 | 5942 |
5919 } } // namespace v8::internal | 5943 } } // namespace v8::internal |
OLD | NEW |