Bug 716027 - Add write barrier to SetReservedSlot in jsfriendapi.h (r=bhackett)

This commit is contained in:
Bill McCloskey 2012-01-23 16:43:19 -08:00
parent 5e946f0618
commit c849a7a139
2 changed files with 14 additions and 1 deletions

View File

@ -323,6 +323,12 @@ js::SetFunctionNativeReserved(JSObject *fun, size_t which, const Value &val)
fun->toFunction()->setExtendedSlot(which, val);
}
JS_FRIEND_API(void)
js::SetReservedSlotWithBarrier(JSObject *obj, size_t slot, const js::Value &value)
{
obj->setSlot(slot, value);
}
void
js::SetPreserveWrapperCallback(JSRuntime *rt, PreserveWrapperCallback callback)
{

View File

@ -378,11 +378,18 @@ GetReservedSlot(const JSObject *obj, size_t slot)
return reinterpret_cast<const shadow::Object *>(obj)->slotRef(slot);
}
JS_FRIEND_API(void)
SetReservedSlotWithBarrier(JSObject *obj, size_t slot, const Value &value);
inline void
SetReservedSlot(JSObject *obj, size_t slot, const Value &value)
{
JS_ASSERT(slot < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj)));
reinterpret_cast<shadow::Object *>(obj)->slotRef(slot) = value;
shadow::Object *sobj = reinterpret_cast<shadow::Object *>(obj);
if (sobj->slotRef(slot).isMarkable())
SetReservedSlotWithBarrier(obj, slot, value);
else
sobj->slotRef(slot) = value;
}
JS_FRIEND_API(uint32_t)