24static const char*
const names[] = {
27#define DEFINE_SYMBOL_LITERAL(symbol, literal) literal,
29#undef DEFINE_SYMBOL_LITERAL
31#define DEFINE_TOKEN_SYMBOL_INDEX(t, s, p, a) s,
34#undef DEFINE_TOKEN_SYMBOL_INDEX
47 if (is_all() && str_.
IsOld()) {
72 const int tok_index = token;
73 ASSERT((0 <= tok_index) && (tok_index < Token::kNumTokens));
76 ASSERT(symbol_handles_[token_id] !=
nullptr);
77 return *symbol_handles_[token_id];
90 ASSERT((
sizeof(
names) /
sizeof(
const char*)) == Symbols::kNullCharId);
99 for (intptr_t
i = 1;
i < Symbols::kNullCharId;
i++) {
103 *str ^=
table.InsertOrGet(*str);
105 symbol_handles_[
i] = str;
110 intptr_t idx = (kNullCharId + c);
113 uint8_t ch =
static_cast<uint8_t
>(c);
117 *str ^=
table.InsertOrGet(*str);
118 ASSERT(predefined_[c] ==
nullptr);
120 predefined_[c] = str->
ptr();
121 symbol_handles_[idx] = str;
138 for (intptr_t
i = 1;
i < Symbols::kNullCharId;
i++) {
140 const unsigned char*
name =
141 reinterpret_cast<const unsigned char*
>(
names[
i]);
146 symbol_handles_[
i] = str;
152 intptr_t idx = (kNullCharId + c);
155 uint8_t ch =
static_cast<uint8_t
>(c);
161 predefined_[c] = str->
ptr();
162 symbol_handles_[idx] = str;
169 ASSERT(isolate_group !=
nullptr);
173 ? kInitialVMIsolateSymtabSize
174 : kInitialSymtabSize;
176 HashTables::New<CanonicalStringSet>(initial_size,
Heap::kOld));
182 intptr_t* capacity) {
183 ASSERT(isolate_group !=
nullptr);
186 *capacity =
table.NumEntries();
192 const uint8_t* utf8_array =
reinterpret_cast<const uint8_t*
>(cstr);
197 const uint8_t* utf8_array,
198 intptr_t array_len) {
199 if (array_len == 0 || utf8_array ==
nullptr) {
200 return FromLatin1(thread,
static_cast<uint8_t*
>(
nullptr), 0);
207 uint8_t* characters = zone->
Alloc<uint8_t>(
len);
215 uint16_t* characters = zone->
Alloc<uint16_t>(
len);
224 const uint8_t* latin1_array,
230 const uint16_t* utf16_array,
239 return New(thread, str2);
240 }
else if (str2.
Length() == 0) {
241 return New(thread, str1);
248 return FromConcat(thread, GetterPrefix(), str);
252 return FromConcat(thread, SetterPrefix(), str);
265 const intptr_t strs_length = strs.
length();
268 intptr_t len_sum = 0;
269 const intptr_t kOneByteChar = 1;
270 intptr_t char_size = kOneByteChar;
272 for (intptr_t
i = 0;
i < strs_length;
i++) {
274 const intptr_t str_len = str.
Length();
280 lengths.
Add(str_len);
283 const bool is_one_byte_string = char_size == kOneByteChar;
286 if (is_one_byte_string) {
288 const uint8_t*
const orig_buffer =
buffer;
289 for (intptr_t
i = 0;
i < strs_length;
i++) {
291 intptr_t str_len = lengths[
i];
295 const uint8_t*
src_p = OneByteString::DataStart(str);
304 const uint16_t*
const orig_buffer =
buffer;
305 for (intptr_t
i = 0;
i < strs_length;
i++) {
307 intptr_t str_len = lengths[
i];
311 memmove(
buffer, TwoByteString::DataStart(str), str_len * 2);
315 const uint8_t*
src_p = OneByteString::DataStart(str);
316 for (
int n = 0; n < str_len; n++) {
329template <
typename StringType>
330StringPtr Symbols::NewSymbol(
Thread* thread,
const StringType& str) {
340 data = vm_isolate_group->object_store()->symbol_table();
342 symbol ^=
table.GetOrNull(str);
347 ObjectStore* object_store =
group->object_store();
355 data = object_store->symbol_table();
357 symbol ^=
table.GetOrNull(str);
362 SafepointMutexLocker ml(
group->symbols_mutex());
363 data = object_store->symbol_table();
365 symbol ^=
table.InsertNewOrGet(str);
366 object_store->set_symbol_table(
table.Release());
374template <
typename StringType>
385 data = vm_isolate_group->object_store()->symbol_table();
387 symbol ^=
table.GetOrNull(str);
396 data = object_store->symbol_table();
398 symbol ^=
table.GetOrNull(str);
401 data = object_store->symbol_table();
403 symbol ^=
table.GetOrNull(str);
416 return Lookup(thread, str2);
417 }
else if (str2.
Length() == 0) {
418 return Lookup(thread, str1);
440 return New(thread, str, 0, str.
Length());
445 intptr_t begin_index,
463 va_copy(args_copy,
args);
478 return predefined_[char_code];
483 intptr_t capacity = -1;
487 OS::PrintErr(
"VM Isolate: Symbol table capacity : %" Pd "\n", capacity);
491 OS::PrintErr(
"Isolate: Symbol table capacity : %" Pd "\n", capacity);
static uint8_t src_p(uint8_t src, uint8_t dst)
#define RELEASE_ASSERT(cond)
StringPtr ToSymbol() const
static IsolateGroup * vm_isolate_group()
static DART_NORETURN void ThrowOOM()
ObjectStore * object_store() const
static IsolateGroup * Current()
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static Object * ReadOnlyHandle()
void SetCanonical() const
static OneByteStringPtr New(intptr_t len, Heap::Space space)
StringPtr ToSymbol() const
static StringPtr FromLatin1(const uint8_t *latin1_array, intptr_t array_len, Heap::Space space=Heap::kNew)
static constexpr intptr_t kMaxElements
bool IsOneByteString() const
intptr_t CharSize() const
bool IsTwoByteString() const
static StringPtr SubString(const String &str, intptr_t begin_index, Heap::Space space=Heap::kNew)
static StringPtr Concat(const String &str1, const String &str2, Heap::Space space=Heap::kNew)
static StringPtr FromUTF16(const uint16_t *utf16_array, intptr_t array_len, Heap::Space space=Heap::kNew)
static void GetStats(IsolateGroup *isolate_group, intptr_t *size, intptr_t *capacity)
static void InitFromSnapshot(IsolateGroup *isolate_group)
static StringPtr Lookup(Thread *thread, const StringType &str)
static const char * Name(SymbolId symbol)
static StringPtr LookupFromDot(Thread *thread, const String &str)
static StringPtr static StringPtr NewFormattedV(Thread *thread, const char *format, va_list args)
static StringPtr LookupFromGet(Thread *thread, const String &str)
static void Init(IsolateGroup *isolate_group)
static StringPtr FromConcat(Thread *thread, const String &str1, const String &str2)
static StringPtr LookupFromSet(Thread *thread, const String &str)
static StringPtr FromUTF16(Thread *thread, const uint16_t *utf16_array, intptr_t len)
static constexpr int kNumberOfOneCharCodeSymbols
static StringPtr FromGet(Thread *thread, const String &str)
static StringPtr FromSet(Thread *thread, const String &str)
static StringPtr FromDot(Thread *thread, const String &str)
static StringPtr FromCharCode(Thread *thread, uint16_t char_code)
static void SetupSymbolTable(IsolateGroup *isolate_group)
static StringPtr FromConcatAll(Thread *thread, const GrowableHandlePtrArray< const String > &strs)
static StringPtr FromUTF8(Thread *thread, const uint8_t *utf8_array, intptr_t len)
static StringPtr New(Thread *thread, const char *cstr)
static void DumpStats(IsolateGroup *isolate_group)
static const String & Dot()
static StringPtr LookupFromConcat(Thread *thread, const String &str1, const String &str2)
static StringPtr NewFormatted(Thread *thread, const char *format,...) PRINTF_ATTRIBUTE(2
static void DumpTable(IsolateGroup *isolate_group)
static StringPtr FromLatin1(Thread *thread, const uint8_t *latin1_array, intptr_t len)
static const String & Token(Token::Kind token)
bool CanAcquireSafepointLocks() const
bool OwnsSafepoint() const
static Thread * Current()
IsolateGroup * isolate_group() const
static intptr_t CodeUnitCount(const uint8_t *utf8_array, intptr_t array_len, Type *type)
static intptr_t ReportInvalidByte(const uint8_t *utf8_array, intptr_t array_len, intptr_t len)
static bool DecodeToUTF16(const uint8_t *utf8_array, intptr_t array_len, uint16_t *dst, intptr_t len)
static bool DecodeToLatin1(const uint8_t *utf8_array, intptr_t array_len, uint8_t *dst, intptr_t len)
static bool IsLatin1(int32_t code_point)
static constexpr T Maximum(T x, T y)
static int static int VSNPrint(char *str, size_t size, const char *format, va_list args)
ElementType * Alloc(intptr_t length)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint32_t uint32_t * format
static const char *const names[]
CharArray< uint8_t > Latin1Array
CharArray< uint16_t > UTF16Array
StringPtr StringFrom(const uint8_t *data, intptr_t len, Heap::Space space)
static int8_t data[kExtLength]
UnorderedHashSet< SymbolTraits, WeakAcqRelStorageTraits > CanonicalStringSet
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
#define REUSABLE_ARRAY_HANDLESCOPE(thread)
#define REUSABLE_SMI_HANDLESCOPE(thread)
#define REUSABLE_WEAK_ARRAY_HANDLESCOPE(thread)
#define REUSABLE_OBJECT_HANDLESCOPE(thread)
#define DEFINE_SYMBOL_LITERAL(symbol, literal)
#define DEFINE_TOKEN_SYMBOL_INDEX(t, s, p, a)
#define PREDEFINED_SYMBOLS_LIST(V)
#define DART_KEYWORD_LIST(KW)
#define DART_TOKEN_LIST(TOK)