mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 23:38:38 +09:00
1325480 - Baldr: make WasmInstanceObject::ExportMap a strong edge
1325480 - Baldr: make WasmInstanceObject::ExportMap a strong edge
This commit is contained in:
parent
0b212e1fe4
commit
1f76c9c036
2 changed files with 13 additions and 11 deletions
|
|
@ -912,8 +912,10 @@ WasmInstanceObject::finalize(FreeOp* fop, JSObject* obj)
|
|||
/* static */ void
|
||||
WasmInstanceObject::trace(JSTracer* trc, JSObject* obj)
|
||||
{
|
||||
if (!obj->as<WasmInstanceObject>().isNewborn())
|
||||
obj->as<WasmInstanceObject>().instance().tracePrivate(trc);
|
||||
WasmInstanceObject& instanceObj = obj->as<WasmInstanceObject>();
|
||||
instanceObj.exports().trace(trc);
|
||||
if (!instanceObj.isNewborn())
|
||||
instanceObj.instance().tracePrivate(trc);
|
||||
}
|
||||
|
||||
/* static */ WasmInstanceObject*
|
||||
|
|
@ -926,7 +928,7 @@ WasmInstanceObject::create(JSContext* cx,
|
|||
const ValVector& globalImports,
|
||||
HandleObject proto)
|
||||
{
|
||||
UniquePtr<WeakExportMap> exports = js::MakeUnique<WeakExportMap>(cx->zone(), ExportMap());
|
||||
UniquePtr<ExportMap> exports = js::MakeUnique<ExportMap>();
|
||||
if (!exports || !exports->init()) {
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
|
|
@ -1026,10 +1028,10 @@ WasmInstanceObject::instance() const
|
|||
return *(Instance*)getReservedSlot(INSTANCE_SLOT).toPrivate();
|
||||
}
|
||||
|
||||
WasmInstanceObject::WeakExportMap&
|
||||
WasmInstanceObject::ExportMap&
|
||||
WasmInstanceObject::exports() const
|
||||
{
|
||||
return *(WeakExportMap*)getReservedSlot(EXPORTS_SLOT).toPrivate();
|
||||
return *(ExportMap*)getReservedSlot(EXPORTS_SLOT).toPrivate();
|
||||
}
|
||||
|
||||
WasmInstanceObject::WeakScopeMap&
|
||||
|
|
|
|||
|
|
@ -154,15 +154,15 @@ class WasmInstanceObject : public NativeObject
|
|||
static void finalize(FreeOp* fop, JSObject* obj);
|
||||
static void trace(JSTracer* trc, JSObject* obj);
|
||||
|
||||
// ExportMap maps from function index to exported function object.
|
||||
// This allows the instance to lazily create exported function
|
||||
// just to ensure a unique object identity for any given function object.
|
||||
// ExportMap maps from function index to exported function
|
||||
// object. This allows the instance to lazily create exported function
|
||||
// objects on demand (instead up-front for all table elements) while
|
||||
// correctly preserving observable function object identity.
|
||||
using ExportMap = GCHashMap<uint32_t,
|
||||
ReadBarrieredFunction,
|
||||
HeapPtr<JSFunction*>,
|
||||
DefaultHasher<uint32_t>,
|
||||
SystemAllocPolicy>;
|
||||
using WeakExportMap = JS::WeakCache<ExportMap>;
|
||||
WeakExportMap& exports() const;
|
||||
ExportMap& exports() const;
|
||||
|
||||
// WeakScopeMap maps from function index to js::Scope. This maps is weak
|
||||
// to avoid holding scope objects alive. The scopes are normally created
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue