mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1198145 - guard calls to getInst(). r=me
This commit is contained in:
parent
39ab1252d6
commit
e682cb1420
@ -1427,7 +1427,7 @@ Assembler::bytesNeeded() const
|
||||
void
|
||||
Assembler::spew(Instruction* i)
|
||||
{
|
||||
if (spewDisabled())
|
||||
if (spewDisabled() || !i)
|
||||
return;
|
||||
disasm::NameConverter converter;
|
||||
disasm::Disassembler dasm(converter);
|
||||
@ -1453,7 +1453,7 @@ Assembler::spewTarget(Label* target)
|
||||
void
|
||||
Assembler::spewBranch(Instruction* i, Label* target /* may be nullptr */)
|
||||
{
|
||||
if (spewDisabled())
|
||||
if (spewDisabled() || !i)
|
||||
return;
|
||||
disasm::NameConverter converter;
|
||||
disasm::Disassembler dasm(converter);
|
||||
@ -1515,7 +1515,10 @@ Assembler::spewData(BufferOffset addr, size_t numInstr, bool loadToPC)
|
||||
{
|
||||
if (spewDisabled())
|
||||
return;
|
||||
uint32_t *instr = reinterpret_cast<uint32_t*>(m_buffer.getInst(addr));
|
||||
Instruction* inst = m_buffer.getInstOrNull(addr);
|
||||
if (!inst)
|
||||
return;
|
||||
uint32_t *instr = reinterpret_cast<uint32_t*>(inst);
|
||||
for ( size_t k=0 ; k < numInstr ; k++ ) {
|
||||
spew(" %08x %08x (patchable constant load%s)",
|
||||
reinterpret_cast<uint32_t>(instr+k), *(instr+k), loadToPC ? " to PC" : "");
|
||||
@ -1636,7 +1639,7 @@ Assembler::writeInst(uint32_t x)
|
||||
{
|
||||
BufferOffset offs = m_buffer.putInt(x);
|
||||
#ifdef JS_DISASM_ARM
|
||||
spew(m_buffer.getInst(offs));
|
||||
spew(m_buffer.getInstOrNull(offs));
|
||||
#endif
|
||||
return offs;
|
||||
}
|
||||
@ -1646,7 +1649,7 @@ Assembler::writeBranchInst(uint32_t x, Label* documentation)
|
||||
{
|
||||
BufferOffset offs = m_buffer.putInt(x, /* markAsBranch = */ true);
|
||||
#ifdef JS_DISASM_ARM
|
||||
spewBranch(m_buffer.getInst(offs), documentation);
|
||||
spewBranch(m_buffer.getInstOrNull(offs), documentation);
|
||||
#endif
|
||||
return offs;
|
||||
}
|
||||
@ -2375,7 +2378,7 @@ Assembler::as_b(Label* l, Condition c)
|
||||
BufferOffset ret = allocBranchInst();
|
||||
as_b(BufferOffset(l).diffB<BOffImm>(ret), c, ret);
|
||||
#ifdef JS_DISASM_ARM
|
||||
spewBranch(m_buffer.getInst(ret), l);
|
||||
spewBranch(m_buffer.getInstOrNull(ret), l);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
@ -2442,7 +2445,7 @@ Assembler::as_bl(Label* l, Condition c)
|
||||
BufferOffset ret = allocBranchInst();
|
||||
as_bl(BufferOffset(l).diffB<BOffImm>(ret), c, ret);
|
||||
#ifdef JS_DISASM_ARM
|
||||
spewBranch(m_buffer.getInst(ret), l);
|
||||
spewBranch(m_buffer.getInstOrNull(ret), l);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
@ -279,6 +279,12 @@ class AssemblerBuffer
|
||||
}
|
||||
|
||||
public:
|
||||
Inst* getInstOrNull(BufferOffset off) {
|
||||
if (!off.assigned())
|
||||
return nullptr;
|
||||
return getInst(off);
|
||||
}
|
||||
|
||||
Inst* getInst(BufferOffset off) {
|
||||
const int offset = off.getOffset();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user