Bug 1105232 - Remove race updating COW shared elements owner pointer r=terrence

This commit is contained in:
Jon Coppeard 2014-12-04 10:15:20 -08:00
Родитель 89d61ef0a0
Коммит 4184ad0a88
2 изменённых файлов: 17 добавлений и 5 удалений

Просмотреть файл

@ -2194,9 +2194,22 @@ RelocateCell(Zone *zone, TenuredCell *src, AllocKind thingKind, size_t thingSize
JSObject *srcObj = static_cast<JSObject *>(static_cast<Cell *>(src));
JSObject *dstObj = static_cast<JSObject *>(static_cast<Cell *>(dst));
// Fixup the pointer to inline object elements if necessary.
if (srcObj->isNative() && srcObj->as<NativeObject>().hasFixedElements())
dstObj->as<NativeObject>().setFixedElements();
if (srcObj->isNative()) {
NativeObject *srcNative = &srcObj->as<NativeObject>();
NativeObject *dstNative = &dstObj->as<NativeObject>();
// Fixup the pointer to inline object elements if necessary.
if (srcNative->hasFixedElements())
dstNative->setFixedElements();
// For copy-on-write objects that own their elements, fix up the
// owner pointer to point to the relocated object.
if (srcNative->hasDynamicElements() && srcNative->denseElementsAreCopyOnWrite()) {
HeapPtrNativeObject &owner = srcNative->getElementsHeader()->ownerObject();
if (owner == srcNative)
owner = dstNative;
}
}
// Call object moved hook if present.
if (JSObjectMovedOp op = srcObj->getClass()->ext.objectMovedOp)

Просмотреть файл

@ -2768,8 +2768,7 @@ JSObject::fixupAfterMovingGC()
if (is<NativeObject>() && as<NativeObject>().hasDynamicElements()) {
ObjectElements *header = as<NativeObject>().getElementsHeader();
if (header->isCopyOnWrite()) {
HeapPtrNativeObject &owner = header->ownerObject();
owner = MaybeForwarded(owner.get());
NativeObject *owner = MaybeForwarded(header->ownerObject().get());
as<NativeObject>().elements_ = owner->getElementsHeader()->elements();
}
}