OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 void String::StringVerify() { | 479 void String::StringVerify() { |
480 CHECK(IsString()); | 480 CHECK(IsString()); |
481 CHECK(length() >= 0 && length() <= Smi::kMaxValue); | 481 CHECK(length() >= 0 && length() <= Smi::kMaxValue); |
482 if (IsInternalizedString()) { | 482 if (IsInternalizedString()) { |
483 CHECK(!HEAP->InNewSpace(this)); | 483 CHECK(!HEAP->InNewSpace(this)); |
484 } | 484 } |
485 if (IsConsString()) { | 485 if (IsConsString()) { |
486 ConsString::cast(this)->ConsStringVerify(); | 486 ConsString::cast(this)->ConsStringVerify(); |
487 } else if (IsSlicedString()) { | 487 } else if (IsSlicedString()) { |
488 SlicedString::cast(this)->SlicedStringVerify(); | 488 SlicedString::cast(this)->SlicedStringVerify(); |
489 } else if (IsSeqOneByteString()) { | |
490 SeqOneByteString::cast(this)->SeqOneByteStringVerify(); | |
491 } | 489 } |
492 } | 490 } |
493 | 491 |
494 | 492 |
495 void SeqOneByteString::SeqOneByteStringVerify() { | |
496 #ifndef ENABLE_LATIN_1 | |
497 CHECK(String::IsAscii(GetChars(), length())); | |
498 #endif | |
499 } | |
500 | |
501 | |
502 void ConsString::ConsStringVerify() { | 493 void ConsString::ConsStringVerify() { |
503 CHECK(this->first()->IsString()); | 494 CHECK(this->first()->IsString()); |
504 CHECK(this->second() == GetHeap()->empty_string() || | 495 CHECK(this->second() == GetHeap()->empty_string() || |
505 this->second()->IsString()); | 496 this->second()->IsString()); |
506 CHECK(this->length() >= ConsString::kMinLength); | 497 CHECK(this->length() >= ConsString::kMinLength); |
507 if (this->IsFlat()) { | 498 if (this->IsFlat()) { |
508 // A flat cons can only be created by String::SlowTryFlatten. | 499 // A flat cons can only be created by String::SlowTryFlatten. |
509 // Afterwards, the first part may be externalized. | 500 // Afterwards, the first part may be externalized. |
510 CHECK(this->first()->IsSeqString() || this->first()->IsExternalString()); | 501 CHECK(this->first()->IsSeqString() || this->first()->IsExternalString()); |
511 } | 502 } |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 for (int i = 0; i < number_of_transitions(); ++i) { | 1059 for (int i = 0; i < number_of_transitions(); ++i) { |
1069 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; | 1060 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; |
1070 } | 1061 } |
1071 return true; | 1062 return true; |
1072 } | 1063 } |
1073 | 1064 |
1074 | 1065 |
1075 #endif // DEBUG | 1066 #endif // DEBUG |
1076 | 1067 |
1077 } } // namespace v8::internal | 1068 } } // namespace v8::internal |
OLD | NEW |