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

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

Issue 1272673003: [es6] Re-implement rest parameters via desugaring. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 __ jmp(&done); 269 __ jmp(&done);
270 270
271 // Non-construct frame 271 // Non-construct frame
272 __ bind(&non_construct_frame); 272 __ bind(&non_construct_frame);
273 __ mov(eax, Immediate(isolate()->factory()->undefined_value())); 273 __ mov(eax, Immediate(isolate()->factory()->undefined_value()));
274 274
275 __ bind(&done); 275 __ bind(&done);
276 SetVar(new_target_var, eax, ebx, edx); 276 SetVar(new_target_var, eax, ebx, edx);
277 } 277 }
278 278
279
280 // Possibly allocate RestParameters
281 int rest_index;
282 Variable* rest_param = scope()->rest_parameter(&rest_index);
283 if (rest_param) {
284 Comment cmnt(masm_, "[ Allocate rest parameter array");
285
286 int num_parameters = info->scope()->num_parameters();
287 int offset = num_parameters * kPointerSize;
288
289 __ lea(edx,
290 Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset));
291 __ push(edx);
292 __ push(Immediate(Smi::FromInt(num_parameters)));
293 __ push(Immediate(Smi::FromInt(rest_index)));
294 __ push(Immediate(Smi::FromInt(language_mode())));
295
296 RestParamAccessStub stub(isolate());
297 __ CallStub(&stub);
298
299 SetVar(rest_param, eax, ebx, edx);
300 }
301
302 Variable* arguments = scope()->arguments(); 279 Variable* arguments = scope()->arguments();
303 if (arguments != NULL) { 280 if (arguments != NULL) {
304 // Function uses arguments object. 281 // Function uses arguments object.
305 Comment cmnt(masm_, "[ Allocate arguments object"); 282 Comment cmnt(masm_, "[ Allocate arguments object");
306 if (function_in_register) { 283 if (function_in_register) {
307 __ push(edi); 284 __ push(edi);
308 } else { 285 } else {
309 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 286 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
310 } 287 }
311 // Receiver is just before the parameters on the caller's stack. 288 // Receiver is just before the parameters on the caller's stack.
(...skipping 5032 matching lines...) Expand 10 before | Expand all | Expand 10 after
5344 Assembler::target_address_at(call_target_address, 5321 Assembler::target_address_at(call_target_address,
5345 unoptimized_code)); 5322 unoptimized_code));
5346 return OSR_AFTER_STACK_CHECK; 5323 return OSR_AFTER_STACK_CHECK;
5347 } 5324 }
5348 5325
5349 5326
5350 } // namespace internal 5327 } // namespace internal
5351 } // namespace v8 5328 } // namespace v8
5352 5329
5353 #endif // V8_TARGET_ARCH_IA32 5330 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698