#ifndef Instruction_h
#define Instruction_h
#include "MacroAssembler.h"
#include "Opcode.h"
#include "PropertySlot.h"
#include "SpecialPointer.h"
#include "Structure.h"
#include "StructureChain.h"
#include "VirtualRegister.h"
#include <wtf/VectorTraits.h>
namespace JSC {
class ArrayAllocationProfile;
class ArrayProfile;
class ObjectAllocationProfile;
class VariableWatchpointSet;
struct LLIntCallLinkInfo;
struct ValueProfile;
struct Instruction {
Instruction()
{
u.jsCell.clear();
}
Instruction(Opcode opcode)
{
#if !ENABLE(COMPUTED_GOTO_OPCODES)
u.jsCell.clear();
#endif
u.opcode = opcode;
}
Instruction(int operand)
{
u.jsCell.clear();
u.operand = operand;
}
Instruction(VM& vm, JSCell* owner, Structure* structure)
{
u.structure.clear();
u.structure.set(vm, owner, structure);
}
Instruction(VM& vm, JSCell* owner, StructureChain* structureChain)
{
u.structureChain.clear();
u.structureChain.set(vm, owner, structureChain);
}
Instruction(VM& vm, JSCell* owner, JSCell* jsCell)
{
u.jsCell.clear();
u.jsCell.set(vm, owner, jsCell);
}
Instruction(PropertySlot::GetValueFunc getterFunc) { u.getterFunc = getterFunc; }
Instruction(LLIntCallLinkInfo* callLinkInfo) { u.callLinkInfo = callLinkInfo; }
Instruction(ValueProfile* profile) { u.profile = profile; }
Instruction(ArrayProfile* profile) { u.arrayProfile = profile; }
Instruction(ArrayAllocationProfile* profile) { u.arrayAllocationProfile = profile; }
Instruction(ObjectAllocationProfile* profile) { u.objectAllocationProfile = profile; }
Instruction(WriteBarrier<Unknown>* registerPointer) { u.registerPointer = registerPointer; }
Instruction(Special::Pointer pointer) { u.specialPointer = pointer; }
Instruction(StringImpl* uid) { u.uid = uid; }
Instruction(bool* predicatePointer) { u.predicatePointer = predicatePointer; }
union {
Opcode opcode;
int operand;
WriteBarrierBase<Structure> structure;
WriteBarrierBase<StructureChain> structureChain;
WriteBarrierBase<JSCell> jsCell;
WriteBarrier<Unknown>* registerPointer;
Special::Pointer specialPointer;
PropertySlot::GetValueFunc getterFunc;
LLIntCallLinkInfo* callLinkInfo;
StringImpl* uid;
ValueProfile* profile;
ArrayProfile* arrayProfile;
ArrayAllocationProfile* arrayAllocationProfile;
ObjectAllocationProfile* objectAllocationProfile;
VariableWatchpointSet* watchpointSet;
WriteBarrierBase<JSActivation> activation;
void* pointer;
bool* predicatePointer;
} u;
private:
Instruction(StructureChain*);
Instruction(Structure*);
};
}
namespace WTF {
template<> struct VectorTraits<JSC::Instruction> : VectorTraitsBase<true, JSC::Instruction> { };
}
#endif // Instruction_h