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