| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 switch (instance_type) { | 81 switch (instance_type) { |
| 82 case MAP_TYPE: | 82 case MAP_TYPE: |
| 83 Map::cast(this)->MapVerify(); | 83 Map::cast(this)->MapVerify(); |
| 84 break; | 84 break; |
| 85 case HEAP_NUMBER_TYPE: | 85 case HEAP_NUMBER_TYPE: |
| 86 HeapNumber::cast(this)->HeapNumberVerify(); | 86 HeapNumber::cast(this)->HeapNumberVerify(); |
| 87 break; | 87 break; |
| 88 case FIXED_ARRAY_TYPE: | 88 case FIXED_ARRAY_TYPE: |
| 89 FixedArray::cast(this)->FixedArrayVerify(); | 89 FixedArray::cast(this)->FixedArrayVerify(); |
| 90 break; | 90 break; |
| 91 case FIXED_DOUBLE_ARRAY_TYPE: |
| 92 FixedDoubleArray::cast(this)->FixedDoubleArrayVerify(); |
| 93 break; |
| 91 case BYTE_ARRAY_TYPE: | 94 case BYTE_ARRAY_TYPE: |
| 92 ByteArray::cast(this)->ByteArrayVerify(); | 95 ByteArray::cast(this)->ByteArrayVerify(); |
| 93 break; | 96 break; |
| 94 case FREE_SPACE_TYPE: | 97 case FREE_SPACE_TYPE: |
| 95 FreeSpace::cast(this)->FreeSpaceVerify(); | 98 FreeSpace::cast(this)->FreeSpaceVerify(); |
| 96 break; | 99 break; |
| 97 case EXTERNAL_PIXEL_ARRAY_TYPE: | 100 case EXTERNAL_PIXEL_ARRAY_TYPE: |
| 98 ExternalPixelArray::cast(this)->ExternalPixelArrayVerify(); | 101 ExternalPixelArray::cast(this)->ExternalPixelArrayVerify(); |
| 99 break; | 102 break; |
| 100 case EXTERNAL_BYTE_ARRAY_TYPE: | 103 case EXTERNAL_BYTE_ARRAY_TYPE: |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 293 |
| 291 void CodeCache::CodeCacheVerify() { | 294 void CodeCache::CodeCacheVerify() { |
| 292 VerifyHeapPointer(default_cache()); | 295 VerifyHeapPointer(default_cache()); |
| 293 VerifyHeapPointer(normal_type_cache()); | 296 VerifyHeapPointer(normal_type_cache()); |
| 294 ASSERT(default_cache()->IsFixedArray()); | 297 ASSERT(default_cache()->IsFixedArray()); |
| 295 ASSERT(normal_type_cache()->IsUndefined() | 298 ASSERT(normal_type_cache()->IsUndefined() |
| 296 || normal_type_cache()->IsCodeCacheHashTable()); | 299 || normal_type_cache()->IsCodeCacheHashTable()); |
| 297 } | 300 } |
| 298 | 301 |
| 299 | 302 |
| 303 void PolymorphicCodeCache::PolymorphicCodeCacheVerify() { |
| 304 VerifyHeapPointer(cache()); |
| 305 ASSERT(cache()->IsUndefined() || cache()->IsPolymorphicCodeCacheHashTable()); |
| 306 } |
| 307 |
| 308 |
| 300 void FixedArray::FixedArrayVerify() { | 309 void FixedArray::FixedArrayVerify() { |
| 301 for (int i = 0; i < length(); i++) { | 310 for (int i = 0; i < length(); i++) { |
| 302 Object* e = get(i); | 311 Object* e = get(i); |
| 303 if (e->IsHeapObject()) { | 312 if (e->IsHeapObject()) { |
| 304 VerifyHeapPointer(e); | 313 VerifyHeapPointer(e); |
| 305 } else { | 314 } else { |
| 306 e->Verify(); | 315 e->Verify(); |
| 307 } | 316 } |
| 308 } | 317 } |
| 309 } | 318 } |
| 310 | 319 |
| 311 | 320 |
| 321 void FixedDoubleArray::FixedDoubleArrayVerify() { |
| 322 for (int i = 0; i < length(); i++) { |
| 323 if (!is_the_hole(i)) { |
| 324 double value = get(i); |
| 325 ASSERT(!isnan(value) || |
| 326 BitCast<uint64_t>(value) == kCanonicalNonHoleNanInt64); |
| 327 } |
| 328 } |
| 329 } |
| 330 |
| 331 |
| 312 void JSValue::JSValueVerify() { | 332 void JSValue::JSValueVerify() { |
| 313 Object* v = value(); | 333 Object* v = value(); |
| 314 if (v->IsHeapObject()) { | 334 if (v->IsHeapObject()) { |
| 315 VerifyHeapPointer(v); | 335 VerifyHeapPointer(v); |
| 316 } | 336 } |
| 317 } | 337 } |
| 318 | 338 |
| 319 | 339 |
| 320 void JSMessageObject::JSMessageObjectVerify() { | 340 void JSMessageObject::JSMessageObjectVerify() { |
| 321 CHECK(IsJSMessageObject()); | 341 CHECK(IsJSMessageObject()); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 CHECK(it.rinfo()->pc() != last_gc_pc); | 447 CHECK(it.rinfo()->pc() != last_gc_pc); |
| 428 last_gc_pc = it.rinfo()->pc(); | 448 last_gc_pc = it.rinfo()->pc(); |
| 429 } | 449 } |
| 430 } | 450 } |
| 431 } | 451 } |
| 432 | 452 |
| 433 | 453 |
| 434 void JSArray::JSArrayVerify() { | 454 void JSArray::JSArrayVerify() { |
| 435 JSObjectVerify(); | 455 JSObjectVerify(); |
| 436 ASSERT(length()->IsNumber() || length()->IsUndefined()); | 456 ASSERT(length()->IsNumber() || length()->IsUndefined()); |
| 437 ASSERT(elements()->IsUndefined() || elements()->IsFixedArray()); | 457 ASSERT(elements()->IsUndefined() || |
| 458 elements()->IsFixedArray() || |
| 459 elements()->IsFixedDoubleArray()); |
| 438 } | 460 } |
| 439 | 461 |
| 440 | 462 |
| 441 void JSRegExp::JSRegExpVerify() { | 463 void JSRegExp::JSRegExpVerify() { |
| 442 JSObjectVerify(); | 464 JSObjectVerify(); |
| 443 ASSERT(data()->IsUndefined() || data()->IsFixedArray()); | 465 ASSERT(data()->IsUndefined() || data()->IsFixedArray()); |
| 444 switch (TypeTag()) { | 466 switch (TypeTag()) { |
| 445 case JSRegExp::ATOM: { | 467 case JSRegExp::ATOM: { |
| 446 FixedArray* arr = FixedArray::cast(data()); | 468 FixedArray* arr = FixedArray::cast(data()); |
| 447 ASSERT(arr->get(JSRegExp::kAtomPatternIndex)->IsString()); | 469 ASSERT(arr->get(JSRegExp::kAtomPatternIndex)->IsString()); |
| 448 break; | 470 break; |
| 449 } | 471 } |
| 450 case JSRegExp::IRREGEXP: { | 472 case JSRegExp::IRREGEXP: { |
| 451 bool is_native = RegExpImpl::UsesNativeRegExp(); | 473 bool is_native = RegExpImpl::UsesNativeRegExp(); |
| 452 | 474 |
| 453 FixedArray* arr = FixedArray::cast(data()); | 475 FixedArray* arr = FixedArray::cast(data()); |
| 454 Object* ascii_data = arr->get(JSRegExp::kIrregexpASCIICodeIndex); | 476 Object* ascii_data = arr->get(JSRegExp::kIrregexpASCIICodeIndex); |
| 455 // TheHole : Not compiled yet. | 477 // Smi : Not compiled yet (-1) or code prepared for flushing. |
| 456 // JSObject: Compilation error. | 478 // JSObject: Compilation error. |
| 457 // Code/ByteArray: Compiled code. | 479 // Code/ByteArray: Compiled code. |
| 458 ASSERT(ascii_data->IsTheHole() || ascii_data->IsJSObject() || | 480 ASSERT(ascii_data->IsSmi() || |
| 459 (is_native ? ascii_data->IsCode() : ascii_data->IsByteArray())); | 481 (is_native ? ascii_data->IsCode() : ascii_data->IsByteArray())); |
| 460 Object* uc16_data = arr->get(JSRegExp::kIrregexpUC16CodeIndex); | 482 Object* uc16_data = arr->get(JSRegExp::kIrregexpUC16CodeIndex); |
| 461 ASSERT(uc16_data->IsTheHole() || uc16_data->IsJSObject() || | 483 ASSERT(uc16_data->IsSmi() || |
| 462 (is_native ? uc16_data->IsCode() : uc16_data->IsByteArray())); | 484 (is_native ? uc16_data->IsCode() : uc16_data->IsByteArray())); |
| 485 |
| 486 Object* ascii_saved = arr->get(JSRegExp::kIrregexpASCIICodeSavedIndex); |
| 487 ASSERT(ascii_saved->IsSmi() || ascii_saved->IsString() || |
| 488 ascii_saved->IsCode()); |
| 489 Object* uc16_saved = arr->get(JSRegExp::kIrregexpUC16CodeSavedIndex); |
| 490 ASSERT(uc16_saved->IsSmi() || uc16_saved->IsString() || |
| 491 uc16_saved->IsCode()); |
| 492 |
| 463 ASSERT(arr->get(JSRegExp::kIrregexpCaptureCountIndex)->IsSmi()); | 493 ASSERT(arr->get(JSRegExp::kIrregexpCaptureCountIndex)->IsSmi()); |
| 464 ASSERT(arr->get(JSRegExp::kIrregexpMaxRegisterCountIndex)->IsSmi()); | 494 ASSERT(arr->get(JSRegExp::kIrregexpMaxRegisterCountIndex)->IsSmi()); |
| 465 break; | 495 break; |
| 466 } | 496 } |
| 467 default: | 497 default: |
| 468 ASSERT_EQ(JSRegExp::NOT_COMPILED, TypeTag()); | 498 ASSERT_EQ(JSRegExp::NOT_COMPILED, TypeTag()); |
| 469 ASSERT(data()->IsUndefined()); | 499 ASSERT(data()->IsUndefined()); |
| 470 break; | 500 break; |
| 471 } | 501 } |
| 472 } | 502 } |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 ASSERT(e->IsUndefined()); | 767 ASSERT(e->IsUndefined()); |
| 738 } | 768 } |
| 739 } | 769 } |
| 740 } | 770 } |
| 741 } | 771 } |
| 742 | 772 |
| 743 | 773 |
| 744 #endif // DEBUG | 774 #endif // DEBUG |
| 745 | 775 |
| 746 } } // namespace v8::internal | 776 } } // namespace v8::internal |
| OLD | NEW |