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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 171 |
172 default: | 172 default: |
173 UNREACHABLE(); | 173 UNREACHABLE(); |
174 break; | 174 break; |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 | 178 |
179 void HeapObject::VerifyHeapPointer(Object* p) { | 179 void HeapObject::VerifyHeapPointer(Object* p) { |
180 ASSERT(p->IsHeapObject()); | 180 ASSERT(p->IsHeapObject()); |
181 ASSERT(Heap::Contains(HeapObject::cast(p))); | 181 ASSERT(HEAP->Contains(HeapObject::cast(p))); |
182 } | 182 } |
183 | 183 |
184 | 184 |
185 void HeapNumber::HeapNumberVerify() { | 185 void HeapNumber::HeapNumberVerify() { |
186 ASSERT(IsHeapNumber()); | 186 ASSERT(IsHeapNumber()); |
187 } | 187 } |
188 | 188 |
189 | 189 |
190 void ByteArray::ByteArrayVerify() { | 190 void ByteArray::ByteArrayVerify() { |
191 ASSERT(IsByteArray()); | 191 ASSERT(IsByteArray()); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 void JSObject::JSObjectVerify() { | 235 void JSObject::JSObjectVerify() { |
236 VerifyHeapPointer(properties()); | 236 VerifyHeapPointer(properties()); |
237 VerifyHeapPointer(elements()); | 237 VerifyHeapPointer(elements()); |
238 if (HasFastProperties()) { | 238 if (HasFastProperties()) { |
239 CHECK_EQ(map()->unused_property_fields(), | 239 CHECK_EQ(map()->unused_property_fields(), |
240 (map()->inobject_properties() + properties()->length() - | 240 (map()->inobject_properties() + properties()->length() - |
241 map()->NextFreePropertyIndex())); | 241 map()->NextFreePropertyIndex())); |
242 } | 242 } |
243 ASSERT(map()->has_fast_elements() == | 243 ASSERT(map()->has_fast_elements() == |
244 (elements()->map() == Heap::fixed_array_map() || | 244 (elements()->map() == GetHeap()->fixed_array_map() || |
245 elements()->map() == Heap::fixed_cow_array_map())); | 245 elements()->map() == GetHeap()->fixed_cow_array_map())); |
246 ASSERT(map()->has_fast_elements() == HasFastElements()); | 246 ASSERT(map()->has_fast_elements() == HasFastElements()); |
247 } | 247 } |
248 | 248 |
249 | 249 |
250 void Map::MapVerify() { | 250 void Map::MapVerify() { |
251 ASSERT(!Heap::InNewSpace(this)); | 251 ASSERT(!HEAP->InNewSpace(this)); |
252 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); | 252 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); |
253 ASSERT(instance_size() == kVariableSizeSentinel || | 253 ASSERT(instance_size() == kVariableSizeSentinel || |
254 (kPointerSize <= instance_size() && | 254 (kPointerSize <= instance_size() && |
255 instance_size() < Heap::Capacity())); | 255 instance_size() < HEAP->Capacity())); |
256 VerifyHeapPointer(prototype()); | 256 VerifyHeapPointer(prototype()); |
257 VerifyHeapPointer(instance_descriptors()); | 257 VerifyHeapPointer(instance_descriptors()); |
258 } | 258 } |
259 | 259 |
260 | 260 |
261 void Map::SharedMapVerify() { | 261 void Map::SharedMapVerify() { |
262 MapVerify(); | 262 MapVerify(); |
263 ASSERT(is_shared()); | 263 ASSERT(is_shared()); |
264 ASSERT_EQ(Heap::empty_descriptor_array(), instance_descriptors()); | 264 ASSERT_EQ(GetHeap()->empty_descriptor_array(), instance_descriptors()); |
265 ASSERT_EQ(0, pre_allocated_property_fields()); | 265 ASSERT_EQ(0, pre_allocated_property_fields()); |
266 ASSERT_EQ(0, unused_property_fields()); | 266 ASSERT_EQ(0, unused_property_fields()); |
267 ASSERT_EQ(StaticVisitorBase::GetVisitorId(instance_type(), instance_size()), | 267 ASSERT_EQ(StaticVisitorBase::GetVisitorId(instance_type(), instance_size()), |
268 visitor_id()); | 268 visitor_id()); |
269 } | 269 } |
270 | 270 |
271 | 271 |
272 void CodeCache::CodeCacheVerify() { | 272 void CodeCache::CodeCacheVerify() { |
273 VerifyHeapPointer(default_cache()); | 273 VerifyHeapPointer(default_cache()); |
274 VerifyHeapPointer(normal_type_cache()); | 274 VerifyHeapPointer(normal_type_cache()); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 VerifyObjectField(kScriptOffset); | 308 VerifyObjectField(kScriptOffset); |
309 VerifyObjectField(kStackTraceOffset); | 309 VerifyObjectField(kStackTraceOffset); |
310 VerifyObjectField(kStackFramesOffset); | 310 VerifyObjectField(kStackFramesOffset); |
311 } | 311 } |
312 | 312 |
313 | 313 |
314 void String::StringVerify() { | 314 void String::StringVerify() { |
315 CHECK(IsString()); | 315 CHECK(IsString()); |
316 CHECK(length() >= 0 && length() <= Smi::kMaxValue); | 316 CHECK(length() >= 0 && length() <= Smi::kMaxValue); |
317 if (IsSymbol()) { | 317 if (IsSymbol()) { |
318 CHECK(!Heap::InNewSpace(this)); | 318 CHECK(!HEAP->InNewSpace(this)); |
319 } | 319 } |
320 } | 320 } |
321 | 321 |
322 | 322 |
323 void JSFunction::JSFunctionVerify() { | 323 void JSFunction::JSFunctionVerify() { |
324 CHECK(IsJSFunction()); | 324 CHECK(IsJSFunction()); |
325 VerifyObjectField(kPrototypeOrInitialMapOffset); | 325 VerifyObjectField(kPrototypeOrInitialMapOffset); |
326 VerifyObjectField(kNextFunctionLinkOffset); | 326 VerifyObjectField(kNextFunctionLinkOffset); |
327 CHECK(next_function_link()->IsUndefined() || | 327 CHECK(next_function_link()->IsUndefined() || |
328 next_function_link()->IsJSFunction()); | 328 next_function_link()->IsJSFunction()); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 VerifyObjectField(i); | 372 VerifyObjectField(i); |
373 } | 373 } |
374 } | 374 } |
375 | 375 |
376 | 376 |
377 void Oddball::OddballVerify() { | 377 void Oddball::OddballVerify() { |
378 CHECK(IsOddball()); | 378 CHECK(IsOddball()); |
379 VerifyHeapPointer(to_string()); | 379 VerifyHeapPointer(to_string()); |
380 Object* number = to_number(); | 380 Object* number = to_number(); |
381 if (number->IsHeapObject()) { | 381 if (number->IsHeapObject()) { |
382 ASSERT(number == Heap::nan_value()); | 382 ASSERT(number == HEAP->nan_value()); |
383 } else { | 383 } else { |
384 ASSERT(number->IsSmi()); | 384 ASSERT(number->IsSmi()); |
385 int value = Smi::cast(number)->value(); | 385 int value = Smi::cast(number)->value(); |
386 // Hidden oddballs have negative smis. | 386 // Hidden oddballs have negative smis. |
387 const int kLeastHiddenOddballNumber = -4; | 387 const int kLeastHiddenOddballNumber = -4; |
388 ASSERT(value <= 1); | 388 ASSERT(value <= 1); |
389 ASSERT(value >= kLeastHiddenOddballNumber); | 389 ASSERT(value >= kLeastHiddenOddballNumber); |
390 } | 390 } |
391 } | 391 } |
392 | 392 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 info->number_of_slow_unused_properties_ += | 583 info->number_of_slow_unused_properties_ += |
584 dict->Capacity() - dict->NumberOfElements(); | 584 dict->Capacity() - dict->NumberOfElements(); |
585 } | 585 } |
586 // Indexed properties | 586 // Indexed properties |
587 switch (GetElementsKind()) { | 587 switch (GetElementsKind()) { |
588 case FAST_ELEMENTS: { | 588 case FAST_ELEMENTS: { |
589 info->number_of_objects_with_fast_elements_++; | 589 info->number_of_objects_with_fast_elements_++; |
590 int holes = 0; | 590 int holes = 0; |
591 FixedArray* e = FixedArray::cast(elements()); | 591 FixedArray* e = FixedArray::cast(elements()); |
592 int len = e->length(); | 592 int len = e->length(); |
| 593 Heap* heap = HEAP; |
593 for (int i = 0; i < len; i++) { | 594 for (int i = 0; i < len; i++) { |
594 if (e->get(i) == Heap::the_hole_value()) holes++; | 595 if (e->get(i) == heap->the_hole_value()) holes++; |
595 } | 596 } |
596 info->number_of_fast_used_elements_ += len - holes; | 597 info->number_of_fast_used_elements_ += len - holes; |
597 info->number_of_fast_unused_elements_ += holes; | 598 info->number_of_fast_unused_elements_ += holes; |
598 break; | 599 break; |
599 } | 600 } |
600 case EXTERNAL_PIXEL_ELEMENTS: { | 601 case EXTERNAL_PIXEL_ELEMENTS: { |
601 info->number_of_objects_with_fast_elements_++; | 602 info->number_of_objects_with_fast_elements_++; |
602 ExternalPixelArray* e = ExternalPixelArray::cast(elements()); | 603 ExternalPixelArray* e = ExternalPixelArray::cast(elements()); |
603 info->number_of_fast_used_elements_ += e->length(); | 604 info->number_of_fast_used_elements_ += e->length(); |
604 break; | 605 break; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 ASSERT(e->IsUndefined()); | 713 ASSERT(e->IsUndefined()); |
713 } | 714 } |
714 } | 715 } |
715 } | 716 } |
716 } | 717 } |
717 | 718 |
718 | 719 |
719 #endif // DEBUG | 720 #endif // DEBUG |
720 | 721 |
721 } } // namespace v8::internal | 722 } } // namespace v8::internal |
OLD | NEW |