| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 void String::StringVerify() { | 373 void String::StringVerify() { |
| 374 CHECK(IsString()); | 374 CHECK(IsString()); |
| 375 CHECK(length() >= 0 && length() <= Smi::kMaxValue); | 375 CHECK(length() >= 0 && length() <= Smi::kMaxValue); |
| 376 if (IsSymbol()) { | 376 if (IsSymbol()) { |
| 377 CHECK(!HEAP->InNewSpace(this)); | 377 CHECK(!HEAP->InNewSpace(this)); |
| 378 } | 378 } |
| 379 if (IsConsString()) { | 379 if (IsConsString()) { |
| 380 ConsString::cast(this)->ConsStringVerify(); | 380 ConsString::cast(this)->ConsStringVerify(); |
| 381 } else if (IsSlicedString()) { | 381 } else if (IsSlicedString()) { |
| 382 SlicedString::cast(this)->SlicedStringVerify(); | 382 SlicedString::cast(this)->SlicedStringVerify(); |
| 383 } else if (IsExternalString()) { |
| 384 ExternalString::cast(this)->ExternalStringVerify(); |
| 383 } | 385 } |
| 384 } | 386 } |
| 385 | 387 |
| 386 | 388 |
| 387 void ConsString::ConsStringVerify() { | 389 void ConsString::ConsStringVerify() { |
| 388 CHECK(this->first()->IsString()); | 390 CHECK(this->first()->IsString()); |
| 389 CHECK(this->second() == GetHeap()->empty_string() || | 391 CHECK(this->second() == GetHeap()->empty_string() || |
| 390 this->second()->IsString()); | 392 this->second()->IsString()); |
| 391 CHECK(this->length() >= String::kMinNonFlatLength); | 393 CHECK(this->length() >= String::kMinNonFlatLength); |
| 392 if (this->IsFlat()) { | 394 if (this->IsFlat()) { |
| 393 // A flat cons can only be created by String::SlowTryFlatten. | 395 // A flat cons can only be created by String::SlowTryFlatten. |
| 394 // Afterwards, the first part may be externalized. | 396 // Afterwards, the first part may be externalized. |
| 395 CHECK(this->first()->IsSeqString() || this->first()->IsExternalString()); | 397 CHECK(this->first()->IsSeqString() || this->first()->IsExternalString()); |
| 396 } | 398 } |
| 397 } | 399 } |
| 398 | 400 |
| 399 | 401 |
| 400 void SlicedString::SlicedStringVerify() { | 402 void SlicedString::SlicedStringVerify() { |
| 401 CHECK(!this->parent()->IsConsString()); | 403 CHECK(!this->parent()->IsConsString()); |
| 402 CHECK(!this->parent()->IsSlicedString()); | 404 CHECK(!this->parent()->IsSlicedString()); |
| 403 CHECK(this->length() >= SlicedString::kMinLength); | 405 CHECK(this->length() >= SlicedString::kMinLength); |
| 404 } | 406 } |
| 405 | 407 |
| 406 | 408 |
| 409 void ExternalString::ExternalStringVerify() { |
| 410 if (IsBuffered()) { |
| 411 CHECK(length() >= kMinBufferedStringLength); |
| 412 int index = buffer_index(); |
| 413 CHECK(index == kInvalidBufferIndex || (index >= 0 && index < length())); |
| 414 } |
| 415 } |
| 416 |
| 417 |
| 407 void JSFunction::JSFunctionVerify() { | 418 void JSFunction::JSFunctionVerify() { |
| 408 CHECK(IsJSFunction()); | 419 CHECK(IsJSFunction()); |
| 409 VerifyObjectField(kPrototypeOrInitialMapOffset); | 420 VerifyObjectField(kPrototypeOrInitialMapOffset); |
| 410 VerifyObjectField(kNextFunctionLinkOffset); | 421 VerifyObjectField(kNextFunctionLinkOffset); |
| 411 CHECK(code()->IsCode()); | 422 CHECK(code()->IsCode()); |
| 412 CHECK(next_function_link()->IsUndefined() || | 423 CHECK(next_function_link()->IsUndefined() || |
| 413 next_function_link()->IsJSFunction()); | 424 next_function_link()->IsJSFunction()); |
| 414 } | 425 } |
| 415 | 426 |
| 416 | 427 |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 ASSERT(e->IsUndefined()); | 858 ASSERT(e->IsUndefined()); |
| 848 } | 859 } |
| 849 } | 860 } |
| 850 } | 861 } |
| 851 } | 862 } |
| 852 | 863 |
| 853 | 864 |
| 854 #endif // DEBUG | 865 #endif // DEBUG |
| 855 | 866 |
| 856 } } // namespace v8::internal | 867 } } // namespace v8::internal |
| OLD | NEW |