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 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 loop_headers->Add(block); | 1060 loop_headers->Add(block); |
1061 } | 1061 } |
1062 } | 1062 } |
1063 } | 1063 } |
1064 | 1064 |
1065 return loop_headers; | 1065 return loop_headers; |
1066 } | 1066 } |
1067 | 1067 |
1068 | 1068 |
1069 void FlowGraph::Bailout(const char* reason) const { | 1069 void FlowGraph::Bailout(const char* reason) const { |
1070 const char* kFormat = "FlowGraph Bailout: %s %s"; | 1070 const Function& function = parsed_function_.function(); |
1071 const char* function_name = parsed_function_.function().ToCString(); | |
1072 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | |
1073 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | |
1074 OS::SNPrint(chars, len, kFormat, function_name, reason); | |
1075 const Error& error = Error::Handle( | 1071 const Error& error = Error::Handle( |
1076 LanguageError::New(String::Handle(String::New(chars)))); | 1072 LanguageError::NewFormatted(Error::Handle(), // No previous error. |
| 1073 Script::Handle(function.script()), |
| 1074 function.token_pos(), |
| 1075 LanguageError::kError, |
| 1076 Heap::kNew, |
| 1077 "FlowGraph Bailout: %s %s", |
| 1078 String::Handle(function.name()).ToCString(), |
| 1079 reason)); |
1077 Isolate::Current()->long_jump_base()->Jump(1, error); | 1080 Isolate::Current()->long_jump_base()->Jump(1, error); |
1078 } | 1081 } |
1079 | 1082 |
1080 | 1083 |
1081 intptr_t FlowGraph::InstructionCount() const { | 1084 intptr_t FlowGraph::InstructionCount() const { |
1082 intptr_t size = 0; | 1085 intptr_t size = 0; |
1083 // Iterate each block, skipping the graph entry. | 1086 // Iterate each block, skipping the graph entry. |
1084 for (intptr_t i = 1; i < preorder_.length(); ++i) { | 1087 for (intptr_t i = 1; i < preorder_.length(); ++i) { |
1085 for (ForwardInstructionIterator it(preorder_[i]); | 1088 for (ForwardInstructionIterator it(preorder_[i]); |
1086 !it.Done(); | 1089 !it.Done(); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1195 } | 1198 } |
1196 | 1199 |
1197 | 1200 |
1198 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, | 1201 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, |
1199 BlockEntryInstr* to) const { | 1202 BlockEntryInstr* to) const { |
1200 return available_at_[to->postorder_number()]->Contains( | 1203 return available_at_[to->postorder_number()]->Contains( |
1201 from->postorder_number()); | 1204 from->postorder_number()); |
1202 } | 1205 } |
1203 | 1206 |
1204 } // namespace dart | 1207 } // namespace dart |
OLD | NEW |