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

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

Issue 816913003: Implement ES6 rest parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Disable optimization of functions with rest parameters in parser Created 5 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 } else if (FLAG_debug_code) { 234 } else if (FLAG_debug_code) {
235 Label done; 235 Label done;
236 __ JumpIfInNewSpace(cp, &done); 236 __ JumpIfInNewSpace(cp, &done);
237 __ Abort(kExpectedNewSpaceObject); 237 __ Abort(kExpectedNewSpaceObject);
238 __ bind(&done); 238 __ bind(&done);
239 } 239 }
240 } 240 }
241 } 241 }
242 } 242 }
243 243
244 // Possibly allocate RestParameters
245 int rest_index;
246 Variable* rest_param = scope()->rest_parameter(&rest_index);
247 if (rest_param) {
248 Comment cmnt(masm_, "[ Allocate rest parameter array");
249
250 int num_parameters = info->scope()->num_parameters();
251 int offset = num_parameters * kPointerSize;
252 __ Add(x3, fp, StandardFrameConstants::kCallerSPOffset + offset);
253 __ Mov(x2, Smi::FromInt(num_parameters));
254 __ Mov(x1, Smi::FromInt(rest_index));
255 __ Push(x3, x2, x1);
256
257 RestParamAccessStub stub(isolate());
258 __ CallStub(&stub);
259
260 SetVar(rest_param, x0, x1, x2);
261 }
262
244 Variable* arguments = scope()->arguments(); 263 Variable* arguments = scope()->arguments();
245 if (arguments != NULL) { 264 if (arguments != NULL) {
246 // Function uses arguments object. 265 // Function uses arguments object.
247 Comment cmnt(masm_, "[ Allocate arguments object"); 266 Comment cmnt(masm_, "[ Allocate arguments object");
248 if (!function_in_register_x1) { 267 if (!function_in_register_x1) {
249 // Load this again, if it's used by the local context below. 268 // Load this again, if it's used by the local context below.
250 __ Ldr(x3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 269 __ Ldr(x3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
251 } else { 270 } else {
252 __ Mov(x3, x1); 271 __ Mov(x3, x1);
253 } 272 }
254 // Receiver is just before the parameters on the caller's stack. 273 // Receiver is just before the parameters on the caller's stack.
255 int num_parameters = info->scope()->num_parameters(); 274 int num_parameters = info->scope()->num_parameters();
256 int offset = num_parameters * kPointerSize; 275 int offset = num_parameters * kPointerSize;
257 __ Add(x2, fp, StandardFrameConstants::kCallerSPOffset + offset); 276 __ Add(x2, fp, StandardFrameConstants::kCallerSPOffset + offset);
258 __ Mov(x1, Smi::FromInt(num_parameters)); 277 __ Mov(x1, Smi::FromInt(num_parameters));
259 __ Push(x3, x2, x1); 278 __ Push(x3, x2, x1);
260 279
261 // Arguments to ArgumentsAccessStub: 280 // Arguments to ArgumentsAccessStub:
262 // function, receiver address, parameter count. 281 // function, receiver address, parameter count.
263 // The stub will rewrite receiver and parameter count if the previous 282 // The stub will rewrite receiver and parameter count if the previous
264 // stack frame was an arguments adapter frame. 283 // stack frame was an arguments adapter frame.
265 ArgumentsAccessStub::Type type; 284 ArgumentsAccessStub::Type type;
266 if (is_strict(language_mode())) { 285 if (is_strict(language_mode()) || !is_simple_parameter_list()) {
Dmitry Lomov (no reviews) 2015/02/13 16:27:14 Is this just temporary and we later add support fo
caitp (gmail) 2015/02/13 16:30:45 This is specced (FunctionDeclarationInstantiation,
Dmitry Lomov (no reviews) 2015/02/13 16:41:08 Ah, thanks!
267 type = ArgumentsAccessStub::NEW_STRICT; 286 type = ArgumentsAccessStub::NEW_STRICT;
268 } else if (function()->has_duplicate_parameters()) { 287 } else if (function()->has_duplicate_parameters()) {
269 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; 288 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
270 } else { 289 } else {
271 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; 290 type = ArgumentsAccessStub::NEW_SLOPPY_FAST;
272 } 291 }
273 ArgumentsAccessStub stub(isolate(), type); 292 ArgumentsAccessStub stub(isolate(), type);
274 __ CallStub(&stub); 293 __ CallStub(&stub);
275 294
276 SetVar(arguments, x0, x1, x2); 295 SetVar(arguments, x0, x1, x2);
(...skipping 5128 matching lines...) Expand 10 before | Expand all | Expand 10 after
5405 return previous_; 5424 return previous_;
5406 } 5425 }
5407 5426
5408 5427
5409 #undef __ 5428 #undef __
5410 5429
5411 5430
5412 } } // namespace v8::internal 5431 } } // namespace v8::internal
5413 5432
5414 #endif // V8_TARGET_ARCH_ARM64 5433 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/bailout-reason.h » ('j') | src/ia32/code-stubs-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698