☠☠ backed out by 35e80f56a797 ☠ ☠ | |
author | Steve Fink <sfink@mozilla.com> |
Tue, 19 Sep 2017 09:55:33 -0700 | |
changeset 381885 | 3c7dfc3cc0c0c9dabcaa80dce62bad1faa381e83 |
parent 381884 | 938750d859b85600b84013bd6dea63db1c32d135 |
child 381886 | 6998422519778a38cfde7e901d05919fde0b023b |
push id | 95224 |
push user | sfink@mozilla.com |
push date | Wed, 20 Sep 2017 15:38:25 +0000 |
treeherder | mozilla-inbound@699842251977 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jonco |
bugs | 1401243 |
milestone | 57.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/src/frontend/BytecodeCompiler.h +++ b/js/src/frontend/BytecodeCompiler.h @@ -115,20 +115,16 @@ bool IsIdentifier(const char* chars, size_t length); bool IsIdentifier(const char16_t* chars, size_t length); /* True if str is a keyword. Defined in TokenStream.cpp. */ bool IsKeyword(JSLinearString* str); -/* Trace all GC things reachable from parser. Defined in Parser.cpp. */ -void -TraceParser(JSTracer* trc, JS::AutoGCRooter* parser); - class MOZ_STACK_CLASS AutoFrontendTraceLog { #ifdef JS_TRACE_LOGGING TraceLoggerThread* logger_; mozilla::Maybe<TraceLoggerEvent> frontendEvent_; mozilla::Maybe<AutoTraceLog> frontendLog_; mozilla::Maybe<AutoTraceLog> typeLog_; #endif
--- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -870,19 +870,19 @@ template <class ParseHandler, typename C Parser<ParseHandler, CharT>::Parser(JSContext* cx, LifoAlloc& alloc, const ReadOnlyCompileOptions& options, const CharT* chars, size_t length, bool foldConstants, UsedNameTracker& usedNames, SyntaxParser* syntaxParser, LazyScript* lazyOuterFunction) : ParserBase(cx, alloc, options, chars, length, foldConstants, usedNames, lazyOuterFunction), - AutoGCRooter(cx, PARSER), syntaxParser_(syntaxParser), - handler(cx, alloc, lazyOuterFunction) + handler(cx, alloc, lazyOuterFunction), + root(cx, thisForCtor()) { // The Mozilla specific JSOPTION_EXTRA_WARNINGS option adds extra warnings // which are not generated if functions are parsed lazily. Note that the // standard "use strict" does not inhibit lazy parsing. if (options.extraWarningsOption) disableSyntaxParser(); } @@ -987,22 +987,16 @@ ModuleSharedContext::ModuleSharedContext template <class ParseHandler, typename CharT> void Parser<ParseHandler, CharT>::trace(JSTracer* trc) { ObjectBox::TraceList(trc, traceListHead); } -void -TraceParser(JSTracer* trc, AutoGCRooter* parser) -{ - static_cast<Parser<FullParseHandler, char16_t>*>(parser)->trace(trc); -} - /* * Parse a top-level JS script. */ template <class ParseHandler, typename CharT> typename ParseHandler::Node Parser<ParseHandler, CharT>::parse() { MOZ_ASSERT(checkOptionsCalled);
--- a/js/src/frontend/Parser.h +++ b/js/src/frontend/Parser.h @@ -316,17 +316,17 @@ ParseContext::Scope::Scope(JSContext* cx inline ParseContext::VarScope::VarScope(ParserBase* parser) : Scope(parser) { useAsVarScope(parser->pc); } template <class ParseHandler, typename CharT> -class Parser final : public ParserBase, private JS::AutoGCRooter +class Parser final : public ParserBase { private: using Node = typename ParseHandler::Node; /* * A class for temporarily stashing errors while parsing continues. * * The ability to stash an error is useful for handling situations where we @@ -491,29 +491,36 @@ class Parser final : public ParserBase, // If ParseHandler is SyntaxParseHandler, clear whether the last syntax // parse was aborted. // // If ParseHandler is FullParseHandler, do nothing. void clearAbortedSyntaxParse(); bool checkOptions(); - friend void js::frontend::TraceParser(JSTracer* trc, JS::AutoGCRooter* parser); - /* * Parse a top-level JS script. */ Node parse(); FunctionBox* newFunctionBox(Node fn, JSFunction* fun, uint32_t toStringStart, Directives directives, GeneratorKind generatorKind, FunctionAsyncKind asyncKind); void trace(JSTracer* trc); + // Parser roots itself (in a somewhat odd way -- it contains a Rooted<> of + // a dummy type that traces the owning Parser.) + struct Rooter { + Parser* parser; + Rooter(Parser* parser) : parser(parser) {} + void trace(JSTracer* trc) { parser->trace(trc); } + }; + PersistentRooted<Rooter> root; + private: Parser* thisForCtor() { return this; } Node stringLiteral(); Node noSubstitutionTaggedTemplate(); Node noSubstitutionUntaggedTemplate(); Node templateLiteral(YieldHandling yieldHandling); bool taggedTemplate(YieldHandling yieldHandling, Node nodeList, TokenKind tt);
--- a/js/src/gc/RootMarking.cpp +++ b/js/src/gc/RootMarking.cpp @@ -145,20 +145,16 @@ JS_FOR_EACH_TRACEKIND(FINISH_ROOT_LIST) // safely clear memebers. We instead assert that none escape the RootLists. // See the comment on RootLists::~RootLists for details. } inline void AutoGCRooter::trace(JSTracer* trc) { switch (tag_) { - case PARSER: - frontend::TraceParser(trc, this); - return; - case VALARRAY: { /* * We don't know the template size parameter, but we can safely treat it * as an AutoValueArray<1> because the length is stored separately. */ AutoValueArray<1>* array = static_cast<AutoValueArray<1>*>(this); TraceRootRange(trc, array->length(), array->begin(), "js::AutoValueArray"); return;
--- a/js/src/jspubtd.h +++ b/js/src/jspubtd.h @@ -235,17 +235,16 @@ class JS_PUBLIC_API(AutoGCRooter) * If negative, meaning is indicated by the corresponding value in the enum * below. Any other negative value indicates some deeper problem such as * memory corruption. */ ptrdiff_t tag_; enum { VALARRAY = -2, /* js::AutoValueArray */ - PARSER = -3, /* js::frontend::Parser */ VALVECTOR = -10, /* js::AutoValueVector */ IDVECTOR = -11, /* js::AutoIdVector */ OBJVECTOR = -14, /* js::AutoObjectVector */ IONMASM = -19, /* js::jit::MacroAssembler */ WRAPVECTOR = -20, /* js::AutoWrapperVector */ WRAPPER = -21, /* js::AutoWrapperRooter */ CUSTOM = -26 /* js::CustomAutoRooter */ };