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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 1921563002: [turbofan] Initial version of number type feedback. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add tests for the checks and fix check insertion Created 4 years, 6 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/compiler/ast-loop-assignment-analyzer.h" 9 #include "src/compiler/ast-loop-assignment-analyzer.h"
10 #include "src/compiler/control-builders.h" 10 #include "src/compiler/control-builders.h"
(...skipping 2711 matching lines...) Expand 10 before | Expand all | Expand 10 after
2722 } 2722 }
2723 2723
2724 // Convert old value into a number. 2724 // Convert old value into a number.
2725 old_value = NewNode(javascript()->ToNumber(), old_value); 2725 old_value = NewNode(javascript()->ToNumber(), old_value);
2726 PrepareFrameState(old_value, expr->ToNumberId(), 2726 PrepareFrameState(old_value, expr->ToNumberId(),
2727 OutputFrameStateCombine::Push()); 2727 OutputFrameStateCombine::Push());
2728 2728
2729 // Create a proper eager frame state for the stores. 2729 // Create a proper eager frame state for the stores.
2730 environment()->Push(old_value); 2730 environment()->Push(old_value);
2731 FrameStateBeforeAndAfter store_states(this, expr->ToNumberId()); 2731 FrameStateBeforeAndAfter store_states(this, expr->ToNumberId());
2732 FrameStateBeforeAndAfter binop_states(this, expr->ToNumberId());
2732 old_value = environment()->Pop(); 2733 old_value = environment()->Pop();
2733 2734
2734 // Save result for postfix expressions at correct stack depth. 2735 // Save result for postfix expressions at correct stack depth.
2735 if (is_postfix) { 2736 if (is_postfix) {
2736 if (assign_type != VARIABLE) { 2737 if (assign_type != VARIABLE) {
2737 environment()->Poke(stack_depth, old_value); 2738 environment()->Poke(stack_depth, old_value);
2738 } else { 2739 } else {
2739 environment()->Push(old_value); 2740 environment()->Push(old_value);
2740 } 2741 }
2741 } 2742 }
2742 2743
2743 // Create node to perform +1/-1 operation. 2744 // Create node to perform +1/-1 operation.
2744 Node* value; 2745 // TODO(bmeurer): Cleanup this feedback/bailout mess!
2745 { 2746 Node* value = BuildBinaryOp(old_value, jsgraph()->OneConstant(),
2746 // TODO(bmeurer): Cleanup this feedback/bailout mess! 2747 expr->binary_op(), expr->CountBinOpFeedbackId());
2747 FrameStateBeforeAndAfter states(this, BailoutId::None()); 2748 // This should never deoptimize because we have converted to number before.
2748 value = BuildBinaryOp(old_value, jsgraph()->OneConstant(), 2749 binop_states.AddToNode(value, BailoutId::None(),
2749 expr->binary_op(), expr->CountBinOpFeedbackId()); 2750 OutputFrameStateCombine::Ignore());
2750 // This should never deoptimize because we have converted to number before.
2751 states.AddToNode(value, BailoutId::None(),
2752 OutputFrameStateCombine::Ignore());
2753 }
2754 2751
2755 // Store the value. 2752 // Store the value.
2756 VectorSlotPair feedback = CreateVectorSlotPair(expr->CountSlot()); 2753 VectorSlotPair feedback = CreateVectorSlotPair(expr->CountSlot());
2757 switch (assign_type) { 2754 switch (assign_type) {
2758 case VARIABLE: { 2755 case VARIABLE: {
2759 Variable* variable = expr->expression()->AsVariableProxy()->var(); 2756 Variable* variable = expr->expression()->AsVariableProxy()->var();
2760 environment()->Push(value); 2757 environment()->Push(value);
2761 BuildVariableAssignment(variable, value, expr->op(), feedback, 2758 BuildVariableAssignment(variable, value, expr->op(), feedback,
2762 expr->AssignmentId(), store_states); 2759 expr->AssignmentId(), store_states);
2763 environment()->Pop(); 2760 environment()->Pop();
(...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after
4370 // Phi does not exist yet, introduce one. 4367 // Phi does not exist yet, introduce one.
4371 value = NewPhi(inputs, value, control); 4368 value = NewPhi(inputs, value, control);
4372 value->ReplaceInput(inputs - 1, other); 4369 value->ReplaceInput(inputs - 1, other);
4373 } 4370 }
4374 return value; 4371 return value;
4375 } 4372 }
4376 4373
4377 } // namespace compiler 4374 } // namespace compiler
4378 } // namespace internal 4375 } // namespace internal
4379 } // namespace v8 4376 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698