Bug 1492301 - Baldr: remove unneeded Debugger.allowWasmBinarySource option (r=yury)
authorLuke Wagner <luke@mozilla.com>
Mon, 19 Nov 2018 16:45:51 -0600
changeset 503561 52fea45d53421be98d29d3f9c619f64809449482
parent 503560 928f054b112554217f661752bac7956a625c2945
child 503562 0892fe15bc04299d99b9ae77088dafa31157584a
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyury
bugs1492301
milestone65.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 1492301 - Baldr: remove unneeded Debugger.allowWasmBinarySource option (r=yury)
devtools/server/actors/source.js
devtools/server/actors/thread.js
js/src/doc/Debugger/Debugger.Source.md
js/src/doc/Debugger/Debugger.md
js/src/jit-test/lib/wasm.js
js/src/jit-test/tests/debug/wasm-binary-sources.js
js/src/vm/Debugger.cpp
js/src/vm/Debugger.h
js/src/vm/Realm.cpp
js/src/vm/Realm.h
js/src/wasm/WasmDebug.cpp
js/src/wasm/WasmDebug.h
js/src/wasm/WasmModule.cpp
--- a/devtools/server/actors/source.js
+++ b/devtools/server/actors/source.js
@@ -350,17 +350,17 @@ const SourceActor = ActorClassWithSpec(s
             return toResolvedContent(sourceContent);
           }
         } catch (error) {
           this._reportLoadSourceError(error, map);
           throw error;
         }
       }
 
-      if (isWasm && this.dbg.allowWasmBinarySource) {
+      if (isWasm) {
         const wasm = this.source.binary;
         const buffer = wasm.buffer;
         assert(
           wasm.byteOffset === 0 && wasm.byteLength === buffer.byteLength,
           "Typed array from wasm source binary must cover entire buffer"
         );
         return toResolvedContent(buffer);
       }
--- a/devtools/server/actors/thread.js
+++ b/devtools/server/actors/thread.js
@@ -434,19 +434,16 @@ const ThreadActor = ActorClassWithSpec(t
     if (this.state == "exited") {
       return { error: "wrongState" };
     }
     const options = request.options || {};
 
     if ("observeAsmJS" in options) {
       this.dbg.allowUnobservedAsmJS = !options.observeAsmJS;
     }
-    if ("wasmBinarySource" in options) {
-      this.dbg.allowWasmBinarySource = !!options.wasmBinarySource;
-    }
 
     Object.assign(this._options, options);
 
     // Update the global source store
     this.sources.setOptions(options);
 
     return {};
   },
--- a/js/src/doc/Debugger/Debugger.Source.md
+++ b/js/src/doc/Debugger/Debugger.Source.md
@@ -68,26 +68,22 @@ A `Debugger.Source` instance inherits th
 from its prototype:
 
 `text`
 :   **If the instance refers to JavaScript source**, the JavaScript source
     code, as a string. The value satisfies the `Program`,
     `FunctionDeclaration`, or `FunctionExpression` productions in the
     ECMAScript standard.
 
-    **If the instance refers to WebAssembly code**, the serialized text
-    representation. The format is yet to be specified in the WebAssembly
-    standard. Currently, the text is an s-expression based syntax. The text
-    generation is disabled if the Debugger has the `allowWasmBinarySource`
-    property set, the `"[wasm]"` value will be returned in this case.
+    **If the instance refers to WebAssembly code**, the `"[wasm]"` value will
+    be returned.
 
 `binary`
-:   **If the instance refers to WebAssembly code** and the Debugger has
-    the `allowWasmBinarySource` property set, a Uint8Array that contains the
-    WebAssembly bytecode.
+:   **If the instance refers to WebAssembly code**, a Uint8Array that contains
+    the WebAssembly bytecode.
 
 `url`
 :   **If the instance refers to JavaScript source**, the filename or URL from
     which this script's code was loaded. For scripts created by `eval` or the
     `Function` constructor, this may be a synthesized filename, starting with a
     valid URL and followed by information tracking how the code was introduced
     into the system; the entire string is not a valid URL. For
     `Function.prototype`'s script, this is `null`. Source may be loaded from a
--- a/js/src/doc/Debugger/Debugger.md
+++ b/js/src/doc/Debugger/Debugger.md
@@ -32,20 +32,16 @@ its prototype:
     ahead-of-time asm.js compiler and forces asm.js code to run as normal
     JavaScript. This is an accessor property with a getter and setter. It is
     initially `false` in a freshly created `Debugger` instance.
 
     Setting this flag to `true` is intended for uses of subsystems of the
     Debugger API (e.g, [`Debugger.Source`][source]) for purposes other than
     step debugging a target JavaScript program.
 
-`allowWasmBinarySource`
-:   A boolean value indicating whether WebAssembly sources will be available
-    in binary form. The WebAssembly text generation will be disabled.
-
 `collectCoverageInfo`
 :   A boolean value indicating whether code coverage should be enabled inside
     each debuggee of this `Debugger` instance. Changing this flag value will
     recompile all JIT code to add or remove code coverage
     instrumentation. Changing this flag when any frame of the debuggee is
     currently active on the stack will produce an exception.
 
     Setting this to `true` enables code coverage instrumentation, which can be
--- a/js/src/jit-test/lib/wasm.js
+++ b/js/src/jit-test/lib/wasm.js
@@ -127,19 +127,16 @@ function wasmFullPassI64(text, expected,
     let augmentedBinary = wasmTextToBinary(augmentedSrc);
     new WebAssembly.Instance(new WebAssembly.Module(augmentedBinary), maybeImports).exports.assert_0();
 }
 
 function wasmRunWithDebugger(wast, lib, init, done) {
     let g = newGlobal('');
     let dbg = new Debugger(g);
 
-    // Enable binary source mode.
-    dbg.allowWasmBinarySource = true;
-
     g.eval(`
 var wasm = wasmTextToBinary('${wast}');
 var lib = ${lib || 'undefined'};
 var m = new WebAssembly.Instance(new WebAssembly.Module(wasm), lib);`);
 
     var wasmScript = dbg.findScripts().filter(s => s.format == 'wasm')[0];
 
     init({dbg, wasmScript, g,});
--- a/js/src/jit-test/tests/debug/wasm-binary-sources.js
+++ b/js/src/jit-test/tests/debug/wasm-binary-sources.js
@@ -15,20 +15,16 @@ dbg.onNewScript = (script) => {
 
 g.eval(`o = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary('(module (func) (export "" 0))')));`);
 assertEq(s.format, "wasm");
 
 var source = s.source;
 
 // The text is never generated with the native Debugger API.
 assertEq(source.text.includes('module'), false);
-assertThrowsInstanceOf(() => source.binary, Error);
-
-// Enable binary sources.
-dbg.allowWasmBinarySource = true;
 
 g.eval(`o = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary('(module (func) (export "" 0))')));`);
 assertEq(s.format, "wasm");
 
 var source2 = s.source;
 
 // The text is predefined if wasm binary sources are enabled.
 assertEq(source2.text, '[debugger missing wasm binary-to-text conversion]');
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -698,17 +698,16 @@ WasmBreakpointSite::destroyIfEmpty(FreeO
 /*** Debugger hook dispatch **********************************************************************/
 
 Debugger::Debugger(JSContext* cx, NativeObject* dbg)
   : object(dbg),
     debuggees(cx->zone()),
     uncaughtExceptionHook(nullptr),
     enabled(true),
     allowUnobservedAsmJS(false),
-    allowWasmBinarySource(false),
     collectCoverageInfo(false),
     observedGCs(cx->zone()),
     allocationsLog(cx),
     trackingAllocationSites(false),
     allocationSamplingProbability(1.0),
     maxAllocationsLogLength(DEFAULT_MAX_LOG_LENGTH),
     allocationsLogOverflowed(false),
     frames(cx->zone()),
@@ -3088,25 +3087,16 @@ Debugger::observesAsmJS() const
 {
     if (enabled && !allowUnobservedAsmJS) {
         return Observing;
     }
     return NotObserving;
 }
 
 Debugger::IsObserving
-Debugger::observesBinarySource() const
-{
-    if (enabled && allowWasmBinarySource) {
-        return Observing;
-    }
-    return NotObserving;
-}
-
-Debugger::IsObserving
 Debugger::observesCoverage() const
 {
     if (enabled && collectCoverageInfo) {
         return Observing;
     }
     return NotObserving;
 }
 
@@ -3203,31 +3193,16 @@ Debugger::updateObservesAsmJSOnDebuggees
         if (realm->debuggerObservesAsmJS() == observing) {
             continue;
         }
 
         realm->updateDebuggerObservesAsmJS();
     }
 }
 
-void
-Debugger::updateObservesBinarySourceDebuggees(IsObserving observing)
-{
-    for (WeakGlobalObjectSet::Range r = debuggees.all(); !r.empty(); r.popFront()) {
-        GlobalObject* global = r.front();
-        Realm* realm = global->realm();
-
-        if (realm->debuggerObservesBinarySource() == observing) {
-            continue;
-        }
-
-        realm->updateDebuggerObservesBinarySource();
-    }
-}
-
 
 /*** Allocations Tracking *************************************************************************/
 
 /* static */ bool
 Debugger::cannotTrackAllocations(const GlobalObject& global)
 {
     auto existingCallback = global.realm()->getAllocationMetadataBuilder();
     return existingCallback && existingCallback != &SavedStacks::metadataBuilder;
@@ -3715,17 +3690,16 @@ Debugger::setEnabled(JSContext* cx, unsi
         if (!dbg->updateObservesAllExecutionOnDebuggees(cx, dbg->observesAllExecution())) {
             return false;
         }
 
         // Note: To toogle code coverage, we currently need to have no live
         // stack frame, thus the coverage does not depend on the enabled flag.
 
         dbg->updateObservesAsmJSOnDebuggees(dbg->observesAsmJS());
-        dbg->updateObservesBinarySourceDebuggees(dbg->observesBinarySource());
     }
 
     args.rval().setUndefined();
     return true;
 }
 
 /* static */ bool
 Debugger::getHookImpl(JSContext* cx, CallArgs& args, Debugger& dbg, Hook which)
@@ -3926,43 +3900,16 @@ Debugger::setAllowUnobservedAsmJS(JSCont
         realm->updateDebuggerObservesAsmJS();
     }
 
     args.rval().setUndefined();
     return true;
 }
 
 /* static */ bool
-Debugger::getAllowWasmBinarySource(JSContext* cx, unsigned argc, Value* vp)
-{
-    THIS_DEBUGGER(cx, argc, vp, "get allowWasmBinarySource", args, dbg);
-    args.rval().setBoolean(dbg->allowWasmBinarySource);
-    return true;
-}
-
-/* static */ bool
-Debugger::setAllowWasmBinarySource(JSContext* cx, unsigned argc, Value* vp)
-{
-    THIS_DEBUGGER(cx, argc, vp, "set allowWasmBinarySource", args, dbg);
-    if (!args.requireAtLeast(cx, "Debugger.set allowWasmBinarySource", 1)) {
-        return false;
-    }
-    dbg->allowWasmBinarySource = ToBoolean(args[0]);
-
-    for (WeakGlobalObjectSet::Range r = dbg->debuggees.all(); !r.empty(); r.popFront()) {
-        GlobalObject* global = r.front();
-        Realm* realm = global->realm();
-        realm->updateDebuggerObservesBinarySource();
-    }
-
-    args.rval().setUndefined();
-    return true;
-}
-
-/* static */ bool
 Debugger::getCollectCoverageInfo(JSContext* cx, unsigned argc, Value* vp)
 {
     THIS_DEBUGGER(cx, argc, vp, "get collectCoverageInfo", args, dbg);
     args.rval().setBoolean(dbg->collectCoverageInfo);
     return true;
 }
 
 /* static */ bool
@@ -4436,17 +4383,16 @@ Debugger::addDebuggeeGlobal(JSContext* c
             Debugger::removeAllocationsTracking(*global);
         }
     });
 
     // (6)
     AutoRestoreRealmDebugMode debugModeGuard(debuggeeRealm);
     debuggeeRealm->setIsDebuggee();
     debuggeeRealm->updateDebuggerObservesAsmJS();
-    debuggeeRealm->updateDebuggerObservesBinarySource();
     debuggeeRealm->updateDebuggerObservesCoverage();
     if (observesAllExecution() && !ensureExecutionObservabilityOfRealm(cx, debuggeeRealm)) {
         return false;
     }
 
     globalDebuggersGuard.release();
     debuggeesGuard.release();
     zoneDebuggersGuard.release();
@@ -4578,17 +4524,16 @@ Debugger::removeDebuggeeGlobal(FreeOp* f
         Debugger::removeAllocationsTracking(*global);
     }
 
     if (global->getDebuggers()->empty()) {
         global->realm()->unsetIsDebuggee();
     } else {
         global->realm()->updateDebuggerObservesAllExecution();
         global->realm()->updateDebuggerObservesAsmJS();
-        global->realm()->updateDebuggerObservesBinarySource();
         global->realm()->updateDebuggerObservesCoverage();
     }
 }
 
 
 static inline DebuggerSourceReferent GetSourceReferent(JSObject* obj);
 
 class MOZ_STACK_CLASS Debugger::QueryBase
@@ -5813,18 +5758,16 @@ const JSPropertySpec Debugger::propertie
     JS_PSGS("onNewPromise", Debugger::getOnNewPromise, Debugger::setOnNewPromise, 0),
     JS_PSGS("onPromiseSettled", Debugger::getOnPromiseSettled, Debugger::setOnPromiseSettled, 0),
     JS_PSGS("onEnterFrame", Debugger::getOnEnterFrame, Debugger::setOnEnterFrame, 0),
     JS_PSGS("onNewGlobalObject", Debugger::getOnNewGlobalObject, Debugger::setOnNewGlobalObject, 0),
     JS_PSGS("uncaughtExceptionHook", Debugger::getUncaughtExceptionHook,
             Debugger::setUncaughtExceptionHook, 0),
     JS_PSGS("allowUnobservedAsmJS", Debugger::getAllowUnobservedAsmJS,
             Debugger::setAllowUnobservedAsmJS, 0),
-    JS_PSGS("allowWasmBinarySource", Debugger::getAllowWasmBinarySource,
-            Debugger::setAllowWasmBinarySource, 0),
     JS_PSGS("collectCoverageInfo", Debugger::getCollectCoverageInfo,
             Debugger::setCollectCoverageInfo, 0),
     JS_PSG("memory", Debugger::getMemory, 0),
     JS_PS_END
 };
 
 const JSFunctionSpec Debugger::methods[] = {
     JS_FN("addDebuggee", Debugger::addDebuggee, 1, 0),
@@ -6287,17 +6230,17 @@ struct DebuggerScriptGetLineCountMatcher
         if (!script) {
             return false;
         }
         return match(script);
     }
     ReturnType match(Handle<WasmInstanceObject*> instanceObj) {
         wasm::Instance& instance = instanceObj->instance();
         if (instance.debugEnabled()) {
-            totalLines = double(instance.debug().totalSourceLines());
+            totalLines = double(instance.debug().bytecode().length());
         } else {
             totalLines = 0;
         }
         return true;
     }
 };
 
 static bool
@@ -8068,17 +8011,17 @@ DebuggerSource_getBinary(JSContext* cx, 
         ReportValueError(cx, JSMSG_DEBUG_BAD_REFERENT, JSDVG_SEARCH_STACK, args.thisv(), nullptr,
                          "a wasm source");
         return false;
     }
 
     RootedWasmInstanceObject instanceObj(cx, referent.as<WasmInstanceObject*>());
     wasm::Instance& instance = instanceObj->instance();
 
-    if (!instance.debugEnabled() || !instance.debug().binarySource()) {
+    if (!instance.debugEnabled()) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
                                   JSMSG_DEBUG_NO_BINARY_SOURCE);
         return false;
     }
 
     const wasm::Bytes& bytecode = instance.debug().bytecode();
     RootedObject arr(cx, JS_NewUint8Array(cx, bytecode.length()));
     if (!arr) {
--- a/js/src/vm/Debugger.h
+++ b/js/src/vm/Debugger.h
@@ -449,17 +449,16 @@ class Debugger : private mozilla::Linked
 
   private:
     GCPtrNativeObject object; /* The Debugger object. Strong reference. */
     WeakGlobalObjectSet debuggees; /* Debuggee globals. Cross-compartment weak references. */
     JS::ZoneSet debuggeeZones; /* Set of zones that we have debuggees in. */
     js::GCPtrObject uncaughtExceptionHook; /* Strong reference. */
     bool enabled;
     bool allowUnobservedAsmJS;
-    bool allowWasmBinarySource;
 
     // Whether to enable code coverage on the Debuggee.
     bool collectCoverageInfo;
 
     template <typename T>
     struct DebuggerLinkAccess {
       static mozilla::DoublyLinkedListElement<T>& Get(T* aThis) {
         return aThis->debuggerLink;
@@ -750,18 +749,16 @@ class Debugger : private mozilla::Linked
     static bool getOnNewPromise(JSContext* cx, unsigned argc, Value* vp);
     static bool setOnNewPromise(JSContext* cx, unsigned argc, Value* vp);
     static bool getOnPromiseSettled(JSContext* cx, unsigned argc, Value* vp);
     static bool setOnPromiseSettled(JSContext* cx, unsigned argc, Value* vp);
     static bool getUncaughtExceptionHook(JSContext* cx, unsigned argc, Value* vp);
     static bool setUncaughtExceptionHook(JSContext* cx, unsigned argc, Value* vp);
     static bool getAllowUnobservedAsmJS(JSContext* cx, unsigned argc, Value* vp);
     static bool setAllowUnobservedAsmJS(JSContext* cx, unsigned argc, Value* vp);
-    static bool getAllowWasmBinarySource(JSContext* cx, unsigned argc, Value* vp);
-    static bool setAllowWasmBinarySource(JSContext* cx, unsigned argc, Value* vp);
     static bool getCollectCoverageInfo(JSContext* cx, unsigned argc, Value* vp);
     static bool setCollectCoverageInfo(JSContext* cx, unsigned argc, Value* vp);
     static bool getMemory(JSContext* cx, unsigned argc, Value* vp);
     static bool addDebuggee(JSContext* cx, unsigned argc, Value* vp);
     static bool addAllGlobalsAsDebuggees(JSContext* cx, unsigned argc, Value* vp);
     static bool removeDebuggee(JSContext* cx, unsigned argc, Value* vp);
     static bool removeAllDebuggees(JSContext* cx, unsigned argc, Value* vp);
     static bool hasDebuggee(JSContext* cx, unsigned argc, Value* vp);
@@ -824,30 +821,27 @@ class Debugger : private mozilla::Linked
     // Whether the Debugger instance needs to observe AOT-compiled asm.js
     // execution of its debuggees.
     IsObserving observesAsmJS() const;
 
     // Whether the Debugger instance needs to observe coverage of any JavaScript
     // execution.
     IsObserving observesCoverage() const;
 
-    IsObserving observesBinarySource() const;
-
   private:
     static MOZ_MUST_USE bool ensureExecutionObservabilityOfFrame(JSContext* cx,
                                                                  AbstractFramePtr frame);
     static MOZ_MUST_USE bool ensureExecutionObservabilityOfRealm(JSContext* cx,
                                                                  JS::Realm* realm);
 
     static bool hookObservesAllExecution(Hook which);
 
     MOZ_MUST_USE bool updateObservesAllExecutionOnDebuggees(JSContext* cx, IsObserving observing);
     MOZ_MUST_USE bool updateObservesCoverageOnDebuggees(JSContext* cx, IsObserving observing);
     void updateObservesAsmJSOnDebuggees(IsObserving observing);
-    void updateObservesBinarySourceDebuggees(IsObserving observing);
 
     JSObject* getHook(Hook hook) const;
     bool hasAnyLiveHooks(JSRuntime* rt) const;
 
     static MOZ_MUST_USE bool slowPathCheckNoExecute(JSContext* cx, HandleScript script);
     static ResumeMode slowPathOnEnterFrame(JSContext* cx, AbstractFramePtr frame);
     static ResumeMode slowPathOnResumeFrame(JSContext* cx, AbstractFramePtr frame);
     static MOZ_MUST_USE bool slowPathOnLeaveFrame(JSContext* cx, AbstractFramePtr frame,
--- a/js/src/vm/Realm.cpp
+++ b/js/src/vm/Realm.cpp
@@ -812,29 +812,27 @@ Realm::ensureDelazifyScriptsForDebugger(
 }
 
 void
 Realm::updateDebuggerObservesFlag(unsigned flag)
 {
     MOZ_ASSERT(isDebuggee());
     MOZ_ASSERT(flag == DebuggerObservesAllExecution ||
                flag == DebuggerObservesCoverage ||
-               flag == DebuggerObservesAsmJS ||
-               flag == DebuggerObservesBinarySource);
+               flag == DebuggerObservesAsmJS);
 
     GlobalObject* global = zone()->runtimeFromMainThread()->gc.isForegroundSweeping()
                            ? unsafeUnbarrieredMaybeGlobal()
                            : maybeGlobal();
     const GlobalObject::DebuggerVector* v = global->getDebuggers();
     for (auto p = v->begin(); p != v->end(); p++) {
         Debugger* dbg = *p;
         if (flag == DebuggerObservesAllExecution ? dbg->observesAllExecution() :
             flag == DebuggerObservesCoverage ? dbg->observesCoverage() :
-            flag == DebuggerObservesAsmJS ? dbg->observesAsmJS() :
-            dbg->observesBinarySource())
+            flag == DebuggerObservesAsmJS && dbg->observesAsmJS())
         {
             debugModeBits_ |= flag;
             return;
         }
     }
 
     debugModeBits_ &= ~flag;
 }
--- a/js/src/vm/Realm.h
+++ b/js/src/vm/Realm.h
@@ -382,24 +382,22 @@ class JS::Realm : public JS::shadow::Rea
     // stack.
     unsigned enterRealmDepthIgnoringJit_ = 0;
 
     enum {
         IsDebuggee = 1 << 0,
         DebuggerObservesAllExecution = 1 << 1,
         DebuggerObservesAsmJS = 1 << 2,
         DebuggerObservesCoverage = 1 << 3,
-        DebuggerObservesBinarySource = 1 << 4,
-        DebuggerNeedsDelazification = 1 << 5
+        DebuggerNeedsDelazification = 1 << 4
     };
     static const unsigned DebuggerObservesMask = IsDebuggee |
                                                  DebuggerObservesAllExecution |
                                                  DebuggerObservesCoverage |
-                                                 DebuggerObservesAsmJS |
-                                                 DebuggerObservesBinarySource;
+                                                 DebuggerObservesAsmJS;
     unsigned debugModeBits_ = 0;
     friend class js::AutoRestoreRealmDebugMode;
 
     bool isSelfHostingRealm_ = false;
     bool marked_ = true;
     bool isSystem_ = false;
 
   public:
@@ -761,25 +759,16 @@ class JS::Realm : public JS::shadow::Rea
     bool debuggerObservesAsmJS() const {
         static const unsigned Mask = IsDebuggee | DebuggerObservesAsmJS;
         return (debugModeBits_ & Mask) == Mask;
     }
     void updateDebuggerObservesAsmJS() {
         updateDebuggerObservesFlag(DebuggerObservesAsmJS);
     }
 
-    bool debuggerObservesBinarySource() const {
-        static const unsigned Mask = IsDebuggee | DebuggerObservesBinarySource;
-        return (debugModeBits_ & Mask) == Mask;
-    }
-
-    void updateDebuggerObservesBinarySource() {
-        updateDebuggerObservesFlag(DebuggerObservesBinarySource);
-    }
-
     // True if this realm's global is a debuggee of some Debugger object
     // whose collectCoverageInfo flag is true.
     bool debuggerObservesCoverage() const {
         static const unsigned Mask = DebuggerObservesCoverage;
         return (debugModeBits_ & Mask) == Mask;
     }
     void updateDebuggerObservesCoverage();
 
--- a/js/src/wasm/WasmDebug.cpp
+++ b/js/src/wasm/WasmDebug.cpp
@@ -29,20 +29,19 @@
 #include "wasm/WasmValidate.h"
 
 using namespace js;
 using namespace js::jit;
 using namespace js::wasm;
 
 using mozilla::BinarySearchIf;
 
-DebugState::DebugState(const Code& code, const Module& module, bool binarySource)
+DebugState::DebugState(const Code& code, const Module& module)
   : code_(&code),
     module_(&module),
-    binarySource_(binarySource),
     enterFrameTrapsEnabled_(false),
     enterAndLeaveFrameTrapsCounter_(0)
 {
     MOZ_ASSERT(code.metadata().debugEnabled);
 }
 
 static const uint32_t DefaultBinarySourceColumnNumber = 1;
 
@@ -55,64 +54,49 @@ SlowCallSiteSearchByOffset(const Metadat
         }
     }
     return nullptr;
 }
 
 bool
 DebugState::getLineOffsets(JSContext* cx, size_t lineno, Vector<uint32_t>* offsets)
 {
-    if (!binarySource_) {
-        return true;
-    }
     const CallSite* callsite = SlowCallSiteSearchByOffset(metadata(Tier::Debug), lineno);
     if (callsite && !offsets->append(lineno)) {
         return false;
     }
     return true;
 }
 
 bool
 DebugState::getAllColumnOffsets(JSContext* cx, Vector<ExprLoc>* offsets)
 {
-    if (!binarySource_) {
-        return true;
-    }
     for (const CallSite& callSite : metadata(Tier::Debug).callSites) {
         if (callSite.kind() != CallSite::Breakpoint) {
             continue;
         }
         uint32_t offset = callSite.lineOrBytecode();
         if (!offsets->emplaceBack(offset, DefaultBinarySourceColumnNumber, offset)) {
             return false;
         }
     }
     return true;
 }
 
 bool
 DebugState::getOffsetLocation(uint32_t offset, size_t* lineno, size_t* column)
 {
-    if (!binarySource_) {
-        return false;
-    }
     if (!SlowCallSiteSearchByOffset(metadata(Tier::Debug), offset)) {
         return false;
     }
     *lineno = offset;
     *column = DefaultBinarySourceColumnNumber;
     return true;
 }
 
-uint32_t
-DebugState::totalSourceLines()
-{
-    return binarySource_ ? bytecode().length() : 0;
-}
-
 bool
 DebugState::stepModeEnabled(uint32_t funcIndex) const
 {
     return stepModeCounters_.lookup(funcIndex).found();
 }
 
 bool
 DebugState::incrementStepModeCount(JSContext* cx, uint32_t funcIndex)
--- a/js/src/wasm/WasmDebug.h
+++ b/js/src/wasm/WasmDebug.h
@@ -51,39 +51,36 @@ struct ExprLoc
 typedef HashMap<uint32_t, uint32_t, DefaultHasher<uint32_t>, SystemAllocPolicy> StepModeCounters;
 typedef HashMap<uint32_t, WasmBreakpointSite*, DefaultHasher<uint32_t>, SystemAllocPolicy>
     WasmBreakpointSiteMap;
 
 class DebugState
 {
     const SharedCode         code_;
     const SharedModule       module_;
-    bool                     binarySource_;
 
     // State maintained when debugging is enabled. In this case, the Code is
     // not actually shared, but is referenced uniquely by the instance that is
     // being debugged.
 
     bool                     enterFrameTrapsEnabled_;
     uint32_t                 enterAndLeaveFrameTrapsCounter_;
     WasmBreakpointSiteMap    breakpointSites_;
     StepModeCounters         stepModeCounters_;
 
     void toggleDebugTrap(uint32_t offset, bool enabled);
 
   public:
-    DebugState(const Code& code, const Module& module, bool binarySource);
+    DebugState(const Code& code, const Module& module);
 
     const Bytes& bytecode() const { return module_->debugBytecode(); }
-    bool binarySource() const { return binarySource_; }
 
     bool getLineOffsets(JSContext* cx, size_t lineno, Vector<uint32_t>* offsets);
     bool getAllColumnOffsets(JSContext* cx, Vector<ExprLoc>* offsets);
     bool getOffsetLocation(uint32_t offset, size_t* lineno, size_t* column);
-    uint32_t totalSourceLines();
 
     // The Code can track enter/leave frame events. Any such event triggers
     // debug trap. The enter/leave frame events enabled or disabled across
     // all functions.
 
     void adjustEnterAndLeaveFrameTrapsState(JSContext* cx, bool enabled);
     void ensureEnterFrameTrapsState(JSContext* cx, bool enabled);
     bool enterFrameTrapsEnabled() const { return enterFrameTrapsEnabled_; }
--- a/js/src/wasm/WasmModule.cpp
+++ b/js/src/wasm/WasmModule.cpp
@@ -1319,18 +1319,17 @@ Module::instantiate(JSContext* cx,
     UniqueDebugState maybeDebug;
     if (metadata().debugEnabled) {
         code = getDebugEnabledCode();
         if (!code) {
             ReportOutOfMemory(cx);
             return false;
         }
 
-        bool binarySource = cx->realm()->debuggerObservesBinarySource();
-        maybeDebug = cx->make_unique<DebugState>(*code, *this, binarySource);
+        maybeDebug = cx->make_unique<DebugState>(*code, *this);
         if (!maybeDebug) {
             return false;
         }
     } else {
         code = code_;
     }
 
     // Create type descriptors for any struct types that the module has.