diff options
Diffstat (limited to 'deps/v8/src/ast/ast-value-factory.h')
-rw-r--r-- | deps/v8/src/ast/ast-value-factory.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/deps/v8/src/ast/ast-value-factory.h b/deps/v8/src/ast/ast-value-factory.h index dce9de40697..134612f1fd0 100644 --- a/deps/v8/src/ast/ast-value-factory.h +++ b/deps/v8/src/ast/ast-value-factory.h @@ -31,6 +31,7 @@ #include <forward_list> #include "src/base/hashmap.h" +#include "src/base/logging.h" #include "src/common/globals.h" #include "src/heap/factory.h" #include "src/numbers/conversions.h" @@ -66,6 +67,8 @@ class AstRawString final : public ZoneObject { int byte_length() const { return literal_bytes_.length(); } const unsigned char* raw_data() const { return literal_bytes_.begin(); } + bool IsPrivateName() const { return length() > 0 && FirstCharacter() == '#'; } + // For storing AstRawStrings in a hash map. uint32_t hash_field() const { return hash_field_; } uint32_t Hash() const { return hash_field_ >> Name::kHashShift; } @@ -288,6 +291,7 @@ class AstValueFactory { empty_cons_string_(nullptr), zone_(zone), hash_seed_(hash_seed) { + DCHECK_NOT_NULL(zone_); DCHECK_EQ(hash_seed, string_constants->hash_seed()); std::fill(one_character_strings_, one_character_strings_ + arraysize(one_character_strings_), @@ -295,7 +299,10 @@ class AstValueFactory { empty_cons_string_ = NewConsString(); } - Zone* zone() const { return zone_; } + Zone* zone() const { + DCHECK_NOT_NULL(zone_); + return zone_; + } const AstRawString* GetOneByteString(Vector<const uint8_t> literal) { return GetOneByteStringInternal(literal); @@ -317,6 +324,9 @@ class AstValueFactory { V8_EXPORT_PRIVATE AstConsString* NewConsString(const AstRawString* str1, const AstRawString* str2); + // Internalize all the strings in the factory, and prevent any more from being + // allocated. Multiple calls to Internalize are allowed, for simplicity, where + // subsequent calls are a no-op. template <typename LocalIsolate> void Internalize(LocalIsolate* isolate); |