Bug 1447578 part 5 - Assert WasmMacroAssembler does not have GC relocation data. r=jonco

--HG--
extra : rebase_source : 15025caf91306f9ec456fc393035d41b87bcab33
This commit is contained in:
Jan de Mooij 2018-03-21 16:59:07 +01:00
parent d151471127
commit 74b08e1309
6 changed files with 37 additions and 0 deletions

View File

@ -2650,6 +2650,9 @@ class MOZ_RAII WasmMacroAssembler : public MacroAssembler
explicit WasmMacroAssembler(TempAllocator& alloc)
: MacroAssembler(WasmToken(), alloc)
{}
~WasmMacroAssembler() {
assertNoGCThings();
}
};
// Heap-allocated MacroAssembler used for Ion off-thread code generation.

View File

@ -1764,6 +1764,14 @@ class Assembler : public AssemblerShared
static void TraceJumpRelocations(JSTracer* trc, JitCode* code, CompactBufferReader& reader);
static void TraceDataRelocations(JSTracer* trc, JitCode* code, CompactBufferReader& reader);
void assertNoGCThings() const {
#ifdef DEBUG
MOZ_ASSERT(dataRelocations_.length() == 0);
for (auto& j : jumps_)
MOZ_ASSERT(j.kind() == Relocation::HARDCODED);
#endif
}
static bool SupportsFloatingPoint() {
return HasVFP();
}

View File

@ -334,6 +334,14 @@ class Assembler : public vixl::Assembler
static void TraceJumpRelocations(JSTracer* trc, JitCode* code, CompactBufferReader& reader);
static void TraceDataRelocations(JSTracer* trc, JitCode* code, CompactBufferReader& reader);
void assertNoGCThings() const {
#ifdef DEBUG
MOZ_ASSERT(dataRelocations_.length() == 0);
for (auto& j : pendingJumps_)
MOZ_ASSERT(j.kind == Relocation::HARDCODED);
#endif
}
public:
// A Jump table entry is 2 instructions, with 8 bytes of raw data
static const size_t SizeOfJumpTableEntry = 16;

View File

@ -911,6 +911,14 @@ class AssemblerMIPSShared : public AssemblerShared
}
}
void assertNoGCThings() const {
#ifdef DEBUG
MOZ_ASSERT(dataRelocations_.length() == 0);
for (auto& j : jumps_)
MOZ_ASSERT(j.kind == Relocation::HARDCODED);
#endif
}
public:
bool oom() const;

View File

@ -201,6 +201,8 @@ class MacroAssemblerNone : public Assembler
bool appendRawCode(const uint8_t* code, size_t numBytes) { MOZ_CRASH(); }
bool swapBuffer(wasm::Bytes& bytes) { MOZ_CRASH(); }
void assertNoGCThings() const { MOZ_CRASH(); }
static void TraceJumpRelocations(JSTracer*, JitCode*, CompactBufferReader&) { MOZ_CRASH(); }
static void TraceDataRelocations(JSTracer*, JitCode*, CompactBufferReader&) { MOZ_CRASH(); }

View File

@ -395,6 +395,14 @@ class AssemblerX86Shared : public AssemblerShared
static void TraceDataRelocations(JSTracer* trc, JitCode* code, CompactBufferReader& reader);
void assertNoGCThings() const {
#ifdef DEBUG
MOZ_ASSERT(dataRelocations_.length() == 0);
for (auto& j : jumps_)
MOZ_ASSERT(j.kind == Relocation::HARDCODED);
#endif
}
bool oom() const {
return AssemblerShared::oom() ||
masm.oom() ||