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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 #ifdef DEBUG | 117 #ifdef DEBUG |
118 if (strlen(FLAG_stop_at) > 0 && | 118 if (strlen(FLAG_stop_at) > 0 && |
119 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 119 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
120 __ Debug("stop-at", __LINE__, BREAK); | 120 __ Debug("stop-at", __LINE__, BREAK); |
121 } | 121 } |
122 #endif | 122 #endif |
123 | 123 |
124 // Sloppy mode functions and builtins need to replace the receiver with the | 124 // Sloppy mode functions and builtins need to replace the receiver with the |
125 // global proxy when called as functions (without an explicit receiver | 125 // global proxy when called as functions (without an explicit receiver |
126 // object). | 126 // object). |
127 if (info->strict_mode() == SLOPPY && !info->is_native()) { | 127 if (info->strict_mode() == SLOPPY && !info->is_native() && |
| 128 info->scope()->has_this_declaration()) { |
128 Label ok; | 129 Label ok; |
129 int receiver_offset = info->scope()->num_parameters() * kXRegSize; | 130 int receiver_offset = info->scope()->num_parameters() * kXRegSize; |
130 __ Peek(x10, receiver_offset); | 131 __ Peek(x10, receiver_offset); |
131 __ JumpIfNotRoot(x10, Heap::kUndefinedValueRootIndex, &ok); | 132 __ JumpIfNotRoot(x10, Heap::kUndefinedValueRootIndex, &ok); |
132 | 133 |
133 __ Ldr(x10, GlobalObjectMemOperand()); | 134 __ Ldr(x10, GlobalObjectMemOperand()); |
134 __ Ldr(x10, FieldMemOperand(x10, GlobalObject::kGlobalProxyOffset)); | 135 __ Ldr(x10, FieldMemOperand(x10, GlobalObject::kGlobalProxyOffset)); |
135 __ Poke(x10, receiver_offset); | 136 __ Poke(x10, receiver_offset); |
136 | 137 |
137 __ Bind(&ok); | 138 __ Bind(&ok); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 __ Push(x1); | 210 __ Push(x1); |
210 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 211 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
211 } | 212 } |
212 function_in_register_x1 = false; | 213 function_in_register_x1 = false; |
213 // Context is returned in x0. It replaces the context passed to us. | 214 // Context is returned in x0. It replaces the context passed to us. |
214 // It's saved in the stack and kept live in cp. | 215 // It's saved in the stack and kept live in cp. |
215 __ Mov(cp, x0); | 216 __ Mov(cp, x0); |
216 __ Str(x0, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 217 __ Str(x0, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
217 // Copy any necessary parameters into the context. | 218 // Copy any necessary parameters into the context. |
218 int num_parameters = info->scope()->num_parameters(); | 219 int num_parameters = info->scope()->num_parameters(); |
219 for (int i = 0; i < num_parameters; i++) { | 220 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0; |
220 Variable* var = scope()->parameter(i); | 221 for (int i = first_parameter; i < num_parameters; i++) { |
| 222 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); |
221 if (var->IsContextSlot()) { | 223 if (var->IsContextSlot()) { |
222 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 224 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
223 (num_parameters - 1 - i) * kPointerSize; | 225 (num_parameters - 1 - i) * kPointerSize; |
224 // Load parameter from stack. | 226 // Load parameter from stack. |
225 __ Ldr(x10, MemOperand(fp, parameter_offset)); | 227 __ Ldr(x10, MemOperand(fp, parameter_offset)); |
226 // Store it in the context. | 228 // Store it in the context. |
227 MemOperand target = ContextMemOperand(cp, var->index()); | 229 MemOperand target = ContextMemOperand(cp, var->index()); |
228 __ Str(x10, target); | 230 __ Str(x10, target); |
229 | 231 |
230 // Update the write barrier. | 232 // Update the write barrier. |
(...skipping 5159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5390 return previous_; | 5392 return previous_; |
5391 } | 5393 } |
5392 | 5394 |
5393 | 5395 |
5394 #undef __ | 5396 #undef __ |
5395 | 5397 |
5396 | 5398 |
5397 } } // namespace v8::internal | 5399 } } // namespace v8::internal |
5398 | 5400 |
5399 #endif // V8_TARGET_ARCH_ARM64 | 5401 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |