Bug 1496750 - Always re-mark JIT code as executable in AutoWritableJitCodeFallible r=jandem
authorMatthew Gaudet <mgaudet@mozilla.com>
Tue, 16 Oct 2018 12:24:20 -0400
changeset 499595 dc8601554a38bdd9ed08d3aee628ec313baae56a
parent 499567 b412e9d74e5770ef2531ca603dbc29df93316009
child 499596 a17dfbac6b10ec140dc69ed3053662987eba25ef
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1496750
milestone65.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 1496750 - Always re-mark JIT code as executable in AutoWritableJitCodeFallible r=jandem
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