Show generated assembly in Ion PC count information, bug 811349. r=pierron

This commit is contained in:
Brian Hackett 2012-11-21 13:53:18 -05:00
Родитель a9fd1719ca
Коммит d3a590d390
12 изменённых файлов: 554 добавлений и 742 удалений

Просмотреть файл

@ -41,24 +41,7 @@
#include "AssemblerBufferWithConstantPool.h"
#include "assembler/wtf/Assertions.h"
#include "methodjit/Logging.h"
#define IPFX " %s"
#define ISPFX " "
#ifdef JS_METHODJIT_SPEW
# define MAYBE_PAD (isOOLPath ? "> " : "")
# define FIXME_INSN_PRINTING \
do { \
js::JaegerSpew(js::JSpew_Insns, \
IPFX "FIXME insn printing %s:%d\n", \
MAYBE_PAD, \
__FILE__, __LINE__); \
} while (0)
#else
# define MAYBE_PAD ""
# define FIXME_INSN_PRINTING ((void) 0)
#endif
// TODO: We don't print the condition code in our JaegerSpew lines. Doing this
// TODO: We don't print the condition code in our spew lines. Doing this
// is awkward whilst maintaining a consistent field width.
namespace js {
namespace ion {
@ -143,16 +126,9 @@ namespace JSC {
return (FPRegisterID)(d / 2);
}
} // namespace ARMRegisters
class ARMAssembler {
class ARMAssembler : public GenericAssembler {
public:
#ifdef JS_METHODJIT_SPEW
bool isOOLPath;
// Assign a default value to keep Valgrind quiet.
ARMAssembler() : isOOLPath(false) { }
#else
ARMAssembler() { }
#endif
typedef ARMRegisters::RegisterID RegisterID;
typedef ARMRegisters::FPRegisterID FPRegisterID;
typedef AssemblerBufferWithConstantPool<2048, 4, 4, ARMAssembler> ARMBuffer;
@ -493,16 +469,14 @@ namespace JSC {
void movw_r(int rd, ARMWord op2, Condition cc = AL)
{
ASSERT((op2 | 0xf0fff) == 0xf0fff);
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, 0x%04x\n", MAYBE_PAD, "movw", nameGpReg(rd), (op2 & 0xfff) | ((op2 >> 4) & 0xf000));
spew("%-15s %s, 0x%04x", "movw", nameGpReg(rd), (op2 & 0xfff) | ((op2 >> 4) & 0xf000));
m_buffer.putInt(static_cast<ARMWord>(cc) | MOVW | RD(rd) | op2);
}
void movt_r(int rd, ARMWord op2, Condition cc = AL)
{
ASSERT((op2 | 0xf0fff) == 0xf0fff);
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, 0x%04x\n", MAYBE_PAD, "movt", nameGpReg(rd), (op2 & 0xfff) | ((op2 >> 4) & 0xf000));
spew("%-15s %s, 0x%04x", "movt", nameGpReg(rd), (op2 & 0xfff) | ((op2 >> 4) & 0xf000));
m_buffer.putInt(static_cast<ARMWord>(cc) | MOVT | RD(rd) | op2);
}
#endif
@ -551,8 +525,7 @@ namespace JSC {
void mull_r(int rdhi, int rdlo, int rn, int rm, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, %s, %s, %s\n", MAYBE_PAD, "mull", nameGpReg(rdlo), nameGpReg(rdhi), nameGpReg(rn), nameGpReg(rm));
spew("%-15s %s, %s, %s, %s", "mull", nameGpReg(rdlo), nameGpReg(rdhi), nameGpReg(rn), nameGpReg(rm));
m_buffer.putInt(static_cast<ARMWord>(cc) | MULL | RN(rdhi) | RD(rdlo) | RS(rn) | RM(rm));
}
@ -561,8 +534,7 @@ namespace JSC {
{
char mnemonic[16];
snprintf(mnemonic, 16, "ldr%s", nameCC(cc));
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, =0x%x @ (%d) (reusable pool entry)\n", MAYBE_PAD, mnemonic, nameGpReg(rd), imm, static_cast<int32_t>(imm));
spew("%-15s %s, =0x%x @ (%d) (reusable pool entry)", mnemonic, nameGpReg(rd), imm, static_cast<int32_t>(imm));
m_buffer.putIntWithConstantInt(static_cast<ARMWord>(cc) | DTR | DT_LOAD | DT_UP | RN(ARMRegisters::pc) | RD(rd), imm, true);
}
@ -570,8 +542,7 @@ namespace JSC {
{
char mnemonic[16];
snprintf(mnemonic, 16, "ldr%s", nameCC(cc));
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, =0x%x @ (%d)\n", MAYBE_PAD, mnemonic, nameGpReg(rd), imm, static_cast<int32_t>(imm));
spew("%-15s %s, =0x%x @ (%d)", mnemonic, nameGpReg(rd), imm, static_cast<int32_t>(imm));
m_buffer.putIntWithConstantInt(static_cast<ARMWord>(cc) | DTR | DT_LOAD | DT_UP | RN(ARMRegisters::pc) | RD(rd), imm);
}
@ -595,10 +566,9 @@ namespace JSC {
break;
}
char const * off_sign = (posOffset) ? ("+") : ("-");
js::JaegerSpew(js::JSpew_Insns,
IPFX "%sr%s%s %s, [%s, #%s%u]\n",
MAYBE_PAD, mnemonic_act, mnemonic_sign, mnemonic_size,
nameGpReg(rd), nameGpReg(rb), off_sign, offset);
spew("%sr%s%s %s, [%s, #%s%u]",
mnemonic_act, mnemonic_sign, mnemonic_size,
nameGpReg(rd), nameGpReg(rb), off_sign, offset);
if (size == 32 || (size == 8 && !isSigned)) {
/* All (the one) 32 bit ops and the unsigned 8 bit ops use the original encoding.*/
emitInst(static_cast<ARMWord>(cc) | DTR |
@ -633,9 +603,8 @@ namespace JSC {
break;
}
char const * off_sign = (posOffset) ? ("+") : ("-");
js::JaegerSpew(js::JSpew_Insns,
IPFX "%sr%s%s %s, [%s, #%s%s]\n", MAYBE_PAD, mnemonic_act, mnemonic_sign, mnemonic_size,
nameGpReg(rd), nameGpReg(rb), off_sign, nameGpReg(rm));
spew("%sr%s%s %s, [%s, #%s%s]", mnemonic_act, mnemonic_sign, mnemonic_size,
nameGpReg(rd), nameGpReg(rb), off_sign, nameGpReg(rm));
if (size == 32 || (size == 8 && !isSigned)) {
/* All (the one) 32 bit ops and the signed 8 bit ops use the original encoding.*/
emitInst(static_cast<ARMWord>(cc) | DTR |
@ -659,8 +628,8 @@ namespace JSC {
void dtr_u(bool isLoad, int rd, int rb, ARMWord offset, Condition cc = AL)
{
char const * mnemonic = (isLoad) ? ("ldr") : ("str");
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, [%s, #+%u]\n", MAYBE_PAD, mnemonic, nameGpReg(rd), nameGpReg(rb), offset);
spew("%-15s %s, [%s, #+%u]",
mnemonic, nameGpReg(rd), nameGpReg(rb), offset);
emitInst(static_cast<ARMWord>(cc) | DTR | (isLoad ? DT_LOAD : 0) | DT_UP, rd, rb, offset);
}
@ -670,8 +639,8 @@ namespace JSC {
void dtr_ur(bool isLoad, int rd, int rb, int rm, Condition cc = AL)
{
char const * mnemonic = (isLoad) ? ("ldr") : ("str");
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, [%s, +%s]\n", MAYBE_PAD, mnemonic, nameGpReg(rd), nameGpReg(rb), nameGpReg(rm));
spew("%-15s %s, [%s, +%s]",
mnemonic, nameGpReg(rd), nameGpReg(rb), nameGpReg(rm));
emitInst(static_cast<ARMWord>(cc) | DTR | (isLoad ? DT_LOAD : 0) | DT_UP | OP2_OFSREG, rd, rb, rm);
}
@ -681,8 +650,8 @@ namespace JSC {
void dtr_d(bool isLoad, int rd, int rb, ARMWord offset, Condition cc = AL)
{
char const * mnemonic = (isLoad) ? ("ldr") : ("str");
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, [%s, #-%u]\n", MAYBE_PAD, mnemonic, nameGpReg(rd), nameGpReg(rb), offset);
spew("%-15s %s, [%s, #-%u]",
mnemonic, nameGpReg(rd), nameGpReg(rb), offset);
emitInst(static_cast<ARMWord>(cc) | DTR | (isLoad ? DT_LOAD : 0), rd, rb, offset);
}
@ -692,8 +661,8 @@ namespace JSC {
void dtr_dr(bool isLoad, int rd, int rb, int rm, Condition cc = AL)
{
char const * mnemonic = (isLoad) ? ("ldr") : ("str");
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, [%s, -%s]\n", MAYBE_PAD, mnemonic, nameGpReg(rd), nameGpReg(rb), nameGpReg(rm));
spew("%-15s %s, [%s, -%s]",
mnemonic, nameGpReg(rd), nameGpReg(rb), nameGpReg(rm));
emitInst(static_cast<ARMWord>(cc) | DTR | (isLoad ? DT_LOAD : 0) | OP2_OFSREG, rd, rb, rm);
}
@ -703,8 +672,8 @@ namespace JSC {
void dtrb_u(bool isLoad, int rd, int rb, ARMWord offset, Condition cc = AL)
{
char const * mnemonic = (isLoad) ? ("ldrb") : ("strb");
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, [%s, #+%u]\n", MAYBE_PAD, mnemonic, nameGpReg(rd), nameGpReg(rb), offset);
spew("%-15s %s, [%s, #+%u]",
mnemonic, nameGpReg(rd), nameGpReg(rb), offset);
emitInst(static_cast<ARMWord>(cc) | DTR | DT_BYTE | (isLoad ? DT_LOAD : 0) | DT_UP, rd, rb, offset);
}
@ -714,8 +683,8 @@ namespace JSC {
void dtrsb_u(bool isLoad, int rd, int rb, ARMWord offset, Condition cc = AL)
{
char const * mnemonic = (isLoad) ? ("ldrsb") : ("strb");
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, [%s, #+%u]\n", MAYBE_PAD, mnemonic, nameGpReg(rd), nameGpReg(rb), offset);
spew("%-15s %s, [%s, #+%u]",
mnemonic, nameGpReg(rd), nameGpReg(rb), offset);
emitInst(static_cast<ARMWord>(cc) | DTRH | HDT_S | (isLoad ? DT_LOAD : 0) | DT_UP, rd, rb, offset);
}
@ -725,8 +694,8 @@ namespace JSC {
void dtrb_ur(bool isLoad, int rd, int rb, int rm, Condition cc = AL)
{
char const * mnemonic = (isLoad) ? ("ldrb") : ("strb");
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, [%s, +%s]\n", MAYBE_PAD, mnemonic, nameGpReg(rd), nameGpReg(rb), nameGpReg(rm));
spew("%-15s %s, [%s, +%s]",
mnemonic, nameGpReg(rd), nameGpReg(rb), nameGpReg(rm));
emitInst(static_cast<ARMWord>(cc) | DTR | DT_BYTE | (isLoad ? DT_LOAD : 0) | DT_UP | OP2_OFSREG, rd, rb, rm);
}
@ -736,8 +705,8 @@ namespace JSC {
void dtrb_d(bool isLoad, int rd, int rb, ARMWord offset, Condition cc = AL)
{
char const * mnemonic = (isLoad) ? ("ldrb") : ("strb");
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, [%s, #-%u]\n", MAYBE_PAD, mnemonic, nameGpReg(rd), nameGpReg(rb), offset);
spew("%-15s %s, [%s, #-%u]",
mnemonic, nameGpReg(rd), nameGpReg(rb), offset);
emitInst(static_cast<ARMWord>(cc) | DTR | DT_BYTE | (isLoad ? DT_LOAD : 0), rd, rb, offset);
}
@ -748,8 +717,8 @@ namespace JSC {
{
ASSERT(isLoad); /*can only do signed byte loads, not stores*/
char const * mnemonic = (isLoad) ? ("ldrsb") : ("strb");
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, [%s, #-%u]\n", MAYBE_PAD, mnemonic, nameGpReg(rd), nameGpReg(rb), offset);
spew("%-15s %s, [%s, #-%u]",
mnemonic, nameGpReg(rd), nameGpReg(rb), offset);
emitInst(static_cast<ARMWord>(cc) | DTRH | HDT_S | (isLoad ? DT_LOAD : 0), rd, rb, offset);
}
@ -759,65 +728,65 @@ namespace JSC {
void dtrb_dr(bool isLoad, int rd, int rb, int rm, Condition cc = AL)
{
char const * mnemonic = (isLoad) ? ("ldrb") : ("strb");
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, [%s, -%s]\n", MAYBE_PAD, mnemonic, nameGpReg(rd), nameGpReg(rb), nameGpReg(rm));
spew("%-15s %s, [%s, -%s]",
mnemonic, nameGpReg(rd), nameGpReg(rb), nameGpReg(rm));
emitInst(static_cast<ARMWord>(cc) | DTR | DT_BYTE | (isLoad ? DT_LOAD : 0) | OP2_OFSREG, rd, rb, rm);
}
void ldrh_r(int rd, int rb, int rm, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, [%s, +%s]\n", MAYBE_PAD, "ldrh", nameGpReg(rd), nameGpReg(rb), nameGpReg(rm));
spew("%-15s %s, [%s, +%s]",
"ldrh", nameGpReg(rd), nameGpReg(rb), nameGpReg(rm));
emitInst(static_cast<ARMWord>(cc) | LDRH | HDT_UH | DT_UP | DT_PRE, rd, rb, rm);
}
void ldrh_d(int rd, int rb, ARMWord offset, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, [%s, #-%u]\n", MAYBE_PAD, "ldrh", nameGpReg(rd), nameGpReg(rb), offset);
spew("%-15s %s, [%s, #-%u]",
"ldrh", nameGpReg(rd), nameGpReg(rb), offset);
emitInst(static_cast<ARMWord>(cc) | LDRH | HDT_UH | DT_PRE, rd, rb, offset);
}
void ldrh_u(int rd, int rb, ARMWord offset, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, [%s, #+%u]\n", MAYBE_PAD, "ldrh", nameGpReg(rd), nameGpReg(rb), offset);
spew("%-15s %s, [%s, #+%u]",
"ldrh", nameGpReg(rd), nameGpReg(rb), offset);
emitInst(static_cast<ARMWord>(cc) | LDRH | HDT_UH | DT_UP | DT_PRE, rd, rb, offset);
}
void ldrsh_d(int rd, int rb, ARMWord offset, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, [%s, #-%u]\n", MAYBE_PAD, "ldrsh", nameGpReg(rd), nameGpReg(rb), offset);
spew("%-15s %s, [%s, #-%u]",
"ldrsh", nameGpReg(rd), nameGpReg(rb), offset);
emitInst(static_cast<ARMWord>(cc) | LDRH | HDT_UH | HDT_S | DT_PRE, rd, rb, offset);
}
void ldrsh_u(int rd, int rb, ARMWord offset, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, [%s, #+%u]\n", MAYBE_PAD, "ldrsh", nameGpReg(rd), nameGpReg(rb), offset);
spew("%-15s %s, [%s, #+%u]",
"ldrsh", nameGpReg(rd), nameGpReg(rb), offset);
emitInst(static_cast<ARMWord>(cc) | LDRH | HDT_UH | HDT_S | DT_UP | DT_PRE, rd, rb, offset);
}
void strh_r(int rb, int rm, int rd, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, [%s, +%s]\n", MAYBE_PAD, "strh", nameGpReg(rd), nameGpReg(rb), nameGpReg(rm));
spew("%-15s %s, [%s, +%s]",
"strh", nameGpReg(rd), nameGpReg(rb), nameGpReg(rm));
emitInst(static_cast<ARMWord>(cc) | STRH | HDT_UH | DT_UP | DT_PRE, rd, rb, rm);
}
void push_r(int reg, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s {%s}\n", MAYBE_PAD, "push", nameGpReg(reg));
spew("%-15s {%s}",
"push", nameGpReg(reg));
ASSERT(ARMWord(reg) <= 0xf);
m_buffer.putInt(cc | DTR | DT_WB | RN(ARMRegisters::sp) | RD(reg) | 0x4);
}
void pop_r(int reg, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s {%s}\n", MAYBE_PAD, "pop", nameGpReg(reg));
spew("%-15s {%s}",
"pop", nameGpReg(reg));
ASSERT(ARMWord(reg) <= 0xf);
m_buffer.putInt(cc | (DTR ^ DT_PRE) | DT_LOAD | DT_UP | RN(ARMRegisters::sp) | RD(reg) | 0x4);
}
@ -845,8 +814,7 @@ namespace JSC {
void bkpt(ARMWord value)
{
#if WTF_ARM_ARCH_VERSION >= 5
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s #0x%04x\n", MAYBE_PAD, "bkpt", value);
spew("%-15s #0x%04x", "bkpt", value);
m_buffer.putInt(BKPT | ((value & 0xfff0) << 4) | (value & 0xf));
#else
// Cannot access to Zero memory address
@ -857,9 +825,7 @@ namespace JSC {
void bx(int rm, Condition cc = AL)
{
#if WTF_ARM_ARCH_VERSION >= 5 || defined(__ARM_ARCH_4T__)
js::JaegerSpew(
js::JSpew_Insns,
IPFX "bx%-13s %s\n", MAYBE_PAD, nameCC(cc), nameGpReg(rm));
spew("bx%-13s %s", nameCC(cc), nameGpReg(rm));
emitInst(static_cast<ARMWord>(cc) | BX, 0, 0, RM(rm));
#else
mov_r(ARMRegisters::pc, RM(rm), cc);
@ -870,9 +836,7 @@ namespace JSC {
{
#if WTF_CPU_ARM && WTF_ARM_ARCH_VERSION >= 5
int s = m_buffer.uncheckedSize();
js::JaegerSpew(
js::JSpew_Insns,
IPFX "blx%-12s %s\n", MAYBE_PAD, nameCC(cc), nameGpReg(rm));
spew("blx%-12s %s", nameCC(cc), nameGpReg(rm));
emitInst(static_cast<ARMWord>(cc) | BLX, 0, 0, RM(rm));
#else
ASSERT(rm != 14);
@ -961,7 +925,7 @@ namespace JSC {
JmpDst label()
{
JmpDst label(m_buffer.size());
js::JaegerSpew(js::JSpew_Insns, IPFX "#label ((%d))\n", MAYBE_PAD, label.m_offset);
spew("#label ((%d))", label.m_offset);
return label;
}
@ -1046,27 +1010,24 @@ namespace JSC {
static void linkPointer(void* code, JmpDst from, void* to)
{
js::JaegerSpew(js::JSpew_Insns,
"##linkPointer ((%p + %#x)) points to ((%p))\n",
code, from.m_offset, to);
staticSpew("##linkPointer ((%p + %#x)) points to ((%p))",
code, from.m_offset, to);
patchPointerInternal(reinterpret_cast<intptr_t>(code) + from.m_offset, to);
}
static void repatchInt32(void* from, int32_t to)
{
js::JaegerSpew(js::JSpew_Insns,
ISPFX "##repatchInt32 ((%p)) holds ((%#x))\n",
from, to);
staticSpew("##repatchInt32 ((%p)) holds ((%#x))",
from, to);
patchPointerInternal(reinterpret_cast<intptr_t>(from), reinterpret_cast<void*>(to));
}
static void repatchPointer(void* from, void* to)
{
js::JaegerSpew(js::JSpew_Insns,
"##repatchPointer ((%p)) points to ((%p))\n",
from, to);
staticSpew("##repatchPointer ((%p)) points to ((%p))",
from, to);
patchPointerInternal(reinterpret_cast<intptr_t>(from), to);
}
@ -1103,27 +1064,24 @@ namespace JSC {
ARMWord* insn = reinterpret_cast<ARMWord*>(code + from.m_offset);
ARMWord* addr = getLdrImmAddressOnPool(insn, m_buffer.poolAddress());
js::JaegerSpew(js::JSpew_Insns,
IPFX "##linkJump ((%#x)) jumps to ((%#x))\n", MAYBE_PAD,
from.m_offset, to.m_offset);
spew("##linkJump ((%#x)) jumps to ((%#x))",
from.m_offset, to.m_offset);
*addr = to.m_offset;
}
static void linkJump(void* code, JmpSrc from, void* to)
{
js::JaegerSpew(js::JSpew_Insns,
ISPFX "##linkJump ((%p + %#x)) jumps to ((%p))\n",
code, from.m_offset, to);
staticSpew("##linkJump ((%p + %#x)) jumps to ((%p))",
code, from.m_offset, to);
patchPointerInternal(reinterpret_cast<intptr_t>(code) + from.m_offset, to);
}
static void relinkJump(void* from, void* to)
{
js::JaegerSpew(js::JSpew_Insns,
ISPFX "##relinkJump ((%p)) jumps to ((%p))\n",
from, to);
staticSpew("##relinkJump ((%p)) jumps to ((%p))",
from, to);
patchPointerInternal(reinterpret_cast<intptr_t>(from), to);
}
@ -1135,18 +1093,16 @@ namespace JSC {
static void linkCall(void* code, JmpSrc from, void* to)
{
js::JaegerSpew(js::JSpew_Insns,
ISPFX "##linkCall ((%p + %#x)) jumps to ((%p))\n",
code, from.m_offset, to);
staticSpew("##linkCall ((%p + %#x)) jumps to ((%p))",
code, from.m_offset, to);
patchPointerInternal(reinterpret_cast<intptr_t>(code) + from.m_offset, to);
}
static void relinkCall(void* from, void* to)
{
js::JaegerSpew(js::JSpew_Insns,
ISPFX "##relinkCall ((%p)) jumps to ((%p))\n",
from, to);
staticSpew("##relinkCall ((%p)) jumps to ((%p))",
from, to);
patchPointerInternal(reinterpret_cast<intptr_t>(from), to);
}
@ -1385,8 +1341,7 @@ namespace JSC {
char op2_fmt[48];
fmtOp2(op2_fmt, op2);
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, %s, %s\n", MAYBE_PAD, mnemonic, nameGpReg(rd), nameGpReg(rn), op2_fmt);
spew("%-15s %s, %s, %s", mnemonic, nameGpReg(rd), nameGpReg(rn), op2_fmt);
}
void spewInsWithOp2(char const * ins, Condition cc, int r, ARMWord op2)
@ -1397,8 +1352,7 @@ namespace JSC {
char op2_fmt[48];
fmtOp2(op2_fmt, op2);
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, %s\n", MAYBE_PAD, mnemonic, nameGpReg(r), op2_fmt);
spew("%-15s %s, %s", mnemonic, nameGpReg(r), op2_fmt);
}
ARMWord RM(int reg)
@ -1556,10 +1510,9 @@ namespace JSC {
void fmem_imm_off(bool isLoad, bool isDouble, bool isUp, int dest, int rn, ARMWord offset, Condition cc = AL)
{
char const * ins = isLoad ? "vldr.f" : "vstr.f";
js::JaegerSpew(js::JSpew_Insns,
IPFX "%s%d %s, [%s, #%s%u]\n", MAYBE_PAD,
ins, (isDouble ? 64 : 32), (isDouble ? nameFpRegD(dest) : nameFpRegS(dest)),
nameGpReg(rn), (isUp ? "+" : "-"), offset);
spew("%s%d %s, [%s, #%s%u]",
ins, (isDouble ? 64 : 32), (isDouble ? nameFpRegD(dest) : nameFpRegS(dest)),
nameGpReg(rn), (isUp ? "+" : "-"), offset);
ASSERT(offset <= 0xff);
emitVFPInst(static_cast<ARMWord>(cc) |
VFP_EXT | VFP_DTR |
@ -1576,10 +1529,9 @@ namespace JSC {
ASSERT(srcType != dstType);
ASSERT(isFloatType(srcType) || isFloatType(dstType));
js::JaegerSpew(js::JSpew_Insns,
IPFX "vcvt.%s.%-15s, %s,%s\n", MAYBE_PAD,
nameType(dstType), nameType(srcType),
nameTypedReg(dstType,dest), nameTypedReg(srcType,src));
spew("vcvt.%s.%-15s, %s,%s",
nameType(dstType), nameType(srcType),
nameTypedReg(dstType,dest), nameTypedReg(srcType,src));
if (isFloatType(srcType) && isFloatType (dstType)) {
// doing a float -> float conversion
@ -1597,13 +1549,11 @@ namespace JSC {
void vmov64 (bool fromFP, bool isDbl, int r1, int r2, int rFP, Condition cc = AL)
{
if (fromFP) {
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, %s, %s\n", MAYBE_PAD, "vmov",
nameGpReg(r1), nameGpReg(r2), nameFpRegD(rFP));
spew("%-15s %s, %s, %s", "vmov",
nameGpReg(r1), nameGpReg(r2), nameFpRegD(rFP));
} else {
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, %s, %s\n", MAYBE_PAD, "vmov",
nameFpRegD(rFP), nameGpReg(r1), nameGpReg(r2));
spew("%-15s %s, %s, %s", "vmov",
nameFpRegD(rFP), nameGpReg(r1), nameGpReg(r2));
}
emitVFPInst(static_cast<ARMWord>(cc) | VFP_DXFER | VFP_MOV |
(fromFP ? DT_LOAD : 0) |
@ -1612,9 +1562,8 @@ namespace JSC {
void fcpyd_r(int dd, int dm, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, %s\n", MAYBE_PAD, "vmov.f64",
nameFpRegD(dd), nameFpRegD(dm));
spew("%-15s %s, %s", "vmov.f64",
nameFpRegD(dd), nameFpRegD(dm));
// TODO: emitInst doesn't work for VFP instructions, though it
// seems to work for current usage.
emitVFPInst(static_cast<ARMWord>(cc) | FCPYD, DD(dd), DM(dm), 0);
@ -1622,8 +1571,7 @@ namespace JSC {
void faddd_r(int dd, int dn, int dm, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, %s, %s\n", MAYBE_PAD, "vadd.f64", nameFpRegD(dd), nameFpRegD(dn), nameFpRegD(dm));
spew("%-15s %s, %s, %s", "vadd.f64", nameFpRegD(dd), nameFpRegD(dn), nameFpRegD(dm));
// TODO: emitInst doesn't work for VFP instructions, though it
// seems to work for current usage.
emitVFPInst(static_cast<ARMWord>(cc) | FADDD, DD(dd), DN(dn), DM(dm));
@ -1631,15 +1579,13 @@ namespace JSC {
void fnegd_r(int dd, int dm, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, %s\n", MAYBE_PAD, "fnegd", nameFpRegD(dd), nameFpRegD(dm));
spew("%-15s %s, %s", "fnegd", nameFpRegD(dd), nameFpRegD(dm));
m_buffer.putInt(static_cast<ARMWord>(cc) | FNEGD | DD(dd) | DM(dm));
}
void fdivd_r(int dd, int dn, int dm, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, %s, %s\n", MAYBE_PAD, "vdiv.f64", nameFpRegD(dd), nameFpRegD(dn), nameFpRegD(dm));
spew("%-15s %s, %s, %s", "vdiv.f64", nameFpRegD(dd), nameFpRegD(dn), nameFpRegD(dm));
// TODO: emitInst doesn't work for VFP instructions, though it
// seems to work for current usage.
emitVFPInst(static_cast<ARMWord>(cc) | FDIVD, DD(dd), DN(dn), DM(dm));
@ -1647,8 +1593,7 @@ namespace JSC {
void fsubd_r(int dd, int dn, int dm, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, %s, %s\n", MAYBE_PAD, "vsub.f64", nameFpRegD(dd), nameFpRegD(dn), nameFpRegD(dm));
spew("%-15s %s, %s, %s", "vsub.f64", nameFpRegD(dd), nameFpRegD(dn), nameFpRegD(dm));
// TODO: emitInst doesn't work for VFP instructions, though it
// seems to work for current usage.
emitVFPInst(static_cast<ARMWord>(cc) | FSUBD, DD(dd), DN(dn), DM(dm));
@ -1656,15 +1601,13 @@ namespace JSC {
void fabsd_r(int dd, int dm, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, %s\n", MAYBE_PAD, "fabsd", nameFpRegD(dd), nameFpRegD(dm));
spew("%-15s %s, %s", "fabsd", nameFpRegD(dd), nameFpRegD(dm));
m_buffer.putInt(static_cast<ARMWord>(cc) | FABSD | DD(dd) | DM(dm));
}
void fmuld_r(int dd, int dn, int dm, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, %s, %s\n", MAYBE_PAD, "vmul.f64", nameFpRegD(dd), nameFpRegD(dn), nameFpRegD(dm));
spew("%-15s %s, %s, %s", "vmul.f64", nameFpRegD(dd), nameFpRegD(dn), nameFpRegD(dm));
// TODO: emitInst doesn't work for VFP instructions, though it
// seems to work for current usage.
emitVFPInst(static_cast<ARMWord>(cc) | FMULD, DD(dd), DN(dn), DM(dm));
@ -1672,8 +1615,7 @@ namespace JSC {
void fcmpd_r(int dd, int dm, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, %s\n", MAYBE_PAD, "vcmp.f64", nameFpRegD(dd), nameFpRegD(dm));
spew("%-15s %s, %s", "vcmp.f64", nameFpRegD(dd), nameFpRegD(dm));
// TODO: emitInst doesn't work for VFP instructions, though it
// seems to work for current usage.
emitVFPInst(static_cast<ARMWord>(cc) | FCMPD, DD(dd), 0, DM(dm));
@ -1681,8 +1623,7 @@ namespace JSC {
void fsqrtd_r(int dd, int dm, Condition cc = AL)
{
js::JaegerSpew(js::JSpew_Insns,
IPFX "%-15s %s, %s\n", MAYBE_PAD, "vsqrt.f64", nameFpRegD(dd), nameFpRegD(dm));
spew("%-15s %s, %s", "vsqrt.f64", nameFpRegD(dd), nameFpRegD(dm));
// TODO: emitInst doesn't work for VFP instructions, though it
// seems to work for current usage.
emitVFPInst(static_cast<ARMWord>(cc) | FSQRTD, DD(dd), 0, DM(dm));

Просмотреть файл

@ -39,6 +39,20 @@
#include "assembler/jit/ExecutableAllocator.h"
#include "assembler/wtf/Assertions.h"
#include <stdarg.h>
#include "jsopcode.h"
#include "methodjit/Logging.h"
#include "ion/IonSpewer.h"
#define PRETTY_PRINT_OFFSET(os) (((os)<0)?"-":""), (((os)<0)?-(os):(os))
#define FIXME_INSN_PRINTING \
do { \
spew("FIXME insn printing %s:%d", \
__FILE__, __LINE__); \
} while (0)
namespace JSC {
class AssemblerBuffer {
@ -234,6 +248,91 @@ namespace JSC {
bool m_oom;
};
class GenericAssembler
{
js::Sprinter *printer;
public:
bool isOOLPath;
GenericAssembler()
: printer(NULL)
, isOOLPath(false)
{}
void setPrinter(js::Sprinter *sp) {
printer = sp;
}
void spew(const char *fmt, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 2, 3)))
#endif
{
if (printer ||
js::IsJaegerSpewChannelActive(js::JSpew_Insns)
#ifdef JS_ION
|| js::ion::IonSpewEnabled(js::ion::IonSpew_Codegen)
#endif
)
{
// Buffer to hold the formatted string. Note that this may contain
// '%' characters, so do not pass it directly to printf functions.
char buf[200];
va_list va;
va_start(va, fmt);
int i = vsnprintf(buf, sizeof(buf), fmt, va);
va_end(va);
if (i > -1) {
if (printer)
printer->printf("%s\n", buf);
// The assembler doesn't know which compiler it is for, so if
// both JM and Ion spew are on, just print via one channel
// (Use JM to pick up isOOLPath).
if (js::IsJaegerSpewChannelActive(js::JSpew_Insns))
js::JaegerSpew(js::JSpew_Insns, "%s %s\n", isOOLPath ? ">" : " ", buf);
#ifdef JS_ION
else
js::ion::IonSpew(js::ion::IonSpew_Codegen, "%s", buf);
#endif
}
}
}
static void staticSpew(const char *fmt, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 1, 2)))
#endif
{
if (js::IsJaegerSpewChannelActive(js::JSpew_Insns)
#ifdef JS_ION
|| js::ion::IonSpewEnabled(js::ion::IonSpew_Codegen)
#endif
)
{
char buf[200];
va_list va;
va_start(va, fmt);
int i = vsnprintf(buf, sizeof(buf), fmt, va);
va_end(va);
if (i > -1) {
if (js::IsJaegerSpewChannelActive(js::JSpew_Insns))
js::JaegerSpew(js::JSpew_Insns, " %s\n", buf);
#ifdef JS_ION
else
js::ion::IonSpew(js::ion::IonSpew_Codegen, "%s", buf);
#endif
}
}
}
};
} // namespace JSC
#endif // ENABLE(ASSEMBLER)

Просмотреть файл

@ -333,8 +333,8 @@ private:
// optionally place a jump to ensure we don't start executing the pool.
void flushConstantPool(bool useBarrier = true)
{
js::JaegerSpew(js::JSpew_Insns, " -- FLUSHING CONSTANT POOL WITH %d CONSTANTS --\n",
m_numConsts);
GenericAssembler::staticSpew(" -- FLUSHING CONSTANT POOL WITH %d CONSTANTS --\n",
m_numConsts);
if (m_numConsts == 0)
return;
m_flushCount++;

Просмотреть файл

@ -40,17 +40,8 @@
#define ISPFX " "
#ifdef JS_METHODJIT_SPEW
# define MAYBE_PAD (isOOLPath ? "> " : "")
# define PRETTY_PRINT_OFFSET(os) (((os)<0)?"-":""), (((os)<0)?-(os):(os))
# define FIXME_INSN_PRINTING \
do { \
js::JaegerSpew(js::JSpew_Insns, \
ISPFX "FIXME insn printing %s:%d\n", \
__FILE__, __LINE__); \
} while (0)
#else
# define MAYBE_PAD ""
# define FIXME_INSN_PRINTING ((void) 0)
# define PRETTY_PRINT_OFFSET(os) "", 0
#endif
namespace JSC {
@ -162,7 +153,7 @@ typedef enum {
} // namespace MIPSRegisters
class MIPSAssembler {
class MIPSAssembler : public GenericAssembler {
public:
typedef MIPSRegisters::RegisterID RegisterID;
typedef MIPSRegisters::FPRegisterID FPRegisterID;
@ -170,13 +161,6 @@ public:
unsigned char *buffer() const { return m_buffer.buffer(); }
bool oom() const { return m_buffer.oom(); }
#ifdef JS_METHODJIT_SPEW
bool isOOLPath;
MIPSAssembler() : isOOLPath(false) { }
#else
MIPSAssembler() { }
#endif
// MIPS instruction opcode field position
enum {
OP_SH_RD = 11,

Просмотреть файл

@ -22,17 +22,8 @@
#define ISPFX " "
#ifdef JS_METHODJIT_SPEW
# define MAYBE_PAD (isOOLPath ? "> " : "")
# define PRETTY_PRINT_OFFSET(os) (((os)<0)?"-":""), (((os)<0)?-(os):(os))
# define FIXME_INSN_PRINTING \
do { \
js::JaegerSpew(js::JSpew_Insns, \
ISPFX "FIXME insn printing %s:%d\n", \
__FILE__, __LINE__); \
} while (0)
#else
# define MAYBE_PAD ""
# define FIXME_INSN_PRINTING ((void) 0)
# define PRETTY_PRINT_OFFSET(os) "", 0
#endif
namespace JSC {
@ -118,20 +109,13 @@ namespace JSC {
} // namespace SparcRegisters
class SparcAssembler {
class SparcAssembler : public GenericAssembler {
public:
typedef SparcRegisters::RegisterID RegisterID;
typedef SparcRegisters::FPRegisterID FPRegisterID;
AssemblerBuffer m_buffer;
bool oom() const { return m_buffer.oom(); }
#ifdef JS_METHODJIT_SPEW
bool isOOLPath;
SparcAssembler() : isOOLPath(false) { }
#else
SparcAssembler() { }
#endif
// Sparc conditional constants
typedef enum {
ConditionE = 0x1, // Zero

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -10,8 +10,6 @@
#ifndef jsion_c1spewer_h__
#define jsion_c1spewer_h__
#include "jscntxt.h"
namespace js {
namespace ion {

Просмотреть файл

@ -1457,6 +1457,7 @@ CodeGenerator::generateBody()
printer.construct(GetIonContext()->cx);
if (!printer.ref().init())
return false;
masm.setPrinter(printer.addr());
}
for (; iter != current->end(); iter++) {
@ -1475,8 +1476,10 @@ CodeGenerator::generateBody()
if (masm.oom())
return false;
if (counts)
if (counts) {
counts->block(i).setCode(printer.ref().string());
masm.setPrinter(NULL);
}
}
JS_ASSERT(pushedArgumentSlots_.empty());

Просмотреть файл

@ -1269,6 +1269,10 @@ class Assembler
static const uint32 * getPtr32Target(Iter *iter, Register *dest = NULL, RelocStyle *rs = NULL);
bool oom() const;
void setPrinter(Sprinter *sp) {
}
private:
bool isFinished;
public:

Просмотреть файл

@ -5,12 +5,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ion/IonSpewer.h"
#include "jscompartment.h"
#include "assembler/assembler/MacroAssembler.h"
#include "ion/IonCompartment.h"
#include "ion/IonLinker.h"
#include "ion/IonFrames.h"
#include "ion/IonSpewer.h"
#include "ion/Bailouts.h"
#include "ion/VMFunctions.h"

Просмотреть файл

@ -128,6 +128,10 @@ class AssemblerX86Shared
dataRelocations_.oom();
}
void setPrinter(Sprinter *sp) {
masm.setPrinter(sp);
}
void executableCopy(void *buffer);
void processDeferredData(IonCode *code, uint8 *data);
void processCodeLabels(IonCode *code);

Просмотреть файл

@ -85,6 +85,11 @@ struct Profiler {
#else
static inline bool IsJaegerSpewChannelActive(JaegerSpewChannel channel)
{
return false;
}
static inline void JaegerSpew(JaegerSpewChannel channel, const char *fmt, ...)
{
}