Ignore:
Timestamp:
Sep 23, 2010, 1:40:10 AM (15 years ago)
Author:
[email protected]
Message:

2010-09-23 Peter Varga <[email protected]>

Reviewed by Gavin Barraclough.

Reduce the number of BOL checks in YARR Interpreter
https://bugs.webkit.org/show_bug.cgi?id=46260

Extend the YARR Interpreter with an optimization which reduces the number of
BOL assertion checks. If a "TypeBodyAlternative" byteTerm is followed by a
"TypeAssertionBOL" byteTerm it will be checked just one time.

  • yarr/RegexInterpreter.cpp: (JSC::Yarr::Interpreter::matchDisjunction): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::ByteCompiler::regexBegin): (JSC::Yarr::ByteCompiler::alternativeBodyDisjunction): (JSC::Yarr::ByteCompiler::emitDisjunction):
  • yarr/RegexInterpreter.h: (JSC::Yarr::ByteTerm::BodyAlternativeBegin): (JSC::Yarr::ByteTerm::BodyAlternativeDisjunction): (JSC::Yarr::ByteTerm::BodyAlternativeEnd): (JSC::Yarr::ByteTerm::AlternativeBegin): (JSC::Yarr::ByteTerm::AlternativeDisjunction): (JSC::Yarr::ByteTerm::AlternativeEnd):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/yarr/RegexInterpreter.h

    r64146 r68127  
    9595            int next;
    9696            int end;
     97            bool onceThrough;
    9798        } alternative;
    9899        unsigned checkInputCount;
     
    216217    }
    217218
    218     static ByteTerm BodyAlternativeBegin()
     219    static ByteTerm BodyAlternativeBegin(bool onceThrough)
    219220    {
    220221        ByteTerm term(TypeBodyAlternativeBegin);
    221222        term.alternative.next = 0;
    222223        term.alternative.end = 0;
    223         return term;
    224     }
    225 
    226     static ByteTerm BodyAlternativeDisjunction()
     224        term.alternative.onceThrough = onceThrough;
     225        return term;
     226    }
     227
     228    static ByteTerm BodyAlternativeDisjunction(bool onceThrough)
    227229    {
    228230        ByteTerm term(TypeBodyAlternativeDisjunction);
    229231        term.alternative.next = 0;
    230232        term.alternative.end = 0;
     233        term.alternative.onceThrough = onceThrough;
    231234        return term;
    232235    }
     
    237240        term.alternative.next = 0;
    238241        term.alternative.end = 0;
     242        term.alternative.onceThrough = false;
    239243        return term;
    240244    }
     
    245249        term.alternative.next = 0;
    246250        term.alternative.end = 0;
     251        term.alternative.onceThrough = false;
    247252        return term;
    248253    }
     
    253258        term.alternative.next = 0;
    254259        term.alternative.end = 0;
     260        term.alternative.onceThrough = false;
    255261        return term;
    256262    }
     
    261267        term.alternative.next = 0;
    262268        term.alternative.end = 0;
     269        term.alternative.onceThrough = false;
    263270        return term;
    264271    }
Note: See TracChangeset for help on using the changeset viewer.