| 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/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/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 7576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7587 const Object& left = instr->left()->definition()->constant_value(); | 7587 const Object& left = instr->left()->definition()->constant_value(); |
| 7588 const Object& right = instr->right()->definition()->constant_value(); | 7588 const Object& right = instr->right()->definition()->constant_value(); |
| 7589 if (IsNonConstant(left) || IsNonConstant(right)) { | 7589 if (IsNonConstant(left) || IsNonConstant(right)) { |
| 7590 SetValue(instr, non_constant_); | 7590 SetValue(instr, non_constant_); |
| 7591 } else if (IsConstant(left) && IsConstant(right)) { | 7591 } else if (IsConstant(left) && IsConstant(right)) { |
| 7592 if (left.IsInteger() && right.IsInteger()) { | 7592 if (left.IsInteger() && right.IsInteger()) { |
| 7593 const bool result = CompareIntegers(instr->kind(), | 7593 const bool result = CompareIntegers(instr->kind(), |
| 7594 Integer::Cast(left), | 7594 Integer::Cast(left), |
| 7595 Integer::Cast(right)); | 7595 Integer::Cast(right)); |
| 7596 SetValue(instr, Bool::Get(result)); | 7596 SetValue(instr, Bool::Get(result)); |
| 7597 } else if (left.IsDouble() && right.IsDouble()) { |
| 7598 // TODO(srdjan): Implement. |
| 7599 SetValue(instr, non_constant_); |
| 7597 } else { | 7600 } else { |
| 7598 SetValue(instr, non_constant_); | 7601 SetValue(instr, non_constant_); |
| 7599 } | 7602 } |
| 7600 } | 7603 } |
| 7601 } | 7604 } |
| 7602 | 7605 |
| 7603 | 7606 |
| 7604 void ConstantPropagator::VisitNativeCall(NativeCallInstr* instr) { | 7607 void ConstantPropagator::VisitNativeCall(NativeCallInstr* instr) { |
| 7605 SetValue(instr, non_constant_); | 7608 SetValue(instr, non_constant_); |
| 7606 } | 7609 } |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8055 void ConstantPropagator::VisitExtractNthOutput(ExtractNthOutputInstr* instr) { | 8058 void ConstantPropagator::VisitExtractNthOutput(ExtractNthOutputInstr* instr) { |
| 8056 SetValue(instr, non_constant_); | 8059 SetValue(instr, non_constant_); |
| 8057 } | 8060 } |
| 8058 | 8061 |
| 8059 | 8062 |
| 8060 void ConstantPropagator::VisitConstant(ConstantInstr* instr) { | 8063 void ConstantPropagator::VisitConstant(ConstantInstr* instr) { |
| 8061 SetValue(instr, instr->value()); | 8064 SetValue(instr, instr->value()); |
| 8062 } | 8065 } |
| 8063 | 8066 |
| 8064 | 8067 |
| 8068 void ConstantPropagator::VisitUnboxedConstant(UnboxedConstantInstr* instr) { |
| 8069 SetValue(instr, instr->value()); |
| 8070 } |
| 8071 |
| 8072 |
| 8065 void ConstantPropagator::VisitConstraint(ConstraintInstr* instr) { | 8073 void ConstantPropagator::VisitConstraint(ConstraintInstr* instr) { |
| 8066 // Should not be used outside of range analysis. | 8074 // Should not be used outside of range analysis. |
| 8067 UNREACHABLE(); | 8075 UNREACHABLE(); |
| 8068 } | 8076 } |
| 8069 | 8077 |
| 8070 | 8078 |
| 8071 void ConstantPropagator::VisitMaterializeObject(MaterializeObjectInstr* instr) { | 8079 void ConstantPropagator::VisitMaterializeObject(MaterializeObjectInstr* instr) { |
| 8072 // Should not be used outside of allocation elimination pass. | 8080 // Should not be used outside of allocation elimination pass. |
| 8073 UNREACHABLE(); | 8081 UNREACHABLE(); |
| 8074 } | 8082 } |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9194 } | 9202 } |
| 9195 | 9203 |
| 9196 // Insert materializations at environment uses. | 9204 // Insert materializations at environment uses. |
| 9197 for (intptr_t i = 0; i < exits.length(); i++) { | 9205 for (intptr_t i = 0; i < exits.length(); i++) { |
| 9198 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *slots); | 9206 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *slots); |
| 9199 } | 9207 } |
| 9200 } | 9208 } |
| 9201 | 9209 |
| 9202 | 9210 |
| 9203 } // namespace dart | 9211 } // namespace dart |
| OLD | NEW |