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

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

Issue 23468021: move HEAP to /test (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 } 331 }
331 CHECK_EQ((map()->has_fast_smi_or_object_elements() || 332 CHECK_EQ((map()->has_fast_smi_or_object_elements() ||
332 (elements() == GetHeap()->empty_fixed_array())), 333 (elements() == GetHeap()->empty_fixed_array())),
333 (elements()->map() == GetHeap()->fixed_array_map() || 334 (elements()->map() == GetHeap()->fixed_array_map() ||
334 elements()->map() == GetHeap()->fixed_cow_array_map())); 335 elements()->map() == GetHeap()->fixed_cow_array_map()));
335 CHECK(map()->has_fast_object_elements() == HasFastObjectElements()); 336 CHECK(map()->has_fast_object_elements() == HasFastObjectElements());
336 } 337 }
337 338
338 339
339 void Map::MapVerify() { 340 void Map::MapVerify() {
340 CHECK(!HEAP->InNewSpace(this)); 341 Heap* heap = GetHeap();
342 CHECK(!heap->InNewSpace(this));
341 CHECK(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); 343 CHECK(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE);
342 CHECK(instance_size() == kVariableSizeSentinel || 344 CHECK(instance_size() == kVariableSizeSentinel ||
343 (kPointerSize <= instance_size() && 345 (kPointerSize <= instance_size() &&
344 instance_size() < HEAP->Capacity())); 346 instance_size() < heap->Capacity()));
345 VerifyHeapPointer(prototype()); 347 VerifyHeapPointer(prototype());
346 VerifyHeapPointer(instance_descriptors()); 348 VerifyHeapPointer(instance_descriptors());
347 SLOW_ASSERT(instance_descriptors()->IsSortedNoDuplicates()); 349 SLOW_ASSERT(instance_descriptors()->IsSortedNoDuplicates());
348 if (HasTransitionArray()) { 350 if (HasTransitionArray()) {
349 SLOW_ASSERT(transitions()->IsSortedNoDuplicates()); 351 SLOW_ASSERT(transitions()->IsSortedNoDuplicates());
350 SLOW_ASSERT(transitions()->IsConsistentWithBackPointers(this)); 352 SLOW_ASSERT(transitions()->IsConsistentWithBackPointers(this));
351 } 353 }
352 ASSERT(!is_observed() || instance_type() < FIRST_JS_OBJECT_TYPE || 354 ASSERT(!is_observed() || instance_type() < FIRST_JS_OBJECT_TYPE ||
353 instance_type() > LAST_JS_OBJECT_TYPE || 355 instance_type() > LAST_JS_OBJECT_TYPE ||
354 has_slow_elements_kind() || has_external_array_elements()); 356 has_slow_elements_kind() || has_external_array_elements());
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 VerifyObjectField(kScriptOffset); 518 VerifyObjectField(kScriptOffset);
517 VerifyObjectField(kStackTraceOffset); 519 VerifyObjectField(kStackTraceOffset);
518 VerifyObjectField(kStackFramesOffset); 520 VerifyObjectField(kStackFramesOffset);
519 } 521 }
520 522
521 523
522 void String::StringVerify() { 524 void String::StringVerify() {
523 CHECK(IsString()); 525 CHECK(IsString());
524 CHECK(length() >= 0 && length() <= Smi::kMaxValue); 526 CHECK(length() >= 0 && length() <= Smi::kMaxValue);
525 if (IsInternalizedString()) { 527 if (IsInternalizedString()) {
526 CHECK(!HEAP->InNewSpace(this)); 528 CHECK(!GetHeap()->InNewSpace(this));
527 } 529 }
528 if (IsConsString()) { 530 if (IsConsString()) {
529 ConsString::cast(this)->ConsStringVerify(); 531 ConsString::cast(this)->ConsStringVerify();
530 } else if (IsSlicedString()) { 532 } else if (IsSlicedString()) {
531 SlicedString::cast(this)->SlicedStringVerify(); 533 SlicedString::cast(this)->SlicedStringVerify();
532 } 534 }
533 } 535 }
534 536
535 537
536 void ConsString::ConsStringVerify() { 538 void ConsString::ConsStringVerify() {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 VerifyObjectField(i); 610 VerifyObjectField(i);
609 } 611 }
610 } 612 }
611 613
612 614
613 void Oddball::OddballVerify() { 615 void Oddball::OddballVerify() {
614 CHECK(IsOddball()); 616 CHECK(IsOddball());
615 VerifyHeapPointer(to_string()); 617 VerifyHeapPointer(to_string());
616 Object* number = to_number(); 618 Object* number = to_number();
617 if (number->IsHeapObject()) { 619 if (number->IsHeapObject()) {
618 CHECK(number == HEAP->nan_value()); 620 CHECK(number == HeapObject::cast(number)->GetHeap()->nan_value());
619 } else { 621 } else {
620 CHECK(number->IsSmi()); 622 CHECK(number->IsSmi());
621 int value = Smi::cast(number)->value(); 623 int value = Smi::cast(number)->value();
622 // Hidden oddballs have negative smis. 624 // Hidden oddballs have negative smis.
623 const int kLeastHiddenOddballNumber = -4; 625 const int kLeastHiddenOddballNumber = -4;
624 CHECK_LE(value, 1); 626 CHECK_LE(value, 1);
625 CHECK(value >= kLeastHiddenOddballNumber); 627 CHECK(value >= kLeastHiddenOddballNumber);
626 } 628 }
627 } 629 }
628 630
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 case FAST_HOLEY_SMI_ELEMENTS: 1038 case FAST_HOLEY_SMI_ELEMENTS:
1037 case FAST_SMI_ELEMENTS: 1039 case FAST_SMI_ELEMENTS:
1038 case FAST_HOLEY_DOUBLE_ELEMENTS: 1040 case FAST_HOLEY_DOUBLE_ELEMENTS:
1039 case FAST_DOUBLE_ELEMENTS: 1041 case FAST_DOUBLE_ELEMENTS:
1040 case FAST_HOLEY_ELEMENTS: 1042 case FAST_HOLEY_ELEMENTS:
1041 case FAST_ELEMENTS: { 1043 case FAST_ELEMENTS: {
1042 info->number_of_objects_with_fast_elements_++; 1044 info->number_of_objects_with_fast_elements_++;
1043 int holes = 0; 1045 int holes = 0;
1044 FixedArray* e = FixedArray::cast(elements()); 1046 FixedArray* e = FixedArray::cast(elements());
1045 int len = e->length(); 1047 int len = e->length();
1046 Heap* heap = HEAP; 1048 Heap* heap = GetHeap();
1047 for (int i = 0; i < len; i++) { 1049 for (int i = 0; i < len; i++) {
1048 if (e->get(i) == heap->the_hole_value()) holes++; 1050 if (e->get(i) == heap->the_hole_value()) holes++;
1049 } 1051 }
1050 info->number_of_fast_used_elements_ += len - holes; 1052 info->number_of_fast_used_elements_ += len - holes;
1051 info->number_of_fast_unused_elements_ += holes; 1053 info->number_of_fast_unused_elements_ += holes;
1052 break; 1054 break;
1053 } 1055 }
1054 case EXTERNAL_BYTE_ELEMENTS: 1056 case EXTERNAL_BYTE_ELEMENTS:
1055 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 1057 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
1056 case EXTERNAL_SHORT_ELEMENTS: 1058 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) { 1171 for (int i = 0; i < number_of_transitions(); ++i) {
1170 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; 1172 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false;
1171 } 1173 }
1172 return true; 1174 return true;
1173 } 1175 }
1174 1176
1175 1177
1176 #endif // DEBUG 1178 #endif // DEBUG
1177 1179
1178 } } // namespace v8::internal 1180 } } // 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