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