| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 258 |
| 259 | 259 |
| 260 void JSObject::JSObjectVerify() { | 260 void JSObject::JSObjectVerify() { |
| 261 VerifyHeapPointer(properties()); | 261 VerifyHeapPointer(properties()); |
| 262 VerifyHeapPointer(elements()); | 262 VerifyHeapPointer(elements()); |
| 263 if (HasFastProperties()) { | 263 if (HasFastProperties()) { |
| 264 CHECK_EQ(map()->unused_property_fields(), | 264 CHECK_EQ(map()->unused_property_fields(), |
| 265 (map()->inobject_properties() + properties()->length() - | 265 (map()->inobject_properties() + properties()->length() - |
| 266 map()->NextFreePropertyIndex())); | 266 map()->NextFreePropertyIndex())); |
| 267 } | 267 } |
| 268 ASSERT(map()->has_fast_elements() == | 268 ASSERT_EQ(map()->has_fast_elements(), |
| 269 (elements()->map() == GetHeap()->fixed_array_map() || | 269 (elements()->map() == GetHeap()->fixed_array_map() || |
| 270 elements()->map() == GetHeap()->fixed_cow_array_map())); | 270 elements()->map() == GetHeap()->fixed_cow_array_map())); |
| 271 ASSERT(map()->has_fast_elements() == HasFastElements()); | 271 ASSERT(map()->has_fast_elements() == HasFastElements()); |
| 272 } | 272 } |
| 273 | 273 |
| 274 | 274 |
| 275 void Map::MapVerify() { | 275 void Map::MapVerify() { |
| 276 ASSERT(!HEAP->InNewSpace(this)); | 276 ASSERT(!HEAP->InNewSpace(this)); |
| 277 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); | 277 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); |
| 278 ASSERT(instance_size() == kVariableSizeSentinel || | 278 ASSERT(instance_size() == kVariableSizeSentinel || |
| 279 (kPointerSize <= instance_size() && | 279 (kPointerSize <= instance_size() && |
| 280 instance_size() < HEAP->Capacity())); | 280 instance_size() < HEAP->Capacity())); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 VerifyObjectField(kStackFramesOffset); | 353 VerifyObjectField(kStackFramesOffset); |
| 354 } | 354 } |
| 355 | 355 |
| 356 | 356 |
| 357 void String::StringVerify() { | 357 void String::StringVerify() { |
| 358 CHECK(IsString()); | 358 CHECK(IsString()); |
| 359 CHECK(length() >= 0 && length() <= Smi::kMaxValue); | 359 CHECK(length() >= 0 && length() <= Smi::kMaxValue); |
| 360 if (IsSymbol()) { | 360 if (IsSymbol()) { |
| 361 CHECK(!HEAP->InNewSpace(this)); | 361 CHECK(!HEAP->InNewSpace(this)); |
| 362 } | 362 } |
| 363 if (IsConsString()) { |
| 364 ConsString::cast(this)->ConsStringVerify(); |
| 365 } else if (IsSlicedString()) { |
| 366 SlicedString::cast(this)->SlicedStringVerify(); |
| 367 } |
| 363 } | 368 } |
| 364 | 369 |
| 365 | 370 |
| 371 void ConsString::ConsStringVerify() { |
| 372 CHECK(this->first()->IsString()); |
| 373 CHECK(this->second() == GetHeap()->empty_string() || |
| 374 this->second()->IsString()); |
| 375 CHECK(this->length() >= String::kMinNonFlatLength); |
| 376 if (this->IsFlat()) { |
| 377 // A flat cons can only be created by String::SlowTryFlatten. |
| 378 // Afterwards, the first part may be externalized. |
| 379 CHECK(this->first()->IsSeqString() || this->first()->IsExternalString()); |
| 380 } |
| 381 } |
| 382 |
| 383 |
| 384 void SlicedString::SlicedStringVerify() { |
| 385 CHECK(!this->parent()->IsConsString()); |
| 386 CHECK(!this->parent()->IsSlicedString()); |
| 387 CHECK(this->length() >= SlicedString::kMinLength); |
| 388 } |
| 389 |
| 390 |
| 366 void JSFunction::JSFunctionVerify() { | 391 void JSFunction::JSFunctionVerify() { |
| 367 CHECK(IsJSFunction()); | 392 CHECK(IsJSFunction()); |
| 368 VerifyObjectField(kPrototypeOrInitialMapOffset); | 393 VerifyObjectField(kPrototypeOrInitialMapOffset); |
| 369 VerifyObjectField(kNextFunctionLinkOffset); | 394 VerifyObjectField(kNextFunctionLinkOffset); |
| 370 CHECK(code()->IsCode()); | 395 CHECK(code()->IsCode()); |
| 371 CHECK(next_function_link()->IsUndefined() || | 396 CHECK(next_function_link()->IsUndefined() || |
| 372 next_function_link()->IsJSFunction()); | 397 next_function_link()->IsJSFunction()); |
| 373 } | 398 } |
| 374 | 399 |
| 375 | 400 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 ASSERT(e->IsUndefined()); | 805 ASSERT(e->IsUndefined()); |
| 781 } | 806 } |
| 782 } | 807 } |
| 783 } | 808 } |
| 784 } | 809 } |
| 785 | 810 |
| 786 | 811 |
| 787 #endif // DEBUG | 812 #endif // DEBUG |
| 788 | 813 |
| 789 } } // namespace v8::internal | 814 } } // namespace v8::internal |
| OLD | NEW |