OLD | NEW |
---|---|
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 17 matching lines...) Expand all Loading... | |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #include "disassembler.h" | 30 #include "disassembler.h" |
31 #include "disasm.h" | 31 #include "disasm.h" |
32 #include "jsregexp.h" | 32 #include "jsregexp.h" |
33 #include "objects-visiting.h" | 33 #include "objects-visiting.h" |
34 | 34 |
35 namespace v8 { | 35 namespace v8 { |
36 namespace internal { | 36 namespace internal { |
37 | 37 |
38 #ifdef DEBUG | 38 #ifdef VERIFY_HEAP |
39 | 39 |
40 void MaybeObject::Verify() { | 40 void MaybeObject::Verify() { |
41 Object* this_as_object; | 41 Object* this_as_object; |
42 if (ToObject(&this_as_object)) { | 42 if (ToObject(&this_as_object)) { |
43 if (this_as_object->IsSmi()) { | 43 if (this_as_object->IsSmi()) { |
44 Smi::cast(this_as_object)->SmiVerify(); | 44 Smi::cast(this_as_object)->SmiVerify(); |
45 } else { | 45 } else { |
46 HeapObject::cast(this_as_object)->HeapObjectVerify(); | 46 HeapObject::cast(this_as_object)->HeapObjectVerify(); |
47 } | 47 } |
48 } else { | 48 } else { |
49 Failure::cast(this)->FailureVerify(); | 49 Failure::cast(this)->FailureVerify(); |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 | 53 |
54 void Object::VerifyPointer(Object* p) { | 54 void Object::VerifyPointer(Object* p) { |
55 if (p->IsHeapObject()) { | 55 if (p->IsHeapObject()) { |
56 HeapObject::VerifyHeapPointer(p); | 56 HeapObject::VerifyHeapPointer(p); |
57 } else { | 57 } else { |
58 ASSERT(p->IsSmi()); | 58 CHECK(p->IsSmi()); |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 | 62 |
63 void Smi::SmiVerify() { | 63 void Smi::SmiVerify() { |
64 ASSERT(IsSmi()); | 64 CHECK(IsSmi()); |
65 } | 65 } |
66 | 66 |
67 | 67 |
68 void Failure::FailureVerify() { | 68 void Failure::FailureVerify() { |
69 ASSERT(IsFailure()); | 69 CHECK(IsFailure()); |
70 } | 70 } |
71 | 71 |
72 | 72 |
73 void HeapObject::HeapObjectVerify() { | 73 void HeapObject::HeapObjectVerify() { |
74 InstanceType instance_type = map()->instance_type(); | 74 InstanceType instance_type = map()->instance_type(); |
75 | 75 |
76 if (instance_type < FIRST_NONSTRING_TYPE) { | 76 if (instance_type < FIRST_NONSTRING_TYPE) { |
77 String::cast(this)->StringVerify(); | 77 String::cast(this)->StringVerify(); |
78 return; | 78 return; |
79 } | 79 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 #undef MAKE_STRUCT_CASE | 200 #undef MAKE_STRUCT_CASE |
201 | 201 |
202 default: | 202 default: |
203 UNREACHABLE(); | 203 UNREACHABLE(); |
204 break; | 204 break; |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
208 | 208 |
209 void HeapObject::VerifyHeapPointer(Object* p) { | 209 void HeapObject::VerifyHeapPointer(Object* p) { |
210 ASSERT(p->IsHeapObject()); | 210 CHECK(p->IsHeapObject()); |
211 ASSERT(HEAP->Contains(HeapObject::cast(p))); | 211 CHECK(HEAP->Contains(HeapObject::cast(p))); |
212 } | 212 } |
213 | 213 |
214 | 214 |
215 void HeapNumber::HeapNumberVerify() { | 215 void HeapNumber::HeapNumberVerify() { |
216 ASSERT(IsHeapNumber()); | 216 CHECK(IsHeapNumber()); |
217 } | 217 } |
218 | 218 |
219 | 219 |
220 void ByteArray::ByteArrayVerify() { | 220 void ByteArray::ByteArrayVerify() { |
221 ASSERT(IsByteArray()); | 221 CHECK(IsByteArray()); |
222 } | 222 } |
223 | 223 |
224 | 224 |
225 void FreeSpace::FreeSpaceVerify() { | 225 void FreeSpace::FreeSpaceVerify() { |
226 ASSERT(IsFreeSpace()); | 226 CHECK(IsFreeSpace()); |
227 } | 227 } |
228 | 228 |
229 | 229 |
230 void ExternalPixelArray::ExternalPixelArrayVerify() { | 230 void ExternalPixelArray::ExternalPixelArrayVerify() { |
231 ASSERT(IsExternalPixelArray()); | 231 CHECK(IsExternalPixelArray()); |
232 } | 232 } |
233 | 233 |
234 | 234 |
235 void ExternalByteArray::ExternalByteArrayVerify() { | 235 void ExternalByteArray::ExternalByteArrayVerify() { |
236 ASSERT(IsExternalByteArray()); | 236 CHECK(IsExternalByteArray()); |
237 } | 237 } |
238 | 238 |
239 | 239 |
240 void ExternalUnsignedByteArray::ExternalUnsignedByteArrayVerify() { | 240 void ExternalUnsignedByteArray::ExternalUnsignedByteArrayVerify() { |
241 ASSERT(IsExternalUnsignedByteArray()); | 241 CHECK(IsExternalUnsignedByteArray()); |
242 } | 242 } |
243 | 243 |
244 | 244 |
245 void ExternalShortArray::ExternalShortArrayVerify() { | 245 void ExternalShortArray::ExternalShortArrayVerify() { |
246 ASSERT(IsExternalShortArray()); | 246 CHECK(IsExternalShortArray()); |
247 } | 247 } |
248 | 248 |
249 | 249 |
250 void ExternalUnsignedShortArray::ExternalUnsignedShortArrayVerify() { | 250 void ExternalUnsignedShortArray::ExternalUnsignedShortArrayVerify() { |
251 ASSERT(IsExternalUnsignedShortArray()); | 251 CHECK(IsExternalUnsignedShortArray()); |
252 } | 252 } |
253 | 253 |
254 | 254 |
255 void ExternalIntArray::ExternalIntArrayVerify() { | 255 void ExternalIntArray::ExternalIntArrayVerify() { |
256 ASSERT(IsExternalIntArray()); | 256 CHECK(IsExternalIntArray()); |
257 } | 257 } |
258 | 258 |
259 | 259 |
260 void ExternalUnsignedIntArray::ExternalUnsignedIntArrayVerify() { | 260 void ExternalUnsignedIntArray::ExternalUnsignedIntArrayVerify() { |
261 ASSERT(IsExternalUnsignedIntArray()); | 261 CHECK(IsExternalUnsignedIntArray()); |
262 } | 262 } |
263 | 263 |
264 | 264 |
265 void ExternalFloatArray::ExternalFloatArrayVerify() { | 265 void ExternalFloatArray::ExternalFloatArrayVerify() { |
266 ASSERT(IsExternalFloatArray()); | 266 CHECK(IsExternalFloatArray()); |
267 } | 267 } |
268 | 268 |
269 | 269 |
270 void ExternalDoubleArray::ExternalDoubleArrayVerify() { | 270 void ExternalDoubleArray::ExternalDoubleArrayVerify() { |
271 ASSERT(IsExternalDoubleArray()); | 271 CHECK(IsExternalDoubleArray()); |
272 } | 272 } |
273 | 273 |
274 | 274 |
275 void JSObject::JSObjectVerify() { | 275 void JSObject::JSObjectVerify() { |
276 VerifyHeapPointer(properties()); | 276 VerifyHeapPointer(properties()); |
277 VerifyHeapPointer(elements()); | 277 VerifyHeapPointer(elements()); |
278 | 278 |
279 if (GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS) { | 279 if (GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS) { |
280 ASSERT(this->elements()->IsFixedArray()); | 280 CHECK(this->elements()->IsFixedArray()); |
281 ASSERT(this->elements()->length() >= 2); | 281 CHECK_GE(this->elements()->length(), 2); |
282 } | 282 } |
283 | 283 |
284 if (HasFastProperties()) { | 284 if (HasFastProperties()) { |
285 CHECK_EQ(map()->unused_property_fields(), | 285 CHECK_EQ(map()->unused_property_fields(), |
286 (map()->inobject_properties() + properties()->length() - | 286 (map()->inobject_properties() + properties()->length() - |
287 map()->NextFreePropertyIndex())); | 287 map()->NextFreePropertyIndex())); |
288 } | 288 } |
289 ASSERT_EQ((map()->has_fast_smi_or_object_elements() || | 289 CHECK_EQ((map()->has_fast_smi_or_object_elements() || |
290 (elements() == GetHeap()->empty_fixed_array())), | 290 (elements() == GetHeap()->empty_fixed_array())), |
291 (elements()->map() == GetHeap()->fixed_array_map() || | 291 (elements()->map() == GetHeap()->fixed_array_map() || |
292 elements()->map() == GetHeap()->fixed_cow_array_map())); | 292 elements()->map() == GetHeap()->fixed_cow_array_map())); |
293 ASSERT(map()->has_fast_object_elements() == HasFastObjectElements()); | 293 CHECK(map()->has_fast_object_elements() == HasFastObjectElements()); |
294 } | 294 } |
295 | 295 |
296 | 296 |
297 void Map::MapVerify() { | 297 void Map::MapVerify() { |
298 ASSERT(!HEAP->InNewSpace(this)); | 298 CHECK(!HEAP->InNewSpace(this)); |
299 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); | 299 CHECK(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); |
300 ASSERT(instance_size() == kVariableSizeSentinel || | 300 CHECK(instance_size() == kVariableSizeSentinel || |
301 (kPointerSize <= instance_size() && | 301 (kPointerSize <= instance_size() && |
302 instance_size() < HEAP->Capacity())); | 302 instance_size() < HEAP->Capacity())); |
303 VerifyHeapPointer(prototype()); | 303 VerifyHeapPointer(prototype()); |
304 VerifyHeapPointer(instance_descriptors()); | 304 VerifyHeapPointer(instance_descriptors()); |
305 DescriptorArray* descriptors = instance_descriptors(); | 305 DescriptorArray* descriptors = instance_descriptors(); |
306 for (int i = 0; i < NumberOfOwnDescriptors(); ++i) { | 306 for (int i = 0; i < NumberOfOwnDescriptors(); ++i) { |
307 ASSERT_EQ(i, descriptors->GetDetails(i).descriptor_index() - 1); | 307 CHECK_EQ(i, descriptors->GetDetails(i).descriptor_index() - 1); |
308 } | 308 } |
309 SLOW_ASSERT(instance_descriptors()->IsSortedNoDuplicates()); | 309 SLOW_ASSERT(instance_descriptors()->IsSortedNoDuplicates()); |
310 if (HasTransitionArray()) { | 310 if (HasTransitionArray()) { |
311 SLOW_ASSERT(transitions()->IsSortedNoDuplicates()); | 311 SLOW_ASSERT(transitions()->IsSortedNoDuplicates()); |
312 SLOW_ASSERT(transitions()->IsConsistentWithBackPointers(this)); | 312 SLOW_ASSERT(transitions()->IsConsistentWithBackPointers(this)); |
313 } | 313 } |
314 } | 314 } |
315 | 315 |
316 | 316 |
317 void Map::SharedMapVerify() { | 317 void Map::SharedMapVerify() { |
318 MapVerify(); | 318 MapVerify(); |
319 ASSERT(is_shared()); | 319 CHECK(is_shared()); |
320 ASSERT(instance_descriptors()->IsEmpty()); | 320 CHECK(instance_descriptors()->IsEmpty()); |
321 ASSERT_EQ(0, pre_allocated_property_fields()); | 321 CHECK_EQ(0, pre_allocated_property_fields()); |
322 ASSERT_EQ(0, unused_property_fields()); | 322 CHECK_EQ(0, unused_property_fields()); |
323 ASSERT_EQ(StaticVisitorBase::GetVisitorId(instance_type(), instance_size()), | 323 CHECK_EQ(StaticVisitorBase::GetVisitorId(instance_type(), instance_size()), |
324 visitor_id()); | 324 visitor_id()); |
325 } | 325 } |
326 | 326 |
327 | 327 |
328 void CodeCache::CodeCacheVerify() { | 328 void CodeCache::CodeCacheVerify() { |
329 VerifyHeapPointer(default_cache()); | 329 VerifyHeapPointer(default_cache()); |
330 VerifyHeapPointer(normal_type_cache()); | 330 VerifyHeapPointer(normal_type_cache()); |
331 ASSERT(default_cache()->IsFixedArray()); | 331 CHECK(default_cache()->IsFixedArray()); |
332 ASSERT(normal_type_cache()->IsUndefined() | 332 CHECK(normal_type_cache()->IsUndefined() |
333 || normal_type_cache()->IsCodeCacheHashTable()); | 333 || normal_type_cache()->IsCodeCacheHashTable()); |
334 } | 334 } |
335 | 335 |
336 | 336 |
337 void PolymorphicCodeCache::PolymorphicCodeCacheVerify() { | 337 void PolymorphicCodeCache::PolymorphicCodeCacheVerify() { |
338 VerifyHeapPointer(cache()); | 338 VerifyHeapPointer(cache()); |
339 ASSERT(cache()->IsUndefined() || cache()->IsPolymorphicCodeCacheHashTable()); | 339 CHECK(cache()->IsUndefined() || cache()->IsPolymorphicCodeCacheHashTable()); |
340 } | 340 } |
341 | 341 |
342 | 342 |
343 void TypeFeedbackInfo::TypeFeedbackInfoVerify() { | 343 void TypeFeedbackInfo::TypeFeedbackInfoVerify() { |
344 VerifyObjectField(kStorage1Offset); | 344 VerifyObjectField(kStorage1Offset); |
345 VerifyObjectField(kStorage2Offset); | 345 VerifyObjectField(kStorage2Offset); |
346 VerifyHeapPointer(type_feedback_cells()); | 346 VerifyHeapPointer(type_feedback_cells()); |
347 } | 347 } |
348 | 348 |
349 | 349 |
(...skipping 11 matching lines...) Expand all Loading... | |
361 e->Verify(); | 361 e->Verify(); |
362 } | 362 } |
363 } | 363 } |
364 } | 364 } |
365 | 365 |
366 | 366 |
367 void FixedDoubleArray::FixedDoubleArrayVerify() { | 367 void FixedDoubleArray::FixedDoubleArrayVerify() { |
368 for (int i = 0; i < length(); i++) { | 368 for (int i = 0; i < length(); i++) { |
369 if (!is_the_hole(i)) { | 369 if (!is_the_hole(i)) { |
370 double value = get_scalar(i); | 370 double value = get_scalar(i); |
371 ASSERT(!isnan(value) || | 371 CHECK(!isnan(value) || |
372 (BitCast<uint64_t>(value) == | 372 (BitCast<uint64_t>(value) == |
373 BitCast<uint64_t>(canonical_not_the_hole_nan_as_double())) || | 373 BitCast<uint64_t>(canonical_not_the_hole_nan_as_double())) || |
374 ((BitCast<uint64_t>(value) & Double::kSignMask) != 0)); | 374 ((BitCast<uint64_t>(value) & Double::kSignMask) != 0)); |
375 } | 375 } |
376 } | 376 } |
377 } | 377 } |
378 | 378 |
379 | 379 |
380 void JSModule::JSModuleVerify() { | 380 void JSModule::JSModuleVerify() { |
381 VerifyObjectField(kContextOffset); | 381 VerifyObjectField(kContextOffset); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
548 VerifyObjectField(i); | 548 VerifyObjectField(i); |
549 } | 549 } |
550 } | 550 } |
551 | 551 |
552 | 552 |
553 void Oddball::OddballVerify() { | 553 void Oddball::OddballVerify() { |
554 CHECK(IsOddball()); | 554 CHECK(IsOddball()); |
555 VerifyHeapPointer(to_string()); | 555 VerifyHeapPointer(to_string()); |
556 Object* number = to_number(); | 556 Object* number = to_number(); |
557 if (number->IsHeapObject()) { | 557 if (number->IsHeapObject()) { |
558 ASSERT(number == HEAP->nan_value()); | 558 CHECK(number == HEAP->nan_value()); |
559 } else { | 559 } else { |
560 ASSERT(number->IsSmi()); | 560 CHECK(number->IsSmi()); |
561 int value = Smi::cast(number)->value(); | 561 int value = Smi::cast(number)->value(); |
562 // Hidden oddballs have negative smis. | 562 // Hidden oddballs have negative smis. |
563 const int kLeastHiddenOddballNumber = -4; | 563 const int kLeastHiddenOddballNumber = -4; |
564 ASSERT(value <= 1); | 564 CHECK_LE(value, 1); |
565 ASSERT(value >= kLeastHiddenOddballNumber); | 565 CHECK(value >= kLeastHiddenOddballNumber); |
566 } | 566 } |
567 } | 567 } |
568 | 568 |
569 | 569 |
570 void JSGlobalPropertyCell::JSGlobalPropertyCellVerify() { | 570 void JSGlobalPropertyCell::JSGlobalPropertyCellVerify() { |
571 CHECK(IsJSGlobalPropertyCell()); | 571 CHECK(IsJSGlobalPropertyCell()); |
572 VerifyObjectField(kValueOffset); | 572 VerifyObjectField(kValueOffset); |
573 } | 573 } |
574 | 574 |
575 | 575 |
576 void Code::CodeVerify() { | 576 void Code::CodeVerify() { |
577 CHECK(IsAligned(reinterpret_cast<intptr_t>(instruction_start()), | 577 CHECK(IsAligned(reinterpret_cast<intptr_t>(instruction_start()), |
578 kCodeAlignment)); | 578 kCodeAlignment)); |
579 relocation_info()->Verify(); | 579 relocation_info()->Verify(); |
580 Address last_gc_pc = NULL; | 580 Address last_gc_pc = NULL; |
581 for (RelocIterator it(this); !it.done(); it.next()) { | 581 for (RelocIterator it(this); !it.done(); it.next()) { |
582 it.rinfo()->Verify(); | 582 it.rinfo()->Verify(); |
583 // Ensure that GC will not iterate twice over the same pointer. | 583 // Ensure that GC will not iterate twice over the same pointer. |
584 if (RelocInfo::IsGCRelocMode(it.rinfo()->rmode())) { | 584 if (RelocInfo::IsGCRelocMode(it.rinfo()->rmode())) { |
585 CHECK(it.rinfo()->pc() != last_gc_pc); | 585 CHECK(it.rinfo()->pc() != last_gc_pc); |
586 last_gc_pc = it.rinfo()->pc(); | 586 last_gc_pc = it.rinfo()->pc(); |
587 } | 587 } |
588 } | 588 } |
589 } | 589 } |
590 | 590 |
591 | 591 |
592 void JSArray::JSArrayVerify() { | 592 void JSArray::JSArrayVerify() { |
593 JSObjectVerify(); | 593 JSObjectVerify(); |
594 ASSERT(length()->IsNumber() || length()->IsUndefined()); | 594 CHECK(length()->IsNumber() || length()->IsUndefined()); |
595 ASSERT(elements()->IsUndefined() || | 595 CHECK(elements()->IsUndefined() || |
596 elements()->IsFixedArray() || | 596 elements()->IsFixedArray() || |
597 elements()->IsFixedDoubleArray()); | 597 elements()->IsFixedDoubleArray()); |
598 } | 598 } |
599 | 599 |
600 | 600 |
601 void JSSet::JSSetVerify() { | 601 void JSSet::JSSetVerify() { |
602 CHECK(IsJSSet()); | 602 CHECK(IsJSSet()); |
603 JSObjectVerify(); | 603 JSObjectVerify(); |
604 VerifyHeapPointer(table()); | 604 VerifyHeapPointer(table()); |
605 ASSERT(table()->IsHashTable() || table()->IsUndefined()); | 605 CHECK(table()->IsHashTable() || table()->IsUndefined()); |
606 } | 606 } |
607 | 607 |
608 | 608 |
609 void JSMap::JSMapVerify() { | 609 void JSMap::JSMapVerify() { |
610 CHECK(IsJSMap()); | 610 CHECK(IsJSMap()); |
611 JSObjectVerify(); | 611 JSObjectVerify(); |
612 VerifyHeapPointer(table()); | 612 VerifyHeapPointer(table()); |
613 ASSERT(table()->IsHashTable() || table()->IsUndefined()); | 613 CHECK(table()->IsHashTable() || table()->IsUndefined()); |
614 } | 614 } |
615 | 615 |
616 | 616 |
617 void JSWeakMap::JSWeakMapVerify() { | 617 void JSWeakMap::JSWeakMapVerify() { |
618 CHECK(IsJSWeakMap()); | 618 CHECK(IsJSWeakMap()); |
619 JSObjectVerify(); | 619 JSObjectVerify(); |
620 VerifyHeapPointer(table()); | 620 VerifyHeapPointer(table()); |
621 ASSERT(table()->IsHashTable() || table()->IsUndefined()); | 621 CHECK(table()->IsHashTable() || table()->IsUndefined()); |
622 } | 622 } |
623 | 623 |
624 | 624 |
625 void JSRegExp::JSRegExpVerify() { | 625 void JSRegExp::JSRegExpVerify() { |
626 JSObjectVerify(); | 626 JSObjectVerify(); |
627 ASSERT(data()->IsUndefined() || data()->IsFixedArray()); | 627 CHECK(data()->IsUndefined() || data()->IsFixedArray()); |
628 switch (TypeTag()) { | 628 switch (TypeTag()) { |
629 case JSRegExp::ATOM: { | 629 case JSRegExp::ATOM: { |
630 FixedArray* arr = FixedArray::cast(data()); | 630 FixedArray* arr = FixedArray::cast(data()); |
631 ASSERT(arr->get(JSRegExp::kAtomPatternIndex)->IsString()); | 631 CHECK(arr->get(JSRegExp::kAtomPatternIndex)->IsString()); |
632 break; | 632 break; |
633 } | 633 } |
634 case JSRegExp::IRREGEXP: { | 634 case JSRegExp::IRREGEXP: { |
635 bool is_native = RegExpImpl::UsesNativeRegExp(); | 635 bool is_native = RegExpImpl::UsesNativeRegExp(); |
636 | 636 |
637 FixedArray* arr = FixedArray::cast(data()); | 637 FixedArray* arr = FixedArray::cast(data()); |
638 Object* ascii_data = arr->get(JSRegExp::kIrregexpASCIICodeIndex); | 638 Object* ascii_data = arr->get(JSRegExp::kIrregexpASCIICodeIndex); |
639 // Smi : Not compiled yet (-1) or code prepared for flushing. | 639 // Smi : Not compiled yet (-1) or code prepared for flushing. |
640 // JSObject: Compilation error. | 640 // JSObject: Compilation error. |
641 // Code/ByteArray: Compiled code. | 641 // Code/ByteArray: Compiled code. |
642 ASSERT(ascii_data->IsSmi() || | 642 CHECK(ascii_data->IsSmi() || |
643 (is_native ? ascii_data->IsCode() : ascii_data->IsByteArray())); | 643 (is_native ? ascii_data->IsCode() : ascii_data->IsByteArray())); |
644 Object* uc16_data = arr->get(JSRegExp::kIrregexpUC16CodeIndex); | 644 Object* uc16_data = arr->get(JSRegExp::kIrregexpUC16CodeIndex); |
645 ASSERT(uc16_data->IsSmi() || | 645 CHECK(uc16_data->IsSmi() || |
646 (is_native ? uc16_data->IsCode() : uc16_data->IsByteArray())); | 646 (is_native ? uc16_data->IsCode() : uc16_data->IsByteArray())); |
647 | 647 |
648 Object* ascii_saved = arr->get(JSRegExp::kIrregexpASCIICodeSavedIndex); | 648 Object* ascii_saved = arr->get(JSRegExp::kIrregexpASCIICodeSavedIndex); |
649 ASSERT(ascii_saved->IsSmi() || ascii_saved->IsString() || | 649 CHECK(ascii_saved->IsSmi() || ascii_saved->IsString() || |
650 ascii_saved->IsCode()); | 650 ascii_saved->IsCode()); |
651 Object* uc16_saved = arr->get(JSRegExp::kIrregexpUC16CodeSavedIndex); | 651 Object* uc16_saved = arr->get(JSRegExp::kIrregexpUC16CodeSavedIndex); |
652 ASSERT(uc16_saved->IsSmi() || uc16_saved->IsString() || | 652 CHECK(uc16_saved->IsSmi() || uc16_saved->IsString() || |
653 uc16_saved->IsCode()); | 653 uc16_saved->IsCode()); |
654 | 654 |
655 ASSERT(arr->get(JSRegExp::kIrregexpCaptureCountIndex)->IsSmi()); | 655 CHECK(arr->get(JSRegExp::kIrregexpCaptureCountIndex)->IsSmi()); |
656 ASSERT(arr->get(JSRegExp::kIrregexpMaxRegisterCountIndex)->IsSmi()); | 656 CHECK(arr->get(JSRegExp::kIrregexpMaxRegisterCountIndex)->IsSmi()); |
657 break; | 657 break; |
658 } | 658 } |
659 default: | 659 default: |
660 ASSERT_EQ(JSRegExp::NOT_COMPILED, TypeTag()); | 660 CHECK_EQ(JSRegExp::NOT_COMPILED, TypeTag()); |
661 ASSERT(data()->IsUndefined()); | 661 CHECK(data()->IsUndefined()); |
662 break; | 662 break; |
663 } | 663 } |
664 } | 664 } |
665 | 665 |
666 | 666 |
667 void JSProxy::JSProxyVerify() { | 667 void JSProxy::JSProxyVerify() { |
668 CHECK(IsJSProxy()); | 668 CHECK(IsJSProxy()); |
669 VerifyPointer(handler()); | 669 VerifyPointer(handler()); |
670 ASSERT(hash()->IsSmi() || hash()->IsUndefined()); | 670 CHECK(hash()->IsSmi() || hash()->IsUndefined()); |
671 } | 671 } |
672 | 672 |
673 | 673 |
674 void JSFunctionProxy::JSFunctionProxyVerify() { | 674 void JSFunctionProxy::JSFunctionProxyVerify() { |
675 CHECK(IsJSFunctionProxy()); | 675 CHECK(IsJSFunctionProxy()); |
676 JSProxyVerify(); | 676 JSProxyVerify(); |
677 VerifyPointer(call_trap()); | 677 VerifyPointer(call_trap()); |
678 VerifyPointer(construct_trap()); | 678 VerifyPointer(construct_trap()); |
679 } | 679 } |
680 | 680 |
681 | 681 |
682 void Foreign::ForeignVerify() { | 682 void Foreign::ForeignVerify() { |
683 ASSERT(IsForeign()); | 683 CHECK(IsForeign()); |
684 } | 684 } |
685 | 685 |
686 | 686 |
687 void AccessorInfo::AccessorInfoVerify() { | 687 void AccessorInfo::AccessorInfoVerify() { |
688 CHECK(IsAccessorInfo()); | 688 CHECK(IsAccessorInfo()); |
689 VerifyPointer(getter()); | 689 VerifyPointer(getter()); |
690 VerifyPointer(setter()); | 690 VerifyPointer(setter()); |
691 VerifyPointer(name()); | 691 VerifyPointer(name()); |
692 VerifyPointer(data()); | 692 VerifyPointer(data()); |
693 VerifyPointer(flag()); | 693 VerifyPointer(flag()); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
775 VerifyPointer(source()); | 775 VerifyPointer(source()); |
776 VerifyPointer(name()); | 776 VerifyPointer(name()); |
777 line_offset()->SmiVerify(); | 777 line_offset()->SmiVerify(); |
778 column_offset()->SmiVerify(); | 778 column_offset()->SmiVerify(); |
779 VerifyPointer(data()); | 779 VerifyPointer(data()); |
780 VerifyPointer(wrapper()); | 780 VerifyPointer(wrapper()); |
781 type()->SmiVerify(); | 781 type()->SmiVerify(); |
782 VerifyPointer(line_ends()); | 782 VerifyPointer(line_ends()); |
783 VerifyPointer(id()); | 783 VerifyPointer(id()); |
784 } | 784 } |
785 | 785 |
Michael Starzinger
2012/10/12 10:53:16
Two empty newlines between function implementation
| |
786 void JSFunctionResultCache::JSFunctionResultCacheVerify() { | |
787 JSFunction::cast(get(kFactoryIndex))->Verify(); | |
788 | |
789 int size = Smi::cast(get(kCacheSizeIndex))->value(); | |
790 CHECK(kEntriesIndex <= size); | |
791 CHECK(size <= length()); | |
792 CHECK_EQ(0, size % kEntrySize); | |
793 | |
794 int finger = Smi::cast(get(kFingerIndex))->value(); | |
795 CHECK(kEntriesIndex <= finger); | |
796 CHECK((finger < size) || (finger == kEntriesIndex && finger == size)); | |
797 CHECK_EQ(0, finger % kEntrySize); | |
798 | |
799 if (FLAG_enable_slow_asserts) { | |
800 for (int i = kEntriesIndex; i < size; i++) { | |
801 CHECK(!get(i)->IsTheHole()); | |
802 get(i)->Verify(); | |
803 } | |
804 for (int i = size; i < length(); i++) { | |
805 CHECK(get(i)->IsTheHole()); | |
806 get(i)->Verify(); | |
807 } | |
808 } | |
809 } | |
810 | |
811 | |
812 void NormalizedMapCache::NormalizedMapCacheVerify() { | |
813 FixedArray::cast(this)->Verify(); | |
814 if (FLAG_enable_slow_asserts) { | |
815 for (int i = 0; i < length(); i++) { | |
816 Object* e = get(i); | |
817 if (e->IsMap()) { | |
818 Map::cast(e)->SharedMapVerify(); | |
819 } else { | |
820 CHECK(e->IsUndefined()); | |
821 } | |
822 } | |
823 } | |
824 } | |
786 | 825 |
Michael Starzinger
2012/10/12 10:53:16
Two empty newlines between function implementation
| |
787 #ifdef ENABLE_DEBUGGER_SUPPORT | 826 #ifdef ENABLE_DEBUGGER_SUPPORT |
788 void DebugInfo::DebugInfoVerify() { | 827 void DebugInfo::DebugInfoVerify() { |
789 CHECK(IsDebugInfo()); | 828 CHECK(IsDebugInfo()); |
790 VerifyPointer(shared()); | 829 VerifyPointer(shared()); |
791 VerifyPointer(original_code()); | 830 VerifyPointer(original_code()); |
792 VerifyPointer(code()); | 831 VerifyPointer(code()); |
793 VerifyPointer(break_points()); | 832 VerifyPointer(break_points()); |
794 } | 833 } |
795 | 834 |
796 | 835 |
797 void BreakPointInfo::BreakPointInfoVerify() { | 836 void BreakPointInfo::BreakPointInfoVerify() { |
798 CHECK(IsBreakPointInfo()); | 837 CHECK(IsBreakPointInfo()); |
799 code_position()->SmiVerify(); | 838 code_position()->SmiVerify(); |
800 source_position()->SmiVerify(); | 839 source_position()->SmiVerify(); |
801 statement_position()->SmiVerify(); | 840 statement_position()->SmiVerify(); |
802 VerifyPointer(break_point_objects()); | 841 VerifyPointer(break_point_objects()); |
803 } | 842 } |
804 #endif // ENABLE_DEBUGGER_SUPPORT | 843 #endif // ENABLE_DEBUGGER_SUPPORT |
844 #endif // VERIFY_HEAP | |
805 | 845 |
846 #ifdef DEBUG | |
806 | 847 |
807 void JSObject::IncrementSpillStatistics(SpillInformation* info) { | 848 void JSObject::IncrementSpillStatistics(SpillInformation* info) { |
808 info->number_of_objects_++; | 849 info->number_of_objects_++; |
809 // Named properties | 850 // Named properties |
810 if (HasFastProperties()) { | 851 if (HasFastProperties()) { |
811 info->number_of_objects_with_fast_properties_++; | 852 info->number_of_objects_with_fast_properties_++; |
812 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); | 853 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); |
813 info->number_of_fast_unused_fields_ += map()->unused_property_fields(); | 854 info->number_of_fast_unused_fields_ += map()->unused_property_fields(); |
814 } else { | 855 } else { |
815 StringDictionary* dict = property_dictionary(); | 856 StringDictionary* dict = property_dictionary(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
955 !CheckOneBackPointer(current_map, elements_transition())) { | 996 !CheckOneBackPointer(current_map, elements_transition())) { |
956 return false; | 997 return false; |
957 } | 998 } |
958 for (int i = 0; i < number_of_transitions(); ++i) { | 999 for (int i = 0; i < number_of_transitions(); ++i) { |
959 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; | 1000 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; |
960 } | 1001 } |
961 return true; | 1002 return true; |
962 } | 1003 } |
963 | 1004 |
964 | 1005 |
965 void JSFunctionResultCache::JSFunctionResultCacheVerify() { | |
966 JSFunction::cast(get(kFactoryIndex))->Verify(); | |
967 | |
968 int size = Smi::cast(get(kCacheSizeIndex))->value(); | |
969 ASSERT(kEntriesIndex <= size); | |
970 ASSERT(size <= length()); | |
971 ASSERT_EQ(0, size % kEntrySize); | |
972 | |
973 int finger = Smi::cast(get(kFingerIndex))->value(); | |
974 ASSERT(kEntriesIndex <= finger); | |
975 ASSERT((finger < size) || (finger == kEntriesIndex && finger == size)); | |
976 ASSERT_EQ(0, finger % kEntrySize); | |
977 | |
978 if (FLAG_enable_slow_asserts) { | |
979 for (int i = kEntriesIndex; i < size; i++) { | |
980 ASSERT(!get(i)->IsTheHole()); | |
981 get(i)->Verify(); | |
982 } | |
983 for (int i = size; i < length(); i++) { | |
984 ASSERT(get(i)->IsTheHole()); | |
985 get(i)->Verify(); | |
986 } | |
987 } | |
988 } | |
989 | |
990 | |
991 void NormalizedMapCache::NormalizedMapCacheVerify() { | |
992 FixedArray::cast(this)->Verify(); | |
993 if (FLAG_enable_slow_asserts) { | |
994 for (int i = 0; i < length(); i++) { | |
995 Object* e = get(i); | |
996 if (e->IsMap()) { | |
997 Map::cast(e)->SharedMapVerify(); | |
998 } else { | |
999 ASSERT(e->IsUndefined()); | |
1000 } | |
1001 } | |
1002 } | |
1003 } | |
1004 | |
1005 | |
1006 void Map::ZapTransitions() { | |
1007 TransitionArray* transition_array = transitions(); | |
1008 MemsetPointer(transition_array->data_start(), | |
1009 GetHeap()->the_hole_value(), | |
1010 transition_array->length()); | |
1011 } | |
1012 | |
1013 | |
1014 void Map::ZapPrototypeTransitions() { | |
1015 FixedArray* proto_transitions = GetPrototypeTransitions(); | |
1016 MemsetPointer(proto_transitions->data_start(), | |
1017 GetHeap()->the_hole_value(), | |
1018 proto_transitions->length()); | |
1019 } | |
1020 | |
1021 | |
1022 #endif // DEBUG | 1006 #endif // DEBUG |
1023 | 1007 |
1024 } } // namespace v8::internal | 1008 } } // namespace v8::internal |
OLD | NEW |