| 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_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/flow_graph_builder.h" | 7 #include "vm/flow_graph_builder.h" |
| 8 #include "vm/il_printer.h" | 8 #include "vm/il_printer.h" |
| 9 #include "vm/object_store.h" | 9 #include "vm/object_store.h" |
| 10 | 10 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 DECLARE_FLAG(bool, enable_type_checks); | 13 DECLARE_FLAG(bool, enable_type_checks); |
| 14 DECLARE_FLAG(bool, print_flow_graph); | |
| 15 DECLARE_FLAG(bool, trace_optimization); | 14 DECLARE_FLAG(bool, trace_optimization); |
| 16 | 15 |
| 17 void FlowGraphOptimizer::ApplyICData() { | 16 void FlowGraphOptimizer::ApplyICData() { |
| 18 VisitBlocks(); | 17 VisitBlocks(); |
| 19 if (FLAG_print_flow_graph) { | |
| 20 OS::Print("After Optimizations:\n"); | |
| 21 FlowGraphPrinter printer(Function::Handle(), block_order_); | |
| 22 printer.PrintBlocks(); | |
| 23 } | |
| 24 } | 18 } |
| 25 | 19 |
| 26 | 20 |
| 27 static bool ICDataHasReceiverClassId(const ICData& ic_data, intptr_t class_id) { | 21 static bool ICDataHasReceiverClassId(const ICData& ic_data, intptr_t class_id) { |
| 28 ASSERT(ic_data.num_args_tested() > 0); | 22 ASSERT(ic_data.num_args_tested() > 0); |
| 29 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) { | 23 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) { |
| 30 const intptr_t test_class_id = ic_data.GetReceiverClassIdAt(i); | 24 const intptr_t test_class_id = ic_data.GetReceiverClassIdAt(i); |
| 31 if (test_class_id == class_id) { | 25 if (test_class_id == class_id) { |
| 32 return true; | 26 return true; |
| 33 } | 27 } |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 LocationSummary* locs = it.Current()->locs(); | 536 LocationSummary* locs = it.Current()->locs(); |
| 543 if ((locs != NULL) && locs->is_call()) { | 537 if ((locs != NULL) && locs->is_call()) { |
| 544 is_leaf_ = false; | 538 is_leaf_ = false; |
| 545 return; | 539 return; |
| 546 } | 540 } |
| 547 } | 541 } |
| 548 } | 542 } |
| 549 } | 543 } |
| 550 | 544 |
| 551 } // namespace dart | 545 } // namespace dart |
| OLD | NEW |