Bug 849453 - Use the AllocKind to get the size instead of sizeOfThis; r=billm

This commit is contained in:
Terrence Cole 2013-03-07 10:55:34 -08:00
parent 4bd994c627
commit 04d98c14ca
3 changed files with 5 additions and 3 deletions

View File

@ -73,7 +73,7 @@ NewObjectCache::fill(EntryIndex entry_, Class *clasp, gc::Cell *key, gc::AllocKi
entry->key = key;
entry->kind = kind;
entry->nbytes = obj->sizeOfThis();
entry->nbytes = gc::Arena::thingSize(kind);
js_memcpy(&entry->templateObject, obj, entry->nbytes);
}

View File

@ -1701,7 +1701,7 @@ CopyInitializerObject(JSContext *cx, HandleObject baseobj, NewObjectKind newKind
gc::AllocKind allocKind = gc::GetGCObjectFixedSlotsKind(baseobj->numFixedSlots());
allocKind = gc::GetBackgroundAllocKind(allocKind);
JS_ASSERT(allocKind == baseobj->getAllocKind());
JS_ASSERT_IF(baseobj->isTenured(), allocKind == baseobj->tenuredGetAllocKind());
RootedObject obj(cx);
obj = NewBuiltinClassInstance(cx, &ObjectClass, allocKind, newKind);
if (!obj)

View File

@ -209,7 +209,9 @@ bool CrossCompartmentWrapper::finalizeInBackground(Value priv)
* Make the 'background-finalized-ness' of the wrapper the same as the
* wrapped object, to allow transplanting between them.
*/
return IsBackgroundFinalized(priv.toObject().getAllocKind());
if (IsInsideNursery(priv.toObject().runtime(), &priv.toObject()))
return false;
return IsBackgroundFinalized(priv.toObject().tenuredGetAllocKind());
}
#define PIERCE(cx, wrapper, pre, op, post) \