ExecutionHarness.h [plain text]
#ifndef ExecutionHarness_h
#define ExecutionHarness_h
#include <wtf/Platform.h>
#if ENABLE(JIT)
#include "JITDriver.h"
#include "LLIntEntrypoints.h"
namespace JSC {
template<typename CodeBlockType>
inline bool prepareForExecution(ExecState* exec, OwnPtr<CodeBlockType>& codeBlock, JITCode& jitCode, JITCode::JITType jitType, unsigned bytecodeIndex)
{
#if ENABLE(LLINT)
if (JITCode::isBaselineCode(jitType)) {
LLInt::getEntrypoint(exec->vm(), codeBlock.get(), jitCode);
codeBlock->setJITCode(jitCode, MacroAssemblerCodePtr());
if (exec->vm().m_perBytecodeProfiler)
exec->vm().m_perBytecodeProfiler->ensureBytecodesFor(codeBlock.get());
return true;
}
#endif // ENABLE(LLINT)
return jitCompileIfAppropriate(exec, codeBlock, jitCode, jitType, bytecodeIndex, JITCode::isBaselineCode(jitType) ? JITCompilationMustSucceed : JITCompilationCanFail);
}
inline bool prepareFunctionForExecution(ExecState* exec, OwnPtr<FunctionCodeBlock>& codeBlock, JITCode& jitCode, MacroAssemblerCodePtr& jitCodeWithArityCheck, JITCode::JITType jitType, unsigned bytecodeIndex, CodeSpecializationKind kind)
{
#if ENABLE(LLINT)
if (JITCode::isBaselineCode(jitType)) {
LLInt::getFunctionEntrypoint(exec->vm(), kind, jitCode, jitCodeWithArityCheck);
codeBlock->setJITCode(jitCode, jitCodeWithArityCheck);
if (exec->vm().m_perBytecodeProfiler)
exec->vm().m_perBytecodeProfiler->ensureBytecodesFor(codeBlock.get());
return true;
}
#else
UNUSED_PARAM(kind);
#endif // ENABLE(LLINT)
return jitCompileFunctionIfAppropriate(exec, codeBlock, jitCode, jitCodeWithArityCheck, jitType, bytecodeIndex, JITCode::isBaselineCode(jitType) ? JITCompilationMustSucceed : JITCompilationCanFail);
}
}
#endif // ENABLE(JIT)
#endif // ExecutionHarness_h