| 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" | |
| 11 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| 11 #include "vm/report.h" |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 | 14 |
| 15 DECLARE_FLAG(bool, reorder_basic_blocks); | 15 DECLARE_FLAG(bool, reorder_basic_blocks); |
| 16 DECLARE_FLAG(bool, trace_optimization); | 16 DECLARE_FLAG(bool, trace_optimization); |
| 17 DECLARE_FLAG(bool, verify_compiler); | 17 DECLARE_FLAG(bool, verify_compiler); |
| 18 DEFINE_FLAG(bool, optimize_try_catch, true, "Optimization of try-catch"); | 18 DEFINE_FLAG(bool, optimize_try_catch, true, "Optimization of try-catch"); |
| 19 | 19 |
| 20 | 20 |
| 21 FlowGraph::FlowGraph(const FlowGraphBuilder& builder, | 21 FlowGraph::FlowGraph(const FlowGraphBuilder& builder, |
| (...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 OS::Print(" B%" Pd "\n", preorder_[it.Current()]->block_id()); | 1140 OS::Print(" B%" Pd "\n", preorder_[it.Current()]->block_id()); |
| 1141 } | 1141 } |
| 1142 } | 1142 } |
| 1143 } | 1143 } |
| 1144 return loop_headers; | 1144 return loop_headers; |
| 1145 } | 1145 } |
| 1146 | 1146 |
| 1147 | 1147 |
| 1148 void FlowGraph::Bailout(const char* reason) const { | 1148 void FlowGraph::Bailout(const char* reason) const { |
| 1149 const Function& function = parsed_function_.function(); | 1149 const Function& function = parsed_function_.function(); |
| 1150 const Error& error = Error::Handle( | 1150 Report::MessageF(Report::kBailout, |
| 1151 LanguageError::NewFormatted(Error::Handle(), // No previous error. | 1151 Script::Handle(function.script()), |
| 1152 Script::Handle(function.script()), | 1152 function.token_pos(), |
| 1153 function.token_pos(), | 1153 "FlowGraph Bailout: %s %s", |
| 1154 LanguageError::kError, | 1154 String::Handle(function.name()).ToCString(), |
| 1155 Heap::kNew, | 1155 reason); |
| 1156 "FlowGraph Bailout: %s %s", | 1156 UNREACHABLE(); |
| 1157 String::Handle(function.name()).ToCString(), | |
| 1158 reason)); | |
| 1159 Isolate::Current()->long_jump_base()->Jump(1, error); | |
| 1160 } | 1157 } |
| 1161 | 1158 |
| 1162 | 1159 |
| 1163 intptr_t FlowGraph::InstructionCount() const { | 1160 intptr_t FlowGraph::InstructionCount() const { |
| 1164 intptr_t size = 0; | 1161 intptr_t size = 0; |
| 1165 // Iterate each block, skipping the graph entry. | 1162 // Iterate each block, skipping the graph entry. |
| 1166 for (intptr_t i = 1; i < preorder_.length(); ++i) { | 1163 for (intptr_t i = 1; i < preorder_.length(); ++i) { |
| 1167 for (ForwardInstructionIterator it(preorder_[i]); | 1164 for (ForwardInstructionIterator it(preorder_[i]); |
| 1168 !it.Done(); | 1165 !it.Done(); |
| 1169 it.Advance()) { | 1166 it.Advance()) { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 } | 1276 } |
| 1280 | 1277 |
| 1281 | 1278 |
| 1282 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, | 1279 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, |
| 1283 BlockEntryInstr* to) const { | 1280 BlockEntryInstr* to) const { |
| 1284 return available_at_[to->postorder_number()]->Contains( | 1281 return available_at_[to->postorder_number()]->Contains( |
| 1285 from->postorder_number()); | 1282 from->postorder_number()); |
| 1286 } | 1283 } |
| 1287 | 1284 |
| 1288 } // namespace dart | 1285 } // namespace dart |
| OLD | NEW |