| 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_builder.h" | 5 #include "vm/flow_graph_builder.h" |
| 6 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
| 9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 intptr_t FlowGraphBuilder::context_level() const { | 168 intptr_t FlowGraphBuilder::context_level() const { |
| 169 return (nesting_stack() == NULL) ? 0 : nesting_stack()->ContextLevel(); | 169 return (nesting_stack() == NULL) ? 0 : nesting_stack()->ContextLevel(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 | 172 |
| 173 JoinEntryInstr* NestedStatement::BreakTargetFor(SourceLabel* label) { | 173 JoinEntryInstr* NestedStatement::BreakTargetFor(SourceLabel* label) { |
| 174 if (label != label_) return NULL; | 174 if (label != label_) return NULL; |
| 175 if (break_target_ == NULL) { | 175 if (break_target_ == NULL) { |
| 176 break_target_ = | 176 break_target_ = |
| 177 new(owner()->zone()) JoinEntryInstr(owner()->AllocateBlockId(), | 177 new(owner()->zone()) JoinEntryInstr(owner()->AllocateBlockId(), |
| 178 owner()->try_index()); | 178 try_index()); |
| 179 } | 179 } |
| 180 return break_target_; | 180 return break_target_; |
| 181 } | 181 } |
| 182 | 182 |
| 183 | 183 |
| 184 JoinEntryInstr* NestedStatement::ContinueTargetFor(SourceLabel* label) { | 184 JoinEntryInstr* NestedStatement::ContinueTargetFor(SourceLabel* label) { |
| 185 return NULL; | 185 return NULL; |
| 186 } | 186 } |
| 187 | 187 |
| 188 | 188 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 private: | 244 private: |
| 245 JoinEntryInstr* continue_target_; | 245 JoinEntryInstr* continue_target_; |
| 246 }; | 246 }; |
| 247 | 247 |
| 248 | 248 |
| 249 JoinEntryInstr* NestedLoop::ContinueTargetFor(SourceLabel* label) { | 249 JoinEntryInstr* NestedLoop::ContinueTargetFor(SourceLabel* label) { |
| 250 if (label != this->label()) return NULL; | 250 if (label != this->label()) return NULL; |
| 251 if (continue_target_ == NULL) { | 251 if (continue_target_ == NULL) { |
| 252 continue_target_ = | 252 continue_target_ = |
| 253 new(owner()->zone()) JoinEntryInstr(owner()->AllocateBlockId(), | 253 new(owner()->zone()) JoinEntryInstr(owner()->AllocateBlockId(), |
| 254 try_index()); | 254 try_index()); |
| 255 } | 255 } |
| 256 return continue_target_; | 256 return continue_target_; |
| 257 } | 257 } |
| 258 | 258 |
| 259 | 259 |
| 260 // A nested switch which can be the target of a break if labeled, and whose | 260 // A nested switch which can be the target of a break if labeled, and whose |
| 261 // cases can be the targets of continues. | 261 // cases can be the targets of continues. |
| 262 class NestedSwitch : public NestedStatement { | 262 class NestedSwitch : public NestedStatement { |
| 263 public: | 263 public: |
| 264 NestedSwitch(FlowGraphBuilder* owner, SwitchNode* node); | 264 NestedSwitch(FlowGraphBuilder* owner, SwitchNode* node); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 288 | 288 |
| 289 JoinEntryInstr* NestedSwitch::ContinueTargetFor(SourceLabel* label) { | 289 JoinEntryInstr* NestedSwitch::ContinueTargetFor(SourceLabel* label) { |
| 290 // Allocate a join for a case clause that matches the label. This block | 290 // Allocate a join for a case clause that matches the label. This block |
| 291 // is not necessarily targeted by a continue, but we always use a join in | 291 // is not necessarily targeted by a continue, but we always use a join in |
| 292 // the graph anyway. | 292 // the graph anyway. |
| 293 for (intptr_t i = 0; i < case_labels_.length(); ++i) { | 293 for (intptr_t i = 0; i < case_labels_.length(); ++i) { |
| 294 if (label != case_labels_[i]) continue; | 294 if (label != case_labels_[i]) continue; |
| 295 if (case_targets_[i] == NULL) { | 295 if (case_targets_[i] == NULL) { |
| 296 case_targets_[i] = | 296 case_targets_[i] = |
| 297 new(owner()->zone()) JoinEntryInstr(owner()->AllocateBlockId(), | 297 new(owner()->zone()) JoinEntryInstr(owner()->AllocateBlockId(), |
| 298 try_index()); | 298 try_index()); |
| 299 } | 299 } |
| 300 return case_targets_[i]; | 300 return case_targets_[i]; |
| 301 } | 301 } |
| 302 return NULL; | 302 return NULL; |
| 303 } | 303 } |
| 304 | 304 |
| 305 | 305 |
| 306 FlowGraphBuilder::FlowGraphBuilder( | 306 FlowGraphBuilder::FlowGraphBuilder( |
| 307 const ParsedFunction& parsed_function, | 307 const ParsedFunction& parsed_function, |
| 308 const ZoneGrowableArray<const ICData*>& ic_data_array, | 308 const ZoneGrowableArray<const ICData*>& ic_data_array, |
| (...skipping 4360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4669 Script::Handle(function.script()), | 4669 Script::Handle(function.script()), |
| 4670 function.token_pos(), | 4670 function.token_pos(), |
| 4671 Report::AtLocation, | 4671 Report::AtLocation, |
| 4672 "FlowGraphBuilder Bailout: %s %s", | 4672 "FlowGraphBuilder Bailout: %s %s", |
| 4673 String::Handle(function.name()).ToCString(), | 4673 String::Handle(function.name()).ToCString(), |
| 4674 reason); | 4674 reason); |
| 4675 UNREACHABLE(); | 4675 UNREACHABLE(); |
| 4676 } | 4676 } |
| 4677 | 4677 |
| 4678 } // namespace dart | 4678 } // namespace dart |
| OLD | NEW |