Commit 91b5d3d2 authored by Luke Wagner's avatar Luke Wagner
Browse files

Bug 1521058 - Baldr: fix IDB deserialization flags on arm64 (r=lth)

--HG--
extra : rebase_source : 6797831a63caff52072803dc9cffb7347725d270
parent f6a935e5
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -26,8 +26,10 @@
#include "js/BuildId.h"  // JS::BuildIdCharVector
#include "threading/LockGuard.h"
#include "util/NSPR.h"
#include "wasm/WasmBaselineCompile.h"
#include "wasm/WasmCompile.h"
#include "wasm/WasmInstance.h"
#include "wasm/WasmIonCompile.h"
#include "wasm/WasmJS.h"
#include "wasm/WasmSerialize.h"

@@ -386,6 +388,12 @@ static UniqueMapping MapFile(PRFileDesc* file, PRFileInfo* info) {
RefPtr<JS::WasmModule> wasm::DeserializeModule(PRFileDesc* bytecodeFile,
                                               UniqueChars filename,
                                               unsigned line) {
  // We have to compile new code here so if we're fundamentally unable to
  // compile, we have to fail.
  if (!BaselineCanCompile() && !IonCanCompile()) {
    return nullptr;
  }

  PRFileInfo bytecodeInfo;
  UniqueMapping bytecodeMapping = MapFile(bytecodeFile, &bytecodeInfo);
  if (!bytecodeMapping) {
@@ -409,17 +417,18 @@ RefPtr<JS::WasmModule> wasm::DeserializeModule(PRFileDesc* bytecodeFile,
    return nullptr;
  }

  // The true answer to whether shared memory is enabled is provided by
  // cx->realm()->creationOptions().getSharedMemoryAndAtomicsEnabled()
  // where cx is the context that originated the call that caused this
  // deserialization attempt to happen.  We don't have that context here, so
  // we assume that shared memory is enabled; we will catch a wrong assumption
  // later, during instantiation.
  // The true answer to whether various flags are enabled is provided by
  // the JSContext that originated the call that caused this deserialization
  // attempt to happen. We don't have that context here, so we assume that
  // shared memory is enabled; we will catch a wrong assumption later, during
  // instantiation.
  //
  // (We would prefer to store this value with the Assumptions when
  // serializing, and for the caller of the deserialization machinery to
  // provide the value from the originating context.)

  args->ionEnabled = true;
  args->baselineEnabled = true;
  args->sharedMemoryEnabled = true;

  UniqueChars error;