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/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/compiler/ast-loop-assignment-analyzer.h" | 8 #include "src/compiler/ast-loop-assignment-analyzer.h" |
9 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
10 #include "src/compiler/js-type-feedback.h" | 10 #include "src/compiler/js-type-feedback.h" |
(...skipping 3642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3653 // Only build phis for those locals assigned in this loop. | 3653 // Only build phis for those locals assigned in this loop. |
3654 for (int i = 0; i < size; ++i) { | 3654 for (int i = 0; i < size; ++i) { |
3655 if (i < assigned->length() && !assigned->Contains(i)) continue; | 3655 if (i < assigned->length() && !assigned->Contains(i)) continue; |
3656 Node* phi = builder_->NewPhi(1, values()->at(i), control); | 3656 Node* phi = builder_->NewPhi(1, values()->at(i), control); |
3657 values()->at(i) = phi; | 3657 values()->at(i) = phi; |
3658 } | 3658 } |
3659 } | 3659 } |
3660 Node* effect = builder_->NewEffectPhi(1, GetEffectDependency(), control); | 3660 Node* effect = builder_->NewEffectPhi(1, GetEffectDependency(), control); |
3661 UpdateEffectDependency(effect); | 3661 UpdateEffectDependency(effect); |
3662 | 3662 |
| 3663 // Connect the loop to end via Terminate if it's not marked as unreachable. |
| 3664 if (!IsMarkedAsUnreachable()) { |
| 3665 // Connect the Loop node to end via a Terminate node. |
| 3666 Node* terminate = builder_->graph()->NewNode( |
| 3667 builder_->common()->Terminate(), effect, control); |
| 3668 builder_->exit_controls_.push_back(terminate); |
| 3669 } |
| 3670 |
3663 if (builder_->info()->is_osr()) { | 3671 if (builder_->info()->is_osr()) { |
3664 // Introduce phis for all context values in the case of an OSR graph. | 3672 // Introduce phis for all context values in the case of an OSR graph. |
3665 for (int i = 0; i < static_cast<int>(contexts()->size()); ++i) { | 3673 for (int i = 0; i < static_cast<int>(contexts()->size()); ++i) { |
3666 Node* val = contexts()->at(i); | 3674 Node* val = contexts()->at(i); |
3667 if (!IrOpcode::IsConstantOpcode(val->opcode())) { | 3675 if (!IrOpcode::IsConstantOpcode(val->opcode())) { |
3668 contexts()->at(i) = builder_->NewPhi(1, val, control); | 3676 contexts()->at(i) = builder_->NewPhi(1, val, control); |
3669 } | 3677 } |
3670 } | 3678 } |
3671 } | 3679 } |
3672 | 3680 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3778 // Phi does not exist yet, introduce one. | 3786 // Phi does not exist yet, introduce one. |
3779 value = NewPhi(inputs, value, control); | 3787 value = NewPhi(inputs, value, control); |
3780 value->ReplaceInput(inputs - 1, other); | 3788 value->ReplaceInput(inputs - 1, other); |
3781 } | 3789 } |
3782 return value; | 3790 return value; |
3783 } | 3791 } |
3784 | 3792 |
3785 } // namespace compiler | 3793 } // namespace compiler |
3786 } // namespace internal | 3794 } // namespace internal |
3787 } // namespace v8 | 3795 } // namespace v8 |
OLD | NEW |