| 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 1292 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 (!CPUFeatures::sse4_1_supported()) { | 1314 if (!CPUFeatures::double_truncate_round_supported()) { |
| 1315 return false; | 1315 return false; |
| 1316 } | 1316 } |
| 1317 AddCheckClass(call, call->ArgumentAt(0)->value()->Copy()); | 1317 AddCheckClass(call, call->ArgumentAt(0)->value()->Copy()); |
| 1318 DoubleToDoubleInstr* d2d_instr = | 1318 DoubleToDoubleInstr* d2d_instr = |
| 1319 new DoubleToDoubleInstr(call->ArgumentAt(0)->value(), | 1319 new DoubleToDoubleInstr(call->ArgumentAt(0)->value(), |
| 1320 call, | 1320 call, |
| 1321 recognized_kind); | 1321 recognized_kind); |
| 1322 call->ReplaceWith(d2d_instr, current_iterator()); | 1322 call->ReplaceWith(d2d_instr, current_iterator()); |
| 1323 RemovePushArguments(call); | 1323 RemovePushArguments(call); |
| 1324 return true; | 1324 return true; |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1994 // as smi values. | 1994 // as smi values. |
| 1995 GrowableArray<ConstraintInstr*> constraints_; | 1995 GrowableArray<ConstraintInstr*> constraints_; |
| 1996 | 1996 |
| 1997 // Bitvector for a quick filtering of known smi values. | 1997 // Bitvector for a quick filtering of known smi values. |
| 1998 BitVector* smi_definitions_; | 1998 BitVector* smi_definitions_; |
| 1999 | 1999 |
| 2000 // Worklist for induction variables analysis. | 2000 // Worklist for induction variables analysis. |
| 2001 GrowableArray<Definition*> worklist_; | 2001 GrowableArray<Definition*> worklist_; |
| 2002 BitVector* marked_defns_; | 2002 BitVector* marked_defns_; |
| 2003 | 2003 |
| 2004 class ArrayLengthData : public ValueObject { | 2004 class ArrayLengthData { |
| 2005 public: | 2005 public: |
| 2006 ArrayLengthData(Definition* array, Definition* array_length) | 2006 ArrayLengthData(Definition* array, Definition* array_length) |
| 2007 : array_(array), array_length_(array_length) { } | 2007 : array_(array), array_length_(array_length) { } |
| 2008 | 2008 |
| 2009 ArrayLengthData(const ArrayLengthData& other) |
| 2010 : array_(other.array_), array_length_(other.array_length_) { } |
| 2011 |
| 2012 ArrayLengthData& operator=(const ArrayLengthData& other) { |
| 2013 array_ = other.array_; |
| 2014 array_length_ = other.array_length_; |
| 2015 return *this; |
| 2016 } |
| 2017 |
| 2009 Definition* array() const { return array_; } | 2018 Definition* array() const { return array_; } |
| 2010 Definition* array_length() const { return array_length_; } | 2019 Definition* array_length() const { return array_length_; } |
| 2011 | 2020 |
| 2012 typedef Definition* Value; | 2021 typedef Definition* Value; |
| 2013 typedef Definition* Key; | 2022 typedef Definition* Key; |
| 2014 typedef class ArrayLengthData Pair; | 2023 typedef class ArrayLengthData Pair; |
| 2015 | 2024 |
| 2016 // KeyValueTrait members. | 2025 // KeyValueTrait members. |
| 2017 static Key KeyOf(const ArrayLengthData& data) { | 2026 static Key KeyOf(const ArrayLengthData& data) { |
| 2018 return data.array(); | 2027 return data.array(); |
| (...skipping 2480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4499 | 4508 |
| 4500 if (FLAG_trace_constant_propagation) { | 4509 if (FLAG_trace_constant_propagation) { |
| 4501 OS::Print("\n==== After constant propagation ====\n"); | 4510 OS::Print("\n==== After constant propagation ====\n"); |
| 4502 FlowGraphPrinter printer(*graph_); | 4511 FlowGraphPrinter printer(*graph_); |
| 4503 printer.PrintBlocks(); | 4512 printer.PrintBlocks(); |
| 4504 } | 4513 } |
| 4505 } | 4514 } |
| 4506 | 4515 |
| 4507 | 4516 |
| 4508 } // namespace dart | 4517 } // namespace dart |
| OLD | NEW |