| 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 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2631 | 2631 |
| 2632 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { | 2632 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
| 2633 // Push copy of the first argument or undefined if it doesn't exist. | 2633 // Push copy of the first argument or undefined if it doesn't exist. |
| 2634 if (arg_count > 0) { | 2634 if (arg_count > 0) { |
| 2635 __ push(Operand(rsp, arg_count * kPointerSize)); | 2635 __ push(Operand(rsp, arg_count * kPointerSize)); |
| 2636 } else { | 2636 } else { |
| 2637 __ PushRoot(Heap::kUndefinedValueRootIndex); | 2637 __ PushRoot(Heap::kUndefinedValueRootIndex); |
| 2638 } | 2638 } |
| 2639 | 2639 |
| 2640 // Push the receiver of the enclosing function and do runtime call. | 2640 // Push the receiver of the enclosing function and do runtime call. |
| 2641 __ push(Operand(rbp, (2 + info_->scope()->num_parameters()) * kPointerSize)); | 2641 StackArgumentsAccessor args(rbp, info_->scope()->num_parameters()); |
| 2642 __ push(args.GetReceiverOperand()); |
| 2642 | 2643 |
| 2643 // Push the language mode. | 2644 // Push the language mode. |
| 2644 __ Push(Smi::FromInt(language_mode())); | 2645 __ Push(Smi::FromInt(language_mode())); |
| 2645 | 2646 |
| 2646 // Push the start position of the scope the calls resides in. | 2647 // Push the start position of the scope the calls resides in. |
| 2647 __ Push(Smi::FromInt(scope()->start_position())); | 2648 __ Push(Smi::FromInt(scope()->start_position())); |
| 2648 | 2649 |
| 2649 // Do the runtime call. | 2650 // Do the runtime call. |
| 2650 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); | 2651 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); |
| 2651 } | 2652 } |
| (...skipping 2224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4876 *context_length = 0; | 4877 *context_length = 0; |
| 4877 return previous_; | 4878 return previous_; |
| 4878 } | 4879 } |
| 4879 | 4880 |
| 4880 | 4881 |
| 4881 #undef __ | 4882 #undef __ |
| 4882 | 4883 |
| 4883 } } // namespace v8::internal | 4884 } } // namespace v8::internal |
| 4884 | 4885 |
| 4885 #endif // V8_TARGET_ARCH_X64 | 4886 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |