OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #include "src/crankshaft/arm/lithium-codegen-arm.h" | 5 #include "src/crankshaft/arm/lithium-codegen-arm.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/crankshaft/arm/lithium-gap-resolver-arm.h" | 10 #include "src/crankshaft/arm/lithium-gap-resolver-arm.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // Result of FastNewFunctionContextStub is always in new space. | 173 // Result of FastNewFunctionContextStub is always in new space. |
174 need_write_barrier = false; | 174 need_write_barrier = false; |
175 } | 175 } |
176 RecordSafepoint(deopt_mode); | 176 RecordSafepoint(deopt_mode); |
177 | 177 |
178 // Context is returned in both r0 and cp. It replaces the context | 178 // Context is returned in both r0 and cp. It replaces the context |
179 // passed to us. It's saved in the stack and kept live in cp. | 179 // passed to us. It's saved in the stack and kept live in cp. |
180 __ mov(cp, r0); | 180 __ mov(cp, r0); |
181 __ str(r0, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 181 __ str(r0, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
182 // Copy any necessary parameters into the context. | 182 // Copy any necessary parameters into the context. |
183 int num_parameters = info()->scope()->num_parameters(); | 183 int num_parameters = scope()->num_parameters(); |
184 int first_parameter = info()->scope()->has_this_declaration() ? -1 : 0; | 184 int first_parameter = scope()->has_this_declaration() ? -1 : 0; |
185 for (int i = first_parameter; i < num_parameters; i++) { | 185 for (int i = first_parameter; i < num_parameters; i++) { |
186 Variable* var = (i == -1) ? info()->scope()->receiver() | 186 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); |
187 : info()->scope()->parameter(i); | |
188 if (var->IsContextSlot()) { | 187 if (var->IsContextSlot()) { |
189 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 188 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
190 (num_parameters - 1 - i) * kPointerSize; | 189 (num_parameters - 1 - i) * kPointerSize; |
191 // Load parameter from stack. | 190 // Load parameter from stack. |
192 __ ldr(r0, MemOperand(fp, parameter_offset)); | 191 __ ldr(r0, MemOperand(fp, parameter_offset)); |
193 // Store it in the context. | 192 // Store it in the context. |
194 MemOperand target = ContextMemOperand(cp, var->index()); | 193 MemOperand target = ContextMemOperand(cp, var->index()); |
195 __ str(r0, target); | 194 __ str(r0, target); |
196 // Update the write barrier. This clobbers r3 and r0. | 195 // Update the write barrier. This clobbers r3 and r0. |
197 if (need_write_barrier) { | 196 if (need_write_barrier) { |
(...skipping 5329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5527 __ ldr(result, FieldMemOperand(scratch, | 5526 __ ldr(result, FieldMemOperand(scratch, |
5528 FixedArray::kHeaderSize - kPointerSize)); | 5527 FixedArray::kHeaderSize - kPointerSize)); |
5529 __ bind(deferred->exit()); | 5528 __ bind(deferred->exit()); |
5530 __ bind(&done); | 5529 __ bind(&done); |
5531 } | 5530 } |
5532 | 5531 |
5533 #undef __ | 5532 #undef __ |
5534 | 5533 |
5535 } // namespace internal | 5534 } // namespace internal |
5536 } // namespace v8 | 5535 } // namespace v8 |
OLD | NEW |