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

Issue 7558017: Simpler (and a bit faster) keyword matcher (Closed)

Created:
9 years, 4 months ago by Vitaly Repeshko
Modified:
9 years, 4 months ago
Reviewers:
Lasse Reichstein
CC:
v8-dev
Visibility:
Public.

Description

Simpler (and a bit faster) keyword matcher. Replaced the keyword matching state machine with a switch on the first char followed up by inlined char comparisons. R=lrn@chromium.org TEST=cctest/test-parsing/ScanKeywords Committed: http://code.google.com/p/v8/source/detail?r=8866

Patch Set 1 #

Patch Set 2 : Tests and cleanup #

Total comments: 6

Patch Set 3 : Review fixes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+162 lines, -409 lines) Patch
M src/scanner-base.h View 1 chunk +0 lines, -145 lines 0 comments Download
M src/scanner-base.cc View 1 2 4 chunks +114 lines, -185 lines 0 comments Download
M src/token.h View 1 3 chunks +2 lines, -3 lines 0 comments Download
M src/token.cc View 1 2 chunks +4 lines, -4 lines 0 comments Download
M test/cctest/test-parsing.cc View 1 2 2 chunks +42 lines, -72 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Vitaly Repeshko
9 years, 4 months ago (2011-08-09 12:12:54 UTC) #1
Lasse Reichstein
LGTM! http://codereview.chromium.org/7558017/diff/1004/src/scanner-base.cc File src/scanner-base.cc (right): http://codereview.chromium.org/7558017/diff/1004/src/scanner-base.cc#newcode738 src/scanner-base.cc:738: ASSERT(input_length >= 1); I think this assert can ...
9 years, 4 months ago (2011-08-09 12:47:56 UTC) #2
Vitaly Repeshko
9 years, 4 months ago (2011-08-09 13:08:00 UTC) #3
Thanks!

http://codereview.chromium.org/7558017/diff/1004/src/scanner-base.cc
File src/scanner-base.cc (right):

http://codereview.chromium.org/7558017/diff/1004/src/scanner-base.cc#newcode738
src/scanner-base.cc:738: ASSERT(input_length >= 1);
On 2011/08/09 12:48:02, Lasse Reichstein wrote:
> I think this assert can be omitted. You just returned if input_length <= 1.

I wanted to catch bad inputs. Moved the assert to be the first line in the
function.

http://codereview.chromium.org/7558017/diff/1004/src/scanner-base.cc#newcode746
src/scanner-base.cc:746: const int keyword_length = sizeof(keyword) - 1;        
\
On 2011/08/09 12:48:02, Lasse Reichstein wrote:
> Add a comment saying sizeof(keyword) == strlen(keyword)+1

Done.

http://codereview.chromium.org/7558017/diff/1004/test/cctest/test-parsing.cc
File test/cctest/test-parsing.cc (right):

http://codereview.chromium.org/7558017/diff/1004/test/cctest/test-parsing.cc#...
test/cctest/test-parsing.cc:83: memmove(buffer, keyword, length);
On 2011/08/09 12:48:02, Lasse Reichstein wrote:
> Could you try appending all three of a letter, a digit and an underscore?

Done.

Powered by Google App Engine
This is Rietveld 408576698