mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1345177 - Give RegExpShared a finalizer r=sfink
This commit is contained in:
parent
3c03ed4fac
commit
c35baf5456
@ -315,9 +315,6 @@ class TenuredCell : public Cell
|
||||
static MOZ_ALWAYS_INLINE void writeBarrierPost(void* cellp, TenuredCell* prior,
|
||||
TenuredCell* next);
|
||||
|
||||
// Default implementation for kinds that don't require finalization.
|
||||
void finalize(FreeOp* fop) {}
|
||||
|
||||
// Default implementation for kinds that don't require fixup.
|
||||
void fixupAfterMovingGC() {}
|
||||
|
||||
|
@ -947,12 +947,6 @@ RegExpShared::RegExpShared(JSAtom* source, RegExpFlag flags)
|
||||
: source(source), flags(flags), canStringMatch(false), parenCount(0)
|
||||
{}
|
||||
|
||||
RegExpShared::~RegExpShared()
|
||||
{
|
||||
for (size_t i = 0; i < tables.length(); i++)
|
||||
js_delete(tables[i]);
|
||||
}
|
||||
|
||||
void
|
||||
RegExpShared::traceChildren(JSTracer* trc)
|
||||
{
|
||||
@ -972,6 +966,14 @@ RegExpShared::discardJitCode()
|
||||
comp.jitCode = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
RegExpShared::finalize(FreeOp* fop)
|
||||
{
|
||||
for (size_t i = 0; i < tables.length(); i++)
|
||||
js_free(tables[i]);
|
||||
tables.~JitCodeTables();
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
RegExpShared::compile(JSContext* cx, MutableHandleRegExpShared re, HandleLinearString input,
|
||||
CompilationMode mode, ForceByteCodeEnum force)
|
||||
|
@ -144,7 +144,8 @@ class RegExpShared : public gc::TenuredCell
|
||||
}
|
||||
|
||||
// Tables referenced by JIT code.
|
||||
Vector<uint8_t*, 0, SystemAllocPolicy> tables;
|
||||
using JitCodeTables = Vector<uint8_t*, 0, SystemAllocPolicy>;
|
||||
JitCodeTables tables;
|
||||
|
||||
/* Internal functions. */
|
||||
RegExpShared(JSAtom* source, RegExpFlag flags);
|
||||
@ -167,7 +168,7 @@ class RegExpShared : public gc::TenuredCell
|
||||
}
|
||||
|
||||
public:
|
||||
~RegExpShared();
|
||||
~RegExpShared() = delete;
|
||||
|
||||
// Execute this RegExp on input starting from searchIndex, filling in
|
||||
// matches if specified and otherwise only determining if there is a match.
|
||||
@ -209,6 +210,7 @@ class RegExpShared : public gc::TenuredCell
|
||||
|
||||
void traceChildren(JSTracer* trc);
|
||||
void discardJitCode();
|
||||
void finalize(FreeOp* fop);
|
||||
|
||||
static size_t offsetOfSource() {
|
||||
return offsetof(RegExpShared, source);
|
||||
|
Loading…
Reference in New Issue
Block a user