Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Issue 2314663002: Rework scanner-character-streams. (Closed)

Created:
4 years, 3 months ago by vogelheim
Modified:
4 years, 3 months ago
Reviewers:
nickie, marja
CC:
v8-reviews_googlegroups.com
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Rework scanner-character-streams. - 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 Committed: https://crrev.com/642d6d314c7934a05cd2386e4b10fca3267769fc Cr-Commit-Position: refs/heads/master@{#39464}

Patch Set 1 #

Patch Set 2 : Some fixes, and marching down the very long road to make all compilers happy. #

Total comments: 36

Patch Set 3 : Add comments to document Utf8ExternalStreamingStream's internal state. #

Total comments: 36

Patch Set 4 : Marja's feedback, round 1. #

Total comments: 31

Patch Set 5 : Feedback, round 2. #

Total comments: 22

Patch Set 6 : Behold! A re-write of utf-8 handling (+ improved tests + fixes) #

Patch Set 7 : Fix compiler issue. #

Patch Set 8 : Niko's feedback and fix compile even harder #

Total comments: 24

Patch Set 9 : Marja's feedback. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1186 lines, -907 lines) Patch
M src/compiler-dispatcher/compiler-dispatcher-job.cc View 1 chunk +4 lines, -9 lines 0 comments Download
M src/parsing/parser.cc View 3 chunks +5 lines, -26 lines 0 comments Download
M src/parsing/scanner.h View 1 2 3 4 5 6 2 chunks +127 lines, -46 lines 0 comments Download
M src/parsing/scanner.cc View 1 2 3 4 19 chunks +30 lines, -28 lines 0 comments Download
M src/parsing/scanner-character-streams.h View 1 chunk +12 lines, -172 lines 0 comments Download
M src/parsing/scanner-character-streams.cc View 1 2 3 4 5 6 7 8 1 chunk +547 lines, -400 lines 0 comments Download
M src/unicode.h View 1 2 3 4 2 chunks +6 lines, -0 lines 0 comments Download
M src/unicode.cc View 1 2 3 4 2 chunks +52 lines, -2 lines 0 comments Download
M test/cctest/cctest.gyp View 1 chunk +1 line, -0 lines 0 comments Download
A test/cctest/parsing/test-scanner-streams.cc View 1 2 3 4 5 6 7 8 1 chunk +364 lines, -0 lines 0 comments Download
M test/cctest/test-api.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M test/cctest/test-parsing.cc View 1 17 chunks +36 lines, -222 lines 0 comments Download

Messages

Total messages: 85 (66 generated)
vogelheim
marja, nikolaos: Please have a look, and please let me know what you think.
4 years, 3 months ago (2016-09-06 13:42:26 UTC) #40
marja
"stuff I don't understand" overflowed, maybe continue offline? https://codereview.chromium.org/2314663002/diff/160001/src/parsing/scanner-character-streams.cc File src/parsing/scanner-character-streams.cc (right): https://codereview.chromium.org/2314663002/diff/160001/src/parsing/scanner-character-streams.cc#newcode202 src/parsing/scanner-character-streams.cc:202: size_t ...
4 years, 3 months ago (2016-09-07 09:17:57 UTC) #41
vogelheim
fyi, added comments to document Utf8ExternalStreamingStream's internal state, as a quick fix to Marja's comments. ...
4 years, 3 months ago (2016-09-07 09:43:52 UTC) #42
marja
https://codereview.chromium.org/2314663002/diff/180001/src/parsing/scanner-character-streams.cc File src/parsing/scanner-character-streams.cc (right): https://codereview.chromium.org/2314663002/diff/180001/src/parsing/scanner-character-streams.cc#newcode234 src/parsing/scanner-character-streams.cc:234: unibrow::Utf8::Utf8IncrementalBuffer buffer; Clarify that buffer contains the characters from ...
4 years, 3 months ago (2016-09-07 11:55:11 UTC) #43
vogelheim
https://codereview.chromium.org/2314663002/diff/160001/src/parsing/scanner-character-streams.cc File src/parsing/scanner-character-streams.cc (right): https://codereview.chromium.org/2314663002/diff/160001/src/parsing/scanner-character-streams.cc#newcode202 src/parsing/scanner-character-streams.cc:202: size_t byte_pos; On 2016/09/07 09:17:57, marja wrote: > This ...
4 years, 3 months ago (2016-09-07 12:32:56 UTC) #44
nickie
I'm publishing my comments so far, because it turns out that they are in two ...
4 years, 3 months ago (2016-09-07 13:28:30 UTC) #46
nickie
My last comments for this round. In general, I think it looks good enough for ...
4 years, 3 months ago (2016-09-07 13:48:44 UTC) #47
marja
Getting better! I was focusing on the utf8 streaming case, where the complexity lies. I ...
4 years, 3 months ago (2016-09-08 09:46:23 UTC) #48
vogelheim
https://codereview.chromium.org/2314663002/diff/160001/src/parsing/scanner.h File src/parsing/scanner.h (right): https://codereview.chromium.org/2314663002/diff/160001/src/parsing/scanner.h#newcode46 src/parsing/scanner.h:46: } else if (ReadBlock()) { On 2016/09/07 13:28:28, nickie ...
4 years, 3 months ago (2016-09-08 13:09:04 UTC) #49
vogelheim
https://codereview.chromium.org/2314663002/diff/220001/src/parsing/scanner-character-streams.cc File src/parsing/scanner-character-streams.cc (right): https://codereview.chromium.org/2314663002/diff/220001/src/parsing/scanner-character-streams.cc#newcode44 src/parsing/scanner-character-streams.cc:44: DCHECK_EQ(buffer_start_, buffer_); // Please nobody mess w/ buffer_start_. On ...
4 years, 3 months ago (2016-09-08 15:02:18 UTC) #51
nickie
LGTM, modulo some old comments (left for subsequent CLs or as food for thought) and ...
4 years, 3 months ago (2016-09-09 11:21:49 UTC) #52
vogelheim
PTAL. @marja: The utf-8 part is largely re-written. Now with many, smaller functions + commentary. ...
4 years, 3 months ago (2016-09-14 11:28:19 UTC) #59
nickie
Still LGTM, but I did not review carefully the UTF8 part. https://codereview.chromium.org/2314663002/diff/260001/src/parsing/scanner-character-streams.cc File src/parsing/scanner-character-streams.cc (right): ...
4 years, 3 months ago (2016-09-14 11:48:18 UTC) #60
vogelheim
On 2016/09/14 11:48:18, nickie wrote: > There has to be a virtual destructor but it ...
4 years, 3 months ago (2016-09-14 17:09:16 UTC) #65
marja
scanner-character-streams.cc + test-scanner-streams.cc LGTM % comments This new version is much clearer, it's much easier ...
4 years, 3 months ago (2016-09-15 08:25:17 UTC) #68
vogelheim
https://codereview.chromium.org/2314663002/diff/320001/src/parsing/scanner-character-streams.cc File src/parsing/scanner-character-streams.cc (right): https://codereview.chromium.org/2314663002/diff/320001/src/parsing/scanner-character-streams.cc#newcode208 src/parsing/scanner-character-streams.cc:208: struct ChunkPosition { On 2016/09/15 08:25:16, marja wrote: > ...
4 years, 3 months ago (2016-09-15 11:29:26 UTC) #70
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2314663002/360001
4 years, 3 months ago (2016-09-16 08:27:25 UTC) #81
commit-bot: I haz the power
Committed patchset #9 (id:360001)
4 years, 3 months ago (2016-09-16 08:29:49 UTC) #83
commit-bot: I haz the power
4 years, 3 months ago (2016-09-16 08:30:03 UTC) #85
Message was sent while issue was closed.
Patchset 9 (id:??) landed as
https://crrev.com/642d6d314c7934a05cd2386e4b10fca3267769fc
Cr-Commit-Position: refs/heads/master@{#39464}

Powered by Google App Engine
This is Rietveld 408576698