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

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

Issue 1348773002: [turbofan] Call ArgumentsAccessStub to materialize arguments. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 5 years, 3 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
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 #if V8_TARGET_ARCH_MIPS 5 #if V8_TARGET_ARCH_MIPS
6 6
7 // Note on Mips implementation: 7 // Note on Mips implementation:
8 // 8 //
9 // The result_register() for mips is the 'v0' register, which is defined 9 // The result_register() for mips is the 'v0' register, which is defined
10 // by the ABI to contain function return values. However, the first 10 // by the ABI to contain function return values. However, the first
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); 292 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
293 __ bind(&done); 293 __ bind(&done);
294 294
295 SetVar(new_target_var, v0, a2, a3); 295 SetVar(new_target_var, v0, a2, a3);
296 } 296 }
297 297
298 Variable* arguments = scope()->arguments(); 298 Variable* arguments = scope()->arguments();
299 if (arguments != NULL) { 299 if (arguments != NULL) {
300 // Function uses arguments object. 300 // Function uses arguments object.
301 Comment cmnt(masm_, "[ Allocate arguments object"); 301 Comment cmnt(masm_, "[ Allocate arguments object");
302 DCHECK(a1.is(ArgumentsAccessNewDescriptor::function()));
302 if (!function_in_register_a1) { 303 if (!function_in_register_a1) {
303 // Load this again, if it's used by the local context below. 304 // Load this again, if it's used by the local context below.
304 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 305 __ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
305 } else {
306 __ mov(a3, a1);
307 } 306 }
308 // Receiver is just before the parameters on the caller's stack. 307 // Receiver is just before the parameters on the caller's stack.
309 int num_parameters = info->scope()->num_parameters(); 308 int num_parameters = info->scope()->num_parameters();
310 int offset = num_parameters * kPointerSize; 309 int offset = num_parameters * kPointerSize;
311 __ Addu(a2, fp, 310 __ li(ArgumentsAccessNewDescriptor::parameter_count(),
312 Operand(StandardFrameConstants::kCallerSPOffset + offset)); 311 Operand(Smi::FromInt(num_parameters)));
313 __ li(a1, Operand(Smi::FromInt(num_parameters))); 312 __ Addu(ArgumentsAccessNewDescriptor::parameter_pointer(), fp,
314 __ Push(a3, a2, a1); 313 Operand(StandardFrameConstants::kCallerSPOffset + offset));
315 314
316 // Arguments to ArgumentsAccessStub: 315 // Arguments to ArgumentsAccessStub:
317 // function, receiver address, parameter count. 316 // function, parameter pointer, parameter count.
318 // The stub will rewrite receiever and parameter count if the previous 317 // The stub will rewrite parameter pointer and parameter count if the
319 // stack frame was an arguments adapter frame. 318 // previous stack frame was an arguments adapter frame.
320 ArgumentsAccessStub::Type type; 319 bool is_unmapped = is_strict(language_mode()) || !has_simple_parameters();
321 if (is_strict(language_mode()) || !has_simple_parameters()) { 320 ArgumentsAccessStub::Type type = ArgumentsAccessStub::ComputeType(
322 type = ArgumentsAccessStub::NEW_STRICT; 321 is_unmapped, literal()->has_duplicate_parameters());
323 } else if (literal()->has_duplicate_parameters()) {
324 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
325 } else {
326 type = ArgumentsAccessStub::NEW_SLOPPY_FAST;
327 }
328 ArgumentsAccessStub stub(isolate(), type); 322 ArgumentsAccessStub stub(isolate(), type);
329 __ CallStub(&stub); 323 __ CallStub(&stub);
330 324
331 SetVar(arguments, v0, a1, a2); 325 SetVar(arguments, v0, a1, a2);
332 } 326 }
333 327
334 if (FLAG_trace) { 328 if (FLAG_trace) {
335 __ CallRuntime(Runtime::kTraceEnter, 0); 329 __ CallRuntime(Runtime::kTraceEnter, 0);
336 } 330 }
337 331
(...skipping 4892 matching lines...) Expand 10 before | Expand all | Expand 10 after
5230 reinterpret_cast<uint32_t>( 5224 reinterpret_cast<uint32_t>(
5231 isolate->builtins()->OsrAfterStackCheck()->entry())); 5225 isolate->builtins()->OsrAfterStackCheck()->entry()));
5232 return OSR_AFTER_STACK_CHECK; 5226 return OSR_AFTER_STACK_CHECK;
5233 } 5227 }
5234 5228
5235 5229
5236 } // namespace internal 5230 } // namespace internal
5237 } // namespace v8 5231 } // namespace v8
5238 5232
5239 #endif // V8_TARGET_ARCH_MIPS 5233 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/full-codegen/ia32/full-codegen-ia32.cc ('k') | src/full-codegen/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698