Ignore:
Timestamp:
Mar 31, 2008, 1:01:09 AM (17 years ago)
Author:
[email protected]
Message:

Reviewed by darin.

Make matching of regexps using much faster
http://bugs.webkit.org/show_bug.cgi?id=18086

  • pcre/pcre_compile.cpp: (compileBranch): (branchNeedsLineStart):
  • pcre/pcre_exec.cpp: (match): (jsRegExpExecute):
  • pcre/pcre_internal.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/pcre/pcre_exec.cpp

    r31048 r31454  
    653653                RRETURN;
    654654               
    655             /* Start of subject, or after internal newline if multiline. */
    656                
     655            /* Start of subject. */
     656
    657657            BEGIN_OPCODE(CIRC):
    658                 if (stack.currentFrame->args.subjectPtr != md.startSubject && (!md.multiline || !isNewline(stack.currentFrame->args.subjectPtr[-1])))
     658                if (stack.currentFrame->args.subjectPtr != md.startSubject)
    659659                    RRETURN_NO_MATCH;
    660660                stack.currentFrame->args.instructionPtr++;
    661661                NEXT_OPCODE;
    662                
    663             /* End of subject, or before internal newline if multiline. */
    664                
     662
     663            /* After internal newline if multiline. */
     664
     665            BEGIN_OPCODE(BOL):
     666                if (stack.currentFrame->args.subjectPtr != md.startSubject && !isNewline(stack.currentFrame->args.subjectPtr[-1]))
     667                    RRETURN_NO_MATCH;
     668                stack.currentFrame->args.instructionPtr++;
     669                NEXT_OPCODE;
     670
     671            /* End of subject. */
     672
    665673            BEGIN_OPCODE(DOLL):
    666                 if (stack.currentFrame->args.subjectPtr < md.endSubject && (!md.multiline || !isNewline(*stack.currentFrame->args.subjectPtr)))
     674                if (stack.currentFrame->args.subjectPtr < md.endSubject)
     675                    RRETURN_NO_MATCH;
     676                stack.currentFrame->args.instructionPtr++;
     677                NEXT_OPCODE;
     678
     679            /* Before internal newline if multiline. */
     680
     681            BEGIN_OPCODE(EOL):
     682                if (stack.currentFrame->args.subjectPtr < md.endSubject && !isNewline(*stack.currentFrame->args.subjectPtr))
    667683                    RRETURN_NO_MATCH;
    668684                stack.currentFrame->args.instructionPtr++;
     
    20552071        DPRINTF((">>>> returning %d\n", returnCode));
    20562072        return returnCode;
    2057     } while (startMatch <= endSubject);
     2073    } while (!(re->options & IsAnchoredOption) && startMatch <= endSubject);
    20582074   
    20592075    if (using_temporary_offsets) {
Note: See TracChangeset for help on using the changeset viewer.