Bug 1326067 part 6 - Fix EmitStubGuardFailure to not clobber registers on ARM/MIPS. r=evilpie
authorJan de Mooij <jdemooij@mozilla.com>
Sat, 21 Jan 2017 17:40:45 +0100
changeset 330551 c1f03c71ed58936e84f1793b5e1944d2cc55f95d
parent 330550 969012588cf0ba98e99b95d6079851c982a4d78b
child 330552 f4b8933f62eafb86402ad92bfe8361cf91b31ced
push id31240
push userphilringnalda@gmail.com
push dateSat, 21 Jan 2017 23:25:11 +0000
treeherdermozilla-central@d5343b0f7e6a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpie
bugs1326067
milestone53.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 1326067 part 6 - Fix EmitStubGuardFailure to not clobber registers on ARM/MIPS. r=evilpie
js/src/jit-test/tests/baseline/unboxed-expando-type-update.js
js/src/jit/arm/MacroAssembler-arm.h
js/src/jit/arm/SharedICHelpers-arm.h
js/src/jit/arm64/SharedICHelpers-arm64.h
js/src/jit/mips-shared/SharedICHelpers-mips-shared.h
js/src/jit/x64/SharedICHelpers-x64.h
js/src/jit/x86/SharedICHelpers-x86.h
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/baseline/unboxed-expando-type-update.js
@@ -0,0 +1,14 @@
+function f() {
+    var a = [];
+    for (var i=0; i<100; i++)
+        a.push({x: i});
+
+    var vals = [1, "", true, null];
+
+    for (var j=0; j<100; j++) {
+        var v = vals[j % vals.length];
+        a[95].y = v;
+        assertEq(a[95].y, v);
+    }
+}
+f();
--- a/js/src/jit/arm/MacroAssembler-arm.h
+++ b/js/src/jit/arm/MacroAssembler-arm.h
@@ -552,22 +552,16 @@ class MacroAssemblerARMCompat : public M
         ma_mov(src, dest);
     }
     void mov(ImmWord imm, Register dest) {
         ma_mov(Imm32(imm.value), dest);
     }
     void mov(ImmPtr imm, Register dest) {
         mov(ImmWord(uintptr_t(imm.value)), dest);
     }
-    void mov(Register src, Address dest) {
-        MOZ_CRASH("NYI-IC");
-    }
-    void mov(Address src, Register dest) {
-        MOZ_CRASH("NYI-IC");
-    }
 
     void branch(JitCode* c) {
         BufferOffset bo = m_buffer.nextOffset();
         addPendingJump(bo, ImmPtr(c->raw()), Relocation::JITCODE);
         ScratchRegisterScope scratch(asMasm());
         ma_movPatchable(ImmPtr(c->raw()), scratch, Always);
         ma_bx(scratch);
     }
--- a/js/src/jit/arm/SharedICHelpers-arm.h
+++ b/js/src/jit/arm/SharedICHelpers-arm.h
@@ -354,31 +354,21 @@ EmitPreBarrier(MacroAssembler& masm, con
     masm.push(lr);
     masm.patchableCallPreBarrier(addr, type);
     masm.pop(lr);
 }
 
 inline void
 EmitStubGuardFailure(MacroAssembler& masm)
 {
-    MOZ_ASSERT(R2 == ValueOperand(r1, r0));
-
-    // NOTE: This routine assumes that the stub guard code left the stack in the
-    // same state it was in when it was entered.
-
-    // BaselineStubEntry points to the current stub.
-
     // Load next stub into ICStubReg.
     masm.loadPtr(Address(ICStubReg, ICStub::offsetOfNext()), ICStubReg);
 
-    // Load stubcode pointer from BaselineStubEntry into scratch register.
-    masm.loadPtr(Address(ICStubReg, ICStub::offsetOfStubCode()), r0);
-
     // Return address is already loaded, just jump to the next stubcode.
     MOZ_ASSERT(ICTailCallReg == lr);
-    masm.branch(r0);
+    masm.jump(Address(ICStubReg, ICStub::offsetOfStubCode()));
 }
 
 
 } // namespace jit
 } // namespace js
 
 #endif /* jit_arm_SharedICHelpers_arm_h */
--- a/js/src/jit/arm64/SharedICHelpers-arm64.h
+++ b/js/src/jit/arm64/SharedICHelpers-arm64.h
@@ -311,27 +311,19 @@ EmitPreBarrier(MacroAssembler& masm, con
     masm.push(lr);
     masm.patchableCallPreBarrier(addr, type);
     masm.pop(lr);
 }
 
 inline void
 EmitStubGuardFailure(MacroAssembler& masm)
 {
-    // NOTE: This routine assumes that the stub guard code left the stack in the
-    // same state it was in when it was entered.
-
-    // BaselineStubEntry points to the current stub.
-
     // Load next stub into ICStubReg.
     masm.loadPtr(Address(ICStubReg, ICStub::offsetOfNext()), ICStubReg);
 
-    // Load stubcode pointer from BaselineStubEntry into scratch register.
-    masm.loadPtr(Address(ICStubReg, ICStub::offsetOfStubCode()), r0);
-
     // Return address is already loaded, just jump to the next stubcode.
-    masm.Br(x0);
+    masm.jump(Address(ICStubReg, ICStub::offsetOfStubCode()));
 }
 
 } // namespace jit
 } // namespace js
 
 #endif // jit_arm64_SharedICHelpers_arm64_h
--- a/js/src/jit/mips-shared/SharedICHelpers-mips-shared.h
+++ b/js/src/jit/mips-shared/SharedICHelpers-mips-shared.h
@@ -355,28 +355,20 @@ EmitPreBarrier(MacroAssembler& masm, con
     masm.push(ra);
     masm.patchableCallPreBarrier(addr, type);
     masm.pop(ra);
 }
 
 inline void
 EmitStubGuardFailure(MacroAssembler& masm)
 {
-    // NOTE: This routine assumes that the stub guard code left the stack in
-    // the same state it was in when it was entered.
-
-    // BaselineStubEntry points to the current stub.
-
     // Load next stub into ICStubReg
     masm.loadPtr(Address(ICStubReg, ICStub::offsetOfNext()), ICStubReg);
 
-    // Load stubcode pointer from BaselineStubEntry into scratch register.
-    masm.loadPtr(Address(ICStubReg, ICStub::offsetOfStubCode()), R2.scratchReg());
-
     // Return address is already loaded, just jump to the next stubcode.
     MOZ_ASSERT(ICTailCallReg == ra);
-    masm.branch(R2.scratchReg());
+    masm.jump(Address(ICStubReg, ICStub::offsetOfStubCode()));
 }
 
 } // namespace jit
 } // namespace js
 
 #endif /* jit_mips_shared_SharedICHelpers_mips_shared_h */
--- a/js/src/jit/x64/SharedICHelpers-x64.h
+++ b/js/src/jit/x64/SharedICHelpers-x64.h
@@ -329,21 +329,16 @@ inline void
 EmitPreBarrier(MacroAssembler& masm, const AddrType& addr, MIRType type)
 {
     masm.patchableCallPreBarrier(addr, type);
 }
 
 inline void
 EmitStubGuardFailure(MacroAssembler& masm)
 {
-    // NOTE: This routine assumes that the stub guard code left the stack in the
-    // same state it was in when it was entered.
-
-    // BaselineStubEntry points to the current stub.
-
     // Load next stub into ICStubReg
     masm.loadPtr(Address(ICStubReg, ICStub::offsetOfNext()), ICStubReg);
 
     // Return address is already loaded, just jump to the next stubcode.
     masm.jmp(Operand(ICStubReg, ICStub::offsetOfStubCode()));
 }
 
 } // namespace jit
--- a/js/src/jit/x86/SharedICHelpers-x86.h
+++ b/js/src/jit/x86/SharedICHelpers-x86.h
@@ -329,25 +329,19 @@ inline void
 EmitPreBarrier(MacroAssembler& masm, const AddrType& addr, MIRType type)
 {
     masm.patchableCallPreBarrier(addr, type);
 }
 
 inline void
 EmitStubGuardFailure(MacroAssembler& masm)
 {
-    // NOTE: This routine assumes that the stub guard code left the stack in the
-    // same state it was in when it was entered.
-
-    // BaselineStubEntry points to the current stub.
-
     // Load next stub into ICStubReg
-    masm.loadPtr(Address(ICStubReg, (int32_t) ICStub::offsetOfNext()), ICStubReg);
+    masm.loadPtr(Address(ICStubReg, ICStub::offsetOfNext()), ICStubReg);
 
     // Return address is already loaded, just jump to the next stubcode.
-    masm.jmp(Operand(ICStubReg, (int32_t) ICStub::offsetOfStubCode()));
+    masm.jmp(Operand(ICStubReg, ICStub::offsetOfStubCode()));
 }
 
-
 } // namespace jit
 } // namespace js
 
 #endif /* jit_x86_SharedICHelpers_x86_h */