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

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: Fix typo in ARM port 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
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/bailout-reason.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 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::HasNewTarget has_new_target = 284 ArgumentsAccessStub::HasNewTarget has_new_target =
266 IsSubclassConstructor(info->function()->kind()) 285 IsSubclassConstructor(info->function()->kind())
267 ? ArgumentsAccessStub::HAS_NEW_TARGET 286 ? ArgumentsAccessStub::HAS_NEW_TARGET
268 : ArgumentsAccessStub::NO_NEW_TARGET; 287 : ArgumentsAccessStub::NO_NEW_TARGET;
269 ArgumentsAccessStub::Type type; 288 ArgumentsAccessStub::Type type;
270 if (is_strict(language_mode())) { 289 if (is_strict(language_mode()) || !is_simple_parameter_list()) {
271 type = ArgumentsAccessStub::NEW_STRICT; 290 type = ArgumentsAccessStub::NEW_STRICT;
272 } else if (function()->has_duplicate_parameters()) { 291 } else if (function()->has_duplicate_parameters()) {
273 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; 292 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
274 } else { 293 } else {
275 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; 294 type = ArgumentsAccessStub::NEW_SLOPPY_FAST;
276 } 295 }
277 ArgumentsAccessStub stub(isolate(), type, has_new_target); 296 ArgumentsAccessStub stub(isolate(), type, has_new_target);
278 __ CallStub(&stub); 297 __ CallStub(&stub);
279 298
280 SetVar(arguments, x0, x1, x2); 299 SetVar(arguments, x0, x1, x2);
(...skipping 5180 matching lines...) Expand 10 before | Expand all | Expand 10 after
5461 return previous_; 5480 return previous_;
5462 } 5481 }
5463 5482
5464 5483
5465 #undef __ 5484 #undef __
5466 5485
5467 5486
5468 } } // namespace v8::internal 5487 } } // namespace v8::internal
5469 5488
5470 #endif // V8_TARGET_ARCH_ARM64 5489 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/bailout-reason.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698