Revert "[parser] Use memcmp for keyword checks"
This reverts commit 5616f91a7a
.
Reason for revert: Tanks performance on codeload/ia32 by >1%
Original change's description:
> [parser] Use memcmp for keyword checks
>
> Small readability increase for the keyword check magic, using memcmp
> instead of a chain of raw comparisons. Could allow better codegen for
> memcmp-aware compilers, though in practice seems to have little effect
> on generated code.
>
> Change-Id: I91020fe67cebc9270c61c4c678e15217e436afff
> Reviewed-on: https://chromium-review.googlesource.com/c/1340291
> Reviewed-by: Toon Verwaest <verwaest@chromium.org>
> Commit-Queue: Leszek Swirski <leszeks@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#57595}
TBR=leszeks@chromium.org,verwaest@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: Ifd4070efb3e692eb70e5d8b3adb04d7d7e45ef0e
Reviewed-on: https://chromium-review.googlesource.com/c/1345994
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57665}
This commit is contained in:
parent
b5a443c267
commit
8da2afaa77
@ -110,8 +110,16 @@ V8_INLINE Token::Value KeywordOrIdentifierToken(const uint8_t* input,
|
||||
DCHECK_EQ(input[0], keyword[0]); \
|
||||
DCHECK(token == Token::FUTURE_STRICT_RESERVED_WORD || \
|
||||
0 == strncmp(keyword, Token::String(token), sizeof(keyword))); \
|
||||
if (input_length == keyword_length && \
|
||||
memcmp(&input[1], &keyword[1], keyword_length - 1) == 0) { \
|
||||
if (input_length == keyword_length && input[1] == keyword[1] && \
|
||||
(keyword_length <= 2 || input[2] == keyword[2]) && \
|
||||
(keyword_length <= 3 || input[3] == keyword[3]) && \
|
||||
(keyword_length <= 4 || input[4] == keyword[4]) && \
|
||||
(keyword_length <= 5 || input[5] == keyword[5]) && \
|
||||
(keyword_length <= 6 || input[6] == keyword[6]) && \
|
||||
(keyword_length <= 7 || input[7] == keyword[7]) && \
|
||||
(keyword_length <= 8 || input[8] == keyword[8]) && \
|
||||
(keyword_length <= 9 || input[9] == keyword[9]) && \
|
||||
(keyword_length <= 10 || input[10] == keyword[10])) { \
|
||||
return token; \
|
||||
} \
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user