| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 } else if (this->is_union()) { | 237 } else if (this->is_union()) { |
| 238 // All but the first are non-bitsets and thus would yield kNone anyway. | 238 // All but the first are non-bitsets and thus would yield kNone anyway. |
| 239 return union_get(this->as_union(), 0)->GlbBitset(); | 239 return union_get(this->as_union(), 0)->GlbBitset(); |
| 240 } else { | 240 } else { |
| 241 return kNone; | 241 return kNone; |
| 242 } | 242 } |
| 243 } | 243 } |
| 244 | 244 |
| 245 | 245 |
| 246 // Most precise _current_ type of a value (usually its class). | 246 // Most precise _current_ type of a value (usually its class). |
| 247 Type* Type::CurrentOf(Handle<i::Object> value) { | 247 Type* Type::OfCurrently(Handle<i::Object> value) { |
| 248 if (value->IsSmi()) return Smi(); | 248 if (value->IsSmi()) return Smi(); |
| 249 i::Map* map = i::HeapObject::cast(*value)->map(); | 249 i::Map* map = i::HeapObject::cast(*value)->map(); |
| 250 if (map->instance_type() == HEAP_NUMBER_TYPE || | 250 if (map->instance_type() == HEAP_NUMBER_TYPE || |
| 251 map->instance_type() == ODDBALL_TYPE) { | 251 map->instance_type() == ODDBALL_TYPE) { |
| 252 return Type::Of(value); | 252 return Type::Of(value); |
| 253 } | 253 } |
| 254 return Class(i::handle(map)); | 254 return Class(i::handle(map)); |
| 255 } | 255 } |
| 256 | 256 |
| 257 | 257 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 if (this->Is(that_i)) return true; | 290 if (this->Is(that_i)) return true; |
| 291 if (this->is_bitset()) break; // Fast fail, no other field is a bitset. | 291 if (this->is_bitset()) break; // Fast fail, no other field is a bitset. |
| 292 } | 292 } |
| 293 return false; | 293 return false; |
| 294 } | 294 } |
| 295 | 295 |
| 296 return false; | 296 return false; |
| 297 } | 297 } |
| 298 | 298 |
| 299 | 299 |
| 300 bool Type::IsCurrently(Type* that) { |
| 301 return this->Is(that) || |
| 302 (this->is_constant() && that->is_class() && |
| 303 this->as_constant()->IsHeapObject() && |
| 304 i::HeapObject::cast(*this->as_constant())->map() == *that->as_class()); |
| 305 } |
| 306 |
| 307 |
| 300 // Check this overlaps that. | 308 // Check this overlaps that. |
| 301 bool Type::Maybe(Type* that) { | 309 bool Type::Maybe(Type* that) { |
| 302 // Fast path for bitsets. | 310 // Fast path for bitsets. |
| 303 if (this->is_bitset()) { | 311 if (this->is_bitset()) { |
| 304 return (this->as_bitset() & that->LubBitset()) != 0; | 312 return (this->as_bitset() & that->LubBitset()) != 0; |
| 305 } | 313 } |
| 306 if (that->is_bitset()) { | 314 if (that->is_bitset()) { |
| 307 return (this->LubBitset() & that->as_bitset()) != 0; | 315 return (this->LubBitset() & that->as_bitset()) != 0; |
| 308 } | 316 } |
| 309 | 317 |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 if (i > 0) PrintF(out, " | "); | 578 if (i > 0) PrintF(out, " | "); |
| 571 type_i->TypePrint(out); | 579 type_i->TypePrint(out); |
| 572 } | 580 } |
| 573 PrintF(out, ")"); | 581 PrintF(out, ")"); |
| 574 } | 582 } |
| 575 } | 583 } |
| 576 #endif | 584 #endif |
| 577 | 585 |
| 578 | 586 |
| 579 } } // namespace v8::internal | 587 } } // namespace v8::internal |
| OLD | NEW |