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/full-codegen/x64/full-codegen-x64.cc

Issue 1693513002: [runtime] Introduce FastNewStrictArgumentsStub to optimize strict arguments. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix mips and mips64. Created 4 years, 10 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/heap/heap.h » ('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/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 function_in_register = false; 255 function_in_register = false;
256 SetVar(rest_param, rax, rbx, rdx); 256 SetVar(rest_param, rax, rbx, rdx);
257 } 257 }
258 258
259 // Possibly allocate an arguments object. 259 // Possibly allocate an arguments object.
260 Variable* arguments = scope()->arguments(); 260 Variable* arguments = scope()->arguments();
261 if (arguments != NULL) { 261 if (arguments != NULL) {
262 // Arguments object must be allocated after the context object, in 262 // Arguments object must be allocated after the context object, in
263 // case the "arguments" or ".arguments" variables are in the context. 263 // case the "arguments" or ".arguments" variables are in the context.
264 Comment cmnt(masm_, "[ Allocate arguments object"); 264 Comment cmnt(masm_, "[ Allocate arguments object");
265 DCHECK(rdi.is(ArgumentsAccessNewDescriptor::function()));
266 if (!function_in_register) { 265 if (!function_in_register) {
267 __ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 266 __ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
268 } 267 }
269 // The receiver is just before the parameters on the caller's stack. 268 if (is_strict(language_mode()) || !has_simple_parameters()) {
270 int num_parameters = info->scope()->num_parameters(); 269 FastNewStrictArgumentsStub stub(isolate());
271 int offset = num_parameters * kPointerSize; 270 __ CallStub(&stub);
272 __ Move(ArgumentsAccessNewDescriptor::parameter_count(), 271 } else {
273 Smi::FromInt(num_parameters)); 272 DCHECK(rdi.is(ArgumentsAccessNewDescriptor::function()));
274 __ leap(ArgumentsAccessNewDescriptor::parameter_pointer(), 273 // The receiver is just before the parameters on the caller's stack.
275 Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset)); 274 int num_parameters = info->scope()->num_parameters();
275 int offset = num_parameters * kPointerSize;
276 __ Move(ArgumentsAccessNewDescriptor::parameter_count(),
277 Smi::FromInt(num_parameters));
278 __ leap(ArgumentsAccessNewDescriptor::parameter_pointer(),
279 Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset));
276 280
277 // Arguments to ArgumentsAccessStub: 281 // Arguments to ArgumentsAccessStub:
278 // function, parameter pointer, parameter count. 282 // function, parameter pointer, parameter count.
279 // The stub will rewrite parameter pointer and parameter count if the 283 // The stub will rewrite parameter pointer and parameter count if the
280 // previous stack frame was an arguments adapter frame. 284 // previous stack frame was an arguments adapter frame.
281 bool is_unmapped = is_strict(language_mode()) || !has_simple_parameters(); 285 ArgumentsAccessStub::Type type = ArgumentsAccessStub::ComputeType(
282 ArgumentsAccessStub::Type type = ArgumentsAccessStub::ComputeType( 286 literal()->has_duplicate_parameters());
283 is_unmapped, literal()->has_duplicate_parameters()); 287 ArgumentsAccessStub stub(isolate(), type);
284 ArgumentsAccessStub stub(isolate(), type); 288 __ CallStub(&stub);
285 __ CallStub(&stub); 289 }
286 290
287 SetVar(arguments, rax, rbx, rdx); 291 SetVar(arguments, rax, rbx, rdx);
288 } 292 }
289 293
290 if (FLAG_trace) { 294 if (FLAG_trace) {
291 __ CallRuntime(Runtime::kTraceEnter); 295 __ CallRuntime(Runtime::kTraceEnter);
292 } 296 }
293 297
294 // Visit the declarations and body unless there is an illegal 298 // Visit the declarations and body unless there is an illegal
295 // redeclaration. 299 // redeclaration.
(...skipping 4281 matching lines...) Expand 10 before | Expand all | Expand 10 after
4577 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4581 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4578 Assembler::target_address_at(call_target_address, 4582 Assembler::target_address_at(call_target_address,
4579 unoptimized_code)); 4583 unoptimized_code));
4580 return OSR_AFTER_STACK_CHECK; 4584 return OSR_AFTER_STACK_CHECK;
4581 } 4585 }
4582 4586
4583 } // namespace internal 4587 } // namespace internal
4584 } // namespace v8 4588 } // namespace v8
4585 4589
4586 #endif // V8_TARGET_ARCH_X64 4590 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/full-codegen/mips64/full-codegen-mips64.cc ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698