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 "handles.h" | 8 #include "handles.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 | 12 |
13 // A simple type system for compiler-internal use. It is based entirely on | 13 // A simple type system for compiler-internal use. It is based entirely on |
14 // union types, and all subtyping hence amounts to set inclusion. Besides the | 14 // union types, and all subtyping hence amounts to set inclusion. Besides the |
15 // obvious primitive types and some predefined unions, the type language also | 15 // obvious primitive types and some predefined unions, the type language also |
16 // can express class types (a.k.a. specific maps) and singleton types (i.e., | 16 // can express class types (a.k.a. specific maps) and singleton types (i.e., |
17 // concrete constants). | 17 // concrete constants). |
18 // | 18 // |
19 // Types consist of two dimensions: semantic (value range) and representation. | 19 // Types consist of two dimensions: semantic (value range) and representation. |
20 // Both are related through subtyping. | 20 // Both are related through subtyping. |
21 // | 21 // |
22 // The following equations and inequations hold for the semantic axis: | 22 // The following equations and inequations hold for the semantic axis: |
23 // | 23 // |
24 // None <= T | 24 // None <= T |
25 // T <= Any | 25 // T <= Any |
26 // | 26 // |
27 // Oddball = Boolean \/ Null \/ Undefined | |
28 // Number = Signed32 \/ Unsigned32 \/ Double | 27 // Number = Signed32 \/ Unsigned32 \/ Double |
29 // Smi <= Signed32 | 28 // Smi <= Signed32 |
30 // Name = String \/ Symbol | 29 // Name = String \/ Symbol |
31 // UniqueName = InternalizedString \/ Symbol | 30 // UniqueName = InternalizedString \/ Symbol |
32 // InternalizedString < String | 31 // InternalizedString < String |
33 // | 32 // |
34 // Receiver = Object \/ Proxy | 33 // Receiver = Object \/ Proxy |
35 // Array < Object | 34 // Array < Object |
36 // Function < Object | 35 // Function < Object |
37 // RegExp < Object | 36 // RegExp < Object |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 V(InternalizedString, 1 << 8 | REPRESENTATION(kTaggedPtr)) \ | 134 V(InternalizedString, 1 << 8 | REPRESENTATION(kTaggedPtr)) \ |
136 V(OtherString, 1 << 9 | REPRESENTATION(kTaggedPtr)) \ | 135 V(OtherString, 1 << 9 | REPRESENTATION(kTaggedPtr)) \ |
137 V(Undetectable, 1 << 10 | REPRESENTATION(kTaggedPtr)) \ | 136 V(Undetectable, 1 << 10 | REPRESENTATION(kTaggedPtr)) \ |
138 V(Array, 1 << 11 | REPRESENTATION(kTaggedPtr)) \ | 137 V(Array, 1 << 11 | REPRESENTATION(kTaggedPtr)) \ |
139 V(Function, 1 << 12 | REPRESENTATION(kTaggedPtr)) \ | 138 V(Function, 1 << 12 | REPRESENTATION(kTaggedPtr)) \ |
140 V(RegExp, 1 << 13 | REPRESENTATION(kTaggedPtr)) \ | 139 V(RegExp, 1 << 13 | REPRESENTATION(kTaggedPtr)) \ |
141 V(OtherObject, 1 << 14 | REPRESENTATION(kTaggedPtr)) \ | 140 V(OtherObject, 1 << 14 | REPRESENTATION(kTaggedPtr)) \ |
142 V(Proxy, 1 << 15 | REPRESENTATION(kTaggedPtr)) \ | 141 V(Proxy, 1 << 15 | REPRESENTATION(kTaggedPtr)) \ |
143 V(Internal, 1 << 16 | REPRESENTATION(kTagged | kUntagged)) \ | 142 V(Internal, 1 << 16 | REPRESENTATION(kTagged | kUntagged)) \ |
144 \ | 143 \ |
145 V(Oddball, kBoolean | kNull | kUndefined) \ | |
146 V(Signed32, kSignedSmall | kOtherSigned32) \ | 144 V(Signed32, kSignedSmall | kOtherSigned32) \ |
147 V(Number, kSigned32 | kUnsigned32 | kFloat) \ | 145 V(Number, kSigned32 | kUnsigned32 | kFloat) \ |
148 V(String, kInternalizedString | kOtherString) \ | 146 V(String, kInternalizedString | kOtherString) \ |
149 V(UniqueName, kSymbol | kInternalizedString) \ | 147 V(UniqueName, kSymbol | kInternalizedString) \ |
150 V(Name, kSymbol | kString) \ | 148 V(Name, kSymbol | kString) \ |
151 V(NumberOrString, kNumber | kString) \ | 149 V(NumberOrString, kNumber | kString) \ |
152 V(DetectableObject, kArray | kFunction | kRegExp | kOtherObject) \ | 150 V(DetectableObject, kArray | kFunction | kRegExp | kOtherObject) \ |
153 V(DetectableReceiver, kDetectableObject | kProxy) \ | 151 V(DetectableReceiver, kDetectableObject | kProxy) \ |
154 V(Detectable, kDetectableReceiver | kNumber | kName) \ | 152 V(Detectable, kDetectableReceiver | kNumber | kName) \ |
155 V(Object, kDetectableObject | kUndetectable) \ | 153 V(Object, kDetectableObject | kUndetectable) \ |
156 V(Receiver, kObject | kProxy) \ | 154 V(Receiver, kObject | kProxy) \ |
157 V(NonNumber, kOddball | kName | kReceiver | kInternal) \ | 155 V(NonNumber, kBoolean | kInternal | kName | kNull | \ |
rossberg
2014/04/07 09:32:15
Nit: put kInternal last
Benedikt Meurer
2014/04/07 09:33:52
Done.
| |
156 kReceiver | kUndefined) \ | |
158 V(Any, kNumber | kNonNumber) | 157 V(Any, kNumber | kNonNumber) |
159 | 158 |
160 #define BITSET_TYPE_LIST(V) \ | 159 #define BITSET_TYPE_LIST(V) \ |
161 MASK_BITSET_TYPE_LIST(V) \ | 160 MASK_BITSET_TYPE_LIST(V) \ |
162 REPRESENTATION_BITSET_TYPE_LIST(V) \ | 161 REPRESENTATION_BITSET_TYPE_LIST(V) \ |
163 SEMANTIC_BITSET_TYPE_LIST(V) | 162 SEMANTIC_BITSET_TYPE_LIST(V) |
164 | 163 |
165 | 164 |
166 // struct Config { | 165 // struct Config { |
167 // typedef Base; | 166 // typedef Base; |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
501 bool Narrows(BoundsImpl that) { | 500 bool Narrows(BoundsImpl that) { |
502 return that.lower->Is(this->lower) && this->upper->Is(that.upper); | 501 return that.lower->Is(this->lower) && this->upper->Is(that.upper); |
503 } | 502 } |
504 }; | 503 }; |
505 | 504 |
506 typedef BoundsImpl<ZoneTypeConfig> Bounds; | 505 typedef BoundsImpl<ZoneTypeConfig> Bounds; |
507 | 506 |
508 } } // namespace v8::internal | 507 } } // namespace v8::internal |
509 | 508 |
510 #endif // V8_TYPES_H_ | 509 #endif // V8_TYPES_H_ |
OLD | NEW |