Bug 1207827 - Eliminate poolSizeBefore(). r=nbp
authorJakob Olesen <jolesen@mozilla.com>
Mon, 26 Oct 2015 17:06:09 -0700
changeset 304816 5beca478137361e9e6c212577d0d694be42d2a56
parent 304815 a6667610d4ba14c1a1505c5bb672f95b87f948a2
child 304817 3bb6cd5b7e5635c826c630a0ab237af4aec768de
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1207827
milestone44.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 1207827 - Eliminate poolSizeBefore(). r=nbp This method was used by the Assembler::actualOffset() methods to translate buffer offsets from pre-pool to post-pool numbers. Since pools are now injected immediately, there is no need to translate offsets. All the actualOffset() methods have become no-ops in all our supported targets.
js/src/jit/arm/Assembler-arm.cpp
js/src/jit/arm/Assembler-arm.h
js/src/jit/arm64/Assembler-arm64.h
js/src/jit/shared/IonAssemblerBufferWithConstantPools.h
--- a/js/src/jit/arm/Assembler-arm.cpp
+++ b/js/src/jit/arm/Assembler-arm.cpp
@@ -629,66 +629,51 @@ void
 Assembler::finish()
 {
     flush();
     MOZ_ASSERT(!isFinished);
     isFinished = true;
 
     for (unsigned int i = 0; i < tmpDataRelocations_.length(); i++) {
         size_t offset = tmpDataRelocations_[i].getOffset();
-        size_t real_offset = offset + m_buffer.poolSizeBefore(offset);
-        dataRelocations_.writeUnsigned(real_offset);
+        dataRelocations_.writeUnsigned(offset);
     }
 
     for (unsigned int i = 0; i < tmpJumpRelocations_.length(); i++) {
         size_t offset = tmpJumpRelocations_[i].getOffset();
-        size_t real_offset = offset + m_buffer.poolSizeBefore(offset);
-        jumpRelocations_.writeUnsigned(real_offset);
+        jumpRelocations_.writeUnsigned(offset);
     }
 
     for (unsigned int i = 0; i < tmpPreBarriers_.length(); i++) {
         size_t offset = tmpPreBarriers_[i].getOffset();
-        size_t real_offset = offset + m_buffer.poolSizeBefore(offset);
-        preBarriers_.writeUnsigned(real_offset);
+        preBarriers_.writeUnsigned(offset);
     }
 }
 
 void
 Assembler::executableCopy(uint8_t* buffer)
 {
     MOZ_ASSERT(isFinished);
     m_buffer.executableCopy(buffer);
     AutoFlushICache::setRange(uintptr_t(buffer), m_buffer.size());
 }
 
 uint32_t
-Assembler::actualOffset(uint32_t off_) const
-{
-    return off_ + m_buffer.poolSizeBefore(off_);
-}
-
-uint32_t
 Assembler::actualIndex(uint32_t idx_) const
 {
     ARMBuffer::PoolEntry pe(idx_);
     return m_buffer.poolEntryOffset(pe);
 }
 
 uint8_t*
 Assembler::PatchableJumpAddress(JitCode* code, uint32_t pe_)
 {
     return code->raw() + pe_;
 }
 
-BufferOffset
-Assembler::actualOffset(BufferOffset off_) const
-{
-    return BufferOffset(off_.getOffset() + m_buffer.poolSizeBefore(off_.getOffset()));
-}
-
 class RelocationIterator
 {
     CompactBufferReader reader_;
     // Offset in bytes.
     uint32_t offset_;
 
   public:
     RelocationIterator(CompactBufferReader& reader)
--- a/js/src/jit/arm/Assembler-arm.h
+++ b/js/src/jit/arm/Assembler-arm.h
@@ -1246,20 +1246,19 @@ class Assembler : public AssemblerShared
     void spewData(BufferOffset addr, size_t numInstr, bool loadToPC);
     void spewLabel(Label* label);
     void spewRetarget(Label* label, Label* target);
     void spewTarget(Label* l);
 #endif
 
   public:
     void resetCounter();
-    uint32_t actualOffset(uint32_t) const;
+    uint32_t actualOffset(uint32_t off) const { return off; }
     uint32_t actualIndex(uint32_t) const;
     static uint8_t* PatchableJumpAddress(JitCode* code, uint32_t index);
-    BufferOffset actualOffset(BufferOffset) const;
     static uint32_t NopFill;
     static uint32_t GetNopFill();
     static uint32_t AsmPoolMaxOffset;
     static uint32_t GetPoolMaxOffset();
 
   protected:
     // Structure for fixing up pc-relative loads/jumps when a the machine code
     // gets moved (executable copy, gc, etc.).
--- a/js/src/jit/arm64/Assembler-arm64.h
+++ b/js/src/jit/arm64/Assembler-arm64.h
@@ -255,19 +255,17 @@ class Assembler : public vixl::Assembler
     void retarget(Label* cur, Label* next);
 
     // The buffer is about to be linked. Ensure any constant pools or
     // excess bookkeeping has been flushed to the instruction stream.
     void flush() {
         armbuffer_.flushPool();
     }
 
-    int actualOffset(int curOffset) {
-        return curOffset + armbuffer_.poolSizeBefore(curOffset);
-    }
+    int actualOffset(int curOffset) { return curOffset; }
     int actualIndex(int curOffset) {
         ARMBuffer::PoolEntry pe(curOffset);
         return armbuffer_.poolEntryOffset(pe);
     }
     int labelOffsetToPatchOffset(int labelOff) {
         return actualOffset(labelOff);
     }
     static uint8_t* PatchableJumpAddress(JitCode* code, uint32_t index) {
@@ -341,17 +339,17 @@ class Assembler : public vixl::Assembler
     static int32_t ExtractCodeLabelOffset(uint8_t* code);
     static void PatchInstructionImmediate(uint8_t* code, PatchedImmPtr imm);
 
     static void FixupNurseryObjects(JSContext* cx, JitCode* code, CompactBufferReader& reader,
                                     const ObjectVector& nurseryObjects);
 
     // Convert a BufferOffset to a final byte offset from the start of the code buffer.
     size_t toFinalOffset(BufferOffset offset) {
-        return size_t(offset.getOffset() + armbuffer_.poolSizeBefore(offset.getOffset()));
+        return size_t(offset.getOffset());
     }
 
   public:
     // A Jump table entry is 2 instructions, with 8 bytes of raw data
     static const size_t SizeOfJumpTableEntry = 16;
 
     struct JumpTableEntry
     {
--- a/js/src/jit/shared/IonAssemblerBufferWithConstantPools.h
+++ b/js/src/jit/shared/IonAssemblerBufferWithConstantPools.h
@@ -594,21 +594,16 @@ struct AssemblerBufferWithConstantPools 
     void leaveNoPool() {
         MOZ_ASSERT(canNotPlacePool_);
         canNotPlacePool_ = false;
 
         // Validate the maxInst argument supplied to enterNoPool().
         MOZ_ASSERT(this->nextOffset().getOffset() - canNotPlacePoolStartOffset_ <= canNotPlacePoolMaxInst_ * InstSize);
     }
 
-    size_t poolSizeBefore(size_t offset) const {
-        // Pools are emitted inline, no adjustment required.
-        return 0;
-    }
-
     void align(unsigned alignment) {
         MOZ_ASSERT(IsPowerOfTwo(alignment));
 
         // A pool many need to be dumped at this point, so insert NOP fill here.
         insertNopFill();
 
         // Check if the code position can be aligned without dumping a pool.
         unsigned requiredFill = sizeExcludingCurrentPool() & (alignment - 1);