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 235497 12756e269785fbcdb500450a15911aacd8ee5192
parent 235496 63f90f467985969860d5c30fd9df0cfd07560477
child 235498 6461b8a32d0eb94340b023587e910a1d1da6a708
push id366
push usercmanchester@mozilla.com
push dateThu, 08 Jan 2015 16:40:24 +0000
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);