Bug 1240521 - IonBuilder processSwitchEnd returns ControlStatus_Error on allocation errors. r=h4writer
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Tue, 08 Mar 2016 13:19:34 +0000
changeset 287244 f7cd029bb2dc11222bab8a8373bfa1d25dbcf832
parent 287243 8fda6bf7dcb31a863deb3d035fd9552a80471116
child 287245 677309c89611f3c23ae78d898837efd3781fac5d
push id30065
push userkwierso@gmail.com
push dateWed, 09 Mar 2016 00:01:05 +0000
treeherdermozilla-central@886b5480b578 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersh4writer
bugs1240521
milestone47.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 1240521 - IonBuilder processSwitchEnd returns ControlStatus_Error on allocation errors. r=h4writer
js/src/jit-test/tests/ion/bug1240521.js
js/src/jit/IonBuilder.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/ion/bug1240521.js
@@ -0,0 +1,13 @@
+// |jit-test| allow-oom
+var egc = 138;
+function SwitchTest(value) {
+    switch (value) {
+        case 0:
+            break
+        case new Number:
+            result = 8
+        case oomAfterAllocations(egc):
+    }
+}
+!(SwitchTest(4) === 4);
+!(SwitchTest(true) === 2);
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -3049,17 +3049,17 @@ IonBuilder::processSwitchEnd(DeferredEdg
     // Else create a block with current as predecessor
     MBasicBlock* successor = nullptr;
     if (breaks)
         successor = createBreakCatchBlock(breaks, exitpc);
     else
         successor = newBlock(current, exitpc);
 
     if (!successor)
-        return ControlStatus_Ended;
+        return ControlStatus_Error;
 
     // If there is current, the current block flows into this one.
     // So current is also a predecessor to this block
     if (current) {
         current->end(MGoto::New(alloc(), successor));
         if (breaks) {
             if (!successor->addPredecessor(alloc(), current))
                 return ControlStatus_Error;