Changeset 58902 in webkit for trunk/JavaScriptCore/interpreter


Ignore:
Timestamp:
May 6, 2010, 12:39:54 PM (15 years ago)
Author:
[email protected]
Message:

2010-05-06 Oliver Hunt <[email protected]>

Reviewed by Geoffrey Garen.

Improve performance of single character string compares
https://bugs.webkit.org/show_bug.cgi?id=38659

Add logic to the jit to identify comparisons to single character string literals
and then just perform the comparison inline, rather than ignoring the evidence
and attempting to perform an integer comparison.

Multiple changes required -- add jnlesseq opcode, add helper function to identify
single character string constants, add a helper to load single character strings.
Then add the 32_64 and normal codepaths to the JIT.

  • assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::load16):
  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump):
  • bytecode/Opcode.h:
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitJumpIfTrue):
  • interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute):
  • jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases):
  • jit/JIT.h:
  • jit/JITArithmetic.cpp: (JSC::JIT::emit_op_jnless): (JSC::JIT::emitSlow_op_jnless): (JSC::JIT::emit_op_jless): (JSC::JIT::emitSlow_op_jless): (JSC::JIT::emit_op_jlesseq): (JSC::JIT::emit_op_jnlesseq): (JSC::JIT::emitSlow_op_jlesseq): (JSC::JIT::emitSlow_op_jnlesseq):
  • jit/JITArithmetic32_64.cpp: (JSC::JIT::emit_op_jnless): (JSC::JIT::emitSlow_op_jnless): (JSC::JIT::emit_op_jless): (JSC::JIT::emitSlow_op_jless): (JSC::JIT::emit_op_jlesseq): (JSC::JIT::emit_op_jnlesseq): (JSC::JIT::emitSlow_op_jlesseq): (JSC::JIT::emitSlow_op_jnlesseq): (JSC::JIT::emitBinaryDoubleOp):
  • jit/JITInlineMethods.h: (JSC::JIT::emitLoadCharacterString): (JSC::JIT::isOperandConstantImmediateChar):
  • jit/JSInterfaceJIT.h: (JSC::ThunkHelpers::stringImplDataOffset): (JSC::ThunkHelpers::jsStringLengthOffset): (JSC::ThunkHelpers::jsStringValueOffset): Moved from ThunkGenerators to make it possible to share.
  • jit/ThunkGenerators.cpp:

2010-05-06 Oliver Hunt <[email protected]>

Reviewed by Geoffrey Garen.

Improve performance of single character string compares
https://bugs.webkit.org/show_bug.cgi?id=38659

Add many tests of <, >, <=, >=, ==, ===, !=, !== as the existing
tests were woefully inadequate.

  • fast/js/comparison-operators-expected.txt: Added.
  • fast/js/comparison-operators-greater-expected.txt: Added.
  • fast/js/comparison-operators-greater.html: Added.
  • fast/js/comparison-operators-less-expected.txt: Added.
  • fast/js/comparison-operators-less.html: Added.
  • fast/js/comparison-operators.html: Added.
  • fast/js/script-tests/comparison-operators-greater.js: Added. (description.makeTest.func.f.toString): (description.makeTest): (doTest):
  • fast/js/script-tests/comparison-operators-less.js: Added. (description.makeTest.func.f.toString): (description.makeTest): (doTest):
  • fast/js/script-tests/comparison-operators.js: Added. (description.makeTest.func.f.toString): (description.makeTest): (doTest):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/interpreter/Interpreter.cpp

    r58012 r58902  
    32103210
    32113211        vPC += OPCODE_LENGTH(op_jnlesseq);
     3212        NEXT_INSTRUCTION();
     3213    }
     3214    DEFINE_OPCODE(op_jlesseq) {
     3215        /* jlesseq src1(r) src2(r) target(offset)
     3216         
     3217         Checks whether register src1 is less than or equal to
     3218         register src2, as with the ECMAScript '<=' operator,
     3219         and then jumps to offset target from the current instruction,
     3220         if and only if the result of the comparison is true.
     3221         */
     3222        JSValue src1 = callFrame->r(vPC[1].u.operand).jsValue();
     3223        JSValue src2 = callFrame->r(vPC[2].u.operand).jsValue();
     3224        int target = vPC[3].u.operand;
     3225       
     3226        bool result = jsLessEq(callFrame, src1, src2);
     3227        CHECK_FOR_EXCEPTION();
     3228       
     3229        if (result) {
     3230            vPC += target;
     3231            NEXT_INSTRUCTION();
     3232        }
     3233       
     3234        vPC += OPCODE_LENGTH(op_jlesseq);
    32123235        NEXT_INSTRUCTION();
    32133236    }
Note: See TracChangeset for help on using the changeset viewer.