OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 } | 408 } |
409 | 409 |
410 | 410 |
411 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { | 411 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { |
412 HConstant* constant = chunk_->LookupConstant(op); | 412 HConstant* constant = chunk_->LookupConstant(op); |
413 ASSERT(chunk_->LookupLiteralRepresentation(op).IsSmiOrTagged()); | 413 ASSERT(chunk_->LookupLiteralRepresentation(op).IsSmiOrTagged()); |
414 return constant->handle(isolate()); | 414 return constant->handle(isolate()); |
415 } | 415 } |
416 | 416 |
417 | 417 |
| 418 static int ArgumentsOffsetWithoutFrame(int index) { |
| 419 ASSERT(index < 0); |
| 420 return -(index + 1) * kPointerSize + kPCOnStackSize; |
| 421 } |
| 422 |
| 423 |
418 Operand LCodeGen::ToOperand(LOperand* op) const { | 424 Operand LCodeGen::ToOperand(LOperand* op) const { |
419 // Does not handle registers. In X64 assembler, plain registers are not | 425 // Does not handle registers. In X64 assembler, plain registers are not |
420 // representable as an Operand. | 426 // representable as an Operand. |
421 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); | 427 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); |
422 return Operand(rbp, StackSlotOffset(op->index())); | 428 if (NeedsEagerFrame()) { |
| 429 return Operand(rbp, StackSlotOffset(op->index())); |
| 430 } else { |
| 431 // Retrieve parameter without eager stack-frame relative to the |
| 432 // stack-pointer. |
| 433 return Operand(rsp, ArgumentsOffsetWithoutFrame(op->index())); |
| 434 } |
423 } | 435 } |
424 | 436 |
425 | 437 |
426 void LCodeGen::WriteTranslation(LEnvironment* environment, | 438 void LCodeGen::WriteTranslation(LEnvironment* environment, |
427 Translation* translation) { | 439 Translation* translation) { |
428 if (environment == NULL) return; | 440 if (environment == NULL) return; |
429 | 441 |
430 // The translation includes one command per value in the environment. | 442 // The translation includes one command per value in the environment. |
431 int translation_size = environment->translation_size(); | 443 int translation_size = environment->translation_size(); |
432 // The output frame height does not include the parameters. | 444 // The output frame height does not include the parameters. |
(...skipping 3470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3903 } | 3915 } |
3904 | 3916 |
3905 | 3917 |
3906 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 3918 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
3907 ASSERT(ToRegister(instr->context()).is(rsi)); | 3919 ASSERT(ToRegister(instr->context()).is(rsi)); |
3908 ASSERT(ToRegister(instr->function()).is(rdi)); | 3920 ASSERT(ToRegister(instr->function()).is(rdi)); |
3909 ASSERT(ToRegister(instr->result()).is(rax)); | 3921 ASSERT(ToRegister(instr->result()).is(rax)); |
3910 | 3922 |
3911 int arity = instr->arity(); | 3923 int arity = instr->arity(); |
3912 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 3924 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
3913 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 3925 if (instr->hydrogen()->IsTailCall()) { |
| 3926 if (NeedsEagerFrame()) __ leave(); |
| 3927 __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); |
| 3928 } else { |
| 3929 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 3930 } |
3914 } | 3931 } |
3915 | 3932 |
3916 | 3933 |
3917 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 3934 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
3918 ASSERT(ToRegister(instr->context()).is(rsi)); | 3935 ASSERT(ToRegister(instr->context()).is(rsi)); |
3919 ASSERT(ToRegister(instr->result()).is(rax)); | 3936 ASSERT(ToRegister(instr->result()).is(rax)); |
3920 int arity = instr->arity(); | 3937 int arity = instr->arity(); |
3921 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; | 3938 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; |
3922 Handle<Code> ic = | 3939 Handle<Code> ic = |
3923 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 3940 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); |
(...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5673 FixedArray::kHeaderSize - kPointerSize)); | 5690 FixedArray::kHeaderSize - kPointerSize)); |
5674 __ bind(&done); | 5691 __ bind(&done); |
5675 } | 5692 } |
5676 | 5693 |
5677 | 5694 |
5678 #undef __ | 5695 #undef __ |
5679 | 5696 |
5680 } } // namespace v8::internal | 5697 } } // namespace v8::internal |
5681 | 5698 |
5682 #endif // V8_TARGET_ARCH_X64 | 5699 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |