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

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

Issue 1676883002: [runtime] Optimize and unify rest parameters. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 if (new_target_var != nullptr) { 247 if (new_target_var != nullptr) {
248 Comment cmnt(masm_, "[ new.target"); 248 Comment cmnt(masm_, "[ new.target");
249 SetVar(new_target_var, rdx, rbx, rcx); 249 SetVar(new_target_var, rdx, rbx, rcx);
250 } 250 }
251 251
252 // Possibly allocate RestParameters 252 // Possibly allocate RestParameters
253 int rest_index; 253 int rest_index;
254 Variable* rest_param = scope()->rest_parameter(&rest_index); 254 Variable* rest_param = scope()->rest_parameter(&rest_index);
255 if (rest_param) { 255 if (rest_param) {
256 Comment cmnt(masm_, "[ Allocate rest parameter array"); 256 Comment cmnt(masm_, "[ Allocate rest parameter array");
257 257 if (!function_in_register) {
258 int num_parameters = info->scope()->num_parameters(); 258 __ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
259 int offset = num_parameters * kPointerSize; 259 }
260 260 FastNewRestParameterStub stub(isolate());
261 __ Move(RestParamAccessDescriptor::parameter_count(), 261 __ CallStub(&stub);
262 Smi::FromInt(num_parameters));
263 __ leap(RestParamAccessDescriptor::parameter_pointer(),
264 Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset));
265 __ Move(RestParamAccessDescriptor::rest_parameter_index(),
266 Smi::FromInt(rest_index));
267 function_in_register = false; 262 function_in_register = false;
268
269 RestParamAccessStub stub(isolate());
270 __ CallStub(&stub);
271
272 SetVar(rest_param, rax, rbx, rdx); 263 SetVar(rest_param, rax, rbx, rdx);
273 } 264 }
274 265
275 // Possibly allocate an arguments object. 266 // Possibly allocate an arguments object.
276 Variable* arguments = scope()->arguments(); 267 Variable* arguments = scope()->arguments();
277 if (arguments != NULL) { 268 if (arguments != NULL) {
278 // Arguments object must be allocated after the context object, in 269 // Arguments object must be allocated after the context object, in
279 // case the "arguments" or ".arguments" variables are in the context. 270 // case the "arguments" or ".arguments" variables are in the context.
280 Comment cmnt(masm_, "[ Allocate arguments object"); 271 Comment cmnt(masm_, "[ Allocate arguments object");
281 DCHECK(rdi.is(ArgumentsAccessNewDescriptor::function())); 272 DCHECK(rdi.is(ArgumentsAccessNewDescriptor::function()));
(...skipping 4340 matching lines...) Expand 10 before | Expand all | Expand 10 after
4622 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4613 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4623 Assembler::target_address_at(call_target_address, 4614 Assembler::target_address_at(call_target_address,
4624 unoptimized_code)); 4615 unoptimized_code));
4625 return OSR_AFTER_STACK_CHECK; 4616 return OSR_AFTER_STACK_CHECK;
4626 } 4617 }
4627 4618
4628 } // namespace internal 4619 } // namespace internal
4629 } // namespace v8 4620 } // namespace v8
4630 4621
4631 #endif // V8_TARGET_ARCH_X64 4622 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698