| 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/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 3923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3934 new TargetEntryInstr(AllocateBlockId(), | 3934 new TargetEntryInstr(AllocateBlockId(), |
| 3935 CatchClauseNode::kInvalidTryIndex); | 3935 CatchClauseNode::kInvalidTryIndex); |
| 3936 graph_entry_ = new GraphEntryInstr(parsed_function(), normal_entry, osr_id_); | 3936 graph_entry_ = new GraphEntryInstr(parsed_function(), normal_entry, osr_id_); |
| 3937 EffectGraphVisitor for_effect(this); | 3937 EffectGraphVisitor for_effect(this); |
| 3938 parsed_function()->node_sequence()->Visit(&for_effect); | 3938 parsed_function()->node_sequence()->Visit(&for_effect); |
| 3939 AppendFragment(normal_entry, for_effect); | 3939 AppendFragment(normal_entry, for_effect); |
| 3940 // Check that the graph is properly terminated. | 3940 // Check that the graph is properly terminated. |
| 3941 ASSERT(!for_effect.is_open()); | 3941 ASSERT(!for_effect.is_open()); |
| 3942 | 3942 |
| 3943 // When compiling for OSR, use a depth first search to prune instructions | 3943 // When compiling for OSR, use a depth first search to prune instructions |
| 3944 // unreachable from the OSR entry. Catch entries are not (yet) properly | 3944 // unreachable from the OSR entry. Catch entries are always considered |
| 3945 // recognized as reachable. | 3945 // reachable, even if they become unreachable after OSR. |
| 3946 if (osr_id_ != Isolate::kNoDeoptId) { | 3946 if (osr_id_ != Isolate::kNoDeoptId) { |
| 3947 if (graph_entry_->SuccessorCount() > 1) { | |
| 3948 Bailout("try/catch when compiling for OSR"); | |
| 3949 } | |
| 3950 PruneUnreachable(); | 3947 PruneUnreachable(); |
| 3951 } | 3948 } |
| 3952 | 3949 |
| 3953 FlowGraph* graph = new FlowGraph(*this, graph_entry_, last_used_block_id_); | 3950 FlowGraph* graph = new FlowGraph(*this, graph_entry_, last_used_block_id_); |
| 3954 return graph; | 3951 return graph; |
| 3955 } | 3952 } |
| 3956 | 3953 |
| 3957 | 3954 |
| 3958 void FlowGraphBuilder::PruneUnreachable() { | 3955 void FlowGraphBuilder::PruneUnreachable() { |
| 3959 ASSERT(osr_id_ != Isolate::kNoDeoptId); | 3956 ASSERT(osr_id_ != Isolate::kNoDeoptId); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4001 LanguageError::kBailout, | 3998 LanguageError::kBailout, |
| 4002 Heap::kNew, | 3999 Heap::kNew, |
| 4003 "FlowGraphBuilder Bailout: %s %s", | 4000 "FlowGraphBuilder Bailout: %s %s", |
| 4004 String::Handle(I, function.name()).ToCString(), | 4001 String::Handle(I, function.name()).ToCString(), |
| 4005 reason)); | 4002 reason)); |
| 4006 I->long_jump_base()->Jump(1, error); | 4003 I->long_jump_base()->Jump(1, error); |
| 4007 UNREACHABLE(); | 4004 UNREACHABLE(); |
| 4008 } | 4005 } |
| 4009 | 4006 |
| 4010 } // namespace dart | 4007 } // namespace dart |
| OLD | NEW |