Bug 1405760 - Remove the JSOp argument from ParseHandler::newDeclarationList. r=Waldo
authorJason Orendorff <jorendorff@mozilla.com>
Wed, 04 Oct 2017 08:42:50 -0500
changeset 385564 cfde890019df4823bd01567331dcc31506ff642f
parent 385563 c3c6f7e45868cd69338588f808a86472caeaae0c
child 385565 17e8992435001e038b5d2ebc4d5877485aa0b7b9
push id32662
push userryanvm@gmail.com
push dateWed, 11 Oct 2017 21:53:47 +0000
treeherdermozilla-central@3d918ff5d634 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo
bugs1405760
milestone58.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
Bug 1405760 - Remove the JSOp argument from ParseHandler::newDeclarationList. r=Waldo This changes these ParseNodes to have pn_op=JSOP_NOP, but the field is already ignored downstream for these node kinds.
js/src/frontend/BytecodeEmitter.cpp
js/src/frontend/FullParseHandler.h
js/src/frontend/Parser.cpp
js/src/frontend/SyntaxParseHandler.h
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -6143,16 +6143,17 @@ BytecodeEmitter::emitTemplateString(Pars
 
     return true;
 }
 
 bool
 BytecodeEmitter::emitDeclarationList(ParseNode* declList)
 {
     MOZ_ASSERT(declList->isArity(PN_LIST));
+    MOZ_ASSERT(declList->isOp(JSOP_NOP));
 
     ParseNode* next;
     for (ParseNode* decl = declList->pn_head; decl; decl = next) {
         if (!updateSourceCoordNotes(decl->pn_pos.begin))
             return false;
         next = decl->pn_next;
 
         if (decl->isKind(PNK_ASSIGN)) {
--- a/js/src/frontend/FullParseHandler.h
+++ b/js/src/frontend/FullParseHandler.h
@@ -814,19 +814,19 @@ class FullParseHandler
     ParseNode* newList(ParseNodeKind kind, const T& begin, JSOp op = JSOP_NOP) = delete;
 
   public:
     ParseNode* newList(ParseNodeKind kind, ParseNode* kid, JSOp op = JSOP_NOP) {
         MOZ_ASSERT(!isDeclarationKind(kind));
         return new_<ListNode>(kind, op, kid);
     }
 
-    ParseNode* newDeclarationList(ParseNodeKind kind, const TokenPos& pos, JSOp op) {
+    ParseNode* newDeclarationList(ParseNodeKind kind, const TokenPos& pos) {
         MOZ_ASSERT(isDeclarationKind(kind));
-        return new_<ListNode>(kind, op, pos);
+        return new_<ListNode>(kind, JSOP_NOP, pos);
     }
 
     bool isDeclarationList(ParseNode* node) {
         return isDeclarationKind(node->getKind());
     }
 
     ParseNode* singleBindingFromDeclaration(ParseNode* decl) {
         MOZ_ASSERT(isDeclarationList(decl));
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -5010,36 +5010,32 @@ template <class ParseHandler, typename C
 typename ParseHandler::Node
 Parser<ParseHandler, CharT>::declarationList(YieldHandling yieldHandling,
                                              ParseNodeKind kind,
                                              ParseNodeKind* forHeadKind /* = nullptr */,
                                              Node* forInOrOfExpression /* = nullptr */)
 {
     MOZ_ASSERT(kind == PNK_VAR || kind == PNK_LET || kind == PNK_CONST);
 
-    JSOp op;
     DeclarationKind declKind;
     switch (kind) {
       case PNK_VAR:
-        op = JSOP_DEFVAR;
         declKind = DeclarationKind::Var;
         break;
       case PNK_CONST:
-        op = JSOP_DEFCONST;
         declKind = DeclarationKind::Const;
         break;
       case PNK_LET:
-        op = JSOP_DEFLET;
         declKind = DeclarationKind::Let;
         break;
       default:
         MOZ_CRASH("Unknown declaration kind");
     }
 
-    Node decl = handler.newDeclarationList(kind, pos(), op);
+    Node decl = handler.newDeclarationList(kind, pos());
     if (!decl)
         return null();
 
     bool matched;
     bool initialDeclaration = true;
     do {
         MOZ_ASSERT_IF(!initialDeclaration && forHeadKind,
                       *forHeadKind == PNK_FORHEAD);
--- a/js/src/frontend/SyntaxParseHandler.h
+++ b/js/src/frontend/SyntaxParseHandler.h
@@ -425,17 +425,17 @@ class SyntaxParseHandler
     template<typename T>
     Node newList(ParseNodeKind kind, const T& begin, JSOp op = JSOP_NOP) = delete;
 
   public:
     Node newList(ParseNodeKind kind, Node kid, JSOp op = JSOP_NOP) {
         return newList(kind, TokenPos(), op);
     }
 
-    Node newDeclarationList(ParseNodeKind kind, const TokenPos& pos, JSOp op = JSOP_NOP) {
+    Node newDeclarationList(ParseNodeKind kind, const TokenPos& pos) {
         if (kind == PNK_VAR)
             return NodeVarDeclaration;
         MOZ_ASSERT(kind == PNK_LET || kind == PNK_CONST);
         return NodeLexicalDeclaration;
     }
 
     bool isDeclarationList(Node node) {
         return node == NodeVarDeclaration || node == NodeLexicalDeclaration;