Example #1
0
ResolveGlobalStatus ResolveGlobalStatus::computeFor(CodeBlock* codeBlock, int, ResolveOperation* operation, Identifier& identifier)
{
    ASSERT(operation->m_operation == ResolveOperation::GetAndReturnGlobalProperty);
    if (!operation->m_structure)
        return ResolveGlobalStatus();
    
    return computeForStructure(codeBlock, operation->m_structure.get(), identifier);
}
ResolveGlobalStatus ResolveGlobalStatus::computeFor(CodeBlock* codeBlock, unsigned bytecodeIndex, Identifier& identifier)
{
#if ENABLE(JIT) && ENABLE(VALUE_PROFILER)
    if (!codeBlock->numberOfGlobalResolveInfos())
        return computeForLLInt(codeBlock, bytecodeIndex, identifier);
    
    if (codeBlock->likelyToTakeSlowCase(bytecodeIndex))
        return ResolveGlobalStatus(TakesSlowPath);
    
    GlobalResolveInfo& globalResolveInfo = codeBlock->globalResolveInfoForBytecodeOffset(bytecodeIndex);
    
    if (!globalResolveInfo.structure)
        return computeForLLInt(codeBlock, bytecodeIndex, identifier);
    
    return computeForStructure(codeBlock, globalResolveInfo.structure.get(), identifier);
#else
    return computeForLLInt(codeBlock, bytecodeIndex, identifier);
#endif
}
static ResolveGlobalStatus computeForLLInt(CodeBlock* codeBlock, unsigned bytecodeIndex, Identifier& identifier)
{
#if ENABLE(LLINT)
    Instruction* instruction = codeBlock->instructions().begin() + bytecodeIndex;

    ASSERT(instruction[0].u.opcode == LLInt::getOpcode(op_resolve_global));
    
    Structure* structure = instruction[3].u.structure.get();
    if (!structure)
        return ResolveGlobalStatus();
    
    return computeForStructure(codeBlock, structure, identifier);
#else
    UNUSED_PARAM(codeBlock);
    UNUSED_PARAM(bytecodeIndex);
    UNUSED_PARAM(identifier);
    return ResolveGlobalStatus();
#endif
}