Chromium Code Reviews| 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 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 930 | 930 |
| 931 | 931 |
| 932 void JoinEntryInstr::InsertPhi(PhiInstr* phi) { | 932 void JoinEntryInstr::InsertPhi(PhiInstr* phi) { |
| 933 // Lazily initialize the array of phis. | 933 // Lazily initialize the array of phis. |
| 934 if (phis_ == NULL) { | 934 if (phis_ == NULL) { |
| 935 phis_ = new ZoneGrowableArray<PhiInstr*>(1); | 935 phis_ = new ZoneGrowableArray<PhiInstr*>(1); |
| 936 } | 936 } |
| 937 phis_->Add(phi); | 937 phis_->Add(phi); |
| 938 } | 938 } |
| 939 | 939 |
| 940 void JoinEntryInstr::RemovePhi(PhiInstr* phi) { | |
| 941 ASSERT(phis_ != NULL); | |
| 942 intptr_t to_index = 0; | |
| 943 for (intptr_t from_index = 0; from_index < phis_->length(); ++from_index) { | |
|
Kevin Millikin (Google)
2013/06/25 09:18:29
Is this better than searching for the phi and repl
Vyacheslav Egorov (Google)
2013/06/25 18:02:39
Done.
| |
| 944 PhiInstr* current = (*phis_)[from_index]; | |
| 945 if (phi != current) { | |
| 946 if (to_index != from_index) { | |
| 947 (*phis_)[to_index] = current; | |
| 948 } | |
| 949 to_index++; | |
| 950 } | |
| 951 } | |
| 952 phis_->RemoveLast(); | |
| 953 } | |
| 940 | 954 |
| 941 void JoinEntryInstr::RemoveDeadPhis(Definition* replacement) { | 955 void JoinEntryInstr::RemoveDeadPhis(Definition* replacement) { |
| 942 if (phis_ == NULL) return; | 956 if (phis_ == NULL) return; |
| 943 | 957 |
| 944 intptr_t to_index = 0; | 958 intptr_t to_index = 0; |
| 945 for (intptr_t from_index = 0; from_index < phis_->length(); ++from_index) { | 959 for (intptr_t from_index = 0; from_index < phis_->length(); ++from_index) { |
| 946 PhiInstr* phi = (*phis_)[from_index]; | 960 PhiInstr* phi = (*phis_)[from_index]; |
| 947 if (phi != NULL) { | 961 if (phi != NULL) { |
| 948 if (phi->is_alive()) { | 962 if (phi->is_alive()) { |
| 949 (*phis_)[to_index++] = phi; | 963 (*phis_)[to_index++] = phi; |
| (...skipping 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2549 default: | 2563 default: |
| 2550 UNREACHABLE(); | 2564 UNREACHABLE(); |
| 2551 } | 2565 } |
| 2552 return kPowRuntimeEntry; | 2566 return kPowRuntimeEntry; |
| 2553 } | 2567 } |
| 2554 | 2568 |
| 2555 | 2569 |
| 2556 #undef __ | 2570 #undef __ |
| 2557 | 2571 |
| 2558 } // namespace dart | 2572 } // namespace dart |
| OLD | NEW |