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 if (this->IsFlat()) { |
| 365 // A flat cons can only have a sequential string as first part because only |
| 366 // String::SlowTryFlatten can convert a cons into a flat cons. |
| 367 CHECK(this->first()->IsSeqString()); |
| 368 } |
| 369 } |
| 370 |
| 371 |
| 372 void SlicedString::SlicedStringVerify() { |
| 373 CHECK(!this->parent()->IsConsString()); |
| 374 CHECK(!this->parent()->IsSlicedString()); |
| 375 if (this->IsTruncated()) { |
| 376 CHECK(this->offset() == 0); |
| 377 // A truncated slice cannot have an external string as parent because only |
| 378 // String::SlowTryTruncate can convert a slice into a truncated slice. |
| 379 // There is no way to gain direct access to the truncated parent string, |
| 380 // therefore the truncated parent cannot be morphed into an external string. |
| 381 CHECK(this->parent()->IsSeqString()); |
| 382 } |
| 383 } |
| 384 |
| 385 |
355 void JSFunction::JSFunctionVerify() { | 386 void JSFunction::JSFunctionVerify() { |
356 CHECK(IsJSFunction()); | 387 CHECK(IsJSFunction()); |
357 VerifyObjectField(kPrototypeOrInitialMapOffset); | 388 VerifyObjectField(kPrototypeOrInitialMapOffset); |
358 VerifyObjectField(kNextFunctionLinkOffset); | 389 VerifyObjectField(kNextFunctionLinkOffset); |
359 CHECK(next_function_link()->IsUndefined() || | 390 CHECK(next_function_link()->IsUndefined() || |
360 next_function_link()->IsJSFunction()); | 391 next_function_link()->IsJSFunction()); |
361 } | 392 } |
362 | 393 |
363 | 394 |
364 void SharedFunctionInfo::SharedFunctionInfoVerify() { | 395 void SharedFunctionInfo::SharedFunctionInfoVerify() { |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 ASSERT(e->IsUndefined()); | 791 ASSERT(e->IsUndefined()); |
761 } | 792 } |
762 } | 793 } |
763 } | 794 } |
764 } | 795 } |
765 | 796 |
766 | 797 |
767 #endif // DEBUG | 798 #endif // DEBUG |
768 | 799 |
769 } } // namespace v8::internal | 800 } } // namespace v8::internal |
OLD | NEW |