Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/ppc/full-codegen-ppc.cc

Issue 1129803003: PPC: Resolve references to "this" the same way as normal variables (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/ppc/lithium-codegen-ppc.cc » ('j') | src/ppc/lithium-codegen-ppc.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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()) { 127 info->MayUseThis() && info->scope()->has_this_declaration()) {
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
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 for (int i = 0; i < num_parameters; i++) { 224 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0;
225 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);
226 if (var->IsContextSlot()) { 227 if (var->IsContextSlot()) {
227 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 228 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
228 (num_parameters - 1 - i) * kPointerSize; 229 (num_parameters - 1 - i) * kPointerSize;
229 // Load parameter from stack. 230 // Load parameter from stack.
230 __ LoadP(r3, MemOperand(fp, parameter_offset), r0); 231 __ LoadP(r3, MemOperand(fp, parameter_offset), r0);
231 // Store it in the context. 232 // Store it in the context.
232 MemOperand target = ContextOperand(cp, var->index()); 233 MemOperand target = ContextOperand(cp, var->index());
233 __ StoreP(r3, target, r0); 234 __ StoreP(r3, target, r0);
234 235
235 // Update the write barrier. 236 // Update the write barrier.
(...skipping 2806 matching lines...) Expand 10 before | Expand all | Expand 10 after
3042 if (arg_count > 0) { 3043 if (arg_count > 0) {
3043 __ LoadP(r8, MemOperand(sp, arg_count * kPointerSize), r0); 3044 __ LoadP(r8, MemOperand(sp, arg_count * kPointerSize), r0);
3044 } else { 3045 } else {
3045 __ LoadRoot(r8, Heap::kUndefinedValueRootIndex); 3046 __ LoadRoot(r8, Heap::kUndefinedValueRootIndex);
3046 } 3047 }
3047 3048
3048 // r7: the receiver of the enclosing function. 3049 // r7: the receiver of the enclosing function.
3049 __ LoadP(r7, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 3050 __ LoadP(r7, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3050 3051
3051 // r6: the receiver of the enclosing function. 3052 // r6: the receiver of the enclosing function.
3052 int receiver_offset = 2 + info_->scope()->num_parameters(); 3053 Variable* this_var = scope()->LookupThis();
3053 __ LoadP(r6, MemOperand(fp, receiver_offset * kPointerSize), r0); 3054 DCHECK_NOT_NULL(this_var);
3055 GetVar(r6, this_var);
3054 3056
3055 // r5: language mode. 3057 // r5: language mode.
3056 __ LoadSmiLiteral(r5, Smi::FromInt(language_mode())); 3058 __ LoadSmiLiteral(r5, Smi::FromInt(language_mode()));
3057 3059
3058 // r4: the start position of the scope the calls resides in. 3060 // r4: the start position of the scope the calls resides in.
3059 __ LoadSmiLiteral(r4, Smi::FromInt(scope()->start_position())); 3061 __ LoadSmiLiteral(r4, Smi::FromInt(scope()->start_position()));
3060 3062
3061 // Do the runtime call. 3063 // Do the runtime call.
3062 __ Push(r8, r7, r6, r5, r4); 3064 __ Push(r8, r7, r6, r5, r4);
3063 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); 3065 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6);
(...skipping 2385 matching lines...) Expand 10 before | Expand all | Expand 10 after
5449 return ON_STACK_REPLACEMENT; 5451 return ON_STACK_REPLACEMENT;
5450 } 5452 }
5451 5453
5452 DCHECK(interrupt_address == 5454 DCHECK(interrupt_address ==
5453 isolate->builtins()->OsrAfterStackCheck()->entry()); 5455 isolate->builtins()->OsrAfterStackCheck()->entry());
5454 return OSR_AFTER_STACK_CHECK; 5456 return OSR_AFTER_STACK_CHECK;
5455 } 5457 }
5456 } 5458 }
5457 } // namespace v8::internal 5459 } // namespace v8::internal
5458 #endif // V8_TARGET_ARCH_PPC 5460 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | src/ppc/lithium-codegen-ppc.cc » ('j') | src/ppc/lithium-codegen-ppc.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698