| 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/constant_propagator.h" | 5 #include "vm/constant_propagator.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/flow_graph_compiler.h" | 9 #include "vm/flow_graph_compiler.h" |
| 10 #include "vm/flow_graph_range_analysis.h" | 10 #include "vm/flow_graph_range_analysis.h" |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 | 695 |
| 696 | 696 |
| 697 void ConstantPropagator::VisitInitStaticField(InitStaticFieldInstr* instr) { | 697 void ConstantPropagator::VisitInitStaticField(InitStaticFieldInstr* instr) { |
| 698 // Nothing to do. | 698 // Nothing to do. |
| 699 } | 699 } |
| 700 | 700 |
| 701 | 701 |
| 702 void ConstantPropagator::VisitLoadStaticField(LoadStaticFieldInstr* instr) { | 702 void ConstantPropagator::VisitLoadStaticField(LoadStaticFieldInstr* instr) { |
| 703 const Field& field = instr->StaticField(); | 703 const Field& field = instr->StaticField(); |
| 704 ASSERT(field.is_static()); | 704 ASSERT(field.is_static()); |
| 705 if (field.is_final()) { | 705 Instance& obj = Instance::Handle(I, field.value()); |
| 706 Instance& obj = Instance::Handle(I, field.value()); | 706 if (field.is_final() && (obj.raw() != Object::sentinel().raw()) && |
| 707 ASSERT(obj.raw() != Object::sentinel().raw()); | 707 (obj.raw() != Object::transition_sentinel().raw())) { |
| 708 ASSERT(obj.raw() != Object::transition_sentinel().raw()); | |
| 709 if (obj.IsSmi() || obj.IsOld()) { | 708 if (obj.IsSmi() || obj.IsOld()) { |
| 710 SetValue(instr, obj); | 709 SetValue(instr, obj); |
| 711 return; | 710 return; |
| 712 } | 711 } |
| 713 } | 712 } |
| 714 SetValue(instr, non_constant_); | 713 SetValue(instr, non_constant_); |
| 715 } | 714 } |
| 716 | 715 |
| 717 | 716 |
| 718 void ConstantPropagator::VisitStoreStaticField(StoreStaticFieldInstr* instr) { | 717 void ConstantPropagator::VisitStoreStaticField(StoreStaticFieldInstr* instr) { |
| (...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1676 graph_->MergeBlocks(); | 1675 graph_->MergeBlocks(); |
| 1677 GrowableArray<BitVector*> dominance_frontier; | 1676 GrowableArray<BitVector*> dominance_frontier; |
| 1678 graph_->ComputeDominators(&dominance_frontier); | 1677 graph_->ComputeDominators(&dominance_frontier); |
| 1679 | 1678 |
| 1680 if (FLAG_trace_constant_propagation) { | 1679 if (FLAG_trace_constant_propagation) { |
| 1681 FlowGraphPrinter::PrintGraph("After CP", graph_); | 1680 FlowGraphPrinter::PrintGraph("After CP", graph_); |
| 1682 } | 1681 } |
| 1683 } | 1682 } |
| 1684 | 1683 |
| 1685 } // namespace dart | 1684 } // namespace dart |
| OLD | NEW |