Bug 1004363 - Follow-up patch to fix a few more places that should ignore trivial blocks on ARM. r=me
authorDan Gohman <sunfish@mozilla.com>
Tue, 20 May 2014 22:58:45 -0700
changeset 184066 5a562c4ceb494f20d15e7c698b9ca7430ccd7966
parent 184065 f135d712226282c51ec27973dfc344a16421ecbe
child 184067 afe8ef1b62d138cf3c13833be8c0d7d4cd132d7e
push id26810
push usercbook@mozilla.com
push dateWed, 21 May 2014 11:46:36 +0000
treeherdermozilla-central@50fb8c4db2fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1004363
milestone32.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 1004363 - Follow-up patch to fix a few more places that should ignore trivial blocks on ARM. r=me
js/src/jit/arm/CodeGenerator-arm.cpp
js/src/jit/mips/CodeGenerator-mips.cpp
--- a/js/src/jit/arm/CodeGenerator-arm.cpp
+++ b/js/src/jit/arm/CodeGenerator-arm.cpp
@@ -1087,17 +1087,17 @@ class js::jit::OutOfLineTableSwitch : pu
 
 bool
 CodeGeneratorARM::visitOutOfLineTableSwitch(OutOfLineTableSwitch *ool)
 {
     MTableSwitch *mir = ool->mir();
 
     size_t numCases = mir->numCases();
     for (size_t i = 0; i < numCases; i++) {
-        LBlock *caseblock = mir->getCase(numCases - 1 - i)->lir();
+        LBlock *caseblock = skipTrivialBlocks(mir->getCase(numCases - 1 - i))->lir();
         Label *caseheader = caseblock->label();
         uint32_t caseoffset = caseheader->offset();
 
         // The entries of the jump table need to be absolute addresses and thus
         // must be patched after codegen is finished.
         CodeLabel cl = ool->codeLabel(i);
         cl.src()->bind(caseoffset);
         if (!masm.addCodeLabel(cl))
@@ -1131,17 +1131,17 @@ CodeGeneratorARM::emitTableSwitchDispatc
     // the address size) into the pc, which branches to the correct case.
     // NOTE: when we go to read the pc, the value that we get back is the pc of
     // the current instruction *PLUS 8*.  This means that ldr foo, [pc, +0]
     // reads $pc+8.  In other words, there is an empty word after the branch into
     // the switch table before the table actually starts.  Since the only other
     // unhandled case is the default case (both out of range high and out of range low)
     // I then insert a branch to default case into the extra slot, which ensures
     // we don't attempt to execute the address table.
-    Label *defaultcase = mir->getDefault()->lir()->label();
+    Label *defaultcase = skipTrivialBlocks(mir->getDefault())->lir()->label();
 
     int32_t cases = mir->numCases();
     // Lower value with low value
     masm.ma_sub(index, Imm32(mir->low()), index, SetCond);
     masm.ma_rsb(index, Imm32(cases - 1), index, SetCond, Assembler::NotSigned);
     AutoForbidPools afp(&masm);
     masm.ma_ldr(DTRAddr(pc, DtrRegImmShift(index, LSL, 2)), pc, Offset, Assembler::NotSigned);
     masm.ma_b(defaultcase);
--- a/js/src/jit/mips/CodeGenerator-mips.cpp
+++ b/js/src/jit/mips/CodeGenerator-mips.cpp
@@ -1013,17 +1013,17 @@ CodeGeneratorMIPS::visitOutOfLineTableSw
     MTableSwitch *mir = ool->mir();
 
     masm.align(sizeof(void*));
     masm.bind(ool->jumpLabel()->src());
     if (!masm.addCodeLabel(*ool->jumpLabel()))
         return false;
 
     for (size_t i = 0; i < mir->numCases(); i++) {
-        LBlock *caseblock = mir->getCase(i)->lir();
+        LBlock *caseblock = skipTrivialBlocks(mir->getCase(i))->lir();
         Label *caseheader = caseblock->label();
         uint32_t caseoffset = caseheader->offset();
 
         // The entries of the jump table need to be absolute addresses and thus
         // must be patched after codegen is finished.
         CodeLabel cl;
         masm.ma_li(ScratchRegister, cl.dest());
         masm.branch(ScratchRegister);
@@ -1034,17 +1034,17 @@ CodeGeneratorMIPS::visitOutOfLineTableSw
 
     return true;
 }
 
 bool
 CodeGeneratorMIPS::emitTableSwitchDispatch(MTableSwitch *mir, Register index,
                                            Register address)
 {
-    Label *defaultcase = mir->getDefault()->lir()->label();
+    Label *defaultcase = skipTrivialBlocks(mir->getDefault())->lir()->label();
 
     // Lower value with low value
     if (mir->low() != 0)
         masm.subPtr(Imm32(mir->low()), index);
 
     // Jump to default case if input is out of range
     int32_t cases = mir->numCases();
     masm.branchPtr(Assembler::AboveOrEqual, index, ImmWord(cases), defaultcase);