Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: src/objects-debug.cc

Issue 8139027: Version 3.6.5 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
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: 91 case FIXED_DOUBLE_ARRAY_TYPE:
92 FixedDoubleArray::cast(this)->FixedDoubleArrayVerify(); 92 FixedDoubleArray::cast(this)->FixedDoubleArrayVerify();
93 break; 93 break;
94 case BYTE_ARRAY_TYPE: 94 case BYTE_ARRAY_TYPE:
95 ByteArray::cast(this)->ByteArrayVerify(); 95 ByteArray::cast(this)->ByteArrayVerify();
96 break; 96 break;
97 case FREE_SPACE_TYPE:
98 FreeSpace::cast(this)->FreeSpaceVerify();
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:
101 ExternalByteArray::cast(this)->ExternalByteArrayVerify(); 104 ExternalByteArray::cast(this)->ExternalByteArrayVerify();
102 break; 105 break;
103 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: 106 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
104 ExternalUnsignedByteArray::cast(this)->ExternalUnsignedByteArrayVerify(); 107 ExternalUnsignedByteArray::cast(this)->ExternalUnsignedByteArrayVerify();
105 break; 108 break;
106 case EXTERNAL_SHORT_ARRAY_TYPE: 109 case EXTERNAL_SHORT_ARRAY_TYPE:
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 void HeapNumber::HeapNumberVerify() { 203 void HeapNumber::HeapNumberVerify() {
201 ASSERT(IsHeapNumber()); 204 ASSERT(IsHeapNumber());
202 } 205 }
203 206
204 207
205 void ByteArray::ByteArrayVerify() { 208 void ByteArray::ByteArrayVerify() {
206 ASSERT(IsByteArray()); 209 ASSERT(IsByteArray());
207 } 210 }
208 211
209 212
213 void FreeSpace::FreeSpaceVerify() {
214 ASSERT(IsFreeSpace());
215 }
216
217
210 void ExternalPixelArray::ExternalPixelArrayVerify() { 218 void ExternalPixelArray::ExternalPixelArrayVerify() {
211 ASSERT(IsExternalPixelArray()); 219 ASSERT(IsExternalPixelArray());
212 } 220 }
213 221
214 222
215 void ExternalByteArray::ExternalByteArrayVerify() { 223 void ExternalByteArray::ExternalByteArrayVerify() {
216 ASSERT(IsExternalByteArray()); 224 ASSERT(IsExternalByteArray());
217 } 225 }
218 226
219 227
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 261
254 262
255 void JSObject::JSObjectVerify() { 263 void JSObject::JSObjectVerify() {
256 VerifyHeapPointer(properties()); 264 VerifyHeapPointer(properties());
257 VerifyHeapPointer(elements()); 265 VerifyHeapPointer(elements());
258 if (HasFastProperties()) { 266 if (HasFastProperties()) {
259 CHECK_EQ(map()->unused_property_fields(), 267 CHECK_EQ(map()->unused_property_fields(),
260 (map()->inobject_properties() + properties()->length() - 268 (map()->inobject_properties() + properties()->length() -
261 map()->NextFreePropertyIndex())); 269 map()->NextFreePropertyIndex()));
262 } 270 }
263 ASSERT_EQ(map()->has_fast_elements(), 271 ASSERT_EQ((map()->has_fast_elements() || map()->has_fast_smi_only_elements()),
264 (elements()->map() == GetHeap()->fixed_array_map() || 272 (elements()->map() == GetHeap()->fixed_array_map() ||
265 elements()->map() == GetHeap()->fixed_cow_array_map())); 273 elements()->map() == GetHeap()->fixed_cow_array_map()));
266 ASSERT(map()->has_fast_elements() == HasFastElements()); 274 ASSERT(map()->has_fast_elements() == HasFastElements());
267 } 275 }
268 276
269 277
270 void Map::MapVerify() { 278 void Map::MapVerify() {
271 ASSERT(!HEAP->InNewSpace(this)); 279 ASSERT(!HEAP->InNewSpace(this));
272 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); 280 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE);
273 ASSERT(instance_size() == kVariableSizeSentinel || 281 ASSERT(instance_size() == kVariableSizeSentinel ||
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } 323 }
316 } 324 }
317 325
318 326
319 void FixedDoubleArray::FixedDoubleArrayVerify() { 327 void FixedDoubleArray::FixedDoubleArrayVerify() {
320 for (int i = 0; i < length(); i++) { 328 for (int i = 0; i < length(); i++) {
321 if (!is_the_hole(i)) { 329 if (!is_the_hole(i)) {
322 double value = get_scalar(i); 330 double value = get_scalar(i);
323 ASSERT(!isnan(value) || 331 ASSERT(!isnan(value) ||
324 (BitCast<uint64_t>(value) == 332 (BitCast<uint64_t>(value) ==
325 BitCast<uint64_t>(canonical_not_the_hole_nan_as_double()))); 333 BitCast<uint64_t>(canonical_not_the_hole_nan_as_double())) ||
334 ((BitCast<uint64_t>(value) & Double::kSignMask) != 0));
326 } 335 }
327 } 336 }
328 } 337 }
329 338
330 339
331 void JSValue::JSValueVerify() { 340 void JSValue::JSValueVerify() {
332 Object* v = value(); 341 Object* v = value();
333 if (v->IsHeapObject()) { 342 if (v->IsHeapObject()) {
334 VerifyHeapPointer(v); 343 VerifyHeapPointer(v);
335 } 344 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 CHECK(!this->parent()->IsConsString()); 389 CHECK(!this->parent()->IsConsString());
381 CHECK(!this->parent()->IsSlicedString()); 390 CHECK(!this->parent()->IsSlicedString());
382 CHECK(this->length() >= SlicedString::kMinLength); 391 CHECK(this->length() >= SlicedString::kMinLength);
383 } 392 }
384 393
385 394
386 void JSFunction::JSFunctionVerify() { 395 void JSFunction::JSFunctionVerify() {
387 CHECK(IsJSFunction()); 396 CHECK(IsJSFunction());
388 VerifyObjectField(kPrototypeOrInitialMapOffset); 397 VerifyObjectField(kPrototypeOrInitialMapOffset);
389 VerifyObjectField(kNextFunctionLinkOffset); 398 VerifyObjectField(kNextFunctionLinkOffset);
399 CHECK(code()->IsCode());
390 CHECK(next_function_link()->IsUndefined() || 400 CHECK(next_function_link()->IsUndefined() ||
391 next_function_link()->IsJSFunction()); 401 next_function_link()->IsJSFunction());
392 } 402 }
393 403
394 404
395 void SharedFunctionInfo::SharedFunctionInfoVerify() { 405 void SharedFunctionInfo::SharedFunctionInfoVerify() {
396 CHECK(IsSharedFunctionInfo()); 406 CHECK(IsSharedFunctionInfo());
397 VerifyObjectField(kNameOffset); 407 VerifyObjectField(kNameOffset);
398 VerifyObjectField(kCodeOffset); 408 VerifyObjectField(kCodeOffset);
399 VerifyObjectField(kScopeInfoOffset); 409 VerifyObjectField(kScopeInfoOffset);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 449
440 void Oddball::OddballVerify() { 450 void Oddball::OddballVerify() {
441 CHECK(IsOddball()); 451 CHECK(IsOddball());
442 VerifyHeapPointer(to_string()); 452 VerifyHeapPointer(to_string());
443 Object* number = to_number(); 453 Object* number = to_number();
444 if (number->IsHeapObject()) { 454 if (number->IsHeapObject()) {
445 ASSERT(number == HEAP->nan_value()); 455 ASSERT(number == HEAP->nan_value());
446 } else { 456 } else {
447 ASSERT(number->IsSmi()); 457 ASSERT(number->IsSmi());
448 int value = Smi::cast(number)->value(); 458 int value = Smi::cast(number)->value();
459 ASSERT(value <= 1);
449 // Hidden oddballs have negative smis. 460 // Hidden oddballs have negative smis.
450 const int kLeastHiddenOddballNumber = -4;
451 ASSERT(value <= 1);
452 ASSERT(value >= kLeastHiddenOddballNumber); 461 ASSERT(value >= kLeastHiddenOddballNumber);
453 } 462 }
454 } 463 }
455 464
456 465
457 void JSGlobalPropertyCell::JSGlobalPropertyCellVerify() { 466 void JSGlobalPropertyCell::JSGlobalPropertyCellVerify() {
458 CHECK(IsJSGlobalPropertyCell()); 467 CHECK(IsJSGlobalPropertyCell());
459 VerifyObjectField(kValueOffset); 468 VerifyObjectField(kValueOffset);
460 } 469 }
461 470
462 471
463 void Code::CodeVerify() { 472 void Code::CodeVerify() {
464 CHECK(IsAligned(reinterpret_cast<intptr_t>(instruction_start()), 473 CHECK(IsAligned(reinterpret_cast<intptr_t>(instruction_start()),
465 kCodeAlignment)); 474 kCodeAlignment));
475 relocation_info()->Verify();
466 Address last_gc_pc = NULL; 476 Address last_gc_pc = NULL;
467 for (RelocIterator it(this); !it.done(); it.next()) { 477 for (RelocIterator it(this); !it.done(); it.next()) {
468 it.rinfo()->Verify(); 478 it.rinfo()->Verify();
469 // Ensure that GC will not iterate twice over the same pointer. 479 // Ensure that GC will not iterate twice over the same pointer.
470 if (RelocInfo::IsGCRelocMode(it.rinfo()->rmode())) { 480 if (RelocInfo::IsGCRelocMode(it.rinfo()->rmode())) {
471 CHECK(it.rinfo()->pc() != last_gc_pc); 481 CHECK(it.rinfo()->pc() != last_gc_pc);
472 last_gc_pc = it.rinfo()->pc(); 482 last_gc_pc = it.rinfo()->pc();
473 } 483 }
474 } 484 }
475 } 485 }
476 486
477 487
478 void JSArray::JSArrayVerify() { 488 void JSArray::JSArrayVerify() {
479 JSObjectVerify(); 489 JSObjectVerify();
480 ASSERT(length()->IsNumber() || length()->IsUndefined()); 490 ASSERT(length()->IsNumber() || length()->IsUndefined());
481 ASSERT(elements()->IsUndefined() || 491 ASSERT(elements()->IsUndefined() ||
482 elements()->IsFixedArray() || 492 elements()->IsFixedArray() ||
483 elements()->IsFixedDoubleArray()); 493 elements()->IsFixedDoubleArray());
484 } 494 }
485 495
486 496
487 void JSWeakMap::JSWeakMapVerify() { 497 void JSWeakMap::JSWeakMapVerify() {
488 CHECK(IsJSWeakMap()); 498 CHECK(IsJSWeakMap());
489 JSObjectVerify(); 499 JSObjectVerify();
490 VerifyHeapPointer(table()); 500 VerifyHeapPointer(table());
491 ASSERT(table()->IsHashTable()); 501 ASSERT(table()->IsHashTable() || table()->IsUndefined());
492 } 502 }
493 503
494 504
495 void JSRegExp::JSRegExpVerify() { 505 void JSRegExp::JSRegExpVerify() {
496 JSObjectVerify(); 506 JSObjectVerify();
497 ASSERT(data()->IsUndefined() || data()->IsFixedArray()); 507 ASSERT(data()->IsUndefined() || data()->IsFixedArray());
498 switch (TypeTag()) { 508 switch (TypeTag()) {
499 case JSRegExp::ATOM: { 509 case JSRegExp::ATOM: {
500 FixedArray* arr = FixedArray::cast(data()); 510 FixedArray* arr = FixedArray::cast(data());
501 ASSERT(arr->get(JSRegExp::kAtomPatternIndex)->IsString()); 511 ASSERT(arr->get(JSRegExp::kAtomPatternIndex)->IsString());
(...skipping 26 matching lines...) Expand all
528 } 538 }
529 default: 539 default:
530 ASSERT_EQ(JSRegExp::NOT_COMPILED, TypeTag()); 540 ASSERT_EQ(JSRegExp::NOT_COMPILED, TypeTag());
531 ASSERT(data()->IsUndefined()); 541 ASSERT(data()->IsUndefined());
532 break; 542 break;
533 } 543 }
534 } 544 }
535 545
536 546
537 void JSProxy::JSProxyVerify() { 547 void JSProxy::JSProxyVerify() {
538 ASSERT(IsJSProxy()); 548 CHECK(IsJSProxy());
539 VerifyPointer(handler()); 549 VerifyPointer(handler());
550 ASSERT(hash()->IsSmi() || hash()->IsUndefined());
540 } 551 }
541 552
542 553
543 void JSFunctionProxy::JSFunctionProxyVerify() { 554 void JSFunctionProxy::JSFunctionProxyVerify() {
544 ASSERT(IsJSFunctionProxy()); 555 CHECK(IsJSFunctionProxy());
545 JSProxyVerify(); 556 JSProxyVerify();
546 VerifyPointer(call_trap()); 557 VerifyPointer(call_trap());
547 VerifyPointer(construct_trap()); 558 VerifyPointer(construct_trap());
548 } 559 }
549 560
550 561
551 void Foreign::ForeignVerify() { 562 void Foreign::ForeignVerify() {
552 ASSERT(IsForeign()); 563 ASSERT(IsForeign());
553 } 564 }
554 565
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 ASSERT(e->IsUndefined()); 819 ASSERT(e->IsUndefined());
809 } 820 }
810 } 821 }
811 } 822 }
812 } 823 }
813 824
814 825
815 #endif // DEBUG 826 #endif // DEBUG
816 827
817 } } // namespace v8::internal 828 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698