OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/constant_propagator.h" | 10 #include "vm/constant_propagator.h" |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 for (ForwardInstructionIterator it(this); !it.Done(); it.Advance()) { | 968 for (ForwardInstructionIterator it(this); !it.Done(); it.Advance()) { |
969 last = it.Current(); | 969 last = it.Current(); |
970 } | 970 } |
971 set_last_instruction(last); | 971 set_last_instruction(last); |
972 if (last->IsGoto()) last->AsGoto()->set_block(this); | 972 if (last->IsGoto()) last->AsGoto()->set_block(this); |
973 | 973 |
974 return true; | 974 return true; |
975 } | 975 } |
976 | 976 |
977 | 977 |
978 bool BlockEntryInstr::PruneUnreachable(FlowGraphBuilder* builder, | 978 bool BlockEntryInstr::PruneUnreachable(GraphEntryInstr* graph_entry, |
979 GraphEntryInstr* graph_entry, | |
980 Instruction* parent, | 979 Instruction* parent, |
981 intptr_t osr_id, | 980 intptr_t osr_id, |
982 BitVector* block_marks) { | 981 BitVector* block_marks) { |
983 // Search for the instruction with the OSR id. Use a depth first search | 982 // Search for the instruction with the OSR id. Use a depth first search |
984 // because basic blocks have not been discovered yet. Prune unreachable | 983 // because basic blocks have not been discovered yet. Prune unreachable |
985 // blocks by replacing the normal entry with a jump to the block | 984 // blocks by replacing the normal entry with a jump to the block |
986 // containing the OSR entry point. | 985 // containing the OSR entry point. |
987 | 986 |
988 // Do not visit blocks more than once. | 987 // Do not visit blocks more than once. |
989 if (block_marks->Contains(block_id())) return false; | 988 if (block_marks->Contains(block_id())) return false; |
(...skipping 15 matching lines...) Expand all Loading... |
1005 | 1004 |
1006 GotoInstr* goto_join = new GotoInstr(AsJoinEntry()); | 1005 GotoInstr* goto_join = new GotoInstr(AsJoinEntry()); |
1007 goto_join->CopyDeoptIdFrom(*parent); | 1006 goto_join->CopyDeoptIdFrom(*parent); |
1008 graph_entry->normal_entry()->LinkTo(goto_join); | 1007 graph_entry->normal_entry()->LinkTo(goto_join); |
1009 return true; | 1008 return true; |
1010 } | 1009 } |
1011 } | 1010 } |
1012 | 1011 |
1013 // Recursively search the successors. | 1012 // Recursively search the successors. |
1014 for (intptr_t i = instr->SuccessorCount() - 1; i >= 0; --i) { | 1013 for (intptr_t i = instr->SuccessorCount() - 1; i >= 0; --i) { |
1015 if (instr->SuccessorAt(i)->PruneUnreachable(builder, | 1014 if (instr->SuccessorAt(i)->PruneUnreachable(graph_entry, |
1016 graph_entry, | |
1017 instr, | 1015 instr, |
1018 osr_id, | 1016 osr_id, |
1019 block_marks)) { | 1017 block_marks)) { |
1020 return true; | 1018 return true; |
1021 } | 1019 } |
1022 } | 1020 } |
1023 return false; | 1021 return false; |
1024 } | 1022 } |
1025 | 1023 |
1026 | 1024 |
(...skipping 2839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3866 set_native_c_function(native_function); | 3864 set_native_c_function(native_function); |
3867 function().SetIsNativeAutoSetupScope(auto_setup_scope); | 3865 function().SetIsNativeAutoSetupScope(auto_setup_scope); |
3868 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); | 3866 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); |
3869 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); | 3867 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); |
3870 set_is_bootstrap_native(is_bootstrap_native); | 3868 set_is_bootstrap_native(is_bootstrap_native); |
3871 } | 3869 } |
3872 | 3870 |
3873 #undef __ | 3871 #undef __ |
3874 | 3872 |
3875 } // namespace dart | 3873 } // namespace dart |
OLD | NEW |