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

Side by Side Diff: src/full-codegen/ia32/full-codegen-ia32.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_IA32 5 #if V8_TARGET_ARCH_IA32
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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 if (new_target_var != nullptr) { 252 if (new_target_var != nullptr) {
253 Comment cmnt(masm_, "[ new.target"); 253 Comment cmnt(masm_, "[ new.target");
254 SetVar(new_target_var, edx, ebx, ecx); 254 SetVar(new_target_var, edx, ebx, ecx);
255 } 255 }
256 256
257 // Possibly allocate RestParameters 257 // Possibly allocate RestParameters
258 int rest_index; 258 int rest_index;
259 Variable* rest_param = scope()->rest_parameter(&rest_index); 259 Variable* rest_param = scope()->rest_parameter(&rest_index);
260 if (rest_param) { 260 if (rest_param) {
261 Comment cmnt(masm_, "[ Allocate rest parameter array"); 261 Comment cmnt(masm_, "[ Allocate rest parameter array");
262 262 if (!function_in_register) {
263 int num_parameters = info->scope()->num_parameters(); 263 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
264 int offset = num_parameters * kPointerSize; 264 }
265 265 FastNewRestParameterStub stub(isolate());
266 __ mov(RestParamAccessDescriptor::parameter_count(), 266 __ CallStub(&stub);
267 Immediate(Smi::FromInt(num_parameters)));
268 __ lea(RestParamAccessDescriptor::parameter_pointer(),
269 Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset));
270 __ mov(RestParamAccessDescriptor::rest_parameter_index(),
271 Immediate(Smi::FromInt(rest_index)));
272 function_in_register = false; 267 function_in_register = false;
273
274 RestParamAccessStub stub(isolate());
275 __ CallStub(&stub);
276 SetVar(rest_param, eax, ebx, edx); 268 SetVar(rest_param, eax, ebx, edx);
277 } 269 }
278 270
279 Variable* arguments = scope()->arguments(); 271 Variable* arguments = scope()->arguments();
280 if (arguments != NULL) { 272 if (arguments != NULL) {
281 // Function uses arguments object. 273 // Function uses arguments object.
282 Comment cmnt(masm_, "[ Allocate arguments object"); 274 Comment cmnt(masm_, "[ Allocate arguments object");
283 DCHECK(edi.is(ArgumentsAccessNewDescriptor::function())); 275 DCHECK(edi.is(ArgumentsAccessNewDescriptor::function()));
284 if (!function_in_register) { 276 if (!function_in_register) {
285 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 277 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
(...skipping 4334 matching lines...) Expand 10 before | Expand all | Expand 10 after
4620 Assembler::target_address_at(call_target_address, 4612 Assembler::target_address_at(call_target_address,
4621 unoptimized_code)); 4613 unoptimized_code));
4622 return OSR_AFTER_STACK_CHECK; 4614 return OSR_AFTER_STACK_CHECK;
4623 } 4615 }
4624 4616
4625 4617
4626 } // namespace internal 4618 } // namespace internal
4627 } // namespace v8 4619 } // namespace v8
4628 4620
4629 #endif // V8_TARGET_ARCH_IA32 4621 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698