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 2677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2688 } | 2688 } |
2689 } | 2689 } |
2690 | 2690 |
2691 // Convert old value into a number. | 2691 // Convert old value into a number. |
2692 old_value = NewNode(javascript()->ToNumber(), old_value); | 2692 old_value = NewNode(javascript()->ToNumber(), old_value); |
2693 PrepareFrameState(old_value, expr->ToNumberId(), | 2693 PrepareFrameState(old_value, expr->ToNumberId(), |
2694 OutputFrameStateCombine::Push()); | 2694 OutputFrameStateCombine::Push()); |
2695 | 2695 |
2696 // Create a proper eager frame state for the stores. | 2696 // Create a proper eager frame state for the stores. |
2697 environment()->Push(old_value); | 2697 environment()->Push(old_value); |
2698 FrameStateBeforeAndAfter binop_states(this, expr->ToNumberId()); | 2698 PrepareEagerCheckpoint(expr->ToNumberId()); |
2699 old_value = environment()->Pop(); | 2699 old_value = environment()->Pop(); |
2700 | 2700 |
2701 // Save result for postfix expressions at correct stack depth. | 2701 // Save result for postfix expressions at correct stack depth. |
2702 if (is_postfix) { | 2702 if (is_postfix) { |
2703 if (assign_type != VARIABLE) { | 2703 if (assign_type != VARIABLE) { |
2704 environment()->Poke(stack_depth, old_value); | 2704 environment()->Poke(stack_depth, old_value); |
2705 } else { | 2705 } else { |
2706 environment()->Push(old_value); | 2706 environment()->Push(old_value); |
2707 } | 2707 } |
2708 } | 2708 } |
2709 | 2709 |
2710 // Create node to perform +1/-1 operation. | 2710 // Create node to perform +1/-1 operation. |
2711 // TODO(bmeurer): Cleanup this feedback/bailout mess! | |
2712 Node* value = BuildBinaryOp(old_value, jsgraph()->OneConstant(), | 2711 Node* value = BuildBinaryOp(old_value, jsgraph()->OneConstant(), |
2713 expr->binary_op(), expr->CountBinOpFeedbackId()); | 2712 expr->binary_op(), expr->CountBinOpFeedbackId()); |
2714 // This should never deoptimize because we have converted to number before. | 2713 // This should never lazy deopt because we have converted to number before. |
2715 binop_states.AddToNode(value, BailoutId::None(), | 2714 PrepareFrameState(value, BailoutId::None()); |
2716 OutputFrameStateCombine::Ignore()); | |
2717 | 2715 |
2718 // Store the value. | 2716 // Store the value. |
2719 VectorSlotPair feedback = CreateVectorSlotPair(expr->CountSlot()); | 2717 VectorSlotPair feedback = CreateVectorSlotPair(expr->CountSlot()); |
2720 switch (assign_type) { | 2718 switch (assign_type) { |
2721 case VARIABLE: { | 2719 case VARIABLE: { |
2722 Variable* variable = expr->expression()->AsVariableProxy()->var(); | 2720 Variable* variable = expr->expression()->AsVariableProxy()->var(); |
2723 environment()->Push(value); | 2721 environment()->Push(value); |
2724 BuildVariableAssignment(variable, value, expr->op(), feedback, | 2722 BuildVariableAssignment(variable, value, expr->op(), feedback, |
2725 expr->AssignmentId()); | 2723 expr->AssignmentId()); |
2726 environment()->Pop(); | 2724 environment()->Pop(); |
(...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4371 // Phi does not exist yet, introduce one. | 4369 // Phi does not exist yet, introduce one. |
4372 value = NewPhi(inputs, value, control); | 4370 value = NewPhi(inputs, value, control); |
4373 value->ReplaceInput(inputs - 1, other); | 4371 value->ReplaceInput(inputs - 1, other); |
4374 } | 4372 } |
4375 return value; | 4373 return value; |
4376 } | 4374 } |
4377 | 4375 |
4378 } // namespace compiler | 4376 } // namespace compiler |
4379 } // namespace internal | 4377 } // namespace internal |
4380 } // namespace v8 | 4378 } // namespace v8 |
OLD | NEW |