• jgruber's avatar
    [regexp] Send sticky @@splits to the slow path · 27fd52ab
    jgruber authored
    Due to shortcuts we take on the RegExp.p[@@split] fast path (we don't allocate
    a new instance), we need to send sticky regexps to the slow path.
    
    The problem is a slight impedance mismatch between the spec and our fast-path
    implementation.
    
    Spec: Creates a new regexp instance `splitter` that is guaranteed to be sticky,
    uses `splitter.lastIndex` to advance the search range, advances by itself using
    AdvanceStringIndex if `splitter` did not match at the current position.
    
    Our fast path: Uses the given regexp instance and does not modify stickyness,
    uses last_match_info to advance search range, returns (and assumes no more
    matches) once RegExpExecInternal fails to match.
    
    This is fine if the given regexp is non-sticky, since 1. the value of lastIndex
    is ignored, and 2. non-sticky regexps match if a match is found anywhere in the
    string, not just exactly at the current lastIndex.
    
    Sticky regexps though are a problem. If no match is found exactly at the current
    position, @@split assumes no more matches and exits.
    
    In a follow-up, we could explore other options, such as allocating a new
    instance or saving/restoring flags and lastIndex.
    
    Bug: v8:6706
    Change-Id: I6da2266df72b2f80f00c1ce3cd7c8655de91f680
    Reviewed-on: https://chromium-review.googlesource.com/626065Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
    Commit-Queue: Jakob Gruber <jgruber@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#47543}
    27fd52ab
Name
Last commit
Last update
benchmarks Loading commit data...
build_overrides Loading commit data...
docs Loading commit data...
gni Loading commit data...
gypfiles Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.editorconfig Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
ChangeLog Loading commit data...
DEPS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
Makefile Loading commit data...
Makefile.android Loading commit data...
OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...
snapshot_toolchain.gni Loading commit data...