| 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_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 2317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2328 Instruction* current = it.Current(); | 2328 Instruction* current = it.Current(); |
| 2329 if (!current->IsPushArgument() && !current->AffectedBySideEffect()) { | 2329 if (!current->IsPushArgument() && !current->AffectedBySideEffect()) { |
| 2330 bool inputs_loop_invariant = true; | 2330 bool inputs_loop_invariant = true; |
| 2331 for (int i = 0; i < current->InputCount(); ++i) { | 2331 for (int i = 0; i < current->InputCount(); ++i) { |
| 2332 Definition* input_def = current->InputAt(i)->definition(); | 2332 Definition* input_def = current->InputAt(i)->definition(); |
| 2333 if (!input_def->GetBlock()->Dominates(pre_header)) { | 2333 if (!input_def->GetBlock()->Dominates(pre_header)) { |
| 2334 inputs_loop_invariant = false; | 2334 inputs_loop_invariant = false; |
| 2335 break; | 2335 break; |
| 2336 } | 2336 } |
| 2337 } | 2337 } |
| 2338 if (inputs_loop_invariant) { | 2338 if (inputs_loop_invariant && |
| 2339 !current->IsAssertAssignable() && |
| 2340 !current->IsAssertBoolean()) { |
| 2341 // TODO(fschneider): Enable hoisting of Assert-instructions |
| 2342 // if it safe to do. |
| 2339 Hoist(&it, pre_header, current); | 2343 Hoist(&it, pre_header, current); |
| 2340 } else if (current->IsCheckSmi() && | 2344 } else if (current->IsCheckSmi() && |
| 2341 current->InputAt(0)->definition()->IsPhi()) { | 2345 current->InputAt(0)->definition()->IsPhi()) { |
| 2342 TryHoistCheckSmiThroughPhi( | 2346 TryHoistCheckSmiThroughPhi( |
| 2343 &it, header, pre_header, current->AsCheckSmi()); | 2347 &it, header, pre_header, current->AsCheckSmi()); |
| 2344 } | 2348 } |
| 2345 } | 2349 } |
| 2346 } | 2350 } |
| 2347 } | 2351 } |
| 2348 } | 2352 } |
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3338 | 3342 |
| 3339 if (FLAG_trace_constant_propagation) { | 3343 if (FLAG_trace_constant_propagation) { |
| 3340 OS::Print("\n==== After constant propagation ====\n"); | 3344 OS::Print("\n==== After constant propagation ====\n"); |
| 3341 FlowGraphPrinter printer(*graph_); | 3345 FlowGraphPrinter printer(*graph_); |
| 3342 printer.PrintBlocks(); | 3346 printer.PrintBlocks(); |
| 3343 } | 3347 } |
| 3344 } | 3348 } |
| 3345 | 3349 |
| 3346 | 3350 |
| 3347 } // namespace dart | 3351 } // namespace dart |
| OLD | NEW |