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

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: 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_IA32 5 #if V8_TARGET_ARCH_IA32
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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 __ jmp(&done); 272 __ jmp(&done);
273 273
274 // Non-construct frame 274 // Non-construct frame
275 __ bind(&non_construct_frame); 275 __ bind(&non_construct_frame);
276 __ mov(eax, Immediate(isolate()->factory()->undefined_value())); 276 __ mov(eax, Immediate(isolate()->factory()->undefined_value()));
277 277
278 __ bind(&done); 278 __ bind(&done);
279 SetVar(new_target_var, eax, ebx, edx); 279 SetVar(new_target_var, eax, ebx, edx);
280 } 280 }
281 281
282
283 // Possibly allocate RestParameters
284 int rest_index;
285 Variable* rest_param = scope()->rest_parameter(&rest_index);
286 if (rest_param) {
287 Comment cmnt(masm_, "[ Allocate rest parameter array");
288
289 int num_parameters = info->scope()->num_parameters();
290 int offset = num_parameters * kPointerSize;
291
292 __ lea(edx,
293 Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset));
294 __ push(edx);
295 __ push(Immediate(Smi::FromInt(num_parameters)));
296 __ push(Immediate(Smi::FromInt(rest_index)));
297 __ push(Immediate(Smi::FromInt(language_mode())));
298
299 RestParamAccessStub stub(isolate());
300 __ CallStub(&stub);
301
302 SetVar(rest_param, eax, ebx, edx);
303 }
304
305 Variable* arguments = scope()->arguments(); 282 Variable* arguments = scope()->arguments();
306 if (arguments != NULL) { 283 if (arguments != NULL) {
307 // Function uses arguments object. 284 // Function uses arguments object.
308 Comment cmnt(masm_, "[ Allocate arguments object"); 285 Comment cmnt(masm_, "[ Allocate arguments object");
309 if (function_in_register) { 286 if (function_in_register) {
310 __ push(edi); 287 __ push(edi);
311 } else { 288 } else {
312 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 289 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
313 } 290 }
314 // Receiver is just before the parameters on the caller's stack. 291 // Receiver is just before the parameters on the caller's stack.
(...skipping 4939 matching lines...) Expand 10 before | Expand all | Expand 10 after
5254 Assembler::target_address_at(call_target_address, 5231 Assembler::target_address_at(call_target_address,
5255 unoptimized_code)); 5232 unoptimized_code));
5256 return OSR_AFTER_STACK_CHECK; 5233 return OSR_AFTER_STACK_CHECK;
5257 } 5234 }
5258 5235
5259 5236
5260 } // namespace internal 5237 } // namespace internal
5261 } // namespace v8 5238 } // namespace v8
5262 5239
5263 #endif // V8_TARGET_ARCH_IA32 5240 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698