Bug 1011474 - Don't trash CallTemp1 register in malloc/free stubs. r=mjrosenb, a=lmandel
authorJon Coppeard <jcoppeard@mozilla.com>
Tue, 10 Jun 2014 07:50:00 -0700
changeset 208104 7df8944f610b58dadf0253f37231522e44dcac01
parent 208103 95f471af5582e7a2fc9c5ebadfdbc2a6584f09d1
child 208105 769f119194b72d7d71e727d3e558787645f66ef2
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmjrosenb, lmandel
bugs1011474
milestone32.0a2
Bug 1011474 - Don't trash CallTemp1 register in malloc/free stubs. r=mjrosenb, a=lmandel
js/src/jit/CodeGenerator.cpp
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -5424,25 +5424,28 @@ JitCompartment::generateStringConcatStub
     return code;
 }
 
 JitCode *
 JitRuntime::generateMallocStub(JSContext *cx)
 {
     const Register regReturn = CallTempReg0;
     const Register regNBytes = CallTempReg0;
-    const Register regRuntime = CallTempReg1;
-    const Register regTemp = CallTempReg1;
 
     MacroAssembler masm(cx);
 
     RegisterSet regs = RegisterSet::Volatile();
     regs.takeUnchecked(regNBytes);
     masm.PushRegsInMask(regs);
 
+    const Register regTemp = regs.takeGeneral();
+    const Register regRuntime = regTemp;
+    regs.add(regTemp);
+    JS_ASSERT(regTemp != regNBytes);
+
     masm.setupUnalignedABICall(2, regTemp);
     masm.movePtr(ImmPtr(cx->runtime()), regRuntime);
     masm.passABIArg(regRuntime);
     masm.passABIArg(regNBytes);
     masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, MallocWrapper));
     masm.storeCallResult(regReturn);
 
     masm.PopRegsInMask(regs);
@@ -5458,24 +5461,27 @@ JitRuntime::generateMallocStub(JSContext
 
     return code;
 }
 
 JitCode *
 JitRuntime::generateFreeStub(JSContext *cx)
 {
     const Register regSlots = CallTempReg0;
-    const Register regTemp = CallTempReg1;
 
     MacroAssembler masm(cx);
 
     RegisterSet regs = RegisterSet::Volatile();
     regs.takeUnchecked(regSlots);
     masm.PushRegsInMask(regs);
 
+    const Register regTemp = regs.takeGeneral();
+    regs.add(regTemp);
+    JS_ASSERT(regTemp != regSlots);
+
     masm.setupUnalignedABICall(1, regTemp);
     masm.passABIArg(regSlots);
     masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, js_free));
 
     masm.PopRegsInMask(regs);
 
     masm.ret();