Bug 858940 - Fix an additional case where we inspect the instruction stream without going through an iterator. r=jbramley, a=lsblakk
authorMarty Rosenberg <mrosenberg@mozilla.com>
Mon, 15 Jul 2013 14:21:46 -0400
changeset 148130 17ca50946dc961cb42c234a895ff39e121e063fa
parent 148129 7926b81402caf0053d64e4b41cffdc5f73be0fb7
child 148131 eef8b9e2fd5291ab316c13c50cc65ad8ee1745de
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjbramley, lsblakk
bugs858940
milestone24.0a2
Bug 858940 - Fix an additional case where we inspect the instruction stream without going through an iterator. r=jbramley, a=lsblakk
js/src/ion/arm/MacroAssembler-arm.cpp
--- a/js/src/ion/arm/MacroAssembler-arm.cpp
+++ b/js/src/ion/arm/MacroAssembler-arm.cpp
@@ -336,16 +336,24 @@ NextInst(Instruction *i)
     return i->next();
 }
 
 void
 MacroAssemblerARM::ma_movPatchable(Imm32 imm_, Register dest,
                                    Assembler::Condition c, RelocStyle rs, Instruction *i)
 {
     int32_t imm = imm_.value;
+    if (i) {
+        // Make sure the current instruction is not an artificial guard
+        // inserted by the assembler buffer.
+        // The InstructionIterator already does this and handles edge cases,
+        // so, just asking an iterator for its current instruction should be
+        // enough to make sure we don't accidentally inspect an artificial guard.
+        i = InstructionIterator(i).cur();
+    }
     switch(rs) {
       case L_MOVWT:
         as_movw(dest, Imm16(imm & 0xffff), c, i);
         // i can be NULL here.  that just means "insert in the next in sequence."
         // NextInst is special cased to not do anything when it is passed NULL, so two
         // consecutive instructions will be inserted.
         i = NextInst(i);
         as_movt(dest, Imm16(imm >> 16 & 0xffff), c, i);