Bug 1353543 - Baldr: soften LookupAsmJSModuleInCache check. r=bbouvier, a=gchang
authorLuke Wagner <luke@mozilla.com>
Wed, 05 Apr 2017 09:37:58 -0500
changeset 375773 b6746564d765c9a749f7808b0984fa8ab13d2180
parent 375772 ab11d51947eb9ec46018150c96784bcc15d565e8
child 375774 11a4906850b25e17e750a13ba67f923cff29e794
push id11026
push userryanvm@gmail.com
push dateThu, 06 Apr 2017 19:16:23 +0000
treeherdermozilla-aurora@4c6327208ad2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier, gchang
bugs1353543
milestone54.0a2
Bug 1353543 - Baldr: soften LookupAsmJSModuleInCache check. r=bbouvier, a=gchang MozReview-Commit-ID: 7g55zJzU7pF
js/src/wasm/AsmJS.cpp
--- a/js/src/wasm/AsmJS.cpp
+++ b/js/src/wasm/AsmJS.cpp
@@ -8533,17 +8533,23 @@ LookupAsmJSModuleInCache(JSContext* cx, 
 
     // Due to the hash comparison made by openEntryForRead, this should succeed
     // with high probability.
     ModuleCharsForLookup moduleChars;
     cursor = moduleChars.deserialize(cursor);
     if (!moduleChars.match(parser))
         return true;
 
+    // Don't punish release users by crashing if there is a programmer error
+    // here, just gracefully return with a cache miss.
+#ifdef NIGHTLY_BUILD
     MOZ_RELEASE_ASSERT(cursor == entry.memory + entry.serializedSize);
+#endif
+    if (cursor != entry.memory + entry.serializedSize)
+        return true;
 
     // See AsmJSMetadata comment as well as ModuleValidator::init().
     asmJSMetadata->preludeStart = parser.pc->functionBox()->preludeStart;
     asmJSMetadata->srcStart = parser.pc->functionBox()->functionNode->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);