mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1238195 - Switch over some AutoVectorRooters to Rooted<TraceableVector>s and fill in some missing support (r=terrence)
This commit is contained in:
parent
bd4e00b84b
commit
2317744539
@ -161,10 +161,12 @@ class MutableTraceableVectorOperations
|
||||
T* begin() { return vec().begin(); }
|
||||
const T* end() const { return vec().end(); }
|
||||
T* end() { return vec().end(); }
|
||||
const T& operator[](size_t aIndex) const { return vec().operator[](aIndex); }
|
||||
const T& back() const { return vec().back(); }
|
||||
T& back() { return vec().back(); }
|
||||
|
||||
JS::Handle<T> operator[](size_t aIndex) const {
|
||||
return JS::Handle<T>::fromMarkedLocation(&vec().operator[](aIndex));
|
||||
}
|
||||
JS::MutableHandle<T> operator[](size_t aIndex) {
|
||||
return JS::MutableHandle<T>::fromMarkedLocation(&vec().operator[](aIndex));
|
||||
}
|
||||
|
@ -390,6 +390,14 @@ struct DefaultGCPolicy<jsid>
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct DefaultGCPolicy<JS::Value>
|
||||
{
|
||||
static void trace(JSTracer* trc, JS::Value* v, const char* name) {
|
||||
js::UnsafeTraceManuallyBarrieredEdge(trc, v, name);
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct DefaultGCPolicy<uint32_t> : public IgnoreGCPolicy<uint32_t> {};
|
||||
template <> struct DefaultGCPolicy<uint64_t> : public IgnoreGCPolicy<uint64_t> {};
|
||||
|
||||
|
@ -7420,7 +7420,7 @@ ValidateGlobalVariable(JSContext* cx, const AsmJSGlobal& global, uint8_t* global
|
||||
|
||||
static bool
|
||||
ValidateFFI(JSContext* cx, const AsmJSGlobal& global, HandleValue importVal,
|
||||
AutoVectorRooter<JSFunction*>* ffis)
|
||||
MutableHandle<FunctionVector> ffis)
|
||||
{
|
||||
RootedPropertyName field(cx, global.ffiField());
|
||||
RootedValue v(cx);
|
||||
@ -7430,7 +7430,7 @@ ValidateFFI(JSContext* cx, const AsmJSGlobal& global, HandleValue importVal,
|
||||
if (!v.isObject() || !v.toObject().is<JSFunction>())
|
||||
return LinkFail(cx, "FFI imports must be functions");
|
||||
|
||||
(*ffis)[global.ffiIndex()].set(&v.toObject().as<JSFunction>());
|
||||
ffis[global.ffiIndex()].set(&v.toObject().as<JSFunction>());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -7727,7 +7727,7 @@ DynamicallyLinkModule(JSContext* cx, const CallArgs& args, AsmJSModule& module)
|
||||
if (module.usesHeap() && !CheckBuffer(cx, module, bufferVal, &buffer))
|
||||
return false;
|
||||
|
||||
AutoVectorRooter<JSFunction*> ffis(cx);
|
||||
Rooted<FunctionVector> ffis(cx, FunctionVector(cx));
|
||||
if (!ffis.resize(module.numFFIs()))
|
||||
return false;
|
||||
|
||||
@ -7769,7 +7769,7 @@ DynamicallyLinkModule(JSContext* cx, const CallArgs& args, AsmJSModule& module)
|
||||
}
|
||||
}
|
||||
|
||||
AutoVectorRooter<JSFunction*> imports(cx);
|
||||
Rooted<FunctionVector> imports(cx, FunctionVector(cx));
|
||||
for (const AsmJSImport& import : module.asmJSImports()) {
|
||||
if (!imports.append(ffis[import.ffiIndex()]))
|
||||
return false;
|
||||
|
@ -1006,7 +1006,7 @@ Module::staticallyLink(ExclusiveContext* cx, const StaticLinkData& linkData)
|
||||
|
||||
bool
|
||||
Module::dynamicallyLink(JSContext* cx, Handle<ArrayBufferObjectMaybeShared*> heap,
|
||||
const AutoVectorRooter<JSFunction*>& importArgs)
|
||||
Handle<FunctionVector> importArgs)
|
||||
{
|
||||
MOZ_ASSERT(staticallyLinked_);
|
||||
MOZ_ASSERT(!dynamicallyLinked_);
|
||||
|
@ -528,7 +528,7 @@ class Module
|
||||
// ImportVector.
|
||||
|
||||
bool dynamicallyLink(JSContext* cx, Handle<ArrayBufferObjectMaybeShared*> heap,
|
||||
const AutoVectorRooter<JSFunction*>& imports);
|
||||
Handle<FunctionVector> imports);
|
||||
|
||||
// The wasm heap, established by dynamicallyLink.
|
||||
|
||||
|
@ -471,13 +471,14 @@ struct DefaultGCPolicy<T*>
|
||||
static void trace(JSTracer* trc, T** thingp, const char* name) {
|
||||
// If linking is failing here, it likely means that you need to define
|
||||
// or use a non-default GC policy for your non-gc-pointer type.
|
||||
TraceManuallyBarrieredEdge(trc, thingp, name);
|
||||
if (*thingp)
|
||||
TraceManuallyBarrieredEdge(trc, thingp, name);
|
||||
}
|
||||
|
||||
static bool needsSweep(T** thingp) {
|
||||
// If linking is failing here, it likely means that you need to define
|
||||
// or use a non-default GC policy for your non-gc-pointer type.
|
||||
return gc::IsAboutToBeFinalizedUnbarriered(thingp);
|
||||
return *thingp && gc::IsAboutToBeFinalizedUnbarriered(thingp);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -55,6 +55,11 @@ typedef JS::Rooted<PlainObject*> RootedPlainObject;
|
||||
typedef JS::Rooted<SavedFrame*> RootedSavedFrame;
|
||||
typedef JS::Rooted<ScriptSourceObject*> RootedScriptSource;
|
||||
|
||||
typedef TraceableVector<JSFunction*> FunctionVector;
|
||||
typedef TraceableVector<PropertyName*> PropertyNameVector;
|
||||
typedef TraceableVector<Shape*> ShapeVector;
|
||||
typedef TraceableVector<JSString*> StringVector;
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
#endif /* gc_Rooting_h */
|
||||
|
@ -672,11 +672,6 @@ CheckForInterrupt(JSContext* cx)
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
typedef JS::AutoVectorRooter<PropertyName*> AutoPropertyNameVector;
|
||||
|
||||
using ShapeVector = js::TraceableVector<Shape*>;
|
||||
using StringVector = js::TraceableVector<JSString*>;
|
||||
|
||||
/* AutoArrayRooter roots an external array of Values. */
|
||||
class MOZ_RAII AutoArrayRooter : private JS::AutoGCRooter
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user