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_TYPES_H_ | 5 #ifndef V8_TYPES_H_ |
6 #define V8_TYPES_H_ | 6 #define V8_TYPES_H_ |
7 | 7 |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/factory.h" | |
10 #include "src/handles.h" | 9 #include "src/handles.h" |
| 10 #include "src/objects.h" |
11 #include "src/ostreams.h" | 11 #include "src/ostreams.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 // SUMMARY | 16 // SUMMARY |
17 // | 17 // |
18 // A simple type system for compiler-internal use. It is based entirely on | 18 // A simple type system for compiler-internal use. It is based entirely on |
19 // union types, and all subtyping hence amounts to set inclusion. Besides the | 19 // union types, and all subtyping hence amounts to set inclusion. Besides the |
20 // obvious primitive types and some predefined unions, the type language also | 20 // obvious primitive types and some predefined unions, the type language also |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 struct Range { | 996 struct Range { |
997 void* tag; | 997 void* tag; |
998 int bitset; | 998 int bitset; |
999 double limits[2]; | 999 double limits[2]; |
1000 }; | 1000 }; |
1001 typedef i::Zone Region; | 1001 typedef i::Zone Region; |
1002 template<class T> struct Handle { typedef T* type; }; | 1002 template<class T> struct Handle { typedef T* type; }; |
1003 | 1003 |
1004 static const int kRangeStructTag = 0x1000; | 1004 static const int kRangeStructTag = 0x1000; |
1005 | 1005 |
1006 template<class T> static inline T* null_handle(); | 1006 template<class T> static inline T* null_handle() { return nullptr; } |
1007 template<class T> static inline T* handle(T* type); | 1007 template<class T> static inline T* handle(T* type); |
1008 template<class T> static inline T* cast(Type* type); | 1008 template<class T> static inline T* cast(Type* type); |
1009 | 1009 |
1010 static inline bool is_bitset(Type* type); | 1010 static inline bool is_bitset(Type* type); |
1011 static inline bool is_class(Type* type); | 1011 static inline bool is_class(Type* type); |
1012 static inline bool is_struct(Type* type, int tag); | 1012 static inline bool is_struct(Type* type, int tag); |
1013 static inline bool is_range(Type* type); | 1013 static inline bool is_range(Type* type); |
1014 | 1014 |
1015 static inline Type::bitset as_bitset(Type* type); | 1015 static inline Type::bitset as_bitset(Type* type); |
1016 static inline i::Handle<i::Map> as_class(Type* type); | 1016 static inline i::Handle<i::Map> as_class(Type* type); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 struct HeapTypeConfig { | 1051 struct HeapTypeConfig { |
1052 typedef TypeImpl<HeapTypeConfig> Type; | 1052 typedef TypeImpl<HeapTypeConfig> Type; |
1053 typedef i::Object Base; | 1053 typedef i::Object Base; |
1054 typedef i::FixedArray Struct; | 1054 typedef i::FixedArray Struct; |
1055 typedef i::FixedArray Range; | 1055 typedef i::FixedArray Range; |
1056 typedef i::Isolate Region; | 1056 typedef i::Isolate Region; |
1057 template<class T> struct Handle { typedef i::Handle<T> type; }; | 1057 template<class T> struct Handle { typedef i::Handle<T> type; }; |
1058 | 1058 |
1059 static const int kRangeStructTag = 0xffff; | 1059 static const int kRangeStructTag = 0xffff; |
1060 | 1060 |
1061 template<class T> static inline i::Handle<T> null_handle(); | 1061 template<class T> static inline i::Handle<T> null_handle() { |
| 1062 return i::Handle<T>(); |
| 1063 } |
1062 template<class T> static inline i::Handle<T> handle(T* type); | 1064 template<class T> static inline i::Handle<T> handle(T* type); |
1063 template<class T> static inline i::Handle<T> cast(i::Handle<Type> type); | 1065 template<class T> static inline i::Handle<T> cast(i::Handle<Type> type); |
1064 | 1066 |
1065 static inline bool is_bitset(Type* type); | 1067 static inline bool is_bitset(Type* type); |
1066 static inline bool is_class(Type* type); | 1068 static inline bool is_class(Type* type); |
1067 static inline bool is_struct(Type* type, int tag); | 1069 static inline bool is_struct(Type* type, int tag); |
1068 static inline bool is_range(Type* type); | 1070 static inline bool is_range(Type* type); |
1069 | 1071 |
1070 static inline Type::bitset as_bitset(Type* type); | 1072 static inline Type::bitset as_bitset(Type* type); |
1071 static inline i::Handle<i::Map> as_class(Type* type); | 1073 static inline i::Handle<i::Map> as_class(Type* type); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 bool Narrows(BoundsImpl that) { | 1165 bool Narrows(BoundsImpl that) { |
1164 return that.lower->Is(this->lower) && this->upper->Is(that.upper); | 1166 return that.lower->Is(this->lower) && this->upper->Is(that.upper); |
1165 } | 1167 } |
1166 }; | 1168 }; |
1167 | 1169 |
1168 typedef BoundsImpl<ZoneTypeConfig> Bounds; | 1170 typedef BoundsImpl<ZoneTypeConfig> Bounds; |
1169 | 1171 |
1170 } } // namespace v8::internal | 1172 } } // namespace v8::internal |
1171 | 1173 |
1172 #endif // V8_TYPES_H_ | 1174 #endif // V8_TYPES_H_ |
OLD | NEW |