Bug 1287086 - Use LifoAlloc::AutoFallibleScope in LSprinter::put. r=h4writer
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Mon, 18 Jul 2016 12:51:25 +0000
changeset 305591 895a11230f50a35a7dc626f6cdca22018f772547
parent 305590 d8fb8e2d81a0bcd9d75703916c8e0593dac12d3c
child 305592 d6f1c31cfcc4aaed9b5fa219b5e728dd6082fa1c
push id30467
push usercbook@mozilla.com
push dateWed, 20 Jul 2016 09:21:53 +0000
treeherdermozilla-central@e904e18d7dfc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersh4writer
bugs1287086
milestone50.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
Bug 1287086 - Use LifoAlloc::AutoFallibleScope in LSprinter::put. r=h4writer
js/src/vm/Printer.cpp
--- a/js/src/vm/Printer.cpp
+++ b/js/src/vm/Printer.cpp
@@ -524,17 +524,21 @@ LSprinter::put(const char* s, size_t len
         len -= minLen;
         s += minLen;
     }
 
     if (len == 0)
         return origLen;
 
     size_t allocLength = AlignBytes(sizeof(Chunk) + len, js::detail::LIFO_ALLOC_ALIGN);
-    Chunk* last = reinterpret_cast<Chunk*>(alloc_->alloc(allocLength));
+    Chunk* last = nullptr;
+    {
+        LifoAlloc::AutoFallibleScope fallibleAllocator(alloc_);
+        last = reinterpret_cast<Chunk*>(alloc_->alloc(allocLength));
+    }
     if (!last) {
         reportOutOfMemory();
         return origLen - len;
     }
 
     if (tail_ && reinterpret_cast<char*>(last) == tail_->end()) {
         // tail_ and last are next to each others in memory, knowing that the
         // TempAlloctator has no meta data and is just a bump allocator, we