Index: src/ast/ast-value-factory.cc |
diff --git a/src/ast/ast-value-factory.cc b/src/ast/ast-value-factory.cc |
index 42295ab6a528a3d6ef20ce25ee3f5bf8fc2a4276..aecaf4bd6474a7022934bfc28bdadb0a62a44942 100644 |
--- a/src/ast/ast-value-factory.cc |
+++ b/src/ast/ast-value-factory.cc |
@@ -28,6 +28,7 @@ |
#include "src/ast/ast-value-factory.h" |
#include "src/api.h" |
+#include "src/char-predicates-inl.h" |
#include "src/objects.h" |
#include "src/utils.h" |
@@ -222,6 +223,15 @@ void AstValue::Internalize(Isolate* isolate) { |
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) { |
+ uint32_t hash = StringHasher::HashSequentialString<uint8_t>( |
+ literal.start(), literal.length(), hash_seed_); |
+ one_character_strings_[key] = GetString(hash, true, literal); |
+ } |
+ return one_character_strings_[key]; |
+ } |
uint32_t hash = StringHasher::HashSequentialString<uint8_t>( |
literal.start(), literal.length(), hash_seed_); |
return GetString(hash, true, literal); |