Changeset 108753 in webkit for trunk/Source/JavaScriptCore/yarr


Ignore:
Timestamp:
Feb 24, 2012, 1:49:38 AM (13 years ago)
Author:
[email protected]
Message:

Remove useless jump instructions for short circuit
https://bugs.webkit.org/show_bug.cgi?id=75602

Patch by Han Hojong <[email protected]> on 2012-02-24
Reviewed by Michael Saboff.

Jump instruction is inserted to make short circuit,
however it does nothing but moving to the next instruction.
Therefore useless jump instructions are removed,
and jump list is moved into the case not for a short circuit,
so that only necessary instructions are added to JIT code
unless it has a 16 bit pattern character and an 8 bit string.

  • yarr/YarrJIT.cpp:

(JSC::Yarr::YarrGenerator::generatePatternCharacterGreedy):
(JSC::Yarr::YarrGenerator::backtrackPatternCharacterNonGreedy):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp

    r108484 r108753  
    817817        move(TrustedImm32(0), countRegister);
    818818
    819         if ((ch > 0xff) && (m_charSize == Char8)) {
    820             // Have a 16 bit pattern character and an 8 bit string - short circuit
    821             op.m_jumps.append(jump());
    822         } else {
     819        // Unless have a 16 bit pattern character and an 8 bit string - short circuit
     820        if (!((ch > 0xff) && (m_charSize == Char8))) {
    823821            JumpList failures;
    824822            Label loop(this);
     
    838836
    839837        storeToFrame(countRegister, term->frameLocation);
    840 
    841838    }
    842839    void backtrackPatternCharacterGreedy(size_t opIndex)
     
    876873        const RegisterID countRegister = regT1;
    877874
    878         JumpList nonGreedyFailures;
    879 
    880875        m_backtrackingState.link(this);
    881876
    882877        loadFromFrame(term->frameLocation, countRegister);
    883878
    884         if ((ch > 0xff) && (m_charSize == Char8)) {
    885             // Have a 16 bit pattern character and an 8 bit string - short circuit
    886             nonGreedyFailures.append(jump());
    887         } else {
     879        // Unless have a 16 bit pattern character and an 8 bit string - short circuit
     880        if (!((ch > 0xff) && (m_charSize == Char8))) {
     881            JumpList nonGreedyFailures;
    888882            nonGreedyFailures.append(atEndOfInput());
    889883            if (term->quantityCount != quantifyInfinite)
     
    895889
    896890            jump(op.m_reentry);
    897         }
    898         nonGreedyFailures.link(this);
     891            nonGreedyFailures.link(this);
     892        }
    899893
    900894        sub32(countRegister, index);
Note: See TracChangeset for help on using the changeset viewer.