Bug 1496750 - Always re-mark JIT code as executable in AutoWritableJitCodeFallible. r=jandem, a=RyanVM
authorMatthew Gaudet <mgaudet@mozilla.com>
Tue, 16 Oct 2018 12:24:20 -0400
changeset 498184 fa02a3cb47228ee873efc02896707b77a5bdf7d8
parent 498183 7e5a43957be53451b2d48e536f3e8d0b95bd6d8f
child 498185 08d5049ad5d9690ed1f80409a58a9d58415437e6
push id10058
push userryanvm@gmail.com
push dateMon, 29 Oct 2018 13:32:17 +0000
treeherdermozilla-beta@52d060761f0c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem, RyanVM
bugs1496750
milestone64.0
Bug 1496750 - Always re-mark JIT code as executable in AutoWritableJitCodeFallible. r=jandem, a=RyanVM
js/src/jit/JitRealm.h
--- a/js/src/jit/JitRealm.h
+++ b/js/src/jit/JitRealm.h
@@ -633,44 +633,40 @@ const unsigned WINDOWS_BIG_FRAME_TOUCH_I
 // AutoWritableJitCodeFallible may only fail to make code writable; it cannot fail to
 // make JIT code executable (because the creating code has no chance to
 // recover from a failed destructor).
 class MOZ_RAII AutoWritableJitCodeFallible
 {
     JSRuntime* rt_;
     void* addr_;
     size_t size_;
-    bool madeWritable_;
 
   public:
     AutoWritableJitCodeFallible(JSRuntime* rt, void* addr, size_t size)
-      : rt_(rt), addr_(addr), size_(size), madeWritable_(false)
+      : rt_(rt), addr_(addr), size_(size)
     {
         rt_->toggleAutoWritableJitCodeActive(true);
     }
 
     AutoWritableJitCodeFallible(void* addr, size_t size)
       : AutoWritableJitCodeFallible(TlsContext.get()->runtime(), addr, size)
     {
     }
 
     explicit AutoWritableJitCodeFallible(JitCode* code)
       : AutoWritableJitCodeFallible(code->runtimeFromMainThread(), code->raw(), code->bufferSize())
     {}
 
     MOZ_MUST_USE bool makeWritable() {
-        madeWritable_ = ExecutableAllocator::makeWritable(addr_, size_);
-        return madeWritable_;
+        return ExecutableAllocator::makeWritable(addr_, size_);
     }
 
     ~AutoWritableJitCodeFallible() {
-        if (madeWritable_) {
-            if (!ExecutableAllocator::makeExecutable(addr_, size_)) {
-                MOZ_CRASH();
-            }
+        if (!ExecutableAllocator::makeExecutable(addr_, size_)) {
+            MOZ_CRASH();
         }
         rt_->toggleAutoWritableJitCodeActive(false);
     }
 
 };
 
 // Infallible variant of AutoWritableJitCodeFallible, ensures writable during construction
 class MOZ_RAII AutoWritableJitCode : private AutoWritableJitCodeFallible