| 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 7586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7597 const Object& left = instr->left()->definition()->constant_value(); | 7597 const Object& left = instr->left()->definition()->constant_value(); |
| 7598 const Object& right = instr->right()->definition()->constant_value(); | 7598 const Object& right = instr->right()->definition()->constant_value(); |
| 7599 if (IsNonConstant(left) || IsNonConstant(right)) { | 7599 if (IsNonConstant(left) || IsNonConstant(right)) { |
| 7600 SetValue(instr, non_constant_); | 7600 SetValue(instr, non_constant_); |
| 7601 } else if (IsConstant(left) && IsConstant(right)) { | 7601 } else if (IsConstant(left) && IsConstant(right)) { |
| 7602 if (left.IsInteger() && right.IsInteger()) { | 7602 if (left.IsInteger() && right.IsInteger()) { |
| 7603 const bool result = CompareIntegers(instr->kind(), | 7603 const bool result = CompareIntegers(instr->kind(), |
| 7604 Integer::Cast(left), | 7604 Integer::Cast(left), |
| 7605 Integer::Cast(right)); | 7605 Integer::Cast(right)); |
| 7606 SetValue(instr, Bool::Get(result)); | 7606 SetValue(instr, Bool::Get(result)); |
| 7607 } else if (left.IsDouble() && right.IsDouble()) { |
| 7608 // TODO(srdjan): Implement. |
| 7609 SetValue(instr, non_constant_); |
| 7607 } else { | 7610 } else { |
| 7608 SetValue(instr, non_constant_); | 7611 SetValue(instr, non_constant_); |
| 7609 } | 7612 } |
| 7610 } | 7613 } |
| 7611 } | 7614 } |
| 7612 | 7615 |
| 7613 | 7616 |
| 7614 void ConstantPropagator::VisitNativeCall(NativeCallInstr* instr) { | 7617 void ConstantPropagator::VisitNativeCall(NativeCallInstr* instr) { |
| 7615 SetValue(instr, non_constant_); | 7618 SetValue(instr, non_constant_); |
| 7616 } | 7619 } |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8065 void ConstantPropagator::VisitExtractNthOutput(ExtractNthOutputInstr* instr) { | 8068 void ConstantPropagator::VisitExtractNthOutput(ExtractNthOutputInstr* instr) { |
| 8066 SetValue(instr, non_constant_); | 8069 SetValue(instr, non_constant_); |
| 8067 } | 8070 } |
| 8068 | 8071 |
| 8069 | 8072 |
| 8070 void ConstantPropagator::VisitConstant(ConstantInstr* instr) { | 8073 void ConstantPropagator::VisitConstant(ConstantInstr* instr) { |
| 8071 SetValue(instr, instr->value()); | 8074 SetValue(instr, instr->value()); |
| 8072 } | 8075 } |
| 8073 | 8076 |
| 8074 | 8077 |
| 8078 void ConstantPropagator::VisitUnboxedConstant(UnboxedConstantInstr* instr) { |
| 8079 SetValue(instr, instr->value()); |
| 8080 } |
| 8081 |
| 8082 |
| 8075 void ConstantPropagator::VisitConstraint(ConstraintInstr* instr) { | 8083 void ConstantPropagator::VisitConstraint(ConstraintInstr* instr) { |
| 8076 // Should not be used outside of range analysis. | 8084 // Should not be used outside of range analysis. |
| 8077 UNREACHABLE(); | 8085 UNREACHABLE(); |
| 8078 } | 8086 } |
| 8079 | 8087 |
| 8080 | 8088 |
| 8081 void ConstantPropagator::VisitMaterializeObject(MaterializeObjectInstr* instr) { | 8089 void ConstantPropagator::VisitMaterializeObject(MaterializeObjectInstr* instr) { |
| 8082 // Should not be used outside of allocation elimination pass. | 8090 // Should not be used outside of allocation elimination pass. |
| 8083 UNREACHABLE(); | 8091 UNREACHABLE(); |
| 8084 } | 8092 } |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9204 } | 9212 } |
| 9205 | 9213 |
| 9206 // Insert materializations at environment uses. | 9214 // Insert materializations at environment uses. |
| 9207 for (intptr_t i = 0; i < exits.length(); i++) { | 9215 for (intptr_t i = 0; i < exits.length(); i++) { |
| 9208 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *slots); | 9216 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *slots); |
| 9209 } | 9217 } |
| 9210 } | 9218 } |
| 9211 | 9219 |
| 9212 | 9220 |
| 9213 } // namespace dart | 9221 } // namespace dart |
| OLD | NEW |