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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 __ int3(); | 131 __ int3(); |
132 } | 132 } |
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 Label begin; | |
142 __ bind(&begin); | |
143 __ testq(rcx, rcx); | 141 __ testq(rcx, rcx); |
144 __ j(zero, &ok, Label::kNear); | 142 __ j(zero, &ok, Label::kNear); |
145 // +1 for return address. | 143 // +1 for return address. |
146 int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize; | 144 int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize; |
147 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); | 145 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
148 __ movq(Operand(rsp, receiver_offset), kScratchRegister); | 146 __ movq(Operand(rsp, receiver_offset), kScratchRegister); |
149 __ bind(&ok); | 147 __ bind(&ok); |
150 ASSERT(!FLAG_age_code || | |
151 (kSizeOfFullCodegenStrictModePrologue == ok.pos() - begin.pos())); | |
152 } | 148 } |
153 | 149 |
154 // Open a frame scope to indicate that there is a frame on the stack. The | 150 // Open a frame scope to indicate that there is a frame on the stack. The |
155 // MANUAL indicates that the scope shouldn't actually generate code to set up | 151 // MANUAL indicates that the scope shouldn't actually generate code to set up |
156 // the frame (that is done below). | 152 // the frame (that is done below). |
157 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 153 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
158 | 154 |
| 155 info->set_prologue_offset(masm_->pc_offset()); |
159 __ push(rbp); // Caller's frame pointer. | 156 __ push(rbp); // Caller's frame pointer. |
160 __ movq(rbp, rsp); | 157 __ movq(rbp, rsp); |
161 __ push(rsi); // Callee's context. | 158 __ push(rsi); // Callee's context. |
162 __ push(rdi); // Callee's JS Function. | 159 __ push(rdi); // Callee's JS Function. |
163 | 160 |
164 { Comment cmnt(masm_, "[ Allocate locals"); | 161 { Comment cmnt(masm_, "[ Allocate locals"); |
165 int locals_count = info->scope()->num_stack_slots(); | 162 int locals_count = info->scope()->num_stack_slots(); |
166 if (locals_count == 1) { | 163 if (locals_count == 1) { |
167 __ PushRoot(Heap::kUndefinedValueRootIndex); | 164 __ PushRoot(Heap::kUndefinedValueRootIndex); |
168 } else if (locals_count > 1) { | 165 } else if (locals_count > 1) { |
(...skipping 4329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4498 *context_length = 0; | 4495 *context_length = 0; |
4499 return previous_; | 4496 return previous_; |
4500 } | 4497 } |
4501 | 4498 |
4502 | 4499 |
4503 #undef __ | 4500 #undef __ |
4504 | 4501 |
4505 } } // namespace v8::internal | 4502 } } // namespace v8::internal |
4506 | 4503 |
4507 #endif // V8_TARGET_ARCH_X64 | 4504 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |