Bug 1285237 - Consider ParseNodeAllocator::allocNode as fallible. r=jorendorff, a=ritu
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Wed, 28 Sep 2016 12:28:37 +0000
changeset 340408 4631a67ac6115395aa4c2d72132b87c351e76131
parent 340407 a738538c802e5162c1088487117179f5a4d39be3
child 340409 ab649b462ad8552105bd0d43772da246b020996e
push id10100
push userryanvm@gmail.com
push dateTue, 04 Oct 2016 21:17:57 +0000
treeherdermozilla-aurora@43c3d294f63c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff, ritu
bugs1285237
milestone51.0a2
Bug 1285237 - Consider ParseNodeAllocator::allocNode as fallible. r=jorendorff, a=ritu
js/src/frontend/ParseNode.cpp
--- a/js/src/frontend/ParseNode.cpp
+++ b/js/src/frontend/ParseNode.cpp
@@ -554,16 +554,17 @@ ParseNodeAllocator::freeTree(ParseNode* 
 void*
 ParseNodeAllocator::allocNode()
 {
     if (ParseNode* pn = freelist) {
         freelist = pn->pn_next;
         return pn;
     }
 
+    LifoAlloc::AutoFallibleScope fallibleAllocator(&alloc);
     void* p = alloc.alloc(sizeof (ParseNode));
     if (!p)
         ReportOutOfMemory(cx);
     return p;
 }
 
 ParseNode*
 ParseNode::appendOrCreateList(ParseNodeKind kind, JSOp op, ParseNode* left, ParseNode* right,