зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1458456 part 8 - Fix remaining TSan races. r=jonco
This commit is contained in:
Родитель
290905a7c8
Коммит
ed21f1eb5d
|
@ -64,24 +64,33 @@ template <>
|
|||
Value
|
||||
DoCallback<Value>(JS::CallbackTracer* trc, Value* vp, const char* name)
|
||||
{
|
||||
*vp = DispatchTyped(DoCallbackFunctor<Value>(), *vp, trc, name);
|
||||
return *vp;
|
||||
// Only update *vp if the value changed, to avoid TSan false positives for
|
||||
// template objects when using DumpHeapTracer or UbiNode tracers while Ion
|
||||
// compiling off-thread.
|
||||
Value v = DispatchTyped(DoCallbackFunctor<Value>(), *vp, trc, name);
|
||||
if (*vp != v)
|
||||
*vp = v;
|
||||
return v;
|
||||
}
|
||||
|
||||
template <>
|
||||
jsid
|
||||
DoCallback<jsid>(JS::CallbackTracer* trc, jsid* idp, const char* name)
|
||||
{
|
||||
*idp = DispatchTyped(DoCallbackFunctor<jsid>(), *idp, trc, name);
|
||||
return *idp;
|
||||
jsid id = DispatchTyped(DoCallbackFunctor<jsid>(), *idp, trc, name);
|
||||
if (*idp != id)
|
||||
*idp = id;
|
||||
return id;
|
||||
}
|
||||
|
||||
template <>
|
||||
TaggedProto
|
||||
DoCallback<TaggedProto>(JS::CallbackTracer* trc, TaggedProto* protop, const char* name)
|
||||
{
|
||||
*protop = DispatchTyped(DoCallbackFunctor<TaggedProto>(), *protop, trc, name);
|
||||
return *protop;
|
||||
TaggedProto proto = DispatchTyped(DoCallbackFunctor<TaggedProto>(), *protop, trc, name);
|
||||
if (*protop != proto)
|
||||
*protop = proto;
|
||||
return proto;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1032,6 +1032,19 @@ JSCompartment::setAllocationMetadataBuilder(const js::AllocationMetadataBuilder
|
|||
allocationMetadataBuilder = builder;
|
||||
}
|
||||
|
||||
void
|
||||
JSCompartment::forgetAllocationMetadataBuilder()
|
||||
{
|
||||
// Unlike setAllocationMetadataBuilder, we don't have to discard all JIT
|
||||
// code here (code is still valid, just a bit slower because it doesn't do
|
||||
// inline GC allocations when a metadata builder is present), but we do want
|
||||
// to cancel off-thread Ion compilations to avoid races when Ion calls
|
||||
// hasAllocationMetadataBuilder off-thread.
|
||||
CancelOffThreadIonCompile(this);
|
||||
|
||||
allocationMetadataBuilder = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
JSCompartment::clearObjectMetadata()
|
||||
{
|
||||
|
|
|
@ -956,9 +956,7 @@ struct JSCompartment
|
|||
return allocationMetadataBuilder;
|
||||
}
|
||||
void setAllocationMetadataBuilder(const js::AllocationMetadataBuilder* builder);
|
||||
void forgetAllocationMetadataBuilder() {
|
||||
allocationMetadataBuilder = nullptr;
|
||||
}
|
||||
void forgetAllocationMetadataBuilder();
|
||||
void setNewObjectMetadata(JSContext* cx, JS::HandleObject obj);
|
||||
void clearObjectMetadata();
|
||||
const void* addressOfMetadataBuilder() const {
|
||||
|
|
Загрузка…
Ссылка в новой задаче