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

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

Issue 153773002: A64: Synchronize with r16679. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 223
224 default: 224 default:
225 UNREACHABLE(); 225 UNREACHABLE();
226 break; 226 break;
227 } 227 }
228 } 228 }
229 229
230 230
231 void HeapObject::VerifyHeapPointer(Object* p) { 231 void HeapObject::VerifyHeapPointer(Object* p) {
232 CHECK(p->IsHeapObject()); 232 CHECK(p->IsHeapObject());
233 CHECK(HEAP->Contains(HeapObject::cast(p))); 233 HeapObject* ho = HeapObject::cast(p);
234 CHECK(ho->GetHeap()->Contains(ho));
234 } 235 }
235 236
236 237
237 void Symbol::SymbolVerify() { 238 void Symbol::SymbolVerify() {
238 CHECK(IsSymbol()); 239 CHECK(IsSymbol());
239 CHECK(HasHashCode()); 240 CHECK(HasHashCode());
240 CHECK_GT(Hash(), 0); 241 CHECK_GT(Hash(), 0);
241 CHECK(name()->IsUndefined() || name()->IsString()); 242 CHECK(name()->IsUndefined() || name()->IsString());
242 } 243 }
243 244
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 Representation r = descriptors->GetDetails(i).representation(); 322 Representation r = descriptors->GetDetails(i).representation();
322 int field = descriptors->GetFieldIndex(i); 323 int field = descriptors->GetFieldIndex(i);
323 Object* value = RawFastPropertyAt(field); 324 Object* value = RawFastPropertyAt(field);
324 if (r.IsDouble()) ASSERT(value->IsHeapNumber()); 325 if (r.IsDouble()) ASSERT(value->IsHeapNumber());
325 if (value->IsUninitialized()) continue; 326 if (value->IsUninitialized()) continue;
326 if (r.IsSmi()) ASSERT(value->IsSmi()); 327 if (r.IsSmi()) ASSERT(value->IsSmi());
327 if (r.IsHeapObject()) ASSERT(value->IsHeapObject()); 328 if (r.IsHeapObject()) ASSERT(value->IsHeapObject());
328 } 329 }
329 } 330 }
330 } 331 }
331 CHECK_EQ((map()->has_fast_smi_or_object_elements() || 332
332 (elements() == GetHeap()->empty_fixed_array())), 333 // TODO(hpayer): deal gracefully with partially constructed JSObjects, when
333 (elements()->map() == GetHeap()->fixed_array_map() || 334 // allocation folding is turned off.
334 elements()->map() == GetHeap()->fixed_cow_array_map())); 335 if (reinterpret_cast<Map*>(elements()) !=
335 CHECK(map()->has_fast_object_elements() == HasFastObjectElements()); 336 GetHeap()->one_pointer_filler_map()) {
337 CHECK_EQ((map()->has_fast_smi_or_object_elements() ||
338 (elements() == GetHeap()->empty_fixed_array())),
339 (elements()->map() == GetHeap()->fixed_array_map() ||
340 elements()->map() == GetHeap()->fixed_cow_array_map()));
341 CHECK(map()->has_fast_object_elements() == HasFastObjectElements());
342 }
336 } 343 }
337 344
338 345
339 void Map::MapVerify() { 346 void Map::MapVerify() {
340 CHECK(!HEAP->InNewSpace(this)); 347 Heap* heap = GetHeap();
348 CHECK(!heap->InNewSpace(this));
341 CHECK(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); 349 CHECK(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE);
342 CHECK(instance_size() == kVariableSizeSentinel || 350 CHECK(instance_size() == kVariableSizeSentinel ||
343 (kPointerSize <= instance_size() && 351 (kPointerSize <= instance_size() &&
344 instance_size() < HEAP->Capacity())); 352 instance_size() < heap->Capacity()));
345 VerifyHeapPointer(prototype()); 353 VerifyHeapPointer(prototype());
346 VerifyHeapPointer(instance_descriptors()); 354 VerifyHeapPointer(instance_descriptors());
347 SLOW_ASSERT(instance_descriptors()->IsSortedNoDuplicates()); 355 SLOW_ASSERT(instance_descriptors()->IsSortedNoDuplicates());
348 if (HasTransitionArray()) { 356 if (HasTransitionArray()) {
349 SLOW_ASSERT(transitions()->IsSortedNoDuplicates()); 357 SLOW_ASSERT(transitions()->IsSortedNoDuplicates());
350 SLOW_ASSERT(transitions()->IsConsistentWithBackPointers(this)); 358 SLOW_ASSERT(transitions()->IsConsistentWithBackPointers(this));
351 } 359 }
352 ASSERT(!is_observed() || instance_type() < FIRST_JS_OBJECT_TYPE || 360 ASSERT(!is_observed() || instance_type() < FIRST_JS_OBJECT_TYPE ||
353 instance_type() > LAST_JS_OBJECT_TYPE || 361 instance_type() > LAST_JS_OBJECT_TYPE ||
354 has_slow_elements_kind() || has_external_array_elements()); 362 has_slow_elements_kind() || has_external_array_elements());
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 VerifyObjectField(kScriptOffset); 524 VerifyObjectField(kScriptOffset);
517 VerifyObjectField(kStackTraceOffset); 525 VerifyObjectField(kStackTraceOffset);
518 VerifyObjectField(kStackFramesOffset); 526 VerifyObjectField(kStackFramesOffset);
519 } 527 }
520 528
521 529
522 void String::StringVerify() { 530 void String::StringVerify() {
523 CHECK(IsString()); 531 CHECK(IsString());
524 CHECK(length() >= 0 && length() <= Smi::kMaxValue); 532 CHECK(length() >= 0 && length() <= Smi::kMaxValue);
525 if (IsInternalizedString()) { 533 if (IsInternalizedString()) {
526 CHECK(!HEAP->InNewSpace(this)); 534 CHECK(!GetHeap()->InNewSpace(this));
527 } 535 }
528 if (IsConsString()) { 536 if (IsConsString()) {
529 ConsString::cast(this)->ConsStringVerify(); 537 ConsString::cast(this)->ConsStringVerify();
530 } else if (IsSlicedString()) { 538 } else if (IsSlicedString()) {
531 SlicedString::cast(this)->SlicedStringVerify(); 539 SlicedString::cast(this)->SlicedStringVerify();
532 } 540 }
533 } 541 }
534 542
535 543
536 void ConsString::ConsStringVerify() { 544 void ConsString::ConsStringVerify() {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 VerifyObjectField(i); 616 VerifyObjectField(i);
609 } 617 }
610 } 618 }
611 619
612 620
613 void Oddball::OddballVerify() { 621 void Oddball::OddballVerify() {
614 CHECK(IsOddball()); 622 CHECK(IsOddball());
615 VerifyHeapPointer(to_string()); 623 VerifyHeapPointer(to_string());
616 Object* number = to_number(); 624 Object* number = to_number();
617 if (number->IsHeapObject()) { 625 if (number->IsHeapObject()) {
618 CHECK(number == HEAP->nan_value()); 626 CHECK(number == HeapObject::cast(number)->GetHeap()->nan_value());
619 } else { 627 } else {
620 CHECK(number->IsSmi()); 628 CHECK(number->IsSmi());
621 int value = Smi::cast(number)->value(); 629 int value = Smi::cast(number)->value();
622 // Hidden oddballs have negative smis. 630 // Hidden oddballs have negative smis.
623 const int kLeastHiddenOddballNumber = -4; 631 const int kLeastHiddenOddballNumber = -4;
624 CHECK_LE(value, 1); 632 CHECK_LE(value, 1);
625 CHECK(value >= kLeastHiddenOddballNumber); 633 CHECK(value >= kLeastHiddenOddballNumber);
626 } 634 }
627 } 635 }
628 636
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 DependentCode::kWeaklyEmbeddedGroup, this)); 676 DependentCode::kWeaklyEmbeddedGroup, this));
669 } 677 }
670 } 678 }
671 } 679 }
672 } 680 }
673 681
674 682
675 void JSArray::JSArrayVerify() { 683 void JSArray::JSArrayVerify() {
676 JSObjectVerify(); 684 JSObjectVerify();
677 CHECK(length()->IsNumber() || length()->IsUndefined()); 685 CHECK(length()->IsNumber() || length()->IsUndefined());
678 CHECK(elements()->IsUndefined() || 686 // TODO(hpayer): deal gracefully with partially constructed JSObjects, when
679 elements()->IsFixedArray() || 687 // allocation folding is turned off.
680 elements()->IsFixedDoubleArray()); 688 if (reinterpret_cast<Map*>(elements()) !=
689 GetHeap()->one_pointer_filler_map()) {
690 CHECK(elements()->IsUndefined() ||
691 elements()->IsFixedArray() ||
692 elements()->IsFixedDoubleArray());
693 // TODO(mvstanton): to diagnose chromium bug 284577, remove after.
694 AllocationMemento* memento = AllocationMemento::FindForJSObject(this);
695 if (memento != NULL && memento->IsValid()) {
696 memento->AllocationMementoVerify();
697 }
698 }
681 } 699 }
682 700
683 701
684 void JSSet::JSSetVerify() { 702 void JSSet::JSSetVerify() {
685 CHECK(IsJSSet()); 703 CHECK(IsJSSet());
686 JSObjectVerify(); 704 JSObjectVerify();
687 VerifyHeapPointer(table()); 705 VerifyHeapPointer(table());
688 CHECK(table()->IsHashTable() || table()->IsUndefined()); 706 CHECK(table()->IsHashTable() || table()->IsUndefined());
689 } 707 }
690 708
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 case FAST_HOLEY_SMI_ELEMENTS: 1054 case FAST_HOLEY_SMI_ELEMENTS:
1037 case FAST_SMI_ELEMENTS: 1055 case FAST_SMI_ELEMENTS:
1038 case FAST_HOLEY_DOUBLE_ELEMENTS: 1056 case FAST_HOLEY_DOUBLE_ELEMENTS:
1039 case FAST_DOUBLE_ELEMENTS: 1057 case FAST_DOUBLE_ELEMENTS:
1040 case FAST_HOLEY_ELEMENTS: 1058 case FAST_HOLEY_ELEMENTS:
1041 case FAST_ELEMENTS: { 1059 case FAST_ELEMENTS: {
1042 info->number_of_objects_with_fast_elements_++; 1060 info->number_of_objects_with_fast_elements_++;
1043 int holes = 0; 1061 int holes = 0;
1044 FixedArray* e = FixedArray::cast(elements()); 1062 FixedArray* e = FixedArray::cast(elements());
1045 int len = e->length(); 1063 int len = e->length();
1046 Heap* heap = HEAP; 1064 Heap* heap = GetHeap();
1047 for (int i = 0; i < len; i++) { 1065 for (int i = 0; i < len; i++) {
1048 if (e->get(i) == heap->the_hole_value()) holes++; 1066 if (e->get(i) == heap->the_hole_value()) holes++;
1049 } 1067 }
1050 info->number_of_fast_used_elements_ += len - holes; 1068 info->number_of_fast_used_elements_ += len - holes;
1051 info->number_of_fast_unused_elements_ += holes; 1069 info->number_of_fast_unused_elements_ += holes;
1052 break; 1070 break;
1053 } 1071 }
1054 case EXTERNAL_BYTE_ELEMENTS: 1072 case EXTERNAL_BYTE_ELEMENTS:
1055 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 1073 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
1056 case EXTERNAL_SHORT_ELEMENTS: 1074 case EXTERNAL_SHORT_ELEMENTS:
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 for (int i = 0; i < number_of_transitions(); ++i) { 1187 for (int i = 0; i < number_of_transitions(); ++i) {
1170 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; 1188 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false;
1171 } 1189 }
1172 return true; 1190 return true;
1173 } 1191 }
1174 1192
1175 1193
1176 #endif // DEBUG 1194 #endif // DEBUG
1177 1195
1178 } } // namespace v8::internal 1196 } } // 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