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

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

Issue 1140633003: Reapply "Resolve references to "this" the same way as normal variables"" (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: ScopeInfo records slot of "this" binding; formatting 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/heap/heap.h ('k') | src/ia32/lithium-codegen-ia32.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/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 __ CallRuntime(Runtime::kNewFunctionContext, 1); 203 __ CallRuntime(Runtime::kNewFunctionContext, 1);
204 } 204 }
205 function_in_register = false; 205 function_in_register = false;
206 // Context is returned in eax. It replaces the context passed to us. 206 // Context is returned in eax. It replaces the context passed to us.
207 // It's saved in the stack and kept live in esi. 207 // It's saved in the stack and kept live in esi.
208 __ mov(esi, eax); 208 __ mov(esi, eax);
209 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); 209 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax);
210 210
211 // Copy parameters into context if necessary. 211 // Copy parameters into context if necessary.
212 int num_parameters = info->scope()->num_parameters(); 212 int num_parameters = info->scope()->num_parameters();
213 for (int i = 0; i < num_parameters; i++) { 213 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0;
214 Variable* var = scope()->parameter(i); 214 for (int i = first_parameter; i < num_parameters; i++) {
215 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i);
215 if (var->IsContextSlot()) { 216 if (var->IsContextSlot()) {
216 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 217 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
217 (num_parameters - 1 - i) * kPointerSize; 218 (num_parameters - 1 - i) * kPointerSize;
218 // Load parameter from stack. 219 // Load parameter from stack.
219 __ mov(eax, Operand(ebp, parameter_offset)); 220 __ mov(eax, Operand(ebp, parameter_offset));
220 // Store it in the context. 221 // Store it in the context.
221 int context_offset = Context::SlotOffset(var->index()); 222 int context_offset = Context::SlotOffset(var->index());
222 __ mov(Operand(esi, context_offset), eax); 223 __ mov(Operand(esi, context_offset), eax);
223 // Update the write barrier. This clobbers eax and ebx. 224 // Update the write barrier. This clobbers eax and ebx.
224 if (need_write_barrier) { 225 if (need_write_barrier) {
(...skipping 2706 matching lines...) Expand 10 before | Expand all | Expand 10 after
2931 // Push copy of the first argument or undefined if it doesn't exist. 2932 // Push copy of the first argument or undefined if it doesn't exist.
2932 if (arg_count > 0) { 2933 if (arg_count > 0) {
2933 __ push(Operand(esp, arg_count * kPointerSize)); 2934 __ push(Operand(esp, arg_count * kPointerSize));
2934 } else { 2935 } else {
2935 __ push(Immediate(isolate()->factory()->undefined_value())); 2936 __ push(Immediate(isolate()->factory()->undefined_value()));
2936 } 2937 }
2937 2938
2938 // Push the enclosing function. 2939 // Push the enclosing function.
2939 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 2940 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
2940 // Push the receiver of the enclosing function. 2941 // Push the receiver of the enclosing function.
2941 __ push(Operand(ebp, (2 + info_->scope()->num_parameters()) * kPointerSize)); 2942 Variable* this_var = scope()->LookupThis();
2943 DCHECK_NOT_NULL(this_var);
2944 __ push(VarOperand(this_var, ecx));
2942 // Push the language mode. 2945 // Push the language mode.
2943 __ push(Immediate(Smi::FromInt(language_mode()))); 2946 __ push(Immediate(Smi::FromInt(language_mode())));
2944 2947
2945 // Push the start position of the scope the calls resides in. 2948 // Push the start position of the scope the calls resides in.
2946 __ push(Immediate(Smi::FromInt(scope()->start_position()))); 2949 __ push(Immediate(Smi::FromInt(scope()->start_position())));
2947 2950
2948 // Do the runtime call. 2951 // Do the runtime call.
2949 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); 2952 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6);
2950 } 2953 }
2951 2954
(...skipping 2394 matching lines...) Expand 10 before | Expand all | Expand 10 after
5346 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5349 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5347 Assembler::target_address_at(call_target_address, 5350 Assembler::target_address_at(call_target_address,
5348 unoptimized_code)); 5351 unoptimized_code));
5349 return OSR_AFTER_STACK_CHECK; 5352 return OSR_AFTER_STACK_CHECK;
5350 } 5353 }
5351 5354
5352 5355
5353 } } // namespace v8::internal 5356 } } // namespace v8::internal
5354 5357
5355 #endif // V8_TARGET_ARCH_IA32 5358 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698