#ifndef DFGOSRExit_h
#define DFGOSRExit_h
#include <wtf/Platform.h>
#if ENABLE(DFG_JIT)
#include "CodeOrigin.h"
#include "DFGCommon.h"
#include "DFGExitProfile.h"
#include "DFGGPRInfo.h"
#include "DFGValueRecoveryOverride.h"
#include "MacroAssembler.h"
#include "MethodOfGettingAValueProfile.h"
#include "Operands.h"
#include "ValueProfile.h"
#include "ValueRecovery.h"
#include <wtf/Vector.h>
namespace JSC { namespace DFG {
class SpeculativeJIT;
enum SpeculationRecoveryType {
SpeculativeAdd,
BooleanSpeculationCheck
};
class SpeculationRecovery {
public:
SpeculationRecovery(SpeculationRecoveryType type, GPRReg dest, GPRReg src)
: m_type(type)
, m_dest(dest)
, m_src(src)
{
}
SpeculationRecoveryType type() { return m_type; }
GPRReg dest() { return m_dest; }
GPRReg src() { return m_src; }
private:
SpeculationRecoveryType m_type;
GPRReg m_dest;
GPRReg m_src;
};
struct OSRExit {
OSRExit(ExitKind, JSValueSource, MethodOfGettingAValueProfile, SpeculativeJIT*, unsigned streamIndex, unsigned recoveryIndex = 0);
MacroAssemblerCodeRef m_code;
JSValueSource m_jsValueSource;
MethodOfGettingAValueProfile m_valueProfile;
unsigned m_patchableCodeOffset;
CodeOrigin m_codeOrigin;
CodeOrigin m_codeOriginForExitProfile;
unsigned m_recoveryIndex;
unsigned m_watchpointIndex;
ExitKind m_kind;
uint32_t m_count;
bool considerAddingAsFrequentExitSite(CodeBlock* profiledCodeBlock)
{
if (!m_count || !exitKindIsCountable(m_kind))
return false;
return considerAddingAsFrequentExitSiteSlow(profiledCodeBlock);
}
void setPatchableCodeOffset(MacroAssembler::PatchableJump);
MacroAssembler::Jump getPatchableCodeOffsetAsJump() const;
CodeLocationJump codeLocationForRepatch(CodeBlock*) const;
void correctJump(LinkBuffer&);
unsigned m_streamIndex;
int m_lastSetOperand;
RefPtr<ValueRecoveryOverride> m_valueRecoveryOverride;
private:
bool considerAddingAsFrequentExitSiteSlow(CodeBlock* profiledCodeBlock);
};
struct SpeculationFailureDebugInfo {
CodeBlock* codeBlock;
};
} }
#endif // ENABLE(DFG_JIT)
#endif // DFGOSRExit_h