Ignore:
Timestamp:
Dec 3, 2008, 11:43:11 PM (16 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2008-12-03 Geoffrey Garen <[email protected]>

Reviewed by Oliver Hunt.


Optimized sequences of characters in regular expressions by comparing
two characters at a time.


1-2% speedup on SunSpider, 19-25% speedup on regexp-dna.

  • assembler/MacroAssembler.h: (JSC::MacroAssembler::load32): (JSC::MacroAssembler::jge32): Filled out a few more macro methods.
  • assembler/X86Assembler.h: (JSC::X86Assembler::movl_mr): Added a verion of movl_mr that operates without an offset, to allow the macro assembler to optmize for that case.


  • wrec/WREC.cpp: (JSC::WREC::Generator::compileRegExp): Test the saved value of index instead of the index register when checking for "end of input." The index register doesn't increment by 1 in an orderly fashion, so testing it for == "end of input" is not valid.


Also, jump all the way to "return failure" upon reaching "end of input,"
instead of executing the next alternative. This is more logical, and
it's a slight optimization in the case of an expression with many alternatives.

  • wrec/WRECGenerator.cpp: (JSC::WREC::Generator::generateIncrementIndex): Added support for jumping to a failure label in the case where the index has reached "end of input."

(JSC::WREC::Generator::generatePatternCharacterSequence):
(JSC::WREC::Generator::generatePatternCharacterPair): This is the
optmization. It's basically like generatePatternCharacter, but it runs two
characters at a time.


(JSC::WREC::Generator::generatePatternCharacter): Changed to use isASCII,
since it's clearer than comparing to a magic hex value.


  • wrec/WRECGenerator.h:

LayoutTests:

2008-12-03 Geoffrey Garen <[email protected]>

Reviewed by Oliver Hunt.


Added a test for another input length miscalculation.

  • fast/regex/alternative-length-miscalculation-expected.txt:
  • fast/regex/resources/alternative-length-miscalculation.js:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/assembler/MacroAssembler.h

    r38975 r38989  
    334334    }
    335335
     336    void load32(BaseIndex address, RegisterID dest)
     337    {
     338        if (address.offset)
     339            m_assembler.movl_mr(address.offset, address.base, address.index, address.scale, dest);
     340        else
     341            m_assembler.movl_mr(address.base, address.index, address.scale, dest);
     342    }
     343
    336344    void load16(BaseIndex address, RegisterID dest)
    337345    {
     
    515523    }
    516524   
     525    Jump jge32(RegisterID left, RegisterID right)
     526    {
     527        m_assembler.cmpl_rr(right, left);
     528        return Jump(m_assembler, m_assembler.jge());
     529    }
     530
    517531    Jump jge32(RegisterID left, Imm32 right)
    518532    {
Note: See TracChangeset for help on using the changeset viewer.