Bug 1521058 - Baldr: fix IDB deserialization flags on arm64 (r=lth)
☠☠ backed out by afa74c85b798 ☠ ☠
authorLuke Wagner <luke@mozilla.com>
Fri, 18 Jan 2019 12:10:35 -0600
changeset 514546 dd45dce4d3a9e37af40b36e631ffc9841817a3a0
parent 514545 ef836f7dfc086551403866e9dd5ca81feb4cdabc
child 514547 c55210f1f837c270f0ab82d4ce563979b8a90a27
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1521058
milestone66.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 1521058 - Baldr: fix IDB deserialization flags on arm64 (r=lth)
js/src/wasm/WasmModule.cpp
--- a/js/src/wasm/WasmModule.cpp
+++ b/js/src/wasm/WasmModule.cpp
@@ -381,16 +381,22 @@ static UniqueMapping MapFile(PRFileDesc*
   uint8_t* memory = (uint8_t*)PR_MemMap(map, 0, info->size);
   PR_CloseFileMap(map);
   return UniqueMapping(memory, MemUnmap(info->size));
 }
 
 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) {
     return nullptr;
   }
 
   MutableBytes bytecode = js_new<ShareableBytes>();
   if (!bytecode ||
@@ -404,27 +410,28 @@ RefPtr<JS::WasmModule> wasm::Deserialize
   scriptedCaller.filename = std::move(filename);
   scriptedCaller.line = line;
 
   MutableCompileArgs args = js_new<CompileArgs>(std::move(scriptedCaller));
   if (!args) {
     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;
   UniqueCharsVector warnings;
   SharedModule module = CompileBuffer(*args, *bytecode, &error, &warnings);
   if (!module) {
     return nullptr;
   }