Changeset 49409 in webkit for trunk/JavaScriptCore/jit/JIT.cpp


Ignore:
Timestamp:
Oct 9, 2009, 5:30:49 PM (16 years ago)
Author:
[email protected]
Message:

Eliminated some legacy bytecode weirdness.

Patch by Geoffrey Garen <[email protected]> on 2009-10-09
Reviewed by Oliver Hunt.

Use vPC[x] subscripting instead of ++vPC to access instruction operands.
This is simpler, and often more efficient.

To support this, and to remove use of hard-coded offsets in bytecode and
JIT code generation and dumping, calculate jump offsets from the beginning
of an instruction, rather than the middle or end.

Also, use OPCODE_LENGTH instead of hard-coded constants for the sizes of
opcodes.

SunSpider reports no change in JIT mode, and a 1.01x speedup in Interpreter
mode.

  • bytecode/CodeBlock.cpp:

(JSC::printConditionalJump):
(JSC::CodeBlock::dump):

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitJump):
(JSC::BytecodeGenerator::emitJumpIfTrue):
(JSC::BytecodeGenerator::emitJumpIfFalse):
(JSC::BytecodeGenerator::emitJumpIfNotFunctionCall):
(JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
(JSC::BytecodeGenerator::emitComplexJumpScopes):
(JSC::BytecodeGenerator::emitJumpScopes):
(JSC::BytecodeGenerator::emitNextPropertyName):
(JSC::BytecodeGenerator::emitCatch):
(JSC::BytecodeGenerator::emitJumpSubroutine):
(JSC::prepareJumpTableForImmediateSwitch):
(JSC::prepareJumpTableForCharacterSwitch):
(JSC::prepareJumpTableForStringSwitch):
(JSC::BytecodeGenerator::endSwitch):

  • bytecompiler/Label.h:

(JSC::Label::setLocation):
(JSC::Label::bind):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::resolve):
(JSC::Interpreter::resolveSkip):
(JSC::Interpreter::resolveGlobal):
(JSC::Interpreter::resolveBase):
(JSC::Interpreter::resolveBaseAndProperty):
(JSC::Interpreter::createExceptionScope):
(JSC::Interpreter::privateExecute):

  • interpreter/Interpreter.h:
  • jit/JIT.cpp:

(JSC::JIT::privateCompile):

  • jit/JITArithmetic.cpp:

(JSC::JIT::emit_op_jnless):
(JSC::JIT::emitSlow_op_jnless):
(JSC::JIT::emit_op_jnlesseq):
(JSC::JIT::emitSlow_op_jnlesseq):
(JSC::JIT::emitBinaryDoubleOp):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_jmp):
(JSC::JIT::emit_op_loop):
(JSC::JIT::emit_op_loop_if_less):
(JSC::JIT::emitSlow_op_loop_if_less):
(JSC::JIT::emit_op_loop_if_lesseq):
(JSC::JIT::emitSlow_op_loop_if_lesseq):
(JSC::JIT::emit_op_loop_if_true):
(JSC::JIT::emitSlow_op_loop_if_true):
(JSC::JIT::emit_op_jfalse):
(JSC::JIT::emitSlow_op_jfalse):
(JSC::JIT::emit_op_jtrue):
(JSC::JIT::emitSlow_op_jtrue):
(JSC::JIT::emit_op_jeq_null):
(JSC::JIT::emit_op_jneq_null):
(JSC::JIT::emit_op_jneq_ptr):
(JSC::JIT::emit_op_jsr):
(JSC::JIT::emit_op_next_pname):
(JSC::JIT::emit_op_jmp_scopes):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jit/JIT.cpp

    r48744 r49409  
    490490            ASSERT(record.jumpTable.simpleJumpTable->branchOffsets.size() == record.jumpTable.simpleJumpTable->ctiOffsets.size());
    491491
    492             record.jumpTable.simpleJumpTable->ctiDefault = patchBuffer.locationOf(m_labels[bytecodeIndex + 3 + record.defaultOffset]);
     492            record.jumpTable.simpleJumpTable->ctiDefault = patchBuffer.locationOf(m_labels[bytecodeIndex + record.defaultOffset]);
    493493
    494494            for (unsigned j = 0; j < record.jumpTable.simpleJumpTable->branchOffsets.size(); ++j) {
    495495                unsigned offset = record.jumpTable.simpleJumpTable->branchOffsets[j];
    496                 record.jumpTable.simpleJumpTable->ctiOffsets[j] = offset ? patchBuffer.locationOf(m_labels[bytecodeIndex + 3 + offset]) : record.jumpTable.simpleJumpTable->ctiDefault;
     496                record.jumpTable.simpleJumpTable->ctiOffsets[j] = offset ? patchBuffer.locationOf(m_labels[bytecodeIndex + offset]) : record.jumpTable.simpleJumpTable->ctiDefault;
    497497            }
    498498        } else {
    499499            ASSERT(record.type == SwitchRecord::String);
    500500
    501             record.jumpTable.stringJumpTable->ctiDefault = patchBuffer.locationOf(m_labels[bytecodeIndex + 3 + record.defaultOffset]);
     501            record.jumpTable.stringJumpTable->ctiDefault = patchBuffer.locationOf(m_labels[bytecodeIndex + record.defaultOffset]);
    502502
    503503            StringJumpTable::StringOffsetTable::iterator end = record.jumpTable.stringJumpTable->offsetTable.end();           
    504504            for (StringJumpTable::StringOffsetTable::iterator it = record.jumpTable.stringJumpTable->offsetTable.begin(); it != end; ++it) {
    505505                unsigned offset = it->second.branchOffset;
    506                 it->second.ctiOffset = offset ? patchBuffer.locationOf(m_labels[bytecodeIndex + 3 + offset]) : record.jumpTable.stringJumpTable->ctiDefault;
     506                it->second.ctiOffset = offset ? patchBuffer.locationOf(m_labels[bytecodeIndex + offset]) : record.jumpTable.stringJumpTable->ctiDefault;
    507507            }
    508508        }
Note: See TracChangeset for help on using the changeset viewer.