Bug 1199171 part 0 - Add spewInst function for debugging Jit code. r=lth
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Wed, 16 Sep 2015 20:10:57 +0200
changeset 295461 6cb745339f3c6426a2ecf0b70c7c4654d508967d
parent 295429 e7d613b3bcfe1e865378bfac37de64560d1234ec
child 295462 b2663d8fb86aa34110a9a340e75bad3ce0388d60
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1199171
milestone43.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 1199171 part 0 - Add spewInst function for debugging Jit code. r=lth
js/src/jit/arm/Assembler-arm.cpp
js/src/jit/arm/Assembler-arm.h
--- a/js/src/jit/arm/Assembler-arm.cpp
+++ b/js/src/jit/arm/Assembler-arm.cpp
@@ -1405,16 +1405,27 @@ Assembler::bytesNeeded() const
     return size() +
         jumpRelocationTableBytes() +
         dataRelocationTableBytes() +
         preBarrierTableBytes();
 }
 
 #ifdef JS_DISASM_ARM
 
+void
+Assembler::spewInst(Instruction* i)
+{
+    disasm::NameConverter converter;
+    disasm::Disassembler dasm(converter);
+    disasm::EmbeddedVector<char, disasm::ReasonableBufferSize> buffer;
+    uint8_t* loc = reinterpret_cast<uint8_t*>(const_cast<uint32_t*>(i->raw()));
+    dasm.InstructionDecode(buffer, loc);
+    printf("   %08x  %s\n", reinterpret_cast<uint32_t>(loc), buffer.start());
+}
+
 // Labels are named as they are encountered by adding names to a
 // table, using the Label address as the key.  This is made tricky by
 // the (memory for) Label objects being reused, but reused label
 // objects are recognizable from being marked as not used or not
 // bound.  See spewResolve().
 //
 // In a number of cases there is no information about the target, and
 // we just end up printing "patchable constant load to PC".  This is
--- a/js/src/jit/arm/Assembler-arm.h
+++ b/js/src/jit/arm/Assembler-arm.h
@@ -1255,16 +1255,17 @@ class Assembler : public AssemblerShared
                             uint8_t* inst, uint8_t* data, ARMBuffer::PoolEntry* pe = nullptr,
                             bool markAsBranch = false, bool loadToPC = false);
 
     Instruction* editSrc (BufferOffset bo) {
         return m_buffer.getInst(bo);
     }
 
 #ifdef JS_DISASM_ARM
+    static void spewInst(Instruction* i);
     void spew(Instruction* i);
     void spewBranch(Instruction* i, Label* target);
     void spewData(BufferOffset addr, size_t numInstr, bool loadToPC);
     void spewLabel(Label* label);
     void spewRetarget(Label* label, Label* target);
     void spewTarget(Label* l);
 #endif