OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/crankshaft/x64/lithium-codegen-x64.h" | 7 #include "src/crankshaft/x64/lithium-codegen-x64.h" |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 need_write_barrier = false; | 189 need_write_barrier = false; |
190 } | 190 } |
191 RecordSafepoint(deopt_mode); | 191 RecordSafepoint(deopt_mode); |
192 | 192 |
193 // Context is returned in rax. It replaces the context passed to us. | 193 // Context is returned in rax. It replaces the context passed to us. |
194 // It's saved in the stack and kept live in rsi. | 194 // It's saved in the stack and kept live in rsi. |
195 __ movp(rsi, rax); | 195 __ movp(rsi, rax); |
196 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax); | 196 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax); |
197 | 197 |
198 // Copy any necessary parameters into the context. | 198 // Copy any necessary parameters into the context. |
199 int num_parameters = info()->scope()->num_parameters(); | 199 int num_parameters = scope()->num_parameters(); |
200 int first_parameter = info()->scope()->has_this_declaration() ? -1 : 0; | 200 int first_parameter = scope()->has_this_declaration() ? -1 : 0; |
201 for (int i = first_parameter; i < num_parameters; i++) { | 201 for (int i = first_parameter; i < num_parameters; i++) { |
202 Variable* var = (i == -1) ? info()->scope()->receiver() | 202 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); |
203 : info()->scope()->parameter(i); | |
204 if (var->IsContextSlot()) { | 203 if (var->IsContextSlot()) { |
205 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 204 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
206 (num_parameters - 1 - i) * kPointerSize; | 205 (num_parameters - 1 - i) * kPointerSize; |
207 // Load parameter from stack. | 206 // Load parameter from stack. |
208 __ movp(rax, Operand(rbp, parameter_offset)); | 207 __ movp(rax, Operand(rbp, parameter_offset)); |
209 // Store it in the context. | 208 // Store it in the context. |
210 int context_offset = Context::SlotOffset(var->index()); | 209 int context_offset = Context::SlotOffset(var->index()); |
211 __ movp(Operand(rsi, context_offset), rax); | 210 __ movp(Operand(rsi, context_offset), rax); |
212 // Update the write barrier. This clobbers rax and rbx. | 211 // Update the write barrier. This clobbers rax and rbx. |
213 if (need_write_barrier) { | 212 if (need_write_barrier) { |
(...skipping 5353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5567 __ bind(deferred->exit()); | 5566 __ bind(deferred->exit()); |
5568 __ bind(&done); | 5567 __ bind(&done); |
5569 } | 5568 } |
5570 | 5569 |
5571 #undef __ | 5570 #undef __ |
5572 | 5571 |
5573 } // namespace internal | 5572 } // namespace internal |
5574 } // namespace v8 | 5573 } // namespace v8 |
5575 | 5574 |
5576 #endif // V8_TARGET_ARCH_X64 | 5575 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |