Bug 1657830 part 5 - Move jumps_ Vector from Assembler-x86-shared to Assembler-x86 and Assembler-x64. r=tcampbell
authorJan de Mooij <jdemooij@mozilla.com>
Mon, 10 Aug 2020 13:36:54 +0000
changeset 544369 e60ebc67c5238ab747d2e082572371c5dff96528
parent 544368 e25fbc36560f8b4f01d558ef516749526ba1c719
child 544370 10c27253a2a3f943d9f9da5c25b0fc0e041389f4
push id37693
push usercsabou@mozilla.com
push dateWed, 12 Aug 2020 15:55:27 +0000
treeherdermozilla-central@fb8518702f1b [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 5 - Move jumps_ Vector from Assembler-x86-shared to Assembler-x86 and Assembler-x64. r=tcampbell This lets us make x64-specific changes in the next patch. Depends on D86373 Differential Revision: https://phabricator.services.mozilla.com/D86374
js/src/jit/x64/Assembler-x64.h
js/src/jit/x86-shared/Assembler-x86-shared.h
js/src/jit/x86/Assembler-x86.h
--- a/js/src/jit/x64/Assembler-x64.h
+++ b/js/src/jit/x64/Assembler-x64.h
@@ -301,16 +301,17 @@ class Assembler : public AssemblerX86Sha
   //    +1 byte for mod r/m
   //    +4 bytes for rip-relative offset (2)
   //    +2 bytes for ud2 instruction
   //    +8 bytes for 64-bit address
   //
   static const uint32_t SizeOfExtendedJump = 1 + 1 + 4 + 2 + 8;
   static const uint32_t SizeOfJumpTableEntry = 16;
 
+  Vector<RelativePatch, 8, SystemAllocPolicy> jumps_;
   uint32_t extendedJumpTable_;
 
   static JitCode* CodeFromJump(JitCode* code, uint8_t* jump);
 
  private:
   void addPendingJump(JmpSrc src, ImmPtr target, RelocationKind reloc);
 
  public:
@@ -328,16 +329,25 @@ class Assembler : public AssemblerX86Sha
   // The buffer is about to be linked, make sure any constant pools or excess
   // bookkeeping has been flushed to the instruction stream.
   void finish();
 
   // Copy the assembly code to the given buffer, and perform any pending
   // relocations relying on the target address.
   void executableCopy(uint8_t* buffer);
 
+  void assertNoGCThings() const {
+#ifdef DEBUG
+    MOZ_ASSERT(dataRelocations_.length() == 0);
+    for (auto& j : jumps_) {
+      MOZ_ASSERT(j.kind == RelocationKind::HARDCODED);
+    }
+#endif
+  }
+
   // Actual assembly emitting functions.
 
   void push(const ImmGCPtr ptr) {
     movq(ptr, ScratchReg);
     push(ScratchReg);
   }
   void push(const ImmWord ptr) {
     // We often end up with ImmWords that actually fit into int32.
--- a/js/src/jit/x86-shared/Assembler-x86-shared.h
+++ b/js/src/jit/x86-shared/Assembler-x86-shared.h
@@ -272,17 +272,16 @@ class AssemblerX86Shared : public Assemb
     int32_t offset;
     void* target;
     RelocationKind kind;
 
     RelativePatch(int32_t offset, void* target, RelocationKind kind)
         : offset(offset), target(target), kind(kind) {}
   };
 
-  Vector<RelativePatch, 8, SystemAllocPolicy> jumps_;
   CompactBufferWriter jumpRelocations_;
   CompactBufferWriter dataRelocations_;
 
   void writeDataRelocation(ImmGCPtr ptr) {
     // Raw GC pointer relocations and Value relocations both end up in
     // Assembler::TraceDataRelocations.
     if (ptr.value) {
       if (gc::IsInsideNursery(ptr.value)) {
@@ -414,25 +413,16 @@ class AssemblerX86Shared : public Assemb
   // Use NaNCondFromDoubleCondition to determine what else is needed.
   static inline Condition ConditionFromDoubleCondition(DoubleCondition cond) {
     return static_cast<Condition>(cond & ~DoubleConditionBits);
   }
 
   static void TraceDataRelocations(JSTracer* trc, JitCode* code,
                                    CompactBufferReader& reader);
 
-  void assertNoGCThings() const {
-#ifdef DEBUG
-    MOZ_ASSERT(dataRelocations_.length() == 0);
-    for (auto& j : jumps_) {
-      MOZ_ASSERT(j.kind == RelocationKind::HARDCODED);
-    }
-#endif
-  }
-
   void setUnlimitedBuffer() {
     // No-op on this platform
   }
   bool oom() const {
     return AssemblerShared::oom() || masm.oom() || jumpRelocations_.oom() ||
            dataRelocations_.oom();
   }
   bool reserve(size_t size) { return masm.reserve(size); }
--- a/js/src/jit/x86/Assembler-x86.h
+++ b/js/src/jit/x86/Assembler-x86.h
@@ -224,16 +224,18 @@ 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 {
+  Vector<RelativePatch, 8, SystemAllocPolicy> jumps_;
+
   void addPendingJump(JmpSrc src, ImmPtr target, RelocationKind kind) {
     enoughMemory_ &=
         jumps_.append(RelativePatch(src.offset(), target.value, kind));
     if (kind == RelocationKind::JITCODE) {
       jumpRelocations_.writeUnsigned(src.offset());
     }
   }
 
@@ -251,16 +253,25 @@ class Assembler : public AssemblerX86Sha
 
   static void TraceJumpRelocations(JSTracer* trc, JitCode* code,
                                    CompactBufferReader& reader);
 
   // Copy the assembly code to the given buffer, and perform any pending
   // relocations relying on the target address.
   void executableCopy(uint8_t* buffer);
 
+  void assertNoGCThings() const {
+#ifdef DEBUG
+    MOZ_ASSERT(dataRelocations_.length() == 0);
+    for (auto& j : jumps_) {
+      MOZ_ASSERT(j.kind == RelocationKind::HARDCODED);
+    }
+#endif
+  }
+
   // Actual assembly emitting functions.
 
   void push(ImmGCPtr ptr) {
     masm.push_i32(int32_t(ptr.value));
     writeDataRelocation(ptr);
   }
   void push(const ImmWord imm) { push(Imm32(imm.value)); }
   void push(const ImmPtr imm) { push(ImmWord(uintptr_t(imm.value))); }