OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include "src/assembler-inl.h" | 7 #include "src/assembler-inl.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/disasm.h" | 9 #include "src/disasm.h" |
10 #include "src/disassembler.h" | 10 #include "src/disassembler.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 void JSObject::JSObjectVerify() { | 329 void JSObject::JSObjectVerify() { |
330 VerifyHeapPointer(properties()); | 330 VerifyHeapPointer(properties()); |
331 VerifyHeapPointer(elements()); | 331 VerifyHeapPointer(elements()); |
332 | 332 |
333 CHECK_IMPLIES(HasSloppyArgumentsElements(), IsJSArgumentsObject()); | 333 CHECK_IMPLIES(HasSloppyArgumentsElements(), IsJSArgumentsObject()); |
334 if (HasFastProperties()) { | 334 if (HasFastProperties()) { |
335 int actual_unused_property_fields = map()->GetInObjectProperties() + | 335 int actual_unused_property_fields = map()->GetInObjectProperties() + |
336 properties()->length() - | 336 properties()->length() - |
337 map()->NextFreePropertyIndex(); | 337 map()->NextFreePropertyIndex(); |
338 if (map()->unused_property_fields() != actual_unused_property_fields) { | 338 if (map()->unused_property_fields() != actual_unused_property_fields) { |
339 // This could actually happen in the middle of StoreTransitionStub | 339 // There are two reasons why this can happen: |
340 // when the new extended backing store is already set into the object and | 340 // - in the middle of StoreTransitionStub when the new extended backing |
341 // the allocation of the MutableHeapNumber triggers GC (in this case map | 341 // store is already set into the object and the allocation of the |
342 // is not updated yet). | 342 // MutableHeapNumber triggers GC while the map isn't updated yet. |
343 CHECK_EQ(map()->unused_property_fields(), | 343 // - deletion of the last property can leave additional backing store |
344 actual_unused_property_fields - JSObject::kFieldsAdded); | 344 // capacity behind. |
| 345 CHECK_GT(actual_unused_property_fields, map()->unused_property_fields()); |
| 346 int delta = |
| 347 actual_unused_property_fields - map()->unused_property_fields(); |
| 348 CHECK_EQ(0, delta % JSObject::kFieldsAdded); |
345 } | 349 } |
346 DescriptorArray* descriptors = map()->instance_descriptors(); | 350 DescriptorArray* descriptors = map()->instance_descriptors(); |
347 Isolate* isolate = GetIsolate(); | 351 Isolate* isolate = GetIsolate(); |
348 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { | 352 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { |
349 PropertyDetails details = descriptors->GetDetails(i); | 353 PropertyDetails details = descriptors->GetDetails(i); |
350 if (details.location() == kField) { | 354 if (details.location() == kField) { |
351 DCHECK_EQ(kData, details.kind()); | 355 DCHECK_EQ(kData, details.kind()); |
352 Representation r = descriptors->GetDetails(i).representation(); | 356 Representation r = descriptors->GetDetails(i).representation(); |
353 FieldIndex index = FieldIndex::ForDescriptor(map(), i); | 357 FieldIndex index = FieldIndex::ForDescriptor(map(), i); |
354 if (IsUnboxedDoubleField(index)) { | 358 if (IsUnboxedDoubleField(index)) { |
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1638 | 1642 |
1639 // Both are done at the same time. | 1643 // Both are done at the same time. |
1640 CHECK_EQ(new_it.done(), old_it.done()); | 1644 CHECK_EQ(new_it.done(), old_it.done()); |
1641 } | 1645 } |
1642 | 1646 |
1643 | 1647 |
1644 #endif // DEBUG | 1648 #endif // DEBUG |
1645 | 1649 |
1646 } // namespace internal | 1650 } // namespace internal |
1647 } // namespace v8 | 1651 } // namespace v8 |
OLD | NEW |