Changeset 37320 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Oct 5, 2008, 3:47:24 PM (17 years ago)
Author:
[email protected]
Message:

2008-10-05 Cameron Zwarich <[email protected]>

Reviewed by Maciej Stachowiak.

Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
<https://bugs.webkit.org/show_bug.cgi?id=21364>

This patch does not yet remove the branch, but it does a bit of refactoring
so that a CodeGenerator now knows whether the associated CodeBlock will need
a full scope before doing any code generation. This makes it possible to emit
explicit tear-off instructions before every op_ret.

  • VM/CodeBlock.h: (JSC::CodeBlock::CodeBlock):
  • VM/CodeGenerator.cpp: (JSC::CodeGenerator::generate): (JSC::CodeGenerator::CodeGenerator): (JSC::CodeGenerator::emitPushScope): (JSC::CodeGenerator::emitPushNewScope):
  • kjs/nodes.h: (JSC::ScopeNode::needsActivation):
Location:
trunk/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r37316 r37320  
     12008-10-05  Cameron Zwarich  <[email protected]>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
     6        <https://bugs.webkit.org/show_bug.cgi?id=21364>
     7
     8        This patch does not yet remove the branch, but it does a bit of refactoring
     9        so that a CodeGenerator now knows whether the associated CodeBlock will need
     10        a full scope before doing any code generation. This makes it possible to emit
     11        explicit tear-off instructions before every op_ret.
     12
     13        * VM/CodeBlock.h:
     14        (JSC::CodeBlock::CodeBlock):
     15        * VM/CodeGenerator.cpp:
     16        (JSC::CodeGenerator::generate):
     17        (JSC::CodeGenerator::CodeGenerator):
     18        (JSC::CodeGenerator::emitPushScope):
     19        (JSC::CodeGenerator::emitPushNewScope):
     20        * kjs/nodes.h:
     21        (JSC::ScopeNode::needsActivation):
     22
    1232008-10-05  Gavin Barraclough  <[email protected]>
    224
  • trunk/JavaScriptCore/VM/CodeBlock.h

    r37275 r37320  
    193193            , numVars(0)
    194194            , numParameters(0)
    195             , needsFullScopeChain(ownerNode_->usesEval() || ownerNode_->containsClosures())
     195            , needsFullScopeChain(ownerNode_->needsActivation())
    196196            , usesEval(ownerNode_->usesEval())
    197197            , codeType(codeType_)
  • trunk/JavaScriptCore/VM/CodeGenerator.cpp

    r37294 r37320  
    132132    m_codeBlock->thisRegister = m_thisRegister.index();
    133133
    134     if (m_shouldEmitDebugHooks)
    135         m_codeBlock->needsFullScopeChain = true;
    136 
    137134    m_scopeNode->emitCode(*this);
    138 
    139     if (m_codeType == FunctionCode && m_codeBlock->needsFullScopeChain) {
    140         ASSERT(globalData()->machine->getOpcodeID(m_codeBlock->instructions[0].u.opcode) == op_enter);
    141         m_codeBlock->instructions[0] = globalData()->machine->getOpcode(op_enter_with_activation);
    142     }
    143135
    144136#ifndef NDEBUG
     
    217209    , m_lastOpcodeID(op_end)
    218210{
     211    if (m_shouldEmitDebugHooks)
     212        m_codeBlock->needsFullScopeChain = true;
     213
    219214    emitOpcode(op_enter);
    220215    codeBlock->globalData = m_globalData;
     
    290285    , m_lastOpcodeID(op_end)
    291286{
    292     emitOpcode(op_enter);
     287    if (m_shouldEmitDebugHooks)
     288        m_codeBlock->needsFullScopeChain = true;
     289
     290    if (m_codeBlock->needsFullScopeChain)
     291        emitOpcode(op_enter_with_activation);
     292    else
     293        emitOpcode(op_enter);
     294
    293295    codeBlock->globalData = m_globalData;
    294296
     
    348350    , m_lastOpcodeID(op_end)
    349351{
     352    if (m_shouldEmitDebugHooks)
     353        m_codeBlock->needsFullScopeChain = true;
     354
    350355    emitOpcode(op_enter);
    351356    codeBlock->globalData = m_globalData;
     
    12011206RegisterID* CodeGenerator::emitPushScope(RegisterID* scope)
    12021207{
    1203     m_codeBlock->needsFullScopeChain = true;
    12041208    ControlFlowContext context;
    12051209    context.isFinallyBlock = false;
     
    14171421void CodeGenerator::emitPushNewScope(RegisterID* dst, Identifier& property, RegisterID* value)
    14181422{
    1419     m_codeBlock->needsFullScopeChain = true;
    14201423    ControlFlowContext context;
    14211424    context.isFinallyBlock = false;
  • trunk/JavaScriptCore/kjs/nodes.h

    r37285 r37320  
    21942194        void setUsesArguments() { m_features |= ArgumentsFeature; }
    21952195        bool usesThis() const { return m_features & ThisFeature; }
     2196        bool needsActivation() const { return m_features & (EvalFeature | ClosureFeature | WithFeature | CatchFeature); }
    21962197
    21972198        VarStack& varStack() { return m_varStack; }
Note: See TracChangeset for help on using the changeset viewer.