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

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

Issue 2663963003: [Ignition] Rename New and NewWithSpread bytecodes. (Closed)
Patch Set: Update comments Created 3 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/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/builtins/builtins-constructor.h" 9 #include "src/builtins/builtins-constructor.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2588 matching lines...) Expand 10 before | Expand all | Expand 10 after
2599 VisitArguments(args, &args_regs); 2599 VisitArguments(args, &args_regs);
2600 // The new target is loaded into the accumulator from the 2600 // The new target is loaded into the accumulator from the
2601 // {new.target} variable. 2601 // {new.target} variable.
2602 VisitForAccumulatorValue(super->new_target_var()); 2602 VisitForAccumulatorValue(super->new_target_var());
2603 builder()->SetExpressionPosition(expr); 2603 builder()->SetExpressionPosition(expr);
2604 2604
2605 // When a super call contains a spread, a CallSuper AST node is only created 2605 // When a super call contains a spread, a CallSuper AST node is only created
2606 // if there is exactly one spread, and it is the last argument. 2606 // if there is exactly one spread, and it is the last argument.
2607 if (expr->only_last_arg_is_spread()) { 2607 if (expr->only_last_arg_is_spread()) {
2608 // TODO(petermarshall): Collect type on the feedback slot. 2608 // TODO(petermarshall): Collect type on the feedback slot.
2609 builder()->NewWithSpread(constructor, args_regs); 2609 builder()->ConstructWithSpread(constructor, args_regs);
2610 } else { 2610 } else {
2611 // Call construct. 2611 // Call construct.
2612 // TODO(turbofan): For now we do gather feedback on super constructor 2612 // TODO(turbofan): For now we do gather feedback on super constructor
2613 // calls, utilizing the existing machinery to inline the actual call 2613 // calls, utilizing the existing machinery to inline the actual call
2614 // target and the JSCreate for the implicit receiver allocation. This 2614 // target and the JSCreate for the implicit receiver allocation. This
2615 // is not an ideal solution for super constructor calls, but it gets 2615 // is not an ideal solution for super constructor calls, but it gets
2616 // the job done for now. In the long run we might want to revisit this 2616 // the job done for now. In the long run we might want to revisit this
2617 // and come up with a better way. 2617 // and come up with a better way.
2618 int const feedback_slot_index = feedback_index(expr->CallFeedbackICSlot()); 2618 int const feedback_slot_index = feedback_index(expr->CallFeedbackICSlot());
2619 builder()->New(constructor, args_regs, feedback_slot_index); 2619 builder()->Construct(constructor, args_regs, feedback_slot_index);
2620 } 2620 }
2621 } 2621 }
2622 2622
2623 void BytecodeGenerator::VisitCallNew(CallNew* expr) { 2623 void BytecodeGenerator::VisitCallNew(CallNew* expr) {
2624 Register constructor = VisitForRegisterValue(expr->expression()); 2624 Register constructor = VisitForRegisterValue(expr->expression());
2625 RegisterList args = register_allocator()->NewGrowableRegisterList(); 2625 RegisterList args = register_allocator()->NewGrowableRegisterList();
2626 VisitArguments(expr->arguments(), &args); 2626 VisitArguments(expr->arguments(), &args);
2627 2627
2628 // The accumulator holds new target which is the same as the 2628 // The accumulator holds new target which is the same as the
2629 // constructor for CallNew. 2629 // constructor for CallNew.
2630 builder()->SetExpressionPosition(expr); 2630 builder()->SetExpressionPosition(expr);
2631 builder()->LoadAccumulatorWithRegister(constructor); 2631 builder()->LoadAccumulatorWithRegister(constructor);
2632 2632
2633 if (expr->only_last_arg_is_spread()) { 2633 if (expr->only_last_arg_is_spread()) {
2634 // TODO(petermarshall): Collect type on the feedback slot. 2634 // TODO(petermarshall): Collect type on the feedback slot.
2635 builder()->NewWithSpread(constructor, args); 2635 builder()->ConstructWithSpread(constructor, args);
2636 } else { 2636 } else {
2637 builder()->New(constructor, args, 2637 builder()->Construct(constructor, args,
2638 feedback_index(expr->CallNewFeedbackSlot())); 2638 feedback_index(expr->CallNewFeedbackSlot()));
2639 } 2639 }
2640 } 2640 }
2641 2641
2642 void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) { 2642 void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) {
2643 if (expr->is_jsruntime()) { 2643 if (expr->is_jsruntime()) {
2644 RegisterList args = register_allocator()->NewGrowableRegisterList(); 2644 RegisterList args = register_allocator()->NewGrowableRegisterList();
2645 // Allocate a register for the receiver and load it with undefined. 2645 // Allocate a register for the receiver and load it with undefined.
2646 BuildPushUndefinedIntoRegisterList(&args); 2646 BuildPushUndefinedIntoRegisterList(&args);
2647 VisitArguments(expr->arguments(), &args); 2647 VisitArguments(expr->arguments(), &args);
2648 builder()->CallJSRuntime(expr->context_index(), args); 2648 builder()->CallJSRuntime(expr->context_index(), args);
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
3377 } 3377 }
3378 3378
3379 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { 3379 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() {
3380 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict 3380 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
3381 : Runtime::kStoreKeyedToSuper_Sloppy; 3381 : Runtime::kStoreKeyedToSuper_Sloppy;
3382 } 3382 }
3383 3383
3384 } // namespace interpreter 3384 } // namespace interpreter
3385 } // namespace internal 3385 } // namespace internal
3386 } // namespace v8 3386 } // 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