Bug 1165793 - Add executableCopy() back for MIPS. r=sstangl
authorAleksandar Zlicic <aleksandar.zlicic@imgtec.com>
Mon, 15 Jun 2015 19:55:55 +0200
changeset 250339 f68aef04ed94dda40bdf77731470791d64f81fc5
parent 250338 fafc26e98274676337d1def350a4a98760642c3b
child 250340 330289920bd3919a9987722b1ab3a840ec2f0da2
push id61519
push usersean.stangl@gmail.com
push dateFri, 26 Jun 2015 18:20:53 +0000
treeherdermozilla-inbound@f68aef04ed94 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssstangl
bugs1165793, 1163168
milestone41.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 1165793 - Add executableCopy() back for MIPS. r=sstangl IonAssemblerBuffer::executableCopy() was erroneously removed in Bug 1163168.
js/src/jit/mips/Assembler-mips.h
js/src/jit/shared/IonAssemblerBuffer.h
--- a/js/src/jit/mips/Assembler-mips.h
+++ b/js/src/jit/mips/Assembler-mips.h
@@ -636,16 +636,30 @@ void
 PatchJump(CodeLocationJump& jump_, CodeLocationLabel label);
 
 void
 PatchBackedge(CodeLocationJump& jump_, CodeLocationLabel label, JitRuntime::BackedgeTarget target);
 
 class Assembler;
 typedef js::jit::AssemblerBuffer<1024, Instruction> MIPSBuffer;
 
+class MIPSBufferWithExecutableCopy : public MIPSBuffer
+{
+  public:
+    void executableCopy(uint8_t* buffer) {
+        if (this->oom())
+            return;
+
+        for (Slice* cur = head; cur != nullptr; cur = cur->getNext()) {
+            memcpy(buffer, &cur->instructions, cur->length());
+            buffer += cur->length();
+        }
+    }
+};
+
 class Assembler : public AssemblerShared
 {
   public:
 
     enum Condition {
         Equal,
         NotEqual,
         Above,
@@ -746,17 +760,17 @@ class Assembler : public AssemblerShared
     js::Vector<CodeLabel, 0, SystemAllocPolicy> codeLabels_;
     js::Vector<RelativePatch, 8, SystemAllocPolicy> jumps_;
     js::Vector<uint32_t, 8, SystemAllocPolicy> longJumps_;
 
     CompactBufferWriter jumpRelocations_;
     CompactBufferWriter dataRelocations_;
     CompactBufferWriter preBarriers_;
 
-    MIPSBuffer m_buffer;
+    MIPSBufferWithExecutableCopy m_buffer;
 
   public:
     Assembler()
       : m_buffer(),
         isFinished(false)
     { }
 
     static Condition InvertCondition(Condition cond);
--- a/js/src/jit/shared/IonAssemblerBuffer.h
+++ b/js/src/jit/shared/IonAssemblerBuffer.h
@@ -94,20 +94,20 @@ class BufferSlice
             memcpy(&instructions[length()], source, numBytes);
         bytelength_ += numBytes;
     }
 };
 
 template<int SliceSize, class Inst>
 class AssemblerBuffer
 {
+  protected:
     typedef BufferSlice<SliceSize> Slice;
     typedef AssemblerBuffer<SliceSize, Inst> AssemblerBuffer_;
 
-  protected:
     // Doubly-linked list of BufferSlices, with the most recent in tail position.
     Slice* head;
     Slice* tail;
 
   public:
     bool m_oom;
     bool m_bail;