| 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 #include "types.h" | 5 #include "types.h" |
| 6 | 6 |
| 7 #include "string-stream.h" | 7 #include "string-stream.h" |
| 8 #include "types-inl.h" | 8 #include "types-inl.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 } | 299 } |
| 300 return false; | 300 return false; |
| 301 } | 301 } |
| 302 | 302 |
| 303 return false; | 303 return false; |
| 304 } | 304 } |
| 305 | 305 |
| 306 | 306 |
| 307 template<class Config> | 307 template<class Config> |
| 308 bool TypeImpl<Config>::NowIs(TypeImpl* that) { | 308 bool TypeImpl<Config>::NowIs(TypeImpl* that) { |
| 309 return this->Is(that) || | 309 if (this->Is(that)) return true; |
| 310 (this->IsConstant() && that->IsClass() && | 310 if (this->IsConstant() && this->AsConstant()->IsHeapObject()) { |
| 311 this->AsConstant()->IsHeapObject() && | 311 i::Handle<i::Map> map(i::HeapObject::cast(*this->AsConstant())->map()); |
| 312 i::HeapObject::cast(*this->AsConstant())->map() == *that->AsClass()); | 312 for (Iterator<i::Map> it = that->Classes(); !it.Done(); it.Advance()) { |
| 313 if (*it.Current() == *map) return true; |
| 314 } |
| 315 } |
| 316 return false; |
| 313 } | 317 } |
| 314 | 318 |
| 315 | 319 |
| 316 // Check this overlaps that. | 320 // Check this overlaps that. |
| 317 template<class Config> | 321 template<class Config> |
| 318 bool TypeImpl<Config>::Maybe(TypeImpl* that) { | 322 bool TypeImpl<Config>::Maybe(TypeImpl* that) { |
| 319 // Fast path for bitsets. | 323 // Fast path for bitsets. |
| 320 if (this->IsBitset()) { | 324 if (this->IsBitset()) { |
| 321 return IsInhabited(this->AsBitset() & that->LubBitset()); | 325 return IsInhabited(this->AsBitset() & that->LubBitset()); |
| 322 } | 326 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 351 if (this->IsConstant()) { | 355 if (this->IsConstant()) { |
| 352 return that->IsConstant() && *this->AsConstant() == *that->AsConstant(); | 356 return that->IsConstant() && *this->AsConstant() == *that->AsConstant(); |
| 353 } | 357 } |
| 354 | 358 |
| 355 return false; | 359 return false; |
| 356 } | 360 } |
| 357 | 361 |
| 358 | 362 |
| 359 template<class Config> | 363 template<class Config> |
| 360 bool TypeImpl<Config>::Contains(i::Object* value) { | 364 bool TypeImpl<Config>::Contains(i::Object* value) { |
| 361 if (this->IsConstant()) { | 365 for (Iterator<i::Object> it = this->Constants(); !it.Done(); it.Advance()) { |
| 362 return *this->AsConstant() == value; | 366 if (*it.Current() == value) return true; |
| 363 } | 367 } |
| 364 return Config::from_bitset(LubBitset(value))->Is(this); | 368 return Config::from_bitset(LubBitset(value))->Is(this); |
| 365 } | 369 } |
| 366 | 370 |
| 367 | 371 |
| 368 template<class Config> | 372 template<class Config> |
| 369 bool TypeImpl<Config>::NowContains(i::Object* value) { | 373 bool TypeImpl<Config>::NowContains(i::Object* value) { |
| 370 return this->Contains(value) || | 374 return this->Contains(value) || |
| 371 (this->IsClass() && value->IsHeapObject() && | 375 (this->IsClass() && value->IsHeapObject() && |
| 372 *this->AsClass() == i::HeapObject::cast(value)->map()); | 376 *this->AsClass() == i::HeapObject::cast(value)->map()); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>; | 681 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>; |
| 678 | 682 |
| 679 template TypeImpl<ZoneTypeConfig>::TypeHandle | 683 template TypeImpl<ZoneTypeConfig>::TypeHandle |
| 680 TypeImpl<ZoneTypeConfig>::Convert<HeapType>( | 684 TypeImpl<ZoneTypeConfig>::Convert<HeapType>( |
| 681 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*); | 685 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*); |
| 682 template TypeImpl<HeapTypeConfig>::TypeHandle | 686 template TypeImpl<HeapTypeConfig>::TypeHandle |
| 683 TypeImpl<HeapTypeConfig>::Convert<Type>( | 687 TypeImpl<HeapTypeConfig>::Convert<Type>( |
| 684 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*); | 688 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*); |
| 685 | 689 |
| 686 } } // namespace v8::internal | 690 } } // namespace v8::internal |
| OLD | NEW |