Chromium Code Reviews| 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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 826 | 826 |
| 827 bool LCodeGen::IsSmi(LConstantOperand* op) const { | 827 bool LCodeGen::IsSmi(LConstantOperand* op) const { |
| 828 return chunk_->LookupLiteralRepresentation(op).IsSmi(); | 828 return chunk_->LookupLiteralRepresentation(op).IsSmi(); |
| 829 } | 829 } |
| 830 | 830 |
| 831 | 831 |
| 832 Operand LCodeGen::ToOperand(LOperand* op) const { | 832 Operand LCodeGen::ToOperand(LOperand* op) const { |
| 833 if (op->IsRegister()) return Operand(ToRegister(op)); | 833 if (op->IsRegister()) return Operand(ToRegister(op)); |
| 834 if (op->IsDoubleRegister()) return Operand(ToDoubleRegister(op)); | 834 if (op->IsDoubleRegister()) return Operand(ToDoubleRegister(op)); |
| 835 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); | 835 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); |
| 836 return Operand(ebp, StackSlotOffset(op->index())); | 836 if (NeedsEagerFrame()) { |
| 837 return Operand(ebp, StackSlotOffset(op->index())); | |
| 838 } else { | |
| 839 // Retrieve parameter without eager stack-frame relative to the | |
| 840 // stack-pointer. | |
| 841 ASSERT(op->index() < 0); | |
| 842 return Operand(esp, StackSlotOffset(op->index()) - kFPOnStackSize); | |
| 843 } | |
| 837 } | 844 } |
| 838 | 845 |
| 839 | 846 |
| 840 Operand LCodeGen::HighOperand(LOperand* op) { | 847 Operand LCodeGen::HighOperand(LOperand* op) { |
| 841 ASSERT(op->IsDoubleStackSlot()); | 848 ASSERT(op->IsDoubleStackSlot()); |
| 842 return Operand(ebp, StackSlotOffset(op->index()) + kPointerSize); | 849 if (NeedsEagerFrame()) { |
| 850 return Operand(ebp, StackSlotOffset(op->index()) + kPointerSize); | |
| 851 } else { | |
| 852 // Retrieve parameter without eager stack-frame relative to the | |
| 853 // stack-pointer. | |
| 854 ASSERT(op->index() < 0); | |
| 855 return Operand(esp, StackSlotOffset(op->index()) | |
| 856 - kFPOnStackSize + kPointerSize); | |
| 857 } | |
| 843 } | 858 } |
| 844 | 859 |
| 845 | 860 |
| 846 void LCodeGen::WriteTranslation(LEnvironment* environment, | 861 void LCodeGen::WriteTranslation(LEnvironment* environment, |
| 847 Translation* translation) { | 862 Translation* translation) { |
| 848 if (environment == NULL) return; | 863 if (environment == NULL) return; |
| 849 | 864 |
| 850 // The translation includes one command per value in the environment. | 865 // The translation includes one command per value in the environment. |
| 851 int translation_size = environment->translation_size(); | 866 int translation_size = environment->translation_size(); |
| 852 // The output frame height does not include the parameters. | 867 // The output frame height does not include the parameters. |
| (...skipping 3497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4350 } | 4365 } |
| 4351 | 4366 |
| 4352 | 4367 |
| 4353 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 4368 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
| 4354 ASSERT(ToRegister(instr->context()).is(esi)); | 4369 ASSERT(ToRegister(instr->context()).is(esi)); |
| 4355 ASSERT(ToRegister(instr->function()).is(edi)); | 4370 ASSERT(ToRegister(instr->function()).is(edi)); |
| 4356 ASSERT(ToRegister(instr->result()).is(eax)); | 4371 ASSERT(ToRegister(instr->result()).is(eax)); |
| 4357 | 4372 |
| 4358 int arity = instr->arity(); | 4373 int arity = instr->arity(); |
| 4359 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 4374 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
| 4360 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 4375 if (instr->hydrogen()->tailcall()) { |
|
danno
2013/10/02 08:49:11
this should probably be called IsTailCall()
Toon Verwaest
2013/10/02 16:28:16
Done.
| |
| 4376 if (NeedsEagerFrame()) __ leave(); | |
| 4377 __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); | |
| 4378 } else { | |
| 4379 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | |
| 4380 } | |
| 4361 } | 4381 } |
| 4362 | 4382 |
| 4363 | 4383 |
| 4364 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 4384 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
| 4365 ASSERT(ToRegister(instr->context()).is(esi)); | 4385 ASSERT(ToRegister(instr->context()).is(esi)); |
| 4366 ASSERT(ToRegister(instr->result()).is(eax)); | 4386 ASSERT(ToRegister(instr->result()).is(eax)); |
| 4367 | 4387 |
| 4368 int arity = instr->arity(); | 4388 int arity = instr->arity(); |
| 4369 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; | 4389 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; |
| 4370 Handle<Code> ic = | 4390 Handle<Code> ic = |
| (...skipping 2032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6403 FixedArray::kHeaderSize - kPointerSize)); | 6423 FixedArray::kHeaderSize - kPointerSize)); |
| 6404 __ bind(&done); | 6424 __ bind(&done); |
| 6405 } | 6425 } |
| 6406 | 6426 |
| 6407 | 6427 |
| 6408 #undef __ | 6428 #undef __ |
| 6409 | 6429 |
| 6410 } } // namespace v8::internal | 6430 } } // namespace v8::internal |
| 6411 | 6431 |
| 6412 #endif // V8_TARGET_ARCH_IA32 | 6432 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |