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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 bool LCodeGen::IsInteger32(LConstantOperand* op) const { | 774 bool LCodeGen::IsInteger32(LConstantOperand* op) const { |
775 return chunk_->LookupLiteralRepresentation(op).IsSmiOrInteger32(); | 775 return chunk_->LookupLiteralRepresentation(op).IsSmiOrInteger32(); |
776 } | 776 } |
777 | 777 |
778 | 778 |
779 bool LCodeGen::IsSmi(LConstantOperand* op) const { | 779 bool LCodeGen::IsSmi(LConstantOperand* op) const { |
780 return chunk_->LookupLiteralRepresentation(op).IsSmi(); | 780 return chunk_->LookupLiteralRepresentation(op).IsSmi(); |
781 } | 781 } |
782 | 782 |
783 | 783 |
| 784 static int ArgumentsOffsetWithoutFrame(int index) { |
| 785 ASSERT(index < 0); |
| 786 return -(index + 1) * kPointerSize + kPCOnStackSize; |
| 787 } |
| 788 |
| 789 |
784 Operand LCodeGen::ToOperand(LOperand* op) const { | 790 Operand LCodeGen::ToOperand(LOperand* op) const { |
785 if (op->IsRegister()) return Operand(ToRegister(op)); | 791 if (op->IsRegister()) return Operand(ToRegister(op)); |
786 if (op->IsDoubleRegister()) return Operand(ToDoubleRegister(op)); | 792 if (op->IsDoubleRegister()) return Operand(ToDoubleRegister(op)); |
787 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); | 793 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); |
788 return Operand(ebp, StackSlotOffset(op->index())); | 794 if (NeedsEagerFrame()) { |
| 795 return Operand(ebp, StackSlotOffset(op->index())); |
| 796 } else { |
| 797 // Retrieve parameter without eager stack-frame relative to the |
| 798 // stack-pointer. |
| 799 return Operand(esp, ArgumentsOffsetWithoutFrame(op->index())); |
| 800 } |
789 } | 801 } |
790 | 802 |
791 | 803 |
792 Operand LCodeGen::HighOperand(LOperand* op) { | 804 Operand LCodeGen::HighOperand(LOperand* op) { |
793 ASSERT(op->IsDoubleStackSlot()); | 805 ASSERT(op->IsDoubleStackSlot()); |
794 return Operand(ebp, StackSlotOffset(op->index()) + kPointerSize); | 806 if (NeedsEagerFrame()) { |
| 807 return Operand(ebp, StackSlotOffset(op->index()) + kPointerSize); |
| 808 } else { |
| 809 // Retrieve parameter without eager stack-frame relative to the |
| 810 // stack-pointer. |
| 811 return Operand( |
| 812 esp, ArgumentsOffsetWithoutFrame(op->index()) + kPointerSize); |
| 813 } |
795 } | 814 } |
796 | 815 |
797 | 816 |
798 void LCodeGen::WriteTranslation(LEnvironment* environment, | 817 void LCodeGen::WriteTranslation(LEnvironment* environment, |
799 Translation* translation) { | 818 Translation* translation) { |
800 if (environment == NULL) return; | 819 if (environment == NULL) return; |
801 | 820 |
802 // The translation includes one command per value in the environment. | 821 // The translation includes one command per value in the environment. |
803 int translation_size = environment->translation_size(); | 822 int translation_size = environment->translation_size(); |
804 // The output frame height does not include the parameters. | 823 // The output frame height does not include the parameters. |
(...skipping 3564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4369 } | 4388 } |
4370 | 4389 |
4371 | 4390 |
4372 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 4391 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
4373 ASSERT(ToRegister(instr->context()).is(esi)); | 4392 ASSERT(ToRegister(instr->context()).is(esi)); |
4374 ASSERT(ToRegister(instr->function()).is(edi)); | 4393 ASSERT(ToRegister(instr->function()).is(edi)); |
4375 ASSERT(ToRegister(instr->result()).is(eax)); | 4394 ASSERT(ToRegister(instr->result()).is(eax)); |
4376 | 4395 |
4377 int arity = instr->arity(); | 4396 int arity = instr->arity(); |
4378 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 4397 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
4379 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 4398 if (instr->hydrogen()->IsTailCall()) { |
| 4399 if (NeedsEagerFrame()) __ leave(); |
| 4400 __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); |
| 4401 } else { |
| 4402 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 4403 } |
4380 } | 4404 } |
4381 | 4405 |
4382 | 4406 |
4383 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 4407 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
4384 ASSERT(ToRegister(instr->context()).is(esi)); | 4408 ASSERT(ToRegister(instr->context()).is(esi)); |
4385 ASSERT(ToRegister(instr->result()).is(eax)); | 4409 ASSERT(ToRegister(instr->result()).is(eax)); |
4386 | 4410 |
4387 int arity = instr->arity(); | 4411 int arity = instr->arity(); |
4388 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; | 4412 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; |
4389 Handle<Code> ic = | 4413 Handle<Code> ic = |
(...skipping 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6477 FixedArray::kHeaderSize - kPointerSize)); | 6501 FixedArray::kHeaderSize - kPointerSize)); |
6478 __ bind(&done); | 6502 __ bind(&done); |
6479 } | 6503 } |
6480 | 6504 |
6481 | 6505 |
6482 #undef __ | 6506 #undef __ |
6483 | 6507 |
6484 } } // namespace v8::internal | 6508 } } // namespace v8::internal |
6485 | 6509 |
6486 #endif // V8_TARGET_ARCH_IA32 | 6510 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |