Ignore:
Timestamp:
Oct 31, 2007, 7:46:41 AM (18 years ago)
Author:
darin
Message:

Reviewed by Maciej.

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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/regexp_object.h

    r27303 r27320  
    7979    virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
    8080    JSValue *getValueProperty(ExecState *, int token) const;
    81     UString performMatch(RegExp *, const UString&, int startOffset = 0, int *endOffset = 0, int **ovector = 0);
    82     JSObject *arrayOfMatches(ExecState *exec, const UString &result) const;
     81    void performMatch(RegExp*, const UString&, int startOffset, int& position, int& length, int** ovector = 0);
     82    JSObject* arrayOfMatches(ExecState*) const;
    8383   
    8484    virtual const ClassInfo *classInfo() const { return &info; }
    8585  private:
    8686    JSValue *getBackref(unsigned) const;
    87     JSValue *getLastMatch() const;
    8887    JSValue *getLastParen() const;
    8988    JSValue *getLeftContext() const;
Note: See TracChangeset for help on using the changeset viewer.