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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 } else if (op->IsDoubleRegister()) { | 481 } else if (op->IsDoubleRegister()) { |
482 Abort(kToOperandIsDoubleRegisterUnimplemented); | 482 Abort(kToOperandIsDoubleRegisterUnimplemented); |
483 return Operand(0); | 483 return Operand(0); |
484 } | 484 } |
485 // Stack slots not implemented, use ToMemOperand instead. | 485 // Stack slots not implemented, use ToMemOperand instead. |
486 UNREACHABLE(); | 486 UNREACHABLE(); |
487 return Operand(0); | 487 return Operand(0); |
488 } | 488 } |
489 | 489 |
490 | 490 |
| 491 static int ArgumentsOffsetWithoutFrame(int index) { |
| 492 ASSERT(index < 0); |
| 493 return -(index + 1) * kPointerSize; |
| 494 } |
| 495 |
| 496 |
491 MemOperand LCodeGen::ToMemOperand(LOperand* op) const { | 497 MemOperand LCodeGen::ToMemOperand(LOperand* op) const { |
492 ASSERT(!op->IsRegister()); | 498 ASSERT(!op->IsRegister()); |
493 ASSERT(!op->IsDoubleRegister()); | 499 ASSERT(!op->IsDoubleRegister()); |
494 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); | 500 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); |
495 return MemOperand(fp, StackSlotOffset(op->index())); | 501 if (NeedsEagerFrame()) { |
| 502 return MemOperand(fp, StackSlotOffset(op->index())); |
| 503 } else { |
| 504 // Retrieve parameter without eager stack-frame relative to the |
| 505 // stack-pointer. |
| 506 return MemOperand(sp, ArgumentsOffsetWithoutFrame(op->index())); |
| 507 } |
496 } | 508 } |
497 | 509 |
498 | 510 |
499 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const { | 511 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const { |
500 ASSERT(op->IsDoubleStackSlot()); | 512 ASSERT(op->IsDoubleStackSlot()); |
501 return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize); | 513 if (NeedsEagerFrame()) { |
| 514 return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize); |
| 515 } else { |
| 516 // Retrieve parameter without eager stack-frame relative to the |
| 517 // stack-pointer. |
| 518 return MemOperand( |
| 519 sp, ArgumentsOffsetWithoutFrame(op->index()) + kPointerSize); |
| 520 } |
502 } | 521 } |
503 | 522 |
504 | 523 |
505 void LCodeGen::WriteTranslation(LEnvironment* environment, | 524 void LCodeGen::WriteTranslation(LEnvironment* environment, |
506 Translation* translation) { | 525 Translation* translation) { |
507 if (environment == NULL) return; | 526 if (environment == NULL) return; |
508 | 527 |
509 // The translation includes one command per value in the environment. | 528 // The translation includes one command per value in the environment. |
510 int translation_size = environment->translation_size(); | 529 int translation_size = environment->translation_size(); |
511 // The output frame height does not include the parameters. | 530 // The output frame height does not include the parameters. |
(...skipping 3496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4008 } | 4027 } |
4009 | 4028 |
4010 | 4029 |
4011 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 4030 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
4012 ASSERT(ToRegister(instr->context()).is(cp)); | 4031 ASSERT(ToRegister(instr->context()).is(cp)); |
4013 ASSERT(ToRegister(instr->function()).is(a1)); | 4032 ASSERT(ToRegister(instr->function()).is(a1)); |
4014 ASSERT(ToRegister(instr->result()).is(v0)); | 4033 ASSERT(ToRegister(instr->result()).is(v0)); |
4015 | 4034 |
4016 int arity = instr->arity(); | 4035 int arity = instr->arity(); |
4017 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 4036 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
4018 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 4037 if (instr->hydrogen()->IsTailCall()) { |
| 4038 if (NeedsEagerFrame()) __ mov(sp, fp); |
| 4039 __ Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); |
| 4040 } else { |
| 4041 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 4042 } |
4019 } | 4043 } |
4020 | 4044 |
4021 | 4045 |
4022 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 4046 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
4023 ASSERT(ToRegister(instr->context()).is(cp)); | 4047 ASSERT(ToRegister(instr->context()).is(cp)); |
4024 ASSERT(ToRegister(instr->result()).is(v0)); | 4048 ASSERT(ToRegister(instr->result()).is(v0)); |
4025 | 4049 |
4026 int arity = instr->arity(); | 4050 int arity = instr->arity(); |
4027 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; | 4051 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; |
4028 Handle<Code> ic = | 4052 Handle<Code> ic = |
(...skipping 1861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5890 __ Subu(scratch, result, scratch); | 5914 __ Subu(scratch, result, scratch); |
5891 __ lw(result, FieldMemOperand(scratch, | 5915 __ lw(result, FieldMemOperand(scratch, |
5892 FixedArray::kHeaderSize - kPointerSize)); | 5916 FixedArray::kHeaderSize - kPointerSize)); |
5893 __ bind(&done); | 5917 __ bind(&done); |
5894 } | 5918 } |
5895 | 5919 |
5896 | 5920 |
5897 #undef __ | 5921 #undef __ |
5898 | 5922 |
5899 } } // namespace v8::internal | 5923 } } // namespace v8::internal |
OLD | NEW |