Commit b42cbe03 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[parser] Extend one_char_strings to all chars < 128

That way we can also cache A-Z, 0-9, _, $ (and all others obviously).

Change-Id: I394001646c80bbabf9b09f66eddc1bef82ae91b3
Reviewed-on: https://chromium-review.googlesource.com/c/1341948
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57606}
parent 7b3f609b
......@@ -208,9 +208,9 @@ AstStringConstants::AstStringConstants(Isolate* isolate, uint64_t hash_seed)
AstRawString* AstValueFactory::GetOneByteStringInternal(
Vector<const uint8_t> literal) {
if (literal.length() == 1 && IsInRange(literal[0], 'a', 'z')) {
int key = literal[0] - 'a';
if (one_character_strings_[key] == nullptr) {
if (literal.length() == 1 && literal[0] < kMaxOneCharStringValue) {
int key = literal[0];
if (V8_UNLIKELY(one_character_strings_[key] == nullptr)) {
uint32_t hash_field = StringHasher::HashSequentialString<uint8_t>(
literal.start(), literal.length(), hash_seed_);
one_character_strings_[key] = GetString(hash_field, true, literal);
......
......@@ -363,7 +363,8 @@ class AstValueFactory {
const AstConsString* empty_cons_string_;
// Caches one character lowercase strings (for minified code).
AstRawString* one_character_strings_[26];
static const int kMaxOneCharStringValue = 128;
AstRawString* one_character_strings_[kMaxOneCharStringValue];
Zone* zone_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment