JITStubRoutineSet.h [plain text]
#pragma once
#include "JITStubRoutine.h"
#include <wtf/FastMalloc.h>
#include <wtf/HashMap.h>
#include <wtf/Vector.h>
namespace JSC {
class GCAwareJITStubRoutine;
class SlotVisitor;
#if ENABLE(JIT)
class JITStubRoutineSet {
WTF_MAKE_NONCOPYABLE(JITStubRoutineSet);
WTF_MAKE_FAST_ALLOCATED;
public:
JITStubRoutineSet();
~JITStubRoutineSet();
void add(GCAwareJITStubRoutine*);
void clearMarks();
void mark(void* candidateAddress)
{
uintptr_t address = reinterpret_cast<uintptr_t>(candidateAddress);
if (!JITStubRoutine::passesFilter(address))
return;
markSlow(address);
}
void deleteUnmarkedJettisonedStubRoutines();
void traceMarkedStubRoutines(SlotVisitor&);
unsigned size() const { return m_listOfRoutines.size(); }
GCAwareJITStubRoutine* at(unsigned i) const { return m_listOfRoutines[i]; }
private:
void markSlow(uintptr_t address);
HashMap<uintptr_t, GCAwareJITStubRoutine*> m_addressToRoutineMap;
Vector<GCAwareJITStubRoutine*> m_listOfRoutines;
};
#else // !ENABLE(JIT)
class JITStubRoutineSet {
WTF_MAKE_NONCOPYABLE(JITStubRoutineSet);
WTF_MAKE_FAST_ALLOCATED;
public:
JITStubRoutineSet() { }
~JITStubRoutineSet() { }
void add(GCAwareJITStubRoutine*) { }
void clearMarks() { }
void mark(void*) { }
void deleteUnmarkedJettisonedStubRoutines() { }
void traceMarkedStubRoutines(SlotVisitor&) { }
};
#endif // !ENABLE(JIT)
}