зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1634435
- Remove parser auto rooters r=sfink
Since the parsers have a virtual trace method already we can handle these by making them CustomAutoRooters and get rid of the special kinds. Differential Revision: https://phabricator.services.mozilla.com/D73297
This commit is contained in:
Родитель
453bf05dcd
Коммит
fd4b8f30fb
|
@ -918,9 +918,6 @@ namespace JS {
|
|||
class JS_PUBLIC_API AutoGCRooter;
|
||||
|
||||
enum class AutoGCRooterKind : uint8_t {
|
||||
Parser, /* js::frontend::Parser */
|
||||
BinASTParser, /* js::frontend::BinASTParser; only used if built with
|
||||
* JS_BUILD_BINAST support */
|
||||
WrapperVector, /* js::AutoWrapperVector */
|
||||
Wrapper, /* js::AutoWrapperRooter */
|
||||
Custom, /* js::CustomAutoRooter */
|
||||
|
|
|
@ -31,11 +31,8 @@ class BinASTParserBase : public ParserSharedBase {
|
|||
~BinASTParserBase() = default;
|
||||
|
||||
public:
|
||||
virtual void doTrace(JSTracer* trc) {}
|
||||
|
||||
void trace(JSTracer* trc) {
|
||||
void trace(JSTracer* trc) override {
|
||||
FunctionBox::TraceList(trc, traceListHead_);
|
||||
doTrace(trc);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -811,7 +811,8 @@ bool BinASTParserPerTokenizer<Tok>::computeErrorMetadata(
|
|||
}
|
||||
|
||||
template <typename Tok>
|
||||
void BinASTParserPerTokenizer<Tok>::doTrace(JSTracer* trc) {
|
||||
void BinASTParserPerTokenizer<Tok>::trace(JSTracer* trc) {
|
||||
BinASTParserBase::trace(trc);
|
||||
if (tokenizer_) {
|
||||
tokenizer_->traceMetadata(trc);
|
||||
}
|
||||
|
|
|
@ -226,7 +226,7 @@ class BinASTParserPerTokenizer : public BinASTParserBase,
|
|||
const ErrorOffset& offset) override;
|
||||
|
||||
private:
|
||||
void doTrace(JSTracer* trc) final;
|
||||
void trace(JSTracer* trc) final;
|
||||
|
||||
public:
|
||||
virtual ErrorReporter& errorReporter() override { return *this; }
|
||||
|
|
|
@ -151,15 +151,7 @@ bool GeneralParser<ParseHandler, Unit>::mustMatchTokenInternal(
|
|||
ParserSharedBase::ParserSharedBase(JSContext* cx,
|
||||
CompilationInfo& compilationInfo,
|
||||
ScriptSourceObject* sourceObject, Kind kind)
|
||||
: JS::AutoGCRooter(
|
||||
cx,
|
||||
#ifdef JS_BUILD_BINAST
|
||||
kind == Kind::Parser ? JS::AutoGCRooter::Kind::Parser
|
||||
: JS::AutoGCRooter::Kind::BinASTParser
|
||||
#else
|
||||
JS::AutoGCRooter::Kind::Parser
|
||||
#endif
|
||||
),
|
||||
: JS::CustomAutoRooter(cx),
|
||||
cx_(cx),
|
||||
alloc_(compilationInfo.allocScope.alloc()),
|
||||
compilationInfo_(compilationInfo),
|
||||
|
|
|
@ -244,7 +244,7 @@ class AutoAwaitIsKeyword;
|
|||
template <class ParseHandler, typename Unit>
|
||||
class AutoInParametersOfAsyncFunction;
|
||||
|
||||
class MOZ_STACK_CLASS ParserSharedBase : public JS::AutoGCRooter {
|
||||
class MOZ_STACK_CLASS ParserSharedBase : public JS::CustomAutoRooter {
|
||||
public:
|
||||
enum class Kind { Parser, BinASTParser };
|
||||
|
||||
|
@ -333,7 +333,7 @@ class MOZ_STACK_CLASS ParserBase : public ParserSharedBase,
|
|||
|
||||
bool checkOptions();
|
||||
|
||||
void trace(JSTracer* trc);
|
||||
void trace(JSTracer* trc) final;
|
||||
|
||||
const char* getFilename() const { return anyChars.getFilename(); }
|
||||
TokenPos pos() const { return anyChars.currentToken().pos; }
|
||||
|
|
|
@ -163,16 +163,6 @@ JS_PUBLIC_API void js::TraceValueArray(JSTracer* trc, size_t length,
|
|||
|
||||
void AutoGCRooter::trace(JSTracer* trc) {
|
||||
switch (kind_) {
|
||||
case Kind::Parser:
|
||||
static_cast<frontend::ParserBase*>(this)->trace(trc);
|
||||
break;
|
||||
|
||||
#if defined(JS_BUILD_BINAST)
|
||||
case Kind::BinASTParser:
|
||||
static_cast<frontend::BinASTParserBase*>(this)->trace(trc);
|
||||
break;
|
||||
#endif // defined(JS_BUILD_BINAST)
|
||||
|
||||
case Kind::Wrapper:
|
||||
static_cast<AutoWrapperRooter*>(this)->trace(trc);
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче