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/factory.h" | 8 #include "src/factory.h" |
9 #include "src/handles.h" | 9 #include "src/handles.h" |
10 #include "src/ostreams.h" | 10 #include "src/ostreams.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // over types. For example, constructors are injective, subtyping is a complete | 115 // over types. For example, constructors are injective, subtyping is a complete |
116 // partial order, union and intersection satisfy the usual algebraic properties. | 116 // partial order, union and intersection satisfy the usual algebraic properties. |
117 // | 117 // |
118 // See test/cctest/test-types.cc for a comprehensive executable specification, | 118 // See test/cctest/test-types.cc for a comprehensive executable specification, |
119 // especially with respect to the properties of the more exotic 'temporal' | 119 // especially with respect to the properties of the more exotic 'temporal' |
120 // constructors and predicates (those prefixed 'Now'). | 120 // constructors and predicates (those prefixed 'Now'). |
121 // | 121 // |
122 // IMPLEMENTATION | 122 // IMPLEMENTATION |
123 // | 123 // |
124 // Internally, all 'primitive' types, and their unions, are represented as | 124 // Internally, all 'primitive' types, and their unions, are represented as |
125 // bitsets. Class is a heap pointer to the respective map. Only Constant's, or | 125 // bitsets. Bit 0 is reserved for tagging. Class is a heap pointer to the |
126 // unions containing Class'es or Constant's, currently require allocation. | 126 // respective map. Only structured types require allocation. |
127 // Note that the bitset representation is closed under both Union and Intersect. | 127 // Note that the bitset representation is closed under both Union and Intersect. |
128 // | 128 // |
129 // There are two type representations, using different allocation: | 129 // There are two type representations, using different allocation: |
130 // | 130 // |
131 // - class Type (zone-allocated, for compiler and concurrent compilation) | 131 // - class Type (zone-allocated, for compiler and concurrent compilation) |
132 // - class HeapType (heap-allocated, for persistent types) | 132 // - class HeapType (heap-allocated, for persistent types) |
133 // | 133 // |
134 // Both provide the same API, and the Convert method can be used to interconvert | 134 // Both provide the same API, and the Convert method can be used to interconvert |
135 // them. For zone types, no query method touches the heap, only constructors do. | 135 // them. For zone types, no query method touches the heap, only constructors do. |
136 | 136 |
137 | 137 |
138 // ----------------------------------------------------------------------------- | 138 // ----------------------------------------------------------------------------- |
139 // Values for bitset types | 139 // Values for bitset types |
140 | 140 |
141 #define MASK_BITSET_TYPE_LIST(V) \ | 141 #define MASK_BITSET_TYPE_LIST(V) \ |
142 V(Representation, static_cast<int>(0xffc00000)) \ | 142 V(Representation, 0xff800000u) \ |
143 V(Semantic, static_cast<int>(0x003fffff)) | 143 V(Semantic, 0x007ffffeu) |
144 | 144 |
145 #define REPRESENTATION(k) ((k) & BitsetType::kRepresentation) | 145 #define REPRESENTATION(k) ((k) & BitsetType::kRepresentation) |
146 #define SEMANTIC(k) ((k) & BitsetType::kSemantic) | 146 #define SEMANTIC(k) ((k) & BitsetType::kSemantic) |
147 | 147 |
148 #define REPRESENTATION_BITSET_TYPE_LIST(V) \ | 148 #define REPRESENTATION_BITSET_TYPE_LIST(V) \ |
149 V(None, 0) \ | 149 V(None, 0) \ |
150 V(UntaggedInt1, 1 << 22 | kSemantic) \ | 150 V(UntaggedInt1, 1 << 23 | kSemantic) \ |
151 V(UntaggedInt8, 1 << 23 | kSemantic) \ | 151 V(UntaggedInt8, 1 << 24 | kSemantic) \ |
152 V(UntaggedInt16, 1 << 24 | kSemantic) \ | 152 V(UntaggedInt16, 1 << 25 | kSemantic) \ |
153 V(UntaggedInt32, 1 << 25 | kSemantic) \ | 153 V(UntaggedInt32, 1 << 26 | kSemantic) \ |
154 V(UntaggedFloat32, 1 << 26 | kSemantic) \ | 154 V(UntaggedFloat32, 1 << 27 | kSemantic) \ |
155 V(UntaggedFloat64, 1 << 27 | kSemantic) \ | 155 V(UntaggedFloat64, 1 << 28 | kSemantic) \ |
156 V(UntaggedPtr, 1 << 28 | kSemantic) \ | 156 V(UntaggedPtr, 1 << 29 | kSemantic) \ |
157 V(TaggedInt, 1 << 29 | kSemantic) \ | 157 V(TaggedInt, 1 << 30 | kSemantic) \ |
158 /* MSB has to be sign-extended */ \ | 158 V(TaggedPtr, 1 << 31 | kSemantic) \ |
159 V(TaggedPtr, static_cast<int>(~0u << 30) | kSemantic) \ | |
160 \ | 159 \ |
161 V(UntaggedInt, kUntaggedInt1 | kUntaggedInt8 | \ | 160 V(UntaggedInt, kUntaggedInt1 | kUntaggedInt8 | \ |
162 kUntaggedInt16 | kUntaggedInt32) \ | 161 kUntaggedInt16 | kUntaggedInt32) \ |
163 V(UntaggedFloat, kUntaggedFloat32 | kUntaggedFloat64) \ | 162 V(UntaggedFloat, kUntaggedFloat32 | kUntaggedFloat64) \ |
164 V(UntaggedNumber, kUntaggedInt | kUntaggedFloat) \ | 163 V(UntaggedNumber, kUntaggedInt | kUntaggedFloat) \ |
165 V(Untagged, kUntaggedNumber | kUntaggedPtr) \ | 164 V(Untagged, kUntaggedNumber | kUntaggedPtr) \ |
166 V(Tagged, kTaggedInt | kTaggedPtr) | 165 V(Tagged, kTaggedInt | kTaggedPtr) |
167 | 166 |
168 #define SEMANTIC_BITSET_TYPE_LIST(V) \ | 167 #define SEMANTIC_BITSET_TYPE_LIST(V) \ |
169 V(Null, 1 << 0 | REPRESENTATION(kTaggedPtr)) \ | 168 V(Null, 1 << 1 | REPRESENTATION(kTaggedPtr)) \ |
170 V(Undefined, 1 << 1 | REPRESENTATION(kTaggedPtr)) \ | 169 V(Undefined, 1 << 2 | REPRESENTATION(kTaggedPtr)) \ |
171 V(Boolean, 1 << 2 | REPRESENTATION(kTaggedPtr)) \ | 170 V(Boolean, 1 << 3 | REPRESENTATION(kTaggedPtr)) \ |
172 V(UnsignedSmall, 1 << 3 | REPRESENTATION(kTagged | kUntaggedNumber)) \ | 171 V(UnsignedSmall, 1 << 4 | REPRESENTATION(kTagged | kUntaggedNumber)) \ |
173 V(OtherSignedSmall, 1 << 4 | REPRESENTATION(kTagged | kUntaggedNumber)) \ | 172 V(OtherSignedSmall, 1 << 5 | REPRESENTATION(kTagged | kUntaggedNumber)) \ |
174 V(OtherUnsigned31, 1 << 5 | REPRESENTATION(kTagged | kUntaggedNumber)) \ | 173 V(OtherUnsigned31, 1 << 6 | REPRESENTATION(kTagged | kUntaggedNumber)) \ |
175 V(OtherUnsigned32, 1 << 6 | REPRESENTATION(kTagged | kUntaggedNumber)) \ | 174 V(OtherUnsigned32, 1 << 7 | REPRESENTATION(kTagged | kUntaggedNumber)) \ |
176 V(OtherSigned32, 1 << 7 | REPRESENTATION(kTagged | kUntaggedNumber)) \ | 175 V(OtherSigned32, 1 << 8 | REPRESENTATION(kTagged | kUntaggedNumber)) \ |
177 V(MinusZero, 1 << 8 | REPRESENTATION(kTagged | kUntaggedNumber)) \ | 176 V(MinusZero, 1 << 9 | REPRESENTATION(kTagged | kUntaggedNumber)) \ |
178 V(NaN, 1 << 9 | REPRESENTATION(kTagged | kUntaggedNumber)) \ | 177 V(NaN, 1 << 10 | REPRESENTATION(kTagged | kUntaggedNumber)) \ |
179 V(OtherNumber, 1 << 10 | REPRESENTATION(kTagged | kUntaggedNumber)) \ | 178 V(OtherNumber, 1 << 11 | REPRESENTATION(kTagged | kUntaggedNumber)) \ |
180 V(Symbol, 1 << 11 | REPRESENTATION(kTaggedPtr)) \ | 179 V(Symbol, 1 << 12 | REPRESENTATION(kTaggedPtr)) \ |
181 V(InternalizedString, 1 << 12 | REPRESENTATION(kTaggedPtr)) \ | 180 V(InternalizedString, 1 << 13 | REPRESENTATION(kTaggedPtr)) \ |
182 V(OtherString, 1 << 13 | REPRESENTATION(kTaggedPtr)) \ | 181 V(OtherString, 1 << 14 | REPRESENTATION(kTaggedPtr)) \ |
183 V(Undetectable, 1 << 14 | REPRESENTATION(kTaggedPtr)) \ | 182 V(Undetectable, 1 << 15 | REPRESENTATION(kTaggedPtr)) \ |
184 V(Array, 1 << 15 | REPRESENTATION(kTaggedPtr)) \ | 183 V(Array, 1 << 16 | REPRESENTATION(kTaggedPtr)) \ |
185 V(Buffer, 1 << 16 | REPRESENTATION(kTaggedPtr)) \ | 184 V(Buffer, 1 << 17 | REPRESENTATION(kTaggedPtr)) \ |
186 V(Function, 1 << 17 | REPRESENTATION(kTaggedPtr)) \ | 185 V(Function, 1 << 18 | REPRESENTATION(kTaggedPtr)) \ |
187 V(RegExp, 1 << 18 | REPRESENTATION(kTaggedPtr)) \ | 186 V(RegExp, 1 << 19 | REPRESENTATION(kTaggedPtr)) \ |
188 V(OtherObject, 1 << 19 | REPRESENTATION(kTaggedPtr)) \ | 187 V(OtherObject, 1 << 20 | REPRESENTATION(kTaggedPtr)) \ |
189 V(Proxy, 1 << 20 | REPRESENTATION(kTaggedPtr)) \ | 188 V(Proxy, 1 << 21 | REPRESENTATION(kTaggedPtr)) \ |
190 V(Internal, 1 << 21 | REPRESENTATION(kTagged | kUntagged)) \ | 189 V(Internal, 1 << 22 | REPRESENTATION(kTagged | kUntagged)) \ |
191 \ | 190 \ |
192 V(SignedSmall, kUnsignedSmall | kOtherSignedSmall) \ | 191 V(SignedSmall, kUnsignedSmall | kOtherSignedSmall) \ |
193 V(Signed32, kSignedSmall | kOtherUnsigned31 | kOtherSigned32) \ | 192 V(Signed32, kSignedSmall | kOtherUnsigned31 | kOtherSigned32) \ |
194 V(Unsigned32, kUnsignedSmall | kOtherUnsigned31 | kOtherUnsigned32) \ | 193 V(Unsigned32, kUnsignedSmall | kOtherUnsigned31 | kOtherUnsigned32) \ |
195 V(Integral32, kSigned32 | kUnsigned32) \ | 194 V(Integral32, kSigned32 | kUnsigned32) \ |
196 V(Number, kIntegral32 | kMinusZero | kNaN | kOtherNumber) \ | 195 V(Number, kIntegral32 | kMinusZero | kNaN | kOtherNumber) \ |
197 V(String, kInternalizedString | kOtherString) \ | 196 V(String, kInternalizedString | kOtherString) \ |
198 V(UniqueName, kSymbol | kInternalizedString) \ | 197 V(UniqueName, kSymbol | kInternalizedString) \ |
199 V(Name, kSymbol | kString) \ | 198 V(Name, kSymbol | kString) \ |
200 V(NumberOrString, kNumber | kString) \ | 199 V(NumberOrString, kNumber | kString) \ |
201 V(Primitive, kNumber | kName | kBoolean | kNull | kUndefined) \ | 200 V(Primitive, kNumber | kName | kBoolean | kNull | kUndefined) \ |
202 V(DetectableObject, kArray | kFunction | kRegExp | kOtherObject) \ | 201 V(DetectableObject, kArray | kFunction | kRegExp | kOtherObject) \ |
203 V(DetectableReceiver, kDetectableObject | kProxy) \ | 202 V(DetectableReceiver, kDetectableObject | kProxy) \ |
204 V(Detectable, kDetectableReceiver | kNumber | kName) \ | 203 V(Detectable, kDetectableReceiver | kNumber | kName) \ |
205 V(Object, kDetectableObject | kUndetectable) \ | 204 V(Object, kDetectableObject | kUndetectable) \ |
206 V(Receiver, kObject | kProxy) \ | 205 V(Receiver, kObject | kProxy) \ |
207 V(NonNumber, kBoolean | kName | kNull | kReceiver | \ | 206 V(NonNumber, kBoolean | kName | kNull | kReceiver | \ |
208 kUndefined | kInternal) \ | 207 kUndefined | kInternal) \ |
209 V(Any, -1) | 208 V(Any, 0xfffffffeu) |
210 | 209 |
211 #define BITSET_TYPE_LIST(V) \ | 210 #define BITSET_TYPE_LIST(V) \ |
212 MASK_BITSET_TYPE_LIST(V) \ | 211 MASK_BITSET_TYPE_LIST(V) \ |
213 REPRESENTATION_BITSET_TYPE_LIST(V) \ | 212 REPRESENTATION_BITSET_TYPE_LIST(V) \ |
214 SEMANTIC_BITSET_TYPE_LIST(V) | 213 SEMANTIC_BITSET_TYPE_LIST(V) |
215 | 214 |
216 | 215 |
217 // ----------------------------------------------------------------------------- | 216 // ----------------------------------------------------------------------------- |
218 // The abstract Type class, parameterized over the low-level representation. | 217 // The abstract Type class, parameterized over the low-level representation. |
219 | 218 |
220 // struct Config { | 219 // struct Config { |
221 // typedef TypeImpl<Config> Type; | 220 // typedef TypeImpl<Config> Type; |
222 // typedef Base; | 221 // typedef Base; |
223 // typedef Struct; | 222 // typedef Struct; |
224 // typedef Region; | 223 // typedef Region; |
225 // template<class> struct Handle { typedef type; } // No template typedefs... | 224 // template<class> struct Handle { typedef type; } // No template typedefs... |
226 // template<class T> static Handle<T>::type handle(T* t); // !is_bitset(t) | 225 // template<class T> static Handle<T>::type handle(T* t); // !is_bitset(t) |
227 // template<class T> static Handle<T>::type cast(Handle<Type>::type); | 226 // template<class T> static Handle<T>::type cast(Handle<Type>::type); |
228 // static bool is_bitset(Type*); | 227 // static bool is_bitset(Type*); |
229 // static bool is_class(Type*); | 228 // static bool is_class(Type*); |
230 // static bool is_struct(Type*, int tag); | 229 // static bool is_struct(Type*, int tag); |
231 // static int as_bitset(Type*); | 230 // static bitset as_bitset(Type*); |
232 // static i::Handle<i::Map> as_class(Type*); | 231 // static i::Handle<i::Map> as_class(Type*); |
233 // static Handle<Struct>::type as_struct(Type*); | 232 // static Handle<Struct>::type as_struct(Type*); |
234 // static Type* from_bitset(int bitset); | 233 // static Type* from_bitset(bitset); |
235 // static Handle<Type>::type from_bitset(int bitset, Region*); | 234 // static Handle<Type>::type from_bitset(bitset, Region*); |
236 // static Handle<Type>::type from_class(i::Handle<Map>, Region*); | 235 // static Handle<Type>::type from_class(i::Handle<Map>, Region*); |
237 // static Handle<Type>::type from_struct(Handle<Struct>::type, int tag); | 236 // static Handle<Type>::type from_struct(Handle<Struct>::type, int tag); |
238 // static Handle<Struct>::type struct_create(int tag, int length, Region*); | 237 // static Handle<Struct>::type struct_create(int tag, int length, Region*); |
239 // static void struct_shrink(Handle<Struct>::type, int length); | 238 // static void struct_shrink(Handle<Struct>::type, int length); |
240 // static int struct_tag(Handle<Struct>::type); | 239 // static int struct_tag(Handle<Struct>::type); |
241 // static int struct_length(Handle<Struct>::type); | 240 // static int struct_length(Handle<Struct>::type); |
242 // static Handle<Type>::type struct_get(Handle<Struct>::type, int); | 241 // static Handle<Type>::type struct_get(Handle<Struct>::type, int); |
243 // static void struct_set(Handle<Struct>::type, int, Handle<Type>::type); | 242 // static void struct_set(Handle<Struct>::type, int, Handle<Type>::type); |
244 // template<class V> | 243 // template<class V> |
245 // static i::Handle<V> struct_get_value(Handle<Struct>::type, int); | 244 // static i::Handle<V> struct_get_value(Handle<Struct>::type, int); |
246 // template<class V> | 245 // template<class V> |
247 // static void struct_set_value(Handle<Struct>::type, int, i::Handle<V>); | 246 // static void struct_set_value(Handle<Struct>::type, int, i::Handle<V>); |
248 // } | 247 // } |
249 template<class Config> | 248 template<class Config> |
250 class TypeImpl : public Config::Base { | 249 class TypeImpl : public Config::Base { |
251 public: | 250 public: |
252 // Auxiliary types. | 251 // Auxiliary types. |
253 | 252 |
254 class BitsetType; // Internal | 253 typedef uintptr_t bitset; // Internal |
255 class StructuralType; // Internal | 254 class BitsetType; // Internal |
256 class UnionType; // Internal | 255 class StructuralType; // Internal |
| 256 class UnionType; // Internal |
257 | 257 |
258 class ClassType; | 258 class ClassType; |
259 class ConstantType; | 259 class ConstantType; |
260 class RangeType; | 260 class RangeType; |
261 class ContextType; | 261 class ContextType; |
262 class ArrayType; | 262 class ArrayType; |
263 class FunctionType; | 263 class FunctionType; |
264 | 264 |
265 typedef typename Config::template Handle<TypeImpl>::type TypeHandle; | 265 typedef typename Config::template Handle<TypeImpl>::type TypeHandle; |
266 typedef typename Config::template Handle<ClassType>::type ClassHandle; | 266 typedef typename Config::template Handle<ClassType>::type ClassHandle; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 } | 449 } |
450 TypeImpl* unhandle() { return this; } | 450 TypeImpl* unhandle() { return this; } |
451 | 451 |
452 // Internal inspection. | 452 // Internal inspection. |
453 | 453 |
454 bool IsNone() { return this == None(); } | 454 bool IsNone() { return this == None(); } |
455 bool IsAny() { return this == Any(); } | 455 bool IsAny() { return this == Any(); } |
456 bool IsBitset() { return Config::is_bitset(this); } | 456 bool IsBitset() { return Config::is_bitset(this); } |
457 bool IsUnion() { return Config::is_struct(this, StructuralType::kUnionTag); } | 457 bool IsUnion() { return Config::is_struct(this, StructuralType::kUnionTag); } |
458 | 458 |
459 int AsBitset() { | 459 bitset AsBitset() { |
460 DCHECK(this->IsBitset()); | 460 DCHECK(this->IsBitset()); |
461 return static_cast<BitsetType*>(this)->Bitset(); | 461 return static_cast<BitsetType*>(this)->Bitset(); |
462 } | 462 } |
463 UnionType* AsUnion() { return UnionType::cast(this); } | 463 UnionType* AsUnion() { return UnionType::cast(this); } |
464 | 464 |
465 // Auxiliary functions. | 465 // Auxiliary functions. |
466 | 466 |
467 int BitsetGlb() { return BitsetType::Glb(this); } | 467 bitset BitsetGlb() { return BitsetType::Glb(this); } |
468 int BitsetLub() { return BitsetType::Lub(this); } | 468 bitset BitsetLub() { return BitsetType::Lub(this); } |
469 int InherentBitsetLub() { return BitsetType::InherentLub(this); } | 469 bitset InherentBitsetLub() { return BitsetType::InherentLub(this); } |
470 | 470 |
471 bool SlowIs(TypeImpl* that); | 471 bool SlowIs(TypeImpl* that); |
472 | 472 |
473 TypeHandle Rebound(int bitset, Region* region); | 473 TypeHandle Rebound(bitset bound, Region* region); |
474 int BoundBy(TypeImpl* that); | 474 bitset BoundBy(TypeImpl* that); |
475 int IndexInUnion(int bound, UnionHandle unioned, int current_size); | 475 int IndexInUnion(bitset bound, UnionHandle unioned, int current_size); |
476 static int ExtendUnion( | 476 static int ExtendUnion( |
477 UnionHandle unioned, int current_size, TypeHandle t, | 477 UnionHandle unioned, int current_size, TypeHandle t, |
478 TypeHandle other, bool is_intersect, Region* region); | 478 TypeHandle other, bool is_intersect, Region* region); |
479 }; | 479 }; |
480 | 480 |
481 | 481 |
482 // ----------------------------------------------------------------------------- | 482 // ----------------------------------------------------------------------------- |
483 // Bitset types (internal). | 483 // Bitset types (internal). |
484 | 484 |
485 template<class Config> | 485 template<class Config> |
486 class TypeImpl<Config>::BitsetType : public TypeImpl<Config> { | 486 class TypeImpl<Config>::BitsetType : public TypeImpl<Config> { |
487 protected: | 487 protected: |
488 friend class TypeImpl<Config>; | 488 friend class TypeImpl<Config>; |
489 | 489 |
490 enum { | 490 enum { |
491 #define DECLARE_TYPE(type, value) k##type = (value), | 491 #define DECLARE_TYPE(type, value) k##type = (value), |
492 BITSET_TYPE_LIST(DECLARE_TYPE) | 492 BITSET_TYPE_LIST(DECLARE_TYPE) |
493 #undef DECLARE_TYPE | 493 #undef DECLARE_TYPE |
494 kUnusedEOL = 0 | 494 kUnusedEOL = 0 |
495 }; | 495 }; |
496 | 496 |
497 int Bitset() { return Config::as_bitset(this); } | 497 bitset Bitset() { return Config::as_bitset(this); } |
498 | 498 |
499 static TypeImpl* New(int bitset) { | 499 static TypeImpl* New(bitset bits) { |
500 return static_cast<BitsetType*>(Config::from_bitset(bitset)); | 500 return static_cast<BitsetType*>(Config::from_bitset(bits)); |
501 } | 501 } |
502 static TypeHandle New(int bitset, Region* region) { | 502 static TypeHandle New(bitset bits, Region* region) { |
503 return Config::from_bitset(bitset, region); | 503 return Config::from_bitset(bits, region); |
504 } | 504 } |
505 | 505 |
506 static bool IsInhabited(int bitset) { | 506 static bool IsInhabited(bitset bits) { |
507 return (bitset & kRepresentation) && (bitset & kSemantic); | 507 return (bits & kRepresentation) && (bits & kSemantic); |
508 } | 508 } |
509 | 509 |
510 static bool Is(int bitset1, int bitset2) { | 510 static bool Is(bitset bits1, bitset bits2) { |
511 return (bitset1 | bitset2) == bitset2; | 511 return (bits1 | bits2) == bits2; |
512 } | 512 } |
513 | 513 |
514 static int Glb(TypeImpl* type); // greatest lower bound that's a bitset | 514 static bitset Glb(TypeImpl* type); // greatest lower bound that's a bitset |
515 static int Lub(TypeImpl* type); // least upper bound that's a bitset | 515 static bitset Lub(TypeImpl* type); // least upper bound that's a bitset |
516 static int Lub(i::Object* value); | 516 static bitset Lub(i::Object* value); |
517 static int Lub(double value); | 517 static bitset Lub(double value); |
518 static int Lub(int32_t value); | 518 static bitset Lub(int32_t value); |
519 static int Lub(uint32_t value); | 519 static bitset Lub(uint32_t value); |
520 static int Lub(i::Map* map); | 520 static bitset Lub(i::Map* map); |
521 static int Lub(double min, double max); | 521 static bitset Lub(double min, double max); |
522 static int InherentLub(TypeImpl* type); | 522 static bitset InherentLub(TypeImpl* type); |
523 | 523 |
524 static const char* Name(int bitset); | 524 static const char* Name(bitset); |
525 static void Print(OStream& os, int bitset); // NOLINT | 525 static void Print(OStream& os, bitset); // NOLINT |
526 using TypeImpl::PrintTo; | 526 using TypeImpl::PrintTo; |
527 }; | 527 }; |
528 | 528 |
529 | 529 |
530 // ----------------------------------------------------------------------------- | 530 // ----------------------------------------------------------------------------- |
531 // Superclass for non-bitset types (internal). | 531 // Superclass for non-bitset types (internal). |
532 // Contains a tag and a variable number of type or value fields. | 532 // Contains a tag and a variable number of type or value fields. |
533 | 533 |
534 template<class Config> | 534 template<class Config> |
535 class TypeImpl<Config>::StructuralType : public TypeImpl<Config> { | 535 class TypeImpl<Config>::StructuralType : public TypeImpl<Config> { |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 return region->isolate(); | 858 return region->isolate(); |
859 } | 859 } |
860 | 860 |
861 template<class T> static inline T* handle(T* type); | 861 template<class T> static inline T* handle(T* type); |
862 template<class T> static inline T* cast(Type* type); | 862 template<class T> static inline T* cast(Type* type); |
863 | 863 |
864 static inline bool is_bitset(Type* type); | 864 static inline bool is_bitset(Type* type); |
865 static inline bool is_class(Type* type); | 865 static inline bool is_class(Type* type); |
866 static inline bool is_struct(Type* type, int tag); | 866 static inline bool is_struct(Type* type, int tag); |
867 | 867 |
868 static inline int as_bitset(Type* type); | 868 static inline Type::bitset as_bitset(Type* type); |
869 static inline i::Handle<i::Map> as_class(Type* type); | 869 static inline i::Handle<i::Map> as_class(Type* type); |
870 static inline Struct* as_struct(Type* type); | 870 static inline Struct* as_struct(Type* type); |
871 | 871 |
872 static inline Type* from_bitset(int bitset); | 872 static inline Type* from_bitset(Type::bitset); |
873 static inline Type* from_bitset(int bitset, Zone* zone); | 873 static inline Type* from_bitset(Type::bitset, Zone* zone); |
874 static inline Type* from_class(i::Handle<i::Map> map, Zone* zone); | 874 static inline Type* from_class(i::Handle<i::Map> map, Zone* zone); |
875 static inline Type* from_struct(Struct* structured); | 875 static inline Type* from_struct(Struct* structured); |
876 | 876 |
877 static inline Struct* struct_create(int tag, int length, Zone* zone); | 877 static inline Struct* struct_create(int tag, int length, Zone* zone); |
878 static inline void struct_shrink(Struct* structure, int length); | 878 static inline void struct_shrink(Struct* structure, int length); |
879 static inline int struct_tag(Struct* structure); | 879 static inline int struct_tag(Struct* structure); |
880 static inline int struct_length(Struct* structure); | 880 static inline int struct_length(Struct* structure); |
881 static inline Type* struct_get(Struct* structure, int i); | 881 static inline Type* struct_get(Struct* structure, int i); |
882 static inline void struct_set(Struct* structure, int i, Type* type); | 882 static inline void struct_set(Struct* structure, int i, Type* type); |
883 template<class V> | 883 template<class V> |
(...skipping 21 matching lines...) Expand all Loading... |
905 return region; | 905 return region; |
906 } | 906 } |
907 | 907 |
908 template<class T> static inline i::Handle<T> handle(T* type); | 908 template<class T> static inline i::Handle<T> handle(T* type); |
909 template<class T> static inline i::Handle<T> cast(i::Handle<Type> type); | 909 template<class T> static inline i::Handle<T> cast(i::Handle<Type> type); |
910 | 910 |
911 static inline bool is_bitset(Type* type); | 911 static inline bool is_bitset(Type* type); |
912 static inline bool is_class(Type* type); | 912 static inline bool is_class(Type* type); |
913 static inline bool is_struct(Type* type, int tag); | 913 static inline bool is_struct(Type* type, int tag); |
914 | 914 |
915 static inline int as_bitset(Type* type); | 915 static inline Type::bitset as_bitset(Type* type); |
916 static inline i::Handle<i::Map> as_class(Type* type); | 916 static inline i::Handle<i::Map> as_class(Type* type); |
917 static inline i::Handle<Struct> as_struct(Type* type); | 917 static inline i::Handle<Struct> as_struct(Type* type); |
918 | 918 |
919 static inline Type* from_bitset(int bitset); | 919 static inline Type* from_bitset(Type::bitset); |
920 static inline i::Handle<Type> from_bitset(int bitset, Isolate* isolate); | 920 static inline i::Handle<Type> from_bitset(Type::bitset, Isolate* isolate); |
921 static inline i::Handle<Type> from_class( | 921 static inline i::Handle<Type> from_class( |
922 i::Handle<i::Map> map, Isolate* isolate); | 922 i::Handle<i::Map> map, Isolate* isolate); |
923 static inline i::Handle<Type> from_struct(i::Handle<Struct> structure); | 923 static inline i::Handle<Type> from_struct(i::Handle<Struct> structure); |
924 | 924 |
925 static inline i::Handle<Struct> struct_create( | 925 static inline i::Handle<Struct> struct_create( |
926 int tag, int length, Isolate* isolate); | 926 int tag, int length, Isolate* isolate); |
927 static inline void struct_shrink(i::Handle<Struct> structure, int length); | 927 static inline void struct_shrink(i::Handle<Struct> structure, int length); |
928 static inline int struct_tag(i::Handle<Struct> structure); | 928 static inline int struct_tag(i::Handle<Struct> structure); |
929 static inline int struct_length(i::Handle<Struct> structure); | 929 static inline int struct_length(i::Handle<Struct> structure); |
930 static inline i::Handle<Type> struct_get(i::Handle<Struct> structure, int i); | 930 static inline i::Handle<Type> struct_get(i::Handle<Struct> structure, int i); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 bool Narrows(BoundsImpl that) { | 995 bool Narrows(BoundsImpl that) { |
996 return that.lower->Is(this->lower) && this->upper->Is(that.upper); | 996 return that.lower->Is(this->lower) && this->upper->Is(that.upper); |
997 } | 997 } |
998 }; | 998 }; |
999 | 999 |
1000 typedef BoundsImpl<ZoneTypeConfig> Bounds; | 1000 typedef BoundsImpl<ZoneTypeConfig> Bounds; |
1001 | 1001 |
1002 } } // namespace v8::internal | 1002 } } // namespace v8::internal |
1003 | 1003 |
1004 #endif // V8_TYPES_H_ | 1004 #endif // V8_TYPES_H_ |
OLD | NEW |