Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/types.h

Issue 230463003: Fix various bugs in the type systems, and improve test coverage. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/types.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 V(UniqueName, kSymbol | kInternalizedString) \ 147 V(UniqueName, kSymbol | kInternalizedString) \
148 V(Name, kSymbol | kString) \ 148 V(Name, kSymbol | kString) \
149 V(NumberOrString, kNumber | kString) \ 149 V(NumberOrString, kNumber | kString) \
150 V(DetectableObject, kArray | kFunction | kRegExp | kOtherObject) \ 150 V(DetectableObject, kArray | kFunction | kRegExp | kOtherObject) \
151 V(DetectableReceiver, kDetectableObject | kProxy) \ 151 V(DetectableReceiver, kDetectableObject | kProxy) \
152 V(Detectable, kDetectableReceiver | kNumber | kName) \ 152 V(Detectable, kDetectableReceiver | kNumber | kName) \
153 V(Object, kDetectableObject | kUndetectable) \ 153 V(Object, kDetectableObject | kUndetectable) \
154 V(Receiver, kObject | kProxy) \ 154 V(Receiver, kObject | kProxy) \
155 V(NonNumber, kBoolean | kName | kNull | kReceiver | \ 155 V(NonNumber, kBoolean | kName | kNull | kReceiver | \
156 kUndefined | kInternal) \ 156 kUndefined | kInternal) \
157 V(Any, kNumber | kNonNumber) 157 V(Any, -1)
158 158
159 #define BITSET_TYPE_LIST(V) \ 159 #define BITSET_TYPE_LIST(V) \
160 MASK_BITSET_TYPE_LIST(V) \ 160 MASK_BITSET_TYPE_LIST(V) \
161 REPRESENTATION_BITSET_TYPE_LIST(V) \ 161 REPRESENTATION_BITSET_TYPE_LIST(V) \
162 SEMANTIC_BITSET_TYPE_LIST(V) 162 SEMANTIC_BITSET_TYPE_LIST(V)
163 163
164 164
165 // struct Config { 165 // struct Config {
166 // typedef Base; 166 // typedef Base;
167 // typedef Struct; 167 // typedef Struct;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 static TypeHandle Union(TypeHandle type1, TypeHandle type2, Region* reg); 213 static TypeHandle Union(TypeHandle type1, TypeHandle type2, Region* reg);
214 static TypeHandle Intersect(TypeHandle type1, TypeHandle type2, Region* reg); 214 static TypeHandle Intersect(TypeHandle type1, TypeHandle type2, Region* reg);
215 215
216 static TypeHandle Of(i::Object* value, Region* region) { 216 static TypeHandle Of(i::Object* value, Region* region) {
217 return Config::from_bitset(LubBitset(value), region); 217 return Config::from_bitset(LubBitset(value), region);
218 } 218 }
219 static TypeHandle Of(i::Handle<i::Object> value, Region* region) { 219 static TypeHandle Of(i::Handle<i::Object> value, Region* region) {
220 return Of(*value, region); 220 return Of(*value, region);
221 } 221 }
222 222
223 bool IsInhabited() {
224 return !this->IsBitset() || IsInhabited(this->AsBitset());
225 }
226
223 bool Is(TypeImpl* that) { return this == that || this->SlowIs(that); } 227 bool Is(TypeImpl* that) { return this == that || this->SlowIs(that); }
224 template<class TypeHandle> 228 template<class TypeHandle>
225 bool Is(TypeHandle that) { return this->Is(*that); } 229 bool Is(TypeHandle that) { return this->Is(*that); }
226 230
227 bool Maybe(TypeImpl* that); 231 bool Maybe(TypeImpl* that);
228 template<class TypeHandle> 232 template<class TypeHandle>
229 bool Maybe(TypeHandle that) { return this->Maybe(*that); } 233 bool Maybe(TypeHandle that) { return this->Maybe(*that); }
230 234
231 // Equivalent to Constant(value)->Is(this), but avoiding allocation. 235 // Equivalent to Constant(value)->Is(this), but avoiding allocation.
232 bool Contains(i::Object* val); 236 bool Contains(i::Object* val);
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 bool Narrows(BoundsImpl that) { 501 bool Narrows(BoundsImpl that) {
498 return that.lower->Is(this->lower) && this->upper->Is(that.upper); 502 return that.lower->Is(this->lower) && this->upper->Is(that.upper);
499 } 503 }
500 }; 504 };
501 505
502 typedef BoundsImpl<ZoneTypeConfig> Bounds; 506 typedef BoundsImpl<ZoneTypeConfig> Bounds;
503 507
504 } } // namespace v8::internal 508 } } // namespace v8::internal
505 509
506 #endif // V8_TYPES_H_ 510 #endif // V8_TYPES_H_
OLDNEW
« no previous file with comments | « no previous file | src/types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698