mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 903193 - Part 2: Refactor isThreadLocal to ThreadSafeContext. (r=bhackett)
This commit is contained in:
parent
1a7724306d
commit
304fdd6a5e
@ -43,8 +43,7 @@ bool
|
|||||||
jit::IsThreadLocalObject(ForkJoinSlice *slice, JSObject *object)
|
jit::IsThreadLocalObject(ForkJoinSlice *slice, JSObject *object)
|
||||||
{
|
{
|
||||||
JS_ASSERT(ForkJoinSlice::Current() == slice);
|
JS_ASSERT(ForkJoinSlice::Current() == slice);
|
||||||
return !IsInsideNursery(slice->runtime(), object) &&
|
return slice->isThreadLocal(object);
|
||||||
slice->allocator()->arenas.containsArena(slice->runtime(), object->arenaHeader());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -15,9 +15,9 @@ namespace jit {
|
|||||||
|
|
||||||
ForkJoinSlice *ForkJoinSlicePar();
|
ForkJoinSlice *ForkJoinSlicePar();
|
||||||
JSObject *NewGCThingPar(ForkJoinSlice *slice, gc::AllocKind allocKind);
|
JSObject *NewGCThingPar(ForkJoinSlice *slice, gc::AllocKind allocKind);
|
||||||
bool IsThreadLocalObject(ForkJoinSlice *context, JSObject *object);
|
bool IsThreadLocalObject(ForkJoinSlice *slice, JSObject *object);
|
||||||
bool CheckOverRecursedPar(ForkJoinSlice *slice);
|
bool CheckOverRecursedPar(ForkJoinSlice *slice);
|
||||||
bool CheckInterruptPar(ForkJoinSlice *context);
|
bool CheckInterruptPar(ForkJoinSlice *slice);
|
||||||
|
|
||||||
// We pass the arguments to PushPar in a structure because, in code
|
// We pass the arguments to PushPar in a structure because, in code
|
||||||
// gen, it is convenient to store them on the stack to avoid
|
// gen, it is convenient to store them on the stack to avoid
|
||||||
|
@ -248,6 +248,9 @@ struct ThreadSafeContext : ContextFriendFields,
|
|||||||
return thing->compartment() == compartment_;
|
return thing->compartment() == compartment_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
inline bool isThreadLocal(T thing) const;
|
||||||
|
|
||||||
void *onOutOfMemory(void *p, size_t nbytes) {
|
void *onOutOfMemory(void *p, size_t nbytes) {
|
||||||
return runtime_->onOutOfMemory(p, nbytes, maybeJSContext());
|
return runtime_->onOutOfMemory(p, nbytes, maybeJSContext());
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,27 @@ ThreadSafeContext::allocator()
|
|||||||
return allocator_;
|
return allocator_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
inline bool
|
||||||
|
ThreadSafeContext::isThreadLocal(T thing) const
|
||||||
|
{
|
||||||
|
if (!isForkJoinSlice())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (!IsInsideNursery(runtime_, thing) &&
|
||||||
|
allocator_->arenas.containsArena(runtime_, thing->arenaHeader()))
|
||||||
|
{
|
||||||
|
// GC should be suppressed in preparation for mutating thread local
|
||||||
|
// objects, as we don't want to trip any barriers.
|
||||||
|
JS_ASSERT(!thing->zoneFromAnyThread()->needsBarrier());
|
||||||
|
JS_ASSERT(!thing->runtimeFromAnyThread()->needsBarrier());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
namespace gc {
|
namespace gc {
|
||||||
|
|
||||||
static inline AllocKind
|
static inline AllocKind
|
||||||
|
Loading…
Reference in New Issue
Block a user