Bug 1287485 - Display comments inside dumped assembly code (-D flag). r=nbp
☠☠ backed out by 88b6929d3c0b ☠ ☠
authorSander Mathijs van Veen <smvv@kompiler.org>
Thu, 28 Jul 2016 01:33:00 -0400
changeset 347165 30da5718207afe6dc72f919bbbf0cc6c178c71be
parent 347164 4e066314768c2002bd3dc699542f44c908aed7ab
child 347166 91eaa3e92b418020024b3b07bff1e65aef59e38e
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1287485
milestone50.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 1287485 - Display comments inside dumped assembly code (-D flag). r=nbp
js/src/jit/CodeGenerator.cpp
js/src/jit/MacroAssembler.cpp
js/src/jit/MacroAssembler.h
js/src/jit/arm/Assembler-arm.h
js/src/jit/arm/MacroAssembler-arm.cpp
js/src/jit/arm64/Assembler-arm64.h
js/src/jit/arm64/MacroAssembler-arm64.cpp
js/src/jit/mips-shared/Assembler-mips-shared.h
js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
js/src/jit/x86-shared/BaseAssembler-x86-shared.h
js/src/jit/x86-shared/MacroAssembler-x86-shared.cpp
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -3075,35 +3075,38 @@ CodeGenerator::emitGetPropertyPolymorphi
     MGetPropertyPolymorphic* mir = ins->mirRaw()->toGetPropertyPolymorphic();
 
     Label done;
 
     for (size_t i = 0; i < mir->numReceivers(); i++) {
         ReceiverGuard receiver = mir->receiver(i);
 
         Label next;
+        masm.comment("GuardReceiver");
         GuardReceiver(masm, receiver, obj, scratch, &next, /* checkNullExpando = */ false);
 
         if (receiver.shape) {
+            masm.comment("loadTypedOrValue");
             // If this is an unboxed expando access, GuardReceiver loaded the
             // expando object into scratch.
             Register target = receiver.group ? scratch : obj;
 
             Shape* shape = mir->shape(i);
             if (shape->slot() < shape->numFixedSlots()) {
                 // Fixed slot.
                 masm.loadTypedOrValue(Address(target, NativeObject::getFixedSlotOffset(shape->slot())),
                                       output);
             } else {
                 // Dynamic slot.
                 uint32_t offset = (shape->slot() - shape->numFixedSlots()) * sizeof(js::Value);
                 masm.loadPtr(Address(target, NativeObject::offsetOfSlots()), scratch);
                 masm.loadTypedOrValue(Address(scratch, offset), output);
             }
         } else {
+            masm.comment("loadUnboxedProperty");
             const UnboxedLayout::Property* property =
                 receiver.group->unboxedLayout().lookup(mir->name());
             Address propertyAddr(obj, UnboxedPlainObject::offsetOfData() + property->offset);
 
             masm.loadUnboxedProperty(propertyAddr, property->type, output);
         }
 
         if (i == mir->numReceivers() - 1) {
@@ -3387,25 +3390,28 @@ CodeGenerator::visitTypeBarrierV(LTypeBa
 void
 CodeGenerator::visitTypeBarrierO(LTypeBarrierO* lir)
 {
     Register obj = ToRegister(lir->object());
     Register scratch = ToTempRegisterOrInvalid(lir->temp());
     Label miss, ok;
 
     if (lir->mir()->type() == MIRType::ObjectOrNull) {
+        masm.comment("Object or Null");
         Label* nullTarget = lir->mir()->resultTypeSet()->mightBeMIRType(MIRType::Null) ? &ok : &miss;
         masm.branchTestPtr(Assembler::Zero, obj, obj, nullTarget);
     } else {
         MOZ_ASSERT(lir->mir()->type() == MIRType::Object);
         MOZ_ASSERT(lir->mir()->barrierKind() != BarrierKind::TypeTagOnly);
     }
 
-    if (lir->mir()->barrierKind() != BarrierKind::TypeTagOnly)
+    if (lir->mir()->barrierKind() != BarrierKind::TypeTagOnly) {
+        masm.comment("Type tag only");
         masm.guardObjectType(obj, lir->mir()->resultTypeSet(), scratch, &miss);
+    }
 
     bailoutFrom(&miss, lir->snapshot());
     masm.bind(&ok);
 }
 
 void
 CodeGenerator::visitMonitorTypes(LMonitorTypes* lir)
 {
@@ -5036,16 +5042,17 @@ CodeGenerator::emitDebugForceBailing(LIn
 {
     if (!lir->snapshot())
         return;
     if (lir->isStart())
         return;
     if (lir->isOsiPoint())
         return;
 
+    masm.comment("emitDebugForceBailing");
     const void* bailAfterAddr = GetJitContext()->runtime->addressOfIonBailAfter();
 
     AllocatableGeneralRegisterSet regs(GeneralRegisterSet::All());
 
     Label done, notBail, bail;
     masm.branch32(Assembler::Equal, AbsoluteAddress(bailAfterAddr), Imm32(0), &done);
     {
         Register temp = regs.takeAny();
--- a/js/src/jit/MacroAssembler.cpp
+++ b/js/src/jit/MacroAssembler.cpp
@@ -171,24 +171,27 @@ MacroAssembler::guardObjectType(Register
     bool hasObjectGroups = false;
     unsigned count = types->getObjectCount();
     for (unsigned i = 0; i < count; i++) {
         if (!types->getSingletonNoBarrier(i)) {
             hasObjectGroups = hasObjectGroups || types->getGroupNoBarrier(i);
             continue;
         }
 
-        if (lastBranch.isInitialized())
+        if (lastBranch.isInitialized()) {
+            comment("emit GC pointer checks");
             lastBranch.emit(*this);
+        }
 
         JSObject* object = types->getSingletonNoBarrier(i);
         lastBranch = BranchGCPtr(Equal, obj, ImmGCPtr(object), &matched);
     }
 
     if (hasObjectGroups) {
+        comment("has object groups");
         // We are possibly going to overwrite the obj register. So already
         // emit the branch, since branch depends on previous value of obj
         // register and there is definitely a branch following. So no need
         // to invert the condition.
         if (lastBranch.isInitialized())
             lastBranch.emit(*this);
         lastBranch = BranchGCPtr();
 
--- a/js/src/jit/MacroAssembler.h
+++ b/js/src/jit/MacroAssembler.h
@@ -385,16 +385,19 @@ class MacroAssembler : public MacroAssem
     //{{{ check_macroassembler_style
   public:
     // ===============================================================
     // MacroAssembler high-level usage.
 
     // Flushes the assembly buffer, on platforms that need it.
     void flush() PER_SHARED_ARCH;
 
+    // Add a comment that is visible in the pretty printed assembly code.
+    void comment(const char* msg) PER_SHARED_ARCH;
+
     // ===============================================================
     // Frame manipulation functions.
 
     inline uint32_t framePushed() const;
     inline void setFramePushed(uint32_t framePushed);
     inline void adjustFrame(int32_t value);
 
     // Adjust the frame, to account for implicit modification of the stack
--- a/js/src/jit/arm/Assembler-arm.h
+++ b/js/src/jit/arm/Assembler-arm.h
@@ -1776,16 +1776,20 @@ class Assembler : public AssemblerShared
     // 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);
         m_buffer.flushPool();
         return;
     }
 
+    void comment(const char* msg) {
+        spew("; %s", msg);
+    }
+
     // Copy the assembly code to the given buffer, and perform any pending
     // relocations relying on the target address.
     void executableCopy(uint8_t* buffer);
 
     // Actual assembly emitting functions.
 
     // Since I can't think of a reasonable default for the mode, I'm going to
     // leave it as a required argument.
--- a/js/src/jit/arm/MacroAssembler-arm.cpp
+++ b/js/src/jit/arm/MacroAssembler-arm.cpp
@@ -4737,16 +4737,22 @@ MacroAssemblerARMCompat::asMasm() const
 // MacroAssembler high-level usage.
 
 void
 MacroAssembler::flush()
 {
     Assembler::flush();
 }
 
+void
+MacroAssembler::comment(const char* msg)
+{
+    Assembler::comment(msg);
+}
+
 // ===============================================================
 // Stack manipulation functions.
 
 void
 MacroAssembler::PushRegsInMask(LiveRegisterSet set)
 {
     int32_t diffF = set.fpus().getPushSizeInBytes();
     int32_t diffG = set.gprs().size() * sizeof(intptr_t);
--- a/js/src/jit/arm64/Assembler-arm64.h
+++ b/js/src/jit/arm64/Assembler-arm64.h
@@ -273,16 +273,21 @@ 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();
     }
 
+    void comment(const char* msg) {
+        // This is not implemented because setPrinter() is not implemented.
+        // TODO spew("; %s", msg);
+    }
+
     int actualIndex(int curOffset) {
         ARMBuffer::PoolEntry pe(curOffset);
         return armbuffer_.poolEntryOffset(pe);
     }
     size_t labelToPatchOffset(CodeOffset label) {
         return label.offset();
     }
     static uint8_t* PatchableJumpAddress(JitCode* code, uint32_t index) {
--- a/js/src/jit/arm64/MacroAssembler-arm64.cpp
+++ b/js/src/jit/arm64/MacroAssembler-arm64.cpp
@@ -826,12 +826,18 @@ MacroAssembler::storeUnboxedValue(Consta
 
 template void
 MacroAssembler::storeUnboxedValue(ConstantOrRegister value, MIRType valueType,
                                   const Address& dest, MIRType slotType);
 template void
 MacroAssembler::storeUnboxedValue(ConstantOrRegister value, MIRType valueType,
                                   const BaseIndex& dest, MIRType slotType);
 
+void
+MacroAssembler::comment(const char* msg)
+{
+    Assembler::comment(msg);
+}
+
 //}}} check_macroassembler_style
 
 } // namespace jit
 } // namespace js
--- a/js/src/jit/mips-shared/Assembler-mips-shared.h
+++ b/js/src/jit/mips-shared/Assembler-mips-shared.h
@@ -1254,16 +1254,21 @@ class AssemblerMIPSShared : public Assem
     }
     uint32_t longJump(size_t i) {
         return longJumps_[i];
     }
 
     void flushBuffer() {
     }
 
+    void comment(const char* msg) {
+        // This is not implemented because setPrinter() is not implemented.
+        // TODO spew("; %s", msg);
+    }
+
     static uint32_t NopSize() { return 4; }
 
     static void PatchWrite_Imm32(CodeLocationLabel label, Imm32 imm);
 
     static uint32_t AlignDoubleArg(uint32_t offset) {
         return (offset + 1U) &~ 1U;
     }
 
--- a/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
+++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
@@ -1446,9 +1446,15 @@ MacroAssembler::branchPtrInNurseryRange(
 
     const Nursery& nursery = GetJitContext()->runtime->gcNursery();
     movePtr(ImmWord(-ptrdiff_t(nursery.start())), SecondScratchReg);
     addPtr(ptr, SecondScratchReg);
     branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
               SecondScratchReg, Imm32(nursery.nurserySize()), label);
 }
 
+void
+MacroAssembler::comment(const char* msg)
+{
+    Assembler::comment(msg);
+}
+
 //}}} check_macroassembler_style
--- a/js/src/jit/x86-shared/BaseAssembler-x86-shared.h
+++ b/js/src/jit/x86-shared/BaseAssembler-x86-shared.h
@@ -70,16 +70,21 @@ public:
     bool oom() const { return m_formatter.oom(); }
 
     void nop()
     {
         spew("nop");
         m_formatter.oneByteOp(OP_NOP);
     }
 
+    void comment(const char* msg)
+    {
+        spew("; %s", msg);
+    }
+
     MOZ_MUST_USE JmpSrc
     twoByteNop()
     {
         spew("nop (2 byte)");
         JmpSrc r(m_formatter.size());
         m_formatter.prefix(PRE_OPERAND_SIZE);
         m_formatter.oneByteOp(OP_NOP);
         return r;
--- a/js/src/jit/x86-shared/MacroAssembler-x86-shared.cpp
+++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared.cpp
@@ -471,16 +471,22 @@ MacroAssemblerX86Shared::outOfLineWasmTr
 // ===============================================================
 // MacroAssembler high-level usage.
 
 void
 MacroAssembler::flush()
 {
 }
 
+void
+MacroAssembler::comment(const char* msg)
+{
+    masm.comment(msg);
+}
+
 // ===============================================================
 // Stack manipulation functions.
 
 void
 MacroAssembler::PushRegsInMask(LiveRegisterSet set)
 {
     FloatRegisterSet fpuSet(set.fpus().reduceSetForPush());
     unsigned numFpu = fpuSet.size();