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/growable_array.h" | 10 #include "vm/growable_array.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 postorder_(), | 34 postorder_(), |
35 reverse_postorder_(), | 35 reverse_postorder_(), |
36 optimized_block_order_(), | 36 optimized_block_order_(), |
37 constant_null_(NULL), | 37 constant_null_(NULL), |
38 constant_dead_(NULL), | 38 constant_dead_(NULL), |
39 block_effects_(NULL), | 39 block_effects_(NULL), |
40 licm_allowed_(true), | 40 licm_allowed_(true), |
41 loop_headers_(NULL), | 41 loop_headers_(NULL), |
42 loop_invariant_loads_(NULL), | 42 loop_invariant_loads_(NULL), |
43 guarded_fields_(builder.guarded_fields()), | 43 guarded_fields_(builder.guarded_fields()), |
44 deferred_prefixes_(builder.deferred_prefixes()) { | 44 deferred_prefixes_(builder.deferred_prefixes()), |
| 45 captured_parameters_( |
| 46 new(isolate_) BitVector(isolate_, variable_count())) { |
45 DiscoverBlocks(); | 47 DiscoverBlocks(); |
46 } | 48 } |
47 | 49 |
48 | 50 |
49 void FlowGraph::AddToGuardedFields( | 51 void FlowGraph::AddToGuardedFields( |
50 ZoneGrowableArray<const Field*>* array, | 52 ZoneGrowableArray<const Field*>* array, |
51 const Field* field) { | 53 const Field* field) { |
52 if ((field->guarded_cid() == kDynamicCid) || | 54 if ((field->guarded_cid() == kDynamicCid) || |
53 (field->guarded_cid() == kIllegalCid)) { | 55 (field->guarded_cid() == kIllegalCid)) { |
54 return; | 56 return; |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 | 954 |
953 PhiInstr* phi = result->AsPhi(); | 955 PhiInstr* phi = result->AsPhi(); |
954 if ((phi != NULL) && !phi->is_alive()) { | 956 if ((phi != NULL) && !phi->is_alive()) { |
955 phi->mark_alive(); | 957 phi->mark_alive(); |
956 live_phis->Add(phi); | 958 live_phis->Add(phi); |
957 } | 959 } |
958 | 960 |
959 if (variable_liveness->IsLastLoad(block_entry, load)) { | 961 if (variable_liveness->IsLastLoad(block_entry, load)) { |
960 (*env)[index] = constant_dead(); | 962 (*env)[index] = constant_dead(); |
961 } | 963 } |
| 964 |
| 965 // Record captured parameters so that they can be skipped when |
| 966 // emitting sync code inside optimized try-blocks. |
| 967 if (load->local().is_captured_parameter()) { |
| 968 intptr_t index = load->local().BitIndexIn(num_non_copied_params_); |
| 969 captured_parameters_->Add(index); |
| 970 } |
| 971 |
962 } else if (push != NULL) { | 972 } else if (push != NULL) { |
963 result = push->value()->definition(); | 973 result = push->value()->definition(); |
964 env->Add(result); | 974 env->Add(result); |
965 it.RemoveCurrentFromGraph(); | 975 it.RemoveCurrentFromGraph(); |
966 continue; | 976 continue; |
967 } else if (drop != NULL) { | 977 } else if (drop != NULL) { |
968 // Drop temps from the environment. | 978 // Drop temps from the environment. |
969 for (intptr_t j = 0; j < drop->num_temps(); j++) { | 979 for (intptr_t j = 0; j < drop->num_temps(); j++) { |
970 env->RemoveLast(); | 980 env->RemoveLast(); |
971 } | 981 } |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 } | 1308 } |
1299 | 1309 |
1300 | 1310 |
1301 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, | 1311 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, |
1302 BlockEntryInstr* to) const { | 1312 BlockEntryInstr* to) const { |
1303 return available_at_[to->postorder_number()]->Contains( | 1313 return available_at_[to->postorder_number()]->Contains( |
1304 from->postorder_number()); | 1314 from->postorder_number()); |
1305 } | 1315 } |
1306 | 1316 |
1307 } // namespace dart | 1317 } // namespace dart |
OLD | NEW |