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

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

Issue 1272673003: [es6] Re-implement rest parameters via desugaring. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Oops. Created 5 years, 3 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/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 __ jmp(&done); 268 __ jmp(&done);
269 269
270 // Non-construct frame 270 // Non-construct frame
271 __ bind(&non_construct_frame); 271 __ bind(&non_construct_frame);
272 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); 272 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
273 273
274 __ bind(&done); 274 __ bind(&done);
275 SetVar(new_target_var, rax, rbx, rdx); 275 SetVar(new_target_var, rax, rbx, rdx);
276 } 276 }
277 277
278 // Possibly allocate RestParameters
279 int rest_index;
280 Variable* rest_param = scope()->rest_parameter(&rest_index);
281 if (rest_param) {
282 Comment cmnt(masm_, "[ Allocate rest parameter array");
283
284 int num_parameters = info->scope()->num_parameters();
285 int offset = num_parameters * kPointerSize;
286
287 __ leap(rdx,
288 Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset));
289 __ Push(rdx);
290 __ Push(Smi::FromInt(num_parameters));
291 __ Push(Smi::FromInt(rest_index));
292 __ Push(Smi::FromInt(language_mode()));
293
294 RestParamAccessStub stub(isolate());
295 __ CallStub(&stub);
296
297 SetVar(rest_param, rax, rbx, rdx);
298 }
299
300 // Possibly allocate an arguments object. 278 // Possibly allocate an arguments object.
301 Variable* arguments = scope()->arguments(); 279 Variable* arguments = scope()->arguments();
302 if (arguments != NULL) { 280 if (arguments != NULL) {
303 // Arguments object must be allocated after the context object, in 281 // Arguments object must be allocated after the context object, in
304 // case the "arguments" or ".arguments" variables are in the context. 282 // case the "arguments" or ".arguments" variables are in the context.
305 Comment cmnt(masm_, "[ Allocate arguments object"); 283 Comment cmnt(masm_, "[ Allocate arguments object");
306 if (function_in_register) { 284 if (function_in_register) {
307 __ Push(rdi); 285 __ Push(rdi);
308 } else { 286 } else {
309 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 287 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
(...skipping 4953 matching lines...) Expand 10 before | Expand all | Expand 10 after
5263 Assembler::target_address_at(call_target_address, 5241 Assembler::target_address_at(call_target_address,
5264 unoptimized_code)); 5242 unoptimized_code));
5265 return OSR_AFTER_STACK_CHECK; 5243 return OSR_AFTER_STACK_CHECK;
5266 } 5244 }
5267 5245
5268 5246
5269 } // namespace internal 5247 } // namespace internal
5270 } // namespace v8 5248 } // namespace v8
5271 5249
5272 #endif // V8_TARGET_ARCH_X64 5250 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/full-codegen/mips64/full-codegen-mips64.cc ('k') | src/hydrogen.cc » ('j') | src/parser.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698