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

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 1130733003: Resolve references to "this" the same way as normal variables (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Add mips/mips64. Fix expectation in nosnap deserialization test. Fix scratch regiser use on x64. 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/ia32/full-codegen-ia32.cc ('k') | src/mips/full-codegen-mips.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 #ifdef DEBUG 134 #ifdef DEBUG
135 if (strlen(FLAG_stop_at) > 0 && 135 if (strlen(FLAG_stop_at) > 0 &&
136 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { 136 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
137 __ int3(); 137 __ int3();
138 } 138 }
139 #endif 139 #endif
140 140
141 // Sloppy mode functions and builtins need to replace the receiver with the 141 // Sloppy mode functions and builtins need to replace the receiver with the
142 // global proxy when called as functions (without an explicit receiver 142 // global proxy when called as functions (without an explicit receiver
143 // object). 143 // object).
144 if (is_sloppy(info_->language_mode()) && info()->MayUseThis() && 144 if (is_sloppy(info()->language_mode()) && info()->MayUseThis() &&
145 !info_->is_native()) { 145 !info()->is_native() && info()->scope()->has_this_declaration()) {
146 Label ok; 146 Label ok;
147 // +1 for return address. 147 // +1 for return address.
148 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; 148 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize;
149 __ mov(ecx, Operand(esp, receiver_offset)); 149 __ mov(ecx, Operand(esp, receiver_offset));
150 150
151 __ cmp(ecx, isolate()->factory()->undefined_value()); 151 __ cmp(ecx, isolate()->factory()->undefined_value());
152 __ j(not_equal, &ok, Label::kNear); 152 __ j(not_equal, &ok, Label::kNear);
153 153
154 __ mov(ecx, GlobalObjectOperand()); 154 __ mov(ecx, GlobalObjectOperand());
155 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalProxyOffset)); 155 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalProxyOffset));
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 __ CallRuntime(Runtime::kNewFunctionContext, 1); 268 __ CallRuntime(Runtime::kNewFunctionContext, 1);
269 } 269 }
270 RecordSafepoint(Safepoint::kNoLazyDeopt); 270 RecordSafepoint(Safepoint::kNoLazyDeopt);
271 // Context is returned in eax. It replaces the context passed to us. 271 // Context is returned in eax. It replaces the context passed to us.
272 // It's saved in the stack and kept live in esi. 272 // It's saved in the stack and kept live in esi.
273 __ mov(esi, eax); 273 __ mov(esi, eax);
274 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); 274 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax);
275 275
276 // Copy parameters into context if necessary. 276 // Copy parameters into context if necessary.
277 int num_parameters = scope()->num_parameters(); 277 int num_parameters = scope()->num_parameters();
278 for (int i = 0; i < num_parameters; i++) { 278 int first_parameter = scope()->has_this_declaration() ? -1 : 0;
279 Variable* var = scope()->parameter(i); 279 for (int i = first_parameter; i < num_parameters; i++) {
280 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i);
280 if (var->IsContextSlot()) { 281 if (var->IsContextSlot()) {
281 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 282 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
282 (num_parameters - 1 - i) * kPointerSize; 283 (num_parameters - 1 - i) * kPointerSize;
283 // Load parameter from stack. 284 // Load parameter from stack.
284 __ mov(eax, Operand(ebp, parameter_offset)); 285 __ mov(eax, Operand(ebp, parameter_offset));
285 // Store it in the context. 286 // Store it in the context.
286 int context_offset = Context::SlotOffset(var->index()); 287 int context_offset = Context::SlotOffset(var->index());
287 __ mov(Operand(esi, context_offset), eax); 288 __ mov(Operand(esi, context_offset), eax);
288 // Update the write barrier. This clobbers eax and ebx. 289 // Update the write barrier. This clobbers eax and ebx.
289 if (need_write_barrier) { 290 if (need_write_barrier) {
(...skipping 5477 matching lines...) Expand 10 before | Expand all | Expand 10 after
5767 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5768 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5768 RecordSafepoint(Safepoint::kNoLazyDeopt); 5769 RecordSafepoint(Safepoint::kNoLazyDeopt);
5769 } 5770 }
5770 5771
5771 5772
5772 #undef __ 5773 #undef __
5773 5774
5774 } } // namespace v8::internal 5775 } } // namespace v8::internal
5775 5776
5776 #endif // V8_TARGET_ARCH_IA32 5777 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698