OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
9 #include "vm/flow_graph_allocator.h" | 9 #include "vm/flow_graph_allocator.h" |
10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 // Currently, phis are stored in a sparse array that holds the phi | 596 // Currently, phis are stored in a sparse array that holds the phi |
597 // for variable with index i at position i. | 597 // for variable with index i at position i. |
598 // TODO(fschneider): Store phis in a more compact way. | 598 // TODO(fschneider): Store phis in a more compact way. |
599 if (phis_ == NULL) { | 599 if (phis_ == NULL) { |
600 phis_ = new ZoneGrowableArray<PhiInstr*>(var_count); | 600 phis_ = new ZoneGrowableArray<PhiInstr*>(var_count); |
601 for (intptr_t i = 0; i < var_count; i++) { | 601 for (intptr_t i = 0; i < var_count; i++) { |
602 phis_->Add(NULL); | 602 phis_->Add(NULL); |
603 } | 603 } |
604 } | 604 } |
605 ASSERT((*phis_)[var_index] == NULL); | 605 ASSERT((*phis_)[var_index] == NULL); |
606 (*phis_)[var_index] = new PhiInstr(PredecessorCount()); | 606 (*phis_)[var_index] = new PhiInstr(this, PredecessorCount()); |
607 phi_count_++; | 607 phi_count_++; |
608 } | 608 } |
609 | 609 |
610 | 610 |
611 void JoinEntryInstr::RemoveDeadPhis() { | 611 void JoinEntryInstr::RemoveDeadPhis() { |
612 if (phis_ == NULL) return; | 612 if (phis_ == NULL) return; |
613 | 613 |
614 for (intptr_t i = 0; i < phis_->length(); i++) { | 614 for (intptr_t i = 0; i < phis_->length(); i++) { |
615 PhiInstr* phi = (*phis_)[i]; | 615 PhiInstr* phi = (*phis_)[i]; |
616 if ((phi != NULL) && !phi->is_alive()) { | 616 if ((phi != NULL) && !phi->is_alive()) { |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 value->set_use_index(i); | 1523 value->set_use_index(i); |
1524 value->AddToEnvUseList(); | 1524 value->AddToEnvUseList(); |
1525 } | 1525 } |
1526 instr->set_env(copy); | 1526 instr->set_env(copy); |
1527 } | 1527 } |
1528 | 1528 |
1529 | 1529 |
1530 #undef __ | 1530 #undef __ |
1531 | 1531 |
1532 } // namespace dart | 1532 } // namespace dart |
OLD | NEW |