OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 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 | 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_TYPE_HINTS_H_ | 5 #ifndef V8_COMPILER_TYPE_HINTS_H_ |
6 #define V8_COMPILER_TYPE_HINTS_H_ | 6 #define V8_COMPILER_TYPE_HINTS_H_ |
7 | 7 |
| 8 #include "src/base/flags.h" |
8 #include "src/utils.h" | 9 #include "src/utils.h" |
9 | 10 |
10 namespace v8 { | 11 namespace v8 { |
11 namespace internal { | 12 namespace internal { |
12 namespace compiler { | 13 namespace compiler { |
13 | 14 |
14 // Type hints for an binary operation. | 15 // Type hints for an binary operation. |
15 class BinaryOperationHints final { | 16 class BinaryOperationHints final { |
16 public: | 17 public: |
17 enum Hint { kNone, kSignedSmall, kSigned32, kNumber, kString, kAny }; | 18 enum Hint { kNone, kSignedSmall, kSigned32, kNumber, kString, kAny }; |
(...skipping 26 matching lines...) Expand all Loading... |
44 typedef BitField<Hint, 0, 3> LeftField; | 45 typedef BitField<Hint, 0, 3> LeftField; |
45 typedef BitField<Hint, 3, 3> RightField; | 46 typedef BitField<Hint, 3, 3> RightField; |
46 typedef BitField<Hint, 6, 3> ResultField; | 47 typedef BitField<Hint, 6, 3> ResultField; |
47 | 48 |
48 uint32_t bit_field_; | 49 uint32_t bit_field_; |
49 }; | 50 }; |
50 | 51 |
51 std::ostream& operator<<(std::ostream&, BinaryOperationHints::Hint); | 52 std::ostream& operator<<(std::ostream&, BinaryOperationHints::Hint); |
52 std::ostream& operator<<(std::ostream&, BinaryOperationHints); | 53 std::ostream& operator<<(std::ostream&, BinaryOperationHints); |
53 | 54 |
| 55 |
| 56 // Type hints for the ToBoolean type conversion. |
| 57 enum class ToBooleanHint : uint16_t { |
| 58 kNone = 0u, |
| 59 kUndefined = 1u << 0, |
| 60 kBoolean = 1u << 1, |
| 61 kNull = 1u << 2, |
| 62 kSmallInteger = 1u << 3, |
| 63 kReceiver = 1u << 4, |
| 64 kString = 1u << 5, |
| 65 kSymbol = 1u << 6, |
| 66 kHeapNumber = 1u << 7, |
| 67 kSimdValue = 1u << 8, |
| 68 kAny = kUndefined | kBoolean | kNull | kSmallInteger | kReceiver | kString | |
| 69 kSymbol | kHeapNumber | kSimdValue |
| 70 }; |
| 71 |
| 72 std::ostream& operator<<(std::ostream&, ToBooleanHint); |
| 73 |
| 74 typedef base::Flags<ToBooleanHint, uint16_t> ToBooleanHints; |
| 75 |
| 76 std::ostream& operator<<(std::ostream&, ToBooleanHints); |
| 77 |
| 78 DEFINE_OPERATORS_FOR_FLAGS(ToBooleanHints) |
| 79 |
54 } // namespace compiler | 80 } // namespace compiler |
55 } // namespace internal | 81 } // namespace internal |
56 } // namespace v8 | 82 } // namespace v8 |
57 | 83 |
58 #endif // V8_COMPILER_TYPE_HINTS_H_ | 84 #endif // V8_COMPILER_TYPE_HINTS_H_ |
OLD | NEW |