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 { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 static TypeHandle Class(i::Handle<i::Map> map, Region* region) { | 206 static TypeHandle Class(i::Handle<i::Map> map, Region* region) { |
207 return Config::from_class(map, LubBitset(*map), region); | 207 return Config::from_class(map, LubBitset(*map), region); |
208 } | 208 } |
209 static TypeHandle Constant(i::Handle<i::Object> value, Region* region) { | 209 static TypeHandle Constant(i::Handle<i::Object> value, Region* region) { |
210 return Config::from_constant(value, LubBitset(*value), region); | 210 return Config::from_constant(value, LubBitset(*value), region); |
211 } | 211 } |
212 | 212 |
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) { |
| 217 return Config::from_bitset(LubBitset(value), region); |
| 218 } |
216 static TypeHandle Of(i::Handle<i::Object> value, Region* region) { | 219 static TypeHandle Of(i::Handle<i::Object> value, Region* region) { |
217 return Config::from_bitset(LubBitset(*value), region); | 220 return Of(*value, region); |
218 } | 221 } |
219 | 222 |
220 bool Is(TypeImpl* that) { return this == that || this->SlowIs(that); } | 223 bool Is(TypeImpl* that) { return this == that || this->SlowIs(that); } |
221 template<class TypeHandle> | 224 template<class TypeHandle> |
222 bool Is(TypeHandle that) { return this->Is(*that); } | 225 bool Is(TypeHandle that) { return this->Is(*that); } |
223 | 226 |
224 bool Maybe(TypeImpl* that); | 227 bool Maybe(TypeImpl* that); |
225 template<class TypeHandle> | 228 template<class TypeHandle> |
226 bool Maybe(TypeHandle that) { return this->Maybe(*that); } | 229 bool Maybe(TypeHandle that) { return this->Maybe(*that); } |
227 | 230 |
228 // Equivalent to Constant(value)->Is(this), but avoiding allocation. | 231 // Equivalent to Constant(value)->Is(this), but avoiding allocation. |
229 bool Contains(i::Object* val); | 232 bool Contains(i::Object* val); |
230 bool Contains(i::Handle<i::Object> val) { return this->Contains(*val); } | 233 bool Contains(i::Handle<i::Object> val) { return this->Contains(*val); } |
231 | 234 |
232 // State-dependent versions of Of and Is that consider subtyping between | 235 // State-dependent versions of Of and Is that consider subtyping between |
233 // a constant and its map class. | 236 // a constant and its map class. |
234 static TypeHandle NowOf(i::Handle<i::Object> value, Region* region); | 237 static TypeHandle NowOf(i::Object* value, Region* region); |
| 238 static TypeHandle NowOf(i::Handle<i::Object> value, Region* region) { |
| 239 return NowOf(*value, region); |
| 240 } |
235 bool NowIs(TypeImpl* that); | 241 bool NowIs(TypeImpl* that); |
236 template<class TypeHandle> | 242 template<class TypeHandle> |
237 bool NowIs(TypeHandle that) { return this->NowIs(*that); } | 243 bool NowIs(TypeHandle that) { return this->NowIs(*that); } |
238 bool NowContains(i::Object* val); | 244 bool NowContains(i::Object* val); |
239 bool NowContains(i::Handle<i::Object> val) { return this->NowContains(*val); } | 245 bool NowContains(i::Handle<i::Object> val) { return this->NowContains(*val); } |
240 | 246 |
241 bool IsClass() { return Config::is_class(this); } | 247 bool IsClass() { return Config::is_class(this); } |
242 bool IsConstant() { return Config::is_constant(this); } | 248 bool IsConstant() { return Config::is_constant(this); } |
243 i::Handle<i::Map> AsClass() { return Config::as_class(this); } | 249 i::Handle<i::Map> AsClass() { return Config::as_class(this); } |
244 i::Handle<i::Object> AsConstant() { return Config::as_constant(this); } | 250 i::Handle<i::Object> AsConstant() { return Config::as_constant(this); } |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 bool Narrows(BoundsImpl that) { | 505 bool Narrows(BoundsImpl that) { |
500 return that.lower->Is(this->lower) && this->upper->Is(that.upper); | 506 return that.lower->Is(this->lower) && this->upper->Is(that.upper); |
501 } | 507 } |
502 }; | 508 }; |
503 | 509 |
504 typedef BoundsImpl<ZoneTypeConfig> Bounds; | 510 typedef BoundsImpl<ZoneTypeConfig> Bounds; |
505 | 511 |
506 } } // namespace v8::internal | 512 } } // namespace v8::internal |
507 | 513 |
508 #endif // V8_TYPES_H_ | 514 #endif // V8_TYPES_H_ |
OLD | NEW |