| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/bit_vector.h" | 8 #include "vm/bit_vector.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flow_graph_allocator.h" | 10 #include "vm/flow_graph_allocator.h" |
| (...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 use_idx += step) { | 973 use_idx += step) { |
| 974 phi->SetInputAt(use_idx, phi->InputAt(use_idx + step)); | 974 phi->SetInputAt(use_idx, phi->InputAt(use_idx + step)); |
| 975 } | 975 } |
| 976 // Write the predecessor use. | 976 // Write the predecessor use. |
| 977 phi->SetInputAt(new_index, pred_use); | 977 phi->SetInputAt(new_index, pred_use); |
| 978 } | 978 } |
| 979 } | 979 } |
| 980 } | 980 } |
| 981 | 981 |
| 982 | 982 |
| 983 bool BlockEntryInstr::IsEmptyBlock() { | |
| 984 return !HasParallelMove() && | |
| 985 next()->IsGoto() && | |
| 986 !next()->AsGoto()->HasParallelMove() && | |
| 987 (!IsJoinEntry() || (AsJoinEntry()->phis() == NULL)); | |
| 988 } | |
| 989 | |
| 990 | |
| 991 void BlockEntryInstr::ClearAllInstructions() { | |
| 992 JoinEntryInstr* join = this->AsJoinEntry(); | |
| 993 if (join != NULL) { | |
| 994 for (PhiIterator it(join); !it.Done(); it.Advance()) { | |
| 995 it.Current()->UnuseAllInputs(); | |
| 996 } | |
| 997 } | |
| 998 UnuseAllInputs(); | |
| 999 for (ForwardInstructionIterator it(this); | |
| 1000 !it.Done(); | |
| 1001 it.Advance()) { | |
| 1002 it.Current()->UnuseAllInputs(); | |
| 1003 } | |
| 1004 } | |
| 1005 | |
| 1006 | |
| 1007 void JoinEntryInstr::InsertPhi(intptr_t var_index, intptr_t var_count) { | 983 void JoinEntryInstr::InsertPhi(intptr_t var_index, intptr_t var_count) { |
| 1008 // Lazily initialize the array of phis. | 984 // Lazily initialize the array of phis. |
| 1009 // Currently, phis are stored in a sparse array that holds the phi | 985 // Currently, phis are stored in a sparse array that holds the phi |
| 1010 // for variable with index i at position i. | 986 // for variable with index i at position i. |
| 1011 // TODO(fschneider): Store phis in a more compact way. | 987 // TODO(fschneider): Store phis in a more compact way. |
| 1012 if (phis_ == NULL) { | 988 if (phis_ == NULL) { |
| 1013 phis_ = new ZoneGrowableArray<PhiInstr*>(var_count); | 989 phis_ = new ZoneGrowableArray<PhiInstr*>(var_count); |
| 1014 for (intptr_t i = 0; i < var_count; i++) { | 990 for (intptr_t i = 0; i < var_count; i++) { |
| 1015 phis_->Add(NULL); | 991 phis_->Add(NULL); |
| 1016 } | 992 } |
| (...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2711 return kCosRuntimeEntry; | 2687 return kCosRuntimeEntry; |
| 2712 default: | 2688 default: |
| 2713 UNREACHABLE(); | 2689 UNREACHABLE(); |
| 2714 } | 2690 } |
| 2715 return kSinRuntimeEntry; | 2691 return kSinRuntimeEntry; |
| 2716 } | 2692 } |
| 2717 | 2693 |
| 2718 #undef __ | 2694 #undef __ |
| 2719 | 2695 |
| 2720 } // namespace dart | 2696 } // namespace dart |
| OLD | NEW |