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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 void ConstantPropagator::VisitNativeCall(NativeCallInstr* instr) { | 597 void ConstantPropagator::VisitNativeCall(NativeCallInstr* instr) { |
598 SetValue(instr, non_constant_); | 598 SetValue(instr, non_constant_); |
599 } | 599 } |
600 | 600 |
601 | 601 |
602 void ConstantPropagator::VisitDebugStepCheck(DebugStepCheckInstr* instr) { | 602 void ConstantPropagator::VisitDebugStepCheck(DebugStepCheckInstr* instr) { |
603 // Nothing to do. | 603 // Nothing to do. |
604 } | 604 } |
605 | 605 |
606 | 606 |
607 void ConstantPropagator::VisitStringFromCharCode( | 607 void ConstantPropagator::VisitOneByteStringFromCharCode( |
608 StringFromCharCodeInstr* instr) { | 608 OneByteStringFromCharCodeInstr* instr) { |
609 const Object& o = instr->char_code()->definition()->constant_value(); | 609 const Object& o = instr->char_code()->definition()->constant_value(); |
610 if (o.IsNull() || IsNonConstant(o)) { | 610 if (o.IsNull() || IsNonConstant(o)) { |
611 SetValue(instr, non_constant_); | 611 SetValue(instr, non_constant_); |
612 } else if (IsConstant(o)) { | 612 } else if (IsConstant(o)) { |
613 const intptr_t ch_code = Smi::Cast(o).Value(); | 613 const intptr_t ch_code = Smi::Cast(o).Value(); |
614 ASSERT(ch_code >= 0); | 614 ASSERT(ch_code >= 0); |
615 if (ch_code < Symbols::kMaxOneCharCodeSymbol) { | 615 if (ch_code < Symbols::kMaxOneCharCodeSymbol) { |
616 RawString** table = Symbols::PredefinedAddress(); | 616 RawString** table = Symbols::PredefinedAddress(); |
617 SetValue(instr, String::ZoneHandle(Z, table[ch_code])); | 617 SetValue(instr, String::ZoneHandle(Z, table[ch_code])); |
618 } else { | 618 } else { |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 graph_->MergeBlocks(); | 1680 graph_->MergeBlocks(); |
1681 GrowableArray<BitVector*> dominance_frontier; | 1681 GrowableArray<BitVector*> dominance_frontier; |
1682 graph_->ComputeDominators(&dominance_frontier); | 1682 graph_->ComputeDominators(&dominance_frontier); |
1683 | 1683 |
1684 if (FLAG_trace_constant_propagation) { | 1684 if (FLAG_trace_constant_propagation) { |
1685 FlowGraphPrinter::PrintGraph("After CP", graph_); | 1685 FlowGraphPrinter::PrintGraph("After CP", graph_); |
1686 } | 1686 } |
1687 } | 1687 } |
1688 | 1688 |
1689 } // namespace dart | 1689 } // namespace dart |
OLD | NEW |