Bug 1116646 - Avoid assertion when running out of virtual registers, r=jandem.
authorBrian Hackett <bhackett1024@gmail.com>
Wed, 07 Jan 2015 10:52:56 -0700
changeset 239262 12756e269785fbcdb500450a15911aacd8ee5192
parent 239261 63f90f467985969860d5c30fd9df0cfd07560477
child 239263 6461b8a32d0eb94340b023587e910a1d1da6a708
push id7472
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 20:36:27 +0000
treeherdermozilla-aurora@300ca104f8fb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1116646
milestone37.0a1
Bug 1116646 - Avoid assertion when running out of virtual registers, r=jandem.
js/src/jit/shared/Lowering-shared.h
--- a/js/src/jit/shared/Lowering-shared.h
+++ b/js/src/jit/shared/Lowering-shared.h
@@ -161,18 +161,21 @@ class LIRGeneratorShared : public MDefin
     inline void redefine(MDefinition *ins, MDefinition *as);
 
     TempAllocator &alloc() const {
         return graph.alloc();
     }
 
     uint32_t getVirtualRegister() {
         uint32_t vreg = lirGraph_.getVirtualRegister();
-        if (vreg >= MAX_VIRTUAL_REGISTERS) {
-            // Mark code generation as having failed, and return a dummy vreg.
+
+        // If we run out of virtual registers, mark code generation as having
+        // failed and return a dummy vreg. Include a + 1 here for NUNBOX32
+        // platforms that expect Value vregs to be adjacent.
+        if (vreg + 1 >= MAX_VIRTUAL_REGISTERS) {
             gen->abort("max virtual registers");
             return 1;
         }
         return vreg;
     }
 
     template <typename T> void annotate(T *ins);
     template <typename T> void add(T *ins, MInstruction *mir = nullptr);