| 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 2807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3044 if (arg_count > 0) { | 3043 if (arg_count > 0) { |
| 3045 __ LoadP(r8, MemOperand(sp, arg_count * kPointerSize), r0); | 3044 __ LoadP(r8, MemOperand(sp, arg_count * kPointerSize), r0); |
| 3046 } else { | 3045 } else { |
| 3047 __ LoadRoot(r8, Heap::kUndefinedValueRootIndex); | 3046 __ LoadRoot(r8, Heap::kUndefinedValueRootIndex); |
| 3048 } | 3047 } |
| 3049 | 3048 |
| 3050 // r7: the receiver of the enclosing function. | 3049 // r7: the receiver of the enclosing function. |
| 3051 __ LoadP(r7, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 3050 __ LoadP(r7, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 3052 | 3051 |
| 3053 // r6: the receiver of the enclosing function. | 3052 // r6: the receiver of the enclosing function. |
| 3054 Variable* this_var = scope()->LookupThis(); | 3053 int receiver_offset = 2 + info_->scope()->num_parameters(); |
| 3055 DCHECK_NOT_NULL(this_var); | 3054 __ LoadP(r6, MemOperand(fp, receiver_offset * kPointerSize), r0); |
| 3056 GetVar(r6, this_var); | |
| 3057 | 3055 |
| 3058 // r5: language mode. | 3056 // r5: language mode. |
| 3059 __ LoadSmiLiteral(r5, Smi::FromInt(language_mode())); | 3057 __ LoadSmiLiteral(r5, Smi::FromInt(language_mode())); |
| 3060 | 3058 |
| 3061 // r4: the start position of the scope the calls resides in. | 3059 // r4: the start position of the scope the calls resides in. |
| 3062 __ LoadSmiLiteral(r4, Smi::FromInt(scope()->start_position())); | 3060 __ LoadSmiLiteral(r4, Smi::FromInt(scope()->start_position())); |
| 3063 | 3061 |
| 3064 // Do the runtime call. | 3062 // Do the runtime call. |
| 3065 __ Push(r8, r7, r6, r5, r4); | 3063 __ Push(r8, r7, r6, r5, r4); |
| 3066 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); | 3064 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); |
| (...skipping 2388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5455 return ON_STACK_REPLACEMENT; | 5453 return ON_STACK_REPLACEMENT; |
| 5456 } | 5454 } |
| 5457 | 5455 |
| 5458 DCHECK(interrupt_address == | 5456 DCHECK(interrupt_address == |
| 5459 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5457 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 5460 return OSR_AFTER_STACK_CHECK; | 5458 return OSR_AFTER_STACK_CHECK; |
| 5461 } | 5459 } |
| 5462 } | 5460 } |
| 5463 } // namespace v8::internal | 5461 } // namespace v8::internal |
| 5464 #endif // V8_TARGET_ARCH_PPC | 5462 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |