| 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 "src/types.h" |    5 #include "src/types.h" | 
|    6  |    6  | 
|    7 #include "src/string-stream.h" |    7 #include "src/string-stream.h" | 
|    8 #include "src/types-inl.h" |    8 #include "src/types-inl.h" | 
|    9  |    9  | 
|   10 namespace v8 { |   10 namespace v8 { | 
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  306   if (this->IsUnion()) { |  306   if (this->IsUnion()) { | 
|  307     UnionHandle unioned = handle(this->AsUnion()); |  307     UnionHandle unioned = handle(this->AsUnion()); | 
|  308     for (int i = 0; i < unioned->Length(); ++i) { |  308     for (int i = 0; i < unioned->Length(); ++i) { | 
|  309       if (!unioned->Get(i)->Is(that)) return false; |  309       if (!unioned->Get(i)->Is(that)) return false; | 
|  310     } |  310     } | 
|  311     return true; |  311     return true; | 
|  312   } |  312   } | 
|  313  |  313  | 
|  314   // T <= (T1 \/ ... \/ Tn)  <=>  (T <= T1) \/ ... \/ (T <= Tn) |  314   // T <= (T1 \/ ... \/ Tn)  <=>  (T <= T1) \/ ... \/ (T <= Tn) | 
|  315   // (iff T is not a union) |  315   // (iff T is not a union) | 
|  316   ASSERT(!this->IsUnion()); |  316   ASSERT(!this->IsUnion() && that->IsUnion()); | 
|  317   if (that->IsUnion()) { |  317   UnionHandle unioned = handle(that->AsUnion()); | 
|  318     UnionHandle unioned = handle(that->AsUnion()); |  318   for (int i = 0; i < unioned->Length(); ++i) { | 
|  319     for (int i = 0; i < unioned->Length(); ++i) { |  319     if (this->Is(unioned->Get(i))) return true; | 
|  320       if (this->Is(unioned->Get(i))) return true; |  320     if (this->IsBitset()) break;  // Fast fail, only first field is a bitset. | 
|  321       if (this->IsBitset()) break;  // Fast fail, only first field is a bitset. |  | 
|  322     } |  | 
|  323     return false; |  | 
|  324   } |  321   } | 
|  325  |  | 
|  326   return false; |  322   return false; | 
|  327 } |  323 } | 
|  328  |  324  | 
|  329  |  325  | 
|  330 template<class Config> |  326 template<class Config> | 
|  331 bool TypeImpl<Config>::NowIs(TypeImpl* that) { |  327 bool TypeImpl<Config>::NowIs(TypeImpl* that) { | 
|  332   DisallowHeapAllocation no_allocation; |  328   DisallowHeapAllocation no_allocation; | 
|  333  |  329  | 
|  334   // TODO(rossberg): this is incorrect for |  330   // TODO(rossberg): this is incorrect for | 
|  335   //   Union(Constant(V), T)->NowIs(Class(M)) |  331   //   Union(Constant(V), T)->NowIs(Class(M)) | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  375   // T overlaps (T1 \/ ... \/ Tn) <=> (T overlaps T1) \/ ... \/ (T overlaps Tn) |  371   // T overlaps (T1 \/ ... \/ Tn) <=> (T overlaps T1) \/ ... \/ (T overlaps Tn) | 
|  376   if (that->IsUnion()) { |  372   if (that->IsUnion()) { | 
|  377     UnionHandle unioned = handle(that->AsUnion()); |  373     UnionHandle unioned = handle(that->AsUnion()); | 
|  378     for (int i = 0; i < unioned->Length(); ++i) { |  374     for (int i = 0; i < unioned->Length(); ++i) { | 
|  379       if (this->Maybe(unioned->Get(i))) return true; |  375       if (this->Maybe(unioned->Get(i))) return true; | 
|  380     } |  376     } | 
|  381     return false; |  377     return false; | 
|  382   } |  378   } | 
|  383  |  379  | 
|  384   ASSERT(!this->IsUnion() && !that->IsUnion()); |  380   ASSERT(!this->IsUnion() && !that->IsUnion()); | 
|  385   if (this->IsBitset()) { |  381   if (this->IsBitset() || that->IsBitset()) { | 
|  386     return BitsetType::IsInhabited(this->AsBitset() & that->BitsetLub()); |  382     return BitsetType::IsInhabited(this->BitsetLub() & that->BitsetLub()); | 
|  387   } |  | 
|  388   if (that->IsBitset()) { |  | 
|  389     return BitsetType::IsInhabited(this->BitsetLub() & that->AsBitset()); |  | 
|  390   } |  383   } | 
|  391   if (this->IsClass()) { |  384   if (this->IsClass()) { | 
|  392     return that->IsClass() |  385     return that->IsClass() | 
|  393         && *this->AsClass()->Map() == *that->AsClass()->Map(); |  386         && *this->AsClass()->Map() == *that->AsClass()->Map(); | 
|  394   } |  387   } | 
|  395   if (this->IsConstant()) { |  388   if (this->IsConstant()) { | 
|  396     return that->IsConstant() |  389     return that->IsConstant() | 
|  397         && *this->AsConstant()->Value() == *that->AsConstant()->Value(); |  390         && *this->AsConstant()->Value() == *that->AsConstant()->Value(); | 
|  398   } |  391   } | 
|  399   if (this->IsContext()) { |  392   if (this->IsContext()) { | 
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  968 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>; |  961 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>; | 
|  969  |  962  | 
|  970 template TypeImpl<ZoneTypeConfig>::TypeHandle |  963 template TypeImpl<ZoneTypeConfig>::TypeHandle | 
|  971   TypeImpl<ZoneTypeConfig>::Convert<HeapType>( |  964   TypeImpl<ZoneTypeConfig>::Convert<HeapType>( | 
|  972     TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*); |  965     TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*); | 
|  973 template TypeImpl<HeapTypeConfig>::TypeHandle |  966 template TypeImpl<HeapTypeConfig>::TypeHandle | 
|  974   TypeImpl<HeapTypeConfig>::Convert<Type>( |  967   TypeImpl<HeapTypeConfig>::Convert<Type>( | 
|  975     TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*); |  968     TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*); | 
|  976  |  969  | 
|  977 } }  // namespace v8::internal |  970 } }  // namespace v8::internal | 
| OLD | NEW |