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 2686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2697 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | 2697 CreateVectorSlotPair(property->PropertyFeedbackSlot()); |
2698 old_value = BuildKeyedSuperLoad(receiver, home_object, key, pair); | 2698 old_value = BuildKeyedSuperLoad(receiver, home_object, key, pair); |
2699 states.AddToNode(old_value, property->LoadId(), | 2699 states.AddToNode(old_value, property->LoadId(), |
2700 OutputFrameStateCombine::Push()); | 2700 OutputFrameStateCombine::Push()); |
2701 stack_depth = 3; | 2701 stack_depth = 3; |
2702 break; | 2702 break; |
2703 } | 2703 } |
2704 } | 2704 } |
2705 | 2705 |
2706 // Convert old value into a number. | 2706 // Convert old value into a number. |
2707 if (!is_strong(language_mode())) { | 2707 old_value = NewNode(javascript()->ToNumber(), old_value); |
2708 old_value = NewNode(javascript()->ToNumber(), old_value); | 2708 PrepareFrameState(old_value, expr->ToNumberId(), |
2709 PrepareFrameState(old_value, expr->ToNumberId(), | 2709 OutputFrameStateCombine::Push()); |
2710 OutputFrameStateCombine::Push()); | |
2711 } | |
2712 | 2710 |
2713 // Create a proper eager frame state for the stores. | 2711 // Create a proper eager frame state for the stores. |
2714 environment()->Push(old_value); | 2712 environment()->Push(old_value); |
2715 FrameStateBeforeAndAfter store_states(this, expr->ToNumberId()); | 2713 FrameStateBeforeAndAfter store_states(this, expr->ToNumberId()); |
2716 old_value = environment()->Pop(); | 2714 old_value = environment()->Pop(); |
2717 | 2715 |
2718 // Save result for postfix expressions at correct stack depth. | 2716 // Save result for postfix expressions at correct stack depth. |
2719 if (is_postfix) { | 2717 if (is_postfix) { |
2720 if (assign_type != VARIABLE) { | 2718 if (assign_type != VARIABLE) { |
2721 environment()->Poke(stack_depth, old_value); | 2719 environment()->Poke(stack_depth, old_value); |
2722 } else { | 2720 } else { |
2723 environment()->Push(old_value); | 2721 environment()->Push(old_value); |
2724 } | 2722 } |
2725 } | 2723 } |
2726 | 2724 |
2727 // Create node to perform +1/-1 operation. | 2725 // Create node to perform +1/-1 operation. |
2728 Node* value; | 2726 Node* value; |
2729 { | 2727 { |
2730 // TODO(bmeurer): Cleanup this feedback/bailout mess! | 2728 // TODO(bmeurer): Cleanup this feedback/bailout mess! |
2731 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 2729 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
2732 value = BuildBinaryOp(old_value, jsgraph()->OneConstant(), | 2730 value = BuildBinaryOp(old_value, jsgraph()->OneConstant(), |
2733 expr->binary_op(), expr->CountBinOpFeedbackId()); | 2731 expr->binary_op(), expr->CountBinOpFeedbackId()); |
2734 // This should never deoptimize outside strong mode because otherwise we | 2732 // This should never deoptimize because we have converted to number before. |
2735 // have converted to number before. | 2733 states.AddToNode(value, BailoutId::None(), |
2736 states.AddToNode(value, is_strong(language_mode()) ? expr->ToNumberId() | |
2737 : BailoutId::None(), | |
2738 OutputFrameStateCombine::Ignore()); | 2734 OutputFrameStateCombine::Ignore()); |
2739 } | 2735 } |
2740 | 2736 |
2741 // Store the value. | 2737 // Store the value. |
2742 VectorSlotPair feedback = CreateVectorSlotPair(expr->CountSlot()); | 2738 VectorSlotPair feedback = CreateVectorSlotPair(expr->CountSlot()); |
2743 switch (assign_type) { | 2739 switch (assign_type) { |
2744 case VARIABLE: { | 2740 case VARIABLE: { |
2745 Variable* variable = expr->expression()->AsVariableProxy()->var(); | 2741 Variable* variable = expr->expression()->AsVariableProxy()->var(); |
2746 environment()->Push(value); | 2742 environment()->Push(value); |
2747 BuildVariableAssignment(variable, value, expr->op(), feedback, | 2743 BuildVariableAssignment(variable, value, expr->op(), feedback, |
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4343 // Phi does not exist yet, introduce one. | 4339 // Phi does not exist yet, introduce one. |
4344 value = NewPhi(inputs, value, control); | 4340 value = NewPhi(inputs, value, control); |
4345 value->ReplaceInput(inputs - 1, other); | 4341 value->ReplaceInput(inputs - 1, other); |
4346 } | 4342 } |
4347 return value; | 4343 return value; |
4348 } | 4344 } |
4349 | 4345 |
4350 } // namespace compiler | 4346 } // namespace compiler |
4351 } // namespace internal | 4347 } // namespace internal |
4352 } // namespace v8 | 4348 } // namespace v8 |
OLD | NEW |