Chromium Code Reviews| Index: src/objects-debug.cc |
| diff --git a/src/objects-debug.cc b/src/objects-debug.cc |
| index 29632317a5e9309ee456c2e0ce9042b0b4c48cdf..5b249aca115030716a4bd3a5b52f24ff6a4f02a8 100644 |
| --- a/src/objects-debug.cc |
| +++ b/src/objects-debug.cc |
| @@ -349,6 +349,29 @@ void String::StringVerify() { |
| if (IsSymbol()) { |
| CHECK(!HEAP->InNewSpace(this)); |
| } |
| + if (IsConsString()) { |
| + ConsString::cast(this)->ConsStringVerify(); |
| + } else if (IsSlicedString()) { |
| + SlicedString::cast(this)->SlicedStringVerify(); |
| + } |
| +} |
| + |
| + |
| +void ConsString::ConsStringVerify() { |
| + CHECK(this->first()->IsString()); |
| + CHECK(this->second() == GetHeap()->empty_string() || |
| + this->second()->IsString()); |
| + if (this->IsFlat()) { |
| + // A flat cons can only be created by String::SlowTryFlatten. |
| + // Afterwards, the first part may be externalized. |
| + CHECK(this->first()->IsSeqString() || this->first()->IsExternalString()); |
| + } |
| +} |
| + |
| + |
| +void SlicedString::SlicedStringVerify() { |
| + CHECK(!this->parent()->IsConsString()); |
| + CHECK(!this->parent()->IsSlicedString()); |
|
Vitaly Repeshko
2011/08/17 19:20:23
Add a min length check?
|
| } |