OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_REPRESENTATION_CHANGE_H_ | 5 #ifndef V8_COMPILER_REPRESENTATION_CHANGE_H_ |
6 #define V8_COMPILER_REPRESENTATION_CHANGE_H_ | 6 #define V8_COMPILER_REPRESENTATION_CHANGE_H_ |
7 | 7 |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/simplified-operator.h" | 9 #include "src/compiler/simplified-operator.h" |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 TruncationKind kind_; | 71 TruncationKind kind_; |
72 | 72 |
73 static TruncationKind Generalize(TruncationKind rep1, TruncationKind rep2); | 73 static TruncationKind Generalize(TruncationKind rep1, TruncationKind rep2); |
74 static bool LessGeneral(TruncationKind rep1, TruncationKind rep2); | 74 static bool LessGeneral(TruncationKind rep1, TruncationKind rep2); |
75 }; | 75 }; |
76 | 76 |
77 enum class TypeCheckKind : uint8_t { | 77 enum class TypeCheckKind : uint8_t { |
78 kNone, | 78 kNone, |
79 kSignedSmall, | 79 kSignedSmall, |
80 kSigned32, | 80 kSigned32, |
| 81 kNumber, |
81 kNumberOrOddball | 82 kNumberOrOddball |
82 }; | 83 }; |
83 | 84 |
84 inline std::ostream& operator<<(std::ostream& os, TypeCheckKind type_check) { | 85 inline std::ostream& operator<<(std::ostream& os, TypeCheckKind type_check) { |
85 switch (type_check) { | 86 switch (type_check) { |
86 case TypeCheckKind::kNone: | 87 case TypeCheckKind::kNone: |
87 return os << "None"; | 88 return os << "None"; |
88 case TypeCheckKind::kSignedSmall: | 89 case TypeCheckKind::kSignedSmall: |
89 return os << "SignedSmall"; | 90 return os << "SignedSmall"; |
90 case TypeCheckKind::kSigned32: | 91 case TypeCheckKind::kSigned32: |
91 return os << "Signed32"; | 92 return os << "Signed32"; |
| 93 case TypeCheckKind::kNumber: |
| 94 return os << "Number"; |
92 case TypeCheckKind::kNumberOrOddball: | 95 case TypeCheckKind::kNumberOrOddball: |
93 return os << "NumberOrOddball"; | 96 return os << "NumberOrOddball"; |
94 } | 97 } |
95 UNREACHABLE(); | 98 UNREACHABLE(); |
96 return os; | 99 return os; |
97 } | 100 } |
98 | 101 |
99 // The {UseInfo} class is used to describe a use of an input of a node. | 102 // The {UseInfo} class is used to describe a use of an input of a node. |
100 // | 103 // |
101 // This information is used in two different ways, based on the phase: | 104 // This information is used in two different ways, based on the phase: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 142 |
140 // Possibly deoptimizing conversions. | 143 // Possibly deoptimizing conversions. |
141 static UseInfo CheckedSignedSmallAsWord32() { | 144 static UseInfo CheckedSignedSmallAsWord32() { |
142 return UseInfo(MachineRepresentation::kWord32, Truncation::Any(), | 145 return UseInfo(MachineRepresentation::kWord32, Truncation::Any(), |
143 TypeCheckKind::kSignedSmall); | 146 TypeCheckKind::kSignedSmall); |
144 } | 147 } |
145 static UseInfo CheckedSigned32AsWord32() { | 148 static UseInfo CheckedSigned32AsWord32() { |
146 return UseInfo(MachineRepresentation::kWord32, Truncation::Any(), | 149 return UseInfo(MachineRepresentation::kWord32, Truncation::Any(), |
147 TypeCheckKind::kSigned32); | 150 TypeCheckKind::kSigned32); |
148 } | 151 } |
| 152 static UseInfo CheckedNumberAsFloat64() { |
| 153 return UseInfo(MachineRepresentation::kFloat64, Truncation::Float64(), |
| 154 TypeCheckKind::kNumber); |
| 155 } |
| 156 static UseInfo CheckedNumberAsWord32() { |
| 157 return UseInfo(MachineRepresentation::kWord32, Truncation::Word32(), |
| 158 TypeCheckKind::kNumber); |
| 159 } |
149 static UseInfo CheckedNumberOrOddballAsFloat64() { | 160 static UseInfo CheckedNumberOrOddballAsFloat64() { |
150 return UseInfo(MachineRepresentation::kFloat64, Truncation::Any(), | 161 return UseInfo(MachineRepresentation::kFloat64, Truncation::Any(), |
151 TypeCheckKind::kNumberOrOddball); | 162 TypeCheckKind::kNumberOrOddball); |
152 } | 163 } |
153 static UseInfo CheckedNumberOrOddballAsWord32() { | 164 static UseInfo CheckedNumberOrOddballAsWord32() { |
154 return UseInfo(MachineRepresentation::kWord32, Truncation::Word32(), | 165 return UseInfo(MachineRepresentation::kWord32, Truncation::Word32(), |
155 TypeCheckKind::kNumberOrOddball); | 166 TypeCheckKind::kNumberOrOddball); |
156 } | 167 } |
157 | 168 |
158 // Undetermined representation. | 169 // Undetermined representation. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 Factory* factory() const { return isolate()->factory(); } | 264 Factory* factory() const { return isolate()->factory(); } |
254 SimplifiedOperatorBuilder* simplified() { return jsgraph()->simplified(); } | 265 SimplifiedOperatorBuilder* simplified() { return jsgraph()->simplified(); } |
255 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } | 266 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } |
256 }; | 267 }; |
257 | 268 |
258 } // namespace compiler | 269 } // namespace compiler |
259 } // namespace internal | 270 } // namespace internal |
260 } // namespace v8 | 271 } // namespace v8 |
261 | 272 |
262 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ | 273 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ |
OLD | NEW |