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):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.