| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 JSRegExp::cast(this)->JSRegExpVerify(); | 151 JSRegExp::cast(this)->JSRegExpVerify(); |
| 152 break; | 152 break; |
| 153 case FILLER_TYPE: | 153 case FILLER_TYPE: |
| 154 break; | 154 break; |
| 155 case PROXY_TYPE: | 155 case PROXY_TYPE: |
| 156 Proxy::cast(this)->ProxyVerify(); | 156 Proxy::cast(this)->ProxyVerify(); |
| 157 break; | 157 break; |
| 158 case SHARED_FUNCTION_INFO_TYPE: | 158 case SHARED_FUNCTION_INFO_TYPE: |
| 159 SharedFunctionInfo::cast(this)->SharedFunctionInfoVerify(); | 159 SharedFunctionInfo::cast(this)->SharedFunctionInfoVerify(); |
| 160 break; | 160 break; |
| 161 case JS_MESSAGE_OBJECT_TYPE: |
| 162 JSMessageObject::cast(this)->JSMessageObjectVerify(); |
| 163 break; |
| 161 | 164 |
| 162 #define MAKE_STRUCT_CASE(NAME, Name, name) \ | 165 #define MAKE_STRUCT_CASE(NAME, Name, name) \ |
| 163 case NAME##_TYPE: \ | 166 case NAME##_TYPE: \ |
| 164 Name::cast(this)->Name##Verify(); \ | 167 Name::cast(this)->Name##Verify(); \ |
| 165 break; | 168 break; |
| 166 STRUCT_LIST(MAKE_STRUCT_CASE) | 169 STRUCT_LIST(MAKE_STRUCT_CASE) |
| 167 #undef MAKE_STRUCT_CASE | 170 #undef MAKE_STRUCT_CASE |
| 168 | 171 |
| 169 default: | 172 default: |
| 170 UNREACHABLE(); | 173 UNREACHABLE(); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 292 |
| 290 | 293 |
| 291 void JSValue::JSValueVerify() { | 294 void JSValue::JSValueVerify() { |
| 292 Object* v = value(); | 295 Object* v = value(); |
| 293 if (v->IsHeapObject()) { | 296 if (v->IsHeapObject()) { |
| 294 VerifyHeapPointer(v); | 297 VerifyHeapPointer(v); |
| 295 } | 298 } |
| 296 } | 299 } |
| 297 | 300 |
| 298 | 301 |
| 302 void JSMessageObject::JSMessageObjectVerify() { |
| 303 CHECK(IsJSMessageObject()); |
| 304 CHECK(type()->IsString()); |
| 305 CHECK(arguments()->IsJSArray()); |
| 306 VerifyObjectField(kStartPositionOffset); |
| 307 VerifyObjectField(kEndPositionOffset); |
| 308 VerifyObjectField(kArgumentsOffset); |
| 309 VerifyObjectField(kScriptOffset); |
| 310 VerifyObjectField(kStackTraceOffset); |
| 311 VerifyObjectField(kStackFramesOffset); |
| 312 } |
| 313 |
| 314 |
| 299 void String::StringVerify() { | 315 void String::StringVerify() { |
| 300 CHECK(IsString()); | 316 CHECK(IsString()); |
| 301 CHECK(length() >= 0 && length() <= Smi::kMaxValue); | 317 CHECK(length() >= 0 && length() <= Smi::kMaxValue); |
| 302 if (IsSymbol()) { | 318 if (IsSymbol()) { |
| 303 CHECK(!Heap::InNewSpace(this)); | 319 CHECK(!Heap::InNewSpace(this)); |
| 304 } | 320 } |
| 305 } | 321 } |
| 306 | 322 |
| 307 | 323 |
| 308 void JSFunction::JSFunctionVerify() { | 324 void JSFunction::JSFunctionVerify() { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 377 |
| 362 void Oddball::OddballVerify() { | 378 void Oddball::OddballVerify() { |
| 363 CHECK(IsOddball()); | 379 CHECK(IsOddball()); |
| 364 VerifyHeapPointer(to_string()); | 380 VerifyHeapPointer(to_string()); |
| 365 Object* number = to_number(); | 381 Object* number = to_number(); |
| 366 if (number->IsHeapObject()) { | 382 if (number->IsHeapObject()) { |
| 367 ASSERT(number == Heap::nan_value()); | 383 ASSERT(number == Heap::nan_value()); |
| 368 } else { | 384 } else { |
| 369 ASSERT(number->IsSmi()); | 385 ASSERT(number->IsSmi()); |
| 370 int value = Smi::cast(number)->value(); | 386 int value = Smi::cast(number)->value(); |
| 371 ASSERT(value == 0 || value == 1 || value == -1 || | 387 // Hidden oddballs have negative smis. |
| 372 value == -2 || value == -3); | 388 const int kLeastHiddenOddballNumber = -4; |
| 389 ASSERT(value <= 1); |
| 390 ASSERT(value >= kLeastHiddenOddballNumber); |
| 373 } | 391 } |
| 374 } | 392 } |
| 375 | 393 |
| 376 | 394 |
| 377 void JSGlobalPropertyCell::JSGlobalPropertyCellVerify() { | 395 void JSGlobalPropertyCell::JSGlobalPropertyCellVerify() { |
| 378 CHECK(IsJSGlobalPropertyCell()); | 396 CHECK(IsJSGlobalPropertyCell()); |
| 379 VerifyObjectField(kValueOffset); | 397 VerifyObjectField(kValueOffset); |
| 380 } | 398 } |
| 381 | 399 |
| 382 | 400 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 bool is_native = RegExpImpl::UsesNativeRegExp(); | 433 bool is_native = RegExpImpl::UsesNativeRegExp(); |
| 416 | 434 |
| 417 FixedArray* arr = FixedArray::cast(data()); | 435 FixedArray* arr = FixedArray::cast(data()); |
| 418 Object* ascii_data = arr->get(JSRegExp::kIrregexpASCIICodeIndex); | 436 Object* ascii_data = arr->get(JSRegExp::kIrregexpASCIICodeIndex); |
| 419 // TheHole : Not compiled yet. | 437 // TheHole : Not compiled yet. |
| 420 // JSObject: Compilation error. | 438 // JSObject: Compilation error. |
| 421 // Code/ByteArray: Compiled code. | 439 // Code/ByteArray: Compiled code. |
| 422 ASSERT(ascii_data->IsTheHole() || ascii_data->IsJSObject() || | 440 ASSERT(ascii_data->IsTheHole() || ascii_data->IsJSObject() || |
| 423 (is_native ? ascii_data->IsCode() : ascii_data->IsByteArray())); | 441 (is_native ? ascii_data->IsCode() : ascii_data->IsByteArray())); |
| 424 Object* uc16_data = arr->get(JSRegExp::kIrregexpUC16CodeIndex); | 442 Object* uc16_data = arr->get(JSRegExp::kIrregexpUC16CodeIndex); |
| 425 ASSERT(uc16_data->IsTheHole() || ascii_data->IsJSObject() || | 443 ASSERT(uc16_data->IsTheHole() || uc16_data->IsJSObject() || |
| 426 (is_native ? uc16_data->IsCode() : uc16_data->IsByteArray())); | 444 (is_native ? uc16_data->IsCode() : uc16_data->IsByteArray())); |
| 427 ASSERT(arr->get(JSRegExp::kIrregexpCaptureCountIndex)->IsSmi()); | 445 ASSERT(arr->get(JSRegExp::kIrregexpCaptureCountIndex)->IsSmi()); |
| 428 ASSERT(arr->get(JSRegExp::kIrregexpMaxRegisterCountIndex)->IsSmi()); | 446 ASSERT(arr->get(JSRegExp::kIrregexpMaxRegisterCountIndex)->IsSmi()); |
| 429 break; | 447 break; |
| 430 } | 448 } |
| 431 default: | 449 default: |
| 432 ASSERT_EQ(JSRegExp::NOT_COMPILED, TypeTag()); | 450 ASSERT_EQ(JSRegExp::NOT_COMPILED, TypeTag()); |
| 433 ASSERT(data()->IsUndefined()); | 451 ASSERT(data()->IsUndefined()); |
| 434 break; | 452 break; |
| 435 } | 453 } |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 void JSFunctionResultCache::JSFunctionResultCacheVerify() { | 679 void JSFunctionResultCache::JSFunctionResultCacheVerify() { |
| 662 JSFunction::cast(get(kFactoryIndex))->Verify(); | 680 JSFunction::cast(get(kFactoryIndex))->Verify(); |
| 663 | 681 |
| 664 int size = Smi::cast(get(kCacheSizeIndex))->value(); | 682 int size = Smi::cast(get(kCacheSizeIndex))->value(); |
| 665 ASSERT(kEntriesIndex <= size); | 683 ASSERT(kEntriesIndex <= size); |
| 666 ASSERT(size <= length()); | 684 ASSERT(size <= length()); |
| 667 ASSERT_EQ(0, size % kEntrySize); | 685 ASSERT_EQ(0, size % kEntrySize); |
| 668 | 686 |
| 669 int finger = Smi::cast(get(kFingerIndex))->value(); | 687 int finger = Smi::cast(get(kFingerIndex))->value(); |
| 670 ASSERT(kEntriesIndex <= finger); | 688 ASSERT(kEntriesIndex <= finger); |
| 671 ASSERT(finger < size || finger == kEntriesIndex); | 689 ASSERT((finger < size) || (finger == kEntriesIndex && finger == size)); |
| 672 ASSERT_EQ(0, finger % kEntrySize); | 690 ASSERT_EQ(0, finger % kEntrySize); |
| 673 | 691 |
| 674 if (FLAG_enable_slow_asserts) { | 692 if (FLAG_enable_slow_asserts) { |
| 675 for (int i = kEntriesIndex; i < size; i++) { | 693 for (int i = kEntriesIndex; i < size; i++) { |
| 676 ASSERT(!get(i)->IsTheHole()); | 694 ASSERT(!get(i)->IsTheHole()); |
| 677 get(i)->Verify(); | 695 get(i)->Verify(); |
| 678 } | 696 } |
| 679 for (int i = size; i < length(); i++) { | 697 for (int i = size; i < length(); i++) { |
| 680 ASSERT(get(i)->IsTheHole()); | 698 ASSERT(get(i)->IsTheHole()); |
| 681 get(i)->Verify(); | 699 get(i)->Verify(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 695 ASSERT(e->IsUndefined()); | 713 ASSERT(e->IsUndefined()); |
| 696 } | 714 } |
| 697 } | 715 } |
| 698 } | 716 } |
| 699 } | 717 } |
| 700 | 718 |
| 701 | 719 |
| 702 #endif // DEBUG | 720 #endif // DEBUG |
| 703 | 721 |
| 704 } } // namespace v8::internal | 722 } } // namespace v8::internal |
| OLD | NEW |