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

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

Issue 1132513005: Revert of 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') | no next file with comments »
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() && 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
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 2806 matching lines...) Expand 10 before | Expand all | Expand 10 after
3043 if (arg_count > 0) { 3042 if (arg_count > 0) {
3044 __ LoadP(r8, MemOperand(sp, arg_count * kPointerSize), r0); 3043 __ LoadP(r8, MemOperand(sp, arg_count * kPointerSize), r0);
3045 } else { 3044 } else {
3046 __ LoadRoot(r8, Heap::kUndefinedValueRootIndex); 3045 __ LoadRoot(r8, Heap::kUndefinedValueRootIndex);
3047 } 3046 }
3048 3047
3049 // r7: the receiver of the enclosing function. 3048 // r7: the receiver of the enclosing function.
3050 __ LoadP(r7, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 3049 __ LoadP(r7, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3051 3050
3052 // r6: the receiver of the enclosing function. 3051 // r6: the receiver of the enclosing function.
3053 Variable* this_var = scope()->LookupThis(); 3052 int receiver_offset = 2 + info_->scope()->num_parameters();
3054 DCHECK_NOT_NULL(this_var); 3053 __ LoadP(r6, MemOperand(fp, receiver_offset * kPointerSize), r0);
3055 GetVar(r6, this_var);
3056 3054
3057 // r5: language mode. 3055 // r5: language mode.
3058 __ LoadSmiLiteral(r5, Smi::FromInt(language_mode())); 3056 __ LoadSmiLiteral(r5, Smi::FromInt(language_mode()));
3059 3057
3060 // r4: the start position of the scope the calls resides in. 3058 // r4: the start position of the scope the calls resides in.
3061 __ LoadSmiLiteral(r4, Smi::FromInt(scope()->start_position())); 3059 __ LoadSmiLiteral(r4, Smi::FromInt(scope()->start_position()));
3062 3060
3063 // Do the runtime call. 3061 // Do the runtime call.
3064 __ Push(r8, r7, r6, r5, r4); 3062 __ Push(r8, r7, r6, r5, r4);
3065 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); 3063 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6);
(...skipping 2385 matching lines...) Expand 10 before | Expand all | Expand 10 after
5451 return ON_STACK_REPLACEMENT; 5449 return ON_STACK_REPLACEMENT;
5452 } 5450 }
5453 5451
5454 DCHECK(interrupt_address == 5452 DCHECK(interrupt_address ==
5455 isolate->builtins()->OsrAfterStackCheck()->entry()); 5453 isolate->builtins()->OsrAfterStackCheck()->entry());
5456 return OSR_AFTER_STACK_CHECK; 5454 return OSR_AFTER_STACK_CHECK;
5457 } 5455 }
5458 } 5456 }
5459 } // namespace v8::internal 5457 } // namespace v8::internal
5460 #endif // V8_TARGET_ARCH_PPC 5458 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | src/ppc/lithium-codegen-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698