Bug 1267551 (part 7) - Use MOZ_MUST_USE more in js/src/frontend/. r=jorendorff.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 05 May 2016 15:14:24 +1000
changeset 335744 e457582d0089f8efa6b89f112298373aa50e6e5f
parent 335743 bd6a8e6f170fbd1028f0231f7c651644915159a7
child 335745 a58e71d68e4900e829c7246076e6e5c239fd1d8c
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1267551
milestone49.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 1267551 (part 7) - Use MOZ_MUST_USE more in js/src/frontend/. r=jorendorff. This found two missing checks for PackedScopedCoordinate::setSlot(). Fixing one of them required making ParseContext::updateDecl() fallible. The patch also changes the return type of addToCallSiteObject() to void.
js/src/frontend/BytecodeCompiler.h
js/src/frontend/BytecodeEmitter.cpp
js/src/frontend/BytecodeEmitter.h
js/src/frontend/FoldConstants.h
js/src/frontend/FullParseHandler.h
js/src/frontend/NameFunctions.h
js/src/frontend/ParseMaps.h
js/src/frontend/ParseNode.h
js/src/frontend/Parser.cpp
js/src/frontend/Parser.h
js/src/frontend/SyntaxParseHandler.h
js/src/frontend/TokenStream.h
--- a/js/src/frontend/BytecodeCompiler.h
+++ b/js/src/frontend/BytecodeCompiler.h
@@ -36,37 +36,37 @@ ModuleObject*
 CompileModule(JSContext* cx, const ReadOnlyCompileOptions& options,
               SourceBufferHolder& srcBuf);
 
 ModuleObject*
 CompileModule(ExclusiveContext* cx, const ReadOnlyCompileOptions& options,
               SourceBufferHolder& srcBuf, LifoAlloc* alloc,
               ScriptSourceObject** sourceObjectOut = nullptr);
 
-bool
+MOZ_MUST_USE bool
 CompileLazyFunction(JSContext* cx, Handle<LazyScript*> lazy, const char16_t* chars, size_t length);
 
 /*
  * enclosingStaticScope is a static enclosing scope (e.g. a StaticWithScope).
  * Must be null if the enclosing scope is a global.
  */
-bool
+MOZ_MUST_USE bool
 CompileFunctionBody(JSContext* cx, MutableHandleFunction fun,
                     const ReadOnlyCompileOptions& options,
                     Handle<PropertyNameVector> formals, JS::SourceBufferHolder& srcBuf,
                     Handle<StaticScope*> enclosingStaticScope);
 
 // As above, but defaults to the global lexical scope as the enclosing static
 // scope.
-bool
+MOZ_MUST_USE bool
 CompileFunctionBody(JSContext* cx, MutableHandleFunction fun,
                     const ReadOnlyCompileOptions& options,
                     Handle<PropertyNameVector> formals, JS::SourceBufferHolder& srcBuf);
 
-bool
+MOZ_MUST_USE bool
 CompileStarGeneratorBody(JSContext* cx, MutableHandleFunction fun,
                          const ReadOnlyCompileOptions& options,
                          Handle<PropertyNameVector> formals, JS::SourceBufferHolder& srcBuf);
 
 ScriptSourceObject*
 CreateScriptSourceObject(ExclusiveContext* cx, const ReadOnlyCompileOptions& options);
 
 /*
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -1933,17 +1933,18 @@ BytecodeEmitter::bindNameToSlotHelper(Pa
 
     if (!computeDefinitionIsAliased(bceOfDef, dn, &op))
         return false;
 
     // Re-set the slot on if it is aliased, since the slot would have been
     // translated on dn.
     if (IsAliasedVarOp(op)) {
         MOZ_ASSERT(dn->isKnownAliased());
-        pn->pn_scopecoord.setSlot(parser->tokenStream, dn->pn_scopecoord.slot());
+        if (!pn->pn_scopecoord.setSlot(parser->tokenStream, dn->pn_scopecoord.slot()))
+            return false;
     }
 
     MOZ_ASSERT(!pn->isOp(op));
     pn->setOp(op);
     pn->pn_dflags |= PND_BOUND;
     return true;
 }
 
--- a/js/src/frontend/BytecodeEmitter.h
+++ b/js/src/frontend/BytecodeEmitter.h
@@ -32,17 +32,20 @@ class ParseNode;
 template <typename ParseHandler> class Parser;
 class SharedContext;
 class TokenStream;
 
 class CGConstList {
     Vector<Value> list;
   public:
     explicit CGConstList(ExclusiveContext* cx) : list(cx) {}
-    bool append(Value v) { MOZ_ASSERT_IF(v.isString(), v.toString()->isAtom()); return list.append(v); }
+    MOZ_MUST_USE bool append(Value v) {
+        MOZ_ASSERT_IF(v.isString(), v.toString()->isAtom());
+        return list.append(v);
+    }
     size_t length() const { return list.length(); }
     void finish(ConstArray* array);
 };
 
 struct CGObjectList {
     uint32_t            length;     /* number of emitted so far objects */
     ObjectBox*          lastbox;   /* last emitted object */
 
@@ -53,17 +56,17 @@ struct CGObjectList {
     void finish(ObjectArray* array);
     ObjectBox* find(uint32_t index);
 };
 
 struct CGTryNoteList {
     Vector<JSTryNote> list;
     explicit CGTryNoteList(ExclusiveContext* cx) : list(cx) {}
 
-    bool append(JSTryNoteKind kind, uint32_t stackDepth, size_t start, size_t end);
+    MOZ_MUST_USE bool append(JSTryNoteKind kind, uint32_t stackDepth, size_t start, size_t end);
     size_t length() const { return list.length(); }
     void finish(TryNoteArray* array);
 };
 
 struct CGBlockScopeNote : public BlockScopeNote
 {
     // The end offset. Used to compute the length; may need adjusting first if
     // in the prologue.
@@ -75,28 +78,29 @@ struct CGBlockScopeNote : public BlockSc
     // Is the end offset in the prologue?
     bool endInPrologue;
 };
 
 struct CGBlockScopeList {
     Vector<CGBlockScopeNote> list;
     explicit CGBlockScopeList(ExclusiveContext* cx) : list(cx) {}
 
-    bool append(uint32_t scopeObjectIndex, uint32_t offset, bool inPrologue, uint32_t parent);
+    MOZ_MUST_USE bool append(uint32_t scopeObjectIndex, uint32_t offset, bool inPrologue,
+                             uint32_t parent);
     uint32_t findEnclosingScope(uint32_t index);
     void recordEnd(uint32_t index, uint32_t offset, bool inPrologue);
     size_t length() const { return list.length(); }
     void finish(BlockScopeArray* array, uint32_t prologueLength);
 };
 
 struct CGYieldOffsetList {
     Vector<uint32_t> list;
     explicit CGYieldOffsetList(ExclusiveContext* cx) : list(cx) {}
 
-    bool append(uint32_t offset) { return list.append(offset); }
+    MOZ_MUST_USE bool append(uint32_t offset) { return list.append(offset); }
     size_t length() const { return list.length(); }
     void finish(YieldOffsetArray& array, uint32_t prologueLength);
 };
 
 struct LoopStmtInfo;
 struct StmtInfoBCE;
 
 // Use zero inline elements because these go on the stack and affect how many
@@ -250,56 +254,56 @@ struct BytecodeEmitter
 
     // An alternate constructor that uses a TokenPos for the starting
     // line and that sets functionBodyEndPos as well.
     BytecodeEmitter(BytecodeEmitter* parent, Parser<FullParseHandler>* parser, SharedContext* sc,
                     HandleScript script, Handle<LazyScript*> lazyScript,
                     bool insideEval, HandleScript evalCaller,
                     bool insideNonGlobalEval, TokenPos bodyPosition, EmitterMode emitterMode = Normal);
 
-    bool init();
-    bool updateLocalsToFrameSlots();
+    MOZ_MUST_USE bool init();
+    MOZ_MUST_USE bool updateLocalsToFrameSlots();
 
     StmtInfoBCE* innermostStmt() const { return stmtStack.innermost(); }
     StmtInfoBCE* innermostScopeStmt() const { return stmtStack.innermostScopeStmt(); }
     JSObject* innermostStaticScope() const;
     JSObject* blockScopeOfDef(Definition* dn) const {
         return parser->blockScopes[dn->pn_blockid];
     }
 
     bool atBodyLevel(StmtInfoBCE* stmt) const;
     bool atBodyLevel() const {
         return atBodyLevel(innermostStmt());
     }
     uint32_t computeHops(ParseNode* pn, BytecodeEmitter** bceOfDefOut);
     bool isAliasedName(BytecodeEmitter* bceOfDef, ParseNode* pn);
-    bool computeDefinitionIsAliased(BytecodeEmitter* bceOfDef, Definition* dn, JSOp* op);
+    MOZ_MUST_USE bool computeDefinitionIsAliased(BytecodeEmitter* bceOfDef, Definition* dn, JSOp* op);
 
     MOZ_ALWAYS_INLINE
-    bool makeAtomIndex(JSAtom* atom, jsatomid* indexp) {
+    MOZ_MUST_USE bool makeAtomIndex(JSAtom* atom, jsatomid* indexp) {
         AtomIndexAddPtr p = atomIndices->lookupForAdd(atom);
         if (p) {
             *indexp = p.value();
             return true;
         }
 
         jsatomid index = atomIndices->count();
         if (!atomIndices->add(p, atom, index))
             return false;
 
         *indexp = index;
         return true;
     }
 
     bool isInLoop();
-    bool checkSingletonContext();
+    MOZ_MUST_USE bool checkSingletonContext();
 
     // Check whether our function is in a run-once context (a toplevel
     // run-one script or a run-once lambda).
-    bool checkRunOnceContext();
+    MOZ_MUST_USE bool checkRunOnceContext();
 
     bool needsImplicitThis();
 
     void tellDebuggerAboutCompiledScript(ExclusiveContext* cx);
 
     inline TokenStream* tokenStream();
 
     BytecodeVector& code() const { return current->code; }
@@ -329,356 +333,360 @@ struct BytecodeEmitter
     // false. Return false on error.
     //
     // The caller should initialize *answer to false and invoke this function on
     // an expression statement or similar subtree to decide whether the tree
     // could produce code that has any side effects.  For an expression
     // statement, we define useless code as code with no side effects, because
     // the main effect, the value left on the stack after the code executes,
     // will be discarded by a pop bytecode.
-    bool checkSideEffects(ParseNode* pn, bool* answer);
+    MOZ_MUST_USE bool checkSideEffects(ParseNode* pn, bool* answer);
 
 #ifdef DEBUG
-    bool checkStrictOrSloppy(JSOp op);
+    MOZ_MUST_USE bool checkStrictOrSloppy(JSOp op);
 #endif
 
     // Append a new source note of the given type (and therefore size) to the
     // notes dynamic array, updating noteCount. Return the new note's index
     // within the array pointed at by current->notes as outparam.
-    bool newSrcNote(SrcNoteType type, unsigned* indexp = nullptr);
-    bool newSrcNote2(SrcNoteType type, ptrdiff_t offset, unsigned* indexp = nullptr);
-    bool newSrcNote3(SrcNoteType type, ptrdiff_t offset1, ptrdiff_t offset2,
-                     unsigned* indexp = nullptr);
+    MOZ_MUST_USE bool newSrcNote(SrcNoteType type, unsigned* indexp = nullptr);
+    MOZ_MUST_USE bool newSrcNote2(SrcNoteType type, ptrdiff_t offset, unsigned* indexp = nullptr);
+    MOZ_MUST_USE bool newSrcNote3(SrcNoteType type, ptrdiff_t offset1, ptrdiff_t offset2,
+                                  unsigned* indexp = nullptr);
 
     void copySrcNotes(jssrcnote* destination, uint32_t nsrcnotes);
-    bool setSrcNoteOffset(unsigned index, unsigned which, ptrdiff_t offset);
+    MOZ_MUST_USE bool setSrcNoteOffset(unsigned index, unsigned which, ptrdiff_t offset);
 
     // NB: this function can add at most one extra extended delta note.
-    bool addToSrcNoteDelta(jssrcnote* sn, ptrdiff_t delta);
+    MOZ_MUST_USE bool addToSrcNoteDelta(jssrcnote* sn, ptrdiff_t delta);
 
     // Finish taking source notes in cx's notePool. If successful, the final
     // source note count is stored in the out outparam.
-    bool finishTakingSrcNotes(uint32_t* out);
+    MOZ_MUST_USE bool finishTakingSrcNotes(uint32_t* out);
 
     void setJumpOffsetAt(ptrdiff_t off);
 
     // Control whether emitTree emits a line number note.
     enum EmitLineNumberNote {
         EMIT_LINENOTE,
         SUPPRESS_LINENOTE
     };
 
     // Emit code for the tree rooted at pn.
-    bool emitTree(ParseNode* pn, EmitLineNumberNote emitLineNote = EMIT_LINENOTE);
+    MOZ_MUST_USE bool emitTree(ParseNode* pn, EmitLineNumberNote emitLineNote = EMIT_LINENOTE);
 
     // Emit function code for the tree rooted at body.
-    bool emitFunctionScript(ParseNode* body);
+    MOZ_MUST_USE bool emitFunctionScript(ParseNode* body);
 
     // Emit module code for the tree rooted at body.
-    bool emitModuleScript(ParseNode* body);
+    MOZ_MUST_USE bool emitModuleScript(ParseNode* body);
 
     // If op is JOF_TYPESET (see the type barriers comment in TypeInference.h),
     // reserve a type set to store its result.
     void checkTypeSet(JSOp op);
 
     void updateDepth(ptrdiff_t target);
-    bool updateLineNumberNotes(uint32_t offset);
-    bool updateSourceCoordNotes(uint32_t offset);
+    MOZ_MUST_USE bool updateLineNumberNotes(uint32_t offset);
+    MOZ_MUST_USE bool updateSourceCoordNotes(uint32_t offset);
 
-    bool bindNameToSlot(ParseNode* pn);
-    bool bindNameToSlotHelper(ParseNode* pn);
+    MOZ_MUST_USE bool bindNameToSlot(ParseNode* pn);
+    MOZ_MUST_USE bool bindNameToSlotHelper(ParseNode* pn);
 
     void strictifySetNameNode(ParseNode* pn);
     JSOp strictifySetNameOp(JSOp op);
 
-    bool tryConvertFreeName(ParseNode* pn);
+    MOZ_MUST_USE bool tryConvertFreeName(ParseNode* pn);
 
     void popStatement();
     void pushStatement(StmtInfoBCE* stmt, StmtType type, ptrdiff_t top);
     void pushStatementInner(StmtInfoBCE* stmt, StmtType type, ptrdiff_t top);
     void pushLoopStatement(LoopStmtInfo* stmt, StmtType type, ptrdiff_t top);
 
-    bool enterNestedScope(StmtInfoBCE* stmt, ObjectBox* objbox, StmtType stmtType);
-    bool leaveNestedScope(StmtInfoBCE* stmt);
+    MOZ_MUST_USE bool enterNestedScope(StmtInfoBCE* stmt, ObjectBox* objbox, StmtType stmtType);
+    MOZ_MUST_USE bool leaveNestedScope(StmtInfoBCE* stmt);
 
-    bool enterBlockScope(StmtInfoBCE* stmtInfo, ObjectBox* objbox, JSOp initialValueOp,
-                         unsigned alreadyPushed = 0);
+    MOZ_MUST_USE bool enterBlockScope(StmtInfoBCE* stmtInfo, ObjectBox* objbox, JSOp initialValueOp,
+                                      unsigned alreadyPushed = 0);
 
-    bool computeAliasedSlots(Handle<StaticBlockScope*> blockScope);
+    MOZ_MUST_USE bool computeAliasedSlots(Handle<StaticBlockScope*> blockScope);
 
-    bool lookupAliasedName(HandleScript script, PropertyName* name, uint32_t* pslot,
-                           ParseNode* pn = nullptr);
-    bool lookupAliasedNameSlot(PropertyName* name, ScopeCoordinate* sc);
+    MOZ_MUST_USE bool lookupAliasedName(HandleScript script, PropertyName* name, uint32_t* pslot,
+                                        ParseNode* pn = nullptr);
+    MOZ_MUST_USE bool lookupAliasedNameSlot(PropertyName* name, ScopeCoordinate* sc);
 
     // In a function, block-scoped locals go after the vars, and form part of the
     // fixed part of a stack frame.  Outside a function, there are no fixed vars,
     // but block-scoped locals still form part of the fixed part of a stack frame
     // and are thus addressable via GETLOCAL and friends.
     void computeLocalOffset(Handle<StaticBlockScope*> blockScope);
 
-    bool flushPops(int* npops);
+    MOZ_MUST_USE bool flushPops(int* npops);
 
-    bool emitCheck(ptrdiff_t delta, ptrdiff_t* offset);
+    MOZ_MUST_USE bool emitCheck(ptrdiff_t delta, ptrdiff_t* offset);
 
     // Emit one bytecode.
-    bool emit1(JSOp op);
+    MOZ_MUST_USE bool emit1(JSOp op);
 
     // Emit two bytecodes, an opcode (op) with a byte of immediate operand
     // (op1).
-    bool emit2(JSOp op, uint8_t op1);
+    MOZ_MUST_USE bool emit2(JSOp op, uint8_t op1);
 
     // Emit three bytecodes, an opcode with two bytes of immediate operands.
-    bool emit3(JSOp op, jsbytecode op1, jsbytecode op2);
+    MOZ_MUST_USE bool emit3(JSOp op, jsbytecode op1, jsbytecode op2);
 
     // Helper to emit JSOP_DUPAT. The argument is the value's depth on the
     // JS stack, as measured from the top.
-    bool emitDupAt(unsigned slotFromTop);
+    MOZ_MUST_USE bool emitDupAt(unsigned slotFromTop);
 
     // Emit a bytecode followed by an uint16 immediate operand stored in
     // big-endian order.
-    bool emitUint16Operand(JSOp op, uint32_t operand);
+    MOZ_MUST_USE bool emitUint16Operand(JSOp op, uint32_t operand);
 
     // Emit a bytecode followed by an uint32 immediate operand.
-    bool emitUint32Operand(JSOp op, uint32_t operand);
+    MOZ_MUST_USE bool emitUint32Operand(JSOp op, uint32_t operand);
 
     // Emit (1 + extra) bytecodes, for N bytes of op and its immediate operand.
-    bool emitN(JSOp op, size_t extra, ptrdiff_t* offset = nullptr);
+    MOZ_MUST_USE bool emitN(JSOp op, size_t extra, ptrdiff_t* offset = nullptr);
 
-    bool emitNumberOp(double dval);
+    MOZ_MUST_USE bool emitNumberOp(double dval);
 
-    bool emitThisLiteral(ParseNode* pn);
-    bool emitCreateFunctionThis();
-    bool emitGetFunctionThis(ParseNode* pn);
-    bool emitGetThisForSuperBase(ParseNode* pn);
-    bool emitSetThis(ParseNode* pn);
+    MOZ_MUST_USE bool emitThisLiteral(ParseNode* pn);
+    MOZ_MUST_USE bool emitCreateFunctionThis();
+    MOZ_MUST_USE bool emitGetFunctionThis(ParseNode* pn);
+    MOZ_MUST_USE bool emitGetThisForSuperBase(ParseNode* pn);
+    MOZ_MUST_USE bool emitSetThis(ParseNode* pn);
 
     // These functions are used to emit GETLOCAL/GETALIASEDVAR or
     // SETLOCAL/SETALIASEDVAR for a particular binding on a function's
     // CallObject.
-    bool emitLoadFromEnclosingFunctionScope(BindingIter& bi);
-    bool emitStoreToEnclosingFunctionScope(BindingIter& bi);
+    MOZ_MUST_USE bool emitLoadFromEnclosingFunctionScope(BindingIter& bi);
+    MOZ_MUST_USE bool emitStoreToEnclosingFunctionScope(BindingIter& bi);
 
     uint32_t computeHopsToEnclosingFunction();
 
-    bool emitJump(JSOp op, ptrdiff_t off, ptrdiff_t* jumpOffset = nullptr);
-    bool emitCall(JSOp op, uint16_t argc, ParseNode* pn = nullptr);
+    MOZ_MUST_USE bool emitJump(JSOp op, ptrdiff_t off, ptrdiff_t* jumpOffset = nullptr);
+    MOZ_MUST_USE bool emitCall(JSOp op, uint16_t argc, ParseNode* pn = nullptr);
 
-    bool emitLoopHead(ParseNode* nextpn);
-    bool emitLoopEntry(ParseNode* nextpn);
+    MOZ_MUST_USE bool emitLoopHead(ParseNode* nextpn);
+    MOZ_MUST_USE bool emitLoopEntry(ParseNode* nextpn);
 
     // Emit a backpatch op with offset pointing to the previous jump of this
     // type, so that we can walk back up the chain fixing up the op and jump
     // offset.
-    bool emitBackPatchOp(ptrdiff_t* lastp);
+    MOZ_MUST_USE bool emitBackPatchOp(ptrdiff_t* lastp);
     void backPatch(ptrdiff_t last, jsbytecode* target, jsbytecode op);
 
-    bool emitGoto(StmtInfoBCE* toStmt, ptrdiff_t* lastp, SrcNoteType noteType = SRC_NULL);
+    MOZ_MUST_USE bool emitGoto(StmtInfoBCE* toStmt, ptrdiff_t* lastp,
+                               SrcNoteType noteType = SRC_NULL);
 
-    bool emitIndex32(JSOp op, uint32_t index);
-    bool emitIndexOp(JSOp op, uint32_t index);
+    MOZ_MUST_USE bool emitIndex32(JSOp op, uint32_t index);
+    MOZ_MUST_USE bool emitIndexOp(JSOp op, uint32_t index);
 
-    bool emitAtomOp(JSAtom* atom, JSOp op);
-    bool emitAtomOp(ParseNode* pn, JSOp op);
+    MOZ_MUST_USE bool emitAtomOp(JSAtom* atom, JSOp op);
+    MOZ_MUST_USE bool emitAtomOp(ParseNode* pn, JSOp op);
 
-    bool emitArrayLiteral(ParseNode* pn);
-    bool emitArray(ParseNode* pn, uint32_t count, JSOp op);
-    bool emitArrayComp(ParseNode* pn);
+    MOZ_MUST_USE bool emitArrayLiteral(ParseNode* pn);
+    MOZ_MUST_USE bool emitArray(ParseNode* pn, uint32_t count, JSOp op);
+    MOZ_MUST_USE bool emitArrayComp(ParseNode* pn);
 
-    bool emitInternedObjectOp(uint32_t index, JSOp op);
-    bool emitObjectOp(ObjectBox* objbox, JSOp op);
-    bool emitObjectPairOp(ObjectBox* objbox1, ObjectBox* objbox2, JSOp op);
-    bool emitRegExp(uint32_t index);
+    MOZ_MUST_USE bool emitInternedObjectOp(uint32_t index, JSOp op);
+    MOZ_MUST_USE bool emitObjectOp(ObjectBox* objbox, JSOp op);
+    MOZ_MUST_USE bool emitObjectPairOp(ObjectBox* objbox1, ObjectBox* objbox2, JSOp op);
+    MOZ_MUST_USE bool emitRegExp(uint32_t index);
 
-    MOZ_NEVER_INLINE bool emitFunction(ParseNode* pn, bool needsProto = false);
-    MOZ_NEVER_INLINE bool emitObject(ParseNode* pn);
+    MOZ_NEVER_INLINE MOZ_MUST_USE bool emitFunction(ParseNode* pn, bool needsProto = false);
+    MOZ_NEVER_INLINE MOZ_MUST_USE bool emitObject(ParseNode* pn);
 
-    bool emitHoistedFunctionsInList(ParseNode* pn);
+    MOZ_MUST_USE bool emitHoistedFunctionsInList(ParseNode* pn);
 
-    bool emitPropertyList(ParseNode* pn, MutableHandlePlainObject objp, PropListType type);
+    MOZ_MUST_USE bool emitPropertyList(ParseNode* pn, MutableHandlePlainObject objp,
+                                       PropListType type);
 
     // To catch accidental misuse, emitUint16Operand/emit3 assert that they are
     // not used to unconditionally emit JSOP_GETLOCAL. Variable access should
     // instead be emitted using EmitVarOp. In special cases, when the caller
     // definitely knows that a given local slot is unaliased, this function may be
     // used as a non-asserting version of emitUint16Operand.
-    bool emitLocalOp(JSOp op, uint32_t slot);
+    MOZ_MUST_USE bool emitLocalOp(JSOp op, uint32_t slot);
 
-    bool emitScopeCoordOp(JSOp op, ScopeCoordinate sc);
-    bool emitAliasedVarOp(JSOp op, ParseNode* pn);
-    bool emitAliasedVarOp(JSOp op, ScopeCoordinate sc, MaybeCheckLexical checkLexical);
-    bool emitUnaliasedVarOp(JSOp op, uint32_t slot, MaybeCheckLexical checkLexical);
+    MOZ_MUST_USE bool emitScopeCoordOp(JSOp op, ScopeCoordinate sc);
+    MOZ_MUST_USE bool emitAliasedVarOp(JSOp op, ParseNode* pn);
+    MOZ_MUST_USE bool emitAliasedVarOp(JSOp op, ScopeCoordinate sc, MaybeCheckLexical checkLexical);
+    MOZ_MUST_USE bool emitUnaliasedVarOp(JSOp op, uint32_t slot, MaybeCheckLexical checkLexical);
 
-    bool emitVarOp(ParseNode* pn, JSOp op);
-    bool emitVarIncDec(ParseNode* pn);
+    MOZ_MUST_USE bool emitVarOp(ParseNode* pn, JSOp op);
+    MOZ_MUST_USE bool emitVarIncDec(ParseNode* pn);
 
-    bool emitNameOp(ParseNode* pn, bool callContext);
-    bool emitNameIncDec(ParseNode* pn);
+    MOZ_MUST_USE bool emitNameOp(ParseNode* pn, bool callContext);
+    MOZ_MUST_USE bool emitNameIncDec(ParseNode* pn);
 
-    bool maybeEmitVarDecl(JSOp prologueOp, ParseNode* pn, jsatomid* result);
-    bool emitVariables(ParseNode* pn, VarEmitOption emitOption);
-    bool emitSingleVariable(ParseNode* pn, ParseNode* binding, ParseNode* initializer,
-                            VarEmitOption emitOption);
+    MOZ_MUST_USE bool maybeEmitVarDecl(JSOp prologueOp, ParseNode* pn, jsatomid* result);
+    MOZ_MUST_USE bool emitVariables(ParseNode* pn, VarEmitOption emitOption);
+    MOZ_MUST_USE bool emitSingleVariable(ParseNode* pn, ParseNode* binding, ParseNode* initializer,
+                                         VarEmitOption emitOption);
 
-    bool emitNewInit(JSProtoKey key);
-    bool emitSingletonInitialiser(ParseNode* pn);
+    MOZ_MUST_USE bool emitNewInit(JSProtoKey key);
+    MOZ_MUST_USE bool emitSingletonInitialiser(ParseNode* pn);
 
-    bool emitPrepareIteratorResult();
-    bool emitFinishIteratorResult(bool done);
-    bool iteratorResultShape(unsigned* shape);
+    MOZ_MUST_USE bool emitPrepareIteratorResult();
+    MOZ_MUST_USE bool emitFinishIteratorResult(bool done);
+    MOZ_MUST_USE bool iteratorResultShape(unsigned* shape);
 
-    bool emitYield(ParseNode* pn);
-    bool emitYieldOp(JSOp op);
-    bool emitYieldStar(ParseNode* iter, ParseNode* gen);
+    MOZ_MUST_USE bool emitYield(ParseNode* pn);
+    MOZ_MUST_USE bool emitYieldOp(JSOp op);
+    MOZ_MUST_USE bool emitYieldStar(ParseNode* iter, ParseNode* gen);
 
-    bool emitPropLHS(ParseNode* pn);
-    bool emitPropOp(ParseNode* pn, JSOp op);
-    bool emitPropIncDec(ParseNode* pn);
+    MOZ_MUST_USE bool emitPropLHS(ParseNode* pn);
+    MOZ_MUST_USE bool emitPropOp(ParseNode* pn, JSOp op);
+    MOZ_MUST_USE bool emitPropIncDec(ParseNode* pn);
 
-    bool emitComputedPropertyName(ParseNode* computedPropName);
+    MOZ_MUST_USE bool emitComputedPropertyName(ParseNode* computedPropName);
 
     // Emit bytecode to put operands for a JSOP_GETELEM/CALLELEM/SETELEM/DELELEM
     // opcode onto the stack in the right order. In the case of SETELEM, the
     // value to be assigned must already be pushed.
     enum class EmitElemOption { Get, Set, Call, IncDec, CompoundAssign };
-    bool emitElemOperands(ParseNode* pn, EmitElemOption opts);
+    MOZ_MUST_USE bool emitElemOperands(ParseNode* pn, EmitElemOption opts);
 
-    bool emitElemOpBase(JSOp op);
-    bool emitElemOp(ParseNode* pn, JSOp op);
-    bool emitElemIncDec(ParseNode* pn);
+    MOZ_MUST_USE bool emitElemOpBase(JSOp op);
+    MOZ_MUST_USE bool emitElemOp(ParseNode* pn, JSOp op);
+    MOZ_MUST_USE bool emitElemIncDec(ParseNode* pn);
 
-    bool emitCatch(ParseNode* pn);
-    bool emitIf(ParseNode* pn);
-    bool emitWith(ParseNode* pn);
+    MOZ_MUST_USE bool emitCatch(ParseNode* pn);
+    MOZ_MUST_USE bool emitIf(ParseNode* pn);
+    MOZ_MUST_USE bool emitWith(ParseNode* pn);
 
-    MOZ_NEVER_INLINE bool emitLabeledStatement(const LabeledStatement* pn);
-    MOZ_NEVER_INLINE bool emitLetBlock(ParseNode* pnLet);
-    MOZ_NEVER_INLINE bool emitLexicalScope(ParseNode* pn);
-    MOZ_NEVER_INLINE bool emitSwitch(ParseNode* pn);
-    MOZ_NEVER_INLINE bool emitTry(ParseNode* pn);
+    MOZ_NEVER_INLINE MOZ_MUST_USE bool emitLabeledStatement(const LabeledStatement* pn);
+    MOZ_NEVER_INLINE MOZ_MUST_USE bool emitLetBlock(ParseNode* pnLet);
+    MOZ_NEVER_INLINE MOZ_MUST_USE bool emitLexicalScope(ParseNode* pn);
+    MOZ_NEVER_INLINE MOZ_MUST_USE bool emitSwitch(ParseNode* pn);
+    MOZ_NEVER_INLINE MOZ_MUST_USE bool emitTry(ParseNode* pn);
 
     // EmitDestructuringLHS assumes the to-be-destructured value has been pushed on
     // the stack and emits code to destructure a single lhs expression (either a
     // name or a compound []/{} expression).
     //
     // If emitOption is InitializeVars, the to-be-destructured value is assigned to
     // locals and ultimately the initial slot is popped (-1 total depth change).
     //
     // If emitOption is PushInitialValues, the to-be-destructured value is replaced
     // with the initial values of the N (where 0 <= N) variables assigned in the
     // lhs expression. (Same post-condition as EmitDestructuringOpsHelper)
-    bool emitDestructuringLHS(ParseNode* target, VarEmitOption emitOption);
+    MOZ_MUST_USE bool emitDestructuringLHS(ParseNode* target, VarEmitOption emitOption);
 
-    bool emitDestructuringOps(ParseNode* pattern, bool isLet = false);
-    bool emitDestructuringOpsHelper(ParseNode* pattern, VarEmitOption emitOption);
-    bool emitDestructuringOpsArrayHelper(ParseNode* pattern, VarEmitOption emitOption);
-    bool emitDestructuringOpsObjectHelper(ParseNode* pattern, VarEmitOption emitOption);
+    MOZ_MUST_USE bool emitDestructuringOps(ParseNode* pattern, bool isLet = false);
+    MOZ_MUST_USE bool emitDestructuringOpsHelper(ParseNode* pattern, VarEmitOption emitOption);
+    MOZ_MUST_USE bool emitDestructuringOpsArrayHelper(ParseNode* pattern, VarEmitOption emitOption);
+    MOZ_MUST_USE bool emitDestructuringOpsObjectHelper(ParseNode* pattern,
+                                                       VarEmitOption emitOption);
 
     typedef bool
     (*DestructuringDeclEmitter)(BytecodeEmitter* bce, JSOp prologueOp, ParseNode* pn);
 
     template <DestructuringDeclEmitter EmitName>
-    bool emitDestructuringDeclsWithEmitter(JSOp prologueOp, ParseNode* pattern);
+    MOZ_MUST_USE bool emitDestructuringDeclsWithEmitter(JSOp prologueOp, ParseNode* pattern);
 
-    bool emitDestructuringDecls(JSOp prologueOp, ParseNode* pattern);
+    MOZ_MUST_USE bool emitDestructuringDecls(JSOp prologueOp, ParseNode* pattern);
 
     // Emit code to initialize all destructured names to the value on the top of
     // the stack.
-    bool emitInitializeDestructuringDecls(JSOp prologueOp, ParseNode* pattern);
+    MOZ_MUST_USE bool emitInitializeDestructuringDecls(JSOp prologueOp, ParseNode* pattern);
 
     // Throw a TypeError if the value atop the stack isn't convertible to an
     // object, with no overall effect on the stack.
-    bool emitRequireObjectCoercible();
+    MOZ_MUST_USE bool emitRequireObjectCoercible();
 
     // emitIterator expects the iterable to already be on the stack.
     // It will replace that stack value with the corresponding iterator
-    bool emitIterator();
+    MOZ_MUST_USE bool emitIterator();
 
     // Pops iterator from the top of the stack. Pushes the result of |.next()|
     // onto the stack.
-    bool emitIteratorNext(ParseNode* pn, bool allowSelfHosted = false);
+    MOZ_MUST_USE bool emitIteratorNext(ParseNode* pn, bool allowSelfHosted = false);
 
     // Check if the value on top of the stack is "undefined". If so, replace
     // that value on the stack with the value defined by |defaultExpr|.
-    bool emitDefault(ParseNode* defaultExpr);
+    MOZ_MUST_USE bool emitDefault(ParseNode* defaultExpr);
 
-    bool emitCallSiteObject(ParseNode* pn);
-    bool emitTemplateString(ParseNode* pn);
-    bool emitAssignment(ParseNode* lhs, JSOp op, ParseNode* rhs);
+    MOZ_MUST_USE bool emitCallSiteObject(ParseNode* pn);
+    MOZ_MUST_USE bool emitTemplateString(ParseNode* pn);
+    MOZ_MUST_USE bool emitAssignment(ParseNode* lhs, JSOp op, ParseNode* rhs);
 
-    bool emitReturn(ParseNode* pn);
-    bool emitStatement(ParseNode* pn);
-    bool emitStatementList(ParseNode* pn);
+    MOZ_MUST_USE bool emitReturn(ParseNode* pn);
+    MOZ_MUST_USE bool emitStatement(ParseNode* pn);
+    MOZ_MUST_USE bool emitStatementList(ParseNode* pn);
 
-    bool emitDeleteName(ParseNode* pn);
-    bool emitDeleteProperty(ParseNode* pn);
-    bool emitDeleteElement(ParseNode* pn);
-    bool emitDeleteExpression(ParseNode* pn);
+    MOZ_MUST_USE bool emitDeleteName(ParseNode* pn);
+    MOZ_MUST_USE bool emitDeleteProperty(ParseNode* pn);
+    MOZ_MUST_USE bool emitDeleteElement(ParseNode* pn);
+    MOZ_MUST_USE bool emitDeleteExpression(ParseNode* pn);
 
     // |op| must be JSOP_TYPEOF or JSOP_TYPEOFEXPR.
-    bool emitTypeof(ParseNode* node, JSOp op);
+    MOZ_MUST_USE bool emitTypeof(ParseNode* node, JSOp op);
 
-    bool emitUnary(ParseNode* pn);
-    bool emitRightAssociative(ParseNode* pn);
-    bool emitLeftAssociative(ParseNode* pn);
-    bool emitLogical(ParseNode* pn);
-    bool emitSequenceExpr(ParseNode* pn);
+    MOZ_MUST_USE bool emitUnary(ParseNode* pn);
+    MOZ_MUST_USE bool emitRightAssociative(ParseNode* pn);
+    MOZ_MUST_USE bool emitLeftAssociative(ParseNode* pn);
+    MOZ_MUST_USE bool emitLogical(ParseNode* pn);
+    MOZ_MUST_USE bool emitSequenceExpr(ParseNode* pn);
 
-    MOZ_NEVER_INLINE bool emitIncOrDec(ParseNode* pn);
+    MOZ_NEVER_INLINE MOZ_MUST_USE bool emitIncOrDec(ParseNode* pn);
 
-    bool emitConditionalExpression(ConditionalExpression& conditional);
+    MOZ_MUST_USE bool emitConditionalExpression(ConditionalExpression& conditional);
 
-    bool isRestParameter(ParseNode* pn, bool* result);
-    bool emitOptimizeSpread(ParseNode* arg0, ptrdiff_t* jmp, bool* emitted);
+    MOZ_MUST_USE bool isRestParameter(ParseNode* pn, bool* result);
+    MOZ_MUST_USE bool emitOptimizeSpread(ParseNode* arg0, ptrdiff_t* jmp, bool* emitted);
 
-    bool emitCallOrNew(ParseNode* pn);
-    bool emitDebugOnlyCheckSelfHosted();
-    bool emitSelfHostedCallFunction(ParseNode* pn);
-    bool emitSelfHostedResumeGenerator(ParseNode* pn);
-    bool emitSelfHostedForceInterpreter(ParseNode* pn);
-    bool emitSelfHostedAllowContentSpread(ParseNode* pn);
+    MOZ_MUST_USE bool emitCallOrNew(ParseNode* pn);
+    MOZ_MUST_USE bool emitDebugOnlyCheckSelfHosted();
+    MOZ_MUST_USE bool emitSelfHostedCallFunction(ParseNode* pn);
+    MOZ_MUST_USE bool emitSelfHostedResumeGenerator(ParseNode* pn);
+    MOZ_MUST_USE bool emitSelfHostedForceInterpreter(ParseNode* pn);
+    MOZ_MUST_USE bool emitSelfHostedAllowContentSpread(ParseNode* pn);
 
-    bool emitComprehensionFor(ParseNode* compFor);
-    bool emitComprehensionForIn(ParseNode* pn);
-    bool emitComprehensionForInOrOfVariables(ParseNode* pn, bool* letBlockScope);
-    bool emitComprehensionForOf(ParseNode* pn);
+    MOZ_MUST_USE bool emitComprehensionFor(ParseNode* compFor);
+    MOZ_MUST_USE bool emitComprehensionForIn(ParseNode* pn);
+    MOZ_MUST_USE bool emitComprehensionForInOrOfVariables(ParseNode* pn, bool* letBlockScope);
+    MOZ_MUST_USE bool emitComprehensionForOf(ParseNode* pn);
 
-    bool emitDo(ParseNode* pn);
-    bool emitFor(ParseNode* pn);
-    bool emitForIn(ParseNode* pn);
-    bool emitForInOrOfVariables(ParseNode* pn);
-    bool emitCStyleFor(ParseNode* pn);
-    bool emitWhile(ParseNode* pn);
+    MOZ_MUST_USE bool emitDo(ParseNode* pn);
+    MOZ_MUST_USE bool emitFor(ParseNode* pn);
+    MOZ_MUST_USE bool emitForIn(ParseNode* pn);
+    MOZ_MUST_USE bool emitForInOrOfVariables(ParseNode* pn);
+    MOZ_MUST_USE bool emitCStyleFor(ParseNode* pn);
+    MOZ_MUST_USE bool emitWhile(ParseNode* pn);
 
-    bool emitBreak(PropertyName* label);
-    bool emitContinue(PropertyName* label);
+    MOZ_MUST_USE bool emitBreak(PropertyName* label);
+    MOZ_MUST_USE bool emitContinue(PropertyName* label);
 
-    bool emitArgsBody(ParseNode* pn);
-    bool emitDefaultsAndDestructuring(ParseNode* pn);
-    bool emitLexicalInitialization(ParseNode* pn, JSOp globalDefOp);
+    MOZ_MUST_USE bool emitArgsBody(ParseNode* pn);
+    MOZ_MUST_USE bool emitDefaultsAndDestructuring(ParseNode* pn);
+    MOZ_MUST_USE bool emitLexicalInitialization(ParseNode* pn, JSOp globalDefOp);
 
-    bool pushInitialConstants(JSOp op, unsigned n);
-    bool initializeBlockScopedLocalsFromStack(Handle<StaticBlockScope*> blockScope);
+    MOZ_MUST_USE bool pushInitialConstants(JSOp op, unsigned n);
+    MOZ_MUST_USE bool initializeBlockScopedLocalsFromStack(Handle<StaticBlockScope*> blockScope);
 
     // Emit bytecode for the spread operator.
     //
     // emitSpread expects the current index (I) of the array, the array itself
     // and the iterator to be on the stack in that order (iterator on the bottom).
     // It will pop the iterator and I, then iterate over the iterator by calling
     // |.next()| and put the results into the I-th element of array with
     // incrementing I, then push the result I (it will be original I +
     // iteration count). The stack after iteration will look like |ARRAY INDEX|.
-    bool emitSpread(bool allowSelfHosted = false);
+    MOZ_MUST_USE bool emitSpread(bool allowSelfHosted = false);
 
     // Emit bytecode for a for-of loop.  pn should be PNK_FOR, and pn->pn_left
     // should be PNK_FOROF.
-    bool emitForOf(ParseNode* pn);
+    MOZ_MUST_USE bool emitForOf(ParseNode* pn);
 
-    bool emitClass(ParseNode* pn);
-    bool emitSuperPropLHS(ParseNode* superBase, bool isCall = false);
-    bool emitSuperPropOp(ParseNode* pn, JSOp op, bool isCall = false);
-    bool emitSuperElemOperands(ParseNode* pn, EmitElemOption opts = EmitElemOption::Get);
-    bool emitSuperElemOp(ParseNode* pn, JSOp op, bool isCall = false);
+    MOZ_MUST_USE bool emitClass(ParseNode* pn);
+    MOZ_MUST_USE bool emitSuperPropLHS(ParseNode* superBase, bool isCall = false);
+    MOZ_MUST_USE bool emitSuperPropOp(ParseNode* pn, JSOp op, bool isCall = false);
+    MOZ_MUST_USE bool emitSuperElemOperands(ParseNode* pn,
+                                            EmitElemOption opts = EmitElemOption::Get);
+    MOZ_MUST_USE bool emitSuperElemOp(ParseNode* pn, JSOp op, bool isCall = false);
 };
 
 } /* namespace frontend */
 } /* namespace js */
 
 #endif /* frontend_BytecodeEmitter_h */
--- a/js/src/frontend/FoldConstants.h
+++ b/js/src/frontend/FoldConstants.h
@@ -20,20 +20,20 @@ namespace frontend {
 // the same node (unchanged or modified in place) or a new node.
 //
 // Usage:
 //    pn = parser->statement();
 //    if (!pn)
 //        return false;
 //    if (!FoldConstants(cx, &pn, parser))
 //        return false;
-bool
+MOZ_MUST_USE bool
 FoldConstants(ExclusiveContext* cx, ParseNode** pnp, Parser<FullParseHandler>* parser);
 
-inline bool
+inline MOZ_MUST_USE bool
 FoldConstants(ExclusiveContext* cx, SyntaxParseHandler::Node* pnp,
               Parser<SyntaxParseHandler>* parser)
 {
     return true;
 }
 
 } /* namespace frontend */
 } /* namespace js */
--- a/js/src/frontend/FullParseHandler.h
+++ b/js/src/frontend/FullParseHandler.h
@@ -168,28 +168,27 @@ class FullParseHandler
         if (!propExpr)
             return null();
 
         addArrayElement(callSite, propExpr);
 
         return callSite;
     }
 
-    bool addToCallSiteObject(ParseNode* callSiteObj, ParseNode* rawNode, ParseNode* cookedNode) {
+    void addToCallSiteObject(ParseNode* callSiteObj, ParseNode* rawNode, ParseNode* cookedNode) {
         MOZ_ASSERT(callSiteObj->isKind(PNK_CALLSITEOBJ));
 
         addArrayElement(callSiteObj, cookedNode);
         addArrayElement(callSiteObj->pn_head, rawNode);
 
         /*
          * We don't know when the last noSubstTemplate will come in, and we
          * don't want to deal with this outside this method
          */
         setEndPosition(callSiteObj, callSiteObj->pn_head);
-        return true;
     }
 
     ParseNode* newThisLiteral(const TokenPos& pos, ParseNode* thisName) {
         return new_<ThisLiteral>(pos, thisName);
     }
 
     ParseNode* newNullLiteral(const TokenPos& pos) {
         return new_<NullLiteral>(pos);
@@ -285,26 +284,26 @@ class FullParseHandler
     ParseNode* newArrayLiteral(uint32_t begin) {
         ParseNode* literal = new_<ListNode>(PNK_ARRAY, TokenPos(begin, begin + 1));
         // Later in this stack: remove dependency on this opcode.
         if (literal)
             literal->setOp(JSOP_NEWINIT);
         return literal;
     }
 
-    bool addElision(ParseNode* literal, const TokenPos& pos) {
+    MOZ_MUST_USE bool addElision(ParseNode* literal, const TokenPos& pos) {
         ParseNode* elision = new_<NullaryNode>(PNK_ELISION, pos);
         if (!elision)
             return false;
         literal->append(elision);
         literal->pn_xflags |= PNX_ARRAYHOLESPREAD | PNX_NONCONST;
         return true;
     }
 
-    bool addSpreadElement(ParseNode* literal, uint32_t begin, ParseNode* inner) {
+    MOZ_MUST_USE bool addSpreadElement(ParseNode* literal, uint32_t begin, ParseNode* inner) {
         TokenPos pos(begin, inner->pn_pos.end);
         ParseNode* spread = new_<UnaryNode>(PNK_SPREAD, JSOP_NOP, pos, inner);
         if (!spread)
             return null();
         literal->append(spread);
         literal->pn_xflags |= PNX_ARRAYHOLESPREAD | PNX_NONCONST;
         return true;
     }
@@ -345,76 +344,77 @@ class FullParseHandler
     }
     ParseNode* newPosHolder(const TokenPos& pos) {
         return new_<NullaryNode>(PNK_POSHOLDER, pos);
     }
     ParseNode* newSuperBase(ParseNode* thisName, const TokenPos& pos) {
         return new_<UnaryNode>(PNK_SUPERBASE, JSOP_NOP, pos, thisName);
     }
 
-    bool addPrototypeMutation(ParseNode* literal, uint32_t begin, ParseNode* expr) {
+    MOZ_MUST_USE bool addPrototypeMutation(ParseNode* literal, uint32_t begin, ParseNode* expr) {
         // Object literals with mutated [[Prototype]] are non-constant so that
         // singleton objects will have Object.prototype as their [[Prototype]].
         setListFlag(literal, PNX_NONCONST);
 
         ParseNode* mutation = newUnary(PNK_MUTATEPROTO, JSOP_NOP, begin, expr);
         if (!mutation)
             return false;
         literal->append(mutation);
         return true;
     }
 
-    bool addPropertyDefinition(ParseNode* literal, ParseNode* key, ParseNode* val) {
+    MOZ_MUST_USE bool addPropertyDefinition(ParseNode* literal, ParseNode* key, ParseNode* val) {
         MOZ_ASSERT(literal->isKind(PNK_OBJECT));
         MOZ_ASSERT(literal->isArity(PN_LIST));
         MOZ_ASSERT(key->isKind(PNK_NUMBER) ||
                    key->isKind(PNK_OBJECT_PROPERTY_NAME) ||
                    key->isKind(PNK_STRING) ||
                    key->isKind(PNK_COMPUTED_NAME));
 
         ParseNode* propdef = newBinary(PNK_COLON, key, val, JSOP_INITPROP);
         if (!propdef)
             return false;
         literal->append(propdef);
         return true;
     }
 
-    bool addShorthand(ParseNode* literal, ParseNode* name, ParseNode* expr) {
+    MOZ_MUST_USE bool addShorthand(ParseNode* literal, ParseNode* name, ParseNode* expr) {
         MOZ_ASSERT(literal->isKind(PNK_OBJECT));
         MOZ_ASSERT(literal->isArity(PN_LIST));
         MOZ_ASSERT(name->isKind(PNK_OBJECT_PROPERTY_NAME));
         MOZ_ASSERT(expr->isKind(PNK_NAME));
         MOZ_ASSERT(name->pn_atom == expr->pn_atom);
 
         setListFlag(literal, PNX_NONCONST);
         ParseNode* propdef = newBinary(PNK_SHORTHAND, name, expr, JSOP_INITPROP);
         if (!propdef)
             return false;
         literal->append(propdef);
         return true;
     }
 
-    bool addObjectMethodDefinition(ParseNode* literal, ParseNode* key, ParseNode* fn, JSOp op)
+    MOZ_MUST_USE bool addObjectMethodDefinition(ParseNode* literal, ParseNode* key, ParseNode* fn,
+                                                JSOp op)
     {
         MOZ_ASSERT(literal->isArity(PN_LIST));
         MOZ_ASSERT(key->isKind(PNK_NUMBER) ||
                    key->isKind(PNK_OBJECT_PROPERTY_NAME) ||
                    key->isKind(PNK_STRING) ||
                    key->isKind(PNK_COMPUTED_NAME));
         literal->pn_xflags |= PNX_NONCONST;
 
         ParseNode* propdef = newBinary(PNK_COLON, key, fn, op);
         if (!propdef)
             return false;
         literal->append(propdef);
         return true;
     }
 
-    bool addClassMethodDefinition(ParseNode* methodList, ParseNode* key, ParseNode* fn, JSOp op,
-                                  bool isStatic)
+    MOZ_MUST_USE bool addClassMethodDefinition(ParseNode* methodList, ParseNode* key, ParseNode* fn,
+                                               JSOp op, bool isStatic)
     {
         MOZ_ASSERT(methodList->isKind(PNK_CLASSMETHODLIST));
         MOZ_ASSERT(key->isKind(PNK_NUMBER) ||
                    key->isKind(PNK_OBJECT_PROPERTY_NAME) ||
                    key->isKind(PNK_STRING) ||
                    key->isKind(PNK_COMPUTED_NAME));
 
         ParseNode* classMethod = new_<ClassMethod>(key, fn, op, isStatic);
@@ -440,17 +440,17 @@ class FullParseHandler
     ParseNode* newStatementList(unsigned blockid, const TokenPos& pos) {
         ParseNode* pn = new_<ListNode>(PNK_STATEMENTLIST, pos);
         if (pn)
             pn->pn_blockid = blockid;
         return pn;
     }
 
     template <typename PC>
-    bool isFunctionStmt(ParseNode* stmt, PC* pc) {
+    MOZ_MUST_USE bool isFunctionStmt(ParseNode* stmt, PC* pc) {
         if (!pc->sc->strict()) {
             while (stmt->isKind(PNK_LABEL))
                 stmt = stmt->as<LabeledStatement>().statement();
         }
 
         return stmt->isKind(PNK_FUNCTION) || stmt->isKind(PNK_ANNEXB_FUNCTION);
     }
 
@@ -475,17 +475,17 @@ class FullParseHandler
         MOZ_ASSERT(casepn->pn_right->isKind(PNK_STATEMENTLIST));
 
         list->append(casepn);
 
         if (casepn->pn_right->pn_xflags & PNX_FUNCDEFS)
             list->pn_xflags |= PNX_FUNCDEFS;
     }
 
-    bool prependInitialYield(ParseNode* stmtList, ParseNode* genName) {
+    MOZ_MUST_USE bool prependInitialYield(ParseNode* stmtList, ParseNode* genName) {
         MOZ_ASSERT(stmtList->isKind(PNK_STATEMENTLIST));
 
         TokenPos yieldPos(stmtList->pn_pos.begin, stmtList->pn_pos.begin + 1);
         ParseNode* makeGen = new_<NullaryNode>(PNK_GENERATOR, yieldPos);
         if (!makeGen)
             return false;
 
         MOZ_ASSERT(genName->getOp() == JSOP_GETNAME);
@@ -664,20 +664,21 @@ class FullParseHandler
     ParseNode* newPropertyAccess(ParseNode* pn, PropertyName* name, uint32_t end) {
         return new_<PropertyAccess>(pn, name, pn->pn_pos.begin, end);
     }
 
     ParseNode* newPropertyByValue(ParseNode* lhs, ParseNode* index, uint32_t end) {
         return new_<PropertyByValue>(lhs, index, lhs->pn_pos.begin, end);
     }
 
-    inline bool addCatchBlock(ParseNode* catchList, ParseNode* letBlock,
-                              ParseNode* catchName, ParseNode* catchGuard, ParseNode* catchBody);
+    inline MOZ_MUST_USE bool addCatchBlock(ParseNode* catchList, ParseNode* letBlock,
+                                           ParseNode* catchName, ParseNode* catchGuard,
+                                           ParseNode* catchBody);
 
-    inline bool setLastFunctionArgumentDefault(ParseNode* funcpn, ParseNode* pn);
+    inline MOZ_MUST_USE bool setLastFunctionArgumentDefault(ParseNode* funcpn, ParseNode* pn);
     inline void setLastFunctionArgumentDestructuring(ParseNode* funcpn, ParseNode* pn);
 
     ParseNode* newFunctionDefinition() {
         return new_<CodeNode>(PNK_FUNCTION, pos());
     }
     void setFunctionBody(ParseNode* pn, ParseNode* kid) {
         pn->pn_body = kid;
     }
@@ -756,17 +757,17 @@ class FullParseHandler
         return kind == PNK_FUNCTION || kind == PNK_VAR || kind == PNK_BREAK || kind == PNK_THROW ||
                (kind == PNK_SEMI && !node->pn_kid);
     }
 
     bool isSuperBase(ParseNode* node) {
         return node->isKind(PNK_SUPERBASE);
     }
 
-    inline bool finishInitializerAssignment(ParseNode* pn, ParseNode* init);
+    inline MOZ_MUST_USE bool finishInitializerAssignment(ParseNode* pn, ParseNode* init);
     inline void setLexicalDeclarationOp(ParseNode* pn, JSOp op);
 
     void setBeginPosition(ParseNode* pn, ParseNode* oth) {
         setBeginPosition(pn, oth->pn_pos.begin);
     }
     void setBeginPosition(ParseNode* pn, uint32_t begin) {
         pn->pn_pos.begin = begin;
         MOZ_ASSERT(pn->pn_pos.begin <= pn->pn_pos.end);
--- a/js/src/frontend/NameFunctions.h
+++ b/js/src/frontend/NameFunctions.h
@@ -12,15 +12,15 @@
 namespace js {
 
 class ExclusiveContext;
 
 namespace frontend {
 
 class ParseNode;
 
-bool
+MOZ_MUST_USE bool
 NameFunctions(ExclusiveContext* cx, ParseNode* pn);
 
 } /* namespace frontend */
 } /* namespace js */
 
 #endif /* frontend_NameFunctions_h */
--- a/js/src/frontend/ParseMaps.h
+++ b/js/src/frontend/ParseMaps.h
@@ -129,17 +129,17 @@ class ParseMapPool
  */
 template <class Map>
 struct AtomThingMapPtr
 {
     Map* map_;
 
     void init() { clearMap(); }
 
-    bool ensureMap(ExclusiveContext* cx);
+    MOZ_MUST_USE bool ensureMap(ExclusiveContext* cx);
     void releaseMap(ExclusiveContext* cx);
 
     bool hasMap() const { return map_; }
     Map* getMap() { return map_; }
     void setMap(Map* newMap) { MOZ_ASSERT(!map_); map_ = newMap; }
     void clearMap() { map_ = nullptr; }
 
     Map* operator->() { return map_; }
@@ -327,17 +327,17 @@ class DefinitionList
         return ParseHandler::definitionFromBits(isMultiple() ? firstNode()->bits : u.bits);
     }
 
     /*
      * If there are multiple Definitions in this list, remove the first and
      * return true. Otherwise there is exactly one Definition in the list; do
      * nothing and return false.
      */
-    bool popFront() {
+    MOZ_MUST_USE bool popFront() {
         if (!isMultiple())
             return false;
 
         Node* node = firstNode();
         Node* next = node->next;
         if (next->next)
             *this = DefinitionList(next);
         else
@@ -346,18 +346,18 @@ class DefinitionList
     }
 
     /*
      * Add a definition to the front of this list.
      *
      * Return true on success. On OOM, report on cx and return false.
      */
     template <typename ParseHandler>
-    bool pushFront(ExclusiveContext* cx, LifoAlloc& alloc,
-                   typename ParseHandler::DefinitionNode defn) {
+    MOZ_MUST_USE bool pushFront(ExclusiveContext* cx, LifoAlloc& alloc,
+                                typename ParseHandler::DefinitionNode defn) {
         Node* tail;
         if (isMultiple()) {
             tail = firstNode();
         } else {
             tail = allocNode(cx, alloc, u.bits, nullptr);
             if (!tail)
                 return false;
         }
@@ -365,18 +365,18 @@ class DefinitionList
         Node* node = allocNode(cx, alloc, ParseHandler::definitionToBits(defn), tail);
         if (!node)
             return false;
         *this = DefinitionList(node);
         return true;
     }
 
     template <typename ParseHandler>
-    bool appendBack(ExclusiveContext* cx, LifoAlloc& alloc,
-                    typename ParseHandler::DefinitionNode defn)
+    MOZ_MUST_USE bool appendBack(ExclusiveContext* cx, LifoAlloc& alloc,
+                                 typename ParseHandler::DefinitionNode defn)
     {
         Node* last = allocNode(cx, alloc, ParseHandler::definitionToBits(defn), nullptr);
         if (!last)
             return false;
 
         if (isMultiple()) {
             lastNode()->next = last;
         } else {
@@ -449,17 +449,17 @@ class AtomDecls
 
   public:
     explicit AtomDecls(ExclusiveContext* cx, LifoAlloc& alloc) : cx(cx),
                                                                  alloc(alloc),
                                                                  map(nullptr) {}
 
     ~AtomDecls();
 
-    bool init();
+    MOZ_MUST_USE bool init();
 
     void clear() {
         map->clear();
     }
 
     /* Return the definition at the head of the chain for |atom|. */
     DefinitionNode lookupFirst(JSAtom* atom) const {
         MOZ_ASSERT(map);
@@ -485,28 +485,28 @@ class AtomDecls
     DefinitionList::Range lookupMulti(JSAtom* atom) const {
         MOZ_ASSERT(map);
         if (AtomDefnListPtr p = map->lookup(atom))
             return p.value().all();
         return DefinitionList::Range();
     }
 
     /* Add-or-update a known-unique definition for |atom|. */
-    bool addUnique(JSAtom* atom, DefinitionNode defn) {
+    MOZ_MUST_USE bool addUnique(JSAtom* atom, DefinitionNode defn) {
         MOZ_ASSERT(map);
         AtomDefnListAddPtr p = map->lookupForAdd(atom);
         if (!p)
             return map->add(p, atom, DefinitionList(ParseHandler::definitionToBits(defn)));
         MOZ_ASSERT(!p.value().isMultiple());
         p.value() = DefinitionList(ParseHandler::definitionToBits(defn));
         return true;
     }
 
-    bool addShadow(JSAtom* atom, DefinitionNode defn);
-    bool addShadowedForAnnexB(JSAtom* atom, DefinitionNode defn);
+    MOZ_MUST_USE bool addShadow(JSAtom* atom, DefinitionNode defn);
+    MOZ_MUST_USE bool addShadowedForAnnexB(JSAtom* atom, DefinitionNode defn);
 
     /* Updating the definition for an entry that is known to exist is infallible. */
     void updateFirst(JSAtom* atom, DefinitionNode defn) {
         MOZ_ASSERT(map);
         AtomDefnListMap::Ptr p = map->lookup(atom);
         MOZ_ASSERT(p);
         p.value().setFront<ParseHandler>(defn);
     }
--- a/js/src/frontend/ParseNode.h
+++ b/js/src/frontend/ParseNode.h
@@ -54,31 +54,31 @@ class PackedScopeCoordinate
     static const uint32_t UNKNOWN_HOPS = SCOPECOORD_HOPS_LIMIT - 1;
     static const uint32_t UNKNOWN_SLOT = SCOPECOORD_SLOT_LIMIT - 1;
     bool isHopsUnknown() const { return hops_ == UNKNOWN_HOPS; }
     bool isFree() const { return slot_ == UNKNOWN_SLOT; }
 
     uint32_t hops() const { MOZ_ASSERT(!isFree()); return hops_; }
     uint32_t slot() const { MOZ_ASSERT(!isFree()); return slot_; }
 
-    bool setSlot(TokenStream& ts, uint32_t newSlot) {
+    MOZ_MUST_USE bool setSlot(TokenStream& ts, uint32_t newSlot) {
         if (newSlot >= UNKNOWN_SLOT)
             return ts.reportError(JSMSG_TOO_MANY_LOCALS);
         slot_ = newSlot;
         return true;
     }
 
-    bool setHops(TokenStream& ts, uint32_t newHops) {
+    MOZ_MUST_USE bool setHops(TokenStream& ts, uint32_t newHops) {
         if (newHops >= UNKNOWN_HOPS)
             return ts.reportError(JSMSG_TOO_DEEP, js_function_str);
         hops_ = newHops;
         return true;
     }
 
-    bool set(TokenStream& ts, uint32_t newHops, uint32_t newSlot) {
+    MOZ_MUST_USE bool set(TokenStream& ts, uint32_t newHops, uint32_t newSlot) {
         return setHops(ts, newHops) && setSlot(ts, newSlot);
     }
 
     void makeFree() {
         hops_ = UNKNOWN_HOPS;
         slot_ = UNKNOWN_SLOT;
         MOZ_ASSERT(isFree());
     }
@@ -914,19 +914,19 @@ class ParseNode
     ;
 
     enum AllowConstantObjects {
         DontAllowObjects = 0,
         AllowObjects,
         ForCopyOnWriteArray
     };
 
-    bool getConstantValue(ExclusiveContext* cx, AllowConstantObjects allowObjects, MutableHandleValue vp,
-                          Value* compare = nullptr, size_t ncompare = 0,
-                          NewObjectKind newKind = TenuredObject);
+    MOZ_MUST_USE bool getConstantValue(ExclusiveContext* cx, AllowConstantObjects allowObjects,
+                                       MutableHandleValue vp, Value* compare = nullptr,
+                                       size_t ncompare = 0, NewObjectKind newKind = TenuredObject);
     inline bool isConstant();
 
     template <class NodeType>
     inline bool is() const {
         return NodeType::test(*this);
     }
 
     /* Casting operations. */
@@ -1386,17 +1386,17 @@ class PropertyByValue : public ParseNode
  */
 struct CallSiteNode : public ListNode {
     explicit CallSiteNode(uint32_t begin): ListNode(PNK_CALLSITEOBJ, TokenPos(begin, begin + 1)) {}
 
     static bool test(const ParseNode& node) {
         return node.isKind(PNK_CALLSITEOBJ);
     }
 
-    bool getRawArrayValue(ExclusiveContext* cx, MutableHandleValue vp) {
+    MOZ_MUST_USE bool getRawArrayValue(ExclusiveContext* cx, MutableHandleValue vp) {
         return pn_head->getConstantValue(cx, AllowObjects, vp);
     }
 };
 
 struct ClassMethod : public BinaryNode {
     /*
      * Method defintions often keep a name and function body that overlap,
      * so explicitly define the beginning and end here.
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -395,17 +395,17 @@ template <typename ParseHandler>
 void
 ParseContext<ParseHandler>::prepareToAddDuplicateArg(HandlePropertyName name, DefinitionNode prevDecl)
 {
     MOZ_ASSERT(decls_.lookupFirst(name) == prevDecl);
     decls_.remove(name);
 }
 
 template <typename ParseHandler>
-void
+bool
 ParseContext<ParseHandler>::updateDecl(TokenStream& ts, JSAtom* atom, Node pn)
 {
     Definition* oldDecl = decls_.lookupFirst(atom);
 
     pn->setDefn(true);
     Definition* newDecl = &pn->template as<Definition>();
     decls_.updateFirst(atom, newDecl);
 
@@ -419,17 +419,17 @@ ParseContext<ParseHandler>::updateDecl(T
         MOZ_ASSERT(oldDecl->getKind() == PNK_FUNCTION);
         MOZ_ASSERT(newDecl->getKind() == PNK_FUNCTION);
         MOZ_ASSERT(!sc->strict());
         MOZ_ASSERT(oldDecl->isBound());
         MOZ_ASSERT(!oldDecl->pn_scopecoord.isFree());
         newDecl->pn_scopecoord = oldDecl->pn_scopecoord;
         newDecl->pn_dflags |= PND_BOUND;
         newDecl->setOp(JSOP_INITLEXICAL);
-        return;
+        return true;
     }
 
     if (sc->isGlobalContext() || oldDecl->isDeoptimized()) {
         MOZ_ASSERT(newDecl->isFreeVar());
         // Global 'var' bindings have no slots, but are still tracked for
         // redeclaration checks.
         for (uint32_t i = 0; i < vars_.length(); i++) {
             if (vars_[i] == oldDecl) {
@@ -439,40 +439,43 @@ ParseContext<ParseHandler>::updateDecl(T
                 //
                 // Global bindings are excluded as currently they are never
                 // frame slots. The notion of being deoptimized is not
                 // applicable to them.
                 if (oldDecl->isDeoptimized() && !newDecl->isDeoptimized() &&
                     !sc->isGlobalContext())
                 {
                     newDecl->pn_dflags |= PND_BOUND;
-                    newDecl->pn_scopecoord.setSlot(ts, i);
+                    if (!newDecl->pn_scopecoord.setSlot(ts, i)) {
+                        return false;
+                    }
                     newDecl->setOp(JSOP_GETLOCAL);
                 }
                 vars_[i] = newDecl;
                 break;
             }
         }
-        return;
+        return true;
     }
 
     MOZ_ASSERT(oldDecl->isBound());
     MOZ_ASSERT(!oldDecl->pn_scopecoord.isFree());
     newDecl->pn_scopecoord = oldDecl->pn_scopecoord;
     newDecl->pn_dflags |= PND_BOUND;
     if (IsArgOp(oldDecl->getOp())) {
         newDecl->setOp(JSOP_GETARG);
         MOZ_ASSERT(args_[oldDecl->pn_scopecoord.slot()] == oldDecl);
         args_[oldDecl->pn_scopecoord.slot()] = newDecl;
     } else {
         MOZ_ASSERT(IsLocalOp(oldDecl->getOp()));
         newDecl->setOp(JSOP_GETLOCAL);
         MOZ_ASSERT(vars_[oldDecl->pn_scopecoord.slot()] == oldDecl);
         vars_[oldDecl->pn_scopecoord.slot()] = newDecl;
     }
+    return true;
 }
 
 template <typename ParseHandler>
 void
 ParseContext<ParseHandler>::popLetDecl(JSAtom* atom)
 {
     MOZ_ASSERT(ParseHandler::getDefinitionKind(decls_.lookupFirst(atom)) == Definition::LET ||
                ParseHandler::getDefinitionKind(decls_.lookupFirst(atom)) == Definition::CONSTANT);
@@ -1434,17 +1437,18 @@ Parser<ParseHandler>::functionBody(InHan
 }
 
 /* See comment for use in Parser::functionDef. */
 template <>
 bool
 Parser<FullParseHandler>::makeDefIntoUse(Definition* dn, ParseNode* pn, HandleAtom atom)
 {
     /* Turn pn into a definition. */
-    pc->updateDecl(tokenStream, atom, pn);
+    if (!pc->updateDecl(tokenStream, atom, pn))
+        return false;
 
     /* Change all uses of dn to be uses of pn. */
     for (ParseNode* pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) {
         MOZ_ASSERT(pnu->isUsed());
         MOZ_ASSERT(!pnu->isDefn());
         pnu->pn_lexdef = &pn->as<Definition>();
         pn->pn_dflags |= pnu->pn_dflags & PND_USE2DEF_FLAGS;
     }
@@ -3071,17 +3075,18 @@ Parser<ParseHandler>::appendToCallSiteOb
 
     JSAtom* atom = tokenStream.getRawTemplateStringAtom();
     if (!atom)
         return false;
     Node rawNode = handler.newTemplateStringLiteral(atom, pos());
     if (!rawNode)
         return false;
 
-    return handler.addToCallSiteObject(callSiteObj, rawNode, cookedNode);
+    handler.addToCallSiteObject(callSiteObj, rawNode, cookedNode);
+    return true;
 }
 
 template <>
 ParseNode*
 Parser<FullParseHandler>::standaloneLazyFunction(HandleFunction fun, bool strict,
                                                  GeneratorKind generatorKind)
 {
     MOZ_ASSERT(checkOptionsCalled);
--- a/js/src/frontend/Parser.h
+++ b/js/src/frontend/Parser.h
@@ -192,17 +192,17 @@ struct MOZ_STACK_CLASS ParseContext : pu
      * name in the block's scope.
      */
     void popLetDecl(JSAtom* atom);
 
     /* See the sad story in defineArg. */
     void prepareToAddDuplicateArg(HandlePropertyName name, DefinitionNode prevDecl);
 
     /* See the sad story in MakeDefIntoUse. */
-    void updateDecl(TokenStream& ts, JSAtom* atom, Node newDecl);
+    MOZ_MUST_USE bool updateDecl(TokenStream& ts, JSAtom* atom, Node newDecl);
 
     // After a script has been parsed, the parser generates the code's
     // "bindings". Bindings are a data-structure, ultimately stored in the
     // compiled JSScript, that serve three purposes:
     //
     //  - After parsing, the ParseContext is destroyed and 'decls' along with
     //    it. Mostly, the emitter just uses the binding information stored in
     //    the use/def nodes, but the emitter occasionally needs 'bindings' for
@@ -279,17 +279,17 @@ struct MOZ_STACK_CLASS ParseContext : pu
     {
         prs->pc = this;
         if (sc->isFunctionBox())
             parseUsingFunctionBox.emplace(prs->context, sc->asFunctionBox());
     }
 
     ~ParseContext();
 
-    bool init(Parser<ParseHandler>& parser);
+    MOZ_MUST_USE bool init(Parser<ParseHandler>& parser);
 
     unsigned blockid() { return stmtStack.innermost() ? stmtStack.innermost()->blockid : bodyid; }
 
     StmtInfoPC* innermostStmt() const { return stmtStack.innermost(); }
     StmtInfoPC* innermostScopeStmt() const { return stmtStack.innermostScopeStmt(); }
     StmtInfoPC* innermostNonLabelStmt() const { return stmtStack.innermostNonLabel(); }
     JSObject* innermostStaticScope() const {
         if (StmtInfoPC* stmt = innermostScopeStmt())
--- a/js/src/frontend/SyntaxParseHandler.h
+++ b/js/src/frontend/SyntaxParseHandler.h
@@ -208,19 +208,17 @@ class SyntaxParseHandler
     Node newTemplateStringLiteral(JSAtom* atom, const TokenPos& pos) {
         return NodeGeneric;
     }
 
     Node newCallSiteObject(uint32_t begin) {
         return NodeGeneric;
     }
 
-    bool addToCallSiteObject(Node callSiteObj, Node rawNode, Node cookedNode) {
-        return true;
-    }
+    void addToCallSiteObject(Node callSiteObj, Node rawNode, Node cookedNode) {}
 
     Node newThisLiteral(const TokenPos& pos, Node thisName) { return NodeGeneric; }
     Node newNullLiteral(const TokenPos& pos) { return NodeGeneric; }
 
     template <class Boxer>
     Node newRegExp(RegExpObject* reobj, const TokenPos& pos, Boxer& boxer) { return NodeGeneric; }
 
     Node newConditional(Node cond, Node thenExpr, Node elseExpr) { return NodeGeneric; }
@@ -256,44 +254,44 @@ class SyntaxParseHandler
     Node newTernary(ParseNodeKind kind, Node first, Node second, Node third, JSOp op = JSOP_NOP) {
         return NodeGeneric;
     }
 
     // Expressions
 
     Node newArrayComprehension(Node body, const TokenPos& pos) { return NodeGeneric; }
     Node newArrayLiteral(uint32_t begin) { return NodeUnparenthesizedArray; }
-    bool addElision(Node literal, const TokenPos& pos) { return true; }
-    bool addSpreadElement(Node literal, uint32_t begin, Node inner) { return true; }
+    MOZ_MUST_USE bool addElision(Node literal, const TokenPos& pos) { return true; }
+    MOZ_MUST_USE bool addSpreadElement(Node literal, uint32_t begin, Node inner) { return true; }
     void addArrayElement(Node literal, Node element) { }
 
     Node newCall() { return NodeFunctionCall; }
     Node newTaggedTemplate() { return NodeGeneric; }
 
     Node newObjectLiteral(uint32_t begin) { return NodeUnparenthesizedObject; }
     Node newClassMethodList(uint32_t begin) { return NodeGeneric; }
 
     Node newNewTarget(Node newHolder, Node targetHolder) { return NodeGeneric; }
     Node newPosHolder(const TokenPos& pos) { return NodeGeneric; }
     Node newSuperBase(Node thisName, const TokenPos& pos) { return NodeSuperBase; }
 
-    bool addPrototypeMutation(Node literal, uint32_t begin, Node expr) { return true; }
-    bool addPropertyDefinition(Node literal, Node name, Node expr) { return true; }
-    bool addShorthand(Node literal, Node name, Node expr) { return true; }
-    bool addObjectMethodDefinition(Node literal, Node name, Node fn, JSOp op) { return true; }
-    bool addClassMethodDefinition(Node literal, Node name, Node fn, JSOp op, bool isStatic) { return true; }
+    MOZ_MUST_USE bool addPrototypeMutation(Node literal, uint32_t begin, Node expr) { return true; }
+    MOZ_MUST_USE bool addPropertyDefinition(Node literal, Node name, Node expr) { return true; }
+    MOZ_MUST_USE bool addShorthand(Node literal, Node name, Node expr) { return true; }
+    MOZ_MUST_USE bool addObjectMethodDefinition(Node literal, Node name, Node fn, JSOp op) { return true; }
+    MOZ_MUST_USE bool addClassMethodDefinition(Node literal, Node name, Node fn, JSOp op, bool isStatic) { return true; }
     Node newYieldExpression(uint32_t begin, Node value, Node gen) { return NodeGeneric; }
     Node newYieldStarExpression(uint32_t begin, Node value, Node gen) { return NodeGeneric; }
 
     // Statements
 
     Node newStatementList(unsigned blockid, const TokenPos& pos) { return NodeGeneric; }
     void addStatementToList(Node list, Node stmt, ParseContext<SyntaxParseHandler>* pc) {}
     void addCaseStatementToList(Node list, Node stmt, ParseContext<SyntaxParseHandler>* pc) {}
-    bool prependInitialYield(Node stmtList, Node gen) { return true; }
+    MOZ_MUST_USE bool prependInitialYield(Node stmtList, Node gen) { return true; }
     Node newEmptyStatement(const TokenPos& pos) { return NodeEmptyStatement; }
 
     Node newSetThis(Node thisName, Node value) { return value; }
 
     Node newExprStatement(Node expr, uint32_t end) {
         return expr == NodeUnparenthesizedString ? NodeStringExprStatement : NodeGeneric;
     }
 
@@ -318,20 +316,20 @@ class SyntaxParseHandler
 
     Node newPropertyAccess(Node pn, PropertyName* name, uint32_t end) {
         lastAtom = name;
         return NodeDottedProperty;
     }
 
     Node newPropertyByValue(Node pn, Node kid, uint32_t end) { return NodeElement; }
 
-    bool addCatchBlock(Node catchList, Node letBlock,
-                       Node catchName, Node catchGuard, Node catchBody) { return true; }
+    MOZ_MUST_USE bool addCatchBlock(Node catchList, Node letBlock, Node catchName,
+                                    Node catchGuard, Node catchBody) { return true; }
 
-    bool setLastFunctionArgumentDefault(Node funcpn, Node pn) { return true; }
+    MOZ_MUST_USE bool setLastFunctionArgumentDefault(Node funcpn, Node pn) { return true; }
     void setLastFunctionArgumentDestructuring(Node funcpn, Node pn) {}
     Node newFunctionDefinition() { return NodeFunctionDefinition; }
     void setFunctionBody(Node pn, Node kid) {}
     void setFunctionBox(Node pn, FunctionBox* funbox) {}
     Node newFunctionDefinitionForAnnexB(Node pn, Node assignment) { return NodeFunctionDefinition; }
     void addFunctionArgument(Node pn, Node argpn) {}
 
     Node newForStatement(uint32_t begin, Node forHead, Node body, unsigned iflags) {
@@ -361,17 +359,17 @@ class SyntaxParseHandler
 
     Node newLexicalScope(ObjectBox* blockbox) { return NodeGeneric; }
     void setLexicalScopeBody(Node block, Node body) {}
 
     Node newLetBlock(Node vars, Node block, const TokenPos& pos) {
         return NodeGeneric;
     }
 
-    bool finishInitializerAssignment(Node pn, Node init) { return true; }
+    MOZ_MUST_USE bool finishInitializerAssignment(Node pn, Node init) { return true; }
     void setLexicalDeclarationOp(Node pn, JSOp op) {}
 
     void setBeginPosition(Node pn, Node oth) {}
     void setBeginPosition(Node pn, uint32_t begin) {}
 
     void setEndPosition(Node pn, Node oth) {}
     void setEndPosition(Node pn, uint32_t end) {}
 
--- a/js/src/frontend/TokenStream.h
+++ b/js/src/frontend/TokenStream.h
@@ -338,17 +338,17 @@ class MOZ_STACK_CLASS TokenStream
   public:
     typedef Vector<char16_t, 32> CharBuffer;
 
     TokenStream(ExclusiveContext* cx, const ReadOnlyCompileOptions& options,
                 const char16_t* base, size_t length, StrictModeGetter* smg);
 
     ~TokenStream();
 
-    bool checkOptions();
+    MOZ_MUST_USE bool checkOptions();
 
     // Accessors.
     const Token& currentToken() const { return tokens[cursor]; }
     bool isCurrentTokenType(TokenKind type) const {
         return currentToken().type == type;
     }
     const CharBuffer& getTokenbuf() const { return tokenbuf; }
     const char* getFilename() const { return filename; }
@@ -431,17 +431,17 @@ class MOZ_STACK_CLASS TokenStream
 
   private:
     // These are private because they should only be called by the tokenizer
     // while tokenizing not by, for example, BytecodeEmitter.
     bool reportStrictModeError(unsigned errorNumber, ...);
     bool strictMode() const { return strictModeGetter && strictModeGetter->strictMode(); }
 
     static JSAtom* atomize(ExclusiveContext* cx, CharBuffer& cb);
-    bool putIdentInTokenbuf(const char16_t* identStart);
+    MOZ_MUST_USE bool putIdentInTokenbuf(const char16_t* identStart);
 
     struct Flags
     {
         bool isEOF:1;           // Hit end of file.
         bool isDirtyLine:1;     // Non-whitespace since start of line.
         bool sawOctalEscape:1;  // Saw an octal character escape.
         bool hadError:1;        // Hit a syntax error, at start or during a
                                 // token.
@@ -531,17 +531,17 @@ class MOZ_STACK_CLASS TokenStream
         MOZ_ASSERT_UNREACHABLE("this token was previously looked up with a "
                                "different modifier, potentially making "
                                "tokenization non-deterministic");
 #endif
     }
 
     // Advance to the next token.  If the token stream encountered an error,
     // return false.  Otherwise return true and store the token kind in |*ttp|.
-    bool getToken(TokenKind* ttp, Modifier modifier = None) {
+    MOZ_MUST_USE bool getToken(TokenKind* ttp, Modifier modifier = None) {
         // Check for a pushed-back token resulting from mismatching lookahead.
         if (lookahead != 0) {
             MOZ_ASSERT(!flags.hadError);
             lookahead--;
             cursor = (cursor + 1) & ntokensMask;
             TokenKind tt = currentToken().type;
             MOZ_ASSERT(tt != TOK_EOL);
             verifyConsistentModifier(modifier, currentToken());
@@ -554,30 +554,30 @@ class MOZ_STACK_CLASS TokenStream
 
     // Push the last scanned token back into the stream.
     void ungetToken() {
         MOZ_ASSERT(lookahead < maxLookahead);
         lookahead++;
         cursor = (cursor - 1) & ntokensMask;
     }
 
-    bool peekToken(TokenKind* ttp, Modifier modifier = None) {
+    MOZ_MUST_USE bool peekToken(TokenKind* ttp, Modifier modifier = None) {
         if (lookahead > 0) {
             MOZ_ASSERT(!flags.hadError);
             verifyConsistentModifier(modifier, nextToken());
             *ttp = nextToken().type;
             return true;
         }
         if (!getTokenInternal(ttp, modifier))
             return false;
         ungetToken();
         return true;
     }
 
-    bool peekTokenPos(TokenPos* posp, Modifier modifier = None) {
+    MOZ_MUST_USE bool peekTokenPos(TokenPos* posp, Modifier modifier = None) {
         if (lookahead == 0) {
             TokenKind tt;
             if (!getTokenInternal(&tt, modifier))
                 return false;
             ungetToken();
             MOZ_ASSERT(hasLookahead());
         } else {
             MOZ_ASSERT(!flags.hadError);
@@ -588,17 +588,17 @@ class MOZ_STACK_CLASS TokenStream
     }
 
     // This is like peekToken(), with one exception:  if there is an EOL
     // between the end of the current token and the start of the next token, it
     // return true and store TOK_EOL in |*ttp|.  In that case, no token with
     // TOK_EOL is actually created, just a TOK_EOL TokenKind is returned, and
     // currentToken() shouldn't be consulted.  (This is the only place TOK_EOL
     // is produced.)
-    MOZ_ALWAYS_INLINE bool
+    MOZ_ALWAYS_INLINE MOZ_MUST_USE bool
     peekTokenSameLine(TokenKind* ttp, Modifier modifier = None) {
         const Token& curr = currentToken();
 
         // If lookahead != 0, we have scanned ahead at least one token, and
         // |lineno| is the line that the furthest-scanned token ends on.  If
         // it's the same as the line that the current token ends on, that's a
         // stronger condition than what we are looking for, and we don't need
         // to return TOK_EOL.
@@ -629,17 +629,17 @@ class MOZ_STACK_CLASS TokenStream
 
         *ttp = srcCoords.lineNum(curr.pos.end) == srcCoords.lineNum(next.pos.begin)
              ? next.type
              : TOK_EOL;
         return true;
     }
 
     // Get the next token from the stream if its kind is |tt|.
-    bool matchToken(bool* matchedp, TokenKind tt, Modifier modifier = None) {
+    MOZ_MUST_USE bool matchToken(bool* matchedp, TokenKind tt, Modifier modifier = None) {
         TokenKind token;
         if (!getToken(&token, modifier))
             return false;
         if (token == tt) {
             *matchedp = true;
         } else {
             ungetToken();
             *matchedp = false;
@@ -659,18 +659,18 @@ class MOZ_STACK_CLASS TokenStream
     // If the name token has the given characters yet *does* contain an escape,
     // a syntax error will be reported.
     //
     // This latter behavior makes this method unsuitable for use in any context
     // where ASI might occur.  In such places, an escaped "contextual keyword"
     // on a new line is the start of an ExpressionStatement, not a continuation
     // of a StatementListItem (or ImportDeclaration or ExportDeclaration, in
     // modules).
-    bool matchContextualKeyword(bool* matchedp, Handle<PropertyName*> keyword,
-                                Modifier modifier = None)
+    MOZ_MUST_USE bool matchContextualKeyword(bool* matchedp, Handle<PropertyName*> keyword,
+                                             Modifier modifier = None)
     {
         TokenKind token;
         if (!getToken(&token, modifier))
             return false;
         if (token == TOK_NAME && currentToken().name() == keyword) {
             if (currentToken().nameContainsEscape()) {
                 reportError(JSMSG_ESCAPED_KEYWORD);
                 return false;
@@ -679,17 +679,17 @@ class MOZ_STACK_CLASS TokenStream
             *matchedp = true;
         } else {
             *matchedp = false;
             ungetToken();
         }
         return true;
     }
 
-    bool nextTokenEndsExpr(bool* endsExpr) {
+    MOZ_MUST_USE bool nextTokenEndsExpr(bool* endsExpr) {
         TokenKind tt;
         if (!peekToken(&tt))
             return false;
         *endsExpr = isExprEnding[tt];
         return true;
     }
 
     class MOZ_STACK_CLASS Position {
@@ -710,20 +710,20 @@ class MOZ_STACK_CLASS TokenStream
         unsigned lineno;
         size_t linebase;
         size_t prevLinebase;
         Token currentToken;
         unsigned lookahead;
         Token lookaheadTokens[maxLookahead];
     };
 
-    bool advance(size_t position);
+    MOZ_MUST_USE bool advance(size_t position);
     void tell(Position*);
     void seek(const Position& pos);
-    bool seek(const Position& pos, const TokenStream& other);
+    MOZ_MUST_USE bool seek(const Position& pos, const TokenStream& other);
 #ifdef DEBUG
     inline bool debugHasNoLookahead() const {
         return lookahead == 0;
     }
 #endif
 
     const char16_t* rawCharPtrAt(size_t offset) const {
         return userbuf.rawCharPtrAt(offset);
@@ -754,20 +754,20 @@ class MOZ_STACK_CLASS TokenStream
     //
     // If it is a reserved word in this version and strictness mode, and thus
     // can't be present in correct code, report a SyntaxError and return false.
     //
     // If it is a keyword, like "if", the behavior depends on ttp. If ttp is
     // null, report a SyntaxError ("if is a reserved identifier") and return
     // false. If ttp is non-null, return true with the keyword's TokenKind in
     // *ttp.
-    bool checkForKeyword(JSAtom* atom, TokenKind* ttp);
+    MOZ_MUST_USE bool checkForKeyword(JSAtom* atom, TokenKind* ttp);
 
     // Same semantics as above, but for the provided keyword.
-    bool checkForKeyword(const KeywordInfo* kw, TokenKind* ttp);
+    MOZ_MUST_USE bool checkForKeyword(const KeywordInfo* kw, TokenKind* ttp);
 
     // This class maps a userbuf offset (which is 0-indexed) to a line number
     // (which is 1-indexed) and a column index (which is 0-indexed).
     class SourceCoords
     {
         // For a given buffer holding source code, |lineStartOffsets_| has one
         // element per line of source code, plus one sentinel element.  Each
         // non-sentinel element holds the buffer offset for the start of the
@@ -812,18 +812,18 @@ class MOZ_STACK_CLASS TokenStream
         static const uint32_t MAX_PTR = UINT32_MAX;
 
         uint32_t lineIndexToNum(uint32_t lineIndex) const { return lineIndex + initialLineNum_; }
         uint32_t lineNumToIndex(uint32_t lineNum)   const { return lineNum   - initialLineNum_; }
 
       public:
         SourceCoords(ExclusiveContext* cx, uint32_t ln);
 
-        bool add(uint32_t lineNum, uint32_t lineStartOffset);
-        bool fill(const SourceCoords& other);
+        MOZ_MUST_USE bool add(uint32_t lineNum, uint32_t lineStartOffset);
+        MOZ_MUST_USE bool fill(const SourceCoords& other);
 
         bool isOnThisLine(uint32_t offset, uint32_t lineNum, bool* onThisLine) const {
             uint32_t lineIndex = lineNumToIndex(lineNum);
             if (lineIndex + 1 >= lineStartOffsets_.length()) // +1 due to sentinel
                 return false;
             *onThisLine = lineStartOffsets_[lineIndex] <= offset &&
                           offset < lineStartOffsets_[lineIndex + 1];
             return true;
@@ -952,38 +952,38 @@ class MOZ_STACK_CLASS TokenStream
 
       private:
         const char16_t* base_;          // base of buffer
         uint32_t startOffset_;          // offset of base_[0]
         const char16_t* limit_;         // limit for quick bounds check
         const char16_t* ptr;            // next char to get
     };
 
-    bool getTokenInternal(TokenKind* ttp, Modifier modifier);
+    MOZ_MUST_USE bool getTokenInternal(TokenKind* ttp, Modifier modifier);
 
-    bool getBracedUnicode(uint32_t* code);
-    bool getStringOrTemplateToken(int untilChar, Token** tp);
+    MOZ_MUST_USE bool getBracedUnicode(uint32_t* code);
+    MOZ_MUST_USE bool getStringOrTemplateToken(int untilChar, Token** tp);
 
     int32_t getChar();
     int32_t getCharIgnoreEOL();
     void ungetChar(int32_t c);
     void ungetCharIgnoreEOL(int32_t c);
     Token* newToken(ptrdiff_t adjust);
     bool peekUnicodeEscape(int32_t* c);
     bool matchUnicodeEscapeIdStart(int32_t* c);
     bool matchUnicodeEscapeIdent(int32_t* c);
     bool peekChars(int n, char16_t* cp);
 
-    bool getDirectives(bool isMultiline, bool shouldWarnDeprecated);
-    bool getDirective(bool isMultiline, bool shouldWarnDeprecated,
-                      const char* directive, int directiveLength,
-                      const char* errorMsgPragma,
-                      UniquePtr<char16_t[], JS::FreePolicy>* destination);
-    bool getDisplayURL(bool isMultiline, bool shouldWarnDeprecated);
-    bool getSourceMappingURL(bool isMultiline, bool shouldWarnDeprecated);
+    MOZ_MUST_USE bool getDirectives(bool isMultiline, bool shouldWarnDeprecated);
+    MOZ_MUST_USE bool getDirective(bool isMultiline, bool shouldWarnDeprecated,
+                                   const char* directive, int directiveLength,
+                                   const char* errorMsgPragma,
+                                   UniquePtr<char16_t[], JS::FreePolicy>* destination);
+    MOZ_MUST_USE bool getDisplayURL(bool isMultiline, bool shouldWarnDeprecated);
+    MOZ_MUST_USE bool getSourceMappingURL(bool isMultiline, bool shouldWarnDeprecated);
 
     // |expect| cannot be an EOL char.
     bool matchChar(int32_t expect) {
         MOZ_ASSERT(!TokenBuf::isRawEOLChar(expect));
         return MOZ_LIKELY(userbuf.hasRawChars()) &&
                userbuf.matchRawChar(expect);
     }