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/flow_graph.h" | 5 #include "vm/flow_graph.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/flow_graph_builder.h" | 8 #include "vm/flow_graph_builder.h" |
9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 for (intptr_t i = 1; i < preorder_.length(); ++i) { | 688 for (intptr_t i = 1; i < preorder_.length(); ++i) { |
689 for (ForwardInstructionIterator it(preorder_[i]); | 689 for (ForwardInstructionIterator it(preorder_[i]); |
690 !it.Done(); | 690 !it.Done(); |
691 it.Advance()) { | 691 it.Advance()) { |
692 ++size; | 692 ++size; |
693 } | 693 } |
694 } | 694 } |
695 return size; | 695 return size; |
696 } | 696 } |
697 | 697 |
| 698 |
| 699 const ZoneGrowableArray<Field*>* FlowGraph::FieldDependencies() const { |
| 700 ZoneGrowableArray<Field*>* result = new ZoneGrowableArray<Field*>(10); |
| 701 |
| 702 for (intptr_t i = 1; i < reverse_postorder().length(); i++) { |
| 703 BlockEntryInstr* entry = reverse_postorder()[i]; |
| 704 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { |
| 705 LoadFieldInstr* load_field = it.Current()->AsLoadField(); |
| 706 if (load_field == NULL) { |
| 707 continue; |
| 708 } |
| 709 |
| 710 Field* field = load_field->field(); |
| 711 if ((field == NULL) || |
| 712 (field->guarded_cid() == kDynamicCid) || |
| 713 (field->guarded_cid() == kIllegalCid)) { |
| 714 continue; |
| 715 } |
| 716 |
| 717 bool found = false; |
| 718 for (intptr_t j = 0; j < result->length(); j++) { |
| 719 if ((*result)[j]->raw() == field->raw()) { |
| 720 found = true; |
| 721 break; |
| 722 } |
| 723 } |
| 724 |
| 725 if (!found) { |
| 726 result->Add(field); |
| 727 } |
| 728 } |
| 729 } |
| 730 |
| 731 return result; |
| 732 } |
| 733 |
698 } // namespace dart | 734 } // namespace dart |
OLD | NEW |