Ignore:
Timestamp:
Jan 9, 2009, 10:47:37 AM (16 years ago)
Author:
[email protected]
Message:

2009-01-09 Sam Weinig <[email protected]>

Roll r39720 back in with a working interpreted mode.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecode/CodeBlock.cpp

    r39737 r39752  
    725725        }
    726726        case op_get_global_var: {
    727             int r0 = it[1].u.operand;
    728             JSValuePtr scope = JSValuePtr(it[2].u.jsCell);
    729             int index = it[3].u.operand;
     727            int r0 = (++it)->u.operand;
     728            JSValuePtr scope = JSValuePtr((++it)->u.jsCell);
     729            int index = (++it)->u.operand;
    730730            printf("[%4d] get_global_var\t %s, %s, %d\n", location, registerName(r0).c_str(), valueToSourceString(exec, scope).ascii(), index);
    731             it += OPCODE_LENGTH(op_get_global_var);
    732731            break;
    733732        }
     
    10921091    macro(identifiers) \
    10931092    macro(functionExpressions) \
    1094     macro(constantRegisters) \
    1095     macro(pcVector)
     1093    macro(constantRegisters)
    10961094
    10971095#define FOR_EACH_MEMBER_VECTOR_RARE_DATA(macro) \
     
    11081106    macro(expressionInfo) \
    11091107    macro(lineInfo) \
    1110     macro(getByIdExceptionInfo)
     1108    macro(getByIdExceptionInfo) \
     1109    macro(pcVector)
    11111110
    11121111template<typename T>
     
    13931392
    13941393    ScopeChainNode* scopeChain = callFrame->scopeChain();
     1394    if (m_needsFullScopeChain) {
     1395        ScopeChain sc(scopeChain);
     1396        int scopeDelta = sc.localDepth();
     1397        if (m_codeType == EvalCode)
     1398            scopeDelta -= static_cast<EvalCodeBlock*>(this)->baseScopeDepth();
     1399        else if (m_codeType == FunctionCode)
     1400            scopeDelta++; // Compilation of function code assumes activation is not on the scope chain yet.
     1401        ASSERT(scopeDelta >= 0);
     1402        while (scopeDelta--)
     1403            scopeChain = scopeChain->next;
     1404    }
    13951405
    13961406    switch (m_codeType) {
     
    13991409            RefPtr<FunctionBodyNode> newFunctionBody = m_globalData->parser->reparse<FunctionBodyNode>(m_globalData, ownerFunctionBodyNode);
    14001410            newFunctionBody->finishParsing(ownerFunctionBodyNode->copyParameters(), ownerFunctionBodyNode->parameterCount());
    1401             CodeBlock& newCodeBlock = newFunctionBody->bytecodeForExceptionInfoReparse(scopeChain);
     1411            CodeBlock& newCodeBlock = newFunctionBody->bytecodeForExceptionInfoReparse(scopeChain, this);
    14021412            ASSERT(newCodeBlock.m_exceptionInfo);
    14031413            ASSERT(newCodeBlock.m_instructionCount == m_instructionCount);
     1414
     1415#if ENABLE(JIT)
     1416            JIT::compile(m_globalData, &newCodeBlock);
     1417            ASSERT(newCodeBlock.m_jitCode.codeSize == m_jitCode.codeSize);
     1418#endif
     1419
    14041420            m_exceptionInfo.set(newCodeBlock.m_exceptionInfo.release());
    14051421            break;
     
    14081424            EvalNode* ownerEvalNode = static_cast<EvalNode*>(m_ownerNode);
    14091425            RefPtr<EvalNode> newEvalBody = m_globalData->parser->reparse<EvalNode>(m_globalData, ownerEvalNode);
    1410             EvalCodeBlock& newCodeBlock = newEvalBody->bytecodeForExceptionInfoReparse(scopeChain);
     1426            EvalCodeBlock& newCodeBlock = newEvalBody->bytecodeForExceptionInfoReparse(scopeChain, this);
    14111427            ASSERT(newCodeBlock.m_exceptionInfo);
    14121428            ASSERT(newCodeBlock.m_instructionCount == m_instructionCount);
     1429
     1430#if ENABLE(JIT)
     1431            JIT::compile(m_globalData, &newCodeBlock);
     1432            ASSERT(newCodeBlock.m_jitCode.codeSize == m_jitCode.codeSize);
     1433#endif
     1434
    14131435            m_exceptionInfo.set(newCodeBlock.m_exceptionInfo.release());
    14141436            break;
     
    15541576    return true;
    15551577}
    1556 
     1578#endif
     1579
     1580#if !ENABLE(JIT)
     1581bool CodeBlock::hasGlobalResolveInstructionAtBytecodeOffset(unsigned bytecodeOffset)
     1582{
     1583    if (m_globalResolveInstructions.isEmpty())
     1584        return false;
     1585
     1586    int low = 0;
     1587    int high = m_globalResolveInstructions.size();
     1588    while (low < high) {
     1589        int mid = low + (high - low) / 2;
     1590        if (m_globalResolveInstructions[mid] <= bytecodeOffset)
     1591            low = mid + 1;
     1592        else
     1593            high = mid;
     1594    }
     1595
     1596    if (!low || m_globalResolveInstructions[low - 1] != bytecodeOffset)
     1597        return false;
     1598    return true;
     1599}
     1600#else
     1601bool CodeBlock::hasGlobalResolveInfoAtBytecodeOffset(unsigned bytecodeOffset)
     1602{
     1603    if (m_globalResolveInfos.isEmpty())
     1604        return false;
     1605
     1606    int low = 0;
     1607    int high = m_globalResolveInfos.size();
     1608    while (low < high) {
     1609        int mid = low + (high - low) / 2;
     1610        if (m_globalResolveInfos[mid].bytecodeOffset <= bytecodeOffset)
     1611            low = mid + 1;
     1612        else
     1613            high = mid;
     1614    }
     1615
     1616    if (!low || m_globalResolveInfos[low - 1].bytecodeOffset != bytecodeOffset)
     1617        return false;
     1618    return true;
     1619}
     1620#endif
     1621
     1622#if ENABLE(JIT)
    15571623void CodeBlock::setJITCode(JITCodeRef& jitCode)
    15581624{
Note: See TracChangeset for help on using the changeset viewer.