• Martin Bidlingmaier's avatar
    [regexp] Support capture groups in experimental engine · 98b8ca89
    Martin Bidlingmaier authored
    This commit adds support for capture groups (as in e.g. /x(123|abc)y/)
    in the experimental regexp engine.  Now every InterpreterThread owns a
    register array containing (sub)match boundaries. There is a new
    instruction to record the current input index in some register.
    
    Submatches in quantifier bodies should be reported only if they occur
    during the last repetition.  Thus we reset those registers before
    attempting to match the body of a quantifier.  This is implemented with
    another new instruction.
    
    Because of concerns for the growing sizeof the NfaInterpreter object
    (which is allocated on the stack), this commit replaces the
    `SmallVector` members of the NfaInterpreter with zone-allocated arrays.
    Register arrays, which for a fixed regexp are all the same size, are
    allocated with a RecyclingZoneAllocator for cheap memory reclamation via
    a linked list of equally-sized free blocks.
    
    Possible optimizations for management of register array memory:
    1. If there are few register per thread, then it is likely faster to
       store them inline in the InterpreterThread struct.
    2. re2 implements copy-on-write:  InterpreterThreads can share the same
       register array. If a thread attempts to write to shared register
       array, the register array is cloned first.
    3. The register at index 1 contains the end of the match; this is only
       written to right before an ACCEPT statement.  We could make ACCEPT
       equivalent to what's currently CAPTURE 1 followed by ACCEPT.  We
       could then save the memory for register 1 for threads that haven't
       finished yet.  This is particularly interesting if now optimization 1
       kicks in.
    
    Cq-Include-Trybots: luci.v8.try:v8_linux64_fyi_rel_ng
    Bug: v8:10765
    Change-Id: I2c0503206ce331e13ac9912945bb66736d740197
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2390770
    Commit-Queue: Martin Bidlingmaier <mbid@google.com>
    Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#69929}
    98b8ca89
Name
Last commit
Last update
..
arm Loading commit data...
arm64 Loading commit data...
experimental Loading commit data...
ia32 Loading commit data...
mips Loading commit data...
mips64 Loading commit data...
ppc Loading commit data...
s390 Loading commit data...
x64 Loading commit data...
OWNERS Loading commit data...
gen-regexp-special-case.cc Loading commit data...
property-sequences.cc Loading commit data...
property-sequences.h Loading commit data...
regexp-ast.cc Loading commit data...
regexp-ast.h Loading commit data...
regexp-bytecode-generator-inl.h Loading commit data...
regexp-bytecode-generator.cc Loading commit data...
regexp-bytecode-generator.h Loading commit data...
regexp-bytecode-peephole.cc Loading commit data...
regexp-bytecode-peephole.h Loading commit data...
regexp-bytecodes.cc Loading commit data...
regexp-bytecodes.h Loading commit data...
regexp-compiler-tonode.cc Loading commit data...
regexp-compiler.cc Loading commit data...
regexp-compiler.h Loading commit data...
regexp-dotprinter.cc Loading commit data...
regexp-dotprinter.h Loading commit data...
regexp-error.cc Loading commit data...
regexp-error.h Loading commit data...
regexp-interpreter.cc Loading commit data...
regexp-interpreter.h Loading commit data...
regexp-macro-assembler-arch.h Loading commit data...
regexp-macro-assembler-tracer.cc Loading commit data...
regexp-macro-assembler-tracer.h Loading commit data...
regexp-macro-assembler.cc Loading commit data...
regexp-macro-assembler.h Loading commit data...
regexp-nodes.h Loading commit data...
regexp-parser.cc Loading commit data...
regexp-parser.h Loading commit data...
regexp-stack.cc Loading commit data...
regexp-stack.h Loading commit data...
regexp-utils.cc Loading commit data...
regexp-utils.h Loading commit data...
regexp.cc Loading commit data...
regexp.h Loading commit data...
special-case.h Loading commit data...