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 be created by String::SlowTryFlatten. | |
366 // Afterwards, the first part may be externalized. | |
367 CHECK(this->first()->IsSeqString() || this->first()->IsExternalString()); | |
368 } | |
369 } | |
370 | |
371 | |
372 void SlicedString::SlicedStringVerify() { | |
373 CHECK(!this->parent()->IsConsString()); | |
374 CHECK(!this->parent()->IsSlicedString()); | |
Vitaly Repeshko
2011/08/17 19:20:23
Add a min length check?
| |
375 } | |
376 | |
377 | |
355 void JSFunction::JSFunctionVerify() { | 378 void JSFunction::JSFunctionVerify() { |
356 CHECK(IsJSFunction()); | 379 CHECK(IsJSFunction()); |
357 VerifyObjectField(kPrototypeOrInitialMapOffset); | 380 VerifyObjectField(kPrototypeOrInitialMapOffset); |
358 VerifyObjectField(kNextFunctionLinkOffset); | 381 VerifyObjectField(kNextFunctionLinkOffset); |
359 CHECK(next_function_link()->IsUndefined() || | 382 CHECK(next_function_link()->IsUndefined() || |
360 next_function_link()->IsJSFunction()); | 383 next_function_link()->IsJSFunction()); |
361 } | 384 } |
362 | 385 |
363 | 386 |
364 void SharedFunctionInfo::SharedFunctionInfoVerify() { | 387 void SharedFunctionInfo::SharedFunctionInfoVerify() { |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
760 ASSERT(e->IsUndefined()); | 783 ASSERT(e->IsUndefined()); |
761 } | 784 } |
762 } | 785 } |
763 } | 786 } |
764 } | 787 } |
765 | 788 |
766 | 789 |
767 #endif // DEBUG | 790 #endif // DEBUG |
768 | 791 |
769 } } // namespace v8::internal | 792 } } // namespace v8::internal |
OLD | NEW |