| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/objects.h" | 5 #include "src/objects.h" |
| 6 | 6 |
| 7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
| 8 #include "src/disasm.h" | 8 #include "src/disasm.h" |
| 9 #include "src/disassembler.h" | 9 #include "src/disassembler.h" |
| 10 #include "src/field-type.h" | 10 #include "src/field-type.h" |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 void String::StringVerify() { | 552 void String::StringVerify() { |
| 553 CHECK(IsString()); | 553 CHECK(IsString()); |
| 554 CHECK(length() >= 0 && length() <= Smi::kMaxValue); | 554 CHECK(length() >= 0 && length() <= Smi::kMaxValue); |
| 555 if (IsInternalizedString()) { | 555 if (IsInternalizedString()) { |
| 556 CHECK(!GetHeap()->InNewSpace(this)); | 556 CHECK(!GetHeap()->InNewSpace(this)); |
| 557 } | 557 } |
| 558 if (IsConsString()) { | 558 if (IsConsString()) { |
| 559 ConsString::cast(this)->ConsStringVerify(); | 559 ConsString::cast(this)->ConsStringVerify(); |
| 560 } else if (IsSlicedString()) { | 560 } else if (IsSlicedString()) { |
| 561 SlicedString::cast(this)->SlicedStringVerify(); | 561 SlicedString::cast(this)->SlicedStringVerify(); |
| 562 } else if (IsThinString()) { |
| 563 ThinString::cast(this)->ThinStringVerify(); |
| 562 } | 564 } |
| 563 } | 565 } |
| 564 | 566 |
| 565 | 567 |
| 566 void ConsString::ConsStringVerify() { | 568 void ConsString::ConsStringVerify() { |
| 567 CHECK(this->first()->IsString()); | 569 CHECK(this->first()->IsString()); |
| 568 CHECK(this->second() == GetHeap()->empty_string() || | 570 CHECK(this->second() == GetHeap()->empty_string() || |
| 569 this->second()->IsString()); | 571 this->second()->IsString()); |
| 570 CHECK(this->length() >= ConsString::kMinLength); | 572 CHECK(this->length() >= ConsString::kMinLength); |
| 571 CHECK(this->length() == this->first()->length() + this->second()->length()); | 573 CHECK(this->length() == this->first()->length() + this->second()->length()); |
| 572 if (this->IsFlat()) { | 574 if (this->IsFlat()) { |
| 573 // A flat cons can only be created by String::SlowTryFlatten. | 575 // A flat cons can only be created by String::SlowFlatten. |
| 574 // Afterwards, the first part may be externalized. | 576 // Afterwards, the first part may be externalized or internalized. |
| 575 CHECK(this->first()->IsSeqString() || this->first()->IsExternalString()); | 577 CHECK(this->first()->IsSeqString() || this->first()->IsExternalString() || |
| 578 this->first()->IsThinString()); |
| 576 } | 579 } |
| 577 } | 580 } |
| 578 | 581 |
| 582 void ThinString::ThinStringVerify() { |
| 583 CHECK(this->actual()->IsInternalizedString()); |
| 584 CHECK(this->actual()->IsSeqString() || this->actual()->IsExternalString()); |
| 585 } |
| 579 | 586 |
| 580 void SlicedString::SlicedStringVerify() { | 587 void SlicedString::SlicedStringVerify() { |
| 581 CHECK(!this->parent()->IsConsString()); | 588 CHECK(!this->parent()->IsConsString()); |
| 582 CHECK(!this->parent()->IsSlicedString()); | 589 CHECK(!this->parent()->IsSlicedString()); |
| 583 CHECK(this->length() >= SlicedString::kMinLength); | 590 CHECK(this->length() >= SlicedString::kMinLength); |
| 584 } | 591 } |
| 585 | 592 |
| 586 | 593 |
| 587 void JSBoundFunction::JSBoundFunctionVerify() { | 594 void JSBoundFunction::JSBoundFunctionVerify() { |
| 588 CHECK(IsJSBoundFunction()); | 595 CHECK(IsJSBoundFunction()); |
| (...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1556 | 1563 |
| 1557 // Both are done at the same time. | 1564 // Both are done at the same time. |
| 1558 CHECK_EQ(new_it.done(), old_it.done()); | 1565 CHECK_EQ(new_it.done(), old_it.done()); |
| 1559 } | 1566 } |
| 1560 | 1567 |
| 1561 | 1568 |
| 1562 #endif // DEBUG | 1569 #endif // DEBUG |
| 1563 | 1570 |
| 1564 } // namespace internal | 1571 } // namespace internal |
| 1565 } // namespace v8 | 1572 } // namespace v8 |
| OLD | NEW |