mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Backed out changeset 873ca890a187 (bug 1827072) for causing nightly as release bustages. CLOSED TREE
This commit is contained in:
parent
075869d7bf
commit
fc457bde73
@ -3358,10 +3358,6 @@ static bool NewString(JSContext* cx, unsigned argc, Value* vp) {
|
||||
if (capacity < len) {
|
||||
capacity = len;
|
||||
}
|
||||
if (len == 0) {
|
||||
JS_ReportErrorASCII(cx, "Cannot set capacity of empty string");
|
||||
return false;
|
||||
}
|
||||
if (stable.isLatin1()) {
|
||||
auto news = cx->make_pod_arena_array<JS::Latin1Char>(
|
||||
js::StringBufferArena, capacity);
|
||||
|
@ -1,2 +0,0 @@
|
||||
try { newString("", { capacity: 1 }); } catch (e) { };
|
||||
newString("x", { capacity: 2, tenured: true });
|
@ -395,19 +395,6 @@ void JSString::dumpRepresentationHeader(js::GenericPrinter& out,
|
||||
out.putChar('\n');
|
||||
}
|
||||
|
||||
JSExtensibleString& JSLinearString::makeExtensible(size_t capacity) {
|
||||
MOZ_ASSERT(!isDependent());
|
||||
MOZ_ASSERT(!isInline());
|
||||
MOZ_ASSERT(!isAtom());
|
||||
MOZ_ASSERT(!isExternal());
|
||||
MOZ_ASSERT(capacity >= length());
|
||||
js::RemoveCellMemory(this, allocSize(), js::MemoryUse::StringContents);
|
||||
setLengthAndFlags(length(), flags() | EXTENSIBLE_FLAGS);
|
||||
d.s.u3.capacity = capacity;
|
||||
js::AddCellMemory(this, allocSize(), js::MemoryUse::StringContents);
|
||||
return asExtensible();
|
||||
}
|
||||
|
||||
void JSLinearString::dumpRepresentationChars(js::GenericPrinter& out,
|
||||
int indent) const {
|
||||
if (hasLatin1Chars()) {
|
||||
|
@ -843,10 +843,16 @@ class JSLinearString : public JSString {
|
||||
JSContext* cx, js::UniquePtr<CharT[], JS::FreePolicy> chars,
|
||||
size_t length, js::gc::InitialHeap heap);
|
||||
|
||||
// Convert a plain linear string to an extensible string. For testing. The
|
||||
// caller must ensure that it is a plain or extensible string already, and
|
||||
// that `capacity` is adequate.
|
||||
JSExtensibleString& makeExtensible(size_t capacity);
|
||||
JSExtensibleString& makeExtensible(size_t capacity) {
|
||||
MOZ_ASSERT(!isDependent());
|
||||
MOZ_ASSERT(!isInline());
|
||||
MOZ_ASSERT(!isAtom());
|
||||
MOZ_ASSERT(!isExternal());
|
||||
MOZ_ASSERT(capacity >= length());
|
||||
setLengthAndFlags(length(), flags() | EXTENSIBLE_FLAGS);
|
||||
d.s.u3.capacity = capacity;
|
||||
return asExtensible();
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
MOZ_ALWAYS_INLINE const CharT* nonInlineChars(
|
||||
|
Loading…
Reference in New Issue
Block a user