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