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_COMPILER_TYPES_H_ |
6 #define V8_TYPES_H_ | 6 #define V8_COMPILER_TYPES_H_ |
7 | 7 |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/handles.h" | 9 #include "src/handles.h" |
10 #include "src/objects.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 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 * -2^31 -2^30 0 2^30 2^31 2^32 | 235 * -2^31 -2^30 0 2^30 2^31 2^32 |
236 * | 236 * |
237 * E.g., OtherUnsigned32 (OU32) covers all integers from 2^31 to 2^32-1. | 237 * E.g., OtherUnsigned32 (OU32) covers all integers from 2^31 to 2^32-1. |
238 * | 238 * |
239 * Some of the atomic numerical bitsets are internal only (see | 239 * Some of the atomic numerical bitsets are internal only (see |
240 * INTERNAL_BITSET_TYPE_LIST). To a types user, they should only occur in | 240 * INTERNAL_BITSET_TYPE_LIST). To a types user, they should only occur in |
241 * union with certain other bitsets. For instance, OtherNumber should only | 241 * union with certain other bitsets. For instance, OtherNumber should only |
242 * occur as part of PlainNumber. | 242 * occur as part of PlainNumber. |
243 */ | 243 */ |
244 | 244 |
245 #define PROPER_BITSET_TYPE_LIST(V) \ | 245 #define PROPER_BITSET_TYPE_LIST(V) \ |
246 REPRESENTATION_BITSET_TYPE_LIST(V) \ | 246 REPRESENTATION_BITSET_TYPE_LIST(V) \ |
247 SEMANTIC_BITSET_TYPE_LIST(V) | 247 SEMANTIC_BITSET_TYPE_LIST(V) |
248 | 248 |
249 #define BITSET_TYPE_LIST(V) \ | 249 #define BITSET_TYPE_LIST(V) \ |
250 MASK_BITSET_TYPE_LIST(V) \ | 250 MASK_BITSET_TYPE_LIST(V) \ |
251 REPRESENTATION_BITSET_TYPE_LIST(V) \ | 251 REPRESENTATION_BITSET_TYPE_LIST(V) \ |
252 INTERNAL_BITSET_TYPE_LIST(V) \ | 252 INTERNAL_BITSET_TYPE_LIST(V) \ |
253 SEMANTIC_BITSET_TYPE_LIST(V) | 253 SEMANTIC_BITSET_TYPE_LIST(V) |
254 | 254 |
255 class Type; | 255 class Type; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 static inline const Boundary* Boundaries(); | 329 static inline const Boundary* Boundaries(); |
330 static inline size_t BoundariesSize(); | 330 static inline size_t BoundariesSize(); |
331 }; | 331 }; |
332 | 332 |
333 // ----------------------------------------------------------------------------- | 333 // ----------------------------------------------------------------------------- |
334 // Superclass for non-bitset types (internal). | 334 // Superclass for non-bitset types (internal). |
335 class TypeBase { | 335 class TypeBase { |
336 protected: | 336 protected: |
337 friend class Type; | 337 friend class Type; |
338 | 338 |
339 enum Kind { | 339 enum Kind { kConstant, kTuple, kUnion, kRange }; |
340 kConstant, | |
341 kTuple, | |
342 kUnion, | |
343 kRange | |
344 }; | |
345 | 340 |
346 Kind kind() const { return kind_; } | 341 Kind kind() const { return kind_; } |
347 explicit TypeBase(Kind kind) : kind_(kind) {} | 342 explicit TypeBase(Kind kind) : kind_(kind) {} |
348 | 343 |
349 static bool IsKind(Type* type, Kind kind) { | 344 static bool IsKind(Type* type, Kind kind) { |
350 if (BitsetType::IsBitset(type)) return false; | 345 if (BitsetType::IsBitset(type)) return false; |
351 TypeBase* base = reinterpret_cast<TypeBase*>(type); | 346 TypeBase* base = reinterpret_cast<TypeBase*>(type); |
352 return base->kind() == kind; | 347 return base->kind() == kind; |
353 } | 348 } |
354 | 349 |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 return Bounds(lower, upper); | 767 return Bounds(lower, upper); |
773 } | 768 } |
774 | 769 |
775 bool Narrows(Bounds that) { | 770 bool Narrows(Bounds that) { |
776 return that.lower->Is(this->lower) && this->upper->Is(that.upper); | 771 return that.lower->Is(this->lower) && this->upper->Is(that.upper); |
777 } | 772 } |
778 }; | 773 }; |
779 } // namespace internal | 774 } // namespace internal |
780 } // namespace v8 | 775 } // namespace v8 |
781 | 776 |
782 #endif // V8_TYPES_H_ | 777 #endif // V8_COMPILER_TYPES_H_ |
OLD | NEW |