Reviewed by Maciej.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2007 14:46:41 +0000 (14:46 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2007 14:46:41 +0000 (14:46 +0000)
commit45515b1f00138f939f47d21473f441b751f11eb0
tree4220044a7fb6f038ec076b40efb8f1226c01136f
parentd63bb27f065ac9f66e4adfbbf2d02562a3583c48
    Reviewed by Maciej.

        - fix http://bugs.webkit.org/show_bug.cgi?id=15749
          RegExp/RegExpObjectImp cause needless UString creation

        Speeds things up 0.4% according to SunSpider.

        * kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
        because this library doesn't use the real PCRE -- it uses its
        own PCRE that works on UTF-16.

        * kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
        Use Noncopyable. Change the return value of match.
        * kjs/regexp.cpp:
        (KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
        (KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
        (KJS::RegExp::match): Change to return the position as an int and the
        ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.

        * kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
        require a result string.
        * kjs/regexp_object.cpp:
        (RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
        (RegExpObjectImp::performMatch): Change so it doesn't return a string.
        (RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
        the main result with the backreferences; now it doesn't need to take
        a result parameter.
        (RegExpObjectImp::getBackref): Minor tweaks.
        (RegExpObjectImp::getLastParen): Ditto.
        (RegExpObjectImp::getLeftContext): Ditto.
        (RegExpObjectImp::getRightContext): Ditto.
        (RegExpObjectImp::getValueProperty): Change LastMatch case to call
        getBackref(0) so we don't need a separate getLastMatch function.

        * kjs/string_object.cpp:
        (KJS::replace): Update to use new performMatch, including merging the
        matched string section with the other substrings.
        (KJS::StringProtoFunc::callAsFunction): Update functions to use the
        new performMatch and match. Also change to use OwnArrayPtr.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27320 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JavaScriptCore/ChangeLog
JavaScriptCore/kjs/config.h
JavaScriptCore/kjs/regexp.cpp
JavaScriptCore/kjs/regexp.h
JavaScriptCore/kjs/regexp_object.cpp
JavaScriptCore/kjs/regexp_object.h
JavaScriptCore/kjs/string_object.cpp