Bug 1276029 - Baldr: remove unnecessary 'cx' arg from deserialize path (r=bbouvier)
authorLuke Wagner <luke@mozilla.com>
Mon, 04 Jul 2016 12:20:19 -0500
changeset 303518 a4c8c1c3ddfb6713833da131e7d7943815f8bc90
parent 303517 bd4f867547079e6c7fac90331702acb1d0e30a90
child 303519 eef71b01a8210f3e9e03328c35d31aef9872d3c1
child 303593 c9a70b64f2faa264296f0cc90d68a2ee2bac6ac5
push id79117
push userlwagner@mozilla.com
push dateMon, 04 Jul 2016 17:22:14 +0000
treeherdermozilla-inbound@a4c8c1c3ddfb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1276029
milestone50.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 1276029 - Baldr: remove unnecessary 'cx' arg from deserialize path (r=bbouvier) MozReview-Commit-ID: Asar5yECXGl
js/src/asmjs/AsmJS.cpp
js/src/asmjs/WasmCode.cpp
js/src/asmjs/WasmCode.h
js/src/asmjs/WasmModule.cpp
js/src/asmjs/WasmModule.h
js/src/asmjs/WasmSerialize.h
js/src/asmjs/WasmTypes.h
--- a/js/src/asmjs/AsmJS.cpp
+++ b/js/src/asmjs/AsmJS.cpp
@@ -8044,20 +8044,20 @@ uint8_t*
 AsmJSGlobal::serialize(uint8_t* cursor) const
 {
     cursor = WriteBytes(cursor, &pod, sizeof(pod));
     cursor = field_.serialize(cursor);
     return cursor;
 }
 
 const uint8_t*
-AsmJSGlobal::deserialize(ExclusiveContext* cx, const uint8_t* cursor)
+AsmJSGlobal::deserialize(const uint8_t* cursor)
 {
     (cursor = ReadBytes(cursor, &pod, sizeof(pod))) &&
-    (cursor = field_.deserialize(cx, cursor));
+    (cursor = field_.deserialize(cursor));
     return cursor;
 }
 
 size_t
 AsmJSGlobal::sizeOfExcludingThis(MallocSizeOf mallocSizeOf) const
 {
     return field_.sizeOfExcludingThis(mallocSizeOf);
 }
@@ -8087,27 +8087,27 @@ AsmJSMetadata::serialize(uint8_t* cursor
     cursor = SerializeVector(cursor, asmJSFuncNames);
     cursor = globalArgumentName.serialize(cursor);
     cursor = importArgumentName.serialize(cursor);
     cursor = bufferArgumentName.serialize(cursor);
     return cursor;
 }
 
 const uint8_t*
-AsmJSMetadata::deserialize(ExclusiveContext* cx, const uint8_t* cursor)
-{
-    (cursor = Metadata::deserialize(cx, cursor)) &&
+AsmJSMetadata::deserialize(const uint8_t* cursor)
+{
+    (cursor = Metadata::deserialize(cursor)) &&
     (cursor = ReadBytes(cursor, &pod(), sizeof(pod()))) &&
-    (cursor = DeserializeVector(cx, cursor, &asmJSGlobals)) &&
-    (cursor = DeserializePodVector(cx, cursor, &asmJSImports)) &&
-    (cursor = DeserializePodVector(cx, cursor, &asmJSExports)) &&
-    (cursor = DeserializeVector(cx, cursor, &asmJSFuncNames)) &&
-    (cursor = globalArgumentName.deserialize(cx, cursor)) &&
-    (cursor = importArgumentName.deserialize(cx, cursor)) &&
-    (cursor = bufferArgumentName.deserialize(cx, cursor));
+    (cursor = DeserializeVector(cursor, &asmJSGlobals)) &&
+    (cursor = DeserializePodVector(cursor, &asmJSImports)) &&
+    (cursor = DeserializePodVector(cursor, &asmJSExports)) &&
+    (cursor = DeserializeVector(cursor, &asmJSFuncNames)) &&
+    (cursor = globalArgumentName.deserialize(cursor)) &&
+    (cursor = importArgumentName.deserialize(cursor)) &&
+    (cursor = bufferArgumentName.deserialize(cursor));
     cacheResult = CacheResult::Hit;
     return cursor;
 }
 
 size_t
 AsmJSMetadata::sizeOfExcludingThis(MallocSizeOf mallocSizeOf) const
 {
     return Metadata::sizeOfExcludingThis(mallocSizeOf) +
@@ -8211,17 +8211,17 @@ class ModuleCharsForStore : ModuleChars
     }
 };
 
 class ModuleCharsForLookup : ModuleChars
 {
     Vector<char16_t, 0, SystemAllocPolicy> chars_;
 
   public:
-    const uint8_t* deserialize(ExclusiveContext* cx, const uint8_t* cursor) {
+    const uint8_t* deserialize(const uint8_t* cursor) {
         uint32_t uncompressedSize;
         cursor = ReadScalar<uint32_t>(cursor, &uncompressedSize);
 
         uint32_t compressedSize;
         cursor = ReadScalar<uint32_t>(cursor, &compressedSize);
 
         if (!chars_.resize(uncompressedSize / sizeof(char16_t)))
             return nullptr;
@@ -8230,17 +8230,17 @@ class ModuleCharsForLookup : ModuleChars
         char* dest = reinterpret_cast<char*>(chars_.begin());
         if (!LZ4::decompress(source, dest, uncompressedSize))
             return nullptr;
 
         cursor += compressedSize;
 
         cursor = ReadScalar<uint32_t>(cursor, &isFunCtor_);
         if (isFunCtor_)
-            cursor = DeserializeVector(cx, cursor, &funCtorArgs_);
+            cursor = DeserializeVector(cursor, &funCtorArgs_);
 
         return cursor;
     }
 
     bool match(AsmJSParser& parser) const {
         const char16_t* parseBegin = parser.tokenStream.rawCharPtrAt(beginOffset(parser));
         const char16_t* parseLimit = parser.tokenStream.rawLimit();
         MOZ_ASSERT(parseLimit >= parseBegin);
@@ -8369,34 +8369,36 @@ LookupAsmJSModuleInCache(ExclusiveContex
 
     ScopedCacheEntryOpenedForRead entry(cx);
     if (!open(cx->global(), begin, limit, &entry.serializedSize, &entry.memory, &entry.handle))
         return true;
 
     const uint8_t* cursor = entry.memory;
 
     MachineId cachedMachineId;
-    cursor = cachedMachineId.deserialize(cx, cursor);
+    cursor = cachedMachineId.deserialize(cursor);
     if (!cursor)
         return false;
     if (machineId != cachedMachineId)
         return true;
 
     ModuleCharsForLookup moduleChars;
-    cursor = moduleChars.deserialize(cx, cursor);
+    cursor = moduleChars.deserialize(cursor);
     if (!moduleChars.match(parser))
         return true;
 
     MutableAsmJSMetadata asmJSMetadata = cx->new_<AsmJSMetadata>();
     if (!asmJSMetadata)
         return false;
 
-    cursor = Module::deserialize(cx, cursor, module, asmJSMetadata.get());
-    if (!cursor)
-        return false;
+    cursor = Module::deserialize(cursor, module, asmJSMetadata.get());
+    if (!cursor) {
+        ReportOutOfMemory(cx);
+        return false;
+    }
 
     // See AsmJSMetadata comment as well as ModuleValidator::init().
     asmJSMetadata->srcStart = parser.pc->maybeFunction->pn_body->pn_pos.begin;
     asmJSMetadata->srcBodyStart = parser.tokenStream.currentToken().pos.end;
     asmJSMetadata->strict = parser.pc->sc->strict() && !parser.pc->sc->hasExplicitUseStrict();
     asmJSMetadata->scriptSource.reset(parser.ss);
 
     bool atEnd = cursor == entry.memory + entry.serializedSize;
--- a/js/src/asmjs/WasmCode.cpp
+++ b/js/src/asmjs/WasmCode.cpp
@@ -242,70 +242,39 @@ CodeSegment::~CodeSegment()
 
     MOZ_ASSERT(wasmCodeAllocations > 0);
     wasmCodeAllocations--;
 
     MOZ_ASSERT(totalLength() > 0);
     DeallocateExecutableMemory(bytes_, totalLength(), gc::SystemPageSize());
 }
 
-size_t
-CodeSegment::serializedSize() const
-{
-    return sizeof(uint32_t) +
-           sizeof(uint32_t) +
-           codeLength_;
-}
-
-uint8_t*
-CodeSegment::serialize(uint8_t* cursor) const
-{
-    cursor = WriteScalar<uint32_t>(cursor, codeLength_);
-    cursor = WriteScalar<uint32_t>(cursor, globalDataLength_);
-    cursor = WriteBytes(cursor, bytes_, codeLength_);
-    return cursor;
-}
-
-const uint8_t*
-CodeSegment::deserialize(ExclusiveContext* cx, const uint8_t* cursor)
-{
-    cursor = ReadScalar<uint32_t>(cursor, &codeLength_);
-    cursor = ReadScalar<uint32_t>(cursor, &globalDataLength_);
-
-    bytes_ = AllocateCodeSegment(cx, codeLength_ + globalDataLength_);
-    if (!bytes_)
-        return nullptr;
-
-    cursor = ReadBytes(cursor, bytes_, codeLength_);
-    return cursor;
-}
-
 static size_t
 SerializedSigSize(const Sig& sig)
 {
     return sizeof(ExprType) +
            SerializedPodVectorSize(sig.args());
 }
 
 static uint8_t*
 SerializeSig(uint8_t* cursor, const Sig& sig)
 {
     cursor = WriteScalar<ExprType>(cursor, sig.ret());
     cursor = SerializePodVector(cursor, sig.args());
     return cursor;
 }
 
 static const uint8_t*
-DeserializeSig(ExclusiveContext* cx, const uint8_t* cursor, Sig* sig)
+DeserializeSig(const uint8_t* cursor, Sig* sig)
 {
     ExprType ret;
     cursor = ReadScalar<ExprType>(cursor, &ret);
 
     ValTypeVector args;
-    cursor = DeserializePodVector(cx, cursor, &args);
+    cursor = DeserializePodVector(cursor, &args);
     if (!cursor)
         return nullptr;
 
     *sig = Sig(Move(args), ret);
     return cursor;
 }
 
 static size_t
@@ -325,19 +294,19 @@ uint8_t*
 Export::serialize(uint8_t* cursor) const
 {
     cursor = SerializeSig(cursor, sig_);
     cursor = WriteBytes(cursor, &pod, sizeof(pod));
     return cursor;
 }
 
 const uint8_t*
-Export::deserialize(ExclusiveContext* cx, const uint8_t* cursor)
+Export::deserialize(const uint8_t* cursor)
 {
-    (cursor = DeserializeSig(cx, cursor, &sig_)) &&
+    (cursor = DeserializeSig(cursor, &sig_)) &&
     (cursor = ReadBytes(cursor, &pod, sizeof(pod)));
     return cursor;
 }
 
 size_t
 Export::sizeOfExcludingThis(MallocSizeOf mallocSizeOf) const
 {
     return SizeOfSigExcludingThis(sig_, mallocSizeOf);
@@ -354,19 +323,19 @@ uint8_t*
 Import::serialize(uint8_t* cursor) const
 {
     cursor = SerializeSig(cursor, sig_);
     cursor = WriteBytes(cursor, &pod, sizeof(pod));
     return cursor;
 }
 
 const uint8_t*
-Import::deserialize(ExclusiveContext* cx, const uint8_t* cursor)
+Import::deserialize(const uint8_t* cursor)
 {
-    (cursor = DeserializeSig(cx, cursor, &sig_)) &&
+    (cursor = DeserializeSig(cursor, &sig_)) &&
     (cursor = ReadBytes(cursor, &pod, sizeof(pod)));
     return cursor;
 }
 
 size_t
 Import::sizeOfExcludingThis(MallocSizeOf mallocSizeOf) const
 {
     return SizeOfSigExcludingThis(sig_, mallocSizeOf);
@@ -446,23 +415,23 @@ CacheableChars::serialize(uint8_t* curso
 {
     uint32_t lengthWithNullChar = StringLengthWithNullChar(get());
     cursor = WriteScalar<uint32_t>(cursor, lengthWithNullChar);
     cursor = WriteBytes(cursor, get(), lengthWithNullChar);
     return cursor;
 }
 
 const uint8_t*
-CacheableChars::deserialize(ExclusiveContext* cx, const uint8_t* cursor)
+CacheableChars::deserialize(const uint8_t* cursor)
 {
     uint32_t lengthWithNullChar;
     cursor = ReadBytes(cursor, &lengthWithNullChar, sizeof(uint32_t));
 
     if (lengthWithNullChar) {
-        reset(cx->pod_malloc<char>(lengthWithNullChar));
+        reset(js_pod_malloc<char>(lengthWithNullChar));
         if (!get())
             return nullptr;
 
         cursor = ReadBytes(cursor, get(), lengthWithNullChar);
     } else {
         MOZ_ASSERT(!get());
     }
 
@@ -502,28 +471,28 @@ Metadata::serialize(uint8_t* cursor) con
     cursor = SerializePodVector(cursor, callSites);
     cursor = SerializePodVector(cursor, callThunks);
     cursor = SerializePodVector(cursor, funcNames);
     cursor = filename.serialize(cursor);
     return cursor;
 }
 
 /* static */ const uint8_t*
-Metadata::deserialize(ExclusiveContext* cx, const uint8_t* cursor)
+Metadata::deserialize(const uint8_t* cursor)
 {
     (cursor = ReadBytes(cursor, &pod(), sizeof(pod()))) &&
-    (cursor = DeserializeVector(cx, cursor, &imports)) &&
-    (cursor = DeserializeVector(cx, cursor, &exports)) &&
-    (cursor = DeserializePodVector(cx, cursor, &memoryAccesses)) &&
-    (cursor = DeserializePodVector(cx, cursor, &boundsChecks)) &&
-    (cursor = DeserializePodVector(cx, cursor, &codeRanges)) &&
-    (cursor = DeserializePodVector(cx, cursor, &callSites)) &&
-    (cursor = DeserializePodVector(cx, cursor, &callThunks)) &&
-    (cursor = DeserializePodVector(cx, cursor, &funcNames)) &&
-    (cursor = filename.deserialize(cx, cursor));
+    (cursor = DeserializeVector(cursor, &imports)) &&
+    (cursor = DeserializeVector(cursor, &exports)) &&
+    (cursor = DeserializePodVector(cursor, &memoryAccesses)) &&
+    (cursor = DeserializePodVector(cursor, &boundsChecks)) &&
+    (cursor = DeserializePodVector(cursor, &codeRanges)) &&
+    (cursor = DeserializePodVector(cursor, &callSites)) &&
+    (cursor = DeserializePodVector(cursor, &callThunks)) &&
+    (cursor = DeserializePodVector(cursor, &funcNames)) &&
+    (cursor = filename.deserialize(cursor));
     return cursor;
 }
 
 size_t
 Metadata::sizeOfExcludingThis(MallocSizeOf mallocSizeOf) const
 {
     return SizeOfVectorExcludingThis(imports, mallocSizeOf) +
            SizeOfVectorExcludingThis(exports, mallocSizeOf) +
--- a/js/src/asmjs/WasmCode.h
+++ b/js/src/asmjs/WasmCode.h
@@ -88,18 +88,16 @@ class CodeSegment
     // enter/exit.
 
     bool containsFunctionPC(void* pc) const {
         return pc >= code() && pc < (code() + functionCodeLength_);
     }
     bool containsCodePC(void* pc) const {
         return pc >= code() && pc < (code() + codeLength_);
     }
-
-    WASM_DECLARE_SERIALIZABLE(CodeSegment)
 };
 
 // This reusable base class factors out the logic for a resource that is shared
 // by multiple instances/modules but should only be counted once when computing
 // about:memory stats.
 
 template <class T>
 struct ShareableBase : RefCounted<T>
--- a/js/src/asmjs/WasmModule.cpp
+++ b/js/src/asmjs/WasmModule.cpp
@@ -70,20 +70,20 @@ uint8_t*
 LinkData::SymbolicLinkArray::serialize(uint8_t* cursor) const
 {
     for (const Uint32Vector& offsets : *this)
         cursor = SerializePodVector(cursor, offsets);
     return cursor;
 }
 
 const uint8_t*
-LinkData::SymbolicLinkArray::deserialize(ExclusiveContext* cx, const uint8_t* cursor)
+LinkData::SymbolicLinkArray::deserialize(const uint8_t* cursor)
 {
     for (Uint32Vector& offsets : *this) {
-        cursor = DeserializePodVector(cx, cursor, &offsets);
+        cursor = DeserializePodVector(cursor, &offsets);
         if (!cursor)
             return nullptr;
     }
     return cursor;
 }
 
 size_t
 LinkData::SymbolicLinkArray::sizeOfExcludingThis(MallocSizeOf mallocSizeOf) const
@@ -105,20 +105,20 @@ uint8_t*
 LinkData::FuncTable::serialize(uint8_t* cursor) const
 {
     cursor = WriteBytes(cursor, &globalDataOffset, sizeof(globalDataOffset));
     cursor = SerializePodVector(cursor, elemOffsets);
     return cursor;
 }
 
 const uint8_t*
-LinkData::FuncTable::deserialize(ExclusiveContext* cx, const uint8_t* cursor)
+LinkData::FuncTable::deserialize(const uint8_t* cursor)
 {
     (cursor = ReadBytes(cursor, &globalDataOffset, sizeof(globalDataOffset))) &&
-    (cursor = DeserializePodVector(cx, cursor, &elemOffsets));
+    (cursor = DeserializePodVector(cursor, &elemOffsets));
     return cursor;
 }
 
 size_t
 LinkData::FuncTable::sizeOfExcludingThis(MallocSizeOf mallocSizeOf) const
 {
     return elemOffsets.sizeOfExcludingThis(mallocSizeOf);
 }
@@ -138,22 +138,22 @@ LinkData::serialize(uint8_t* cursor) con
     cursor = WriteBytes(cursor, &pod(), sizeof(pod()));
     cursor = SerializePodVector(cursor, internalLinks);
     cursor = symbolicLinks.serialize(cursor);
     cursor = SerializeVector(cursor, funcTables);
     return cursor;
 }
 
 const uint8_t*
-LinkData::deserialize(ExclusiveContext* cx, const uint8_t* cursor)
+LinkData::deserialize(const uint8_t* cursor)
 {
     (cursor = ReadBytes(cursor, &pod(), sizeof(pod()))) &&
-    (cursor = DeserializePodVector(cx, cursor, &internalLinks)) &&
-    (cursor = symbolicLinks.deserialize(cx, cursor)) &&
-    (cursor = DeserializeVector(cx, cursor, &funcTables));
+    (cursor = DeserializePodVector(cursor, &internalLinks)) &&
+    (cursor = symbolicLinks.deserialize(cursor)) &&
+    (cursor = DeserializeVector(cursor, &funcTables));
     return cursor;
 }
 
 size_t
 LinkData::sizeOfExcludingThis(MallocSizeOf mallocSizeOf) const
 {
     return internalLinks.sizeOfExcludingThis(mallocSizeOf) +
            symbolicLinks.sizeOfExcludingThis(mallocSizeOf) +
@@ -171,20 +171,20 @@ uint8_t*
 ImportName::serialize(uint8_t* cursor) const
 {
     cursor = module.serialize(cursor);
     cursor = func.serialize(cursor);
     return cursor;
 }
 
 const uint8_t*
-ImportName::deserialize(ExclusiveContext* cx, const uint8_t* cursor)
+ImportName::deserialize(const uint8_t* cursor)
 {
-    (cursor = module.deserialize(cx, cursor)) &&
-    (cursor = func.deserialize(cx, cursor));
+    (cursor = module.deserialize(cursor)) &&
+    (cursor = func.deserialize(cursor));
     return cursor;
 }
 
 size_t
 ImportName::sizeOfExcludingThis(MallocSizeOf mallocSizeOf) const
 {
     return module.sizeOfExcludingThis(mallocSizeOf) +
            func.sizeOfExcludingThis(mallocSizeOf);
@@ -201,20 +201,20 @@ uint8_t*
 ExportMap::serialize(uint8_t* cursor) const
 {
     cursor = SerializeVector(cursor, fieldNames);
     cursor = SerializePodVector(cursor, fieldsToExports);
     return cursor;
 }
 
 const uint8_t*
-ExportMap::deserialize(ExclusiveContext* cx, const uint8_t* cursor)
+ExportMap::deserialize(const uint8_t* cursor)
 {
-    (cursor = DeserializeVector(cx, cursor, &fieldNames)) &&
-    (cursor = DeserializePodVector(cx, cursor, &fieldsToExports));
+    (cursor = DeserializeVector(cursor, &fieldNames)) &&
+    (cursor = DeserializePodVector(cursor, &fieldsToExports));
     return cursor;
 }
 
 size_t
 ExportMap::sizeOfExcludingThis(MallocSizeOf mallocSizeOf) const
 {
     return SizeOfVectorExcludingThis(fieldNames, mallocSizeOf) &&
            fieldsToExports.sizeOfExcludingThis(mallocSizeOf);
@@ -241,71 +241,70 @@ Module::serialize(uint8_t* cursor) const
     cursor = exportMap_.serialize(cursor);
     cursor = SerializePodVector(cursor, dataSegments_);
     cursor = metadata_->serialize(cursor);
     cursor = SerializePodVector(cursor, bytecode_->bytes);
     return cursor;
 }
 
 /* static */ const uint8_t*
-Module::deserialize(ExclusiveContext* cx, const uint8_t* cursor, UniquePtr<Module>* module,
-                    Metadata* maybeMetadata)
+Module::deserialize(const uint8_t* cursor, UniquePtr<Module>* module, Metadata* maybeMetadata)
 {
     Bytes code;
-    cursor = DeserializePodVector(cx, cursor, &code);
+    cursor = DeserializePodVector(cursor, &code);
     if (!cursor)
         return nullptr;
 
     LinkData linkData;
-    cursor = linkData.deserialize(cx, cursor);
+    cursor = linkData.deserialize(cursor);
     if (!cursor)
         return nullptr;
 
     ImportNameVector importNames;
-    cursor = DeserializeVector(cx, cursor, &importNames);
+    cursor = DeserializeVector(cursor, &importNames);
     if (!cursor)
         return nullptr;
 
     ExportMap exportMap;
-    cursor = exportMap.deserialize(cx, cursor);
+    cursor = exportMap.deserialize(cursor);
     if (!cursor)
         return nullptr;
 
     DataSegmentVector dataSegments;
-    cursor = DeserializePodVector(cx, cursor, &dataSegments);
+    cursor = DeserializePodVector(cursor, &dataSegments);
     if (!cursor)
         return nullptr;
 
     MutableMetadata metadata;
     if (maybeMetadata) {
         metadata = maybeMetadata;
     } else {
-        metadata = cx->new_<Metadata>();
+        metadata = js_new<Metadata>();
         if (!metadata)
             return nullptr;
     }
-    cursor = metadata->deserialize(cx, cursor);
+    cursor = metadata->deserialize(cursor);
     if (!cursor)
         return nullptr;
     MOZ_RELEASE_ASSERT(!!maybeMetadata == metadata->isAsmJS());
 
-    MutableBytes bytecode = cx->new_<ShareableBytes>();
+    MutableBytes bytecode = js_new<ShareableBytes>();
     if (!bytecode)
         return nullptr;
-    cursor = DeserializePodVector(cx, cursor, &bytecode->bytes);
+    cursor = DeserializePodVector(cursor, &bytecode->bytes);
     if (!cursor)
         return nullptr;
 
-    *module = cx->make_unique<Module>(Move(code),
-                                      Move(linkData),
-                                      Move(importNames),
-                                      Move(exportMap),
-                                      Move(dataSegments),
-                                      *metadata,
-                                      *bytecode);
+    *module = js::MakeUnique<Module>(Move(code),
+                                     Move(linkData),
+                                     Move(importNames),
+                                     Move(exportMap),
+                                     Move(dataSegments),
+                                     *metadata,
+                                     *bytecode);
     if (!*module)
         return nullptr;
 
     return cursor;
 }
 
 /* virtual */ void
 Module::addSizeOfMisc(MallocSizeOf mallocSizeOf,
--- a/js/src/asmjs/WasmModule.h
+++ b/js/src/asmjs/WasmModule.h
@@ -192,18 +192,17 @@ class Module
                      Handle<FunctionVector> funcImports,
                      Handle<ArrayBufferObjectMaybeShared*> asmJSHeap,
                      HandleWasmInstanceObject instanceObj) const;
 
     // Structured clone support:
 
     size_t serializedSize() const;
     uint8_t* serialize(uint8_t* cursor) const;
-    static const uint8_t* deserialize(ExclusiveContext* cx, const uint8_t* cursor,
-                                      UniquePtr<Module>* module,
+    static const uint8_t* deserialize(const uint8_t* cursor, UniquePtr<Module>* module,
                                       Metadata* maybeMetadata = nullptr);
 
     // about:memory reporting:
 
     void addSizeOfMisc(MallocSizeOf mallocSizeOf,
                        Metadata::SeenSet* seenMetadata,
                        ShareableBytes::SeenSet* seenBytes,
                        size_t* code, size_t* data) const;
--- a/js/src/asmjs/WasmSerialize.h
+++ b/js/src/asmjs/WasmSerialize.h
@@ -74,25 +74,24 @@ SerializeVector(uint8_t* cursor, const m
     cursor = WriteScalar<uint32_t>(cursor, vec.length());
     for (size_t i = 0; i < vec.length(); i++)
         cursor = vec[i].serialize(cursor);
     return cursor;
 }
 
 template <class T, size_t N>
 static inline const uint8_t*
-DeserializeVector(ExclusiveContext* cx, const uint8_t* cursor,
-                  mozilla::Vector<T, N, SystemAllocPolicy>* vec)
+DeserializeVector(const uint8_t* cursor, mozilla::Vector<T, N, SystemAllocPolicy>* vec)
 {
     uint32_t length;
     cursor = ReadScalar<uint32_t>(cursor, &length);
     if (!vec->resize(length))
         return nullptr;
     for (size_t i = 0; i < vec->length(); i++) {
-        if (!(cursor = (*vec)[i].deserialize(cx, cursor)))
+        if (!(cursor = (*vec)[i].deserialize(cursor)))
             return nullptr;
     }
     return cursor;
 }
 
 template <class T, size_t N>
 static inline size_t
 SizeOfVectorExcludingThis(const mozilla::Vector<T, N, SystemAllocPolicy>& vec,
@@ -118,18 +117,17 @@ SerializePodVector(uint8_t* cursor, cons
 {
     cursor = WriteScalar<uint32_t>(cursor, vec.length());
     cursor = WriteBytes(cursor, vec.begin(), vec.length() * sizeof(T));
     return cursor;
 }
 
 template <class T, size_t N>
 static inline const uint8_t*
-DeserializePodVector(ExclusiveContext* cx, const uint8_t* cursor,
-                     mozilla::Vector<T, N, SystemAllocPolicy>* vec)
+DeserializePodVector(const uint8_t* cursor, mozilla::Vector<T, N, SystemAllocPolicy>* vec)
 {
     uint32_t length;
     cursor = ReadScalar<uint32_t>(cursor, &length);
     if (!vec->initLengthUninitialized(length))
         return nullptr;
     cursor = ReadBytes(cursor, vec->begin(), length * sizeof(T));
     return cursor;
 }
@@ -193,19 +191,19 @@ class MachineId
     }
 
     uint8_t* serialize(uint8_t* cursor) const {
         cursor = WriteScalar<uint32_t>(cursor, cpuId_);
         cursor = SerializePodVector(cursor, buildId_);
         return cursor;
     }
 
-    const uint8_t* deserialize(ExclusiveContext* cx, const uint8_t* cursor) {
+    const uint8_t* deserialize(const uint8_t* cursor) {
         (cursor = ReadScalar<uint32_t>(cursor, &cpuId_)) &&
-        (cursor = DeserializePodVector(cx, cursor, &buildId_));
+        (cursor = DeserializePodVector(cursor, &buildId_));
         return cursor;
     }
 
     bool operator==(const MachineId& rhs) const {
         return cpuId_ == rhs.cpuId_ &&
                buildId_.length() == rhs.buildId_.length() &&
                mozilla::PodEqual(buildId_.begin(), rhs.buildId_.begin(), buildId_.length());
     }
--- a/js/src/asmjs/WasmTypes.h
+++ b/js/src/asmjs/WasmTypes.h
@@ -67,29 +67,29 @@ typedef Vector<Type, 0, SystemAllocPolic
 // deserialization. Some data can be simply copied as raw bytes and,
 // 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.
 
 #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);    \
+    const uint8_t* deserialize(const uint8_t* cursor);                          \
     size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
 
 #define WASM_DECLARE_SERIALIZABLE_VIRTUAL(Type)                                 \
     virtual size_t serializedSize() const;                                      \
     virtual uint8_t* serialize(uint8_t* cursor) const;                          \
-    virtual const uint8_t* deserialize(ExclusiveContext* cx, const uint8_t* cursor);\
+    virtual const uint8_t* deserialize(const uint8_t* cursor);                  \
     virtual size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
 
 #define WASM_DECLARE_SERIALIZABLE_OVERRIDE(Type)                                \
     size_t serializedSize() const override;                                     \
     uint8_t* serialize(uint8_t* cursor) const override;                         \
-    const uint8_t* deserialize(ExclusiveContext* cx, const uint8_t* cursor) override;\
+    const uint8_t* deserialize(const uint8_t* cursor) override;                 \
     size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const override;
 
 // ValType/ExprType utilities
 
 // ExprType::Limit is an out-of-band value and has no wasm-semantic meaning. For
 // the purpose of recursive validation, we use this value to represent the type
 // of branch/return instructions that don't actually return to the parent
 // expression and can thus be used in any context.