Bug 1657830 part 4 - Fold writeRelocation/addJumpRelocation into sole callers. r=tcampbell
authorJan de Mooij <jdemooij@mozilla.com>
Fri, 07 Aug 2020 20:14:14 +0000
changeset 544385 e25fbc36560f8b4f01d558ef516749526ba1c719
parent 544384 f7c04ba4c7a635693702ebf286c26b4d9e0dca84
child 544386 e60ebc67c5238ab747d2e082572371c5dff96528
push id124001
push userjdemooij@mozilla.com
push dateWed, 12 Aug 2020 08:50:03 +0000
treeherderautoland@10c27253a2a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1657830
milestone81.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 1657830 part 4 - Fold writeRelocation/addJumpRelocation into sole callers. r=tcampbell Depends on D86372 Differential Revision: https://phabricator.services.mozilla.com/D86373
js/src/jit/arm/Assembler-arm.h
js/src/jit/arm64/Assembler-arm64.cpp
js/src/jit/arm64/Assembler-arm64.h
js/src/jit/mips-shared/Assembler-mips-shared.h
js/src/jit/x64/Assembler-x64.cpp
js/src/jit/x64/Assembler-x64.h
js/src/jit/x86/Assembler-x86.h
--- a/js/src/jit/arm/Assembler-arm.h
+++ b/js/src/jit/arm/Assembler-arm.h
@@ -1250,20 +1250,16 @@ class Assembler : public AssemblerShared
   void setUnlimitedBuffer() { m_buffer.setUnlimited(); }
 
   static Condition InvertCondition(Condition cond);
   static Condition UnsignedCondition(Condition cond);
   static Condition ConditionWithoutEqual(Condition cond);
 
   static DoubleCondition InvertCondition(DoubleCondition cond);
 
-  void writeRelocation(BufferOffset src) {
-    jumpRelocations_.writeUnsigned(src.getOffset());
-  }
-
   void writeDataRelocation(BufferOffset offset, ImmGCPtr ptr) {
     // Raw GC pointer relocations and Value relocations both end up in
     // Assembler::TraceDataRelocations.
     if (ptr.value) {
       if (gc::IsInsideNursery(ptr.value)) {
         embedsNurseryPointers_ = true;
       }
       dataRelocations_.writeUnsigned(offset.getOffset());
@@ -1673,17 +1669,17 @@ class Assembler : public AssemblerShared
   static bool SupportsFastUnalignedAccesses() { return false; }
 
   static bool HasRoundInstruction(RoundingMode mode) { return false; }
 
  protected:
   void addPendingJump(BufferOffset src, ImmPtr target, RelocationKind kind) {
     enoughMemory_ &= jumps_.append(RelativePatch(target.value, kind));
     if (kind == RelocationKind::JITCODE) {
-      writeRelocation(src);
+      jumpRelocations_.writeUnsigned(src.getOffset());
     }
   }
 
  public:
   // The buffer is about to be linked, make sure any constant pools or excess
   // bookkeeping has been flushed to the instruction stream.
   void flush() {
     MOZ_ASSERT(!isFinished);
--- a/js/src/jit/arm64/Assembler-arm64.cpp
+++ b/js/src/jit/arm64/Assembler-arm64.cpp
@@ -265,29 +265,22 @@ void Assembler::bind(Label* label, Buffe
 
     branchOffset = nextOffset;
   }
 
   // Bind the label, so that future uses may encode the offset immediately.
   label->bind(targetOffset.getOffset());
 }
 
-void Assembler::addJumpRelocation(BufferOffset src, RelocationKind reloc) {
-  // Only JITCODE relocations are patchable at runtime.
-  MOZ_ASSERT(reloc == RelocationKind::JITCODE);
-
-  jumpRelocations_.writeUnsigned(src.getOffset());
-}
-
 void Assembler::addPendingJump(BufferOffset src, ImmPtr target,
                                RelocationKind reloc) {
   MOZ_ASSERT(target.value != nullptr);
 
   if (reloc == RelocationKind::JITCODE) {
-    addJumpRelocation(src, reloc);
+    jumpRelocations_.writeUnsigned(src.getOffset());
   }
 
   // This jump is not patchable at runtime. Extended jump table entry
   // requirements cannot be known until finalization, so to be safe, give each
   // jump and entry. This also causes GC tracing of the target.
   enoughMemory_ &=
       pendingJumps_.append(RelativePatch(src, target.value, reloc));
 }
--- a/js/src/jit/arm64/Assembler-arm64.h
+++ b/js/src/jit/arm64/Assembler-arm64.h
@@ -275,19 +275,16 @@ class Assembler : public vixl::Assembler
   }
 
   static bool SupportsFloatingPoint() { return true; }
   static bool SupportsUnalignedAccesses() { return true; }
   static bool SupportsFastUnalignedAccesses() { return true; }
 
   static bool HasRoundInstruction(RoundingMode mode) { return false; }
 
-  // Tracks a jump that is patchable after finalization.
-  void addJumpRelocation(BufferOffset src, RelocationKind reloc);
-
  protected:
   // Add a jump whose target is unknown until finalization.
   // The jump may not be patched at runtime.
   void addPendingJump(BufferOffset src, ImmPtr target, RelocationKind kind);
 
  public:
   static uint32_t PatchWrite_NearCallSize() { return 4; }
 
--- a/js/src/jit/mips-shared/Assembler-mips-shared.h
+++ b/js/src/jit/mips-shared/Assembler-mips-shared.h
@@ -815,20 +815,16 @@ class AssemblerMIPSShared : public Assem
         printer(nullptr),
 #endif
         isFinished(false) {
   }
 
   static Condition InvertCondition(Condition cond);
   static DoubleCondition InvertCondition(DoubleCondition cond);
 
-  void writeRelocation(BufferOffset src) {
-    jumpRelocations_.writeUnsigned(src.getOffset());
-  }
-
   // As opposed to x86/x64 version, the data relocation has to be executed
   // before to recover the pointer, and not after.
   void writeDataRelocation(ImmGCPtr ptr) {
     // Raw GC pointer relocations and Value relocations both end up in
     // TraceOneDataRelocation.
     if (ptr.value) {
       if (gc::IsInsideNursery(ptr.value)) {
         embedsNurseryPointers_ = true;
@@ -1238,17 +1234,17 @@ class AssemblerMIPSShared : public Assem
 
   static bool HasRoundInstruction(RoundingMode mode) { return false; }
 
  protected:
   InstImm invertBranch(InstImm branch, BOffImm16 skipOffset);
   void addPendingJump(BufferOffset src, ImmPtr target, RelocationKind kind) {
     enoughMemory_ &= jumps_.append(RelativePatch(src, target.value, kind));
     if (kind == RelocationKind::JITCODE) {
-      writeRelocation(src);
+      jumpRelocations_.writeUnsigned(src.getOffset());
     }
   }
 
   void addLongJump(BufferOffset src, BufferOffset dst) {
     CodeLabel cl;
     cl.patchAt()->bind(src.getOffset());
     cl.target()->bind(dst.getOffset());
     cl.setLinkMode(CodeLabel::JumpImmediate);
--- a/js/src/jit/x64/Assembler-x64.cpp
+++ b/js/src/jit/x64/Assembler-x64.cpp
@@ -105,30 +105,24 @@ ABIArg ABIArgGenerator::next(MIRType typ
       break;
     default:
       MOZ_CRASH("Unexpected argument type");
   }
   return current_;
 #endif
 }
 
-void Assembler::writeRelocation(JmpSrc src, RelocationKind reloc) {
-  if (reloc == RelocationKind::JITCODE) {
-    jumpRelocations_.writeUnsigned(src.offset());
-  }
-}
-
 void Assembler::addPendingJump(JmpSrc src, ImmPtr target,
                                RelocationKind reloc) {
   MOZ_ASSERT(target.value != nullptr);
 
   // Emit reloc before modifying the jump table, since it computes a 0-based
   // index. This jump is not patchable at runtime.
   if (reloc == RelocationKind::JITCODE) {
-    writeRelocation(src, reloc);
+    jumpRelocations_.writeUnsigned(src.offset());
   }
   enoughMemory_ &=
       jumps_.append(RelativePatch(src.offset(), target.value, reloc));
 }
 
 void Assembler::finish() {
   if (oom()) {
     return;
--- a/js/src/jit/x64/Assembler-x64.h
+++ b/js/src/jit/x64/Assembler-x64.h
@@ -306,17 +306,16 @@ class Assembler : public AssemblerX86Sha
   static const uint32_t SizeOfExtendedJump = 1 + 1 + 4 + 2 + 8;
   static const uint32_t SizeOfJumpTableEntry = 16;
 
   uint32_t extendedJumpTable_;
 
   static JitCode* CodeFromJump(JitCode* code, uint8_t* jump);
 
  private:
-  void writeRelocation(JmpSrc src, RelocationKind reloc);
   void addPendingJump(JmpSrc src, ImmPtr target, RelocationKind reloc);
 
  public:
   using AssemblerX86Shared::j;
   using AssemblerX86Shared::jmp;
   using AssemblerX86Shared::pop;
   using AssemblerX86Shared::push;
   using AssemblerX86Shared::vmovq;
--- a/js/src/jit/x86/Assembler-x86.h
+++ b/js/src/jit/x86/Assembler-x86.h
@@ -224,24 +224,21 @@ static inline Operand HighWord(const Ope
   }
 }
 
 // Return operand from a JS -> JS call.
 static constexpr ValueOperand JSReturnOperand{JSReturnReg_Type,
                                               JSReturnReg_Data};
 
 class Assembler : public AssemblerX86Shared {
-  void writeRelocation(JmpSrc src) {
-    jumpRelocations_.writeUnsigned(src.offset());
-  }
   void addPendingJump(JmpSrc src, ImmPtr target, RelocationKind kind) {
     enoughMemory_ &=
         jumps_.append(RelativePatch(src.offset(), target.value, kind));
     if (kind == RelocationKind::JITCODE) {
-      writeRelocation(src);
+      jumpRelocations_.writeUnsigned(src.offset());
     }
   }
 
  public:
   using AssemblerX86Shared::call;
   using AssemblerX86Shared::cmpl;
   using AssemblerX86Shared::j;
   using AssemblerX86Shared::jmp;