Changeset 39752 in webkit for trunk/JavaScriptCore/bytecompiler


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.

Location:
trunk/JavaScriptCore/bytecompiler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r39737 r39752  
    116116
    117117#ifndef NDEBUG
    118 bool BytecodeGenerator::s_dumpsGeneratedCode = false;
     118static bool s_dumpsGeneratedCode = false;
    119119#endif
    120120
     
    212212    : m_shouldEmitDebugHooks(!!debugger)
    213213    , m_shouldEmitProfileHooks(scopeChain.globalObject()->supportsProfiling())
    214     , m_regeneratingForExceptionInfo(false)
    215214    , m_scopeChain(&scopeChain)
    216215    , m_symbolTable(symbolTable)
     
    226225    , m_lastOpcodeID(op_end)
    227226    , m_emitNodeDepth(0)
     227    , m_regeneratingForExceptionInfo(false)
     228    , m_codeBlockBeingRegeneratedFrom(0)
    228229{
    229230    if (m_shouldEmitDebugHooks)
     
    295296    : m_shouldEmitDebugHooks(!!debugger)
    296297    , m_shouldEmitProfileHooks(scopeChain.globalObject()->supportsProfiling())
    297     , m_regeneratingForExceptionInfo(false)
    298298    , m_scopeChain(&scopeChain)
    299299    , m_symbolTable(symbolTable)
     
    307307    , m_lastOpcodeID(op_end)
    308308    , m_emitNodeDepth(0)
     309    , m_regeneratingForExceptionInfo(false)
     310    , m_codeBlockBeingRegeneratedFrom(0)
    309311{
    310312    if (m_shouldEmitDebugHooks)
     
    367369    : m_shouldEmitDebugHooks(!!debugger)
    368370    , m_shouldEmitProfileHooks(scopeChain.globalObject()->supportsProfiling())
    369     , m_regeneratingForExceptionInfo(false)
    370371    , m_scopeChain(&scopeChain)
    371372    , m_symbolTable(symbolTable)
     
    375376    , m_finallyDepth(0)
    376377    , m_dynamicScopeDepth(0)
    377     , m_baseScopeDepth(scopeChain.localDepth())
     378    , m_baseScopeDepth(codeBlock->baseScopeDepth())
    378379    , m_codeType(EvalCode)
    379380    , m_globalData(&scopeChain.globalObject()->globalExec()->globalData())
    380381    , m_lastOpcodeID(op_end)
    381382    , m_emitNodeDepth(0)
     383    , m_regeneratingForExceptionInfo(false)
     384    , m_codeBlockBeingRegeneratedFrom(0)
    382385{
    383386    if (m_shouldEmitDebugHooks || m_baseScopeDepth)
     
    992995    }
    993996
    994     if (index != missingSymbolMarker()) {
    995         // Directly index the property lookup across multiple scopes.  Yay!
    996         return emitGetScopedVar(dst, depth, index, globalObject);
    997     }
    998 
    999997    if (globalObject) {
     998        bool forceGlobalResolve = false;
     999        if (m_regeneratingForExceptionInfo) {
    10001000#if ENABLE(JIT)
    1001         m_codeBlock->addGlobalResolveInfo();
     1001            forceGlobalResolve = m_codeBlockBeingRegeneratedFrom->hasGlobalResolveInfoAtBytecodeOffset(instructions().size());
     1002#else
     1003            forceGlobalResolve = m_codeBlockBeingRegeneratedFrom->hasGlobalResolveInstructionAtBytecodeOffset(instructions().size());
     1004#endif
     1005        }
     1006
     1007        if (index != missingSymbolMarker() && !forceGlobalResolve) {
     1008            // Directly index the property lookup across multiple scopes.
     1009            return emitGetScopedVar(dst, depth, index, globalObject);
     1010        }
     1011
     1012#if ENABLE(JIT)
     1013        m_codeBlock->addGlobalResolveInfo(instructions().size());
    10021014#else
    10031015        m_codeBlock->addGlobalResolveInstruction(instructions().size());
     
    10121024    }
    10131025
     1026    if (index != missingSymbolMarker()) {
     1027        // Directly index the property lookup across multiple scopes.
     1028        return emitGetScopedVar(dst, depth, index, globalObject);
     1029    }
     1030
    10141031    // In this case we are at least able to drop a few scope chains from the
    10151032    // lookup chain, although we still need to hash from then on.
     
    10241041{
    10251042    if (globalObject) {
    1026         // op_get_global_var must be the same length as op_resolve_global.
    10271043        emitOpcode(op_get_global_var);
    10281044        instructions().append(dst->index());
    10291045        instructions().append(asCell(globalObject));
    10301046        instructions().append(index);
    1031         instructions().append(0);
    1032         instructions().append(0);
    10331047        return dst;
    10341048    }
  • trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    r39737 r39752  
    330330        CodeType codeType() const { return m_codeType; }
    331331
    332         void setRegeneratingForExceptionInfo() { m_regeneratingForExceptionInfo = true; }
     332        void setRegeneratingForExceptionInfo(CodeBlock* originalCodeBlock)
     333        {
     334            m_regeneratingForExceptionInfo = true;
     335            m_codeBlockBeingRegeneratedFrom = originalCodeBlock;
     336        }
    333337
    334338    private:
     
    422426        bool m_shouldEmitDebugHooks;
    423427        bool m_shouldEmitProfileHooks;
    424 
    425         bool m_regeneratingForExceptionInfo;
    426428
    427429        const ScopeChain* m_scopeChain;
     
    466468        OpcodeID m_lastOpcodeID;
    467469
    468 #ifndef NDEBUG
    469         static bool s_dumpsGeneratedCode;
    470 #endif
    471 
    472470        unsigned m_emitNodeDepth;
     471
     472        bool m_regeneratingForExceptionInfo;
     473        CodeBlock* m_codeBlockBeingRegeneratedFrom;
    473474
    474475        static const unsigned s_maxEmitNodeDepth = 10000;
Note: See TracChangeset for help on using the changeset viewer.