Bug 1231224 part 6 - Handle Vector OOM in some copy constructors. r=bhackett
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 10 Dec 2015 13:22:15 -0500
changeset 310259 136542de8e2ea963923a4296d3b02b27fe7eb021
parent 310258 5000824d37a7d4a8d30cbe35cec1b7d00c21aa78
child 310260 5a1e59872646924a54ea2ee8dbfa5c754919d918
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhackett
bugs1231224
milestone45.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 1231224 part 6 - Handle Vector OOM in some copy constructors. r=bhackett
js/src/jit/IonAnalysis.h
js/src/jit/RegisterAllocator.h
--- a/js/src/jit/IonAnalysis.h
+++ b/js/src/jit/IonAnalysis.h
@@ -129,17 +129,19 @@ class LinearSum
         constant_(0)
     {
     }
 
     LinearSum(const LinearSum& other)
       : terms_(other.terms_.allocPolicy()),
         constant_(other.constant_)
     {
-        terms_.appendAll(other.terms_);
+        AutoEnterOOMUnsafeRegion oomUnsafe;
+        if (!terms_.appendAll(other.terms_))
+            oomUnsafe.crash("LinearSum::LinearSum");
     }
 
     // These return false on an integer overflow, and afterwards the sum must
     // not be used.
     bool multiply(int32_t scale);
     bool add(const LinearSum& other, int32_t scale = 1);
     bool add(SimpleLinearSum other, int32_t scale = 1);
     bool add(MDefinition* term, int32_t scale);
--- a/js/src/jit/RegisterAllocator.h
+++ b/js/src/jit/RegisterAllocator.h
@@ -60,28 +60,34 @@ struct AllocationIntegrityState
         Vector<LDefinition, 0, SystemAllocPolicy> temps;
         Vector<LDefinition, 1, SystemAllocPolicy> outputs;
 
         InstructionInfo()
         { }
 
         InstructionInfo(const InstructionInfo& o)
         {
-            inputs.appendAll(o.inputs);
-            temps.appendAll(o.temps);
-            outputs.appendAll(o.outputs);
+            AutoEnterOOMUnsafeRegion oomUnsafe;
+            if (!inputs.appendAll(o.inputs) ||
+                !temps.appendAll(o.temps) ||
+                !outputs.appendAll(o.outputs))
+            {
+                oomUnsafe.crash("InstructionInfo::InstructionInfo");
+            }
         }
     };
     Vector<InstructionInfo, 0, SystemAllocPolicy> instructions;
 
     struct BlockInfo {
         Vector<InstructionInfo, 5, SystemAllocPolicy> phis;
         BlockInfo() {}
         BlockInfo(const BlockInfo& o) {
-            phis.appendAll(o.phis);
+            AutoEnterOOMUnsafeRegion oomUnsafe;
+            if (!phis.appendAll(o.phis))
+                oomUnsafe.crash("BlockInfo::BlockInfo");
         }
     };
     Vector<BlockInfo, 0, SystemAllocPolicy> blocks;
 
     Vector<LDefinition*, 20, SystemAllocPolicy> virtualRegisters;
 
     // Describes a correspondence that should hold at the end of a block.
     // The value which was written to vreg in the original LIR should be