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

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

Issue 1028703002: MIPS: [es6] generate rest parameters correctly for subclass constructors (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/full-codegen-mips.cc ('k') | no next file » | 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 248
249 ArgumentsAccessStub::HasNewTarget has_new_target =
250 IsSubclassConstructor(info->function()->kind())
251 ? ArgumentsAccessStub::HAS_NEW_TARGET
252 : ArgumentsAccessStub::NO_NEW_TARGET;
253
249 // Possibly allocate RestParameters 254 // Possibly allocate RestParameters
250 int rest_index; 255 int rest_index;
251 Variable* rest_param = scope()->rest_parameter(&rest_index); 256 Variable* rest_param = scope()->rest_parameter(&rest_index);
252 if (rest_param) { 257 if (rest_param) {
253 Comment cmnt(masm_, "[ Allocate rest parameter array"); 258 Comment cmnt(masm_, "[ Allocate rest parameter array");
254 259
255 int num_parameters = info->scope()->num_parameters(); 260 int num_parameters = info->scope()->num_parameters();
256 int offset = num_parameters * kPointerSize; 261 int offset = num_parameters * kPointerSize;
262 if (has_new_target == ArgumentsAccessStub::HAS_NEW_TARGET) {
263 --num_parameters;
264 ++rest_index;
265 }
266
257 __ Daddu(a3, fp, 267 __ Daddu(a3, fp,
258 Operand(StandardFrameConstants::kCallerSPOffset + offset)); 268 Operand(StandardFrameConstants::kCallerSPOffset + offset));
259 __ li(a2, Operand(Smi::FromInt(num_parameters))); 269 __ li(a2, Operand(Smi::FromInt(num_parameters)));
260 __ li(a1, Operand(Smi::FromInt(rest_index))); 270 __ li(a1, Operand(Smi::FromInt(rest_index)));
261 __ Push(a3, a2, a1); 271 __ Push(a3, a2, a1);
262 272
263 RestParamAccessStub stub(isolate()); 273 RestParamAccessStub stub(isolate());
264 __ CallStub(&stub); 274 __ CallStub(&stub);
265 275
266 SetVar(rest_param, v0, a1, a2); 276 SetVar(rest_param, v0, a1, a2);
(...skipping 14 matching lines...) Expand all
281 int offset = num_parameters * kPointerSize; 291 int offset = num_parameters * kPointerSize;
282 __ Daddu(a2, fp, 292 __ Daddu(a2, fp,
283 Operand(StandardFrameConstants::kCallerSPOffset + offset)); 293 Operand(StandardFrameConstants::kCallerSPOffset + offset));
284 __ li(a1, Operand(Smi::FromInt(num_parameters))); 294 __ li(a1, Operand(Smi::FromInt(num_parameters)));
285 __ Push(a3, a2, a1); 295 __ Push(a3, a2, a1);
286 296
287 // Arguments to ArgumentsAccessStub: 297 // Arguments to ArgumentsAccessStub:
288 // function, receiver address, parameter count. 298 // function, receiver address, parameter count.
289 // The stub will rewrite receiever and parameter count if the previous 299 // The stub will rewrite receiever and parameter count if the previous
290 // stack frame was an arguments adapter frame. 300 // stack frame was an arguments adapter frame.
291 ArgumentsAccessStub::HasNewTarget has_new_target =
292 IsSubclassConstructor(info->function()->kind())
293 ? ArgumentsAccessStub::HAS_NEW_TARGET
294 : ArgumentsAccessStub::NO_NEW_TARGET;
295 ArgumentsAccessStub::Type type; 301 ArgumentsAccessStub::Type type;
296 if (is_strict(language_mode()) || !is_simple_parameter_list()) { 302 if (is_strict(language_mode()) || !is_simple_parameter_list()) {
297 type = ArgumentsAccessStub::NEW_STRICT; 303 type = ArgumentsAccessStub::NEW_STRICT;
298 } else if (function()->has_duplicate_parameters()) { 304 } else if (function()->has_duplicate_parameters()) {
299 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; 305 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
300 } else { 306 } else {
301 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; 307 type = ArgumentsAccessStub::NEW_SLOPPY_FAST;
302 } 308 }
303 ArgumentsAccessStub stub(isolate(), type, has_new_target); 309 ArgumentsAccessStub stub(isolate(), type, has_new_target);
304 __ CallStub(&stub); 310 __ CallStub(&stub);
(...skipping 5157 matching lines...) Expand 10 before | Expand all | Expand 10 after
5462 Assembler::target_address_at(pc_immediate_load_address)) == 5468 Assembler::target_address_at(pc_immediate_load_address)) ==
5463 reinterpret_cast<uint64_t>( 5469 reinterpret_cast<uint64_t>(
5464 isolate->builtins()->OsrAfterStackCheck()->entry())); 5470 isolate->builtins()->OsrAfterStackCheck()->entry()));
5465 return OSR_AFTER_STACK_CHECK; 5471 return OSR_AFTER_STACK_CHECK;
5466 } 5472 }
5467 5473
5468 5474
5469 } } // namespace v8::internal 5475 } } // namespace v8::internal
5470 5476
5471 #endif // V8_TARGET_ARCH_MIPS64 5477 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/full-codegen-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698