Bug 650161 - Update pointers in TraceDataRelocations r=mjrosenb

This commit is contained in:
Jon Coppeard 2014-08-14 11:46:55 +01:00
Родитель 5b1c8897ed
Коммит eec4a0fd36
3 изменённых файлов: 32 добавлений и 15 удалений

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

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

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

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

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

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