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_COMPILER_TYPES_H_ | 5 #ifndef V8_COMPILER_TYPES_H_ |
6 #define V8_COMPILER_TYPES_H_ | 6 #define V8_COMPILER_TYPES_H_ |
7 | 7 |
| 8 #include "src/base/compiler-specific.h" |
8 #include "src/conversions.h" | 9 #include "src/conversions.h" |
| 10 #include "src/globals.h" |
9 #include "src/handles.h" | 11 #include "src/handles.h" |
10 #include "src/objects.h" | 12 #include "src/objects.h" |
11 #include "src/ostreams.h" | 13 #include "src/ostreams.h" |
12 | 14 |
13 namespace v8 { | 15 namespace v8 { |
14 namespace internal { | 16 namespace internal { |
15 namespace compiler { | 17 namespace compiler { |
16 | 18 |
17 // SUMMARY | 19 // SUMMARY |
18 // | 20 // |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 185 |
184 #define BITSET_TYPE_LIST(V) \ | 186 #define BITSET_TYPE_LIST(V) \ |
185 INTERNAL_BITSET_TYPE_LIST(V) \ | 187 INTERNAL_BITSET_TYPE_LIST(V) \ |
186 PROPER_BITSET_TYPE_LIST(V) | 188 PROPER_BITSET_TYPE_LIST(V) |
187 | 189 |
188 class Type; | 190 class Type; |
189 | 191 |
190 // ----------------------------------------------------------------------------- | 192 // ----------------------------------------------------------------------------- |
191 // Bitset types (internal). | 193 // Bitset types (internal). |
192 | 194 |
193 class BitsetType { | 195 class V8_EXPORT_PRIVATE BitsetType { |
194 public: | 196 public: |
195 typedef uint32_t bitset; // Internal | 197 typedef uint32_t bitset; // Internal |
196 | 198 |
197 enum : uint32_t { | 199 enum : uint32_t { |
198 #define DECLARE_TYPE(type, value) k##type = (value), | 200 #define DECLARE_TYPE(type, value) k##type = (value), |
199 BITSET_TYPE_LIST(DECLARE_TYPE) | 201 BITSET_TYPE_LIST(DECLARE_TYPE) |
200 #undef DECLARE_TYPE | 202 #undef DECLARE_TYPE |
201 kUnusedEOL = 0 | 203 kUnusedEOL = 0 |
202 }; | 204 }; |
203 | 205 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 explicit OtherNumberConstantType(double value) | 313 explicit OtherNumberConstantType(double value) |
312 : TypeBase(kOtherNumberConstant), value_(value) { | 314 : TypeBase(kOtherNumberConstant), value_(value) { |
313 CHECK(IsOtherNumberConstant(value)); | 315 CHECK(IsOtherNumberConstant(value)); |
314 } | 316 } |
315 | 317 |
316 BitsetType::bitset Lub() { return BitsetType::kOtherNumber; } | 318 BitsetType::bitset Lub() { return BitsetType::kOtherNumber; } |
317 | 319 |
318 double value_; | 320 double value_; |
319 }; | 321 }; |
320 | 322 |
321 class HeapConstantType : public TypeBase { | 323 class V8_EXPORT_PRIVATE HeapConstantType : public NON_EXPORTED_BASE(TypeBase) { |
322 public: | 324 public: |
323 i::Handle<i::HeapObject> Value() { return object_; } | 325 i::Handle<i::HeapObject> Value() { return object_; } |
324 | 326 |
325 private: | 327 private: |
326 friend class Type; | 328 friend class Type; |
327 friend class BitsetType; | 329 friend class BitsetType; |
328 | 330 |
329 static Type* New(i::Handle<i::HeapObject> value, Zone* zone) { | 331 static Type* New(i::Handle<i::HeapObject> value, Zone* zone) { |
330 BitsetType::bitset bitset = BitsetType::Lub(*value); | 332 BitsetType::bitset bitset = BitsetType::Lub(*value); |
331 return AsType(new (zone->New(sizeof(HeapConstantType))) | 333 return AsType(new (zone->New(sizeof(HeapConstantType))) |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 } | 481 } |
480 | 482 |
481 static UnionType* cast(Type* type) { | 483 static UnionType* cast(Type* type) { |
482 DCHECK(IsKind(type, kUnion)); | 484 DCHECK(IsKind(type, kUnion)); |
483 return static_cast<UnionType*>(FromType(type)); | 485 return static_cast<UnionType*>(FromType(type)); |
484 } | 486 } |
485 | 487 |
486 bool Wellformed(); | 488 bool Wellformed(); |
487 }; | 489 }; |
488 | 490 |
489 class Type { | 491 class V8_EXPORT_PRIVATE Type { |
490 public: | 492 public: |
491 typedef BitsetType::bitset bitset; // Internal | 493 typedef BitsetType::bitset bitset; // Internal |
492 | 494 |
493 // Constructors. | 495 // Constructors. |
494 #define DEFINE_TYPE_CONSTRUCTOR(type, value) \ | 496 #define DEFINE_TYPE_CONSTRUCTOR(type, value) \ |
495 static Type* type() { return BitsetType::New(BitsetType::k##type); } | 497 static Type* type() { return BitsetType::New(BitsetType::k##type); } |
496 PROPER_BITSET_TYPE_LIST(DEFINE_TYPE_CONSTRUCTOR) | 498 PROPER_BITSET_TYPE_LIST(DEFINE_TYPE_CONSTRUCTOR) |
497 #undef DEFINE_TYPE_CONSTRUCTOR | 499 #undef DEFINE_TYPE_CONSTRUCTOR |
498 | 500 |
499 static Type* SignedSmall() { | 501 static Type* SignedSmall() { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 RangeType::Limits* limits, Zone* zone); | 641 RangeType::Limits* limits, Zone* zone); |
640 static Type* NormalizeUnion(Type* unioned, int size, Zone* zone); | 642 static Type* NormalizeUnion(Type* unioned, int size, Zone* zone); |
641 static Type* NormalizeRangeAndBitset(Type* range, bitset* bits, Zone* zone); | 643 static Type* NormalizeRangeAndBitset(Type* range, bitset* bits, Zone* zone); |
642 }; | 644 }; |
643 | 645 |
644 } // namespace compiler | 646 } // namespace compiler |
645 } // namespace internal | 647 } // namespace internal |
646 } // namespace v8 | 648 } // namespace v8 |
647 | 649 |
648 #endif // V8_COMPILER_TYPES_H_ | 650 #endif // V8_COMPILER_TYPES_H_ |
OLD | NEW |