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

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

Powered by Google App Engine
This is Rietveld 408576698