MethodOfGettingAValueProfile.cpp [plain text]
#include "config.h"
#include "MethodOfGettingAValueProfile.h"
#if ENABLE(DFG_JIT)
#include "ArithProfile.h"
#include "CCallHelpers.h"
#include "CodeBlock.h"
#include "JSCInlines.h"
namespace JSC {
MethodOfGettingAValueProfile MethodOfGettingAValueProfile::fromLazyOperand(
CodeBlock* codeBlock, const LazyOperandValueProfileKey& key)
{
MethodOfGettingAValueProfile result;
result.m_kind = LazyOperand;
result.u.lazyOperand.codeBlock = codeBlock;
result.u.lazyOperand.bytecodeOffset = key.bytecodeOffset();
result.u.lazyOperand.operand = key.operand().offset();
return result;
}
void MethodOfGettingAValueProfile::emitReportValue(CCallHelpers& jit, JSValueRegs regs) const
{
switch (m_kind) {
case None:
return;
case Ready:
jit.storeValue(regs, u.profile->specFailBucket(0));
return;
case LazyOperand: {
LazyOperandValueProfileKey key(u.lazyOperand.bytecodeOffset, VirtualRegister(u.lazyOperand.operand));
ConcurrentJSLocker locker(u.lazyOperand.codeBlock->m_lock);
LazyOperandValueProfile* profile =
u.lazyOperand.codeBlock->lazyOperandValueProfiles().add(locker, key);
jit.storeValue(regs, profile->specFailBucket(0));
return;
}
case ArithProfileReady: {
u.arithProfile->emitObserveResult(jit, regs, DoNotHaveTagRegisters);
return;
} }
RELEASE_ASSERT_NOT_REACHED();
}
}
#endif // ENABLE(DFG_JIT)