зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1528844 - Move ParseNode allocation from BinASTParserBase to FullParseHandler. r=Yoric
BinASTParserBase::allocParseNode was used only for creating ParseNodeKind::ParamsBody node, and other nodes are created by FullParseHandler. Added FullParseHandler::newParamsBody and removed ParseNode allocation methods from BinASTParserBase. Differential Revision: https://phabricator.services.mozilla.com/D20774 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
5fc0c2d2a4
Коммит
de2a04e277
|
@ -3135,9 +3135,7 @@ JS::Result<Ok> BinASTParser<Tok>::parseInterfaceGetterContents(
|
|||
(void)isThisCaptured;
|
||||
MOZ_TRY(parseAssertedVarScope());
|
||||
|
||||
BINJS_TRY_DECL(params,
|
||||
this->template new_<ListNode>(ParseNodeKind::ParamsBody,
|
||||
tokenizer_->pos(start)));
|
||||
BINJS_TRY_DECL(params, handler_.newParamsBody(tokenizer_->pos(start)));
|
||||
BINJS_MOZ_TRY_DECL(body, parseFunctionBody());
|
||||
|
||||
*paramsOut = params;
|
||||
|
@ -3721,8 +3719,7 @@ JS::Result<Ok> BinASTParser<Tok>::parseInterfaceSetterContents(
|
|||
MOZ_TRY(parseAssertedParameterScope(&positionalParams));
|
||||
|
||||
BINJS_MOZ_TRY_DECL(param, parseParameter());
|
||||
BINJS_TRY_DECL(params, this->template new_<ListNode>(
|
||||
ParseNodeKind::ParamsBody, param->pn_pos));
|
||||
BINJS_TRY_DECL(params, handler_.newParamsBody(param->pn_pos));
|
||||
handler_.addList(params, param);
|
||||
MOZ_TRY(checkPositionalParameterIndices(positionalParams, params));
|
||||
MOZ_TRY(parseAssertedVarScope());
|
||||
|
@ -4751,9 +4748,7 @@ JS::Result<ListNode*> BinASTParser<Tok>::parseListOfParameter() {
|
|||
|
||||
const auto start = tokenizer_->offset();
|
||||
MOZ_TRY(tokenizer_->enterList(length, guard));
|
||||
BINJS_TRY_DECL(result,
|
||||
this->template new_<ListNode>(ParseNodeKind::ParamsBody,
|
||||
tokenizer_->pos(start)));
|
||||
BINJS_TRY_DECL(result, handler_.newParamsBody(tokenizer_->pos(start)));
|
||||
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
BINJS_MOZ_TRY_DECL(item, parseParameter());
|
||||
|
|
|
@ -16,7 +16,6 @@ BinASTParserBase::BinASTParserBase(JSContext* cx, LifoAlloc& alloc,
|
|||
HandleScriptSourceObject sourceObject,
|
||||
Handle<LazyScript*> lazyScript)
|
||||
: ParserSharedBase(cx, alloc, usedNames, sourceObject),
|
||||
nodeAlloc_(cx, alloc),
|
||||
lazyScript_(cx, lazyScript),
|
||||
handler_(cx, alloc, nullptr, SourceKind::Binary) {
|
||||
MOZ_ASSERT_IF(lazyScript, lazyScript->isBinAST());
|
||||
|
|
|
@ -41,16 +41,6 @@ class BinASTParserBase : public ParserSharedBase {
|
|||
doTrace(trc);
|
||||
}
|
||||
|
||||
public:
|
||||
ParseNode* allocParseNode(size_t size) {
|
||||
return static_cast<ParseNode*>(nodeAlloc_.allocNode(size));
|
||||
}
|
||||
|
||||
JS_DECLARE_NEW_METHODS(new_, allocParseNode, inline)
|
||||
|
||||
private:
|
||||
ParseNodeAllocator nodeAlloc_;
|
||||
|
||||
// ---- Parsing-related stuff
|
||||
protected:
|
||||
Rooted<LazyScript*> lazyScript_;
|
||||
|
|
|
@ -882,18 +882,14 @@ GetterContents:
|
|||
fields:
|
||||
body:
|
||||
before: |
|
||||
BINJS_TRY_DECL(params,
|
||||
this->template new_<ListNode>(ParseNodeKind::ParamsBody,
|
||||
tokenizer_->pos(start)));
|
||||
BINJS_TRY_DECL(params, handler_.newParamsBody(tokenizer_->pos(start)));
|
||||
|
||||
SetterContents:
|
||||
inherits: FunctionExpressionContents
|
||||
fields:
|
||||
param:
|
||||
after: |
|
||||
BINJS_TRY_DECL(params,
|
||||
this->template new_<ListNode>(ParseNodeKind::ParamsBody,
|
||||
param->pn_pos));
|
||||
BINJS_TRY_DECL(params, handler_.newParamsBody(param->pn_pos));
|
||||
handler_.addList(params, param);
|
||||
MOZ_TRY(checkPositionalParameterIndices(positionalParams, params));
|
||||
|
||||
|
@ -1213,9 +1209,7 @@ ListOfParameter:
|
|||
type-ok:
|
||||
ListNode*
|
||||
init: |
|
||||
BINJS_TRY_DECL(result,
|
||||
this->template new_<ListNode>(ParseNodeKind::ParamsBody,
|
||||
tokenizer_->pos(start)));
|
||||
BINJS_TRY_DECL(result, handler_.newParamsBody(tokenizer_->pos(start)));
|
||||
append:
|
||||
handler_.addList(/* list = */ result, /* kid = */ item);
|
||||
|
||||
|
@ -1232,9 +1226,7 @@ ListOfStatement:
|
|||
# type-ok:
|
||||
# ListNode*
|
||||
# init:
|
||||
# BINJS_TRY_DECL(result,
|
||||
# this->template new_<ListNode>(ParseNodeKind::ParamsBody,
|
||||
# tokenizer_->pos()));
|
||||
# BINJS_TRY_DECL(result, handler_.newParamsBody(tokenizer_->pos()));
|
||||
# append:
|
||||
# result->appendWithoutOrderAssumption(item);
|
||||
|
||||
|
|
|
@ -790,6 +790,10 @@ class FullParseHandler {
|
|||
return newBinary(ParseNodeKind::Shorthand, key, value, JSOP_INITPROP);
|
||||
}
|
||||
|
||||
ListNodeType newParamsBody(const TokenPos& pos) {
|
||||
return new_<ListNode>(ParseNodeKind::ParamsBody, pos);
|
||||
}
|
||||
|
||||
void setFunctionFormalParametersAndBody(FunctionNodeType funNode,
|
||||
ListNodeType paramsBody) {
|
||||
MOZ_ASSERT_IF(paramsBody, paramsBody->isKind(ParseNodeKind::ParamsBody));
|
||||
|
|
Загрузка…
Ссылка в новой задаче