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

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 2541113004: [Ignition/turbo] Add a NewWithSpread bytecode. (Closed)
Patch Set: Add todo Created 4 years 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/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/interpreter/bytecode-generator.h" 5 #include "src/interpreter/bytecode-generator.h"
6 6
7 #include "src/ast/compile-time-value.h" 7 #include "src/ast/compile-time-value.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-info.h" 10 #include "src/compilation-info.h"
(...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after
2486 builder()->CallRuntime(Runtime::kInlineGetSuperConstructor, this_function); 2486 builder()->CallRuntime(Runtime::kInlineGetSuperConstructor, this_function);
2487 2487
2488 Register constructor = this_function; // Re-use dead this_function register. 2488 Register constructor = this_function; // Re-use dead this_function register.
2489 builder()->StoreAccumulatorInRegister(constructor); 2489 builder()->StoreAccumulatorInRegister(constructor);
2490 2490
2491 ZoneList<Expression*>* args = expr->arguments(); 2491 ZoneList<Expression*>* args = expr->arguments();
2492 2492
2493 // When a super call contains a spread, a CallSuper AST node is only created 2493 // When a super call contains a spread, a CallSuper AST node is only created
2494 // if there is exactly one spread, and it is the last argument. 2494 // if there is exactly one spread, and it is the last argument.
2495 if (!args->is_empty() && args->last()->IsSpread()) { 2495 if (!args->is_empty() && args->last()->IsSpread()) {
2496 // Prepare the spread arguments. 2496 RegisterList args_regs =
2497 RegisterList spread_prepare_args = 2497 register_allocator()->NewRegisterList(args->length() + 2);
2498 register_allocator()->NewRegisterList(args->length()); 2498 builder()->MoveRegister(constructor, args_regs[0]);
2499 VisitArguments(args, spread_prepare_args); 2499 VisitForRegisterValue(super->new_target_var(), args_regs[1]);
2500 2500 VisitArguments(args, args_regs, 2);
2501 builder()->CallRuntime(Runtime::kSpreadIterablePrepareVarargs, 2501 builder()->NewWithSpread(args_regs);
2502 spread_prepare_args);
2503
2504 // Call ReflectConstruct to do the actual super constructor call.
2505 RegisterList reflect_construct_args =
2506 register_allocator()->NewRegisterList(4);
2507 builder()
2508 ->StoreAccumulatorInRegister(reflect_construct_args[2])
2509 .LoadUndefined()
2510 .StoreAccumulatorInRegister(reflect_construct_args[0])
2511 .MoveRegister(constructor, reflect_construct_args[1]);
2512 VisitForRegisterValue(super->new_target_var(), reflect_construct_args[3]);
2513 builder()->CallJSRuntime(Context::REFLECT_CONSTRUCT_INDEX,
2514 reflect_construct_args);
2515 } else { 2502 } else {
2516 RegisterList args_regs = 2503 RegisterList args_regs =
2517 register_allocator()->NewRegisterList(args->length()); 2504 register_allocator()->NewRegisterList(args->length());
2518 VisitArguments(args, args_regs); 2505 VisitArguments(args, args_regs);
2519 // The new target is loaded into the accumulator from the 2506 // The new target is loaded into the accumulator from the
2520 // {new.target} variable. 2507 // {new.target} variable.
2521 VisitForAccumulatorValue(super->new_target_var()); 2508 VisitForAccumulatorValue(super->new_target_var());
2522 2509
2523 // Call construct. 2510 // Call construct.
2524 builder()->SetExpressionPosition(expr); 2511 builder()->SetExpressionPosition(expr);
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
3223 } 3210 }
3224 3211
3225 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { 3212 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() {
3226 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict 3213 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
3227 : Runtime::kStoreKeyedToSuper_Sloppy; 3214 : Runtime::kStoreKeyedToSuper_Sloppy;
3228 } 3215 }
3229 3216
3230 } // namespace interpreter 3217 } // namespace interpreter
3231 } // namespace internal 3218 } // namespace internal
3232 } // namespace v8 3219 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698