Backed out changeset 4c45705d14c4 (reland bug 952330 since it wasn't at fault for the ggc orange)

This commit is contained in:
Wes Kocher 2013-12-20 14:27:26 -08:00
Родитель 48d1f78eec
Коммит 8be282a635
1 изменённых файлов: 13 добавлений и 0 удалений

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

@ -69,6 +69,7 @@ using namespace js::types;
using js::frontend::IsIdentifier;
using mozilla::ArrayLength;
using mozilla::DebugOnly;
using mozilla::Maybe;
using mozilla::RoundUpPow2;
JS_STATIC_ASSERT(int32_t((JSObject::NELEMENTS_LIMIT - 1) * sizeof(Value)) == int64_t((JSObject::NELEMENTS_LIMIT - 1) * sizeof(Value)));
@ -2528,6 +2529,12 @@ JSObject::growSlots(ThreadSafeContext *cx, HandleObject obj, uint32_t oldCount,
}
}
// Global slots may be read during off thread compilation, and updates to
// their slot pointers need to be synchronized.
Maybe<AutoLockForCompilation> lock;
if (obj->is<GlobalObject>())
lock.construct(cx->asExclusiveContext());
if (!oldCount) {
obj->slots = AllocateSlots(cx, obj, newCount);
if (!obj->slots)
@ -2572,6 +2579,12 @@ JSObject::shrinkSlots(ThreadSafeContext *cx, HandleObject obj, uint32_t oldCount
JS_ASSERT(newCount >= SLOT_CAPACITY_MIN);
// Global slots may be read during off thread compilation, and updates to
// their slot pointers need to be synchronized.
Maybe<AutoLockForCompilation> lock;
if (obj->is<GlobalObject>())
lock.construct(cx->asExclusiveContext());
HeapSlot *newslots = ReallocateSlots(cx, obj, obj->slots, oldCount, newCount);
if (!newslots)
return; /* Leave slots at its old size. */