OLD | NEW |
1 // Copyright (c) 2012, 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" |
11 #include "vm/hash_map.h" | 11 #include "vm/hash_map.h" |
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 } else { | 1316 } else { |
1317 // Optimistically assume result fits into Smi. | 1317 // Optimistically assume result fits into Smi. |
1318 d2i_instr = new DoubleToSmiInstr(call->ArgumentAt(0)->value(), call); | 1318 d2i_instr = new DoubleToSmiInstr(call->ArgumentAt(0)->value(), call); |
1319 } | 1319 } |
1320 call->ReplaceWith(d2i_instr, current_iterator()); | 1320 call->ReplaceWith(d2i_instr, current_iterator()); |
1321 RemovePushArguments(call); | 1321 RemovePushArguments(call); |
1322 return true; | 1322 return true; |
1323 } | 1323 } |
1324 if ((recognized_kind == MethodRecognizer::kDoubleTruncate) || | 1324 if ((recognized_kind == MethodRecognizer::kDoubleTruncate) || |
1325 (recognized_kind == MethodRecognizer::kDoubleRound)) { | 1325 (recognized_kind == MethodRecognizer::kDoubleRound)) { |
1326 if (!CPUFeatures::sse4_1_supported()) { | 1326 if (!CPUFeatures::double_truncate_round_supported()) { |
1327 return false; | 1327 return false; |
1328 } | 1328 } |
1329 AddCheckClass(call, call->ArgumentAt(0)->value()->Copy()); | 1329 AddCheckClass(call, call->ArgumentAt(0)->value()->Copy()); |
1330 DoubleToDoubleInstr* d2d_instr = | 1330 DoubleToDoubleInstr* d2d_instr = |
1331 new DoubleToDoubleInstr(call->ArgumentAt(0)->value(), | 1331 new DoubleToDoubleInstr(call->ArgumentAt(0)->value(), |
1332 call, | 1332 call, |
1333 recognized_kind); | 1333 recognized_kind); |
1334 call->ReplaceWith(d2d_instr, current_iterator()); | 1334 call->ReplaceWith(d2d_instr, current_iterator()); |
1335 RemovePushArguments(call); | 1335 RemovePushArguments(call); |
1336 return true; | 1336 return true; |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2011 | 2011 |
2012 // Worklist for induction variables analysis. | 2012 // Worklist for induction variables analysis. |
2013 GrowableArray<Definition*> worklist_; | 2013 GrowableArray<Definition*> worklist_; |
2014 BitVector* marked_defns_; | 2014 BitVector* marked_defns_; |
2015 | 2015 |
2016 class ArrayLengthData : public ValueObject { | 2016 class ArrayLengthData : public ValueObject { |
2017 public: | 2017 public: |
2018 ArrayLengthData(Definition* array, Definition* array_length) | 2018 ArrayLengthData(Definition* array, Definition* array_length) |
2019 : array_(array), array_length_(array_length) { } | 2019 : array_(array), array_length_(array_length) { } |
2020 | 2020 |
| 2021 ArrayLengthData(const ArrayLengthData& other) |
| 2022 : ValueObject(), |
| 2023 array_(other.array_), |
| 2024 array_length_(other.array_length_) { } |
| 2025 |
| 2026 ArrayLengthData& operator=(const ArrayLengthData& other) { |
| 2027 array_ = other.array_; |
| 2028 array_length_ = other.array_length_; |
| 2029 return *this; |
| 2030 } |
| 2031 |
2021 Definition* array() const { return array_; } | 2032 Definition* array() const { return array_; } |
2022 Definition* array_length() const { return array_length_; } | 2033 Definition* array_length() const { return array_length_; } |
2023 | 2034 |
2024 typedef Definition* Value; | 2035 typedef Definition* Value; |
2025 typedef Definition* Key; | 2036 typedef Definition* Key; |
2026 typedef class ArrayLengthData Pair; | 2037 typedef class ArrayLengthData Pair; |
2027 | 2038 |
2028 // KeyValueTrait members. | 2039 // KeyValueTrait members. |
2029 static Key KeyOf(const ArrayLengthData& data) { | 2040 static Key KeyOf(const ArrayLengthData& data) { |
2030 return data.array(); | 2041 return data.array(); |
(...skipping 2488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4519 | 4530 |
4520 if (FLAG_trace_constant_propagation) { | 4531 if (FLAG_trace_constant_propagation) { |
4521 OS::Print("\n==== After constant propagation ====\n"); | 4532 OS::Print("\n==== After constant propagation ====\n"); |
4522 FlowGraphPrinter printer(*graph_); | 4533 FlowGraphPrinter printer(*graph_); |
4523 printer.PrintBlocks(); | 4534 printer.PrintBlocks(); |
4524 } | 4535 } |
4525 } | 4536 } |
4526 | 4537 |
4527 | 4538 |
4528 } // namespace dart | 4539 } // namespace dart |
OLD | NEW |