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

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

Issue 816913003: Implement ES6 rest parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Disable optimization of functions with rest parameters in parser 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
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_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } else if (FLAG_debug_code) { 242 } else if (FLAG_debug_code) {
243 Label done; 243 Label done;
244 __ JumpIfInNewSpace(cp, a0, &done); 244 __ JumpIfInNewSpace(cp, a0, &done);
245 __ Abort(kExpectedNewSpaceObject); 245 __ Abort(kExpectedNewSpaceObject);
246 __ bind(&done); 246 __ bind(&done);
247 } 247 }
248 } 248 }
249 } 249 }
250 } 250 }
251 251
252 // Possibly allocate RestParameters
253 int rest_index;
254 Variable* rest_param = scope()->rest_parameter(&rest_index);
255 if (rest_param) {
256 Comment cmnt(masm_, "[ Allocate rest parameter array");
257
258 int num_parameters = info->scope()->num_parameters();
259 int offset = num_parameters * kPointerSize;
260 __ Addu(a3, fp,
261 Operand(StandardFrameConstants::kCallerSPOffset + offset));
262 __ li(a2, Operand(Smi::FromInt(num_parameters)));
263 __ li(a1, Operand(Smi::FromInt(rest_index)));
264 __ Push(a3, a2, a1);
265
266 RestParamAccessStub stub(isolate());
267 __ CallStub(&stub);
268
269 SetVar(rest_param, v0, a1, a2);
270 }
271
252 Variable* arguments = scope()->arguments(); 272 Variable* arguments = scope()->arguments();
253 if (arguments != NULL) { 273 if (arguments != NULL) {
254 // Function uses arguments object. 274 // Function uses arguments object.
255 Comment cmnt(masm_, "[ Allocate arguments object"); 275 Comment cmnt(masm_, "[ Allocate arguments object");
256 if (!function_in_register) { 276 if (!function_in_register) {
257 // Load this again, if it's used by the local context below. 277 // Load this again, if it's used by the local context below.
258 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 278 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
259 } else { 279 } else {
260 __ mov(a3, a1); 280 __ mov(a3, a1);
261 } 281 }
262 // Receiver is just before the parameters on the caller's stack. 282 // Receiver is just before the parameters on the caller's stack.
263 int num_parameters = info->scope()->num_parameters(); 283 int num_parameters = info->scope()->num_parameters();
264 int offset = num_parameters * kPointerSize; 284 int offset = num_parameters * kPointerSize;
265 __ Addu(a2, fp, 285 __ Addu(a2, fp,
266 Operand(StandardFrameConstants::kCallerSPOffset + offset)); 286 Operand(StandardFrameConstants::kCallerSPOffset + offset));
267 __ li(a1, Operand(Smi::FromInt(num_parameters))); 287 __ li(a1, Operand(Smi::FromInt(num_parameters)));
268 __ Push(a3, a2, a1); 288 __ Push(a3, a2, a1);
269 289
270 // Arguments to ArgumentsAccessStub: 290 // Arguments to ArgumentsAccessStub:
271 // function, receiver address, parameter count. 291 // function, receiver address, parameter count.
272 // The stub will rewrite receiever and parameter count if the previous 292 // The stub will rewrite receiever and parameter count if the previous
273 // stack frame was an arguments adapter frame. 293 // stack frame was an arguments adapter frame.
274 ArgumentsAccessStub::Type type; 294 ArgumentsAccessStub::Type type;
275 if (is_strict(language_mode())) { 295 if (is_strict(language_mode()) || !is_simple_parameter_list()) {
276 type = ArgumentsAccessStub::NEW_STRICT; 296 type = ArgumentsAccessStub::NEW_STRICT;
277 } else if (function()->has_duplicate_parameters()) { 297 } else if (function()->has_duplicate_parameters()) {
278 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; 298 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
279 } else { 299 } else {
280 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; 300 type = ArgumentsAccessStub::NEW_SLOPPY_FAST;
281 } 301 }
282 ArgumentsAccessStub stub(isolate(), type); 302 ArgumentsAccessStub stub(isolate(), type);
283 __ CallStub(&stub); 303 __ CallStub(&stub);
284 304
285 SetVar(arguments, v0, a1, a2); 305 SetVar(arguments, v0, a1, a2);
(...skipping 5078 matching lines...) Expand 10 before | Expand all | Expand 10 after
5364 Assembler::target_address_at(pc_immediate_load_address)) == 5384 Assembler::target_address_at(pc_immediate_load_address)) ==
5365 reinterpret_cast<uint32_t>( 5385 reinterpret_cast<uint32_t>(
5366 isolate->builtins()->OsrAfterStackCheck()->entry())); 5386 isolate->builtins()->OsrAfterStackCheck()->entry()));
5367 return OSR_AFTER_STACK_CHECK; 5387 return OSR_AFTER_STACK_CHECK;
5368 } 5388 }
5369 5389
5370 5390
5371 } } // namespace v8::internal 5391 } } // namespace v8::internal
5372 5392
5373 #endif // V8_TARGET_ARCH_MIPS 5393 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698