| 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/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 4509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4520 } | 4520 } |
| 4521 } | 4521 } |
| 4522 } | 4522 } |
| 4523 } | 4523 } |
| 4524 | 4524 |
| 4525 for (ForwardInstructionIterator i(block); !i.Done(); i.Advance()) { | 4525 for (ForwardInstructionIterator i(block); !i.Done(); i.Advance()) { |
| 4526 Definition* defn = i.Current()->AsDefinition(); | 4526 Definition* defn = i.Current()->AsDefinition(); |
| 4527 // Replace constant-valued instructions without observable side | 4527 // Replace constant-valued instructions without observable side |
| 4528 // effects. Do this for smis only to avoid having to copy other | 4528 // effects. Do this for smis only to avoid having to copy other |
| 4529 // objects into the heap's old generation. | 4529 // objects into the heap's old generation. |
| 4530 // | |
| 4531 // TODO(kmillikin): Extend this to handle booleans, other number | |
| 4532 // types, etc. | |
| 4533 if ((defn != NULL) && | 4530 if ((defn != NULL) && |
| 4534 (defn->constant_value().IsSmi() || | 4531 IsConstant(defn->constant_value()) && |
| 4535 defn->constant_value().IsNull() || | 4532 (defn->constant_value().IsSmi() || defn->constant_value().IsOld()) && |
| 4536 defn->constant_value().IsTypeArguments()) && | |
| 4537 !defn->IsConstant() && | 4533 !defn->IsConstant() && |
| 4538 !defn->IsPushArgument() && | 4534 !defn->IsPushArgument() && |
| 4539 !defn->IsStoreIndexed() && | 4535 !defn->IsStoreIndexed() && |
| 4540 !defn->IsStoreInstanceField() && | 4536 !defn->IsStoreInstanceField() && |
| 4541 !defn->IsStoreStaticField() && | 4537 !defn->IsStoreStaticField() && |
| 4542 !defn->IsStoreVMField()) { | 4538 !defn->IsStoreVMField()) { |
| 4543 if (FLAG_trace_constant_propagation) { | 4539 if (FLAG_trace_constant_propagation) { |
| 4544 OS::Print("Constant v%"Pd" = %s\n", | 4540 OS::Print("Constant v%"Pd" = %s\n", |
| 4545 defn->ssa_temp_index(), | 4541 defn->ssa_temp_index(), |
| 4546 defn->constant_value().ToCString()); | 4542 defn->constant_value().ToCString()); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4601 | 4597 |
| 4602 if (FLAG_trace_constant_propagation) { | 4598 if (FLAG_trace_constant_propagation) { |
| 4603 OS::Print("\n==== After constant propagation ====\n"); | 4599 OS::Print("\n==== After constant propagation ====\n"); |
| 4604 FlowGraphPrinter printer(*graph_); | 4600 FlowGraphPrinter printer(*graph_); |
| 4605 printer.PrintBlocks(); | 4601 printer.PrintBlocks(); |
| 4606 } | 4602 } |
| 4607 } | 4603 } |
| 4608 | 4604 |
| 4609 | 4605 |
| 4610 } // namespace dart | 4606 } // namespace dart |
| OLD | NEW |