| 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 HeapObject* ho = HeapObject::cast(p); | 236 HeapObject* ho = HeapObject::cast(p); |
| 237 CHECK(ho->GetHeap()->Contains(ho)); | 237 CHECK(ho->GetHeap()->Contains(ho)); |
| 238 } | 238 } |
| 239 | 239 |
| 240 | 240 |
| 241 void Symbol::SymbolVerify() { | 241 void Symbol::SymbolVerify() { |
| 242 CHECK(IsSymbol()); | 242 CHECK(IsSymbol()); |
| 243 CHECK(HasHashCode()); | 243 CHECK(HasHashCode()); |
| 244 CHECK_GT(Hash(), 0); | 244 CHECK_GT(Hash(), 0); |
| 245 CHECK(name()->IsUndefined() || name()->IsString()); | 245 CHECK(name()->IsUndefined() || name()->IsString()); |
| 246 CHECK(flags()->IsSmi()); |
| 246 } | 247 } |
| 247 | 248 |
| 248 | 249 |
| 249 void HeapNumber::HeapNumberVerify() { | 250 void HeapNumber::HeapNumberVerify() { |
| 250 CHECK(IsHeapNumber()); | 251 CHECK(IsHeapNumber()); |
| 251 } | 252 } |
| 252 | 253 |
| 253 | 254 |
| 254 void ByteArray::ByteArrayVerify() { | 255 void ByteArray::ByteArrayVerify() { |
| 255 CHECK(IsByteArray()); | 256 CHECK(IsByteArray()); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 void ExternalFloatArray::ExternalFloatArrayVerify() { | 300 void ExternalFloatArray::ExternalFloatArrayVerify() { |
| 300 CHECK(IsExternalFloatArray()); | 301 CHECK(IsExternalFloatArray()); |
| 301 } | 302 } |
| 302 | 303 |
| 303 | 304 |
| 304 void ExternalDoubleArray::ExternalDoubleArrayVerify() { | 305 void ExternalDoubleArray::ExternalDoubleArrayVerify() { |
| 305 CHECK(IsExternalDoubleArray()); | 306 CHECK(IsExternalDoubleArray()); |
| 306 } | 307 } |
| 307 | 308 |
| 308 | 309 |
| 310 bool JSObject::ElementsAreSafeToExamine() { |
| 311 return (FLAG_use_gvn && FLAG_use_allocation_folding) || |
| 312 reinterpret_cast<Map*>(elements()) != |
| 313 GetHeap()->one_pointer_filler_map(); |
| 314 } |
| 315 |
| 316 |
| 309 void JSObject::JSObjectVerify() { | 317 void JSObject::JSObjectVerify() { |
| 310 VerifyHeapPointer(properties()); | 318 VerifyHeapPointer(properties()); |
| 311 VerifyHeapPointer(elements()); | 319 VerifyHeapPointer(elements()); |
| 312 | 320 |
| 313 if (GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS) { | 321 if (GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS) { |
| 314 CHECK(this->elements()->IsFixedArray()); | 322 CHECK(this->elements()->IsFixedArray()); |
| 315 CHECK_GE(this->elements()->length(), 2); | 323 CHECK_GE(this->elements()->length(), 2); |
| 316 } | 324 } |
| 317 | 325 |
| 318 if (HasFastProperties()) { | 326 if (HasFastProperties()) { |
| 319 CHECK_EQ(map()->unused_property_fields(), | 327 CHECK_EQ(map()->unused_property_fields(), |
| 320 (map()->inobject_properties() + properties()->length() - | 328 (map()->inobject_properties() + properties()->length() - |
| 321 map()->NextFreePropertyIndex())); | 329 map()->NextFreePropertyIndex())); |
| 322 DescriptorArray* descriptors = map()->instance_descriptors(); | 330 DescriptorArray* descriptors = map()->instance_descriptors(); |
| 323 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { | 331 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { |
| 324 if (descriptors->GetDetails(i).type() == FIELD) { | 332 if (descriptors->GetDetails(i).type() == FIELD) { |
| 325 Representation r = descriptors->GetDetails(i).representation(); | 333 Representation r = descriptors->GetDetails(i).representation(); |
| 326 int field = descriptors->GetFieldIndex(i); | 334 int field = descriptors->GetFieldIndex(i); |
| 327 Object* value = RawFastPropertyAt(field); | 335 Object* value = RawFastPropertyAt(field); |
| 328 if (r.IsDouble()) ASSERT(value->IsHeapNumber()); | 336 if (r.IsDouble()) ASSERT(value->IsHeapNumber()); |
| 329 if (value->IsUninitialized()) continue; | 337 if (value->IsUninitialized()) continue; |
| 330 if (r.IsSmi()) ASSERT(value->IsSmi()); | 338 if (r.IsSmi()) ASSERT(value->IsSmi()); |
| 331 if (r.IsHeapObject()) ASSERT(value->IsHeapObject()); | 339 if (r.IsHeapObject()) ASSERT(value->IsHeapObject()); |
| 332 } | 340 } |
| 333 } | 341 } |
| 334 } | 342 } |
| 335 | 343 |
| 336 // If a GC was caused while constructing this object, the elements | 344 // If a GC was caused while constructing this object, the elements |
| 337 // pointer may point to a one pointer filler map. | 345 // pointer may point to a one pointer filler map. |
| 338 if ((FLAG_use_gvn && FLAG_use_allocation_folding) || | 346 if (ElementsAreSafeToExamine()) { |
| 339 (reinterpret_cast<Map*>(elements()) != | |
| 340 GetHeap()->one_pointer_filler_map())) { | |
| 341 CHECK_EQ((map()->has_fast_smi_or_object_elements() || | 347 CHECK_EQ((map()->has_fast_smi_or_object_elements() || |
| 342 (elements() == GetHeap()->empty_fixed_array())), | 348 (elements() == GetHeap()->empty_fixed_array())), |
| 343 (elements()->map() == GetHeap()->fixed_array_map() || | 349 (elements()->map() == GetHeap()->fixed_array_map() || |
| 344 elements()->map() == GetHeap()->fixed_cow_array_map())); | 350 elements()->map() == GetHeap()->fixed_cow_array_map())); |
| 345 CHECK(map()->has_fast_object_elements() == HasFastObjectElements()); | 351 CHECK(map()->has_fast_object_elements() == HasFastObjectElements()); |
| 346 } | 352 } |
| 347 } | 353 } |
| 348 | 354 |
| 349 | 355 |
| 350 void Map::MapVerify() { | 356 void Map::MapVerify() { |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 } | 697 } |
| 692 } | 698 } |
| 693 } | 699 } |
| 694 | 700 |
| 695 | 701 |
| 696 void JSArray::JSArrayVerify() { | 702 void JSArray::JSArrayVerify() { |
| 697 JSObjectVerify(); | 703 JSObjectVerify(); |
| 698 CHECK(length()->IsNumber() || length()->IsUndefined()); | 704 CHECK(length()->IsNumber() || length()->IsUndefined()); |
| 699 // If a GC was caused while constructing this array, the elements | 705 // If a GC was caused while constructing this array, the elements |
| 700 // pointer may point to a one pointer filler map. | 706 // pointer may point to a one pointer filler map. |
| 701 if ((FLAG_use_gvn && FLAG_use_allocation_folding) || | 707 if (ElementsAreSafeToExamine()) { |
| 702 (reinterpret_cast<Map*>(elements()) != | |
| 703 GetHeap()->one_pointer_filler_map())) { | |
| 704 CHECK(elements()->IsUndefined() || | 708 CHECK(elements()->IsUndefined() || |
| 705 elements()->IsFixedArray() || | 709 elements()->IsFixedArray() || |
| 706 elements()->IsFixedDoubleArray()); | 710 elements()->IsFixedDoubleArray()); |
| 707 } | 711 } |
| 708 } | 712 } |
| 709 | 713 |
| 710 | 714 |
| 711 void JSSet::JSSetVerify() { | 715 void JSSet::JSSetVerify() { |
| 712 CHECK(IsJSSet()); | 716 CHECK(IsJSSet()); |
| 713 JSObjectVerify(); | 717 JSObjectVerify(); |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 for (int i = 0; i < number_of_transitions(); ++i) { | 1200 for (int i = 0; i < number_of_transitions(); ++i) { |
| 1197 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; | 1201 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; |
| 1198 } | 1202 } |
| 1199 return true; | 1203 return true; |
| 1200 } | 1204 } |
| 1201 | 1205 |
| 1202 | 1206 |
| 1203 #endif // DEBUG | 1207 #endif // DEBUG |
| 1204 | 1208 |
| 1205 } } // namespace v8::internal | 1209 } } // namespace v8::internal |
| OLD | NEW |