| 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" | |
| 11 | 10 |
| 12 namespace v8 { | 11 namespace v8 { |
| 13 namespace internal { | 12 namespace internal { |
| 14 | 13 |
| 14 class OStream; |
| 15 |
| 15 // SUMMARY | 16 // SUMMARY |
| 16 // | 17 // |
| 17 // A simple type system for compiler-internal use. It is based entirely on | 18 // A simple type system for compiler-internal use. It is based entirely on |
| 18 // union types, and all subtyping hence amounts to set inclusion. Besides the | 19 // union types, and all subtyping hence amounts to set inclusion. Besides the |
| 19 // obvious primitive types and some predefined unions, the type language also | 20 // obvious primitive types and some predefined unions, the type language also |
| 20 // can express class types (a.k.a. specific maps) and singleton types (i.e., | 21 // can express class types (a.k.a. specific maps) and singleton types (i.e., |
| 21 // concrete constants). | 22 // concrete constants). |
| 22 // | 23 // |
| 23 // Types consist of two dimensions: semantic (value range) and representation. | 24 // Types consist of two dimensions: semantic (value range) and representation. |
| 24 // Both are related through subtyping. | 25 // Both are related through subtyping. |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 } | 505 } |
| 505 | 506 |
| 506 static bool Is(int bitset1, int bitset2) { | 507 static bool Is(int bitset1, int bitset2) { |
| 507 return (bitset1 | bitset2) == bitset2; | 508 return (bitset1 | bitset2) == bitset2; |
| 508 } | 509 } |
| 509 | 510 |
| 510 static int Glb(TypeImpl* type); // greatest lower bound that's a bitset | 511 static int Glb(TypeImpl* type); // greatest lower bound that's a bitset |
| 511 static int Lub(TypeImpl* type); // least upper bound that's a bitset | 512 static int Lub(TypeImpl* type); // least upper bound that's a bitset |
| 512 static int Lub(i::Object* value); | 513 static int Lub(i::Object* value); |
| 513 static int Lub(double value); | 514 static int Lub(double value); |
| 514 static int Lub(int32_t value); | |
| 515 static int Lub(uint32_t value); | |
| 516 static int Lub(i::Map* map); | 515 static int Lub(i::Map* map); |
| 517 static int InherentLub(TypeImpl* type); | 516 static int InherentLub(TypeImpl* type); |
| 518 | 517 |
| 519 static const char* Name(int bitset); | 518 static const char* Name(int bitset); |
| 520 static void Print(OStream& os, int bitset); // NOLINT | 519 static void Print(OStream& os, int bitset); // NOLINT |
| 521 using TypeImpl::PrintTo; | 520 using TypeImpl::PrintTo; |
| 522 }; | 521 }; |
| 523 | 522 |
| 524 | 523 |
| 525 // ----------------------------------------------------------------------------- | 524 // ----------------------------------------------------------------------------- |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 bool Narrows(BoundsImpl that) { | 990 bool Narrows(BoundsImpl that) { |
| 992 return that.lower->Is(this->lower) && this->upper->Is(that.upper); | 991 return that.lower->Is(this->lower) && this->upper->Is(that.upper); |
| 993 } | 992 } |
| 994 }; | 993 }; |
| 995 | 994 |
| 996 typedef BoundsImpl<ZoneTypeConfig> Bounds; | 995 typedef BoundsImpl<ZoneTypeConfig> Bounds; |
| 997 | 996 |
| 998 } } // namespace v8::internal | 997 } } // namespace v8::internal |
| 999 | 998 |
| 1000 #endif // V8_TYPES_H_ | 999 #endif // V8_TYPES_H_ |
| OLD | NEW |