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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 explicit Truncation(TruncationKind kind) : kind_(kind) {} | 67 explicit Truncation(TruncationKind kind) : kind_(kind) {} |
68 TruncationKind kind() const { return kind_; } | 68 TruncationKind kind() const { return kind_; } |
69 | 69 |
70 TruncationKind kind_; | 70 TruncationKind kind_; |
71 | 71 |
72 static TruncationKind Generalize(TruncationKind rep1, TruncationKind rep2); | 72 static TruncationKind Generalize(TruncationKind rep1, TruncationKind rep2); |
73 static bool LessGeneral(TruncationKind rep1, TruncationKind rep2); | 73 static bool LessGeneral(TruncationKind rep1, TruncationKind rep2); |
74 }; | 74 }; |
75 | 75 |
76 enum class TypeCheckKind : uint8_t { | 76 enum class TypeCheckKind : uint8_t { kNone, kSigned32, kNumberOrOddball }; |
77 kNone, | |
78 kSigned32, | |
79 kNumberOrUndefined, | |
80 kNumber | |
81 }; | |
82 | 77 |
83 inline std::ostream& operator<<(std::ostream& os, TypeCheckKind type_check) { | 78 inline std::ostream& operator<<(std::ostream& os, TypeCheckKind type_check) { |
84 switch (type_check) { | 79 switch (type_check) { |
85 case TypeCheckKind::kNone: | 80 case TypeCheckKind::kNone: |
86 return os << "None"; | 81 return os << "None"; |
87 case TypeCheckKind::kSigned32: | 82 case TypeCheckKind::kSigned32: |
88 return os << "Signed32"; | 83 return os << "Signed32"; |
89 case TypeCheckKind::kNumberOrUndefined: | 84 case TypeCheckKind::kNumberOrOddball: |
90 return os << "NumberOrUndefined"; | 85 return os << "NumberOrOddball"; |
91 case TypeCheckKind::kNumber: | |
92 return os << "Number"; | |
93 } | 86 } |
94 UNREACHABLE(); | 87 UNREACHABLE(); |
95 return os; | 88 return os; |
96 } | 89 } |
97 | 90 |
98 // The {UseInfo} class is used to describe a use of an input of a node. | 91 // The {UseInfo} class is used to describe a use of an input of a node. |
99 // | 92 // |
100 // This information is used in two different ways, based on the phase: | 93 // This information is used in two different ways, based on the phase: |
101 // | 94 // |
102 // 1. During propagation, the use info is used to inform the input node | 95 // 1. During propagation, the use info is used to inform the input node |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 127 } |
135 static UseInfo AnyTagged() { | 128 static UseInfo AnyTagged() { |
136 return UseInfo(MachineRepresentation::kTagged, Truncation::Any()); | 129 return UseInfo(MachineRepresentation::kTagged, Truncation::Any()); |
137 } | 130 } |
138 | 131 |
139 // Possibly deoptimizing conversions. | 132 // Possibly deoptimizing conversions. |
140 static UseInfo CheckedSigned32AsWord32() { | 133 static UseInfo CheckedSigned32AsWord32() { |
141 return UseInfo(MachineRepresentation::kWord32, Truncation::Any(), | 134 return UseInfo(MachineRepresentation::kWord32, Truncation::Any(), |
142 TypeCheckKind::kSigned32); | 135 TypeCheckKind::kSigned32); |
143 } | 136 } |
144 static UseInfo CheckedNumberOrUndefinedAsFloat64() { | 137 static UseInfo CheckedNumberOrOddballAsFloat64() { |
145 return UseInfo(MachineRepresentation::kFloat64, Truncation::Any(), | 138 return UseInfo(MachineRepresentation::kFloat64, Truncation::Any(), |
146 TypeCheckKind::kNumberOrUndefined); | 139 TypeCheckKind::kNumberOrOddball); |
147 } | 140 } |
148 | 141 |
149 // Undetermined representation. | 142 // Undetermined representation. |
150 static UseInfo Any() { | 143 static UseInfo Any() { |
151 return UseInfo(MachineRepresentation::kNone, Truncation::Any()); | 144 return UseInfo(MachineRepresentation::kNone, Truncation::Any()); |
152 } | 145 } |
153 static UseInfo AnyTruncatingToBool() { | 146 static UseInfo AnyTruncatingToBool() { |
154 return UseInfo(MachineRepresentation::kNone, Truncation::Bool()); | 147 return UseInfo(MachineRepresentation::kNone, Truncation::Bool()); |
155 } | 148 } |
156 | 149 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 Factory* factory() const { return isolate()->factory(); } | 242 Factory* factory() const { return isolate()->factory(); } |
250 SimplifiedOperatorBuilder* simplified() { return jsgraph()->simplified(); } | 243 SimplifiedOperatorBuilder* simplified() { return jsgraph()->simplified(); } |
251 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } | 244 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } |
252 }; | 245 }; |
253 | 246 |
254 } // namespace compiler | 247 } // namespace compiler |
255 } // namespace internal | 248 } // namespace internal |
256 } // namespace v8 | 249 } // namespace v8 |
257 | 250 |
258 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ | 251 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ |
OLD | NEW |