| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 default: | 175 default: |
| 176 UNREACHABLE(); | 176 UNREACHABLE(); |
| 177 break; | 177 break; |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 | 180 |
| 181 | 181 |
| 182 void HeapObject::VerifyHeapPointer(Object* p) { | 182 void HeapObject::VerifyHeapPointer(Object* p) { |
| 183 ASSERT(p->IsHeapObject()); | 183 ASSERT(p->IsHeapObject()); |
| 184 ASSERT(Heap::Contains(HeapObject::cast(p))); | 184 ASSERT(HEAP->Contains(HeapObject::cast(p))); |
| 185 } | 185 } |
| 186 | 186 |
| 187 | 187 |
| 188 void HeapNumber::HeapNumberVerify() { | 188 void HeapNumber::HeapNumberVerify() { |
| 189 ASSERT(IsHeapNumber()); | 189 ASSERT(IsHeapNumber()); |
| 190 } | 190 } |
| 191 | 191 |
| 192 | 192 |
| 193 void ByteArray::ByteArrayVerify() { | 193 void ByteArray::ByteArrayVerify() { |
| 194 ASSERT(IsByteArray()); | 194 ASSERT(IsByteArray()); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 242 |
| 243 void JSObject::JSObjectVerify() { | 243 void JSObject::JSObjectVerify() { |
| 244 VerifyHeapPointer(properties()); | 244 VerifyHeapPointer(properties()); |
| 245 VerifyHeapPointer(elements()); | 245 VerifyHeapPointer(elements()); |
| 246 if (HasFastProperties()) { | 246 if (HasFastProperties()) { |
| 247 CHECK_EQ(map()->unused_property_fields(), | 247 CHECK_EQ(map()->unused_property_fields(), |
| 248 (map()->inobject_properties() + properties()->length() - | 248 (map()->inobject_properties() + properties()->length() - |
| 249 map()->NextFreePropertyIndex())); | 249 map()->NextFreePropertyIndex())); |
| 250 } | 250 } |
| 251 ASSERT(map()->has_fast_elements() == | 251 ASSERT(map()->has_fast_elements() == |
| 252 (elements()->map() == Heap::fixed_array_map() || | 252 (elements()->map() == GetHeap()->fixed_array_map() || |
| 253 elements()->map() == Heap::fixed_cow_array_map())); | 253 elements()->map() == GetHeap()->fixed_cow_array_map())); |
| 254 ASSERT(map()->has_fast_elements() == HasFastElements()); | 254 ASSERT(map()->has_fast_elements() == HasFastElements()); |
| 255 } | 255 } |
| 256 | 256 |
| 257 | 257 |
| 258 void Map::MapVerify() { | 258 void Map::MapVerify() { |
| 259 ASSERT(!Heap::InNewSpace(this)); | 259 ASSERT(!HEAP->InNewSpace(this)); |
| 260 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); | 260 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); |
| 261 ASSERT(instance_size() == kVariableSizeSentinel || | 261 ASSERT(instance_size() == kVariableSizeSentinel || |
| 262 (kPointerSize <= instance_size() && | 262 (kPointerSize <= instance_size() && |
| 263 instance_size() < Heap::Capacity())); | 263 instance_size() < HEAP->Capacity())); |
| 264 VerifyHeapPointer(prototype()); | 264 VerifyHeapPointer(prototype()); |
| 265 VerifyHeapPointer(instance_descriptors()); | 265 VerifyHeapPointer(instance_descriptors()); |
| 266 } | 266 } |
| 267 | 267 |
| 268 | 268 |
| 269 void Map::SharedMapVerify() { | 269 void Map::SharedMapVerify() { |
| 270 MapVerify(); | 270 MapVerify(); |
| 271 ASSERT(is_shared()); | 271 ASSERT(is_shared()); |
| 272 ASSERT_EQ(Heap::empty_descriptor_array(), instance_descriptors()); | 272 ASSERT_EQ(GetHeap()->empty_descriptor_array(), instance_descriptors()); |
| 273 ASSERT_EQ(0, pre_allocated_property_fields()); | 273 ASSERT_EQ(0, pre_allocated_property_fields()); |
| 274 ASSERT_EQ(0, unused_property_fields()); | 274 ASSERT_EQ(0, unused_property_fields()); |
| 275 ASSERT_EQ(StaticVisitorBase::GetVisitorId(instance_type(), instance_size()), | 275 ASSERT_EQ(StaticVisitorBase::GetVisitorId(instance_type(), instance_size()), |
| 276 visitor_id()); | 276 visitor_id()); |
| 277 } | 277 } |
| 278 | 278 |
| 279 | 279 |
| 280 void CodeCache::CodeCacheVerify() { | 280 void CodeCache::CodeCacheVerify() { |
| 281 VerifyHeapPointer(default_cache()); | 281 VerifyHeapPointer(default_cache()); |
| 282 VerifyHeapPointer(normal_type_cache()); | 282 VerifyHeapPointer(normal_type_cache()); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 VerifyObjectField(kScriptOffset); | 316 VerifyObjectField(kScriptOffset); |
| 317 VerifyObjectField(kStackTraceOffset); | 317 VerifyObjectField(kStackTraceOffset); |
| 318 VerifyObjectField(kStackFramesOffset); | 318 VerifyObjectField(kStackFramesOffset); |
| 319 } | 319 } |
| 320 | 320 |
| 321 | 321 |
| 322 void String::StringVerify() { | 322 void String::StringVerify() { |
| 323 CHECK(IsString()); | 323 CHECK(IsString()); |
| 324 CHECK(length() >= 0 && length() <= Smi::kMaxValue); | 324 CHECK(length() >= 0 && length() <= Smi::kMaxValue); |
| 325 if (IsSymbol()) { | 325 if (IsSymbol()) { |
| 326 CHECK(!Heap::InNewSpace(this)); | 326 CHECK(!HEAP->InNewSpace(this)); |
| 327 } | 327 } |
| 328 } | 328 } |
| 329 | 329 |
| 330 | 330 |
| 331 void JSFunction::JSFunctionVerify() { | 331 void JSFunction::JSFunctionVerify() { |
| 332 CHECK(IsJSFunction()); | 332 CHECK(IsJSFunction()); |
| 333 VerifyObjectField(kPrototypeOrInitialMapOffset); | 333 VerifyObjectField(kPrototypeOrInitialMapOffset); |
| 334 VerifyObjectField(kNextFunctionLinkOffset); | 334 VerifyObjectField(kNextFunctionLinkOffset); |
| 335 CHECK(next_function_link()->IsUndefined() || | 335 CHECK(next_function_link()->IsUndefined() || |
| 336 next_function_link()->IsJSFunction()); | 336 next_function_link()->IsJSFunction()); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 VerifyObjectField(i); | 380 VerifyObjectField(i); |
| 381 } | 381 } |
| 382 } | 382 } |
| 383 | 383 |
| 384 | 384 |
| 385 void Oddball::OddballVerify() { | 385 void Oddball::OddballVerify() { |
| 386 CHECK(IsOddball()); | 386 CHECK(IsOddball()); |
| 387 VerifyHeapPointer(to_string()); | 387 VerifyHeapPointer(to_string()); |
| 388 Object* number = to_number(); | 388 Object* number = to_number(); |
| 389 if (number->IsHeapObject()) { | 389 if (number->IsHeapObject()) { |
| 390 ASSERT(number == Heap::nan_value()); | 390 ASSERT(number == HEAP->nan_value()); |
| 391 } else { | 391 } else { |
| 392 ASSERT(number->IsSmi()); | 392 ASSERT(number->IsSmi()); |
| 393 int value = Smi::cast(number)->value(); | 393 int value = Smi::cast(number)->value(); |
| 394 // Hidden oddballs have negative smis. | 394 // Hidden oddballs have negative smis. |
| 395 const int kLeastHiddenOddballNumber = -4; | 395 const int kLeastHiddenOddballNumber = -4; |
| 396 ASSERT(value <= 1); | 396 ASSERT(value <= 1); |
| 397 ASSERT(value >= kLeastHiddenOddballNumber); | 397 ASSERT(value >= kLeastHiddenOddballNumber); |
| 398 } | 398 } |
| 399 } | 399 } |
| 400 | 400 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 info->number_of_slow_unused_properties_ += | 591 info->number_of_slow_unused_properties_ += |
| 592 dict->Capacity() - dict->NumberOfElements(); | 592 dict->Capacity() - dict->NumberOfElements(); |
| 593 } | 593 } |
| 594 // Indexed properties | 594 // Indexed properties |
| 595 switch (GetElementsKind()) { | 595 switch (GetElementsKind()) { |
| 596 case FAST_ELEMENTS: { | 596 case FAST_ELEMENTS: { |
| 597 info->number_of_objects_with_fast_elements_++; | 597 info->number_of_objects_with_fast_elements_++; |
| 598 int holes = 0; | 598 int holes = 0; |
| 599 FixedArray* e = FixedArray::cast(elements()); | 599 FixedArray* e = FixedArray::cast(elements()); |
| 600 int len = e->length(); | 600 int len = e->length(); |
| 601 Heap* heap = HEAP; |
| 601 for (int i = 0; i < len; i++) { | 602 for (int i = 0; i < len; i++) { |
| 602 if (e->get(i) == Heap::the_hole_value()) holes++; | 603 if (e->get(i) == heap->the_hole_value()) holes++; |
| 603 } | 604 } |
| 604 info->number_of_fast_used_elements_ += len - holes; | 605 info->number_of_fast_used_elements_ += len - holes; |
| 605 info->number_of_fast_unused_elements_ += holes; | 606 info->number_of_fast_unused_elements_ += holes; |
| 606 break; | 607 break; |
| 607 } | 608 } |
| 608 case EXTERNAL_PIXEL_ELEMENTS: { | 609 case EXTERNAL_PIXEL_ELEMENTS: { |
| 609 info->number_of_objects_with_fast_elements_++; | 610 info->number_of_objects_with_fast_elements_++; |
| 610 ExternalPixelArray* e = ExternalPixelArray::cast(elements()); | 611 ExternalPixelArray* e = ExternalPixelArray::cast(elements()); |
| 611 info->number_of_fast_used_elements_ += e->length(); | 612 info->number_of_fast_used_elements_ += e->length(); |
| 612 break; | 613 break; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 ASSERT(e->IsUndefined()); | 721 ASSERT(e->IsUndefined()); |
| 721 } | 722 } |
| 722 } | 723 } |
| 723 } | 724 } |
| 724 } | 725 } |
| 725 | 726 |
| 726 | 727 |
| 727 #endif // DEBUG | 728 #endif // DEBUG |
| 728 | 729 |
| 729 } } // namespace v8::internal | 730 } } // namespace v8::internal |
| OLD | NEW |