| 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/ostreams.h" | 7 #include "src/ostreams.h" |
| 8 #include "src/types-inl.h" | 8 #include "src/types-inl.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 if (IsUint32Double(value)) { | 126 if (IsUint32Double(value)) { |
| 127 uint32_t u = FastD2UI(value); | 127 uint32_t u = FastD2UI(value); |
| 128 if (u < 0x40000000u) return kUnsignedSmall; | 128 if (u < 0x40000000u) return kUnsignedSmall; |
| 129 if (u < 0x80000000u) { | 129 if (u < 0x80000000u) { |
| 130 return i::SmiValuesAre31Bits() ? kOtherUnsigned31 : kUnsignedSmall; | 130 return i::SmiValuesAre31Bits() ? kOtherUnsigned31 : kUnsignedSmall; |
| 131 } | 131 } |
| 132 return kOtherUnsigned32; | 132 return kOtherUnsigned32; |
| 133 } | 133 } |
| 134 if (IsInt32Double(value)) { | 134 if (IsInt32Double(value)) { |
| 135 int32_t i = FastD2I(value); | 135 int32_t i = FastD2I(value); |
| 136 ASSERT(i < 0); | 136 DCHECK(i < 0); |
| 137 if (i >= -0x40000000) return kOtherSignedSmall; | 137 if (i >= -0x40000000) return kOtherSignedSmall; |
| 138 return i::SmiValuesAre31Bits() ? kOtherSigned32 : kOtherSignedSmall; | 138 return i::SmiValuesAre31Bits() ? kOtherSigned32 : kOtherSignedSmall; |
| 139 } | 139 } |
| 140 return kOtherNumber; | 140 return kOtherNumber; |
| 141 } | 141 } |
| 142 | 142 |
| 143 | 143 |
| 144 template<class Config> | 144 template<class Config> |
| 145 int TypeImpl<Config>::BitsetType::Lub(i::Map* map) { | 145 int TypeImpl<Config>::BitsetType::Lub(i::Map* map) { |
| 146 DisallowHeapAllocation no_allocation; | 146 DisallowHeapAllocation no_allocation; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 166 case SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE: | 166 case SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE: |
| 167 case SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE: | 167 case SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE: |
| 168 return kString; | 168 return kString; |
| 169 case SYMBOL_TYPE: | 169 case SYMBOL_TYPE: |
| 170 return kSymbol; | 170 return kSymbol; |
| 171 case ODDBALL_TYPE: { | 171 case ODDBALL_TYPE: { |
| 172 Heap* heap = map->GetHeap(); | 172 Heap* heap = map->GetHeap(); |
| 173 if (map == heap->undefined_map()) return kUndefined; | 173 if (map == heap->undefined_map()) return kUndefined; |
| 174 if (map == heap->null_map()) return kNull; | 174 if (map == heap->null_map()) return kNull; |
| 175 if (map == heap->boolean_map()) return kBoolean; | 175 if (map == heap->boolean_map()) return kBoolean; |
| 176 ASSERT(map == heap->the_hole_map() || | 176 DCHECK(map == heap->the_hole_map() || |
| 177 map == heap->uninitialized_map() || | 177 map == heap->uninitialized_map() || |
| 178 map == heap->no_interceptor_result_sentinel_map() || | 178 map == heap->no_interceptor_result_sentinel_map() || |
| 179 map == heap->termination_exception_map() || | 179 map == heap->termination_exception_map() || |
| 180 map == heap->arguments_marker_map()); | 180 map == heap->arguments_marker_map()); |
| 181 return kInternal & kTaggedPtr; | 181 return kInternal & kTaggedPtr; |
| 182 } | 182 } |
| 183 case HEAP_NUMBER_TYPE: | 183 case HEAP_NUMBER_TYPE: |
| 184 return kNumber & kTaggedPtr; | 184 return kNumber & kTaggedPtr; |
| 185 case JS_VALUE_TYPE: | 185 case JS_VALUE_TYPE: |
| 186 case JS_DATE_TYPE: | 186 case JS_DATE_TYPE: |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 if (this->IsUnion()) { | 297 if (this->IsUnion()) { |
| 298 UnionHandle unioned = handle(this->AsUnion()); | 298 UnionHandle unioned = handle(this->AsUnion()); |
| 299 for (int i = 0; i < unioned->Length(); ++i) { | 299 for (int i = 0; i < unioned->Length(); ++i) { |
| 300 if (!unioned->Get(i)->Is(that)) return false; | 300 if (!unioned->Get(i)->Is(that)) return false; |
| 301 } | 301 } |
| 302 return true; | 302 return true; |
| 303 } | 303 } |
| 304 | 304 |
| 305 // T <= (T1 \/ ... \/ Tn) <=> (T <= T1) \/ ... \/ (T <= Tn) | 305 // T <= (T1 \/ ... \/ Tn) <=> (T <= T1) \/ ... \/ (T <= Tn) |
| 306 // (iff T is not a union) | 306 // (iff T is not a union) |
| 307 ASSERT(!this->IsUnion() && that->IsUnion()); | 307 DCHECK(!this->IsUnion() && that->IsUnion()); |
| 308 UnionHandle unioned = handle(that->AsUnion()); | 308 UnionHandle unioned = handle(that->AsUnion()); |
| 309 for (int i = 0; i < unioned->Length(); ++i) { | 309 for (int i = 0; i < unioned->Length(); ++i) { |
| 310 if (this->Is(unioned->Get(i))) return true; | 310 if (this->Is(unioned->Get(i))) return true; |
| 311 if (this->IsBitset()) break; // Fast fail, only first field is a bitset. | 311 if (this->IsBitset()) break; // Fast fail, only first field is a bitset. |
| 312 } | 312 } |
| 313 return false; | 313 return false; |
| 314 } | 314 } |
| 315 | 315 |
| 316 | 316 |
| 317 template<class Config> | 317 template<class Config> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 361 |
| 362 // T overlaps (T1 \/ ... \/ Tn) <=> (T overlaps T1) \/ ... \/ (T overlaps Tn) | 362 // T overlaps (T1 \/ ... \/ Tn) <=> (T overlaps T1) \/ ... \/ (T overlaps Tn) |
| 363 if (that->IsUnion()) { | 363 if (that->IsUnion()) { |
| 364 UnionHandle unioned = handle(that->AsUnion()); | 364 UnionHandle unioned = handle(that->AsUnion()); |
| 365 for (int i = 0; i < unioned->Length(); ++i) { | 365 for (int i = 0; i < unioned->Length(); ++i) { |
| 366 if (this->Maybe(unioned->Get(i))) return true; | 366 if (this->Maybe(unioned->Get(i))) return true; |
| 367 } | 367 } |
| 368 return false; | 368 return false; |
| 369 } | 369 } |
| 370 | 370 |
| 371 ASSERT(!this->IsUnion() && !that->IsUnion()); | 371 DCHECK(!this->IsUnion() && !that->IsUnion()); |
| 372 if (this->IsBitset() || that->IsBitset()) { | 372 if (this->IsBitset() || that->IsBitset()) { |
| 373 return BitsetType::IsInhabited(this->BitsetLub() & that->BitsetLub()); | 373 return BitsetType::IsInhabited(this->BitsetLub() & that->BitsetLub()); |
| 374 } | 374 } |
| 375 if (this->IsClass()) { | 375 if (this->IsClass()) { |
| 376 return that->IsClass() | 376 return that->IsClass() |
| 377 && *this->AsClass()->Map() == *that->AsClass()->Map(); | 377 && *this->AsClass()->Map() == *that->AsClass()->Map(); |
| 378 } | 378 } |
| 379 if (this->IsConstant()) { | 379 if (this->IsConstant()) { |
| 380 return that->IsConstant() | 380 return that->IsConstant() |
| 381 && *this->AsConstant()->Value() == *that->AsConstant()->Value(); | 381 && *this->AsConstant()->Value() == *that->AsConstant()->Value(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 402 DisallowHeapAllocation no_allocation; | 402 DisallowHeapAllocation no_allocation; |
| 403 for (Iterator<i::Object> it = this->Constants(); !it.Done(); it.Advance()) { | 403 for (Iterator<i::Object> it = this->Constants(); !it.Done(); it.Advance()) { |
| 404 if (*it.Current() == value) return true; | 404 if (*it.Current() == value) return true; |
| 405 } | 405 } |
| 406 return BitsetType::New(BitsetType::Lub(value))->Is(this); | 406 return BitsetType::New(BitsetType::Lub(value))->Is(this); |
| 407 } | 407 } |
| 408 | 408 |
| 409 | 409 |
| 410 template<class Config> | 410 template<class Config> |
| 411 bool TypeImpl<Config>::UnionType::Wellformed() { | 411 bool TypeImpl<Config>::UnionType::Wellformed() { |
| 412 ASSERT(this->Length() >= 2); | 412 DCHECK(this->Length() >= 2); |
| 413 for (int i = 0; i < this->Length(); ++i) { | 413 for (int i = 0; i < this->Length(); ++i) { |
| 414 ASSERT(!this->Get(i)->IsUnion()); | 414 DCHECK(!this->Get(i)->IsUnion()); |
| 415 if (i > 0) ASSERT(!this->Get(i)->IsBitset()); | 415 if (i > 0) DCHECK(!this->Get(i)->IsBitset()); |
| 416 for (int j = 0; j < this->Length(); ++j) { | 416 for (int j = 0; j < this->Length(); ++j) { |
| 417 if (i != j) ASSERT(!this->Get(i)->Is(this->Get(j))); | 417 if (i != j) DCHECK(!this->Get(i)->Is(this->Get(j))); |
| 418 } | 418 } |
| 419 } | 419 } |
| 420 return true; | 420 return true; |
| 421 } | 421 } |
| 422 | 422 |
| 423 | 423 |
| 424 // ----------------------------------------------------------------------------- | 424 // ----------------------------------------------------------------------------- |
| 425 // Union and intersection | 425 // Union and intersection |
| 426 | 426 |
| 427 template<class Config> | 427 template<class Config> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 446 } | 446 } |
| 447 return type; | 447 return type; |
| 448 } | 448 } |
| 449 UNREACHABLE(); | 449 UNREACHABLE(); |
| 450 return TypeHandle(); | 450 return TypeHandle(); |
| 451 } | 451 } |
| 452 | 452 |
| 453 | 453 |
| 454 template<class Config> | 454 template<class Config> |
| 455 int TypeImpl<Config>::BoundBy(TypeImpl* that) { | 455 int TypeImpl<Config>::BoundBy(TypeImpl* that) { |
| 456 ASSERT(!this->IsUnion()); | 456 DCHECK(!this->IsUnion()); |
| 457 if (that->IsUnion()) { | 457 if (that->IsUnion()) { |
| 458 UnionType* unioned = that->AsUnion(); | 458 UnionType* unioned = that->AsUnion(); |
| 459 int length = unioned->Length(); | 459 int length = unioned->Length(); |
| 460 int bitset = BitsetType::kNone; | 460 int bitset = BitsetType::kNone; |
| 461 for (int i = 0; i < length; ++i) { | 461 for (int i = 0; i < length; ++i) { |
| 462 bitset |= BoundBy(unioned->Get(i)->unhandle()); | 462 bitset |= BoundBy(unioned->Get(i)->unhandle()); |
| 463 } | 463 } |
| 464 return bitset; | 464 return bitset; |
| 465 } else if (that->IsClass() && this->IsClass() && | 465 } else if (that->IsClass() && this->IsClass() && |
| 466 *this->AsClass()->Map() == *that->AsClass()->Map()) { | 466 *this->AsClass()->Map() == *that->AsClass()->Map()) { |
| 467 return that->BitsetLub(); | 467 return that->BitsetLub(); |
| 468 } else if (that->IsConstant() && this->IsConstant() && | 468 } else if (that->IsConstant() && this->IsConstant() && |
| 469 *this->AsConstant()->Value() == *that->AsConstant()->Value()) { | 469 *this->AsConstant()->Value() == *that->AsConstant()->Value()) { |
| 470 return that->AsConstant()->Bound()->AsBitset(); | 470 return that->AsConstant()->Bound()->AsBitset(); |
| 471 } else if (that->IsContext() && this->IsContext() && this->Is(that)) { | 471 } else if (that->IsContext() && this->IsContext() && this->Is(that)) { |
| 472 return that->AsContext()->Bound()->AsBitset(); | 472 return that->AsContext()->Bound()->AsBitset(); |
| 473 } else if (that->IsArray() && this->IsArray() && this->Is(that)) { | 473 } else if (that->IsArray() && this->IsArray() && this->Is(that)) { |
| 474 return that->AsArray()->Bound()->AsBitset(); | 474 return that->AsArray()->Bound()->AsBitset(); |
| 475 } else if (that->IsFunction() && this->IsFunction() && this->Is(that)) { | 475 } else if (that->IsFunction() && this->IsFunction() && this->Is(that)) { |
| 476 return that->AsFunction()->Bound()->AsBitset(); | 476 return that->AsFunction()->Bound()->AsBitset(); |
| 477 } | 477 } |
| 478 return that->BitsetGlb(); | 478 return that->BitsetGlb(); |
| 479 } | 479 } |
| 480 | 480 |
| 481 | 481 |
| 482 template<class Config> | 482 template<class Config> |
| 483 int TypeImpl<Config>::IndexInUnion( | 483 int TypeImpl<Config>::IndexInUnion( |
| 484 int bound, UnionHandle unioned, int current_size) { | 484 int bound, UnionHandle unioned, int current_size) { |
| 485 ASSERT(!this->IsUnion()); | 485 DCHECK(!this->IsUnion()); |
| 486 for (int i = 0; i < current_size; ++i) { | 486 for (int i = 0; i < current_size; ++i) { |
| 487 TypeHandle that = unioned->Get(i); | 487 TypeHandle that = unioned->Get(i); |
| 488 if (that->IsBitset()) { | 488 if (that->IsBitset()) { |
| 489 if ((bound | that->AsBitset()) == that->AsBitset()) return i; | 489 if ((bound | that->AsBitset()) == that->AsBitset()) return i; |
| 490 } else if (that->IsClass() && this->IsClass()) { | 490 } else if (that->IsClass() && this->IsClass()) { |
| 491 if (*this->AsClass()->Map() == *that->AsClass()->Map()) return i; | 491 if (*this->AsClass()->Map() == *that->AsClass()->Map()) return i; |
| 492 } else if (that->IsConstant() && this->IsConstant()) { | 492 } else if (that->IsConstant() && this->IsConstant()) { |
| 493 if (*this->AsConstant()->Value() == *that->AsConstant()->Value()) | 493 if (*this->AsConstant()->Value() == *that->AsConstant()->Value()) |
| 494 return i; | 494 return i; |
| 495 } else if (that->IsContext() && this->IsContext()) { | 495 } else if (that->IsContext() && this->IsContext()) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 508 // Store at result starting at index. Returns updated index. | 508 // Store at result starting at index. Returns updated index. |
| 509 template<class Config> | 509 template<class Config> |
| 510 int TypeImpl<Config>::ExtendUnion( | 510 int TypeImpl<Config>::ExtendUnion( |
| 511 UnionHandle result, int size, TypeHandle type, | 511 UnionHandle result, int size, TypeHandle type, |
| 512 TypeHandle other, bool is_intersect, Region* region) { | 512 TypeHandle other, bool is_intersect, Region* region) { |
| 513 int old_size = size; | 513 int old_size = size; |
| 514 if (type->IsUnion()) { | 514 if (type->IsUnion()) { |
| 515 UnionHandle unioned = handle(type->AsUnion()); | 515 UnionHandle unioned = handle(type->AsUnion()); |
| 516 for (int i = 0; i < unioned->Length(); ++i) { | 516 for (int i = 0; i < unioned->Length(); ++i) { |
| 517 TypeHandle type_i = unioned->Get(i); | 517 TypeHandle type_i = unioned->Get(i); |
| 518 ASSERT(i == 0 || !(type_i->IsBitset() || type_i->Is(unioned->Get(0)))); | 518 DCHECK(i == 0 || !(type_i->IsBitset() || type_i->Is(unioned->Get(0)))); |
| 519 if (!type_i->IsBitset()) { | 519 if (!type_i->IsBitset()) { |
| 520 size = ExtendUnion(result, size, type_i, other, is_intersect, region); | 520 size = ExtendUnion(result, size, type_i, other, is_intersect, region); |
| 521 } | 521 } |
| 522 } | 522 } |
| 523 } else if (!type->IsBitset()) { | 523 } else if (!type->IsBitset()) { |
| 524 ASSERT(type->IsClass() || type->IsConstant() || | 524 DCHECK(type->IsClass() || type->IsConstant() || |
| 525 type->IsArray() || type->IsFunction() || type->IsContext()); | 525 type->IsArray() || type->IsFunction() || type->IsContext()); |
| 526 int inherent_bound = type->InherentBitsetLub(); | 526 int inherent_bound = type->InherentBitsetLub(); |
| 527 int old_bound = type->BitsetLub(); | 527 int old_bound = type->BitsetLub(); |
| 528 int other_bound = type->BoundBy(other->unhandle()) & inherent_bound; | 528 int other_bound = type->BoundBy(other->unhandle()) & inherent_bound; |
| 529 int new_bound = | 529 int new_bound = |
| 530 is_intersect ? (old_bound & other_bound) : (old_bound | other_bound); | 530 is_intersect ? (old_bound & other_bound) : (old_bound | other_bound); |
| 531 if (new_bound != BitsetType::kNone) { | 531 if (new_bound != BitsetType::kNone) { |
| 532 int i = type->IndexInUnion(new_bound, result, old_size); | 532 int i = type->IndexInUnion(new_bound, result, old_size); |
| 533 if (i == -1) { | 533 if (i == -1) { |
| 534 i = size++; | 534 i = size++; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 // Slow case: may need to produce a Unioned object. | 589 // Slow case: may need to produce a Unioned object. |
| 590 int size = 0; | 590 int size = 0; |
| 591 if (!type1->IsBitset()) { | 591 if (!type1->IsBitset()) { |
| 592 size += (type1->IsUnion() ? type1->AsUnion()->Length() : 1); | 592 size += (type1->IsUnion() ? type1->AsUnion()->Length() : 1); |
| 593 } | 593 } |
| 594 if (!type2->IsBitset()) { | 594 if (!type2->IsBitset()) { |
| 595 size += (type2->IsUnion() ? type2->AsUnion()->Length() : 1); | 595 size += (type2->IsUnion() ? type2->AsUnion()->Length() : 1); |
| 596 } | 596 } |
| 597 int bitset = type1->BitsetGlb() | type2->BitsetGlb(); | 597 int bitset = type1->BitsetGlb() | type2->BitsetGlb(); |
| 598 if (bitset != BitsetType::kNone) ++size; | 598 if (bitset != BitsetType::kNone) ++size; |
| 599 ASSERT(size >= 1); | 599 DCHECK(size >= 1); |
| 600 | 600 |
| 601 UnionHandle unioned = UnionType::New(size, region); | 601 UnionHandle unioned = UnionType::New(size, region); |
| 602 size = 0; | 602 size = 0; |
| 603 if (bitset != BitsetType::kNone) { | 603 if (bitset != BitsetType::kNone) { |
| 604 unioned->Set(size++, BitsetType::New(bitset, region)); | 604 unioned->Set(size++, BitsetType::New(bitset, region)); |
| 605 } | 605 } |
| 606 size = ExtendUnion(unioned, size, type1, type2, false, region); | 606 size = ExtendUnion(unioned, size, type1, type2, false, region); |
| 607 size = ExtendUnion(unioned, size, type2, type1, false, region); | 607 size = ExtendUnion(unioned, size, type2, type1, false, region); |
| 608 size = NormalizeUnion(unioned, size, bitset); | 608 size = NormalizeUnion(unioned, size, bitset); |
| 609 | 609 |
| 610 if (size == 1) { | 610 if (size == 1) { |
| 611 return unioned->Get(0); | 611 return unioned->Get(0); |
| 612 } else { | 612 } else { |
| 613 unioned->Shrink(size); | 613 unioned->Shrink(size); |
| 614 ASSERT(unioned->Wellformed()); | 614 DCHECK(unioned->Wellformed()); |
| 615 return unioned; | 615 return unioned; |
| 616 } | 616 } |
| 617 } | 617 } |
| 618 | 618 |
| 619 | 619 |
| 620 // Intersection is O(1) on simple bitsets, but O(n*m) on structured unions. | 620 // Intersection is O(1) on simple bitsets, but O(n*m) on structured unions. |
| 621 template<class Config> | 621 template<class Config> |
| 622 typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Intersect( | 622 typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Intersect( |
| 623 TypeHandle type1, TypeHandle type2, Region* region) { | 623 TypeHandle type1, TypeHandle type2, Region* region) { |
| 624 // Fast case: bit sets. | 624 // Fast case: bit sets. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 639 // Slow case: may need to produce a Unioned object. | 639 // Slow case: may need to produce a Unioned object. |
| 640 int size = 0; | 640 int size = 0; |
| 641 if (!type1->IsBitset()) { | 641 if (!type1->IsBitset()) { |
| 642 size += (type1->IsUnion() ? type1->AsUnion()->Length() : 1); | 642 size += (type1->IsUnion() ? type1->AsUnion()->Length() : 1); |
| 643 } | 643 } |
| 644 if (!type2->IsBitset()) { | 644 if (!type2->IsBitset()) { |
| 645 size += (type2->IsUnion() ? type2->AsUnion()->Length() : 1); | 645 size += (type2->IsUnion() ? type2->AsUnion()->Length() : 1); |
| 646 } | 646 } |
| 647 int bitset = type1->BitsetGlb() & type2->BitsetGlb(); | 647 int bitset = type1->BitsetGlb() & type2->BitsetGlb(); |
| 648 if (bitset != BitsetType::kNone) ++size; | 648 if (bitset != BitsetType::kNone) ++size; |
| 649 ASSERT(size >= 1); | 649 DCHECK(size >= 1); |
| 650 | 650 |
| 651 UnionHandle unioned = UnionType::New(size, region); | 651 UnionHandle unioned = UnionType::New(size, region); |
| 652 size = 0; | 652 size = 0; |
| 653 if (bitset != BitsetType::kNone) { | 653 if (bitset != BitsetType::kNone) { |
| 654 unioned->Set(size++, BitsetType::New(bitset, region)); | 654 unioned->Set(size++, BitsetType::New(bitset, region)); |
| 655 } | 655 } |
| 656 size = ExtendUnion(unioned, size, type1, type2, true, region); | 656 size = ExtendUnion(unioned, size, type1, type2, true, region); |
| 657 size = ExtendUnion(unioned, size, type2, type1, true, region); | 657 size = ExtendUnion(unioned, size, type2, type1, true, region); |
| 658 size = NormalizeUnion(unioned, size, bitset); | 658 size = NormalizeUnion(unioned, size, bitset); |
| 659 | 659 |
| 660 if (size == 0) { | 660 if (size == 0) { |
| 661 return None(region); | 661 return None(region); |
| 662 } else if (size == 1) { | 662 } else if (size == 1) { |
| 663 return unioned->Get(0); | 663 return unioned->Get(0); |
| 664 } else { | 664 } else { |
| 665 unioned->Shrink(size); | 665 unioned->Shrink(size); |
| 666 ASSERT(unioned->Wellformed()); | 666 DCHECK(unioned->Wellformed()); |
| 667 return unioned; | 667 return unioned; |
| 668 } | 668 } |
| 669 } | 669 } |
| 670 | 670 |
| 671 | 671 |
| 672 // ----------------------------------------------------------------------------- | 672 // ----------------------------------------------------------------------------- |
| 673 // Iteration. | 673 // Iteration. |
| 674 | 674 |
| 675 template<class Config> | 675 template<class Config> |
| 676 int TypeImpl<Config>::NumClasses() { | 676 int TypeImpl<Config>::NumClasses() { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 704 return result; | 704 return result; |
| 705 } else { | 705 } else { |
| 706 return 0; | 706 return 0; |
| 707 } | 707 } |
| 708 } | 708 } |
| 709 | 709 |
| 710 | 710 |
| 711 template<class Config> template<class T> | 711 template<class Config> template<class T> |
| 712 typename TypeImpl<Config>::TypeHandle | 712 typename TypeImpl<Config>::TypeHandle |
| 713 TypeImpl<Config>::Iterator<T>::get_type() { | 713 TypeImpl<Config>::Iterator<T>::get_type() { |
| 714 ASSERT(!Done()); | 714 DCHECK(!Done()); |
| 715 return type_->IsUnion() ? type_->AsUnion()->Get(index_) : type_; | 715 return type_->IsUnion() ? type_->AsUnion()->Get(index_) : type_; |
| 716 } | 716 } |
| 717 | 717 |
| 718 | 718 |
| 719 // C++ cannot specialise nested templates, so we have to go through this | 719 // C++ cannot specialise nested templates, so we have to go through this |
| 720 // contortion with an auxiliary template to simulate it. | 720 // contortion with an auxiliary template to simulate it. |
| 721 template<class Config, class T> | 721 template<class Config, class T> |
| 722 struct TypeImplIteratorAux { | 722 struct TypeImplIteratorAux { |
| 723 static bool matches(typename TypeImpl<Config>::TypeHandle type); | 723 static bool matches(typename TypeImpl<Config>::TypeHandle type); |
| 724 static i::Handle<T> current(typename TypeImpl<Config>::TypeHandle type); | 724 static i::Handle<T> current(typename TypeImpl<Config>::TypeHandle type); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 os << "("; | 868 os << "("; |
| 869 for (int i(ARRAY_SIZE(named_bitsets) - 1); bitset != 0 && i >= 0; --i) { | 869 for (int i(ARRAY_SIZE(named_bitsets) - 1); bitset != 0 && i >= 0; --i) { |
| 870 int subset = named_bitsets[i]; | 870 int subset = named_bitsets[i]; |
| 871 if ((bitset & subset) == subset) { | 871 if ((bitset & subset) == subset) { |
| 872 if (!is_first) os << " | "; | 872 if (!is_first) os << " | "; |
| 873 is_first = false; | 873 is_first = false; |
| 874 os << Name(subset); | 874 os << Name(subset); |
| 875 bitset -= subset; | 875 bitset -= subset; |
| 876 } | 876 } |
| 877 } | 877 } |
| 878 ASSERT(bitset == 0); | 878 DCHECK(bitset == 0); |
| 879 os << ")"; | 879 os << ")"; |
| 880 } | 880 } |
| 881 | 881 |
| 882 | 882 |
| 883 template <class Config> | 883 template <class Config> |
| 884 void TypeImpl<Config>::PrintTo(OStream& os, PrintDimension dim) { // NOLINT | 884 void TypeImpl<Config>::PrintTo(OStream& os, PrintDimension dim) { // NOLINT |
| 885 DisallowHeapAllocation no_allocation; | 885 DisallowHeapAllocation no_allocation; |
| 886 if (dim != REPRESENTATION_DIM) { | 886 if (dim != REPRESENTATION_DIM) { |
| 887 if (this->IsBitset()) { | 887 if (this->IsBitset()) { |
| 888 BitsetType::Print(os, SEMANTIC(this->AsBitset())); | 888 BitsetType::Print(os, SEMANTIC(this->AsBitset())); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>; | 952 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>; |
| 953 | 953 |
| 954 template TypeImpl<ZoneTypeConfig>::TypeHandle | 954 template TypeImpl<ZoneTypeConfig>::TypeHandle |
| 955 TypeImpl<ZoneTypeConfig>::Convert<HeapType>( | 955 TypeImpl<ZoneTypeConfig>::Convert<HeapType>( |
| 956 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*); | 956 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*); |
| 957 template TypeImpl<HeapTypeConfig>::TypeHandle | 957 template TypeImpl<HeapTypeConfig>::TypeHandle |
| 958 TypeImpl<HeapTypeConfig>::Convert<Type>( | 958 TypeImpl<HeapTypeConfig>::Convert<Type>( |
| 959 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*); | 959 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*); |
| 960 | 960 |
| 961 } } // namespace v8::internal | 961 } } // namespace v8::internal |
| OLD | NEW |