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

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

Issue 816913003: Implement ES6 rest parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typo in ARM port Created 5 years, 10 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
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } else if (FLAG_debug_code) { 229 } else if (FLAG_debug_code) {
230 Label done; 230 Label done;
231 __ JumpIfInNewSpace(esi, eax, &done, Label::kNear); 231 __ JumpIfInNewSpace(esi, eax, &done, Label::kNear);
232 __ Abort(kExpectedNewSpaceObject); 232 __ Abort(kExpectedNewSpaceObject);
233 __ bind(&done); 233 __ bind(&done);
234 } 234 }
235 } 235 }
236 } 236 }
237 } 237 }
238 238
239 // Possibly allocate RestParameters
240 int rest_index;
241 Variable* rest_param = scope()->rest_parameter(&rest_index);
242 if (rest_param) {
243 Comment cmnt(masm_, "[ Allocate rest parameter array");
244
245 int num_parameters = info->scope()->num_parameters();
246 int offset = num_parameters * kPointerSize;
247 __ lea(edx,
248 Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset));
249 __ push(edx);
250 __ push(Immediate(Smi::FromInt(num_parameters)));
251 __ push(Immediate(Smi::FromInt(rest_index)));
252
253 RestParamAccessStub stub(isolate());
254 __ CallStub(&stub);
255
256 SetVar(rest_param, eax, ebx, edx);
257 }
258
239 Variable* arguments = scope()->arguments(); 259 Variable* arguments = scope()->arguments();
240 if (arguments != NULL) { 260 if (arguments != NULL) {
241 // Function uses arguments object. 261 // Function uses arguments object.
242 Comment cmnt(masm_, "[ Allocate arguments object"); 262 Comment cmnt(masm_, "[ Allocate arguments object");
243 if (function_in_register) { 263 if (function_in_register) {
244 __ push(edi); 264 __ push(edi);
245 } else { 265 } else {
246 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 266 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
247 } 267 }
248 // Receiver is just before the parameters on the caller's stack. 268 // Receiver is just before the parameters on the caller's stack.
249 int num_parameters = info->scope()->num_parameters(); 269 int num_parameters = info->scope()->num_parameters();
250 int offset = num_parameters * kPointerSize; 270 int offset = num_parameters * kPointerSize;
251 __ lea(edx, 271 __ lea(edx,
252 Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset)); 272 Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset));
253 __ push(edx); 273 __ push(edx);
254 __ push(Immediate(Smi::FromInt(num_parameters))); 274 __ push(Immediate(Smi::FromInt(num_parameters)));
255 // Arguments to ArgumentsAccessStub: 275 // Arguments to ArgumentsAccessStub:
256 // function, receiver address, parameter count. 276 // function, receiver address, parameter count.
257 // The stub will rewrite receiver and parameter count if the previous 277 // The stub will rewrite receiver and parameter count if the previous
258 // stack frame was an arguments adapter frame. 278 // stack frame was an arguments adapter frame.
259 ArgumentsAccessStub::Type type; 279 ArgumentsAccessStub::Type type;
260 if (is_strict(language_mode())) { 280 if (is_strict(language_mode()) || !is_simple_parameter_list()) {
261 type = ArgumentsAccessStub::NEW_STRICT; 281 type = ArgumentsAccessStub::NEW_STRICT;
262 } else if (function()->has_duplicate_parameters()) { 282 } else if (function()->has_duplicate_parameters()) {
263 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; 283 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
264 } else { 284 } else {
265 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; 285 type = ArgumentsAccessStub::NEW_SLOPPY_FAST;
266 } 286 }
267 ArgumentsAccessStub::HasNewTarget has_new_target = 287 ArgumentsAccessStub::HasNewTarget has_new_target =
268 IsSubclassConstructor(info->function()->kind()) 288 IsSubclassConstructor(info->function()->kind())
269 ? ArgumentsAccessStub::HAS_NEW_TARGET 289 ? ArgumentsAccessStub::HAS_NEW_TARGET
270 : ArgumentsAccessStub::NO_NEW_TARGET; 290 : ArgumentsAccessStub::NO_NEW_TARGET;
(...skipping 5074 matching lines...) Expand 10 before | Expand all | Expand 10 after
5345 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5365 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5346 Assembler::target_address_at(call_target_address, 5366 Assembler::target_address_at(call_target_address,
5347 unoptimized_code)); 5367 unoptimized_code));
5348 return OSR_AFTER_STACK_CHECK; 5368 return OSR_AFTER_STACK_CHECK;
5349 } 5369 }
5350 5370
5351 5371
5352 } } // namespace v8::internal 5372 } } // namespace v8::internal
5353 5373
5354 #endif // V8_TARGET_ARCH_IA32 5374 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698