mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 23:38:38 +09:00
Fix remaining errors without busting compilation.
Fix remaining errors without busting compilation.
This commit is contained in:
parent
9a870dfa39
commit
86fa4d7298
1 changed files with 11 additions and 6 deletions
|
|
@ -958,16 +958,17 @@ RegExpShared::RegExpShared(JSAtom* source, RegExpFlag flags)
|
|||
{}
|
||||
|
||||
struct RegExpShared::NamedCaptureData {
|
||||
bool mapInited;
|
||||
// per-compartment template cache (optional; you can also skip templates entirely)
|
||||
using GroupsTemplateMap =
|
||||
GCHashMap<JSCompartment*, ReadBarriered<PlainObject*>,
|
||||
DefaultHasher<JSCompartment*>, SystemAllocPolicy>;
|
||||
GroupsTemplateMap groupsTemplateMap;
|
||||
bool groupsTemplateMapInited = false;
|
||||
bool groupsTemplateMapInited;
|
||||
|
||||
Vector<JSAtom*, 0, SystemAllocPolicy> names;
|
||||
Vector<uint32_t, 0, SystemAllocPolicy> indices;
|
||||
|
||||
NamedCaptureData() : groupsTemplateMapInited(false) {}
|
||||
};
|
||||
|
||||
void
|
||||
|
|
@ -977,7 +978,7 @@ RegExpShared::traceChildren(JSTracer* trc)
|
|||
if (IsMarkingTrace(trc) && trc->runtime()->gc.isShrinkingGC())
|
||||
discardJitCode();
|
||||
|
||||
if (namedCaptureData_ && namedCaptureData_->mapInited) {
|
||||
if (namedCaptureData_ && namedCaptureData_->groupsTemplateMapInited) {
|
||||
for (auto iter = namedCaptureData_->groupsTemplateMap.all(); !iter.empty(); iter.popFront()) {
|
||||
TraceNullableEdge(trc, &iter.front().value(), "RegExpShared groupsTemplate per-compartment");
|
||||
}
|
||||
|
|
@ -985,7 +986,7 @@ RegExpShared::traceChildren(JSTracer* trc)
|
|||
|
||||
for (auto& atom : namedCaptureNames_) {
|
||||
TraceEdge(trc, &atom, "RegExpShared namedCaptureName");
|
||||
}
|
||||
}
|
||||
|
||||
TraceNullableEdge(trc, &source, "RegExpShared source");
|
||||
for (auto& comp : compilationArray)
|
||||
|
|
@ -1005,6 +1006,10 @@ RegExpShared::discardJitCode()
|
|||
void
|
||||
RegExpShared::finalize(FreeOp* fop)
|
||||
{
|
||||
if (namedCaptureData_) {
|
||||
js_delete(namedCaptureData_);
|
||||
namedCaptureData_ = nullptr;
|
||||
}
|
||||
for (auto& comp : compilationArray)
|
||||
js_free(comp.byteCode);
|
||||
tables.~JitCodeTables();
|
||||
|
|
@ -1401,10 +1406,10 @@ RegExpShared::getOrCreateGroupsTemplate(JSContext* cx)
|
|||
|
||||
NamedCaptureData* data = namedCaptureData_;
|
||||
|
||||
if (!data->mapInited) {
|
||||
if (!data->groupsTemplateMapInited) {
|
||||
if (!data->groupsTemplateMap.init(4))
|
||||
return nullptr;
|
||||
data->mapInited = true;
|
||||
data->groupsTemplateMapInited = true;
|
||||
}
|
||||
|
||||
JSCompartment* comp = cx->compartment();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue