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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 #endif | 133 #endif |
134 | 134 |
135 // Strict mode functions and builtins need to replace the receiver | 135 // Strict mode functions and builtins need to replace the receiver |
136 // with undefined when called as functions (without an explicit | 136 // with undefined when called as functions (without an explicit |
137 // receiver object). rcx is zero for method calls and non-zero for | 137 // receiver object). rcx is zero for method calls and non-zero for |
138 // function calls. | 138 // function calls. |
139 if (!info->is_classic_mode() || info->is_native()) { | 139 if (!info->is_classic_mode() || info->is_native()) { |
140 Label ok; | 140 Label ok; |
141 __ testq(rcx, rcx); | 141 __ testq(rcx, rcx); |
142 __ j(zero, &ok, Label::kNear); | 142 __ j(zero, &ok, Label::kNear); |
143 // +1 for return address. | 143 StackArgumentsAccessor args(rsp, info->scope()->num_parameters()); |
144 int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize; | |
145 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); | 144 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
146 __ movq(Operand(rsp, receiver_offset), kScratchRegister); | 145 __ movq(args.GetReceiverOperand(), kScratchRegister); |
147 __ bind(&ok); | 146 __ bind(&ok); |
148 } | 147 } |
149 | 148 |
150 // Open a frame scope to indicate that there is a frame on the stack. The | 149 // Open a frame scope to indicate that there is a frame on the stack. The |
151 // MANUAL indicates that the scope shouldn't actually generate code to set up | 150 // MANUAL indicates that the scope shouldn't actually generate code to set up |
152 // the frame (that is done below). | 151 // the frame (that is done below). |
153 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 152 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
154 | 153 |
155 info->set_prologue_offset(masm_->pc_offset()); | 154 info->set_prologue_offset(masm_->pc_offset()); |
156 __ push(rbp); // Caller's frame pointer. | 155 __ push(rbp); // Caller's frame pointer. |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 } | 670 } |
672 } | 671 } |
673 | 672 |
674 | 673 |
675 MemOperand FullCodeGenerator::StackOperand(Variable* var) { | 674 MemOperand FullCodeGenerator::StackOperand(Variable* var) { |
676 ASSERT(var->IsStackAllocated()); | 675 ASSERT(var->IsStackAllocated()); |
677 // Offset is negative because higher indexes are at lower addresses. | 676 // Offset is negative because higher indexes are at lower addresses. |
678 int offset = -var->index() * kPointerSize; | 677 int offset = -var->index() * kPointerSize; |
679 // Adjust by a (parameter or local) base offset. | 678 // Adjust by a (parameter or local) base offset. |
680 if (var->IsParameter()) { | 679 if (var->IsParameter()) { |
681 offset += (info_->scope()->num_parameters() + 1) * kPointerSize; | 680 offset += kFPOnStackSize + kPCOnStackSize + |
| 681 (info_->scope()->num_parameters() - 1) * kPointerSize; |
682 } else { | 682 } else { |
683 offset += JavaScriptFrameConstants::kLocal0Offset; | 683 offset += JavaScriptFrameConstants::kLocal0Offset; |
684 } | 684 } |
685 return Operand(rbp, offset); | 685 return Operand(rbp, offset); |
686 } | 686 } |
687 | 687 |
688 | 688 |
689 MemOperand FullCodeGenerator::VarOperand(Variable* var, Register scratch) { | 689 MemOperand FullCodeGenerator::VarOperand(Variable* var, Register scratch) { |
690 ASSERT(var->IsContextSlot() || var->IsStackAllocated()); | 690 ASSERT(var->IsContextSlot() || var->IsStackAllocated()); |
691 if (var->IsContextSlot()) { | 691 if (var->IsContextSlot()) { |
(...skipping 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2625 | 2625 |
2626 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { | 2626 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
2627 // Push copy of the first argument or undefined if it doesn't exist. | 2627 // Push copy of the first argument or undefined if it doesn't exist. |
2628 if (arg_count > 0) { | 2628 if (arg_count > 0) { |
2629 __ push(Operand(rsp, arg_count * kPointerSize)); | 2629 __ push(Operand(rsp, arg_count * kPointerSize)); |
2630 } else { | 2630 } else { |
2631 __ PushRoot(Heap::kUndefinedValueRootIndex); | 2631 __ PushRoot(Heap::kUndefinedValueRootIndex); |
2632 } | 2632 } |
2633 | 2633 |
2634 // Push the receiver of the enclosing function and do runtime call. | 2634 // Push the receiver of the enclosing function and do runtime call. |
2635 __ push(Operand(rbp, (2 + info_->scope()->num_parameters()) * kPointerSize)); | 2635 StackArgumentsAccessor args(rbp, info_->scope()->num_parameters()); |
| 2636 __ push(args.GetReceiverOperand()); |
2636 | 2637 |
2637 // Push the language mode. | 2638 // Push the language mode. |
2638 __ Push(Smi::FromInt(language_mode())); | 2639 __ Push(Smi::FromInt(language_mode())); |
2639 | 2640 |
2640 // Push the start position of the scope the calls resides in. | 2641 // Push the start position of the scope the calls resides in. |
2641 __ Push(Smi::FromInt(scope()->start_position())); | 2642 __ Push(Smi::FromInt(scope()->start_position())); |
2642 | 2643 |
2643 // Do the runtime call. | 2644 // Do the runtime call. |
2644 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); | 2645 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); |
2645 } | 2646 } |
(...skipping 2300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4946 | 4947 |
4947 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4948 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4948 Assembler::target_address_at(call_target_address)); | 4949 Assembler::target_address_at(call_target_address)); |
4949 return OSR_AFTER_STACK_CHECK; | 4950 return OSR_AFTER_STACK_CHECK; |
4950 } | 4951 } |
4951 | 4952 |
4952 | 4953 |
4953 } } // namespace v8::internal | 4954 } } // namespace v8::internal |
4954 | 4955 |
4955 #endif // V8_TARGET_ARCH_X64 | 4956 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |