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_SIMPLIFIED_OPERATOR_H_ | 5 #ifndef V8_COMPILER_SIMPLIFIED_OPERATOR_H_ |
6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_H_ | 6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/compiler/operator.h" | 10 #include "src/compiler/operator.h" |
11 #include "src/compiler/type-hints.h" | |
12 #include "src/handles.h" | 11 #include "src/handles.h" |
13 #include "src/machine-type.h" | 12 #include "src/machine-type.h" |
14 #include "src/objects.h" | 13 #include "src/objects.h" |
15 | 14 |
16 namespace v8 { | 15 namespace v8 { |
17 namespace internal { | 16 namespace internal { |
18 | 17 |
19 // Forward declarations. | 18 // Forward declarations. |
20 class Type; | 19 class Type; |
21 class Zone; | 20 class Zone; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // A descriptor for elements kind transitions. | 142 // A descriptor for elements kind transitions. |
144 enum class ElementsTransition : uint8_t { | 143 enum class ElementsTransition : uint8_t { |
145 kFastTransition, // simple transition, just updating the map. | 144 kFastTransition, // simple transition, just updating the map. |
146 kSlowTransition // full transition, round-trip to the runtime. | 145 kSlowTransition // full transition, round-trip to the runtime. |
147 }; | 146 }; |
148 | 147 |
149 std::ostream& operator<<(std::ostream&, ElementsTransition); | 148 std::ostream& operator<<(std::ostream&, ElementsTransition); |
150 | 149 |
151 ElementsTransition ElementsTransitionOf(const Operator* op) WARN_UNUSED_RESULT; | 150 ElementsTransition ElementsTransitionOf(const Operator* op) WARN_UNUSED_RESULT; |
152 | 151 |
153 BinaryOperationHints::Hint BinaryOperationHintOf(const Operator* op); | 152 // Hints for numeric operations. |
| 153 enum class NumberOperationHint : uint8_t { kNone, kSigned32, kNumberOrOddball }; |
154 | 154 |
155 CompareOperationHints::Hint CompareOperationHintOf(const Operator* op); | 155 size_t hash_value(NumberOperationHint); |
| 156 |
| 157 std::ostream& operator<<(std::ostream&, NumberOperationHint); |
| 158 |
| 159 NumberOperationHint NumberOperationHintOf(const Operator* op) |
| 160 WARN_UNUSED_RESULT; |
156 | 161 |
157 // Interface for building simplified operators, which represent the | 162 // Interface for building simplified operators, which represent the |
158 // medium-level operations of V8, including adding numbers, allocating objects, | 163 // medium-level operations of V8, including adding numbers, allocating objects, |
159 // indexing into objects and arrays, etc. | 164 // indexing into objects and arrays, etc. |
160 // All operators are typed but many are representation independent. | 165 // All operators are typed but many are representation independent. |
161 | 166 |
162 // Number values from JS can be in one of these representations: | 167 // Number values from JS can be in one of these representations: |
163 // - Tagged: word-sized integer that is either | 168 // - Tagged: word-sized integer that is either |
164 // - a signed small integer (31 or 32 bits plus a tag) | 169 // - a signed small integer (31 or 32 bits plus a tag) |
165 // - a tagged pointer to a HeapNumber object that has a float64 field | 170 // - a tagged pointer to a HeapNumber object that has a float64 field |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 const Operator* NumberSinh(); | 232 const Operator* NumberSinh(); |
228 const Operator* NumberSqrt(); | 233 const Operator* NumberSqrt(); |
229 const Operator* NumberTan(); | 234 const Operator* NumberTan(); |
230 const Operator* NumberTanh(); | 235 const Operator* NumberTanh(); |
231 const Operator* NumberTrunc(); | 236 const Operator* NumberTrunc(); |
232 const Operator* NumberToInt32(); | 237 const Operator* NumberToInt32(); |
233 const Operator* NumberToUint32(); | 238 const Operator* NumberToUint32(); |
234 | 239 |
235 const Operator* NumberSilenceNaN(); | 240 const Operator* NumberSilenceNaN(); |
236 | 241 |
237 const Operator* SpeculativeNumberAdd(BinaryOperationHints::Hint hint); | 242 const Operator* SpeculativeNumberAdd(NumberOperationHint hint); |
238 const Operator* SpeculativeNumberSubtract(BinaryOperationHints::Hint hint); | 243 const Operator* SpeculativeNumberSubtract(NumberOperationHint hint); |
239 const Operator* SpeculativeNumberMultiply(BinaryOperationHints::Hint hint); | 244 const Operator* SpeculativeNumberMultiply(NumberOperationHint hint); |
240 const Operator* SpeculativeNumberDivide(BinaryOperationHints::Hint hint); | 245 const Operator* SpeculativeNumberDivide(NumberOperationHint hint); |
241 const Operator* SpeculativeNumberModulus(BinaryOperationHints::Hint hint); | 246 const Operator* SpeculativeNumberModulus(NumberOperationHint hint); |
242 const Operator* SpeculativeNumberShiftLeft(BinaryOperationHints::Hint hint); | 247 const Operator* SpeculativeNumberShiftLeft(NumberOperationHint hint); |
243 | 248 |
244 const Operator* SpeculativeNumberLessThan(CompareOperationHints::Hint hint); | 249 const Operator* SpeculativeNumberLessThan(NumberOperationHint hint); |
245 const Operator* SpeculativeNumberLessThanOrEqual( | 250 const Operator* SpeculativeNumberLessThanOrEqual(NumberOperationHint hint); |
246 CompareOperationHints::Hint hint); | 251 const Operator* SpeculativeNumberEqual(NumberOperationHint hint); |
247 const Operator* SpeculativeNumberEqual(CompareOperationHints::Hint hint); | |
248 | 252 |
249 const Operator* ReferenceEqual(Type* type); | 253 const Operator* ReferenceEqual(Type* type); |
250 | 254 |
251 const Operator* StringEqual(); | 255 const Operator* StringEqual(); |
252 const Operator* StringLessThan(); | 256 const Operator* StringLessThan(); |
253 const Operator* StringLessThanOrEqual(); | 257 const Operator* StringLessThanOrEqual(); |
254 const Operator* StringFromCharCode(); | 258 const Operator* StringFromCharCode(); |
255 | 259 |
256 const Operator* PlainPrimitiveToNumber(); | 260 const Operator* PlainPrimitiveToNumber(); |
257 const Operator* PlainPrimitiveToWord32(); | 261 const Operator* PlainPrimitiveToWord32(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 Zone* const zone_; | 329 Zone* const zone_; |
326 | 330 |
327 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder); | 331 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder); |
328 }; | 332 }; |
329 | 333 |
330 } // namespace compiler | 334 } // namespace compiler |
331 } // namespace internal | 335 } // namespace internal |
332 } // namespace v8 | 336 } // namespace v8 |
333 | 337 |
334 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_ | 338 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_ |
OLD | NEW |