| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_range_analysis.h" | 5 #include "vm/flow_graph_range_analysis.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/il_printer.h" | 8 #include "vm/il_printer.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 | 754 |
| 755 iteration++; | 755 iteration++; |
| 756 } while (changed && (iteration < max_iterations)); | 756 } while (changed && (iteration < max_iterations)); |
| 757 } | 757 } |
| 758 | 758 |
| 759 | 759 |
| 760 void RangeAnalysis::InferRanges() { | 760 void RangeAnalysis::InferRanges() { |
| 761 if (FLAG_trace_range_analysis) { | 761 if (FLAG_trace_range_analysis) { |
| 762 FlowGraphPrinter::PrintGraph("Range Analysis (BEFORE)", flow_graph_); | 762 FlowGraphPrinter::PrintGraph("Range Analysis (BEFORE)", flow_graph_); |
| 763 } | 763 } |
| 764 | 764 Zone* zone = flow_graph_->zone(); |
| 765 // Initialize bitvector for quick filtering of int values. | 765 // Initialize bitvector for quick filtering of int values. |
| 766 BitVector* set = new(I) BitVector(I, flow_graph_->current_ssa_temp_index()); | 766 BitVector* set = new(zone) BitVector(zone, |
| 767 flow_graph_->current_ssa_temp_index()); |
| 767 for (intptr_t i = 0; i < values_.length(); i++) { | 768 for (intptr_t i = 0; i < values_.length(); i++) { |
| 768 set->Add(values_[i]->ssa_temp_index()); | 769 set->Add(values_[i]->ssa_temp_index()); |
| 769 } | 770 } |
| 770 for (intptr_t i = 0; i < constraints_.length(); i++) { | 771 for (intptr_t i = 0; i < constraints_.length(); i++) { |
| 771 set->Add(constraints_[i]->ssa_temp_index()); | 772 set->Add(constraints_[i]->ssa_temp_index()); |
| 772 } | 773 } |
| 773 | 774 |
| 774 // Collect integer definitions (including constraints) in the reverse | 775 // Collect integer definitions (including constraints) in the reverse |
| 775 // postorder. This improves convergence speed compared to iterating | 776 // postorder. This improves convergence speed compared to iterating |
| 776 // values_ and constraints_ array separately. | 777 // values_ and constraints_ array separately. |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1650 } | 1651 } |
| 1651 } | 1652 } |
| 1652 | 1653 |
| 1653 | 1654 |
| 1654 IntegerInstructionSelector::IntegerInstructionSelector(FlowGraph* flow_graph) | 1655 IntegerInstructionSelector::IntegerInstructionSelector(FlowGraph* flow_graph) |
| 1655 : flow_graph_(flow_graph), | 1656 : flow_graph_(flow_graph), |
| 1656 isolate_(NULL) { | 1657 isolate_(NULL) { |
| 1657 ASSERT(flow_graph_ != NULL); | 1658 ASSERT(flow_graph_ != NULL); |
| 1658 isolate_ = flow_graph_->isolate(); | 1659 isolate_ = flow_graph_->isolate(); |
| 1659 ASSERT(isolate_ != NULL); | 1660 ASSERT(isolate_ != NULL); |
| 1661 Zone* zone = flow_graph_->zone(); |
| 1660 selected_uint32_defs_ = | 1662 selected_uint32_defs_ = |
| 1661 new(I) BitVector(I, flow_graph_->current_ssa_temp_index()); | 1663 new(zone) BitVector(zone, flow_graph_->current_ssa_temp_index()); |
| 1662 } | 1664 } |
| 1663 | 1665 |
| 1664 | 1666 |
| 1665 void IntegerInstructionSelector::Select() { | 1667 void IntegerInstructionSelector::Select() { |
| 1666 if (FLAG_trace_integer_ir_selection) { | 1668 if (FLAG_trace_integer_ir_selection) { |
| 1667 OS::Print("---- starting integer ir selection -------\n"); | 1669 OS::Print("---- starting integer ir selection -------\n"); |
| 1668 } | 1670 } |
| 1669 FindPotentialUint32Definitions(); | 1671 FindPotentialUint32Definitions(); |
| 1670 FindUint32NarrowingDefinitions(); | 1672 FindUint32NarrowingDefinitions(); |
| 1671 Propagate(); | 1673 Propagate(); |
| (...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3141 } | 3143 } |
| 3142 } while (CanonicalizeMaxBoundary(&max) || | 3144 } while (CanonicalizeMaxBoundary(&max) || |
| 3143 CanonicalizeMinBoundary(&canonical_length)); | 3145 CanonicalizeMinBoundary(&canonical_length)); |
| 3144 | 3146 |
| 3145 // Failed to prove that maximum is bounded with array length. | 3147 // Failed to prove that maximum is bounded with array length. |
| 3146 return false; | 3148 return false; |
| 3147 } | 3149 } |
| 3148 | 3150 |
| 3149 | 3151 |
| 3150 } // namespace dart | 3152 } // namespace dart |
| OLD | NEW |