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