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

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: Tiny bit more cleanup 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 __ jmp(&done); 264 __ jmp(&done);
265 265
266 // Non-construct frame 266 // Non-construct frame
267 __ bind(&non_construct_frame); 267 __ bind(&non_construct_frame);
268 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); 268 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
269 269
270 __ bind(&done); 270 __ bind(&done);
271 SetVar(new_target_var, rax, rbx, rdx); 271 SetVar(new_target_var, rax, rbx, rdx);
272 } 272 }
273 273
274 // Possibly allocate RestParameters
275 int rest_index;
276 Variable* rest_param = scope()->rest_parameter(&rest_index);
277 if (rest_param) {
278 Comment cmnt(masm_, "[ Allocate rest parameter array");
279
280 int num_parameters = info->scope()->num_parameters();
281 int offset = num_parameters * kPointerSize;
282
283 __ leap(rdx,
284 Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset));
285 __ Push(rdx);
286 __ Push(Smi::FromInt(num_parameters));
287 __ Push(Smi::FromInt(rest_index));
288 __ Push(Smi::FromInt(language_mode()));
289
290 RestParamAccessStub stub(isolate());
291 __ CallStub(&stub);
292
293 SetVar(rest_param, rax, rbx, rdx);
294 }
295
296 // Possibly allocate an arguments object. 274 // Possibly allocate an arguments object.
297 Variable* arguments = scope()->arguments(); 275 Variable* arguments = scope()->arguments();
298 if (arguments != NULL) { 276 if (arguments != NULL) {
299 // Arguments object must be allocated after the context object, in 277 // Arguments object must be allocated after the context object, in
300 // case the "arguments" or ".arguments" variables are in the context. 278 // case the "arguments" or ".arguments" variables are in the context.
301 Comment cmnt(masm_, "[ Allocate arguments object"); 279 Comment cmnt(masm_, "[ Allocate arguments object");
302 if (function_in_register) { 280 if (function_in_register) {
303 __ Push(rdi); 281 __ Push(rdi);
304 } else { 282 } else {
305 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 283 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
(...skipping 4960 matching lines...) Expand 10 before | Expand all | Expand 10 after
5266 Assembler::target_address_at(call_target_address, 5244 Assembler::target_address_at(call_target_address,
5267 unoptimized_code)); 5245 unoptimized_code));
5268 return OSR_AFTER_STACK_CHECK; 5246 return OSR_AFTER_STACK_CHECK;
5269 } 5247 }
5270 5248
5271 5249
5272 } // namespace internal 5250 } // namespace internal
5273 } // namespace v8 5251 } // namespace v8
5274 5252
5275 #endif // V8_TARGET_ARCH_X64 5253 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/full-codegen/ia32/full-codegen-ia32.cc ('k') | src/hydrogen.cc » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698