• vogelheim's avatar
    Rework scanner-character-streams. · 642d6d31
    vogelheim authored
    - Smaller, more consistent streams API (Advance, Back, pos, Seek)
    - Remove implementations from the header, in favor of creation functions.
    
    Observe:
    - Performance:
      - All Utf16CharacterStream methods have an inlinable V8_LIKELY w/ a
        body of only a few instructions. I expect most calls to end up there.
      - There used to be performance problems w/ bookmarking, particularly
        with copying too much data on SetBookmark w/ UTF-8 streaming streams.
        All those copies are gone.
      - The old streaming streams implementation used to copy data even for
        2-byte input. It no longer does.
      - The only remaining 'slow' method is the Seek(.) slow case for utf-8
        streaming streams. I don't expect this to be called a lot; and even if,
        I expect it to be offset by the gains in the (vastly more frequent)
        calls to the other methods or the 'fast path'.
      - If it still bothers us, there are several ways to speed it up.
    - API & code cleanliness:
      - I want to remove the 'old' API in a follow-up CL, which should mostly
        delete code, or replace it 1:1.
      - In a 2nd follow-up I want to delete much of the UTF-8 handling in Blink
        for streaming streams.
      - The "bookmark" is now always implemented (and mostly very fast), so we
        should be able to use it for more things.
    - Testing & correctness:
      - The unit tests now cover all stream implementations,
        and are pretty good and triggering all the edge cases.
      - Vastly more DCHECKs of the invariants.
    
    BUG=v8:4947
    
    Review-Url: https://codereview.chromium.org/2314663002
    Cr-Commit-Position: refs/heads/master@{#39464}
    642d6d31
test-api.cc 906 KB