Changeset 27702 in webkit for trunk/JavaScriptCore/kjs/regexp.h


Ignore:
Timestamp:
Nov 11, 2007, 8:27:33 PM (18 years ago)
Author:
[email protected]
Message:

Reviewed by Sam Weinig.


Fixed http://bugs.webkit.org/show_bug.cgi?id=15902
15% of string-validate-input.js is spent compiling the same regular expression


Store a compiled representation of the regular expression in the AST.


Only a .2% SunSpider speedup overall, but a 10.6% speedup on
string-validate-input.js.

  • kjs/nodes.cpp: (KJS::RegExpNode::evaluate):
  • kjs/nodes.h: (KJS::RegExpNode::):
  • kjs/nodes2string.cpp: (KJS::RegExpNode::streamTo):
  • kjs/regexp.cpp: (KJS::RegExp::flags):
  • kjs/regexp.h: (KJS::RegExp::pattern):
  • kjs/regexp_object.cpp: (KJS::RegExpObjectImp::construct): (KJS::RegExpObjectImp::createRegExpImp):
  • kjs/regexp_object.h:
File:
1 edited

Legend:

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

    r27686 r27702  
    4747    int refCount() { return m_refCount; }
    4848
    49     bool global() const { return m_flags & Global; }
    50     bool ignoreCase() const { return m_flags & IgnoreCase; }
    51     bool multiline() const { return m_flags & Multiline; }
     49    bool global() const { return m_flagBits & Global; }
     50    bool ignoreCase() const { return m_flagBits & IgnoreCase; }
     51    bool multiline() const { return m_flagBits & Multiline; }
     52
    5253    const UString& pattern() const { return m_pattern; }
     54    const UString& flags() const { return m_flags; }
    5355
    5456    bool isValid() const { return !m_constructionError; }
     
    6466   
    6567    // Data supplied by caller.
    66     UString m_pattern;
    67     int m_flags;
     68    UString m_pattern; // FIXME: Just decompile m_regExp instead of storing this.
     69    UString m_flags; // FIXME: Just decompile m_regExp instead of storing this.
     70    int m_flagBits;
    6871
    6972    // Data supplied by PCRE.
Note: See TracChangeset for help on using the changeset viewer.