OLD | NEW |
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 2717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2728 } | 2728 } |
2729 | 2729 |
2730 // Convert old value into a number. | 2730 // Convert old value into a number. |
2731 old_value = NewNode(javascript()->ToNumber(), old_value); | 2731 old_value = NewNode(javascript()->ToNumber(), old_value); |
2732 PrepareFrameState(old_value, expr->ToNumberId(), | 2732 PrepareFrameState(old_value, expr->ToNumberId(), |
2733 OutputFrameStateCombine::Push()); | 2733 OutputFrameStateCombine::Push()); |
2734 | 2734 |
2735 // Create a proper eager frame state for the stores. | 2735 // Create a proper eager frame state for the stores. |
2736 environment()->Push(old_value); | 2736 environment()->Push(old_value); |
2737 FrameStateBeforeAndAfter store_states(this, expr->ToNumberId()); | 2737 FrameStateBeforeAndAfter store_states(this, expr->ToNumberId()); |
| 2738 FrameStateBeforeAndAfter binop_states(this, expr->ToNumberId()); |
2738 old_value = environment()->Pop(); | 2739 old_value = environment()->Pop(); |
2739 | 2740 |
2740 // Save result for postfix expressions at correct stack depth. | 2741 // Save result for postfix expressions at correct stack depth. |
2741 if (is_postfix) { | 2742 if (is_postfix) { |
2742 if (assign_type != VARIABLE) { | 2743 if (assign_type != VARIABLE) { |
2743 environment()->Poke(stack_depth, old_value); | 2744 environment()->Poke(stack_depth, old_value); |
2744 } else { | 2745 } else { |
2745 environment()->Push(old_value); | 2746 environment()->Push(old_value); |
2746 } | 2747 } |
2747 } | 2748 } |
2748 | 2749 |
2749 // Create node to perform +1/-1 operation. | 2750 // Create node to perform +1/-1 operation. |
2750 Node* value; | 2751 // TODO(bmeurer): Cleanup this feedback/bailout mess! |
2751 { | 2752 Node* value = BuildBinaryOp(old_value, jsgraph()->OneConstant(), |
2752 // TODO(bmeurer): Cleanup this feedback/bailout mess! | 2753 expr->binary_op(), expr->CountBinOpFeedbackId()); |
2753 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 2754 // This should never deoptimize because we have converted to number before. |
2754 value = BuildBinaryOp(old_value, jsgraph()->OneConstant(), | 2755 binop_states.AddToNode(value, BailoutId::None(), |
2755 expr->binary_op(), expr->CountBinOpFeedbackId()); | 2756 OutputFrameStateCombine::Ignore()); |
2756 // This should never deoptimize because we have converted to number before. | |
2757 states.AddToNode(value, BailoutId::None(), | |
2758 OutputFrameStateCombine::Ignore()); | |
2759 } | |
2760 | 2757 |
2761 // Store the value. | 2758 // Store the value. |
2762 VectorSlotPair feedback = CreateVectorSlotPair(expr->CountSlot()); | 2759 VectorSlotPair feedback = CreateVectorSlotPair(expr->CountSlot()); |
2763 switch (assign_type) { | 2760 switch (assign_type) { |
2764 case VARIABLE: { | 2761 case VARIABLE: { |
2765 Variable* variable = expr->expression()->AsVariableProxy()->var(); | 2762 Variable* variable = expr->expression()->AsVariableProxy()->var(); |
2766 environment()->Push(value); | 2763 environment()->Push(value); |
2767 BuildVariableAssignment(variable, value, expr->op(), feedback, | 2764 BuildVariableAssignment(variable, value, expr->op(), feedback, |
2768 expr->AssignmentId(), store_states); | 2765 expr->AssignmentId(), store_states); |
2769 environment()->Pop(); | 2766 environment()->Pop(); |
(...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4376 // Phi does not exist yet, introduce one. | 4373 // Phi does not exist yet, introduce one. |
4377 value = NewPhi(inputs, value, control); | 4374 value = NewPhi(inputs, value, control); |
4378 value->ReplaceInput(inputs - 1, other); | 4375 value->ReplaceInput(inputs - 1, other); |
4379 } | 4376 } |
4380 return value; | 4377 return value; |
4381 } | 4378 } |
4382 | 4379 |
4383 } // namespace compiler | 4380 } // namespace compiler |
4384 } // namespace internal | 4381 } // namespace internal |
4385 } // namespace v8 | 4382 } // namespace v8 |
OLD | NEW |