Chromium Code Reviews| Index: runtime/vm/flow_graph.cc |
| diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc |
| index fe14079dc1a7890a34bccecb53a4664db5f7f4af..492a26d39b66cc674122f36c2423a8e35a019ae6 100644 |
| --- a/runtime/vm/flow_graph.cc |
| +++ b/runtime/vm/flow_graph.cc |
| @@ -696,4 +696,39 @@ intptr_t FlowGraph::InstructionCount() const { |
| } |
| +ZoneGrowableArray<Field*>* FlowGraph::FieldDependencies() const { |
| + ZoneGrowableArray<Field*>* result = new ZoneGrowableArray<Field*>(10); |
| + |
| + for (intptr_t i = 1; i < reverse_postorder().length(); i++) { |
| + BlockEntryInstr* entry = reverse_postorder()[i]; |
| + for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { |
| + LoadFieldInstr* load_field = it.Current()->AsLoadField(); |
| + if (load_field == NULL) { |
| + continue; |
| + } |
| + |
| + Field* field = load_field->field(); |
| + if ((field == NULL) || |
| + (field->guarded_cid() == kDynamicCid) || |
| + (field->guarded_cid() == kIllegalCid)) { |
| + continue; |
| + } |
| + |
| + bool found = false; |
| + for (intptr_t j = 0; j < result->length(); j++) { |
| + if ((*result)[j]->raw() == field->raw()) { |
|
srdjan
2013/03/18 18:54:35
do "continue" here and remove 'found' ?
Vyacheslav Egorov (Google)
2013/03/18 19:41:18
C++ does not have continue with a label, so I can'
|
| + found = true; |
| + break; |
| + } |
| + } |
| + |
| + if (!found) { |
| + result->Add(field); |
| + } |
| + } |
| + } |
| + |
| + return result; |
| +} |
| + |
| } // namespace dart |