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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 (is_sloppy(info->language_mode()) && !info->is_native() && | 126 if (is_sloppy(info->language_mode()) && !info->is_native() && |
127 info->MayUseThis() && info->scope()->has_this_declaration()) { | 127 info->MayUseThis()) { |
128 Label ok; | 128 Label ok; |
129 int receiver_offset = info->scope()->num_parameters() * kPointerSize; | 129 int receiver_offset = info->scope()->num_parameters() * kPointerSize; |
130 __ LoadP(r5, MemOperand(sp, receiver_offset), r0); | 130 __ LoadP(r5, MemOperand(sp, receiver_offset), r0); |
131 __ CompareRoot(r5, Heap::kUndefinedValueRootIndex); | 131 __ CompareRoot(r5, Heap::kUndefinedValueRootIndex); |
132 __ bne(&ok); | 132 __ bne(&ok); |
133 | 133 |
134 __ LoadP(r5, GlobalObjectOperand()); | 134 __ LoadP(r5, GlobalObjectOperand()); |
135 __ LoadP(r5, FieldMemOperand(r5, GlobalObject::kGlobalProxyOffset)); | 135 __ LoadP(r5, FieldMemOperand(r5, GlobalObject::kGlobalProxyOffset)); |
136 | 136 |
137 __ 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... |
214 __ push(r4); | 214 __ push(r4); |
215 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 215 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
216 } | 216 } |
217 function_in_register = false; | 217 function_in_register = false; |
218 // 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. |
219 // It's saved in the stack and kept live in cp. | 219 // It's saved in the stack and kept live in cp. |
220 __ mr(cp, r3); | 220 __ mr(cp, r3); |
221 __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 221 __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
222 // Copy any necessary parameters into the context. | 222 // Copy any necessary parameters into the context. |
223 int num_parameters = info->scope()->num_parameters(); | 223 int num_parameters = info->scope()->num_parameters(); |
224 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0; | 224 for (int i = 0; i < num_parameters; i++) { |
225 for (int i = first_parameter; i < num_parameters; i++) { | 225 Variable* var = scope()->parameter(i); |
226 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); | |
227 if (var->IsContextSlot()) { | 226 if (var->IsContextSlot()) { |
228 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 227 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
229 (num_parameters - 1 - i) * kPointerSize; | 228 (num_parameters - 1 - i) * kPointerSize; |
230 // Load parameter from stack. | 229 // Load parameter from stack. |
231 __ LoadP(r3, MemOperand(fp, parameter_offset), r0); | 230 __ LoadP(r3, MemOperand(fp, parameter_offset), r0); |
232 // Store it in the context. | 231 // Store it in the context. |
233 MemOperand target = ContextOperand(cp, var->index()); | 232 MemOperand target = ContextOperand(cp, var->index()); |
234 __ StoreP(r3, target, r0); | 233 __ StoreP(r3, target, r0); |
235 | 234 |
236 // Update the write barrier. | 235 // Update the write barrier. |
(...skipping 2785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3022 if (arg_count > 0) { | 3021 if (arg_count > 0) { |
3023 __ LoadP(r8, MemOperand(sp, arg_count * kPointerSize), r0); | 3022 __ LoadP(r8, MemOperand(sp, arg_count * kPointerSize), r0); |
3024 } else { | 3023 } else { |
3025 __ LoadRoot(r8, Heap::kUndefinedValueRootIndex); | 3024 __ LoadRoot(r8, Heap::kUndefinedValueRootIndex); |
3026 } | 3025 } |
3027 | 3026 |
3028 // r7: the receiver of the enclosing function. | 3027 // r7: the receiver of the enclosing function. |
3029 __ LoadP(r7, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 3028 __ LoadP(r7, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
3030 | 3029 |
3031 // r6: the receiver of the enclosing function. | 3030 // r6: the receiver of the enclosing function. |
3032 Variable* this_var = scope()->LookupThis(); | 3031 int receiver_offset = 2 + info_->scope()->num_parameters(); |
3033 DCHECK_NOT_NULL(this_var); | 3032 __ LoadP(r6, MemOperand(fp, receiver_offset * kPointerSize), r0); |
3034 GetVar(r6, this_var); | |
3035 | 3033 |
3036 // r5: language mode. | 3034 // r5: language mode. |
3037 __ LoadSmiLiteral(r5, Smi::FromInt(language_mode())); | 3035 __ LoadSmiLiteral(r5, Smi::FromInt(language_mode())); |
3038 | 3036 |
3039 // r4: the start position of the scope the calls resides in. | 3037 // r4: the start position of the scope the calls resides in. |
3040 __ LoadSmiLiteral(r4, Smi::FromInt(scope()->start_position())); | 3038 __ LoadSmiLiteral(r4, Smi::FromInt(scope()->start_position())); |
3041 | 3039 |
3042 // Do the runtime call. | 3040 // Do the runtime call. |
3043 __ Push(r8, r7, r6, r5, r4); | 3041 __ Push(r8, r7, r6, r5, r4); |
3044 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); | 3042 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); |
(...skipping 2382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5427 return ON_STACK_REPLACEMENT; | 5425 return ON_STACK_REPLACEMENT; |
5428 } | 5426 } |
5429 | 5427 |
5430 DCHECK(interrupt_address == | 5428 DCHECK(interrupt_address == |
5431 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5429 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5432 return OSR_AFTER_STACK_CHECK; | 5430 return OSR_AFTER_STACK_CHECK; |
5433 } | 5431 } |
5434 } | 5432 } |
5435 } // namespace v8::internal | 5433 } // namespace v8::internal |
5436 #endif // V8_TARGET_ARCH_PPC | 5434 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |