Bug 1267551 (part 4) - Use MOZ_MUST_USE more in js/src/asmjs/. r=bbouvier.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 05 May 2016 13:45:45 +1000
changeset 335741 5b115b854171f01c1a521e389f2c52c700e9f935
parent 335740 a0eeeb82335526f5a2c6226c5317b9b691f4ed9c
child 335742 75ceb95a4cb101b3b706780ecbdc825696891dcd
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)
reviewersbbouvier
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 4) - Use MOZ_MUST_USE more in js/src/asmjs/. r=bbouvier. The patch also removes some unnecessary MOZ_MUST_USE annotations on function definitions (because the function declaration is already annotated). And it changes the return type of ModuleGenerator::initFuncSig() to void, because is always returns true.
js/src/asmjs/AsmJS.cpp
js/src/asmjs/AsmJS.h
js/src/asmjs/Wasm.h
js/src/asmjs/WasmBinary.h
js/src/asmjs/WasmBinaryIterator.h
js/src/asmjs/WasmBinaryToText.h
js/src/asmjs/WasmGenerator.cpp
js/src/asmjs/WasmGenerator.h
js/src/asmjs/WasmIonCompile.h
js/src/asmjs/WasmModule.h
js/src/asmjs/WasmSerialize.h
js/src/asmjs/WasmSignalHandlers.h
js/src/asmjs/WasmTextToBinary.h
js/src/asmjs/WasmTypes.h
--- a/js/src/asmjs/AsmJS.cpp
+++ b/js/src/asmjs/AsmJS.cpp
@@ -2020,18 +2020,17 @@ class MOZ_STACK_CLASS ModuleValidator
     }
     bool addFunction(PropertyName* name, uint32_t firstUse, Sig&& sig, Func** func) {
         uint32_t sigIndex;
         if (!declareSig(Move(sig), &sigIndex))
             return false;
         uint32_t funcIndex = numFunctions();
         if (funcIndex >= MaxFuncs)
             return failCurrentOffset("too many functions");
-        if (!mg_.initFuncSig(funcIndex, sigIndex))
-            return false;
+        mg_.initFuncSig(funcIndex, sigIndex);
         Global* global = validationLifo_.new_<Global>(Global::Function);
         if (!global)
             return false;
         global->u.funcIndex_ = funcIndex;
         if (!globalMap_.putNew(name, global))
             return false;
         *func = validationLifo_.new_<Func>(name, firstUse, funcIndex);
         return *func && functions_.append(*func);
--- a/js/src/asmjs/AsmJS.h
+++ b/js/src/asmjs/AsmJS.h
@@ -35,17 +35,17 @@ typedef frontend::ParseContext<frontend:
 
 // This function takes over parsing of a function starting with "use asm". The
 // return value indicates whether an error was reported which the caller should
 // propagate. If no error was reported, the function may still fail to validate
 // as asm.js. In this case, the parser.tokenStream has been advanced an
 // indeterminate amount and the entire function should be reparsed from the
 // beginning.
 
-extern bool
+extern MOZ_MUST_USE bool
 CompileAsmJS(ExclusiveContext* cx, AsmJSParser& parser, frontend::ParseNode* stmtList,
              bool* validated);
 
 // asm.js module/export queries:
 
 extern bool
 IsAsmJSModuleNative(JSNative native);
 
--- a/js/src/asmjs/Wasm.h
+++ b/js/src/asmjs/Wasm.h
@@ -43,17 +43,17 @@ static const unsigned PageSize = 64 * 10
 // See also static asserts in MIRGenerator::foldableOffsetRange.
 #ifdef ASMJS_MAY_USE_SIGNAL_HANDLERS_FOR_OOB
 static const uint64_t Uint32Range = uint64_t(UINT32_MAX) + 1;
 static const uint64_t MappedSize = 2 * Uint32Range + PageSize;
 #endif
 
 // Compiles the given binary wasm module given the ArrayBufferObject
 // and links the module's imports with the given import object.
-bool
+MOZ_MUST_USE bool
 Eval(JSContext* cx, Handle<TypedArrayObject*> code, HandleObject importObj,
      MutableHandleObject exportObj);
 
 }  // namespace wasm
 
 // Initialization of the Wasm global object and its properties.
 
 extern const Class WasmClass;
--- a/js/src/asmjs/WasmBinary.h
+++ b/js/src/asmjs/WasmBinary.h
@@ -810,18 +810,18 @@ class Decoder
     }
 };
 
 // Reusable macro encoding/decoding functions reused by both the two
 // encoders (AsmJS/WasmText) and decoders (Wasm/WasmIonCompile).
 
 typedef Vector<ValType, 8, SystemAllocPolicy> ValTypeVector;
 
-bool
+MOZ_MUST_USE bool
 EncodeLocalEntries(Encoder& d, const ValTypeVector& locals);
 
-bool
+MOZ_MUST_USE bool
 DecodeLocalEntries(Decoder& d, ValTypeVector* locals);
 
 } // namespace wasm
 } // namespace js
 
 #endif // wasm_binary_h
--- a/js/src/asmjs/WasmBinaryIterator.h
+++ b/js/src/asmjs/WasmBinaryIterator.h
@@ -385,17 +385,17 @@ class MOZ_STACK_CLASS ExprIter : private
         if (!checkType(tv.type(), expectedType))
             return false;
         if (Output)
             *value = tv.value();
         return true;
     }
 
     // Read the value stack entry at depth |index|.
-    bool peek(uint32_t index, TypeAndValue<Value>* tv) {
+    MOZ_MUST_USE bool peek(uint32_t index, TypeAndValue<Value>* tv) {
         if (Validate && valueStack_.length() - controlStack_.back().valueStackStart() <= index)
             return fail("peeking at value from outside block");
         *tv = valueStack_[valueStack_.length() - index];
         return true;
     }
 
   public:
     ExprIter(Policy policy, Decoder& decoder)
@@ -531,17 +531,17 @@ ExprIter<Policy>::typeMismatch(ExprType 
                                   ToCString(actual), ToCString(expected)));
     if (!error)
         return false;
 
     return fail(error.get());
 }
 
 template <typename Policy>
-inline MOZ_MUST_USE bool
+inline bool
 ExprIter<Policy>::checkType(ExprType actual, ExprType expected)
 {
     if (!Validate) {
         MOZ_ASSERT(actual == AnyType || actual == expected, "type mismatch");
         return true;
     }
 
     if (MOZ_LIKELY(actual == AnyType || actual == expected))
@@ -1225,39 +1225,39 @@ ExprIter<Policy>::readSetGlobal(const Gl
 
     if (Output)
         *id = validateId;
 
     return true;
 }
 
 template <typename Policy>
-inline MOZ_MUST_USE bool
+inline bool
 ExprIter<Policy>::readI32Const(int32_t* i32)
 {
     MOZ_ASSERT(Classify(expr_) == ExprKind::I32);
 
     int32_t unused;
     return readVarS32(Output ? i32 : &unused) &&
            push(ExprType::I32);
 }
 
 template <typename Policy>
-inline MOZ_MUST_USE bool
+inline bool
 ExprIter<Policy>::readI64Const(int64_t* i64)
 {
     MOZ_ASSERT(Classify(expr_) == ExprKind::I64);
 
     int64_t unused;
     return readVarS64(Output ? i64 : &unused) &&
            push(ExprType::I64);
 }
 
 template <typename Policy>
-inline MOZ_MUST_USE bool
+inline bool
 ExprIter<Policy>::readF32Const(float* f32)
 {
     MOZ_ASSERT(Classify(expr_) == ExprKind::F32);
 
     float validateF32;
     if (!readFixedF32(Output ? f32 : &validateF32))
         return false;
 
@@ -1266,17 +1266,17 @@ ExprIter<Policy>::readF32Const(float* f3
         if (memcmp(Output ? f32 : &validateF32, &jsNaN, sizeof(*f32)) != 0)
             return notYetImplemented("NaN literals with custom payloads");
     }
 
     return push(ExprType::F32);
 }
 
 template <typename Policy>
-inline MOZ_MUST_USE bool
+inline bool
 ExprIter<Policy>::readF64Const(double* f64)
 {
     MOZ_ASSERT(Classify(expr_) == ExprKind::F64);
 
     double validateF64;
     if (!readFixedF64(Output ? f64 : &validateF64))
        return false;
 
@@ -1285,39 +1285,39 @@ ExprIter<Policy>::readF64Const(double* f
         if (memcmp(Output ? f64 : &validateF64, &jsNaN, sizeof(*f64)) != 0)
             return notYetImplemented("NaN literals with custom payloads");
     }
 
     return push(ExprType::F64);
 }
 
 template <typename Policy>
-inline MOZ_MUST_USE bool
+inline bool
 ExprIter<Policy>::readI32x4Const(I32x4* i32x4)
 {
     MOZ_ASSERT(Classify(expr_) == ExprKind::I32x4);
 
     I32x4 unused;
     return readFixedI32x4(Output ? i32x4 : &unused) &&
            push(ExprType::I32x4);
 }
 
 template <typename Policy>
-inline MOZ_MUST_USE bool
+inline bool
 ExprIter<Policy>::readF32x4Const(F32x4* f32x4)
 {
     MOZ_ASSERT(Classify(expr_) == ExprKind::F32x4);
 
     F32x4 unused;
     return readFixedF32x4(Output ? f32x4 : &unused) &&
            push(ExprType::F32x4);
 }
 
 template <typename Policy>
-inline MOZ_MUST_USE bool
+inline bool
 ExprIter<Policy>::readB32x4Const(I32x4* i32x4)
 {
     MOZ_ASSERT(Classify(expr_) == ExprKind::B32x4);
 
     I32x4 unused;
     return readFixedI32x4(Output ? i32x4 : &unused) &&
            push(ExprType::B32x4);
 }
--- a/js/src/asmjs/WasmBinaryToText.h
+++ b/js/src/asmjs/WasmBinaryToText.h
@@ -28,16 +28,16 @@ namespace js {
 
 class StringBuffer;
 
 namespace wasm {
 
 // Translate the given binary representation of a wasm module into the module's textual
 // representation.
 
-bool
+MOZ_MUST_USE bool
 BinaryToText(JSContext* cx, const uint8_t* bytes, size_t length, StringBuffer& buffer);
 
 }  // namespace wasm
 
 }  // namespace js
 
 #endif // namespace wasm_binary_to_text_h
--- a/js/src/asmjs/WasmGenerator.cpp
+++ b/js/src/asmjs/WasmGenerator.cpp
@@ -623,26 +623,25 @@ ModuleGenerator::initSig(uint32_t sigInd
 
 const DeclaredSig&
 ModuleGenerator::sig(uint32_t index) const
 {
     MOZ_ASSERT(index < numSigs_);
     return shared_->sigs[index];
 }
 
-bool
+void
 ModuleGenerator::initFuncSig(uint32_t funcIndex, uint32_t sigIndex)
 {
     MOZ_ASSERT(isAsmJS());
     MOZ_ASSERT(funcIndex == module_->numFuncs);
     MOZ_ASSERT(!shared_->funcSigs[funcIndex]);
 
     module_->numFuncs++;
     shared_->funcSigs[funcIndex] = &shared_->sigs[sigIndex];
-    return true;
 }
 
 void
 ModuleGenerator::bumpMinHeapLength(uint32_t newMinHeapLength)
 {
     MOZ_ASSERT(isAsmJS());
     MOZ_ASSERT(newMinHeapLength >= shared_->minHeapLength);
 
--- a/js/src/asmjs/WasmGenerator.h
+++ b/js/src/asmjs/WasmGenerator.h
@@ -140,31 +140,32 @@ class MOZ_STACK_CLASS ModuleGenerator
     Vector<IonCompileTask>          tasks_;
     Vector<IonCompileTask*>         freeTasks_;
 
     // Assertions
     DebugOnly<FunctionGenerator*>   activeFunc_;
     DebugOnly<bool>                 startedFuncDefs_;
     DebugOnly<bool>                 finishedFuncDefs_;
 
-    bool finishOutstandingTask();
+    MOZ_MUST_USE bool finishOutstandingTask();
     bool funcIsDefined(uint32_t funcIndex) const;
     uint32_t funcEntry(uint32_t funcIndex) const;
-    bool convertOutOfRangeBranchesToThunks();
-    bool finishTask(IonCompileTask* task);
-    bool finishCodegen(StaticLinkData* link);
-    bool finishStaticLinkData(uint8_t* code, uint32_t codeBytes, StaticLinkData* link);
-    bool addImport(const Sig& sig, uint32_t globalDataOffset);
-    bool allocateGlobalBytes(uint32_t bytes, uint32_t align, uint32_t* globalDataOffset);
+    MOZ_MUST_USE bool convertOutOfRangeBranchesToThunks();
+    MOZ_MUST_USE bool finishTask(IonCompileTask* task);
+    MOZ_MUST_USE bool finishCodegen(StaticLinkData* link);
+    MOZ_MUST_USE bool finishStaticLinkData(uint8_t* code, uint32_t codeBytes, StaticLinkData* link);
+    MOZ_MUST_USE bool addImport(const Sig& sig, uint32_t globalDataOffset);
+    MOZ_MUST_USE bool allocateGlobalBytes(uint32_t bytes, uint32_t align,
+                                          uint32_t* globalDataOffset);
 
   public:
     explicit ModuleGenerator(ExclusiveContext* cx);
     ~ModuleGenerator();
 
-    bool init(UniqueModuleGeneratorData shared, UniqueChars filename);
+    MOZ_MUST_USE bool init(UniqueModuleGeneratorData shared, UniqueChars filename);
 
     bool isAsmJS() const { return module_->kind == ModuleKind::AsmJS; }
     CompileArgs args() const { return module_->compileArgs; }
     jit::MacroAssembler& masm() { return masm_; }
 
     // Heap usage:
     void initHeapUsage(HeapUsage heapUsage, uint32_t minHeapLength = 0);
     bool usesHeap() const;
@@ -173,53 +174,55 @@ class MOZ_STACK_CLASS ModuleGenerator
     uint32_t numSigs() const { return numSigs_; }
     const DeclaredSig& sig(uint32_t sigIndex) const;
 
     // Function declarations:
     uint32_t numFuncSigs() const { return module_->numFuncs; }
     const DeclaredSig& funcSig(uint32_t funcIndex) const;
 
     // Globals:
-    bool allocateGlobal(ValType type, bool isConst, uint32_t* index);
+    MOZ_MUST_USE bool allocateGlobal(ValType type, bool isConst, uint32_t* index);
     const GlobalDesc& global(unsigned index) const { return shared_->globals[index]; }
 
     // Imports:
     uint32_t numImports() const;
     const ImportModuleGeneratorData& import(uint32_t index) const;
 
     // Exports:
-    bool declareExport(UniqueChars fieldName, uint32_t funcIndex, uint32_t* exportIndex = nullptr);
+    MOZ_MUST_USE bool declareExport(UniqueChars fieldName, uint32_t funcIndex,
+                                    uint32_t* exportIndex = nullptr);
     uint32_t numExports() const;
-    bool addMemoryExport(UniqueChars fieldName);
+    MOZ_MUST_USE bool addMemoryExport(UniqueChars fieldName);
 
     // Function definitions:
-    bool startFuncDefs();
-    bool startFuncDef(uint32_t lineOrBytecode, FunctionGenerator* fg);
-    bool finishFuncDef(uint32_t funcIndex, unsigned generateTime, FunctionGenerator* fg);
-    bool finishFuncDefs();
+    MOZ_MUST_USE bool startFuncDefs();
+    MOZ_MUST_USE bool startFuncDef(uint32_t lineOrBytecode, FunctionGenerator* fg);
+    MOZ_MUST_USE bool finishFuncDef(uint32_t funcIndex, unsigned generateTime,
+                                    FunctionGenerator* fg);
+    MOZ_MUST_USE bool finishFuncDefs();
 
     // Function-pointer tables:
     static const uint32_t BadIndirectCall = UINT32_MAX;
 
     // asm.js lazy initialization:
     void initSig(uint32_t sigIndex, Sig&& sig);
-    bool initFuncSig(uint32_t funcIndex, uint32_t sigIndex);
-    bool initImport(uint32_t importIndex, uint32_t sigIndex);
-    bool initSigTableLength(uint32_t sigIndex, uint32_t numElems);
+    void initFuncSig(uint32_t funcIndex, uint32_t sigIndex);
+    MOZ_MUST_USE bool initImport(uint32_t importIndex, uint32_t sigIndex);
+    MOZ_MUST_USE bool initSigTableLength(uint32_t sigIndex, uint32_t numElems);
     void initSigTableElems(uint32_t sigIndex, Uint32Vector&& elemFuncIndices);
     void bumpMinHeapLength(uint32_t newMinHeapLength);
 
     // Return a ModuleData object which may be used to construct a Module, the
     // StaticLinkData required to call Module::staticallyLink, and the list of
     // functions that took a long time to compile.
-    bool finish(CacheableCharsVector&& prettyFuncNames,
-                UniqueModuleData* module,
-                UniqueStaticLinkData* staticLinkData,
-                UniqueExportMap* exportMap,
-                SlowFunctionVector* slowFuncs);
+    MOZ_MUST_USE bool finish(CacheableCharsVector&& prettyFuncNames,
+                             UniqueModuleData* module,
+                             UniqueStaticLinkData* staticLinkData,
+                             UniqueExportMap* exportMap,
+                             SlowFunctionVector* slowFuncs);
 };
 
 // A FunctionGenerator encapsulates the generation of a single function body.
 // ModuleGenerator::startFunc must be called after construction and before doing
 // anything else. After the body is complete, ModuleGenerator::finishFunc must
 // be called before the FunctionGenerator is destroyed and the next function is
 // started.
 
@@ -240,17 +243,17 @@ class MOZ_STACK_CLASS FunctionGenerator
   public:
     FunctionGenerator()
       : m_(nullptr), task_(nullptr), lineOrBytecode_(0)
     {}
 
     Bytes& bytes() {
         return bytes_;
     }
-    bool addCallSiteLineNum(uint32_t lineno) {
+    MOZ_MUST_USE bool addCallSiteLineNum(uint32_t lineno) {
         return callSiteLineNums_.append(lineno);
     }
 };
 
 } // namespace wasm
 } // namespace js
 
 #endif // wasm_generator_h
--- a/js/src/asmjs/WasmIonCompile.h
+++ b/js/src/asmjs/WasmIonCompile.h
@@ -145,15 +145,15 @@ class IonCompileTask
         if (func_)
             *recycled = Move(func_->bytes());
         func_.reset(nullptr);
         results_.reset();
         lifo_.releaseAll();
     }
 };
 
-bool
+MOZ_MUST_USE bool
 IonCompileFunction(IonCompileTask* task);
 
 } // namespace wasm
 } // namespace js
 
 #endif // wasm_ion_compile_h
--- a/js/src/asmjs/WasmModule.h
+++ b/js/src/asmjs/WasmModule.h
@@ -40,17 +40,17 @@ namespace wasm {
 // as a convention, is stored in an inline CacheablePod struct. Everything else
 // should implement the below methods which are called recusively by the
 // containing Module. See comments for these methods in wasm::Module.
 
 #define WASM_DECLARE_SERIALIZABLE(Type)                                         \
     size_t serializedSize() const;                                              \
     uint8_t* serialize(uint8_t* cursor) const;                                  \
     const uint8_t* deserialize(ExclusiveContext* cx, const uint8_t* cursor);    \
-    bool clone(JSContext* cx, Type* out) const;                                 \
+    MOZ_MUST_USE bool clone(JSContext* cx, Type* out) const;                    \
     size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
 
 // The StaticLinkData contains all the metadata necessary to perform
 // Module::staticallyLink but is not necessary afterwards.
 
 struct StaticLinkData
 {
     struct InternalLink {
@@ -511,25 +511,25 @@ class Module : public mozilla::LinkedLis
     // Possibly stored copy of the bytes from which this module was compiled.
     Bytes                        source_;
 
     uint8_t* rawHeapPtr() const;
     uint8_t*& rawHeapPtr();
     WasmActivation*& activation();
     void specializeToHeap(ArrayBufferObjectMaybeShared* heap);
     void despecializeFromHeap(ArrayBufferObjectMaybeShared* heap);
-    bool sendCodeRangesToProfiler(JSContext* cx);
+    MOZ_MUST_USE bool sendCodeRangesToProfiler(JSContext* cx);
     MOZ_MUST_USE bool setProfilingEnabled(JSContext* cx, bool enabled);
     ImportExit& importToExit(const Import& import);
 
     friend class js::WasmActivation;
 
   protected:
     const ModuleData& base() const { return *module_; }
-    bool clone(JSContext* cx, const StaticLinkData& link, Module* clone) const;
+    MOZ_MUST_USE bool clone(JSContext* cx, const StaticLinkData& link, Module* clone) const;
 
   public:
     static const unsigned SizeOfImportExit = sizeof(ImportExit);
     static const unsigned OffsetOfImportExitFun = offsetof(ImportExit, fun);
     static const unsigned SizeOfEntryArg = sizeof(EntryArg);
 
     explicit Module(UniqueModuleData module);
     virtual ~Module();
@@ -581,49 +581,49 @@ class Module : public mozilla::LinkedLis
     const CallSite* lookupCallSite(void* returnAddress) const;
     const CodeRange* lookupCodeRange(void* pc) const;
     const HeapAccess* lookupHeapAccess(void* pc) const;
 
     // This function transitions the module from an unlinked state to a
     // statically-linked state. The given StaticLinkData must have come from the
     // compilation of this module.
 
-    bool staticallyLink(ExclusiveContext* cx, const StaticLinkData& link);
+    MOZ_MUST_USE bool staticallyLink(ExclusiveContext* cx, const StaticLinkData& link);
 
     // This function transitions the module from a statically-linked state to a
     // dynamically-linked state. If this module usesHeap(), a non-null heap
     // buffer must be given. The given import vector must match the module's
     // ImportVector. The function returns a new export object for this module.
 
-    bool dynamicallyLink(JSContext* cx,
-                         Handle<WasmModuleObject*> moduleObj,
-                         Handle<ArrayBufferObjectMaybeShared*> heap,
-                         Handle<FunctionVector> imports,
-                         const ExportMap& exportMap,
-                         MutableHandleObject exportObj);
+    MOZ_MUST_USE bool dynamicallyLink(JSContext* cx,
+                                      Handle<WasmModuleObject*> moduleObj,
+                                      Handle<ArrayBufferObjectMaybeShared*> heap,
+                                      Handle<FunctionVector> imports,
+                                      const ExportMap& exportMap,
+                                      MutableHandleObject exportObj);
 
     // The wasm heap, established by dynamicallyLink.
 
     SharedMem<uint8_t*> heap() const;
     size_t heapLength() const;
 
     // The exports of a wasm module are called by preparing an array of
     // arguments (coerced to the corresponding types of the Export signature)
     // and calling the export's entry trampoline.
 
-    bool callExport(JSContext* cx, uint32_t exportIndex, CallArgs args);
+    MOZ_MUST_USE bool callExport(JSContext* cx, uint32_t exportIndex, CallArgs args);
 
     // Initially, calls to imports in wasm code call out through the generic
     // callImport method. If the imported callee gets JIT compiled and the types
     // match up, callImport will patch the code to instead call through a thunk
     // directly into the JIT code. If the JIT code is released, the Module must
     // be notified so it can go back to the generic callImport.
 
-    bool callImport(JSContext* cx, uint32_t importIndex, unsigned argc, const uint64_t* argv,
-                    MutableHandleValue rval);
+    MOZ_MUST_USE bool callImport(JSContext* cx, uint32_t importIndex, unsigned argc,
+                                 const uint64_t* argv, MutableHandleValue rval);
     void deoptimizeImportExit(uint32_t importIndex);
 
     // At runtime, when $pc is in wasm function code (containsFunctionPC($pc)),
     // $pc may be moved abruptly to interrupt() or outOfBounds() by a signal
     // handler or SetContext() from another thread.
 
     uint8_t* interrupt() const { MOZ_ASSERT(staticallyLinked_); return interrupt_; }
     uint8_t* outOfBounds() const { MOZ_ASSERT(staticallyLinked_); return outOfBounds_; }
@@ -677,17 +677,17 @@ class WasmModuleObject : public NativeOb
     static const ClassOps classOps_;
 
     bool hasModule() const;
     static void finalize(FreeOp* fop, JSObject* obj);
     static void trace(JSTracer* trc, JSObject* obj);
   public:
     static const unsigned RESERVED_SLOTS = 1;
     static WasmModuleObject* create(ExclusiveContext* cx);
-    bool init(wasm::Module* module);
+    MOZ_MUST_USE bool init(wasm::Module* module);
     wasm::Module& module() const;
     void addSizeOfMisc(mozilla::MallocSizeOf mallocSizeOf, size_t* code, size_t* data);
     static const Class class_;
 };
 
 inline const HeapPtr<WasmModuleObject*>&
 wasm::Module::owner() const {
     MOZ_ASSERT(&ownerObject_->module() == this);
--- a/js/src/asmjs/WasmSerialize.h
+++ b/js/src/asmjs/WasmSerialize.h
@@ -160,17 +160,17 @@ DeserializeVector(ExclusiveContext* cx, 
     for (size_t i = 0; i < vec->length(); i++) {
         if (!(cursor = (*vec)[i].deserialize(cx, cursor)))
             return nullptr;
     }
     return cursor;
 }
 
 template <class T, size_t N>
-static inline bool
+static inline MOZ_MUST_USE bool
 CloneVector(JSContext* cx, const mozilla::Vector<T, N, SystemAllocPolicy>& in,
             mozilla::Vector<T, N, SystemAllocPolicy>* out)
 {
     if (!out->resize(in.length()))
         return false;
     for (size_t i = 0; i < in.length(); i++) {
         if (!in[i].clone(cx, &(*out)[i]))
             return false;
@@ -215,27 +215,27 @@ DeserializePodVector(ExclusiveContext* c
     cursor = ReadScalar<uint32_t>(cursor, &length);
     if (!vec->resize(length))
         return nullptr;
     cursor = ReadBytes(cursor, vec->begin(), length * sizeof(T));
     return cursor;
 }
 
 template <class T, size_t N>
-static inline bool
+static inline MOZ_MUST_USE bool
 ClonePodVector(JSContext* cx, const mozilla::Vector<T, N, SystemAllocPolicy>& in,
                mozilla::Vector<T, N, SystemAllocPolicy>* out)
 {
     if (!out->resize(in.length()))
         return false;
     mozilla::PodCopy(out->begin(), in.begin(), in.length());
     return true;
 }
 
-static inline bool
+static inline MOZ_MUST_USE bool
 GetCPUID(uint32_t* cpuId)
 {
     enum Arch {
         X86 = 0x1,
         X64 = 0x2,
         ARM = 0x3,
         MIPS = 0x4,
         MIPS64 = 0x5,
@@ -268,17 +268,17 @@ GetCPUID(uint32_t* cpuId)
 }
 
 class MachineId
 {
     uint32_t cpuId_;
     JS::BuildIdCharVector buildId_;
 
   public:
-    bool extractCurrentState(ExclusiveContext* cx) {
+    MOZ_MUST_USE bool extractCurrentState(ExclusiveContext* cx) {
         if (!cx->buildIdOp())
             return false;
         if (!cx->buildIdOp()(&buildId_))
             return false;
         if (!GetCPUID(&cpuId_))
             return false;
         return true;
     }
--- a/js/src/asmjs/WasmSignalHandlers.h
+++ b/js/src/asmjs/WasmSignalHandlers.h
@@ -33,17 +33,17 @@ extern void
 InterruptRunningJitCode(JSRuntime* rt);
 
 namespace wasm {
 
 // Set up any signal/exception handlers needed to execute code in the given
 // runtime. Return whether runtime can:
 //  - rely on fault handler support for avoiding asm.js heap bounds checks
 //  - rely on InterruptRunningJitCode to halt running Ion/asm.js from any thread
-bool
+MOZ_MUST_USE bool
 EnsureSignalHandlersInstalled(JSRuntime* rt);
 
 #if defined(XP_DARWIN) && defined(ASMJS_MAY_USE_SIGNAL_HANDLERS)
 // On OSX we are forced to use the lower-level Mach exception mechanism instead
 // of Unix signals. Mach exceptions are not handled on the victim's stack but
 // rather require an extra thread. For simplicity, we create one such thread
 // per JSRuntime (upon the first use of asm.js in the JSRuntime). This thread
 // and related resources are owned by AsmJSMachExceptionHandler which is owned
--- a/js/src/asmjs/WasmTextToBinary.h
+++ b/js/src/asmjs/WasmTextToBinary.h
@@ -24,15 +24,15 @@
 
 namespace js {
 namespace wasm {
 
 // Translate the textual representation of a wasm module (given by a
 // null-terminated char16_t array) into serialized bytes. If there is an error
 // other than out-of-memory an error message string will be stored in 'error'.
 
-extern bool
+extern MOZ_MUST_USE bool
 TextToBinary(const char16_t* text, Bytes* bytes, UniqueChars* error);
 
 } // namespace wasm
 } // namespace js
 
 #endif // wasm_text_to_binary_h
--- a/js/src/asmjs/WasmTypes.h
+++ b/js/src/asmjs/WasmTypes.h
@@ -258,17 +258,17 @@ class Sig
     Sig(const Sig&) = delete;
     Sig& operator=(const Sig&) = delete;
 
   public:
     Sig() : args_(), ret_(ExprType::Void) {}
     Sig(Sig&& rhs) : args_(Move(rhs.args_)), ret_(rhs.ret_) {}
     Sig(ValTypeVector&& args, ExprType ret) : args_(Move(args)), ret_(ret) {}
 
-    bool clone(const Sig& rhs) {
+    MOZ_MUST_USE bool clone(const Sig& rhs) {
         ret_ = rhs.ret_;
         MOZ_ASSERT(args_.empty());
         return args_.appendAll(rhs.args_);
     }
     Sig& operator=(Sig&& rhs) {
         ret_ = rhs.ret_;
         args_ = Move(rhs.args_);
         return *this;
@@ -643,17 +643,17 @@ enum class SymbolicAddress
     Limit
 };
 
 void*
 AddressOf(SymbolicAddress imm, ExclusiveContext* cx);
 
 // Extracts low and high from an int64 object {low: int32, high: int32}, for
 // testing purposes mainly.
-bool ReadI64Object(JSContext* cx, HandleValue v, int64_t* val);
+MOZ_MUST_USE bool ReadI64Object(JSContext* cx, HandleValue v, int64_t* val);
 
 // A wasm::JumpTarget represents one of a special set of stubs that can be
 // jumped to from any function. Because wasm modules can be larger than the
 // range of a plain jump, these potentially out-of-range jumps must be recorded
 // and patched specially by the MacroAssembler and ModuleGenerator.
 
 enum class JumpTarget
 {