Changeset 121925 in webkit for trunk/Source/JavaScriptCore/runtime/JSObject.cpp
- Timestamp:
- Jul 5, 2012, 3:55:51 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r120897 r121925 94 94 visitor.m_isCheckingForDefaultMarkViolation = false; 95 95 #endif 96 96 97 97 JSCell::visitChildren(thisObject, visitor); 98 98 99 PropertyStorage storage = thisObject->propertyStorage(); 100 size_t storageSize = thisObject->structure()->propertyStorageSize(); 101 if (thisObject->isUsingInlineStorage()) 102 visitor.appendValues(storage, storageSize); 103 else { 99 PropertyStorage storage = thisObject->outOfLineStorage(); 100 if (storage) { 101 size_t storageSize = thisObject->structure()->outOfLineSizeForKnownNonFinalObject(); 104 102 // We have this extra temp here to slake GCC's thirst for the blood of those who dereference type-punned pointers. 105 103 void* temp = storage; 106 visitor.copyAndAppend(&temp, thisObject->structure()-> propertyStorageCapacity() * sizeof(WriteBarrierBase<Unknown>), storage->slot(), storageSize);104 visitor.copyAndAppend(&temp, thisObject->structure()->outOfLineCapacity() * sizeof(WriteBarrierBase<Unknown>), storage->slot(), storageSize); 107 105 storage = static_cast<PropertyStorage>(temp); 108 thisObject->m_ propertyStorage.set(storage, StorageBarrier::Unchecked);106 thisObject->m_outOfLineStorage.set(storage, StorageBarrier::Unchecked); 109 107 } 110 108 111 109 if (thisObject->m_inheritorID) 112 110 visitor.append(&thisObject->m_inheritorID); 111 112 #if !ASSERT_DISABLED 113 visitor.m_isCheckingForDefaultMarkViolation = wasCheckingForDefaultMarkViolation; 114 #endif 115 } 116 117 void JSFinalObject::visitChildren(JSCell* cell, SlotVisitor& visitor) 118 { 119 JSFinalObject* thisObject = jsCast<JSFinalObject*>(cell); 120 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); 121 #if !ASSERT_DISABLED 122 bool wasCheckingForDefaultMarkViolation = visitor.m_isCheckingForDefaultMarkViolation; 123 visitor.m_isCheckingForDefaultMarkViolation = false; 124 #endif 125 126 JSCell::visitChildren(thisObject, visitor); 127 128 PropertyStorage storage = thisObject->outOfLineStorage(); 129 if (storage) { 130 size_t storageSize = thisObject->structure()->outOfLineSizeForKnownFinalObject(); 131 // We have this extra temp here to slake GCC's thirst for the blood of those who dereference type-punned pointers. 132 void* temp = storage; 133 visitor.copyAndAppend(&temp, thisObject->structure()->outOfLineCapacity() * sizeof(WriteBarrierBase<Unknown>), storage->slot(), storageSize); 134 storage = static_cast<PropertyStorage>(temp); 135 thisObject->m_outOfLineStorage.set(storage, StorageBarrier::Unchecked); 136 } 137 138 if (thisObject->m_inheritorID) 139 visitor.append(&thisObject->m_inheritorID); 140 141 size_t storageSize = thisObject->structure()->inlineSizeForKnownFinalObject(); 142 visitor.appendValues(thisObject->inlineStorage(), storageSize); 113 143 114 144 #if !ASSERT_DISABLED … … 154 184 unsigned attributes; 155 185 JSCell* specificValue; 156 size_t offset = obj->structure()->get(globalData, propertyName, attributes, specificValue);157 if (offset != WTF::notFound) {186 PropertyOffset offset = obj->structure()->get(globalData, propertyName, attributes, specificValue); 187 if (offset != invalidOffset) { 158 188 if (attributes & ReadOnly) { 159 189 if (slot.isStrictMode()) … … 273 303 unsigned attributes; 274 304 JSCell* specificValue; 275 if ( thisObject->structure()->get(exec->globalData(), propertyName, attributes, specificValue) != WTF::notFound) {305 if (isValidOffset(thisObject->structure()->get(exec->globalData(), propertyName, attributes, specificValue))) { 276 306 if (attributes & DontDelete && !exec->globalData().isInDefineOwnProperty()) 277 307 return false; … … 395 425 { 396 426 unsigned attributes; 397 if ( structure()->get(exec->globalData(), propertyName, attributes, specificValue) != WTF::notFound)427 if (isValidOffset(structure()->get(exec->globalData(), propertyName, attributes, specificValue))) 398 428 return true; 399 429 … … 517 547 bool JSObject::removeDirect(JSGlobalData& globalData, PropertyName propertyName) 518 548 { 519 if ( structure()->get(globalData, propertyName) == WTF::notFound)549 if (!isValidOffset(structure()->get(globalData, propertyName))) 520 550 return false; 521 551 522 size_t offset;552 PropertyOffset offset; 523 553 if (structure()->isUncacheableDictionary()) { 524 554 offset = structure()->removePropertyWithoutTransition(globalData, propertyName); 525 if (offset == WTF::notFound)555 if (offset == invalidOffset) 526 556 return false; 527 557 putUndefinedAtDirectOffset(offset); … … 530 560 531 561 setStructure(globalData, Structure::removePropertyTransition(globalData, structure(), propertyName, offset)); 532 if (offset == WTF::notFound)562 if (offset == invalidOffset) 533 563 return false; 534 564 putUndefinedAtDirectOffset(offset); … … 560 590 } 561 591 562 PropertyStorage JSObject::grow PropertyStorage(JSGlobalData& globalData, size_t oldSize, size_t newSize)592 PropertyStorage JSObject::growOutOfLineStorage(JSGlobalData& globalData, size_t oldSize, size_t newSize) 563 593 { 564 594 ASSERT(newSize > oldSize); … … 567 597 // we might be in the middle of a transition. 568 598 569 PropertyStorage oldPropertyStorage = m_ propertyStorage.get();599 PropertyStorage oldPropertyStorage = m_outOfLineStorage.get(); 570 600 PropertyStorage newPropertyStorage = 0; 571 601 572 if ( isUsingInlineStorage()) {602 if (!oldPropertyStorage) { 573 603 // We have this extra temp here to slake GCC's thirst for the blood of those who dereference type-punned pointers. 574 604 void* temp = newPropertyStorage; … … 576 606 CRASH(); 577 607 newPropertyStorage = static_cast<PropertyStorage>(temp); 578 579 for (unsigned i = 0; i < oldSize; ++i)580 newPropertyStorage[i] = oldPropertyStorage[i];581 608 } else { 582 609 // We have this extra temp here to slake GCC's thirst for the blood of those who dereference type-punned pointers. … … 595 622 unsigned attributes = 0; 596 623 JSCell* cell = 0; 597 size_t offset = object->structure()->get(exec->globalData(), propertyName, attributes, cell);598 if (offset == WTF::notFound)624 PropertyOffset offset = object->structure()->get(exec->globalData(), propertyName, attributes, cell); 625 if (offset == invalidOffset) 599 626 return false; 600 627 descriptor.setDescriptor(object->getDirectOffset(offset), attributes);
Note:
See TracChangeset
for help on using the changeset viewer.