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

Side by Side Diff: src/mips64/full-codegen-mips64.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/mips64/code-stubs-mips64.cc ('k') | src/objects.h » ('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_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 cp, target.offset(), a0, a3, kRAHasBeenSaved, kDontSaveFPRegs); 238 cp, target.offset(), a0, a3, kRAHasBeenSaved, kDontSaveFPRegs);
239 } else if (FLAG_debug_code) { 239 } else if (FLAG_debug_code) {
240 Label done; 240 Label done;
241 __ JumpIfInNewSpace(cp, a0, &done); 241 __ JumpIfInNewSpace(cp, a0, &done);
242 __ Abort(kExpectedNewSpaceObject); 242 __ Abort(kExpectedNewSpaceObject);
243 __ bind(&done); 243 __ bind(&done);
244 } 244 }
245 } 245 }
246 } 246 }
247 } 247 }
248
249 // Possibly allocate RestParameters
250 int rest_index;
251 Variable* rest_param = scope()->rest_parameter(&rest_index);
252 if (rest_param) {
253 Comment cmnt(masm_, "[ Allocate rest parameter array");
254
255 int num_parameters = info->scope()->num_parameters();
256 int offset = num_parameters * kPointerSize;
257 __ Daddu(a3, fp,
258 Operand(StandardFrameConstants::kCallerSPOffset + offset));
259 __ li(a2, Operand(Smi::FromInt(num_parameters)));
260 __ li(a1, Operand(Smi::FromInt(rest_index)));
261 __ Push(a3, a2, a1);
262
263 RestParamAccessStub stub(isolate());
264 __ CallStub(&stub);
265
266 SetVar(rest_param, v0, a1, a2);
267 }
268
248 Variable* arguments = scope()->arguments(); 269 Variable* arguments = scope()->arguments();
249 if (arguments != NULL) { 270 if (arguments != NULL) {
250 // Function uses arguments object. 271 // Function uses arguments object.
251 Comment cmnt(masm_, "[ Allocate arguments object"); 272 Comment cmnt(masm_, "[ Allocate arguments object");
252 if (!function_in_register) { 273 if (!function_in_register) {
253 // Load this again, if it's used by the local context below. 274 // Load this again, if it's used by the local context below.
254 __ ld(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 275 __ ld(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
255 } else { 276 } else {
256 __ mov(a3, a1); 277 __ mov(a3, a1);
257 } 278 }
258 // Receiver is just before the parameters on the caller's stack. 279 // Receiver is just before the parameters on the caller's stack.
259 int num_parameters = info->scope()->num_parameters(); 280 int num_parameters = info->scope()->num_parameters();
260 int offset = num_parameters * kPointerSize; 281 int offset = num_parameters * kPointerSize;
261 __ Daddu(a2, fp, 282 __ Daddu(a2, fp,
262 Operand(StandardFrameConstants::kCallerSPOffset + offset)); 283 Operand(StandardFrameConstants::kCallerSPOffset + offset));
263 __ li(a1, Operand(Smi::FromInt(num_parameters))); 284 __ li(a1, Operand(Smi::FromInt(num_parameters)));
264 __ Push(a3, a2, a1); 285 __ Push(a3, a2, a1);
265 286
266 // Arguments to ArgumentsAccessStub: 287 // Arguments to ArgumentsAccessStub:
267 // function, receiver address, parameter count. 288 // function, receiver address, parameter count.
268 // The stub will rewrite receiever and parameter count if the previous 289 // The stub will rewrite receiever and parameter count if the previous
269 // stack frame was an arguments adapter frame. 290 // stack frame was an arguments adapter frame.
270 ArgumentsAccessStub::HasNewTarget has_new_target = 291 ArgumentsAccessStub::HasNewTarget has_new_target =
271 IsSubclassConstructor(info->function()->kind()) 292 IsSubclassConstructor(info->function()->kind())
272 ? ArgumentsAccessStub::HAS_NEW_TARGET 293 ? ArgumentsAccessStub::HAS_NEW_TARGET
273 : ArgumentsAccessStub::NO_NEW_TARGET; 294 : ArgumentsAccessStub::NO_NEW_TARGET;
274 ArgumentsAccessStub::Type type; 295 ArgumentsAccessStub::Type type;
275 if (is_strict(language_mode())) { 296 if (is_strict(language_mode()) || !is_simple_parameter_list()) {
276 type = ArgumentsAccessStub::NEW_STRICT; 297 type = ArgumentsAccessStub::NEW_STRICT;
277 } else if (function()->has_duplicate_parameters()) { 298 } else if (function()->has_duplicate_parameters()) {
278 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; 299 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
279 } else { 300 } else {
280 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; 301 type = ArgumentsAccessStub::NEW_SLOPPY_FAST;
281 } 302 }
282 ArgumentsAccessStub stub(isolate(), type, has_new_target); 303 ArgumentsAccessStub stub(isolate(), type, has_new_target);
283 __ CallStub(&stub); 304 __ CallStub(&stub);
284 305
285 SetVar(arguments, v0, a1, a2); 306 SetVar(arguments, v0, a1, a2);
(...skipping 5141 matching lines...) Expand 10 before | Expand all | Expand 10 after
5427 Assembler::target_address_at(pc_immediate_load_address)) == 5448 Assembler::target_address_at(pc_immediate_load_address)) ==
5428 reinterpret_cast<uint64_t>( 5449 reinterpret_cast<uint64_t>(
5429 isolate->builtins()->OsrAfterStackCheck()->entry())); 5450 isolate->builtins()->OsrAfterStackCheck()->entry()));
5430 return OSR_AFTER_STACK_CHECK; 5451 return OSR_AFTER_STACK_CHECK;
5431 } 5452 }
5432 5453
5433 5454
5434 } } // namespace v8::internal 5455 } } // namespace v8::internal
5435 5456
5436 #endif // V8_TARGET_ARCH_MIPS64 5457 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698