OLD | NEW |
| (Empty) |
1 // Copyright 2015 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef V8_COMPILER_TYPE_HINTS_H_ | |
6 #define V8_COMPILER_TYPE_HINTS_H_ | |
7 | |
8 #include "src/base/flags.h" | |
9 #include "src/utils.h" | |
10 | |
11 namespace v8 { | |
12 namespace internal { | |
13 namespace compiler { | |
14 | |
15 // Type hints for an binary operation. | |
16 enum class BinaryOperationHint : uint8_t { | |
17 kNone, | |
18 kSignedSmall, | |
19 kSigned32, | |
20 kNumberOrOddball, | |
21 kString, | |
22 kAny | |
23 }; | |
24 | |
25 inline size_t hash_value(BinaryOperationHint hint) { | |
26 return static_cast<unsigned>(hint); | |
27 } | |
28 | |
29 std::ostream& operator<<(std::ostream&, BinaryOperationHint); | |
30 | |
31 // Type hints for an compare operation. | |
32 enum class CompareOperationHint : uint8_t { | |
33 kNone, | |
34 kSignedSmall, | |
35 kNumber, | |
36 kNumberOrOddball, | |
37 kAny | |
38 }; | |
39 | |
40 inline size_t hash_value(CompareOperationHint hint) { | |
41 return static_cast<unsigned>(hint); | |
42 } | |
43 | |
44 std::ostream& operator<<(std::ostream&, CompareOperationHint); | |
45 | |
46 // Type hints for the ToBoolean type conversion. | |
47 enum class ToBooleanHint : uint16_t { | |
48 kNone = 0u, | |
49 kUndefined = 1u << 0, | |
50 kBoolean = 1u << 1, | |
51 kNull = 1u << 2, | |
52 kSmallInteger = 1u << 3, | |
53 kReceiver = 1u << 4, | |
54 kString = 1u << 5, | |
55 kSymbol = 1u << 6, | |
56 kHeapNumber = 1u << 7, | |
57 kSimdValue = 1u << 8, | |
58 kAny = kUndefined | kBoolean | kNull | kSmallInteger | kReceiver | kString | | |
59 kSymbol | kHeapNumber | kSimdValue | |
60 }; | |
61 | |
62 std::ostream& operator<<(std::ostream&, ToBooleanHint); | |
63 | |
64 typedef base::Flags<ToBooleanHint, uint16_t> ToBooleanHints; | |
65 | |
66 std::ostream& operator<<(std::ostream&, ToBooleanHints); | |
67 | |
68 DEFINE_OPERATORS_FOR_FLAGS(ToBooleanHints) | |
69 | |
70 } // namespace compiler | |
71 } // namespace internal | |
72 } // namespace v8 | |
73 | |
74 #endif // V8_COMPILER_TYPE_HINTS_H_ | |
OLD | NEW |