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

Side by Side Diff: src/mips/full-codegen-mips.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 | « no previous file | src/mips64/full-codegen-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 ArgumentsAccessStub::HasNewTarget has_new_target =
253 IsSubclassConstructor(info->function()->kind())
254 ? ArgumentsAccessStub::HAS_NEW_TARGET
255 : ArgumentsAccessStub::NO_NEW_TARGET;
256
252 // Possibly allocate RestParameters 257 // Possibly allocate RestParameters
253 int rest_index; 258 int rest_index;
254 Variable* rest_param = scope()->rest_parameter(&rest_index); 259 Variable* rest_param = scope()->rest_parameter(&rest_index);
255 if (rest_param) { 260 if (rest_param) {
256 Comment cmnt(masm_, "[ Allocate rest parameter array"); 261 Comment cmnt(masm_, "[ Allocate rest parameter array");
257 262
258 int num_parameters = info->scope()->num_parameters(); 263 int num_parameters = info->scope()->num_parameters();
259 int offset = num_parameters * kPointerSize; 264 int offset = num_parameters * kPointerSize;
265 if (has_new_target == ArgumentsAccessStub::HAS_NEW_TARGET) {
266 --num_parameters;
267 ++rest_index;
268 }
269
260 __ Addu(a3, fp, 270 __ Addu(a3, fp,
261 Operand(StandardFrameConstants::kCallerSPOffset + offset)); 271 Operand(StandardFrameConstants::kCallerSPOffset + offset));
262 __ li(a2, Operand(Smi::FromInt(num_parameters))); 272 __ li(a2, Operand(Smi::FromInt(num_parameters)));
263 __ li(a1, Operand(Smi::FromInt(rest_index))); 273 __ li(a1, Operand(Smi::FromInt(rest_index)));
264 __ Push(a3, a2, a1); 274 __ Push(a3, a2, a1);
265 275
266 RestParamAccessStub stub(isolate()); 276 RestParamAccessStub stub(isolate());
267 __ CallStub(&stub); 277 __ CallStub(&stub);
268 278
269 SetVar(rest_param, v0, a1, a2); 279 SetVar(rest_param, v0, a1, a2);
(...skipping 14 matching lines...) Expand all
284 int offset = num_parameters * kPointerSize; 294 int offset = num_parameters * kPointerSize;
285 __ Addu(a2, fp, 295 __ Addu(a2, fp,
286 Operand(StandardFrameConstants::kCallerSPOffset + offset)); 296 Operand(StandardFrameConstants::kCallerSPOffset + offset));
287 __ li(a1, Operand(Smi::FromInt(num_parameters))); 297 __ li(a1, Operand(Smi::FromInt(num_parameters)));
288 __ Push(a3, a2, a1); 298 __ Push(a3, a2, a1);
289 299
290 // Arguments to ArgumentsAccessStub: 300 // Arguments to ArgumentsAccessStub:
291 // function, receiver address, parameter count. 301 // function, receiver address, parameter count.
292 // The stub will rewrite receiever and parameter count if the previous 302 // The stub will rewrite receiever and parameter count if the previous
293 // stack frame was an arguments adapter frame. 303 // stack frame was an arguments adapter frame.
294 ArgumentsAccessStub::HasNewTarget has_new_target =
295 IsSubclassConstructor(info->function()->kind())
296 ? ArgumentsAccessStub::HAS_NEW_TARGET
297 : ArgumentsAccessStub::NO_NEW_TARGET;
298 ArgumentsAccessStub::Type type; 304 ArgumentsAccessStub::Type type;
299 if (is_strict(language_mode()) || !is_simple_parameter_list()) { 305 if (is_strict(language_mode()) || !is_simple_parameter_list()) {
300 type = ArgumentsAccessStub::NEW_STRICT; 306 type = ArgumentsAccessStub::NEW_STRICT;
301 } else if (function()->has_duplicate_parameters()) { 307 } else if (function()->has_duplicate_parameters()) {
302 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; 308 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
303 } else { 309 } else {
304 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; 310 type = ArgumentsAccessStub::NEW_SLOPPY_FAST;
305 } 311 }
306 ArgumentsAccessStub stub(isolate(), type, has_new_target); 312 ArgumentsAccessStub stub(isolate(), type, has_new_target);
307 __ CallStub(&stub); 313 __ CallStub(&stub);
(...skipping 5148 matching lines...) Expand 10 before | Expand all | Expand 10 after
5456 Assembler::target_address_at(pc_immediate_load_address)) == 5462 Assembler::target_address_at(pc_immediate_load_address)) ==
5457 reinterpret_cast<uint32_t>( 5463 reinterpret_cast<uint32_t>(
5458 isolate->builtins()->OsrAfterStackCheck()->entry())); 5464 isolate->builtins()->OsrAfterStackCheck()->entry()));
5459 return OSR_AFTER_STACK_CHECK; 5465 return OSR_AFTER_STACK_CHECK;
5460 } 5466 }
5461 5467
5462 5468
5463 } } // namespace v8::internal 5469 } } // namespace v8::internal
5464 5470
5465 #endif // V8_TARGET_ARCH_MIPS 5471 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698