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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
545 void String::StringVerify() { | 545 void String::StringVerify() { |
546 CHECK(IsString()); | 546 CHECK(IsString()); |
547 CHECK(length() >= 0 && length() <= Smi::kMaxValue); | 547 CHECK(length() >= 0 && length() <= Smi::kMaxValue); |
548 if (IsInternalizedString()) { | 548 if (IsInternalizedString()) { |
549 CHECK(!GetHeap()->InNewSpace(this)); | 549 CHECK(!GetHeap()->InNewSpace(this)); |
550 } | 550 } |
551 if (IsConsString()) { | 551 if (IsConsString()) { |
552 ConsString::cast(this)->ConsStringVerify(); | 552 ConsString::cast(this)->ConsStringVerify(); |
553 } else if (IsSlicedString()) { | 553 } else if (IsSlicedString()) { |
554 SlicedString::cast(this)->SlicedStringVerify(); | 554 SlicedString::cast(this)->SlicedStringVerify(); |
555 } | 555 } |
Igor Sheludko
2016/12/20 23:46:58
} else if (IsThinString()) {
ThinString::cast(th
Jakob Kummerow
2017/01/04 12:45:06
Done.
| |
556 } | 556 } |
557 | 557 |
558 | 558 |
559 void ConsString::ConsStringVerify() { | 559 void ConsString::ConsStringVerify() { |
560 CHECK(this->first()->IsString()); | 560 CHECK(this->first()->IsString()); |
561 CHECK(this->second() == GetHeap()->empty_string() || | 561 CHECK(this->second() == GetHeap()->empty_string() || |
562 this->second()->IsString()); | 562 this->second()->IsString()); |
563 CHECK(this->length() >= ConsString::kMinLength); | 563 CHECK(this->length() >= ConsString::kMinLength); |
564 CHECK(this->length() == this->first()->length() + this->second()->length()); | 564 CHECK(this->length() == this->first()->length() + this->second()->length()); |
565 if (this->IsFlat()) { | 565 if (this->IsFlat()) { |
566 // A flat cons can only be created by String::SlowTryFlatten. | 566 // A flat cons can only be created by String::SlowFlatten. |
567 // Afterwards, the first part may be externalized. | 567 // Afterwards, the first part may be externalized or internalized. |
568 CHECK(this->first()->IsSeqString() || this->first()->IsExternalString()); | 568 CHECK(this->first()->IsSeqString() || this->first()->IsExternalString() || |
569 this->first()->IsThinString()); | |
569 } | 570 } |
570 } | 571 } |
571 | 572 |
572 | 573 |
573 void SlicedString::SlicedStringVerify() { | 574 void SlicedString::SlicedStringVerify() { |
574 CHECK(!this->parent()->IsConsString()); | 575 CHECK(!this->parent()->IsConsString()); |
575 CHECK(!this->parent()->IsSlicedString()); | 576 CHECK(!this->parent()->IsSlicedString()); |
576 CHECK(this->length() >= SlicedString::kMinLength); | 577 CHECK(this->length() >= SlicedString::kMinLength); |
577 } | 578 } |
578 | 579 |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1529 | 1530 |
1530 // Both are done at the same time. | 1531 // Both are done at the same time. |
1531 CHECK_EQ(new_it.done(), old_it.done()); | 1532 CHECK_EQ(new_it.done(), old_it.done()); |
1532 } | 1533 } |
1533 | 1534 |
1534 | 1535 |
1535 #endif // DEBUG | 1536 #endif // DEBUG |
1536 | 1537 |
1537 } // namespace internal | 1538 } // namespace internal |
1538 } // namespace v8 | 1539 } // namespace v8 |
OLD | NEW |