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/handles.h" | 8 #include "src/handles.h" |
9 #include "src/ostreams.h" | |
9 | 10 |
10 namespace v8 { | 11 namespace v8 { |
11 namespace internal { | 12 namespace internal { |
12 | 13 |
13 // SUMMARY | 14 // SUMMARY |
14 // | 15 // |
15 // A simple type system for compiler-internal use. It is based entirely on | 16 // A simple type system for compiler-internal use. It is based entirely on |
16 // union types, and all subtyping hence amounts to set inclusion. Besides the | 17 // union types, and all subtyping hence amounts to set inclusion. Besides the |
17 // obvious primitive types and some predefined unions, the type language also | 18 // obvious primitive types and some predefined unions, the type language also |
18 // can express class types (a.k.a. specific maps) and singleton types (i.e., | 19 // can express class types (a.k.a. specific maps) and singleton types (i.e., |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
408 static inline TypeImpl* cast(typename Config::Base* object); | 409 static inline TypeImpl* cast(typename Config::Base* object); |
409 | 410 |
410 template<class OtherTypeImpl> | 411 template<class OtherTypeImpl> |
411 static TypeHandle Convert( | 412 static TypeHandle Convert( |
412 typename OtherTypeImpl::TypeHandle type, Region* region); | 413 typename OtherTypeImpl::TypeHandle type, Region* region); |
413 | 414 |
414 // Printing. | 415 // Printing. |
415 | 416 |
416 enum PrintDimension { BOTH_DIMS, SEMANTIC_DIM, REPRESENTATION_DIM }; | 417 enum PrintDimension { BOTH_DIMS, SEMANTIC_DIM, REPRESENTATION_DIM }; |
417 | 418 |
418 void PrintTo(StringStream* stream, PrintDimension = BOTH_DIMS); | 419 OStream& PrintTo(OStream& os, PrintDimension dim = BOTH_DIMS); // NOLINT |
Michael Starzinger
2014/07/02 15:14:58
suggestion: Likewise.
Sven Panne
2014/07/03 07:18:52
Done.
| |
419 void TypePrint(PrintDimension = BOTH_DIMS); | |
420 void TypePrint(FILE* out, PrintDimension = BOTH_DIMS); | |
421 | 420 |
422 protected: | 421 protected: |
423 // Friends. | 422 // Friends. |
424 | 423 |
425 template<class> friend class Iterator; | 424 template<class> friend class Iterator; |
426 template<class> friend class TypeImpl; | 425 template<class> friend class TypeImpl; |
427 | 426 |
428 // Handle conversion. | 427 // Handle conversion. |
429 | 428 |
430 template<class T> | 429 template<class T> |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
495 static int Glb(TypeImpl* type); // greatest lower bound that's a bitset | 494 static int Glb(TypeImpl* type); // greatest lower bound that's a bitset |
496 static int Lub(TypeImpl* type); // least upper bound that's a bitset | 495 static int Lub(TypeImpl* type); // least upper bound that's a bitset |
497 static int Lub(i::Object* value); | 496 static int Lub(i::Object* value); |
498 static int Lub(double value); | 497 static int Lub(double value); |
499 static int Lub(int32_t value); | 498 static int Lub(int32_t value); |
500 static int Lub(uint32_t value); | 499 static int Lub(uint32_t value); |
501 static int Lub(i::Map* map); | 500 static int Lub(i::Map* map); |
502 static int InherentLub(TypeImpl* type); | 501 static int InherentLub(TypeImpl* type); |
503 | 502 |
504 static const char* Name(int bitset); | 503 static const char* Name(int bitset); |
505 static void PrintTo(StringStream* stream, int bitset); | 504 static OStream& Print(OStream& os, int bitset); // NOLINT |
Michael Starzinger
2014/07/02 15:14:58
suggestion: Likewise.
Sven Panne
2014/07/03 07:18:52
Done.
| |
506 using TypeImpl::PrintTo; | 505 using TypeImpl::PrintTo; |
507 }; | 506 }; |
508 | 507 |
509 | 508 |
510 // ----------------------------------------------------------------------------- | 509 // ----------------------------------------------------------------------------- |
511 // Superclass for non-bitset types (internal). | 510 // Superclass for non-bitset types (internal). |
512 // Contains a tag and a variable number of type or value fields. | 511 // Contains a tag and a variable number of type or value fields. |
513 | 512 |
514 template<class Config> | 513 template<class Config> |
515 class TypeImpl<Config>::StructuralType : public TypeImpl<Config> { | 514 class TypeImpl<Config>::StructuralType : public TypeImpl<Config> { |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
924 bool Narrows(BoundsImpl that) { | 923 bool Narrows(BoundsImpl that) { |
925 return that.lower->Is(this->lower) && this->upper->Is(that.upper); | 924 return that.lower->Is(this->lower) && this->upper->Is(that.upper); |
926 } | 925 } |
927 }; | 926 }; |
928 | 927 |
929 typedef BoundsImpl<ZoneTypeConfig> Bounds; | 928 typedef BoundsImpl<ZoneTypeConfig> Bounds; |
930 | 929 |
931 } } // namespace v8::internal | 930 } } // namespace v8::internal |
932 | 931 |
933 #endif // V8_TYPES_H_ | 932 #endif // V8_TYPES_H_ |
OLD | NEW |