Mozilla Home
Privacy
Cookies
Legal
Bugzilla
Browse
Advanced Search
New Bug
Reports
Documentation
Log In
Log In with GitHub
or
Remember me
Browse
Advanced Search
New Bug
Reports
Documentation
Attachment 8961331 Details for
Bug 1083458
[patch]
Remove isExprBody
remove-isexprbody (text/plain), 11.34 KB, created by
Tom S. (please needinfo tschuster)
(
hide
)
Description:
Remove isExprBody
Filename:
MIME Type:
Creator:
Tom S. (please needinfo tschuster)
Size:
11.34 KB
patch
obsolete
># HG changeset patch ># User Tom Schuster <evilpies@gmail.com> ># Date 1520884496 -3600 ># Mon Mar 12 20:54:56 2018 +0100 ># Node ID 4161ca8a07957e858fdae319c4ef3b4b960fdb45 ># Parent 711d02a56aa129ac6e5622ea579c25e74c64b6b2 >more complex removal > >diff --git a/js/src/builtin/ReflectParse.cpp b/js/src/builtin/ReflectParse.cpp >--- a/js/src/builtin/ReflectParse.cpp >+++ b/js/src/builtin/ReflectParse.cpp >@@ -3184,7 +3184,7 @@ ASTSerializer::function(ParseNode* pn, A > : GeneratorStyle::None; > > bool isAsync = pn->pn_funbox->isAsync(); >- bool isExpression = pn->pn_funbox->isExprBody(); >+ bool isExpression = type == AST_ARROW_EXPR; > > RootedValue id(cx); > RootedAtom funcAtom(cx, func->explicitName()); >diff --git a/js/src/frontend/FullParseHandler.h b/js/src/frontend/FullParseHandler.h >--- a/js/src/frontend/FullParseHandler.h >+++ b/js/src/frontend/FullParseHandler.h >@@ -683,18 +683,6 @@ class FullParseHandler > return new_<CodeNode>(ParseNodeKind::Function, JSOP_LAMBDA_ARROW, pos); > } > >- bool isExpressionClosure(ParseNode* node) const { >- return node->isKind(ParseNodeKind::Function) && >- node->pn_funbox->isExprBody() && >- !node->pn_funbox->isArrow(); >- } >- >- void noteExpressionClosure(Node* funcNode) const { >- // No need to do anything: |funcNode->pn_funbox| modifications >- // performed elsewhere in the relevant code path will assure >- // |isExpressionClosure| above tests true on |*funcNode|. >- } >- > ParseNode* newObjectMethodOrPropertyDefinition(ParseNode* key, ParseNode* fn, AccessorType atype) { > MOZ_ASSERT(isUsableAsObjectPropertyName(key)); > >diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp >--- a/js/src/frontend/Parser.cpp >+++ b/js/src/frontend/Parser.cpp >@@ -485,7 +485,6 @@ FunctionBox::FunctionBox(JSContext* cx, > usesThis(false), > usesReturn(false), > hasRest_(false), >- isExprBody_(false), > hasExtensibleScope_(false), > argumentsHasLocalBinding_(false), > definitelyNeedsArgsObj_(false), >@@ -2501,8 +2500,6 @@ PerHandlerParser<SyntaxParseHandler>::fi > lazy->setAsyncKind(funbox->asyncKind()); > if (funbox->hasRest()) > lazy->setHasRest(); >- if (funbox->isExprBody()) >- lazy->setIsExprBody(); > if (funbox->isLikelyConstructorWrapper()) > lazy->setLikelyConstructorWrapper(); > if (funbox->isDerivedClassConstructor()) >@@ -3254,8 +3251,6 @@ Parser<FullParseHandler, CharT>::skipLaz > LazyScript* lazy = fun->lazyScript(); > if (lazy->needsHomeObject()) > funbox->setNeedsHomeObject(); >- if (lazy->isExprBody()) >- funbox->setIsExprBody(); > > PropagateTransitiveParseFlags(lazy, pc->sc()); > >@@ -3781,7 +3776,6 @@ GeneralParser<ParseHandler, CharT>::func > > anyChars.ungetToken(); > bodyType = ExpressionBody; >- funbox->setIsExprBody(); > } else { > openedPos = pos().begin; > } >@@ -7896,9 +7890,6 @@ GeneralParser<ParseHandler, CharT>::orEx > if (!pn) > return null(); > >- if (handler.isExpressionClosure(pn)) >- return pn; >- > expressionClosureHandling = ExpressionClosure::Forbidden; > > // If a binary operator follows, consume it and compute the >@@ -7974,9 +7965,6 @@ GeneralParser<ParseHandler, CharT>::cond > if (!condition) > return null(); > >- if (handler.isExpressionClosure(condition)) >- return condition; >- > bool matched; > if (!tokenStream.matchToken(&matched, TokenKind::Hook)) > return null(); >@@ -8407,9 +8395,6 @@ GeneralParser<ParseHandler, CharT>::unar > if (!expr) > return null(); > >- if (handler.isExpressionClosure(expr)) >- return expr; >- > /* Don't look across a newline boundary for a postfix incop. */ > if (!tokenStream.peekTokenSameLine(&tt)) > return null(); >@@ -8577,9 +8562,6 @@ GeneralParser<ParseHandler, CharT>::memb > possibleError, invoked); > if (!lhs) > return null(); >- >- if (handler.isExpressionClosure(lhs)) >- return lhs; > } > > MOZ_ASSERT_IF(handler.isSuperBase(lhs), anyChars.isCurrentTokenType(TokenKind::Super)); >diff --git a/js/src/frontend/SharedContext.h b/js/src/frontend/SharedContext.h >--- a/js/src/frontend/SharedContext.h >+++ b/js/src/frontend/SharedContext.h >@@ -342,9 +342,6 @@ class FunctionBox : public ObjectBox, pu > bool usesThis:1; /* contains 'this' */ > bool usesReturn:1; /* contains a 'return' statement */ > bool hasRest_:1; /* has rest parameter */ >- bool isExprBody_:1; /* arrow function with expression >- * body or expression closure: >- * function(x) x*x */ > > // This function does something that can extend the set of bindings in its > // call objects --- it does a direct eval in non-strict code, or includes a >@@ -483,11 +480,6 @@ class FunctionBox : public ObjectBox, pu > hasRest_ = true; > } > >- bool isExprBody() const { return isExprBody_; } >- void setIsExprBody() { >- isExprBody_ = true; >- } >- > bool hasExtensibleScope() const { return hasExtensibleScope_; } > bool hasThisBinding() const { return hasThisBinding_; } > bool argumentsHasLocalBinding() const { return argumentsHasLocalBinding_; } >diff --git a/js/src/frontend/SyntaxParseHandler.h b/js/src/frontend/SyntaxParseHandler.h >--- a/js/src/frontend/SyntaxParseHandler.h >+++ b/js/src/frontend/SyntaxParseHandler.h >@@ -66,10 +66,6 @@ class SyntaxParseHandler > // ECMAScript. > NodeFunctionExpressionBlockBody, > >- // A non-arrow function expression with AssignmentExpression body -- a >- // proprietary SpiderMonkey extension. >- NodeFunctionExpressionClosure, >- > NodeFunctionArrow, > NodeFunctionStatement, > >@@ -141,7 +137,7 @@ class SyntaxParseHandler > }; > > bool isNonArrowFunctionExpression(Node node) const { >- return node == NodeFunctionExpressionBlockBody || node == NodeFunctionExpressionClosure; >+ return node == NodeFunctionExpressionBlockBody; > } > > bool isPropertyAccess(Node node) { >@@ -348,22 +344,11 @@ class SyntaxParseHandler > Node newFunctionStatement(const TokenPos& pos) { return NodeFunctionStatement; } > > Node newFunctionExpression(const TokenPos& pos) { >- // All non-arrow function expressions are initially presumed to have >- // block body. This will be overridden later *if* the function >- // expression permissibly has an AssignmentExpression body. > return NodeFunctionExpressionBlockBody; > } > > Node newArrowFunction(const TokenPos& pos) { return NodeFunctionArrow; } > >- bool isExpressionClosure(Node node) const { >- return node == NodeFunctionExpressionClosure; >- } >- >- void noteExpressionClosure(Node* funcNode) const { >- *funcNode = NodeFunctionExpressionClosure; >- } >- > void setFunctionFormalParametersAndBody(Node funcNode, Node kid) {} > void setFunctionBody(Node pn, Node kid) {} > void setFunctionBox(Node pn, FunctionBox* funbox) {} >diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp >--- a/js/src/shell/js.cpp >+++ b/js/src/shell/js.cpp >@@ -2932,10 +2932,6 @@ DisassembleScript(JSContext* cx, HandleS > if (!sp->put(" CONSTRUCTOR")) > return false; > } >- if (script->isExprBody()) { >- if (!sp->put(" EXPRESSION_CLOSURE")) >- return false; >- } > if (fun->isSelfHostedBuiltin()) { > if (!sp->put(" SELF_HOSTED")) > return false; >diff --git a/js/src/vm/JSScript.cpp b/js/src/vm/JSScript.cpp >--- a/js/src/vm/JSScript.cpp >+++ b/js/src/vm/JSScript.cpp >@@ -334,7 +334,6 @@ js::XDRScript(XDRState<mode>* xdr, Handl > IsGenerator, > IsAsync, > HasRest, >- IsExprBody, > OwnSource, > ExplicitUseStrict, > SelfHosted, >@@ -447,8 +446,6 @@ js::XDRScript(XDRState<mode>* xdr, Handl > scriptBits |= (1 << IsAsync); > if (script->hasRest()) > scriptBits |= (1 << HasRest); >- if (script->isExprBody()) >- scriptBits |= (1 << IsExprBody); > if (script->hasSingletons()) > scriptBits |= (1 << HasSingleton); > if (script->treatAsRunOnce()) >@@ -599,8 +596,6 @@ js::XDRScript(XDRState<mode>* xdr, Handl > script->setAsyncKind(FunctionAsyncKind::AsyncFunction); > if (scriptBits & (1 << HasRest)) > script->setHasRest(); >- if (scriptBits & (1 << IsExprBody)) >- script->setIsExprBody(); > } > > JS_STATIC_ASSERT(sizeof(jsbytecode) == 1); >@@ -2901,8 +2896,6 @@ JSScript::initFromFunctionBox(HandleScri > script->setAsyncKind(funbox->asyncKind()); > if (funbox->hasRest()) > script->setHasRest(); >- if (funbox->isExprBody()) >- script->setIsExprBody(); > > PositionalFormalParameterIter fi(script); > while (fi && !fi.closedOver()) >@@ -3556,7 +3549,6 @@ js::detail::CopyScript(JSContext* cx, Ha > dst->isDefaultClassConstructor_ = src->isDefaultClassConstructor(); > dst->isAsync_ = src->isAsync_; > dst->hasRest_ = src->hasRest_; >- dst->isExprBody_ = src->isExprBody_; > dst->hideScriptFromDebugger_ = src->hideScriptFromDebugger_; > > if (nconsts != 0) { >@@ -4286,7 +4278,6 @@ LazyScript::Create(JSContext* cx, Handle > p.hasThisBinding = false; > p.isAsync = false; > p.hasRest = false; >- p.isExprBody = false; > p.numClosedOverBindings = closedOverBindings.length(); > p.numInnerFunctions = innerFunctions.length(); > p.isGenerator = false; >diff --git a/js/src/vm/JSScript.h b/js/src/vm/JSScript.h >--- a/js/src/vm/JSScript.h >+++ b/js/src/vm/JSScript.h >@@ -1140,7 +1140,6 @@ class JSScript : public js::gc::TenuredC > bool isAsync_:1; > > bool hasRest_:1; >- bool isExprBody_:1; > > // True if the debugger's onNewScript hook has not yet been called. > bool hideScriptFromDebugger_:1; >@@ -1459,13 +1458,6 @@ class JSScript : public js::gc::TenuredC > hasRest_ = true; > } > >- bool isExprBody() const { >- return isExprBody_; >- } >- void setIsExprBody() { >- isExprBody_ = true; >- } >- > bool hideScriptFromDebugger() const { > return hideScriptFromDebugger_; > } >@@ -2113,7 +2105,6 @@ class LazyScript : public gc::TenuredCel > uint32_t shouldDeclareArguments : 1; > uint32_t hasThisBinding : 1; > uint32_t isAsync : 1; >- uint32_t isExprBody : 1; > > uint32_t numClosedOverBindings : NumClosedOverBindingsBits; > >@@ -2271,13 +2262,6 @@ class LazyScript : public gc::TenuredCel > p_.hasRest = true; > } > >- bool isExprBody() const { >- return p_.isExprBody; >- } >- void setIsExprBody() { >- p_.isExprBody = true; >- } >- > bool strict() const { > return p_.strict; > } >diff --git a/js/src/wasm/AsmJS.cpp b/js/src/wasm/AsmJS.cpp >--- a/js/src/wasm/AsmJS.cpp >+++ b/js/src/wasm/AsmJS.cpp >@@ -3344,8 +3344,6 @@ CheckFunctionHead(ModuleValidator& m, Pa > { > if (fn->pn_funbox->hasRest()) > return m.fail(fn, "rest args not allowed"); >- if (fn->pn_funbox->isExprBody()) >- return m.fail(fn, "expression closures not allowed"); > if (fn->pn_funbox->hasDestructuringArgs) > return m.fail(fn, "destructuring args not allowed"); > return true;
Actions:
View
|
Diff
|
Review
Attachments on
bug 1083458
:
8828212
|
8961064
|
8961065
|
8961331
|
8964182
|
8964183
|
8964527
|
8964534