| 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 VerifyObjectField(kStackFramesOffset); | 342 VerifyObjectField(kStackFramesOffset); |
| 343 } | 343 } |
| 344 | 344 |
| 345 | 345 |
| 346 void String::StringVerify() { | 346 void String::StringVerify() { |
| 347 CHECK(IsString()); | 347 CHECK(IsString()); |
| 348 CHECK(length() >= 0 && length() <= Smi::kMaxValue); | 348 CHECK(length() >= 0 && length() <= Smi::kMaxValue); |
| 349 if (IsSymbol()) { | 349 if (IsSymbol()) { |
| 350 CHECK(!HEAP->InNewSpace(this)); | 350 CHECK(!HEAP->InNewSpace(this)); |
| 351 } | 351 } |
| 352 if (IsConsString()) { |
| 353 ConsString::cast(this)->ConsStringVerify(); |
| 354 } else if (IsSlicedString()) { |
| 355 SlicedString::cast(this)->SlicedStringVerify(); |
| 356 } |
| 352 } | 357 } |
| 353 | 358 |
| 354 | 359 |
| 360 void ConsString::ConsStringVerify() { |
| 361 CHECK(this->first()->IsString()); |
| 362 CHECK(this->second() == GetHeap()->empty_string() || |
| 363 this->second()->IsString()); |
| 364 CHECK(this->length() >= String::kMinNonFlatLength); |
| 365 if (this->IsFlat()) { |
| 366 // A flat cons can only be created by String::SlowTryFlatten. |
| 367 // Afterwards, the first part may be externalized. |
| 368 CHECK(this->first()->IsSeqString() || this->first()->IsExternalString()); |
| 369 } |
| 370 } |
| 371 |
| 372 |
| 373 void SlicedString::SlicedStringVerify() { |
| 374 CHECK(!this->parent()->IsConsString()); |
| 375 CHECK(!this->parent()->IsSlicedString()); |
| 376 CHECK(this->length() >= SlicedString::kMinLength); |
| 377 } |
| 378 |
| 379 |
| 355 void JSFunction::JSFunctionVerify() { | 380 void JSFunction::JSFunctionVerify() { |
| 356 CHECK(IsJSFunction()); | 381 CHECK(IsJSFunction()); |
| 357 VerifyObjectField(kPrototypeOrInitialMapOffset); | 382 VerifyObjectField(kPrototypeOrInitialMapOffset); |
| 358 VerifyObjectField(kNextFunctionLinkOffset); | 383 VerifyObjectField(kNextFunctionLinkOffset); |
| 359 CHECK(next_function_link()->IsUndefined() || | 384 CHECK(next_function_link()->IsUndefined() || |
| 360 next_function_link()->IsJSFunction()); | 385 next_function_link()->IsJSFunction()); |
| 361 } | 386 } |
| 362 | 387 |
| 363 | 388 |
| 364 void SharedFunctionInfo::SharedFunctionInfoVerify() { | 389 void SharedFunctionInfo::SharedFunctionInfoVerify() { |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 ASSERT(e->IsUndefined()); | 785 ASSERT(e->IsUndefined()); |
| 761 } | 786 } |
| 762 } | 787 } |
| 763 } | 788 } |
| 764 } | 789 } |
| 765 | 790 |
| 766 | 791 |
| 767 #endif // DEBUG | 792 #endif // DEBUG |
| 768 | 793 |
| 769 } } // namespace v8::internal | 794 } } // namespace v8::internal |
| OLD | NEW |