Bug 1577857 - Create ParseInfo class to manage Parser related information r=tcampbell

- Hoists the UsedNameTracker and and the FunctionTreeHolder into a new ParseInfo structure.
- Make LifoAllocScopes lifetimes lexically explicit throughout parser.
- Removes allocator argument to Parser construction in lieu of the LifoAllocScope inside of ParseInfo.

Differential Revision: https://phabricator.services.mozilla.com/D45042
This commit is contained in:
Matthew Gaudet
2019-09-10 15:53:20 +00:00
parent 3ad2553c88
commit d7c5d8d4ed
21 changed files with 193 additions and 146 deletions

View File

@@ -83,14 +83,14 @@ using UsedNamePtr = UsedNameTracker::UsedNameMap::Ptr;
template <typename Tok>
BinASTParserPerTokenizer<Tok>::BinASTParserPerTokenizer(
JSContext* cx, LifoAlloc& alloc, UsedNameTracker& usedNames,
JSContext* cx, ParseInfo& parseInfo,
const JS::ReadOnlyCompileOptions& options,
HandleScriptSourceObject sourceObject,
Handle<LazyScript*> lazyScript /* = nullptr */)
: BinASTParserBase(cx, alloc, usedNames, sourceObject),
: BinASTParserBase(cx, parseInfo, sourceObject),
options_(options),
lazyScript_(cx, lazyScript),
handler_(cx, alloc, nullptr, SourceKind::Binary),
handler_(cx, parseInfo.allocScope.alloc(), nullptr, SourceKind::Binary),
variableDeclarationKind_(VariableDeclarationKind::Var),
treeHolder_(cx, FunctionTreeHolder::Mode::Eager) {
MOZ_ASSERT_IF(lazyScript_, lazyScript_->isBinAST());