Backed out changeset 6f7f5787e46e (bug 953164)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Wed, 26 Feb 2014 13:59:41 +0100
changeset 171021 20226f09d05969f56a96f06e0225dc67b4abf8af
parent 171020 a6c42421bb9d13e33361df9455202796d49464c9
child 171022 b90bf66240666f255fcca4064309942db531d60c
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
bugs953164
milestone30.0a1
backs out6f7f5787e46e0ad5cf3610924555f7e32ed6d7ea
Backed out changeset 6f7f5787e46e (bug 953164)
js/src/jit/Ion.cpp
js/src/jit/IonAnalysis.cpp
js/src/jit/IonBuilder.cpp
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -1372,18 +1372,18 @@ OptimizeMIR(MIRGenerator *mir)
 
     if (mir->optimizationInfo().eliminateRedundantChecksEnabled()) {
         // Note: check elimination has to run after all other passes that move
         // instructions. Since check uses are replaced with the actual index,
         // code motion after this pass could incorrectly move a load or store
         // before its bounds check.
         if (!EliminateRedundantChecks(graph))
             return false;
+        AssertGraphCoherency(graph);
         IonSpewPass("Bounds Check Elimination");
-        AssertGraphCoherency(graph);
     }
 
     return true;
 }
 
 LIRGraph *
 GenerateLIR(MIRGenerator *mir)
 {
@@ -1391,17 +1391,17 @@ GenerateLIR(MIRGenerator *mir)
 
     LIRGraph *lir = mir->alloc().lifoAlloc()->new_<LIRGraph>(&graph);
     if (!lir)
         return nullptr;
 
     LIRGenerator lirgen(mir, graph, *lir);
     if (!lirgen.generate())
         return nullptr;
-    IonSpewPass("Generate LIR");
+    //IonSpewPass("Generate LIR");
 
     if (mir->shouldCancel("Generate LIR"))
         return nullptr;
 
     AllocationIntegrityState integrity(*lir);
 
     switch (mir->optimizationInfo().registerAllocator()) {
       case RegisterAllocator_LSRA: {
@@ -1414,17 +1414,17 @@ GenerateLIR(MIRGenerator *mir)
         if (!regalloc.go())
             return nullptr;
 
 #ifdef DEBUG
         if (!integrity.check(false))
             return nullptr;
 #endif
 
-        IonSpewPass("Allocate Registers [LSRA]", &regalloc);
+        //IonSpewPass("Allocate Registers [LSRA]", &regalloc);
         break;
       }
 
       case RegisterAllocator_Backtracking: {
 #ifdef DEBUG
         if (!integrity.record())
             return nullptr;
 #endif
@@ -1433,47 +1433,47 @@ GenerateLIR(MIRGenerator *mir)
         if (!regalloc.go())
             return nullptr;
 
 #ifdef DEBUG
         if (!integrity.check(false))
             return nullptr;
 #endif
 
-        IonSpewPass("Allocate Registers [Backtracking]");
+        //IonSpewPass("Allocate Registers [Backtracking]");
         break;
       }
 
       case RegisterAllocator_Stupid: {
         // Use the integrity checker to populate safepoint information, so
         // run it in all builds.
         if (!integrity.record())
             return nullptr;
 
         StupidAllocator regalloc(mir, &lirgen, *lir);
         if (!regalloc.go())
             return nullptr;
         if (!integrity.check(true))
             return nullptr;
-        IonSpewPass("Allocate Registers [Stupid]");
+        //IonSpewPass("Allocate Registers [Stupid]");
         break;
       }
 
       default:
         MOZ_ASSUME_UNREACHABLE("Bad regalloc");
     }
 
     if (mir->shouldCancel("Allocate Registers"))
         return nullptr;
 
     // Now that all optimization and register allocation is done, re-introduce
     // critical edges to avoid unnecessary jumps.
     if (!UnsplitEdges(lir))
         return nullptr;
-    IonSpewPass("Unsplit Critical Edges");
+    //IonSpewPass("Unsplit Critical Edges");
     AssertBasicGraphCoherency(graph);
 
     return lir;
 }
 
 CodeGenerator *
 GenerateCode(MIRGenerator *mir, LIRGraph *lir, MacroAssembler *maybeMasm)
 {
--- a/js/src/jit/IonAnalysis.cpp
+++ b/js/src/jit/IonAnalysis.cpp
@@ -1282,29 +1282,32 @@ jit::AssertBasicGraphCoherency(MIRGraph 
         JS_ASSERT(!osrBlock->unreachable());
     }
 
     if (MResumePoint *resumePoint = graph.entryResumePoint())
         JS_ASSERT(resumePoint->block() == graph.entryBlock());
 
     // Assert successor and predecessor list coherency.
     uint32_t count = 0;
+    size_t compares = 0;
     for (MBasicBlockIterator block(graph.begin()); block != graph.end(); block++) {
         count++;
 
         JS_ASSERT(&block->graph() == &graph);
 
         for (size_t i = 0; i < block->numSuccessors(); i++)
             JS_ASSERT(CheckSuccessorImpliesPredecessor(*block, block->getSuccessor(i)));
 
         for (size_t i = 0; i < block->numPredecessors(); i++)
             JS_ASSERT(CheckPredecessorImpliesSuccessor(*block, block->getPredecessor(i)));
 
         // Assert that use chains are valid for this instruction.
         for (MDefinitionIterator iter(*block); iter; iter++) {
+            if (iter->isCompare())
+                compares++;
             for (uint32_t i = 0, e = iter->numOperands(); i < e; i++)
                 JS_ASSERT(CheckOperandImpliesUse(*iter, iter->getOperand(i)));
         }
         for (MResumePointIterator iter(block->resumePointsBegin()); iter != block->resumePointsEnd(); iter++) {
             for (uint32_t i = 0, e = iter->numOperands(); i < e; i++) {
                 if (iter->getUseFor(i)->hasProducer())
                     JS_ASSERT(CheckOperandImpliesUse(*iter, iter->getOperand(i)));
             }
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -3027,22 +3027,23 @@ IonBuilder::filterTypesAtTest(MTest *tes
     if (!subject)
         return true;
 
     // There is no TypeSet that can get filtered.
     if (!subject->resultTypeSet())
         return true;
 
     // Only do this optimization if the typeset does contains null or undefined.
-    if ((!(removeUndefined && subject->resultTypeSet()->hasType(types::Type::UndefinedType())) &&
-         !(removeNull && subject->resultTypeSet()->hasType(types::Type::NullType()))))
+    if (!((removeUndefined && subject->resultTypeSet()->hasType(types::Type::UndefinedType())) ||
+        (removeNull && subject->resultTypeSet()->hasType(types::Type::NullType()))))
     {
         return true;
     }
 
+    //printf("%d: replacing\n", script()->lineno());
     // Find all values on the stack that correspond to the subject
     // and replace it with a MIR with filtered TypeSet information.
     // Create the replacement MIR lazily upon first occurence.
     MDefinition *replace = nullptr;
     for (uint32_t i = 0; i < current->stackDepth(); i++) {
         if (current->getSlot(i) != subject)
             continue;