Changeset 39038 in webkit for trunk/JavaScriptCore/interpreter


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/interpreter/Interpreter.cpp

    r38975 r39038  
    32093209        else {
    32103210            int32_t value = JSImmediate::getTruncatedInt32(scrutinee);
    3211             vPC += callFrame->codeBlock()->immediateSwitchJumpTables[tableIndex].offsetForValue(value, defaultOffset);
     3211            vPC += callFrame->codeBlock()->immediateSwitchJumpTable(tableIndex).offsetForValue(value, defaultOffset);
    32123212        }
    32133213        NEXT_INSTRUCTION();
     
    32323232                vPC += defaultOffset;
    32333233            else
    3234                 vPC += callFrame->codeBlock()->characterSwitchJumpTables[tableIndex].offsetForValue(value->data()[0], defaultOffset);
     3234                vPC += callFrame->codeBlock()->characterSwitchJumpTable(tableIndex).offsetForValue(value->data()[0], defaultOffset);
    32353235        }
    32363236        NEXT_INSTRUCTION();
     
    32513251            vPC += defaultOffset;
    32523252        else
    3253             vPC += callFrame->codeBlock()->stringSwitchJumpTables[tableIndex].offsetForValue(asString(scrutinee)->value().rep(), defaultOffset);
     3253            vPC += callFrame->codeBlock()->stringSwitchJumpTable(tableIndex).offsetForValue(asString(scrutinee)->value().rep(), defaultOffset);
    32543254        NEXT_INSTRUCTION();
    32553255    }
     
    59715971    if (JSImmediate::isNumber(scrutinee)) {
    59725972        int32_t value = JSImmediate::getTruncatedInt32(scrutinee);
    5973         return codeBlock->immediateSwitchJumpTables[tableIndex].ctiForValue(value);
    5974     }
    5975 
    5976     return codeBlock->immediateSwitchJumpTables[tableIndex].ctiDefault;
     5973        return codeBlock->immediateSwitchJumpTable(tableIndex).ctiForValue(value);
     5974    }
     5975
     5976    return codeBlock->immediateSwitchJumpTable(tableIndex).ctiDefault;
    59775977}
    59785978
     
    59865986    CodeBlock* codeBlock = callFrame->codeBlock();
    59875987
    5988     void* result = codeBlock->characterSwitchJumpTables[tableIndex].ctiDefault;
     5988    void* result = codeBlock->characterSwitchJumpTable(tableIndex).ctiDefault;
    59895989
    59905990    if (scrutinee->isString()) {
    59915991        UString::Rep* value = asString(scrutinee)->value().rep();
    59925992        if (value->size() == 1)
    5993             result = codeBlock->characterSwitchJumpTables[tableIndex].ctiForValue(value->data()[0]);
     5993            result = codeBlock->characterSwitchJumpTable(tableIndex).ctiForValue(value->data()[0]);
    59945994    }
    59955995
     
    60066006    CodeBlock* codeBlock = callFrame->codeBlock();
    60076007
    6008     void* result = codeBlock->stringSwitchJumpTables[tableIndex].ctiDefault;
     6008    void* result = codeBlock->stringSwitchJumpTable(tableIndex).ctiDefault;
    60096009
    60106010    if (scrutinee->isString()) {
    60116011        UString::Rep* value = asString(scrutinee)->value().rep();
    6012         result = codeBlock->stringSwitchJumpTables[tableIndex].ctiForValue(value);
     6012        result = codeBlock->stringSwitchJumpTable(tableIndex).ctiForValue(value);
    60136013    }
    60146014
Note: See TracChangeset for help on using the changeset viewer.