OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 } else { | 1304 } else { |
1305 // Optimistically assume result fits into Smi. | 1305 // Optimistically assume result fits into Smi. |
1306 d2i_instr = new DoubleToSmiInstr(call->ArgumentAt(0)->value(), call); | 1306 d2i_instr = new DoubleToSmiInstr(call->ArgumentAt(0)->value(), call); |
1307 } | 1307 } |
1308 call->ReplaceWith(d2i_instr, current_iterator()); | 1308 call->ReplaceWith(d2i_instr, current_iterator()); |
1309 RemovePushArguments(call); | 1309 RemovePushArguments(call); |
1310 return true; | 1310 return true; |
1311 } | 1311 } |
1312 if ((recognized_kind == MethodRecognizer::kDoubleTruncate) || | 1312 if ((recognized_kind == MethodRecognizer::kDoubleTruncate) || |
1313 (recognized_kind == MethodRecognizer::kDoubleRound)) { | 1313 (recognized_kind == MethodRecognizer::kDoubleRound)) { |
| 1314 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
| 1315 // TODO(regis): FlowGraphOptimizer should be architecture dependent. |
1314 if (!CPUFeatures::sse4_1_supported()) { | 1316 if (!CPUFeatures::sse4_1_supported()) { |
1315 return false; | 1317 return false; |
1316 } | 1318 } |
| 1319 #else |
| 1320 return false; |
| 1321 #endif |
1317 AddCheckClass(call, call->ArgumentAt(0)->value()->Copy()); | 1322 AddCheckClass(call, call->ArgumentAt(0)->value()->Copy()); |
1318 DoubleToDoubleInstr* d2d_instr = | 1323 DoubleToDoubleInstr* d2d_instr = |
1319 new DoubleToDoubleInstr(call->ArgumentAt(0)->value(), | 1324 new DoubleToDoubleInstr(call->ArgumentAt(0)->value(), |
1320 call, | 1325 call, |
1321 recognized_kind); | 1326 recognized_kind); |
1322 call->ReplaceWith(d2d_instr, current_iterator()); | 1327 call->ReplaceWith(d2d_instr, current_iterator()); |
1323 RemovePushArguments(call); | 1328 RemovePushArguments(call); |
1324 return true; | 1329 return true; |
1325 } | 1330 } |
1326 } | 1331 } |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1994 // as smi values. | 1999 // as smi values. |
1995 GrowableArray<ConstraintInstr*> constraints_; | 2000 GrowableArray<ConstraintInstr*> constraints_; |
1996 | 2001 |
1997 // Bitvector for a quick filtering of known smi values. | 2002 // Bitvector for a quick filtering of known smi values. |
1998 BitVector* smi_definitions_; | 2003 BitVector* smi_definitions_; |
1999 | 2004 |
2000 // Worklist for induction variables analysis. | 2005 // Worklist for induction variables analysis. |
2001 GrowableArray<Definition*> worklist_; | 2006 GrowableArray<Definition*> worklist_; |
2002 BitVector* marked_defns_; | 2007 BitVector* marked_defns_; |
2003 | 2008 |
2004 class ArrayLengthData : public ValueObject { | 2009 class ArrayLengthData { |
2005 public: | 2010 public: |
2006 ArrayLengthData(Definition* array, Definition* array_length) | 2011 ArrayLengthData(Definition* array, Definition* array_length) |
2007 : array_(array), array_length_(array_length) { } | 2012 : array_(array), array_length_(array_length) { } |
2008 | 2013 |
| 2014 ArrayLengthData(const ArrayLengthData& other) |
| 2015 : array_(other.array_), array_length_(other.array_length_) { } |
| 2016 |
| 2017 ArrayLengthData& operator=(const ArrayLengthData& other) { |
| 2018 array_ = other.array_; |
| 2019 array_length_ = other.array_length_; |
| 2020 return *this; |
| 2021 } |
| 2022 |
2009 Definition* array() const { return array_; } | 2023 Definition* array() const { return array_; } |
2010 Definition* array_length() const { return array_length_; } | 2024 Definition* array_length() const { return array_length_; } |
2011 | 2025 |
2012 typedef Definition* Value; | 2026 typedef Definition* Value; |
2013 typedef Definition* Key; | 2027 typedef Definition* Key; |
2014 typedef class ArrayLengthData Pair; | 2028 typedef class ArrayLengthData Pair; |
2015 | 2029 |
2016 // KeyValueTrait members. | 2030 // KeyValueTrait members. |
2017 static Key KeyOf(const ArrayLengthData& data) { | 2031 static Key KeyOf(const ArrayLengthData& data) { |
2018 return data.array(); | 2032 return data.array(); |
(...skipping 2480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4499 | 4513 |
4500 if (FLAG_trace_constant_propagation) { | 4514 if (FLAG_trace_constant_propagation) { |
4501 OS::Print("\n==== After constant propagation ====\n"); | 4515 OS::Print("\n==== After constant propagation ====\n"); |
4502 FlowGraphPrinter printer(*graph_); | 4516 FlowGraphPrinter printer(*graph_); |
4503 printer.PrintBlocks(); | 4517 printer.PrintBlocks(); |
4504 } | 4518 } |
4505 } | 4519 } |
4506 | 4520 |
4507 | 4521 |
4508 } // namespace dart | 4522 } // namespace dart |
OLD | NEW |