Bug 650161 - Update pointers in TraceDataRelocations r=mjrosenb

This commit is contained in:
Jon Coppeard 2014-08-14 11:46:55 +01:00
parent 2c36c06785
commit d2c826f66f
3 changed files with 32 additions and 15 deletions

View File

@ -795,36 +795,49 @@ Assembler::TraceJumpRelocations(JSTracer *trc, JitCode *code, CompactBufferReade
}
}
template <class Iter>
static void
TraceDataRelocations(JSTracer *trc, uint8_t *buffer, CompactBufferReader &reader)
TraceOneDataRelocation(JSTracer *trc, Iter *iter, MacroAssemblerARM *masm)
{
Instruction *ins = iter->cur();
Register dest;
Assembler::RelocStyle rs;
const void *prior = Assembler::GetPtr32Target(iter, &dest, &rs);
void *ptr = const_cast<void *>(prior);
// No barrier needed since these are constants.
gc::MarkGCThingUnbarriered(trc, &ptr, "ion-masm-ptr");
if (ptr != prior)
masm->ma_movPatchable(Imm32(int32_t(ptr)), dest, Assembler::Always, rs, ins);
}
static void
TraceDataRelocations(JSTracer *trc, uint8_t *buffer, CompactBufferReader &reader,
MacroAssemblerARM *masm)
{
while (reader.more()) {
size_t offset = reader.readUnsigned();
InstructionIterator iter((Instruction*)(buffer + offset));
void *ptr = const_cast<uint32_t *>(Assembler::GetPtr32Target(&iter));
// No barrier needed since these are constants.
gc::MarkGCThingUnbarriered(trc, reinterpret_cast<void **>(&ptr), "ion-masm-ptr");
TraceOneDataRelocation(trc, &iter, masm);
}
}
static void
TraceDataRelocations(JSTracer *trc, ARMBuffer *buffer,
Vector<BufferOffset, 0, SystemAllocPolicy> *locs)
Vector<BufferOffset, 0, SystemAllocPolicy> *locs, MacroAssemblerARM *masm)
{
for (unsigned int idx = 0; idx < locs->length(); idx++) {
BufferOffset bo = (*locs)[idx];
ARMBuffer::AssemblerBufferInstIterator iter(bo, buffer);
void *ptr = const_cast<uint32_t *>(Assembler::GetPtr32Target(&iter));
// No barrier needed since these are constants.
gc::MarkGCThingUnbarriered(trc, reinterpret_cast<void **>(&ptr), "ion-masm-ptr");
TraceOneDataRelocation(trc, &iter, masm);
}
}
void
Assembler::TraceDataRelocations(JSTracer *trc, JitCode *code, CompactBufferReader &reader)
{
::TraceDataRelocations(trc, code->raw(), reader);
::TraceDataRelocations(trc, code->raw(), reader, static_cast<MacroAssemblerARM *>(Dummy));
}
void
@ -860,8 +873,10 @@ Assembler::trace(JSTracer *trc)
}
}
if (tmpDataRelocations_.length())
::TraceDataRelocations(trc, &m_buffer, &tmpDataRelocations_);
if (tmpDataRelocations_.length()) {
::TraceDataRelocations(trc, &m_buffer, &tmpDataRelocations_,
static_cast<MacroAssemblerARM *>(this));
}
}
void

View File

@ -262,6 +262,7 @@ TraceDataRelocations(JSTracer *trc, uint8_t *buffer, CompactBufferReader &reader
// No barrier needed since these are constants.
gc::MarkGCThingUnbarriered(trc, reinterpret_cast<void **>(&ptr), "ion-masm-ptr");
Assembler::UpdateLuiOriValue(inst, inst->next(), uint32_t(ptr));
}
}
@ -276,6 +277,7 @@ TraceDataRelocations(JSTracer *trc, MIPSBuffer *buffer, CompactBufferReader &rea
// No barrier needed since these are constants.
gc::MarkGCThingUnbarriered(trc, reinterpret_cast<void **>(&ptr), "ion-masm-ptr");
Assembler::UpdateLuiOriValue(iter.cur(), iter.next(), uint32_t(ptr));
}
}

View File

@ -54,7 +54,7 @@ TraceDataRelocations(JSTracer *trc, uint8_t *buffer, CompactBufferReader &reader
layout.asBits = *word;
Value v = IMPL_TO_JSVAL(layout);
gc::MarkValueUnbarriered(trc, &v, "ion-masm-value");
JS_ASSERT(*word == JSVAL_TO_IMPL(v).asBits);
*word = JSVAL_TO_IMPL(v).asBits;
continue;
}
#endif