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

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: 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/mips/code-stubs-mips.cc ('k') | src/mips64/code-stubs-mips64.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_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::HasNewTarget has_new_target = 294 ArgumentsAccessStub::HasNewTarget has_new_target =
275 IsSubclassConstructor(info->function()->kind()) 295 IsSubclassConstructor(info->function()->kind())
276 ? ArgumentsAccessStub::HAS_NEW_TARGET 296 ? ArgumentsAccessStub::HAS_NEW_TARGET
277 : ArgumentsAccessStub::NO_NEW_TARGET; 297 : ArgumentsAccessStub::NO_NEW_TARGET;
278 ArgumentsAccessStub::Type type; 298 ArgumentsAccessStub::Type type;
279 if (is_strict(language_mode())) { 299 if (is_strict(language_mode()) || !is_simple_parameter_list()) {
280 type = ArgumentsAccessStub::NEW_STRICT; 300 type = ArgumentsAccessStub::NEW_STRICT;
281 } else if (function()->has_duplicate_parameters()) { 301 } else if (function()->has_duplicate_parameters()) {
282 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; 302 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
283 } else { 303 } else {
284 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; 304 type = ArgumentsAccessStub::NEW_SLOPPY_FAST;
285 } 305 }
286 ArgumentsAccessStub stub(isolate(), type, has_new_target); 306 ArgumentsAccessStub stub(isolate(), type, has_new_target);
287 __ CallStub(&stub); 307 __ CallStub(&stub);
288 308
289 SetVar(arguments, v0, a1, a2); 309 SetVar(arguments, v0, a1, a2);
(...skipping 5132 matching lines...) Expand 10 before | Expand all | Expand 10 after
5422 Assembler::target_address_at(pc_immediate_load_address)) == 5442 Assembler::target_address_at(pc_immediate_load_address)) ==
5423 reinterpret_cast<uint32_t>( 5443 reinterpret_cast<uint32_t>(
5424 isolate->builtins()->OsrAfterStackCheck()->entry())); 5444 isolate->builtins()->OsrAfterStackCheck()->entry()));
5425 return OSR_AFTER_STACK_CHECK; 5445 return OSR_AFTER_STACK_CHECK;
5426 } 5446 }
5427 5447
5428 5448
5429 } } // namespace v8::internal 5449 } } // namespace v8::internal
5430 5450
5431 #endif // V8_TARGET_ARCH_MIPS 5451 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698