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

Side by Side Diff: src/ppc/lithium-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 | « src/ppc/full-codegen-ppc.cc ('k') | no next file » | 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 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/cpu-profiler.h" 10 #include "src/cpu-profiler.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // cp: Callee's context. 112 // cp: Callee's context.
113 // pp: Callee's constant pool pointer (if enabled) 113 // pp: Callee's constant pool pointer (if enabled)
114 // fp: Caller's frame pointer. 114 // fp: Caller's frame pointer.
115 // lr: Caller's pc. 115 // lr: Caller's pc.
116 // ip: Our own function entry (required by the prologue) 116 // ip: Our own function entry (required by the prologue)
117 117
118 // Sloppy mode functions and builtins need to replace the receiver with the 118 // Sloppy mode functions and builtins need to replace the receiver with the
119 // global proxy when called as functions (without an explicit receiver 119 // global proxy when called as functions (without an explicit receiver
120 // object). 120 // object).
121 if (is_sloppy(info_->language_mode()) && info()->MayUseThis() && 121 if (is_sloppy(info_->language_mode()) && info()->MayUseThis() &&
122 !info_->is_native()) { 122 !info_->is_native() && info_->scope()->has_this_declaration()) {
wingo 2015/05/06 15:56:43 Might want to use info() consistently here
123 Label ok; 123 Label ok;
124 int receiver_offset = info_->scope()->num_parameters() * kPointerSize; 124 int receiver_offset = info_->scope()->num_parameters() * kPointerSize;
125 __ LoadP(r5, MemOperand(sp, receiver_offset)); 125 __ LoadP(r5, MemOperand(sp, receiver_offset));
126 __ CompareRoot(r5, Heap::kUndefinedValueRootIndex); 126 __ CompareRoot(r5, Heap::kUndefinedValueRootIndex);
127 __ bne(&ok); 127 __ bne(&ok);
128 128
129 __ LoadP(r5, GlobalObjectOperand()); 129 __ LoadP(r5, GlobalObjectOperand());
130 __ LoadP(r5, FieldMemOperand(r5, GlobalObject::kGlobalProxyOffset)); 130 __ LoadP(r5, FieldMemOperand(r5, GlobalObject::kGlobalProxyOffset));
131 131
132 __ StoreP(r5, MemOperand(sp, receiver_offset)); 132 __ StoreP(r5, MemOperand(sp, receiver_offset));
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 __ push(r4); 192 __ push(r4);
193 __ CallRuntime(Runtime::kNewFunctionContext, 1); 193 __ CallRuntime(Runtime::kNewFunctionContext, 1);
194 } 194 }
195 RecordSafepoint(Safepoint::kNoLazyDeopt); 195 RecordSafepoint(Safepoint::kNoLazyDeopt);
196 // Context is returned in both r3 and cp. It replaces the context 196 // Context is returned in both r3 and cp. It replaces the context
197 // passed to us. It's saved in the stack and kept live in cp. 197 // passed to us. It's saved in the stack and kept live in cp.
198 __ mr(cp, r3); 198 __ mr(cp, r3);
199 __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset)); 199 __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset));
200 // Copy any necessary parameters into the context. 200 // Copy any necessary parameters into the context.
201 int num_parameters = scope()->num_parameters(); 201 int num_parameters = scope()->num_parameters();
202 for (int i = 0; i < num_parameters; i++) { 202 int first_parameter = scope()->has_this_declaration() ? -1 : 0;
203 Variable* var = scope()->parameter(i); 203 for (int i = first_parameter; i < num_parameters; i++) {
204 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i);
204 if (var->IsContextSlot()) { 205 if (var->IsContextSlot()) {
205 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 206 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
206 (num_parameters - 1 - i) * kPointerSize; 207 (num_parameters - 1 - i) * kPointerSize;
207 // Load parameter from stack. 208 // Load parameter from stack.
208 __ LoadP(r3, MemOperand(fp, parameter_offset)); 209 __ LoadP(r3, MemOperand(fp, parameter_offset));
209 // Store it in the context. 210 // Store it in the context.
210 MemOperand target = ContextOperand(cp, var->index()); 211 MemOperand target = ContextOperand(cp, var->index());
211 __ StoreP(r3, target, r0); 212 __ StoreP(r3, target, r0);
212 // Update the write barrier. This clobbers r6 and r3. 213 // Update the write barrier. This clobbers r6 and r3.
213 if (need_write_barrier) { 214 if (need_write_barrier) {
(...skipping 5991 matching lines...) Expand 10 before | Expand all | Expand 10 after
6205 __ Push(scope_info); 6206 __ Push(scope_info);
6206 __ push(ToRegister(instr->function())); 6207 __ push(ToRegister(instr->function()));
6207 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6208 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6208 RecordSafepoint(Safepoint::kNoLazyDeopt); 6209 RecordSafepoint(Safepoint::kNoLazyDeopt);
6209 } 6210 }
6210 6211
6211 6212
6212 #undef __ 6213 #undef __
6213 } 6214 }
6214 } // namespace v8::internal 6215 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ppc/full-codegen-ppc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698