"(either one or two byte) because defaulting to throw away the external data" should be "(either one or two byte) BEFORE defaulting to throw away the external data"
On Monday, April 17, 2023 at 7:12:19 AM UTC-7 Bruce MacNaughton wrote: > This is my first relatively deep dive into v8 strings; if I misinterpreted > what's going on, please correct me. > > When a string is used as a key: > > const x = 'xyzzy'; > // add some external data to x > const obj = { [x]: 1234 }; > > the external data is lost because StringTable:::LookupKey() finds an entry > (data->FindEntry()) and returns a Handle<String> to it. That String is > *not* internalized, so > String::MakeThin() is called on the original string (as 'this') with the > Handle<String> returned by FindEntry(). MakeThin() finds > this->IsExternalString() true so calls MigrateExternalString(), > internalized is *not* an External string, so FinalizeExternalString() is > called, discarding the external data. > > whew. > > It seems like, to propagate the external data that, in LookupString(), if > string->IsExternal() and !result->IsExternal() then result should be > reconstructed as an External string. > > It may be that the way it works is intended, but it's not clear because > MigrateExternalString() in string.cc checks to see if 'internalized' is an > external string (either one or two byte) because defaulting to throw away > the external data. > > But maybe there are considerations with the shared heap that I have yet to > understand. > > Basic question: is this is a bug or intentional design? > > > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/e88c1553-4a78-435f-bc75-cc42f0b3f147n%40googlegroups.com.