| 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 HYDROGEN_TYPES_H_ | 5 #ifndef HYDROGEN_TYPES_H_ |
| 6 #define HYDROGEN_TYPES_H_ | 6 #define HYDROGEN_TYPES_H_ |
| 7 | 7 |
| 8 #include <climits> | 8 #include <climits> |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 | 10 |
| 11 #include "src/base/macros.h" | 11 #include "src/base/macros.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 // Forward declarations. | 16 // Forward declarations. |
| 17 template <typename T> class Handle; | 17 template <typename T> class Handle; |
| 18 class Object; | 18 class Object; |
| 19 | 19 |
| 20 #define HTYPE_LIST(V) \ | 20 #define HTYPE_LIST(V) \ |
| 21 V(Any, 0x0) /* 0000 0000 0000 0000 */ \ | 21 V(Any, 0x0) /* 0000 0000 0000 0000 */ \ |
| 22 V(Tagged, 0x1) /* 0000 0000 0000 0001 */ \ | 22 V(Tagged, 0x1) /* 0000 0000 0000 0001 */ \ |
| 23 V(TaggedPrimitive, 0x5) /* 0000 0000 0000 0101 */ \ | 23 V(TaggedPrimitive, 0x5) /* 0000 0000 0000 0101 */ \ |
| 24 V(TaggedNumber, 0xd) /* 0000 0000 0000 1101 */ \ | 24 V(TaggedNumber, 0xd) /* 0000 0000 0000 1101 */ \ |
| 25 V(Smi, 0x1d) /* 0000 0000 0001 1101 */ \ | 25 V(Smi, 0x1d) /* 0000 0000 0001 1101 */ \ |
| 26 V(HeapObject, 0x21) /* 0000 0000 0010 0001 */ \ | 26 V(HeapObject, 0x21) /* 0000 0000 0010 0001 */ \ |
| 27 V(HeapPrimitive, 0x25) /* 0000 0000 0010 0101 */ \ | 27 V(HeapPrimitive, 0x25) /* 0000 0000 0010 0101 */ \ |
| 28 V(Null, 0x27) /* 0000 0000 0010 0111 */ \ | 28 V(Null, 0x27) /* 0000 0000 0010 0111 */ \ |
| 29 V(HeapNumber, 0x2d) /* 0000 0000 0010 1101 */ \ | 29 V(HeapNumber, 0x2d) /* 0000 0000 0010 1101 */ \ |
| 30 V(String, 0x65) /* 0000 0000 0110 0101 */ \ | 30 V(String, 0x65) /* 0000 0000 0110 0101 */ \ |
| 31 V(Boolean, 0xa5) /* 0000 0000 1010 0101 */ \ | 31 V(Boolean, 0xa5) /* 0000 0000 1010 0101 */ \ |
| 32 V(Undefined, 0x125) /* 0000 0001 0010 0101 */ \ | 32 V(Undefined, 0x125) /* 0000 0001 0010 0101 */ \ |
| 33 V(JSObject, 0x221) /* 0000 0010 0010 0001 */ \ | 33 V(JSReceiver, 0x221) /* 0000 0010 0010 0001 */ \ |
| 34 V(JSArray, 0x621) /* 0000 0110 0010 0001 */ \ | 34 V(JSObject, 0x621) /* 0000 0110 0010 0001 */ \ |
| 35 V(None, 0x7ff) /* 0000 0111 1111 1111 */ | 35 V(JSArray, 0xe21) /* 0000 1110 0010 0001 */ \ |
| 36 V(None, 0xfff) /* 0000 1111 1111 1111 */ |
| 36 | 37 |
| 37 class HType FINAL { | 38 class HType FINAL { |
| 38 public: | 39 public: |
| 39 #define DECLARE_CONSTRUCTOR(Name, mask) \ | 40 #define DECLARE_CONSTRUCTOR(Name, mask) \ |
| 40 static HType Name() WARN_UNUSED_RESULT { return HType(k##Name); } | 41 static HType Name() WARN_UNUSED_RESULT { return HType(k##Name); } |
| 41 HTYPE_LIST(DECLARE_CONSTRUCTOR) | 42 HTYPE_LIST(DECLARE_CONSTRUCTOR) |
| 42 #undef DECLARE_CONSTRUCTOR | 43 #undef DECLARE_CONSTRUCTOR |
| 43 | 44 |
| 44 // Return the weakest (least precise) common type. | 45 // Return the weakest (least precise) common type. |
| 45 HType Combine(HType other) const WARN_UNUSED_RESULT { | 46 HType Combine(HType other) const WARN_UNUSED_RESULT { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 explicit HType(Kind kind) : kind_(kind) { } | 82 explicit HType(Kind kind) : kind_(kind) { } |
| 82 | 83 |
| 83 int16_t kind_; | 84 int16_t kind_; |
| 84 }; | 85 }; |
| 85 | 86 |
| 86 | 87 |
| 87 std::ostream& operator<<(std::ostream& os, const HType& t); | 88 std::ostream& operator<<(std::ostream& os, const HType& t); |
| 88 } } // namespace v8::internal | 89 } } // namespace v8::internal |
| 89 | 90 |
| 90 #endif // HYDROGEN_TYPES_H_ | 91 #endif // HYDROGEN_TYPES_H_ |
| OLD | NEW |