Title: [135555] trunk/Source/_javascript_Core
Revision
135555
Author
[email protected]
Date
2012-11-22 20:54:43 -0800 (Thu, 22 Nov 2012)

Log Message

Fix the MIPS build after r135330
https://bugs.webkit.org/show_bug.cgi?id=102872

Patch by Balazs Kilvady <[email protected]> on 2012-11-22
Reviewed by Gavin Barraclough.

Revert/replace functions added to MIPS port.

* assembler/MIPSAssembler.h:
(JSC::MIPSAssembler::revertJumpToMove):
(MIPSAssembler):
(JSC::MIPSAssembler::replaceWithJump):
* assembler/MacroAssemblerMIPS.h:
(MacroAssemblerMIPS):
(JSC::MacroAssemblerMIPS::startOfBranchPtrWithPatchOnRegister):
(JSC::MacroAssemblerMIPS::revertJumpReplacementToBranchPtrWithPatch):
(JSC::MacroAssemblerMIPS::startOfPatchableBranchPtrWithPatchOnAddress):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (135554 => 135555)


--- trunk/Source/_javascript_Core/ChangeLog	2012-11-23 03:31:38 UTC (rev 135554)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-11-23 04:54:43 UTC (rev 135555)
@@ -1,3 +1,22 @@
+2012-11-22  Balazs Kilvady  <[email protected]>
+
+        Fix the MIPS build after r135330
+        https://bugs.webkit.org/show_bug.cgi?id=102872
+
+        Reviewed by Gavin Barraclough.
+
+        Revert/replace functions added to MIPS port.
+
+        * assembler/MIPSAssembler.h:
+        (JSC::MIPSAssembler::revertJumpToMove):
+        (MIPSAssembler):
+        (JSC::MIPSAssembler::replaceWithJump):
+        * assembler/MacroAssemblerMIPS.h:
+        (MacroAssemblerMIPS):
+        (JSC::MacroAssemblerMIPS::startOfBranchPtrWithPatchOnRegister):
+        (JSC::MacroAssemblerMIPS::revertJumpReplacementToBranchPtrWithPatch):
+        (JSC::MacroAssemblerMIPS::startOfPatchableBranchPtrWithPatchOnAddress):
+
 2012-11-21  Filip Pizlo  <[email protected]>
 
         Rename dataLog() and dataLogV() to dataLogF() and dataLogFV()

Modified: trunk/Source/_javascript_Core/assembler/MIPSAssembler.h (135554 => 135555)


--- trunk/Source/_javascript_Core/assembler/MIPSAssembler.h	2012-11-23 03:31:38 UTC (rev 135554)
+++ trunk/Source/_javascript_Core/assembler/MIPSAssembler.h	2012-11-23 04:54:43 UTC (rev 135555)
@@ -825,6 +825,31 @@
 #endif
     }
 
+    static void revertJumpToMove(void* instructionStart, RegisterID rt, int imm)
+    {
+        MIPSWord* insn = static_cast<MIPSWord*>(instructionStart) + 1;
+        ASSERT((*insn & 0xfc000000) == 0x34000000);
+        *insn = (*insn & 0xfc1f0000) | (imm & 0xffff);
+        cacheFlush(insn, sizeof(MIPSWord));
+    }
+
+    static void replaceWithJump(void* instructionStart, void* to)
+    {
+        MIPSWord* instruction = reinterpret_cast<MIPSWord*>(instructionStart);
+        intptr_t jumpTo = reinterpret_cast<intptr_t>(to);
+
+        // lui
+        instruction[0] = 0x3c000000 | (MIPSRegisters::t9 << OP_SH_RT) | ((jumpTo >> 16) & 0xffff);
+        // ori
+        instruction[1] = 0x34000000 | (MIPSRegisters::t9 << OP_SH_RT) | (MIPSRegisters::t9 << OP_SH_RS) | (jumpTo & 0xffff);
+        // jr
+        instruction[2] = 0x00000008 | (MIPSRegisters::t9 << OP_SH_RS);
+        // nop
+        instruction[3] = 0x0;
+
+        cacheFlush(instruction, sizeof(MIPSWord) * 4);
+    }
+
     static void replaceWithLoad(void* instructionStart)
     {
         MIPSWord* insn = reinterpret_cast<MIPSWord*>(instructionStart);

Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerMIPS.h (135554 => 135555)


--- trunk/Source/_javascript_Core/assembler/MacroAssemblerMIPS.h	2012-11-23 03:31:38 UTC (rev 135554)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerMIPS.h	2012-11-23 04:54:43 UTC (rev 135555)
@@ -2244,8 +2244,18 @@
 
     static bool canJumpReplacePatchableBranchPtrWithPatch() { return false; }
 
-    static CodeLocationLabel startOfPatchableBranchPtrWithPatch(CodeLocationDataLabelPtr label)
+    static CodeLocationLabel startOfBranchPtrWithPatchOnRegister(CodeLocationDataLabelPtr label)
     {
+        return label.labelAtOffset(0);
+    }
+
+    static void revertJumpReplacementToBranchPtrWithPatch(CodeLocationLabel instructionStart, RegisterID, void* initialValue)
+    {
+        MIPSAssembler::revertJumpToMove(instructionStart.dataLocation(), immTempRegister, reinterpret_cast<int>(initialValue) & 0xffff);
+    }
+
+    static CodeLocationLabel startOfPatchableBranchPtrWithPatchOnAddress(CodeLocationDataLabelPtr)
+    {
         UNREACHABLE_FOR_PLATFORM();
         return CodeLocationLabel();
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to