Bug 1494544 - Baldr: change order of setting tier-2 testing flag to fix testing race condition (r=lth)
authorLuke Wagner <luke@mozilla.com>
Fri, 28 Sep 2018 16:31:17 -0500
changeset 494569 909adfe5eaa7c22edbfd0d887349c42cd3943601
parent 494568 3f01040106719f099339ebe65ff98690a65ee9f0
child 494570 8a7d0b7ce84eb68f2d9832d1bdd0d73103ff8aa9
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1494544
milestone64.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 1494544 - Baldr: change order of setting tier-2 testing flag to fix testing race condition (r=lth)
js/src/wasm/WasmModule.cpp
--- a/js/src/wasm/WasmModule.cpp
+++ b/js/src/wasm/WasmModule.cpp
@@ -163,23 +163,25 @@ Module::finishTier2(const LinkData& link
         // set*Entry functions.
         if (cr.isFunction()) {
             code().setTieringEntry(cr.funcIndex(), base + cr.funcTierEntry());
         } else if (cr.isJitEntry()) {
             code().setJitEntry(cr.funcIndex(), base + cr.begin());
         }
     }
 
-    // Tier-2 is done; let everyone know.
+    // Tier-2 is done; let everyone know. Mark tier-2 active for testing
+    // purposes so that wasmHasTier2CompilationCompleted() only returns true
+    // after tier-2 has been fully cached.
 
-    testingTier2Active_ = false;
     if (tier2Listener_) {
         serialize(linkData2, *tier2Listener_);
         tier2Listener_ = nullptr;
     }
+    testingTier2Active_ = false;
 
     return true;
 }
 
 void
 Module::testingBlockOnTier2Complete() const
 {
     while (testingTier2Active_) {
@@ -201,17 +203,16 @@ Module::serializedSize(const LinkData& l
            SerializedVectorSize(elemSegments_) +
            SerializedVectorSize(customSections_) +
            code_->serializedSize();
 }
 
 /* virtual */ void
 Module::serialize(const LinkData& linkData, uint8_t* begin, size_t size) const
 {
-    MOZ_RELEASE_ASSERT(!testingTier2Active_);
     MOZ_RELEASE_ASSERT(!metadata().debugEnabled);
     MOZ_RELEASE_ASSERT(code_->hasTier(Tier::Serialized));
 
     JS::BuildIdCharVector buildId;
     JS::GetOptimizedEncodingBuildId(&buildId);
 
     uint8_t* cursor = begin;
     cursor = SerializePodVector(cursor, buildId);