Ignore:
Timestamp:
Dec 5, 2008, 12:27:58 PM (16 years ago)
Author:
[email protected]
Message:

2008-12-05 Sam Weinig <[email protected]>

Reviewed by Geoffrey Garen.

Encapsulate access to jump tables in the CodeBlock in preparation
of moving them to a rare data structure.

  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): (JSC::CodeBlock::shrinkToFit):
  • bytecode/CodeBlock.h: (JSC::CodeBlock::numberOfImmediateSwitchJumpTables): (JSC::CodeBlock::addImmediateSwitchJumpTable): (JSC::CodeBlock::immediateSwitchJumpTable): (JSC::CodeBlock::numberOfCharacterSwitchJumpTables): (JSC::CodeBlock::addCharacterSwitchJumpTable): (JSC::CodeBlock::characterSwitchJumpTable): (JSC::CodeBlock::numberOfStringSwitchJumpTables): (JSC::CodeBlock::addStringSwitchJumpTable): (JSC::CodeBlock::stringSwitchJumpTable):
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::endSwitch):
  • interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): (JSC::Interpreter::cti_op_switch_imm): (JSC::Interpreter::cti_op_switch_char): (JSC::Interpreter::cti_op_switch_string):
  • jit/JIT.cpp: (JSC::JIT::privateCompileMainPass):
File:
1 edited

Legend:

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

    r38917 r39038  
    140140    }
    141141#endif
    142    
    143     m_codeBlock->instructions.shrinkToFit();
    144     m_codeBlock->globalResolveInstructions.shrinkToFit();
    145     m_codeBlock->propertyAccessInstructions.shrinkToFit();
    146     m_codeBlock->callLinkInfos.shrinkToFit();
    147     m_codeBlock->linkedCallerList.shrinkToFit();
    148 
    149     m_codeBlock->identifiers.shrinkToFit();
    150     m_codeBlock->functions.shrinkToFit();
    151     m_codeBlock->functionExpressions.shrinkToFit();
    152     m_codeBlock->constantRegisters.shrinkToFit();
    153     m_codeBlock->unexpectedConstants.shrinkToFit();
    154     m_codeBlock->regexps.shrinkToFit();
    155     m_codeBlock->exceptionHandlers.shrinkToFit();
    156     m_codeBlock->expressionInfo.shrinkToFit();
    157     m_codeBlock->lineInfo.shrinkToFit();
    158 
    159     m_codeBlock->immediateSwitchJumpTables.shrinkToFit();
    160     m_codeBlock->characterSwitchJumpTables.shrinkToFit();
    161     m_codeBlock->stringSwitchJumpTables.shrinkToFit();
    162 
     142
     143    m_codeBlock->shrinkToFit();
    163144}
    164145
     
    17111692    m_switchContextStack.removeLast();
    17121693    if (switchInfo.switchType == SwitchInfo::SwitchImmediate) {
    1713         instructions()[switchInfo.bytecodeOffset + 1] = m_codeBlock->immediateSwitchJumpTables.size();
     1694        instructions()[switchInfo.bytecodeOffset + 1] = m_codeBlock->numberOfImmediateSwitchJumpTables();
    17141695        instructions()[switchInfo.bytecodeOffset + 2] = defaultLabel->offsetFrom(switchInfo.bytecodeOffset + 3);
    17151696
    1716         m_codeBlock->immediateSwitchJumpTables.append(SimpleJumpTable());
    1717         SimpleJumpTable& jumpTable = m_codeBlock->immediateSwitchJumpTables.last();
    1718 
     1697        SimpleJumpTable& jumpTable = m_codeBlock->addImmediateSwitchJumpTable();
    17191698        prepareJumpTableForImmediateSwitch(jumpTable, switchInfo.bytecodeOffset + 3, clauseCount, labels, nodes, min, max);
    17201699    } else if (switchInfo.switchType == SwitchInfo::SwitchCharacter) {
    1721         instructions()[switchInfo.bytecodeOffset + 1] = m_codeBlock->characterSwitchJumpTables.size();
     1700        instructions()[switchInfo.bytecodeOffset + 1] = m_codeBlock->numberOfCharacterSwitchJumpTables();
    17221701        instructions()[switchInfo.bytecodeOffset + 2] = defaultLabel->offsetFrom(switchInfo.bytecodeOffset + 3);
    17231702       
    1724         m_codeBlock->characterSwitchJumpTables.append(SimpleJumpTable());
    1725         SimpleJumpTable& jumpTable = m_codeBlock->characterSwitchJumpTables.last();
    1726 
     1703        SimpleJumpTable& jumpTable = m_codeBlock->addCharacterSwitchJumpTable();
    17271704        prepareJumpTableForCharacterSwitch(jumpTable, switchInfo.bytecodeOffset + 3, clauseCount, labels, nodes, min, max);
    17281705    } else {
    17291706        ASSERT(switchInfo.switchType == SwitchInfo::SwitchString);
    1730         instructions()[switchInfo.bytecodeOffset + 1] = m_codeBlock->stringSwitchJumpTables.size();
     1707        instructions()[switchInfo.bytecodeOffset + 1] = m_codeBlock->numberOfStringSwitchJumpTables();
    17311708        instructions()[switchInfo.bytecodeOffset + 2] = defaultLabel->offsetFrom(switchInfo.bytecodeOffset + 3);
    17321709
    1733         m_codeBlock->stringSwitchJumpTables.append(StringJumpTable());
    1734         StringJumpTable& jumpTable = m_codeBlock->stringSwitchJumpTables.last();
    1735 
     1710        StringJumpTable& jumpTable = m_codeBlock->addStringSwitchJumpTable();
    17361711        prepareJumpTableForStringSwitch(jumpTable, switchInfo.bytecodeOffset + 3, clauseCount, labels, nodes);
    17371712    }
Note: See TracChangeset for help on using the changeset viewer.