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 355944 4631a67ac6115395aa4c2d72132b87c351e76131
parent 355943 a738538c802e5162c1088487117179f5a4d39be3
child 355945 ab649b462ad8552105bd0d43772da246b020996e
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [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,