| 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_CRANKSHAFT_HYDROGEN_TYPES_H_ | 5 #ifndef V8_CRANKSHAFT_HYDROGEN_TYPES_H_ |
| 6 #define V8_CRANKSHAFT_HYDROGEN_TYPES_H_ | 6 #define V8_CRANKSHAFT_HYDROGEN_TYPES_H_ |
| 7 | 7 |
| 8 #include <climits> | 8 #include <climits> |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 | 10 |
| 11 #include "src/ast/ast-types.h" |
| 11 #include "src/base/macros.h" | 12 #include "src/base/macros.h" |
| 12 #include "src/types.h" | |
| 13 | 13 |
| 14 namespace v8 { | 14 namespace v8 { |
| 15 namespace internal { | 15 namespace internal { |
| 16 | 16 |
| 17 // Forward declarations. | 17 // Forward declarations. |
| 18 template <typename T> class Handle; | 18 template <typename T> class Handle; |
| 19 class FieldType; | 19 class FieldType; |
| 20 class Object; | 20 class Object; |
| 21 | 21 |
| 22 #define HTYPE_LIST(V) \ | 22 #define HTYPE_LIST(V) \ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 return Combine(other).Equals(other); | 57 return Combine(other).Equals(other); |
| 58 } | 58 } |
| 59 | 59 |
| 60 #define DECLARE_IS_TYPE(Name, mask) \ | 60 #define DECLARE_IS_TYPE(Name, mask) \ |
| 61 bool Is##Name() const WARN_UNUSED_RESULT { \ | 61 bool Is##Name() const WARN_UNUSED_RESULT { \ |
| 62 return IsSubtypeOf(HType::Name()); \ | 62 return IsSubtypeOf(HType::Name()); \ |
| 63 } | 63 } |
| 64 HTYPE_LIST(DECLARE_IS_TYPE) | 64 HTYPE_LIST(DECLARE_IS_TYPE) |
| 65 #undef DECLARE_IS_TYPE | 65 #undef DECLARE_IS_TYPE |
| 66 | 66 |
| 67 static HType FromType(Type* type) WARN_UNUSED_RESULT; | 67 static HType FromType(AstType* type) WARN_UNUSED_RESULT; |
| 68 static HType FromFieldType(Handle<FieldType> type, | 68 static HType FromFieldType(Handle<FieldType> type, |
| 69 Zone* temp_zone) WARN_UNUSED_RESULT; | 69 Zone* temp_zone) WARN_UNUSED_RESULT; |
| 70 static HType FromValue(Handle<Object> value) WARN_UNUSED_RESULT; | 70 static HType FromValue(Handle<Object> value) WARN_UNUSED_RESULT; |
| 71 | 71 |
| 72 friend std::ostream& operator<<(std::ostream& os, const HType& t); | 72 friend std::ostream& operator<<(std::ostream& os, const HType& t); |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 enum Kind { | 75 enum Kind { |
| 76 #define DECLARE_TYPE(Name, mask) k##Name = mask, | 76 #define DECLARE_TYPE(Name, mask) k##Name = mask, |
| 77 HTYPE_LIST(DECLARE_TYPE) | 77 HTYPE_LIST(DECLARE_TYPE) |
| 78 #undef DECLARE_TYPE | 78 #undef DECLARE_TYPE |
| 79 LAST_KIND = kNone | 79 LAST_KIND = kNone |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 // Make sure type fits in int16. | 82 // Make sure type fits in int16. |
| 83 STATIC_ASSERT(LAST_KIND < (1 << (CHAR_BIT * sizeof(int16_t)))); | 83 STATIC_ASSERT(LAST_KIND < (1 << (CHAR_BIT * sizeof(int16_t)))); |
| 84 | 84 |
| 85 explicit HType(Kind kind) : kind_(kind) { } | 85 explicit HType(Kind kind) : kind_(kind) { } |
| 86 | 86 |
| 87 int16_t kind_; | 87 int16_t kind_; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 | 90 |
| 91 std::ostream& operator<<(std::ostream& os, const HType& t); | 91 std::ostream& operator<<(std::ostream& os, const HType& t); |
| 92 } // namespace internal | 92 } // namespace internal |
| 93 } // namespace v8 | 93 } // namespace v8 |
| 94 | 94 |
| 95 #endif // V8_CRANKSHAFT_HYDROGEN_TYPES_H_ | 95 #endif // V8_CRANKSHAFT_HYDROGEN_TYPES_H_ |
| OLD | NEW |