зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1651390 - Part 1: Copy comments from NewString[DontDeflate]. r=sfink
Copy the comments to the `NewString<allowGC>` alternatives before removing the functions in part 2. Differential Revision: https://phabricator.services.mozilla.com/D82732
This commit is contained in:
Родитель
444700f8d1
Коммит
f36ea50e8b
|
@ -1680,6 +1680,8 @@ JSLinearString* js::NewStringDontDeflate(
|
|||
}
|
||||
|
||||
if (JSInlineString::lengthFits<CharT>(length)) {
|
||||
// |chars.get()| is safe because 1) |NewInlineString| necessarily *copies*,
|
||||
// and 2) |chars| frees its contents only when this function returns.
|
||||
return NewInlineString<allowGC>(
|
||||
cx, mozilla::Range<const CharT>(chars.get(), length), heap);
|
||||
}
|
||||
|
@ -1710,6 +1712,8 @@ JSLinearString* js::NewString(JSContext* cx,
|
|||
size_t length, gc::InitialHeap heap) {
|
||||
if constexpr (std::is_same_v<CharT, char16_t>) {
|
||||
if (CanStoreCharsAsLatin1(chars.get(), length)) {
|
||||
// Deflating copies from |chars.get()| and lets |chars| be freed on
|
||||
// return.
|
||||
return NewStringDeflated<allowGC>(cx, chars.get(), length, heap);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче