X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/81345200c95645a1b0d2635520f96ad55dfde63f..2d39b0e377c0896910ee49ae70082ba665faf986:/parser/ParserArena.h?ds=sidebyside diff --git a/parser/ParserArena.h b/parser/ParserArena.h index e806d45..d8bc2cf 100644 --- a/parser/ParserArena.h +++ b/parser/ParserArena.h @@ -26,6 +26,7 @@ #ifndef ParserArena_h #define ParserArena_h +#include "CommonIdentifiers.h" #include "Identifier.h" #include #include @@ -72,6 +73,8 @@ namespace JSC { template ALWAYS_INLINE const Identifier& IdentifierArena::makeIdentifier(VM* vm, const T* characters, size_t length) { + if (!length) + return vm->propertyNames->emptyIdentifier; if (characters[0] >= MaximumCachableCharacter) { m_identifiers.append(Identifier(vm, characters, length)); return m_identifiers.last(); @@ -93,6 +96,8 @@ namespace JSC { ALWAYS_INLINE const Identifier& IdentifierArena::makeIdentifierLCharFromUChar(VM* vm, const UChar* characters, size_t length) { + if (!length) + return vm->propertyNames->emptyIdentifier; if (characters[0] >= MaximumCachableCharacter) { m_identifiers.append(Identifier::createLCharFromUChar(vm, characters, length)); return m_identifiers.last();