Chromium Code Reviews| 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 | 264 |
| 265 // State-dependent versions of Of and Is that consider subtyping between | 265 // State-dependent versions of Of and Is that consider subtyping between |
| 266 // a constant and its map class. | 266 // a constant and its map class. |
| 267 static TypeHandle NowOf(i::Object* value, Region* region); | 267 static TypeHandle NowOf(i::Object* value, Region* region); |
| 268 static TypeHandle NowOf(i::Handle<i::Object> value, Region* region) { | 268 static TypeHandle NowOf(i::Handle<i::Object> value, Region* region) { |
| 269 return NowOf(*value, region); | 269 return NowOf(*value, region); |
| 270 } | 270 } |
| 271 bool NowIs(TypeImpl* that); | 271 bool NowIs(TypeImpl* that); |
| 272 template<class TypeHandle> | 272 template<class TypeHandle> |
| 273 bool NowIs(TypeHandle that) { return this->NowIs(*that); } | 273 bool NowIs(TypeHandle that) { return this->NowIs(*that); } |
| 274 bool NowContains(i::Object* val); | 274 bool NowContains(i::Object* val) { |
|
rossberg
2014/04/11 09:19:37
Can we move that to types-inl?
Benedikt Meurer
2014/04/11 09:23:30
Done.
| |
| 275 DisallowHeapAllocation no_allocation; | |
| 276 if (this->IsAny()) return true; | |
| 277 if (val->IsHeapObject()) { | |
| 278 i::Map* map = i::HeapObject::cast(val)->map(); | |
| 279 for (Iterator<i::Map> it = this->Classes(); !it.Done(); it.Advance()) { | |
| 280 if (*it.Current() == map) return true; | |
| 281 } | |
| 282 } | |
| 283 return this->Contains(val); | |
| 284 } | |
| 275 bool NowContains(i::Handle<i::Object> val) { return this->NowContains(*val); } | 285 bool NowContains(i::Handle<i::Object> val) { return this->NowContains(*val); } |
| 276 | 286 |
| 277 bool IsClass() { return Config::is_class(this); } | 287 bool IsClass() { return Config::is_class(this); } |
| 278 bool IsConstant() { return Config::is_constant(this); } | 288 bool IsConstant() { return Config::is_constant(this); } |
| 279 i::Handle<i::Map> AsClass() { return Config::as_class(this); } | 289 i::Handle<i::Map> AsClass() { return Config::as_class(this); } |
| 280 i::Handle<i::Object> AsConstant() { return Config::as_constant(this); } | 290 i::Handle<i::Object> AsConstant() { return Config::as_constant(this); } |
| 281 | 291 |
| 282 int NumClasses(); | 292 int NumClasses(); |
| 283 int NumConstants(); | 293 int NumConstants(); |
| 284 | 294 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 527 bool Narrows(BoundsImpl that) { | 537 bool Narrows(BoundsImpl that) { |
| 528 return that.lower->Is(this->lower) && this->upper->Is(that.upper); | 538 return that.lower->Is(this->lower) && this->upper->Is(that.upper); |
| 529 } | 539 } |
| 530 }; | 540 }; |
| 531 | 541 |
| 532 typedef BoundsImpl<ZoneTypeConfig> Bounds; | 542 typedef BoundsImpl<ZoneTypeConfig> Bounds; |
| 533 | 543 |
| 534 } } // namespace v8::internal | 544 } } // namespace v8::internal |
| 535 | 545 |
| 536 #endif // V8_TYPES_H_ | 546 #endif // V8_TYPES_H_ |
| OLD | NEW |