OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 #ifdef DEBUG | 116 #ifdef DEBUG |
117 if (strlen(FLAG_stop_at) > 0 && | 117 if (strlen(FLAG_stop_at) > 0 && |
118 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 118 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
119 __ stop("stop-at"); | 119 __ stop("stop-at"); |
120 } | 120 } |
121 #endif | 121 #endif |
122 | 122 |
123 // Sloppy mode functions and builtins need to replace the receiver with the | 123 // Sloppy mode functions and builtins need to replace the receiver with the |
124 // global proxy when called as functions (without an explicit receiver | 124 // global proxy when called as functions (without an explicit receiver |
125 // object). | 125 // object). |
126 if (info->strict_mode() == SLOPPY && !info->is_native()) { | 126 if (info->strict_mode() == SLOPPY && !info->is_native() && |
| 127 info->scope()->has_this_declaration()) { |
127 Label ok; | 128 Label ok; |
128 int receiver_offset = info->scope()->num_parameters() * kPointerSize; | 129 int receiver_offset = info->scope()->num_parameters() * kPointerSize; |
129 __ LoadP(r5, MemOperand(sp, receiver_offset), r0); | 130 __ LoadP(r5, MemOperand(sp, receiver_offset), r0); |
130 __ CompareRoot(r5, Heap::kUndefinedValueRootIndex); | 131 __ CompareRoot(r5, Heap::kUndefinedValueRootIndex); |
131 __ bne(&ok); | 132 __ bne(&ok); |
132 | 133 |
133 __ LoadP(r5, GlobalObjectOperand()); | 134 __ LoadP(r5, GlobalObjectOperand()); |
134 __ LoadP(r5, FieldMemOperand(r5, GlobalObject::kGlobalProxyOffset)); | 135 __ LoadP(r5, FieldMemOperand(r5, GlobalObject::kGlobalProxyOffset)); |
135 | 136 |
136 __ StoreP(r5, MemOperand(sp, receiver_offset), r0); | 137 __ StoreP(r5, MemOperand(sp, receiver_offset), r0); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 __ push(r4); | 214 __ push(r4); |
214 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 215 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
215 } | 216 } |
216 function_in_register = false; | 217 function_in_register = false; |
217 // Context is returned in r3. It replaces the context passed to us. | 218 // Context is returned in r3. It replaces the context passed to us. |
218 // It's saved in the stack and kept live in cp. | 219 // It's saved in the stack and kept live in cp. |
219 __ mr(cp, r3); | 220 __ mr(cp, r3); |
220 __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 221 __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
221 // Copy any necessary parameters into the context. | 222 // Copy any necessary parameters into the context. |
222 int num_parameters = info->scope()->num_parameters(); | 223 int num_parameters = info->scope()->num_parameters(); |
223 for (int i = 0; i < num_parameters; i++) { | 224 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0; |
224 Variable* var = scope()->parameter(i); | 225 for (int i = first_parameter; i < num_parameters; i++) { |
| 226 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); |
225 if (var->IsContextSlot()) { | 227 if (var->IsContextSlot()) { |
226 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 228 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
227 (num_parameters - 1 - i) * kPointerSize; | 229 (num_parameters - 1 - i) * kPointerSize; |
228 // Load parameter from stack. | 230 // Load parameter from stack. |
229 __ LoadP(r3, MemOperand(fp, parameter_offset), r0); | 231 __ LoadP(r3, MemOperand(fp, parameter_offset), r0); |
230 // Store it in the context. | 232 // Store it in the context. |
231 MemOperand target = ContextOperand(cp, var->index()); | 233 MemOperand target = ContextOperand(cp, var->index()); |
232 __ StoreP(r3, target, r0); | 234 __ StoreP(r3, target, r0); |
233 | 235 |
234 // Update the write barrier. | 236 // Update the write barrier. |
(...skipping 5048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5283 return ON_STACK_REPLACEMENT; | 5285 return ON_STACK_REPLACEMENT; |
5284 } | 5286 } |
5285 | 5287 |
5286 DCHECK(interrupt_address == | 5288 DCHECK(interrupt_address == |
5287 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5289 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5288 return OSR_AFTER_STACK_CHECK; | 5290 return OSR_AFTER_STACK_CHECK; |
5289 } | 5291 } |
5290 } | 5292 } |
5291 } // namespace v8::internal | 5293 } // namespace v8::internal |
5292 #endif // V8_TARGET_ARCH_PPC | 5294 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |