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

--HG--
extra : rebase_source : 988997984bda4ec329a801655f1649bb73aeea7a
This commit is contained in:
Terrence Cole 2013-03-07 10:55:34 -08:00
parent b60d8cddf6
commit 241444bb22
3 changed files with 6 additions and 4 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

@ -1085,7 +1085,7 @@ JSObject::hasShapeTable() const
inline size_t
JSObject::computedSizeOfThisSlotsElements() const
{
size_t n = sizeOfThis();
size_t n = js::gc::Arena::thingSize(js::gc::GetGCObjectFixedSlotsKind(numFixedSlots()));
if (hasDynamicSlots())
n += numDynamicSlots() * sizeof(js::Value);
@ -1721,7 +1721,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->getAllocKind());
RootedObject obj(cx);
obj = NewBuiltinClassInstance(cx, &ObjectClass, allocKind, newKind);
if (!obj)

View File

@ -215,7 +215,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) \