| 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/flow_graph_compiler.h" | 9 #include "vm/flow_graph_compiler.h" |
| 10 #include "vm/flow_graph_range_analysis.h" | 10 #include "vm/flow_graph_range_analysis.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 postorder_(), | 41 postorder_(), |
| 42 reverse_postorder_(), | 42 reverse_postorder_(), |
| 43 optimized_block_order_(), | 43 optimized_block_order_(), |
| 44 constant_null_(NULL), | 44 constant_null_(NULL), |
| 45 constant_dead_(NULL), | 45 constant_dead_(NULL), |
| 46 constant_empty_context_(NULL), | 46 constant_empty_context_(NULL), |
| 47 block_effects_(NULL), | 47 block_effects_(NULL), |
| 48 licm_allowed_(true), | 48 licm_allowed_(true), |
| 49 loop_headers_(NULL), | 49 loop_headers_(NULL), |
| 50 loop_invariant_loads_(NULL), | 50 loop_invariant_loads_(NULL), |
| 51 guarded_fields_(parsed_function.guarded_fields()), | |
| 52 deferred_prefixes_(parsed_function.deferred_prefixes()), | 51 deferred_prefixes_(parsed_function.deferred_prefixes()), |
| 53 captured_parameters_(new(zone()) BitVector(zone(), variable_count())), | 52 captured_parameters_(new(zone()) BitVector(zone(), variable_count())), |
| 54 inlining_id_(-1) { | 53 inlining_id_(-1) { |
| 55 DiscoverBlocks(); | 54 DiscoverBlocks(); |
| 56 } | 55 } |
| 57 | 56 |
| 58 | 57 |
| 59 void FlowGraph::EnsureSSATempIndex(Definition* defn, | 58 void FlowGraph::EnsureSSATempIndex(Definition* defn, |
| 60 Definition* replacement) { | 59 Definition* replacement) { |
| 61 if ((replacement->ssa_temp_index() == -1) && | 60 if ((replacement->ssa_temp_index() == -1) && |
| (...skipping 23 matching lines...) Expand all Loading... |
| 85 THR_Print("Removing %s\n", current->DebugName()); | 84 THR_Print("Removing %s\n", current->DebugName()); |
| 86 } else { | 85 } else { |
| 87 ASSERT(!current_defn->HasUses()); | 86 ASSERT(!current_defn->HasUses()); |
| 88 THR_Print("Removing v%" Pd ".\n", current_defn->ssa_temp_index()); | 87 THR_Print("Removing v%" Pd ".\n", current_defn->ssa_temp_index()); |
| 89 } | 88 } |
| 90 } | 89 } |
| 91 iterator->RemoveCurrentFromGraph(); | 90 iterator->RemoveCurrentFromGraph(); |
| 92 } | 91 } |
| 93 | 92 |
| 94 | 93 |
| 95 | |
| 96 void FlowGraph::AddToGuardedFields( | |
| 97 ZoneGrowableArray<const Field*>* array, | |
| 98 const Field* field) { | |
| 99 if ((field->guarded_cid() == kDynamicCid) || | |
| 100 (field->guarded_cid() == kIllegalCid)) { | |
| 101 return; | |
| 102 } | |
| 103 for (intptr_t j = 0; j < array->length(); j++) { | |
| 104 if ((*array)[j]->raw() == field->raw()) { | |
| 105 return; | |
| 106 } | |
| 107 } | |
| 108 array->Add(field); | |
| 109 } | |
| 110 | |
| 111 | |
| 112 void FlowGraph::AddToDeferredPrefixes( | 94 void FlowGraph::AddToDeferredPrefixes( |
| 113 ZoneGrowableArray<const LibraryPrefix*>* from) { | 95 ZoneGrowableArray<const LibraryPrefix*>* from) { |
| 114 ZoneGrowableArray<const LibraryPrefix*>* to = deferred_prefixes(); | 96 ZoneGrowableArray<const LibraryPrefix*>* to = deferred_prefixes(); |
| 115 for (intptr_t i = 0; i < from->length(); i++) { | 97 for (intptr_t i = 0; i < from->length(); i++) { |
| 116 const LibraryPrefix* prefix = (*from)[i]; | 98 const LibraryPrefix* prefix = (*from)[i]; |
| 117 for (intptr_t j = 0; j < to->length(); j++) { | 99 for (intptr_t j = 0; j < to->length(); j++) { |
| 118 if ((*to)[j]->raw() == prefix->raw()) { | 100 if ((*to)[j]->raw() == prefix->raw()) { |
| 119 return; | 101 return; |
| 120 } | 102 } |
| 121 } | 103 } |
| (...skipping 1872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1994 ReplaceCurrentInstruction(&it, current, replacement); | 1976 ReplaceCurrentInstruction(&it, current, replacement); |
| 1995 changed = true; | 1977 changed = true; |
| 1996 } | 1978 } |
| 1997 } | 1979 } |
| 1998 } | 1980 } |
| 1999 return changed; | 1981 return changed; |
| 2000 } | 1982 } |
| 2001 | 1983 |
| 2002 | 1984 |
| 2003 } // namespace dart | 1985 } // namespace dart |
| OLD | NEW |