☠☠ backed out by b580ce0f1d06 ☠ ☠ | |
author | Steve Fink <sfink@mozilla.com> |
Thu, 11 Jan 2018 11:27:56 -0800 (2018-01-11) | |
changeset 398845 | 2dab1647f93321a1bb6f418495f55260f2eacc28 |
parent 398844 | 6e926521ce37cadc4fcbd3451542a7975446311e |
child 398846 | 16740cf93a77c1f8ba6d39cf5748e0180e7e95dc |
push id | 98844 |
push user | sfink@mozilla.com |
push date | Thu, 11 Jan 2018 19:32:29 +0000 (2018-01-11) |
treeherder | mozilla-inbound@2dab1647f933 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | leak |
bugs | 903519 |
milestone | 59.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/src/vm/String.cpp +++ b/js/src/vm/String.cpp @@ -698,16 +698,24 @@ template <typename CharT> JSFlatString* JSDependentString::undependInternal(JSContext* cx) { size_t n = length(); CharT* s = cx->pod_malloc<CharT>(n + 1); if (!s) return nullptr; + if (!isTenured()) { + if (!cx->runtime()->gc.nursery().registerMallocedBuffer(s)) { + js_free(s); + ReportOutOfMemory(cx); + return nullptr; + } + } + AutoCheckCannotGC nogc; PodCopy(s, nonInlineChars<CharT>(nogc), n); s[n] = '\0'; setNonInlineChars<CharT>(s); /* * Transform *this into an undepended string so 'base' will remain rooted * for the benefit of any other dependent string that depends on *this. @@ -1100,16 +1108,24 @@ JSExternalString::ensureFlat(JSContext* { MOZ_ASSERT(hasTwoByteChars()); size_t n = length(); char16_t* s = cx->pod_malloc<char16_t>(n + 1); if (!s) return nullptr; + if (!isTenured()) { + if (!cx->runtime()->gc.nursery().registerMallocedBuffer(s)) { + js_free(s); + ReportOutOfMemory(cx); + return nullptr; + } + } + // Copy the chars before finalizing the string. { AutoCheckCannotGC nogc; PodCopy(s, nonInlineChars<char16_t>(nogc), n); s[n] = '\0'; } // Release the external chars.