Bug 1230010 - OdinMonkey: MIPS: Make immediate patching shared. r=luke
authorHeiher <r@hev.cc>
Thu, 03 Dec 2015 19:22:36 +0800
changeset 309592 1ac1c7f5cf9a2355e5a277fe9d5b29eb20d8dc30
parent 309591 857b2d9012c0a21b9ab8737b0de96cf1ee78a748
child 309593 a356bb51323fb3dad48622d852770db171d6fa98
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1230010
milestone45.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 1230010 - OdinMonkey: MIPS: Make immediate patching shared. r=luke --- js/src/asmjs/AsmJSModule.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-)
js/src/asmjs/AsmJSModule.cpp
--- a/js/src/asmjs/AsmJSModule.cpp
+++ b/js/src/asmjs/AsmJSModule.cpp
@@ -1794,22 +1794,19 @@ AsmJSModule::setProfilingEnabled(bool en
         Instruction* callerInsn = reinterpret_cast<Instruction*>(caller);
         BOffImm calleeOffset;
         callerInsn->as<InstBLImm>()->extractImm(&calleeOffset);
         void* callee = calleeOffset.getDest(callerInsn);
 #elif defined(JS_CODEGEN_ARM64)
         MOZ_CRASH();
         void* callee = nullptr;
         (void)callerRetAddr;
-#elif defined(JS_CODEGEN_MIPS32)
-        Instruction* instr = (Instruction*)(callerRetAddr - 4 * sizeof(uint32_t));
-        void* callee = (void*)Assembler::ExtractLuiOriValue(instr, instr->next());
-#elif defined(JS_CODEGEN_MIPS64)
-        Instruction* instr = (Instruction*)(callerRetAddr - 6 * sizeof(uint32_t));
-        void* callee = (void*)Assembler::ExtractLoad64Value(instr);
+#elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
+        uint8_t* instr = callerRetAddr - Assembler::PatchWrite_NearCallSize();
+        void* callee = (void*)Assembler::ExtractInstructionImmediate(instr);
 #elif defined(JS_CODEGEN_NONE)
         MOZ_CRASH();
         void* callee = nullptr;
 #else
 # error "Missing architecture"
 #endif
 
         const CodeRange* codeRange = lookupCodeRange(callee);
@@ -1824,23 +1821,18 @@ AsmJSModule::setProfilingEnabled(bool en
 
 #if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
         X86Encoding::SetRel32(callerRetAddr, newCallee);
 #elif defined(JS_CODEGEN_ARM)
         new (caller) InstBLImm(BOffImm(newCallee - caller), Assembler::Always);
 #elif defined(JS_CODEGEN_ARM64)
         (void)newCallee;
         MOZ_CRASH();
-#elif defined(JS_CODEGEN_MIPS32)
-        Assembler::WriteLuiOriInstructions(instr, instr->next(),
-                                           ScratchRegister, (uint32_t)newCallee);
-        instr[2] = InstReg(op_special, ScratchRegister, zero, ra, ff_jalr);
-#elif defined(JS_CODEGEN_MIPS64)
-        Assembler::WriteLoad64Instructions(instr, ScratchRegister, (uint64_t)newCallee);
-        instr[4] = InstReg(op_special, ScratchRegister, zero, ra, ff_jalr);
+#elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
+        Assembler::PatchInstructionImmediate(instr, PatchedImmPtr(newCallee));
 #elif defined(JS_CODEGEN_NONE)
         MOZ_CRASH();
 #else
 # error "Missing architecture"
 #endif
     }
 
     // Update all the addresses in the function-pointer tables to point to the