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

Side by Side Diff: src/full-codegen/x64/full-codegen-x64.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, 2 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/full-codegen/mips64/full-codegen-mips64.cc ('k') | src/ia32/code-stubs-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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 __ bind(&done); 274 __ bind(&done);
275 SetVar(new_target_var, rax, rbx, rdx); 275 SetVar(new_target_var, rax, rbx, rdx);
276 } 276 }
277 277
278 // Possibly allocate an arguments object. 278 // Possibly allocate an arguments object.
279 Variable* arguments = scope()->arguments(); 279 Variable* arguments = scope()->arguments();
280 if (arguments != NULL) { 280 if (arguments != NULL) {
281 // Arguments object must be allocated after the context object, in 281 // Arguments object must be allocated after the context object, in
282 // case the "arguments" or ".arguments" variables are in the context. 282 // case the "arguments" or ".arguments" variables are in the context.
283 Comment cmnt(masm_, "[ Allocate arguments object"); 283 Comment cmnt(masm_, "[ Allocate arguments object");
284 if (function_in_register) { 284 DCHECK(rdi.is(ArgumentsAccessNewDescriptor::function()));
285 __ Push(rdi); 285 if (!function_in_register) {
286 } else { 286 __ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
287 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
288 } 287 }
289 // The receiver is just before the parameters on the caller's stack. 288 // The receiver is just before the parameters on the caller's stack.
290 int num_parameters = info->scope()->num_parameters(); 289 int num_parameters = info->scope()->num_parameters();
291 int offset = num_parameters * kPointerSize; 290 int offset = num_parameters * kPointerSize;
292 __ leap(rdx, 291 __ Move(ArgumentsAccessNewDescriptor::parameter_count(),
293 Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset)); 292 Smi::FromInt(num_parameters));
294 __ Push(rdx); 293 __ leap(ArgumentsAccessNewDescriptor::parameter_pointer(),
295 __ Push(Smi::FromInt(num_parameters)); 294 Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset));
295
296 // Arguments to ArgumentsAccessStub: 296 // Arguments to ArgumentsAccessStub:
297 // function, receiver address, parameter count. 297 // function, parameter pointer, parameter count.
298 // The stub will rewrite receiver and parameter count if the previous 298 // The stub will rewrite parameter pointer and parameter count if the
299 // stack frame was an arguments adapter frame. 299 // previous stack frame was an arguments adapter frame.
300 300 bool is_unmapped = is_strict(language_mode()) || !has_simple_parameters();
301 ArgumentsAccessStub::Type type; 301 ArgumentsAccessStub::Type type = ArgumentsAccessStub::ComputeType(
302 if (is_strict(language_mode()) || !has_simple_parameters()) { 302 is_unmapped, literal()->has_duplicate_parameters());
303 type = ArgumentsAccessStub::NEW_STRICT;
304 } else if (literal()->has_duplicate_parameters()) {
305 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
306 } else {
307 type = ArgumentsAccessStub::NEW_SLOPPY_FAST;
308 }
309 ArgumentsAccessStub stub(isolate(), type); 303 ArgumentsAccessStub stub(isolate(), type);
310 __ CallStub(&stub); 304 __ CallStub(&stub);
311 305
312 SetVar(arguments, rax, rbx, rdx); 306 SetVar(arguments, rax, rbx, rdx);
313 } 307 }
314 308
315 if (FLAG_trace) { 309 if (FLAG_trace) {
316 __ CallRuntime(Runtime::kTraceEnter, 0); 310 __ CallRuntime(Runtime::kTraceEnter, 0);
317 } 311 }
318 312
(...skipping 4829 matching lines...) Expand 10 before | Expand all | Expand 10 after
5148 Assembler::target_address_at(call_target_address, 5142 Assembler::target_address_at(call_target_address,
5149 unoptimized_code)); 5143 unoptimized_code));
5150 return OSR_AFTER_STACK_CHECK; 5144 return OSR_AFTER_STACK_CHECK;
5151 } 5145 }
5152 5146
5153 5147
5154 } // namespace internal 5148 } // namespace internal
5155 } // namespace v8 5149 } // namespace v8
5156 5150
5157 #endif // V8_TARGET_ARCH_X64 5151 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/full-codegen/mips64/full-codegen-mips64.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698