Bug 1342023 - Part 2: Stop using PageProtectingVector in AssemblerBuffer. r=jandem
authorEmanuel Hoogeveen <emanuel.hoogeveen@gmail.com>
Wed, 26 Jul 2017 08:54:00 -0400
changeset 420033 3144b8254557acbdc9f62a88e6b887db4e03b6a5
parent 420032 20da293c7656ef8e58f8acdc36f9e34de1ac7ae0
child 420034 d260dd770741e0b3899ed929f432dabaf10cba24
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1342023
milestone56.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 1342023 - Part 2: Stop using PageProtectingVector in AssemblerBuffer. r=jandem
js/src/jit/MacroAssembler.h
js/src/jit/arm/Assembler-arm.h
js/src/jit/arm64/Assembler-arm64.h
js/src/jit/mips-shared/Assembler-mips-shared.h
js/src/jit/none/MacroAssembler-none.h
js/src/jit/x86-shared/Assembler-x86-shared.h
js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h
js/src/jit/x86-shared/BaseAssembler-x86-shared.h
--- a/js/src/jit/MacroAssembler.h
+++ b/js/src/jit/MacroAssembler.h
@@ -368,19 +368,16 @@ class MacroAssembler : public MacroAssem
 
 #if defined(JS_CODEGEN_ARM)
         initWithAllocator();
         m_buffer.id = 0;
 #elif defined(JS_CODEGEN_ARM64)
         initWithAllocator();
         armbuffer_.id = 0;
 #endif
-
-        // Disable page protection for WASM.
-        disableProtection();
     }
 
     void constructRoot(JSContext* cx) {
         autoRooter_.emplace(cx, this);
     }
 
     MoveResolver& moveResolver() {
         return moveResolver_;
--- a/js/src/jit/arm/Assembler-arm.h
+++ b/js/src/jit/arm/Assembler-arm.h
@@ -1383,22 +1383,16 @@ class Assembler : public AssemblerShared
     static const uint32_t* GetCF32Target(Iter* iter);
 
     static uintptr_t GetPointer(uint8_t*);
     template <class Iter>
     static const uint32_t* GetPtr32Target(Iter* iter, Register* dest = nullptr, RelocStyle* rs = nullptr);
 
     bool oom() const;
 
-    void disableProtection() {}
-    void enableProtection() {}
-    void setLowerBoundForProtection(size_t) {}
-    void unprotectRegion(unsigned char*, size_t) {}
-    void reprotectRegion(unsigned char*, size_t) {}
-
     void setPrinter(Sprinter* sp) {
 #ifdef JS_DISASM_ARM
         printer_ = sp;
 #endif
     }
 
     static const Register getStackPointer() {
         return StackPointer;
--- a/js/src/jit/arm64/Assembler-arm64.h
+++ b/js/src/jit/arm64/Assembler-arm64.h
@@ -216,22 +216,16 @@ class Assembler : public vixl::Assembler
 
     bool oom() const {
         return AssemblerShared::oom() ||
             armbuffer_.oom() ||
             jumpRelocations_.oom() ||
             dataRelocations_.oom();
     }
 
-    void disableProtection() {}
-    void enableProtection() {}
-    void setLowerBoundForProtection(size_t) {}
-    void unprotectRegion(unsigned char*, size_t) {}
-    void reprotectRegion(unsigned char*, size_t) {}
-
     void copyJumpRelocationTable(uint8_t* dest) const {
         if (jumpRelocations_.length())
             memcpy(dest, jumpRelocations_.buffer(), jumpRelocations_.length());
     }
     void copyDataRelocationTable(uint8_t* dest) const {
         if (dataRelocations_.length())
             memcpy(dest, dataRelocations_.buffer(), dataRelocations_.length());
     }
--- a/js/src/jit/mips-shared/Assembler-mips-shared.h
+++ b/js/src/jit/mips-shared/Assembler-mips-shared.h
@@ -901,22 +901,16 @@ class AssemblerMIPSShared : public Assem
                 embedsNurseryPointers_ = true;
             dataRelocations_.writeUnsigned(nextOffset().getOffset());
         }
     }
 
   public:
     bool oom() const;
 
-    void disableProtection() {}
-    void enableProtection() {}
-    void setLowerBoundForProtection(size_t) {}
-    void unprotectRegion(unsigned char*, size_t) {}
-    void reprotectRegion(unsigned char*, size_t) {}
-
     void setPrinter(Sprinter* sp) {
     }
 
     static const Register getStackPointer() {
         return StackPointer;
     }
 
   protected:
--- a/js/src/jit/none/MacroAssembler-none.h
+++ b/js/src/jit/none/MacroAssembler-none.h
@@ -419,22 +419,16 @@ class MacroAssemblerNone : public Assemb
     Operand ToPayload(Operand base) { MOZ_CRASH(); }
 
     static const Register getStackPointer() { MOZ_CRASH(); }
 
     // Instrumentation for entering and leaving the profiler.
     void profilerEnterFrame(Register , Register ) { MOZ_CRASH(); }
     void profilerExitFrame() { MOZ_CRASH(); }
 
-    void disableProtection() { MOZ_CRASH(); }
-    void enableProtection() { MOZ_CRASH(); }
-    void setLowerBoundForProtection(size_t) { MOZ_CRASH(); }
-    void unprotectRegion(unsigned char*, size_t) { MOZ_CRASH(); }
-    void reprotectRegion(unsigned char*, size_t) { MOZ_CRASH(); }
-
 #ifdef JS_NUNBOX32
     Address ToPayload(Address) { MOZ_CRASH(); }
     Address ToType(Address) { MOZ_CRASH(); }
 #endif
 };
 
 typedef MacroAssemblerNone MacroAssemblerSpecific;
 
--- a/js/src/jit/x86-shared/Assembler-x86-shared.h
+++ b/js/src/jit/x86-shared/Assembler-x86-shared.h
@@ -399,28 +399,16 @@ class AssemblerX86Shared : public Assemb
 
     bool oom() const {
         return AssemblerShared::oom() ||
                masm.oom() ||
                jumpRelocations_.oom() ||
                dataRelocations_.oom();
     }
 
-    void disableProtection() { masm.disableProtection(); }
-    void enableProtection() { masm.enableProtection(); }
-    void setLowerBoundForProtection(size_t size) {
-        masm.setLowerBoundForProtection(size);
-    }
-    void unprotectRegion(unsigned char* first, size_t size) {
-        masm.unprotectRegion(first, size);
-    }
-    void reprotectRegion(unsigned char* first, size_t size) {
-        masm.reprotectRegion(first, size);
-    }
-
     void setPrinter(Sprinter* sp) {
         masm.setPrinter(sp);
     }
 
     static const Register getStackPointer() {
         return StackPointer;
     }
 
--- a/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h
+++ b/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h
@@ -28,17 +28,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef jit_x86_shared_AssemblerBuffer_x86_shared_h
 #define jit_x86_shared_AssemblerBuffer_x86_shared_h
 
 #include <stdarg.h>
 #include <string.h>
 
-#include "ds/PageProtectingVector.h"
 #include "jit/ExecutableAllocator.h"
 #include "jit/JitSpewer.h"
 
 // Spew formatting helpers.
 #define PRETTYHEX(x)                       (((x)<0)?"-":""),(((x)<0)?-(x):(x))
 
 #define MEM_o     "%s0x%x"
 #define MEM_os    MEM_o   "(,%s,%d)"
@@ -132,39 +131,16 @@ namespace jit {
             return m_buffer.begin();
         }
 
         unsigned char* data()
         {
             return m_buffer.begin();
         }
 
-#ifndef RELEASE_OR_BETA
-        void disableProtection() { m_buffer.disableProtection(); }
-        void enableProtection() { m_buffer.enableProtection(); }
-        void setLowerBoundForProtection(size_t size)
-        {
-            m_buffer.setLowerBoundForProtection(size);
-        }
-        void unprotectRegion(unsigned char* first, size_t size)
-        {
-            m_buffer.unprotectRegion(first, size);
-        }
-        void reprotectRegion(unsigned char* first, size_t size)
-        {
-            m_buffer.reprotectRegion(first, size);
-        }
-#else
-        void disableProtection() {}
-        void enableProtection() {}
-        void setLowerBoundForProtection(size_t) {}
-        void unprotectRegion(unsigned char*, size_t) {}
-        void reprotectRegion(unsigned char*, size_t) {}
-#endif
-
     protected:
         /*
          * OOM handling: This class can OOM in the ensureSpace() method trying
          * to allocate a new buffer. In response to an OOM, we need to avoid
          * crashing and report the error. We also want to make it so that
          * users of this class need to check for OOM only at certain points
          * and not after every operation.
          *
@@ -176,22 +152,17 @@ namespace jit {
          * See also the |buffer| method.
          */
         void oomDetected()
         {
             m_oom = true;
             m_buffer.clear();
         }
 
-#ifndef RELEASE_OR_BETA
-        PageProtectingVector<unsigned char, 256, SystemAllocPolicy,
-                             /* ProtectUsed = */ false, /* ProtectUnused = */ false> m_buffer;
-#else
         mozilla::Vector<unsigned char, 256, SystemAllocPolicy> m_buffer;
-#endif
         bool m_oom;
     };
 
     class GenericAssembler
     {
 #ifdef JS_JITSPEW
         Sprinter* printer;
 #endif
--- a/js/src/jit/x86-shared/BaseAssembler-x86-shared.h
+++ b/js/src/jit/x86-shared/BaseAssembler-x86-shared.h
@@ -53,31 +53,16 @@ public:
 
     void disableVEX() { useVEX_ = false; }
 
     size_t size() const { return m_formatter.size(); }
     const unsigned char* buffer() const { return m_formatter.buffer(); }
     unsigned char* data() { return m_formatter.data(); }
     bool oom() const { return m_formatter.oom(); }
 
-    void disableProtection() { m_formatter.disableProtection(); }
-    void enableProtection() { m_formatter.enableProtection(); }
-    void setLowerBoundForProtection(size_t size)
-    {
-        m_formatter.setLowerBoundForProtection(size);
-    }
-    void unprotectRegion(unsigned char* first, size_t size)
-    {
-        m_formatter.unprotectRegion(first, size);
-    }
-    void reprotectRegion(unsigned char* first, size_t size)
-    {
-        m_formatter.reprotectRegion(first, size);
-    }
-
     void nop()
     {
         spew("nop");
         m_formatter.oneByteOp(OP_NOP);
     }
 
     void comment(const char* msg)
     {
@@ -5156,31 +5141,16 @@ threeByteOpImmSimd("vblendps", VEX_PD, O
         // Administrative methods:
 
         size_t size() const { return m_buffer.size(); }
         const unsigned char* buffer() const { return m_buffer.buffer(); }
         unsigned char* data() { return m_buffer.data(); }
         bool oom() const { return m_buffer.oom(); }
         bool isAligned(int alignment) const { return m_buffer.isAligned(alignment); }
 
-        void disableProtection() { m_buffer.disableProtection(); }
-        void enableProtection() { m_buffer.enableProtection(); }
-        void setLowerBoundForProtection(size_t size)
-        {
-            m_buffer.setLowerBoundForProtection(size);
-        }
-        void unprotectRegion(unsigned char* first, size_t size)
-        {
-            m_buffer.unprotectRegion(first, size);
-        }
-        void reprotectRegion(unsigned char* first, size_t size)
-        {
-            m_buffer.reprotectRegion(first, size);
-        }
-
         MOZ_MUST_USE bool append(const unsigned char* values, size_t size)
         {
             return m_buffer.append(values, size);
         }
 
     private:
 
         // Internals; ModRm and REX formatters.