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

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

Issue 2212343002: Revert of [Interpreter] Collect type feedback for 'new' in the bytecode handler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/interpreter/bytecode-flags.h" 10 #include "src/interpreter/bytecode-flags.h"
(...skipping 2601 matching lines...) Expand 10 before | Expand all | Expand 10 after
2612 ->CallRuntime(Runtime::kResolvePossiblyDirectEval, callee_for_eval, 6) 2612 ->CallRuntime(Runtime::kResolvePossiblyDirectEval, callee_for_eval, 6)
2613 .StoreAccumulatorInRegister(callee); 2613 .StoreAccumulatorInRegister(callee);
2614 } 2614 }
2615 2615
2616 builder()->SetExpressionPosition(expr); 2616 builder()->SetExpressionPosition(expr);
2617 2617
2618 int feedback_slot_index; 2618 int feedback_slot_index;
2619 if (expr->CallFeedbackICSlot().IsInvalid()) { 2619 if (expr->CallFeedbackICSlot().IsInvalid()) {
2620 DCHECK(call_type == Call::POSSIBLY_EVAL_CALL); 2620 DCHECK(call_type == Call::POSSIBLY_EVAL_CALL);
2621 // Valid type feedback slots can only be greater than kReservedIndexCount. 2621 // Valid type feedback slots can only be greater than kReservedIndexCount.
2622 // We use 0 to indicate an invalid slot id. Statically assert that 0 cannot 2622 // We use 0 to indicate an invalid slot it. Statically assert that 0 cannot
2623 // be a valid slot id. 2623 // be a valid slot id.
2624 STATIC_ASSERT(TypeFeedbackVector::kReservedIndexCount > 0); 2624 STATIC_ASSERT(TypeFeedbackVector::kReservedIndexCount > 0);
2625 feedback_slot_index = 0; 2625 feedback_slot_index = 0;
2626 } else { 2626 } else {
2627 feedback_slot_index = feedback_index(expr->CallFeedbackICSlot()); 2627 feedback_slot_index = feedback_index(expr->CallFeedbackICSlot());
2628 } 2628 }
2629 builder()->Call(callee, receiver, 1 + args->length(), feedback_slot_index, 2629 builder()->Call(callee, receiver, 1 + args->length(), feedback_slot_index,
2630 expr->tail_call_mode()); 2630 expr->tail_call_mode());
2631 execution_result()->SetResultInAccumulator(); 2631 execution_result()->SetResultInAccumulator();
2632 } 2632 }
(...skipping 14 matching lines...) Expand all
2647 2647
2648 ZoneList<Expression*>* args = expr->arguments(); 2648 ZoneList<Expression*>* args = expr->arguments();
2649 Register first_arg = VisitArguments(args); 2649 Register first_arg = VisitArguments(args);
2650 2650
2651 // The new target is loaded into the accumulator from the 2651 // The new target is loaded into the accumulator from the
2652 // {new.target} variable. 2652 // {new.target} variable.
2653 VisitForAccumulatorValue(super->new_target_var()); 2653 VisitForAccumulatorValue(super->new_target_var());
2654 2654
2655 // Call construct. 2655 // Call construct.
2656 builder()->SetExpressionPosition(expr); 2656 builder()->SetExpressionPosition(expr);
2657 // Valid type feedback slots can only be greater than kReservedIndexCount. 2657 builder()->New(constructor, first_arg, args->length());
2658 // Assert that 0 cannot be valid a valid slot id.
2659 STATIC_ASSERT(TypeFeedbackVector::kReservedIndexCount > 0);
2660 // Type feedback is not necessary for super constructor calls. The type
2661 // information can be inferred in most cases. Slot id 0 indicates type
2662 // feedback is not required.
2663 builder()->New(constructor, first_arg, args->length(), 0);
2664 execution_result()->SetResultInAccumulator(); 2658 execution_result()->SetResultInAccumulator();
2665 } 2659 }
2666 2660
2667 void BytecodeGenerator::VisitCallNew(CallNew* expr) { 2661 void BytecodeGenerator::VisitCallNew(CallNew* expr) {
2668 Register constructor = register_allocator()->NewRegister(); 2662 Register constructor = register_allocator()->NewRegister();
2669 VisitForAccumulatorValue(expr->expression()); 2663 VisitForAccumulatorValue(expr->expression());
2670 builder()->StoreAccumulatorInRegister(constructor); 2664 builder()->StoreAccumulatorInRegister(constructor);
2671 2665
2672 ZoneList<Expression*>* args = expr->arguments(); 2666 ZoneList<Expression*>* args = expr->arguments();
2673 Register first_arg = VisitArguments(args); 2667 Register first_arg = VisitArguments(args);
2674 2668
2675 builder()->SetExpressionPosition(expr); 2669 builder()->SetExpressionPosition(expr);
2676 // The accumulator holds new target which is the same as the 2670 // The accumulator holds new target which is the same as the
2677 // constructor for CallNew. 2671 // constructor for CallNew.
2678 builder() 2672 builder()
2679 ->LoadAccumulatorWithRegister(constructor) 2673 ->LoadAccumulatorWithRegister(constructor)
2680 .New(constructor, first_arg, args->length(), 2674 .New(constructor, first_arg, args->length());
2681 feedback_index(expr->CallNewFeedbackSlot()));
2682 execution_result()->SetResultInAccumulator(); 2675 execution_result()->SetResultInAccumulator();
2683 } 2676 }
2684 2677
2685 void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) { 2678 void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) {
2686 ZoneList<Expression*>* args = expr->arguments(); 2679 ZoneList<Expression*>* args = expr->arguments();
2687 if (expr->is_jsruntime()) { 2680 if (expr->is_jsruntime()) {
2688 // Allocate a register for the receiver and load it with undefined. 2681 // Allocate a register for the receiver and load it with undefined.
2689 register_allocator()->PrepareForConsecutiveAllocations(1 + args->length()); 2682 register_allocator()->PrepareForConsecutiveAllocations(1 + args->length());
2690 Register receiver = register_allocator()->NextConsecutiveRegister(); 2683 Register receiver = register_allocator()->NextConsecutiveRegister();
2691 builder()->LoadUndefined().StoreAccumulatorInRegister(receiver); 2684 builder()->LoadUndefined().StoreAccumulatorInRegister(receiver);
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
3278 return execution_context()->scope()->language_mode(); 3271 return execution_context()->scope()->language_mode();
3279 } 3272 }
3280 3273
3281 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3274 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3282 return TypeFeedbackVector::GetIndex(slot); 3275 return TypeFeedbackVector::GetIndex(slot);
3283 } 3276 }
3284 3277
3285 } // namespace interpreter 3278 } // namespace interpreter
3286 } // namespace internal 3279 } // namespace internal
3287 } // namespace v8 3280 } // 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