• marja's avatar
    RegExpParser: Fix Reset()ting to the end. · 978f41a1
    marja authored
    The bug would occur when we try to Reset() to a position already at the end.
    
    This happens e.g., when the regexp ends with \u. What used to happen in that
    case: 1) Advance past \ and u (to the end) (which wouldn't increase next_pos_
    enough) 2) Try to parse 4 hex digits 3) When that failed, Reset() to the
    position which should've been at the end but wasn't.
    
    To be able to properly Reset() to a position at the end, we need to allow
    next_pos_ to move beyond the end (since position() is next_pos_ - 1).
    
    Minimal repro case:
    
    var r = /foo\u/
    r.test("foou") // should be true, was false.
    
    (Note that \u not followed by 4 hex didits should be interpreted as an identity
    escape. It already worked unless \u was at the end of the regexp.)
    
    BUG=v8:3756
    LOG=NO
    
    Review URL: https://codereview.chromium.org/802313003
    
    Cr-Commit-Position: refs/heads/master@{#25838}
    978f41a1
Name
Last commit
Last update
..
benchmarks Loading commit data...
cctest Loading commit data...
intl Loading commit data...
js-perf-test Loading commit data...
message Loading commit data...
mjsunit Loading commit data...
mozilla Loading commit data...
preparser Loading commit data...
promises-aplus Loading commit data...
test262 Loading commit data...
test262-es6 Loading commit data...
unittests Loading commit data...
webkit Loading commit data...