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/mips/full-codegen-mips.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/ia32/lithium-codegen-ia32.cc ('k') | src/mips/lithium-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_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 if (strlen(FLAG_stop_at) > 0 && 128 if (strlen(FLAG_stop_at) > 0 &&
129 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { 129 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
130 __ stop("stop-at"); 130 __ stop("stop-at");
131 } 131 }
132 #endif 132 #endif
133 133
134 // Sloppy mode functions and builtins need to replace the receiver with the 134 // Sloppy mode functions and builtins need to replace the receiver with the
135 // global proxy when called as functions (without an explicit receiver 135 // global proxy when called as functions (without an explicit receiver
136 // object). 136 // object).
137 if (is_sloppy(info->language_mode()) && !info->is_native() && 137 if (is_sloppy(info->language_mode()) && !info->is_native() &&
138 info->MayUseThis()) { 138 info->MayUseThis() && info->scope()->has_this_declaration()) {
139 Label ok; 139 Label ok;
140 int receiver_offset = info->scope()->num_parameters() * kPointerSize; 140 int receiver_offset = info->scope()->num_parameters() * kPointerSize;
141 __ lw(at, MemOperand(sp, receiver_offset)); 141 __ lw(at, MemOperand(sp, receiver_offset));
142 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); 142 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
143 __ Branch(&ok, ne, a2, Operand(at)); 143 __ Branch(&ok, ne, a2, Operand(at));
144 144
145 __ lw(a2, GlobalObjectOperand()); 145 __ lw(a2, GlobalObjectOperand());
146 __ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalProxyOffset)); 146 __ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalProxyOffset));
147 147
148 __ sw(a2, MemOperand(sp, receiver_offset)); 148 __ sw(a2, MemOperand(sp, receiver_offset));
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 __ push(a1); 218 __ push(a1);
219 __ CallRuntime(Runtime::kNewFunctionContext, 1); 219 __ CallRuntime(Runtime::kNewFunctionContext, 1);
220 } 220 }
221 function_in_register = false; 221 function_in_register = false;
222 // Context is returned in v0. It replaces the context passed to us. 222 // Context is returned in v0. It replaces the context passed to us.
223 // It's saved in the stack and kept live in cp. 223 // It's saved in the stack and kept live in cp.
224 __ mov(cp, v0); 224 __ mov(cp, v0);
225 __ sw(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); 225 __ sw(v0, MemOperand(fp, StandardFrameConstants::kContextOffset));
226 // Copy any necessary parameters into the context. 226 // Copy any necessary parameters into the context.
227 int num_parameters = info->scope()->num_parameters(); 227 int num_parameters = info->scope()->num_parameters();
228 for (int i = 0; i < num_parameters; i++) { 228 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0;
229 Variable* var = scope()->parameter(i); 229 for (int i = first_parameter; i < num_parameters; i++) {
230 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i);
230 if (var->IsContextSlot()) { 231 if (var->IsContextSlot()) {
231 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 232 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
232 (num_parameters - 1 - i) * kPointerSize; 233 (num_parameters - 1 - i) * kPointerSize;
233 // Load parameter from stack. 234 // Load parameter from stack.
234 __ lw(a0, MemOperand(fp, parameter_offset)); 235 __ lw(a0, MemOperand(fp, parameter_offset));
235 // Store it in the context. 236 // Store it in the context.
236 MemOperand target = ContextOperand(cp, var->index()); 237 MemOperand target = ContextOperand(cp, var->index());
237 __ sw(a0, target); 238 __ sw(a0, target);
238 239
239 // Update the write barrier. 240 // Update the write barrier.
(...skipping 2769 matching lines...) Expand 10 before | Expand all | Expand 10 after
3009 if (arg_count > 0) { 3010 if (arg_count > 0) {
3010 __ lw(t3, MemOperand(sp, arg_count * kPointerSize)); 3011 __ lw(t3, MemOperand(sp, arg_count * kPointerSize));
3011 } else { 3012 } else {
3012 __ LoadRoot(t3, Heap::kUndefinedValueRootIndex); 3013 __ LoadRoot(t3, Heap::kUndefinedValueRootIndex);
3013 } 3014 }
3014 3015
3015 // t2: the receiver of the enclosing function. 3016 // t2: the receiver of the enclosing function.
3016 __ lw(t2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 3017 __ lw(t2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3017 3018
3018 // t1: the receiver of the enclosing function. 3019 // t1: the receiver of the enclosing function.
3019 int receiver_offset = 2 + info_->scope()->num_parameters(); 3020 Variable* this_var = scope()->LookupThis();
3020 __ lw(t1, MemOperand(fp, receiver_offset * kPointerSize)); 3021 DCHECK_NOT_NULL(this_var);
3022 __ lw(t1, VarOperand(this_var, t1));
3021 3023
3022 // t0: the language mode. 3024 // t0: the language mode.
3023 __ li(t0, Operand(Smi::FromInt(language_mode()))); 3025 __ li(t0, Operand(Smi::FromInt(language_mode())));
3024 3026
3025 // a1: the start position of the scope the calls resides in. 3027 // a1: the start position of the scope the calls resides in.
3026 __ li(a1, Operand(Smi::FromInt(scope()->start_position()))); 3028 __ li(a1, Operand(Smi::FromInt(scope()->start_position())));
3027 3029
3028 // Do the runtime call. 3030 // Do the runtime call.
3029 __ Push(t3); 3031 __ Push(t3);
3030 __ Push(t2, t1, t0, a1); 3032 __ Push(t2, t1, t0, a1);
(...skipping 2390 matching lines...) Expand 10 before | Expand all | Expand 10 after
5421 Assembler::target_address_at(pc_immediate_load_address)) == 5423 Assembler::target_address_at(pc_immediate_load_address)) ==
5422 reinterpret_cast<uint32_t>( 5424 reinterpret_cast<uint32_t>(
5423 isolate->builtins()->OsrAfterStackCheck()->entry())); 5425 isolate->builtins()->OsrAfterStackCheck()->entry()));
5424 return OSR_AFTER_STACK_CHECK; 5426 return OSR_AFTER_STACK_CHECK;
5425 } 5427 }
5426 5428
5427 5429
5428 } } // namespace v8::internal 5430 } } // namespace v8::internal
5429 5431
5430 #endif // V8_TARGET_ARCH_MIPS 5432 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698