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