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

Unified Diff: src/ast/ast-value-factory.h

Issue 2541353002: AstValueFactory: add a cache for one-character strings. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ast/ast-value-factory.cc » ('j') | src/ast/ast-value-factory.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/ast-value-factory.h
diff --git a/src/ast/ast-value-factory.h b/src/ast/ast-value-factory.h
index 4ce480fe570b94b6fda45492592985afaeb137cb..5909b1a06ca1ea9d5e2fe9eeec2fc89c5f469906 100644
--- a/src/ast/ast-value-factory.h
+++ b/src/ast/ast-value-factory.h
@@ -332,7 +332,6 @@ class AstValueFactory {
AstValueFactory(Zone* zone, uint32_t hash_seed)
: string_table_(AstRawStringCompare),
values_(nullptr),
- smis_(),
strings_(nullptr),
strings_end_(&strings_),
zone_(zone),
@@ -344,6 +343,9 @@ class AstValueFactory {
OTHER_CONSTANTS(F)
#undef F
std::fill(smis_, smis_ + arraysize(smis_), nullptr);
+ std::fill(one_character_strings_,
+ one_character_strings_ + arraysize(one_character_strings_),
+ nullptr);
}
Zone* zone() const { return zone_; }
@@ -423,11 +425,16 @@ class AstValueFactory {
// they can be internalized later).
AstValue* values_;
- AstValue* smis_[kMaxCachedSmi + 1];
// We need to keep track of strings_ in order since cons strings require their
// members to be internalized first.
AstString* strings_;
AstString** strings_end_;
+
+ // Caches for faster access: small numbers, one character lowercase strings
+ // (for minified code).
+ AstValue* smis_[kMaxCachedSmi + 1];
+ AstRawString* one_character_strings_[26];
Toon Verwaest 2016/12/05 15:30:40 constants ... :) I guess the alphabet won't change
+
Zone* zone_;
uint32_t hash_seed_;
« no previous file with comments | « no previous file | src/ast/ast-value-factory.cc » ('j') | src/ast/ast-value-factory.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698