Bug 1284056 - Baldr: remove cx_ from ModuleGenerator (r=bbouvier)
authorLuke Wagner <luke@mozilla.com>
Wed, 06 Jul 2016 08:36:23 -0500
changeset 343968 433ae510d1fdba13129e3d70da08a778fdca9ebf
parent 343967 1647bedef92ee1a31784306083b28f1a17e43696
child 343969 8aeb6b6748db11237c385c7f7aa9d2fc6ab100f1
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1284056
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 1284056 - Baldr: remove cx_ from ModuleGenerator (r=bbouvier) MozReview-Commit-ID: 9UeeVdogeAR
js/src/asmjs/AsmJS.cpp
js/src/asmjs/WasmCompile.cpp
js/src/asmjs/WasmCompile.h
js/src/asmjs/WasmGenerator.cpp
js/src/asmjs/WasmGenerator.h
js/src/asmjs/WasmIonCompile.cpp
js/src/asmjs/WasmJS.cpp
js/src/vm/HelperThreads.cpp
js/src/vm/HelperThreads.h
--- a/js/src/asmjs/AsmJS.cpp
+++ b/js/src/asmjs/AsmJS.cpp
@@ -1656,17 +1656,16 @@ class MOZ_STACK_CLASS ModuleValidator
         validationLifo_(VALIDATION_LIFO_DEFAULT_CHUNK_SIZE),
         functions_(cx),
         funcPtrTables_(cx),
         globalMap_(cx),
         sigMap_(cx),
         importMap_(cx),
         arrayViews_(cx),
         atomicsPresent_(false),
-        mg_(cx),
         errorString_(nullptr),
         errorOffset_(UINT32_MAX),
         errorOverRecursed_(false)
     {}
 
     ~ModuleValidator() {
         if (errorString_) {
             MOZ_ASSERT(errorOffset_ != UINT32_MAX);
@@ -1749,38 +1748,37 @@ class MOZ_STACK_CLASS ModuleValidator
 
         // This flows into FunctionBox, so must be tenured.
         dummyFunction_ = NewScriptedFunction(cx_, 0, JSFunction::INTERPRETED, nullptr,
                                              /* proto = */ nullptr, gc::AllocKind::FUNCTION,
                                              TenuredObject);
         if (!dummyFunction_)
             return false;
 
-        Assumptions assumptions;
-        if (!assumptions.init(SignalUsage(cx_), cx_->buildIdOp()))
-            return false;
-
-        auto genData = MakeUnique<ModuleGeneratorData>(assumptions.usesSignal, ModuleKind::AsmJS);
+        CompileArgs args;
+        if (!args.assumptions.init(SignalUsage(cx_), cx_->buildIdOp()))
+            return false;
+
+        auto genData = MakeUnique<ModuleGeneratorData>(args.assumptions.usesSignal, ModuleKind::AsmJS);
         if (!genData ||
             !genData->sigs.resize(MaxSigs) ||
             !genData->funcSigs.resize(MaxFuncs) ||
             !genData->imports.resize(MaxImports) ||
             !genData->asmJSSigToTable.resize(MaxTables))
         {
             return false;
         }
 
-        CacheableChars filename;
         if (parser_.ss->filename()) {
-            filename = DuplicateString(parser_.ss->filename());
-            if (!filename)
+            args.filename = DuplicateString(parser_.ss->filename());
+            if (!args.filename)
                 return false;
         }
 
-        if (!mg_.init(Move(genData), Move(filename), Move(assumptions), asmJSMetadata_.get()))
+        if (!mg_.init(Move(genData), Move(args), asmJSMetadata_.get()))
             return false;
 
         mg_.bumpMinHeapLength(asmJSMetadata_->minHeapLength);
 
         return true;
     }
 
     ExclusiveContext* cx() const             { return cx_; }
--- a/js/src/asmjs/WasmCompile.cpp
+++ b/js/src/asmjs/WasmCompile.cpp
@@ -1078,19 +1078,19 @@ DecodeUnknownSections(JSContext* cx, Dec
         if (!d.skipSection())
             return Fail(cx, d, "failed to skip unknown section at end");
     }
 
     return true;
 }
 
 static UniqueModule
-DecodeModule(JSContext* cx, UniqueChars file, Assumptions&& assumptions, const ShareableBytes& bytecode)
+DecodeModule(JSContext* cx, const ShareableBytes& bytecode, CompileArgs&& args)
 {
-    auto init = js::MakeUnique<ModuleGeneratorData>(assumptions.usesSignal);
+    auto init = js::MakeUnique<ModuleGeneratorData>(args.assumptions.usesSignal);
     if (!init)
         return nullptr;
 
     Decoder d(bytecode.begin(), bytecode.end());
 
     if (!DecodePreamble(cx, d))
         return nullptr;
 
@@ -1102,18 +1102,18 @@ DecodeModule(JSContext* cx, UniqueChars 
         return nullptr;
 
     if (!DecodeFunctionSection(cx, d, init.get()))
         return nullptr;
 
     if (!DecodeTableSection(cx, d, init.get()))
         return nullptr;
 
-    ModuleGenerator mg(cx);
-    if (!mg.init(Move(init), Move(file), Move(assumptions)))
+    ModuleGenerator mg;
+    if (!mg.init(Move(init), Move(args)))
         return nullptr;
 
     if (!DecodeMemorySection(cx, d, mg))
         return nullptr;
 
     if (!DecodeExportSection(cx, d, mg))
         return nullptr;
 
@@ -1128,25 +1128,25 @@ DecodeModule(JSContext* cx, UniqueChars 
 
     if (!DecodeUnknownSections(cx, d))
         return nullptr;
 
     return mg.finish(Move(importNames), bytecode);
 }
 
 UniqueModule
-wasm::Compile(JSContext* cx, UniqueChars file, Assumptions&& assumptions, Bytes&& bytecode)
+wasm::Compile(JSContext* cx, Bytes&& bytecode, CompileArgs&& args)
 {
     MOZ_ASSERT(HasCompilerSupport(cx));
 
     SharedBytes sharedBytes = cx->new_<ShareableBytes>(Move(bytecode));
     if (!sharedBytes)
         return nullptr;
 
-    UniqueModule module = DecodeModule(cx, Move(file), Move(assumptions), *sharedBytes);
+    UniqueModule module = DecodeModule(cx, *sharedBytes, Move(args));
     if (!module) {
         if (!cx->isExceptionPending())
             ReportOutOfMemory(cx);
         return nullptr;
     }
 
     return module;
 }
--- a/js/src/asmjs/WasmCompile.h
+++ b/js/src/asmjs/WasmCompile.h
@@ -21,18 +21,27 @@
 
 #include "asmjs/WasmBinary.h"
 #include "asmjs/WasmJS.h"
 #include "asmjs/WasmTypes.h"
 
 namespace js {
 namespace wasm {
 
-// Compile the given WebAssembly bytecode with the given filename into a
-// wasm::Module.
+// Compile the given WebAssembly bytecode with the given assumptions, settings
+// and filename into a wasm::Module.
+
+struct CompileArgs
+{
+    Assumptions assumptions;
+    UniqueChars filename;
+    bool alwaysBaseline;
+
+    CompileArgs() : alwaysBaseline(false) {}
+};
 
 UniqueModule
-Compile(JSContext* cx, UniqueChars filename, Assumptions&& assumptions, Bytes&& code);
+Compile(JSContext* cx, Bytes&& code, CompileArgs&& compileArgs);
 
 }  // namespace wasm
 }  // namespace js
 
 #endif // namespace wasm_compile_h
--- a/js/src/asmjs/WasmGenerator.cpp
+++ b/js/src/asmjs/WasmGenerator.cpp
@@ -35,49 +35,46 @@ using mozilla::CheckedInt;
 using mozilla::MakeEnumeratedRange;
 
 // ****************************************************************************
 // ModuleGenerator
 
 static const unsigned GENERATOR_LIFO_DEFAULT_CHUNK_SIZE = 4 * 1024;
 static const unsigned COMPILATION_LIFO_DEFAULT_CHUNK_SIZE = 64 * 1024;
 
-ModuleGenerator::ModuleGenerator(ExclusiveContext* cx)
-  : cx_(cx),
+ModuleGenerator::ModuleGenerator()
+  : alwaysBaseline_(false),
     numSigs_(0),
     lifo_(GENERATOR_LIFO_DEFAULT_CHUNK_SIZE),
     masmAlloc_(&lifo_),
     masm_(MacroAssembler::AsmJSToken(), masmAlloc_),
-    funcIndexToExport_(cx),
     lastPatchedCallsite_(0),
     startOfUnpatchedBranches_(0),
     parallel_(false),
     outstanding_(0),
-    tasks_(cx),
-    freeTasks_(cx),
     activeFunc_(nullptr),
     startedFuncDefs_(false),
     finishedFuncDefs_(false)
 {
     MOZ_ASSERT(IsCompilingAsmJS());
 }
 
 ModuleGenerator::~ModuleGenerator()
 {
     if (parallel_) {
         // Wait for any outstanding jobs to fail or complete.
         if (outstanding_) {
             AutoLockHelperThreadState lock;
             while (true) {
-                IonCompileTaskVector& worklist = HelperThreadState().wasmWorklist();
+                IonCompileTaskPtrVector& worklist = HelperThreadState().wasmWorklist();
                 MOZ_ASSERT(outstanding_ >= worklist.length());
                 outstanding_ -= worklist.length();
                 worklist.clear();
 
-                IonCompileTaskVector& finished = HelperThreadState().wasmFinishedList();
+                IonCompileTaskPtrVector& finished = HelperThreadState().wasmFinishedList();
                 MOZ_ASSERT(outstanding_ >= finished.length());
                 outstanding_ -= finished.length();
                 finished.clear();
 
                 uint32_t numFailed = HelperThreadState().harvestFailedWasmJobs();
                 MOZ_ASSERT(outstanding_ >= numFailed);
                 outstanding_ -= numFailed;
 
@@ -91,37 +88,40 @@ ModuleGenerator::~ModuleGenerator()
         MOZ_ASSERT(HelperThreadState().wasmCompilationInProgress);
         HelperThreadState().wasmCompilationInProgress = false;
     } else {
         MOZ_ASSERT(!outstanding_);
     }
 }
 
 bool
-ModuleGenerator::init(UniqueModuleGeneratorData shared, UniqueChars file, Assumptions&& assumptions,
-                      Metadata* maybeMetadata)
+ModuleGenerator::init(UniqueModuleGeneratorData shared, CompileArgs&& args,
+                      Metadata* maybeAsmJSMetadata)
 {
+    alwaysBaseline_ = args.alwaysBaseline;
+
     if (!funcIndexToExport_.init())
         return false;
 
     linkData_.globalDataLength = AlignBytes(InitialGlobalDataBytes, sizeof(void*));;
 
     // asm.js passes in an AsmJSMetadata subclass to use instead.
-    if (maybeMetadata) {
-        metadata_ = maybeMetadata;
+    if (maybeAsmJSMetadata) {
+        MOZ_ASSERT(shared->kind == ModuleKind::AsmJS);
+        metadata_ = maybeAsmJSMetadata;
     } else {
         metadata_ = js_new<Metadata>();
         if (!metadata_)
             return false;
     }
 
     metadata_->kind = shared->kind;
     metadata_->heapUsage = HeapUsage::None;
-    metadata_->filename = Move(file);
-    metadata_->assumptions = Move(assumptions);
+    metadata_->filename = Move(args.filename);
+    metadata_->assumptions = Move(args.assumptions);
 
     shared_ = Move(shared);
 
     // For asm.js, the Vectors in ModuleGeneratorData are max-sized reservations
     // and will be initialized in a linear order via init* functions as the
     // module is generated. For wasm, the Vectors are correctly-sized and
     // already initialized.
 
@@ -193,27 +193,27 @@ ModuleGenerator::funcCodeRange(uint32_t 
 }
 
 static uint32_t
 JumpRange()
 {
     return Min(JitOptions.jumpThreshold, JumpImmediateRange);
 }
 
-typedef HashMap<uint32_t, uint32_t> OffsetMap;
+typedef HashMap<uint32_t, uint32_t, DefaultHasher<uint32_t>, SystemAllocPolicy> OffsetMap;
 
 bool
 ModuleGenerator::convertOutOfRangeBranchesToThunks()
 {
     masm_.haltingAlign(CodeAlignment);
 
     // Create thunks for callsites that have gone out of range. Use a map to
     // create one thunk for each callee since there is often high reuse.
 
-    OffsetMap alreadyThunked(cx_);
+    OffsetMap alreadyThunked;
     if (!alreadyThunked.init())
         return false;
 
     for (; lastPatchedCallsite_ < masm_.callSites().length(); lastPatchedCallsite_++) {
         const CallSiteAndTarget& cs = masm_.callSites()[lastPatchedCallsite_];
         if (!cs.isInternal())
             continue;
 
@@ -322,28 +322,31 @@ ModuleGenerator::finishTask(IonCompileTa
     if (!masm_.asmMergeWith(results.masm()))
         return false;
     MOZ_ASSERT(masm_.size() == offsetInWhole + results.masm().size());
 
     freeTasks_.infallibleAppend(task);
     return true;
 }
 
+typedef Vector<Offsets, 0, SystemAllocPolicy> OffsetVector;
+typedef Vector<ProfilingOffsets, 0, SystemAllocPolicy> ProfilingOffsetVector;
+
 bool
 ModuleGenerator::finishCodegen()
 {
     uint32_t offsetInWhole = masm_.size();
 
     // Generate stubs in a separate MacroAssembler since, otherwise, for modules
     // larger than the JumpImmediateRange, even local uses of Label will fail
     // due to the large absolute offsets temporarily stored by Label::bind().
 
-    Vector<Offsets> entries(cx_);
-    Vector<ProfilingOffsets> interpExits(cx_);
-    Vector<ProfilingOffsets> jitExits(cx_);
+    OffsetVector entries;
+    ProfilingOffsetVector interpExits;
+    ProfilingOffsetVector jitExits;
     EnumeratedArray<JumpTarget, JumpTarget::Limit, Offsets> jumpTargets;
     Offsets interruptExit;
 
     {
         TempAllocator alloc(&lifo_);
         MacroAssembler masm(MacroAssembler::AsmJSToken(), alloc);
 
         if (!entries.resize(numExports()))
@@ -795,41 +798,34 @@ ModuleGenerator::startFuncDef(uint32_t l
     fg->task_ = task;
     activeFunc_ = fg;
     return true;
 }
 
 bool
 ModuleGenerator::finishFuncDef(uint32_t funcIndex, FunctionGenerator* fg)
 {
-    TraceLoggerThread* logger = nullptr;
-    if (cx_->isJSContext())
-        logger = TraceLoggerForMainThread(cx_->asJSContext()->runtime());
-    else
-        logger = TraceLoggerForCurrentThread();
-    AutoTraceLog logCompile(logger, TraceLogger_WasmCompilation);
-
     MOZ_ASSERT(activeFunc_ == fg);
 
     auto func = js::MakeUnique<FuncBytes>(Move(fg->bytes_),
                                           funcIndex,
                                           funcSig(funcIndex),
                                           fg->lineOrBytecode_,
                                           Move(fg->callSiteLineNums_));
     if (!func)
         return false;
 
-    JSRuntime* rt = cx_->compartment()->runtimeFromAnyThread();
-    bool baselineCompile = rt->options().wasmAlwaysBaseline() && BaselineCanCompile(fg);
+    auto mode = alwaysBaseline_ && BaselineCanCompile(fg)
+                ? IonCompileTask::CompileMode::Baseline
+                : IonCompileTask::CompileMode::Ion;
 
-    fg->task_->init(Move(func), baselineCompile ? IonCompileTask::CompileMode::Baseline
-                                                : IonCompileTask::CompileMode::Ion);
+    fg->task_->init(Move(func), mode);
 
     if (parallel_) {
-        if (!StartOffThreadWasmCompile(cx_, fg->task_))
+        if (!StartOffThreadWasmCompile(fg->task_))
             return false;
         outstanding_++;
     } else {
         if (!CompileFunction(fg->task_))
             return false;
         if (!finishTask(fg->task_))
             return false;
     }
@@ -952,16 +948,16 @@ ModuleGenerator::finish(ImportNameVector
         MOZ_ASSERT(codeRange.begin() >= lastEnd);
         lastEnd = codeRange.end();
     }
 #endif
 
     if (!finishLinkData(code))
         return nullptr;
 
-    return cx_->make_unique<Module>(Move(code),
-                                    Move(linkData_),
-                                    Move(importNames),
-                                    Move(exportMap_),
-                                    Move(dataSegments_),
-                                    *metadata_,
-                                    bytecode);
+    return js::MakeUnique<Module>(Move(code),
+                                  Move(linkData_),
+                                  Move(importNames),
+                                  Move(exportMap_),
+                                  Move(dataSegments_),
+                                  *metadata_,
+                                  bytecode);
 }
--- a/js/src/asmjs/WasmGenerator.h
+++ b/js/src/asmjs/WasmGenerator.h
@@ -15,16 +15,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 #ifndef wasm_generator_h
 #define wasm_generator_h
 
 #include "asmjs/WasmBinary.h"
+#include "asmjs/WasmCompile.h"
 #include "asmjs/WasmModule.h"
 #include "jit/MacroAssembler.h"
 
 namespace js {
 namespace wasm {
 
 class FunctionGenerator;
 
@@ -87,19 +88,22 @@ typedef UniquePtr<ModuleGeneratorData> U
 // A ModuleGenerator encapsulates the creation of a wasm module. During the
 // lifetime of a ModuleGenerator, a sequence of FunctionGenerators are created
 // and destroyed to compile the individual function bodies. After generating all
 // functions, ModuleGenerator::finish() must be called to complete the
 // compilation and extract the resulting wasm module.
 
 class MOZ_STACK_CLASS ModuleGenerator
 {
-    typedef HashMap<uint32_t, uint32_t> FuncIndexMap;
+    typedef HashMap<uint32_t, uint32_t, DefaultHasher<uint32_t>, SystemAllocPolicy> FuncIndexMap;
+    typedef Vector<IonCompileTask, 0, SystemAllocPolicy> IonCompileTaskVector;
+    typedef Vector<IonCompileTask*, 0, SystemAllocPolicy> IonCompileTaskPtrVector;
 
-    ExclusiveContext*               cx_;
+    // Constant parameters
+    bool                            alwaysBaseline_;
 
     // Data that is moved into the result of finish()
     LinkData                        linkData_;
     MutableMetadata                 metadata_;
     ExportMap                       exportMap_;
     DataSegmentVector               dataSegments_;
 
     // Data scoped to the ModuleGenerator's lifetime
@@ -113,18 +117,18 @@ class MOZ_STACK_CLASS ModuleGenerator
     FuncIndexMap                    funcIndexToExport_;
     uint32_t                        lastPatchedCallsite_;
     uint32_t                        startOfUnpatchedBranches_;
     JumpSiteArray                   jumpThunks_;
 
     // Parallel compilation
     bool                            parallel_;
     uint32_t                        outstanding_;
-    Vector<IonCompileTask>          tasks_;
-    Vector<IonCompileTask*>         freeTasks_;
+    IonCompileTaskVector            tasks_;
+    IonCompileTaskPtrVector         freeTasks_;
 
     // Assertions
     DebugOnly<FunctionGenerator*>   activeFunc_;
     DebugOnly<bool>                 startedFuncDefs_;
     DebugOnly<bool>                 finishedFuncDefs_;
 
     MOZ_MUST_USE bool finishOutstandingTask();
     bool funcIsDefined(uint32_t funcIndex) const;
@@ -132,23 +136,21 @@ class MOZ_STACK_CLASS ModuleGenerator
     MOZ_MUST_USE bool convertOutOfRangeBranchesToThunks();
     MOZ_MUST_USE bool finishTask(IonCompileTask* task);
     MOZ_MUST_USE bool finishCodegen();
     MOZ_MUST_USE bool finishLinkData(Bytes& code);
     MOZ_MUST_USE bool addImport(const Sig& sig, uint32_t globalDataOffset);
     MOZ_MUST_USE bool allocateGlobalBytes(uint32_t bytes, uint32_t align, uint32_t* globalDataOff);
 
   public:
-    explicit ModuleGenerator(ExclusiveContext* cx);
+    explicit ModuleGenerator();
     ~ModuleGenerator();
 
-    MOZ_MUST_USE bool init(UniqueModuleGeneratorData shared,
-                           UniqueChars filename,
-                           Assumptions&& assumptions,
-                           Metadata* maybeMetadata = nullptr);
+    MOZ_MUST_USE bool init(UniqueModuleGeneratorData shared, CompileArgs&& args,
+                           Metadata* maybeAsmJSMetadata = nullptr);
 
     bool isAsmJS() const { return metadata_->kind == ModuleKind::AsmJS; }
     SignalUsage usesSignal() const { return metadata_->assumptions.usesSignal; }
     jit::MacroAssembler& masm() { return masm_; }
 
     // Heap usage:
     void initHeapUsage(HeapUsage heapUsage, uint32_t initialHeapLength = 0);
     bool usesHeap() const;
--- a/js/src/asmjs/WasmIonCompile.cpp
+++ b/js/src/asmjs/WasmIonCompile.cpp
@@ -3436,19 +3436,22 @@ wasm::IonCompileFunction(IonCompileTask*
     }
 
     return true;
 }
 
 bool
 wasm::CompileFunction(IonCompileTask* task)
 {
+    TraceLoggerThread* logger = TraceLoggerForCurrentThread();
+    AutoTraceLog logCompile(logger, TraceLogger_WasmCompilation);
+
     switch (task->mode()) {
       case wasm::IonCompileTask::CompileMode::Ion:
         return wasm::IonCompileFunction(task);
       case wasm::IonCompileTask::CompileMode::Baseline:
         return wasm::BaselineCompileFunction(task);
       case wasm::IonCompileTask::CompileMode::None:
-        MOZ_CRASH("Uninitialized task");
+        break;
     }
-    // Silence gcc 5.2.1 warning.
-    return false;
+
+    MOZ_CRASH("Uninitialized task");
 }
--- a/js/src/asmjs/WasmJS.cpp
+++ b/js/src/asmjs/WasmJS.cpp
@@ -117,29 +117,28 @@ wasm::Eval(JSContext* cx, Handle<TypedAr
 {
     if (!CheckCompilerSupport(cx))
         return false;
 
     Bytes bytecode;
     if (!bytecode.append((uint8_t*)code->viewDataEither().unwrap(), code->byteLength()))
         return false;
 
-    UniqueChars filename;
+    CompileArgs compileArgs;
+    if (!compileArgs.assumptions.init(SignalUsage(cx), cx->buildIdOp()))
+        return true;
+
     JS::AutoFilename af;
     if (DescribeScriptedCaller(cx, &af)) {
-        filename = DuplicateString(cx, af.get());
-        if (!filename)
+        compileArgs.filename = DuplicateString(cx, af.get());
+        if (!compileArgs.filename)
             return false;
     }
 
-    Assumptions assumptions;
-    if (!assumptions.init(SignalUsage(cx), cx->buildIdOp()))
-        return true;
-
-    UniqueModule module = Compile(cx, Move(filename), Move(assumptions), Move(bytecode));
+    UniqueModule module = Compile(cx, Move(bytecode), Move(compileArgs));
     if (!module)
         return false;
 
     Rooted<FunctionVector> funcImports(cx, FunctionVector(cx));
     if (!ImportFunctions(cx, importObj, module->importNames(), &funcImports))
         return false;
 
     instanceObj.set(WasmInstanceObject::create(cx));
@@ -310,32 +309,31 @@ ModuleConstructor(JSContext* cx, unsigne
         ArrayBufferObject& buffer = args[0].toObject().as<ArrayBufferObject>();
         if (!bytecode.append(buffer.dataPointer(), buffer.byteLength()))
             return false;
     } else {
         JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_WASM_BAD_BUF_ARG);
         return false;
     }
 
-    UniqueChars filename;
+    CompileArgs compileArgs;
+    if (!compileArgs.assumptions.init(SignalUsage(cx), cx->buildIdOp()))
+        return true;
+
     JS::AutoFilename af;
     if (DescribeScriptedCaller(cx, &af)) {
-        filename = DuplicateString(cx, af.get());
-        if (!filename)
+        compileArgs.filename = DuplicateString(cx, af.get());
+        if (!compileArgs.filename)
             return false;
     }
 
-    Assumptions assumptions;
-    if (!assumptions.init(SignalUsage(cx), cx->buildIdOp()))
-        return true;
-
     if (!CheckCompilerSupport(cx))
         return false;
 
-    UniqueModule module = Compile(cx, Move(filename), Move(assumptions), Move(bytecode));
+    UniqueModule module = Compile(cx, Move(bytecode), Move(compileArgs));
     if (!module)
         return false;
 
     RootedObject proto(cx, &GetConstructorPrototype(cx, ModuleConstructor, args));
     RootedObject moduleObj(cx, WasmModuleObject::create(cx, Move(module), proto));
     if (!moduleObj)
         return false;
 
--- a/js/src/vm/HelperThreads.cpp
+++ b/js/src/vm/HelperThreads.cpp
@@ -76,17 +76,17 @@ js::SetFakeCPUCount(size_t count)
     // This must be called before the threads have been initialized.
     MOZ_ASSERT(!HelperThreadState().threads);
 
     HelperThreadState().cpuCount = count;
     HelperThreadState().threadCount = ThreadCountForCPUCount(count);
 }
 
 bool
-js::StartOffThreadWasmCompile(ExclusiveContext* cx, wasm::IonCompileTask* task)
+js::StartOffThreadWasmCompile(wasm::IonCompileTask* task)
 {
     AutoLockHelperThreadState lock;
 
     // Don't append this task if another failed.
     if (HelperThreadState().wasmFailed())
         return false;
 
     if (!HelperThreadState().wasmWorklist().append(task))
@@ -1347,20 +1347,16 @@ HelperThread::handleWasmWorkload(AutoLoc
     MOZ_ASSERT(idle());
 
     currentTask.emplace(HelperThreadState().wasmWorklist().popCopy());
     bool success = false;
 
     wasm::IonCompileTask* task = wasmTask();
     {
         AutoUnlockHelperThreadState unlock(locked);
-
-        TraceLoggerThread* logger = TraceLoggerForCurrentThread();
-        AutoTraceLog logCompile(logger, TraceLogger_WasmCompilation);
-
         success = wasm::CompileFunction(task);
     }
 
     // On success, try to move work to the finished list.
     if (success)
         success = HelperThreadState().wasmFinishedList().append(task);
 
     // On failure, note the failure for harvesting by the parent.
--- a/js/src/vm/HelperThreads.h
+++ b/js/src/vm/HelperThreads.h
@@ -34,17 +34,17 @@ struct HelperThread;
 struct ParseTask;
 namespace jit {
   class IonBuilder;
 } // namespace jit
 namespace wasm {
   class FuncIR;
   class FunctionCompileResults;
   class IonCompileTask;
-  typedef Vector<IonCompileTask*, 0, SystemAllocPolicy> IonCompileTaskVector;
+  typedef Vector<IonCompileTask*, 0, SystemAllocPolicy> IonCompileTaskPtrVector;
 } // namespace wasm
 
 enum class ParseTaskKind
 {
     Script,
     Module
 };
 
@@ -73,17 +73,17 @@ class GlobalHelperThreadState
 
   private:
     // The lists below are all protected by |lock|.
 
     // Ion compilation worklist and finished jobs.
     IonBuilderVector ionWorklist_, ionFinishedList_;
 
     // wasm worklist and finished jobs.
-    wasm::IonCompileTaskVector wasmWorklist_, wasmFinishedList_;
+    wasm::IonCompileTaskPtrVector wasmWorklist_, wasmFinishedList_;
 
   public:
     // For now, only allow a single parallel asm.js compilation to happen at a
     // time. This avoids race conditions on wasmWorklist/wasmFinishedList/etc.
     mozilla::Atomic<bool> wasmCompilationInProgress;
 
   private:
     // Script parsing/emitting worklist and finished jobs.
@@ -152,21 +152,21 @@ class GlobalHelperThreadState
         MOZ_ASSERT(isLocked());
         return ionWorklist_;
     }
     IonBuilderVector& ionFinishedList() {
         MOZ_ASSERT(isLocked());
         return ionFinishedList_;
     }
 
-    wasm::IonCompileTaskVector& wasmWorklist() {
+    wasm::IonCompileTaskPtrVector& wasmWorklist() {
         MOZ_ASSERT(isLocked());
         return wasmWorklist_;
     }
-    wasm::IonCompileTaskVector& wasmFinishedList() {
+    wasm::IonCompileTaskPtrVector& wasmFinishedList() {
         MOZ_ASSERT(isLocked());
         return wasmFinishedList_;
     }
 
     ParseTaskVector& parseWorklist() {
         MOZ_ASSERT(isLocked());
         return parseWorklist_;
     }
@@ -387,17 +387,17 @@ void
 SetFakeCPUCount(size_t count);
 
 // Pause the current thread until it's pause flag is unset.
 void
 PauseCurrentHelperThread();
 
 /* Perform MIR optimization and LIR generation on a single function. */
 bool
-StartOffThreadWasmCompile(ExclusiveContext* cx, wasm::IonCompileTask* task);
+StartOffThreadWasmCompile(wasm::IonCompileTask* task);
 
 /*
  * Schedule an Ion compilation for a script, given a builder which has been
  * generated and read everything needed from the VM state.
  */
 bool
 StartOffThreadIonCompile(JSContext* cx, jit::IonBuilder* builder);