PolymorphicAccessStructureList.h [plain text]
#ifndef PolymorphicAccessStructureList_h
#define PolymorphicAccessStructureList_h
#include "JITStubRoutine.h"
#include "Structure.h"
#include "StructureChain.h"
#define POLYMORPHIC_LIST_CACHE_SIZE 8
namespace JSC {
#if ENABLE(JIT)
struct PolymorphicAccessStructureList {
WTF_MAKE_FAST_ALLOCATED;
public:
struct PolymorphicStubInfo {
bool isDirect : 1;
unsigned count : 31;
RefPtr<JITStubRoutine> stubRoutine;
WriteBarrier<Structure> base;
WriteBarrier<StructureChain> chain;
PolymorphicStubInfo()
{
}
void set(VM& vm, JSCell* owner, PassRefPtr<JITStubRoutine> _stubRoutine, Structure* _base, bool _isDirect)
{
stubRoutine = _stubRoutine;
base.set(vm, owner, _base);
isDirect = _isDirect;
count = 0;
}
void set(VM& vm, JSCell* owner, PassRefPtr<JITStubRoutine> _stubRoutine, Structure* _base, StructureChain* _chain, bool _isDirect, unsigned _count)
{
stubRoutine = _stubRoutine;
base.set(vm, owner, _base);
chain.set(vm, owner, _chain);
isDirect = _isDirect;
count = _count;
}
} list[POLYMORPHIC_LIST_CACHE_SIZE];
PolymorphicAccessStructureList()
{
}
PolymorphicAccessStructureList(VM& vm, JSCell* owner, PassRefPtr<JITStubRoutine> stubRoutine, Structure* firstBase, bool isDirect)
{
list[0].set(vm, owner, stubRoutine, firstBase, isDirect);
}
PolymorphicAccessStructureList(VM& vm, JSCell* owner, PassRefPtr<JITStubRoutine> stubRoutine, Structure* firstBase, StructureChain* firstChain, bool isDirect, unsigned count)
{
list[0].set(vm, owner, stubRoutine, firstBase, firstChain, isDirect, count);
}
bool visitWeak(int count)
{
for (int i = 0; i < count; ++i) {
PolymorphicStubInfo& info = list[i];
if (!info.base)
continue;
if (!Heap::isMarked(info.base.get()))
return false;
if (info.chain && !Heap::isMarked(info.chain.get()))
return false;
}
return true;
}
};
#endif // ENABLE(JIT)
}
#endif // PolymorphicAccessStructureList_h