Bug 73432

Summary: MacroAssemblerMIPS does not implement readCallTarget
Product: WebKit Reporter: Csaba Osztrogon√°c <ossy>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Blocker CC: barraclough, fpizlo, fu, loki, ossy, webkit.review.bot, zecke, zherczeg
Priority: P1    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Add MIPS readCallTarget() none

Description Csaba Osztrogon√°c 2011-11-30 04:56:16 PST
It is blocker bug, beacuse after http://trac.webkit.org/changeset/101457
Qt-MIPS build is broken. (and all other MIPS build of course)
Comment 1 Chao-ying Fu 2011-11-30 11:39:48 PST
Can you try this patch quickly?  I haven't had time to test.  Thanks a lot!

Regards,
Chao-ying

Index: MIPSAssembler.h
===================================================================
--- MIPSAssembler.h     (revision 101454)
+++ MIPSAssembler.h     (working copy)
@@ -772,6 +772,18 @@
         return reinterpret_cast<void*>(readInt32(from));
     }

+    static void* readCallTarget(void* from)
+    {
+        MIPSWord* insn = reinterpret_cast<MIPSWord*>(from);
+        insn -= 4;
+        ASSERT((*insn & 0xffe00000) == 0x3c000000); // lui
+        int32_t result = (*insn & 0x0000ffff) << 16;
+        insn++;
+        ASSERT((*insn & 0xfc000000) == 0x34000000); // ori
+        result |= *insn & 0x0000ffff;
+        return reinterpret_cast<void*>(result);
+    }
+
 private:
     /* Update each jump in the buffer of newBase.  */
     void relocateJumps(void* oldBase, void* newBase)
Index: MacroAssemblerMIPS.h
===================================================================
--- MacroAssemblerMIPS.h        (revision 101454)
+++ MacroAssemblerMIPS.h        (working copy)
@@ -1815,6 +1815,11 @@
         m_assembler.nop();
     }

+    static FunctionPtr readCallTarget(CodeLocationCall call)
+    {
+        return FunctionPtr(reinterpret_cast<void(*)()>(MIPSAssembler::readCallTarget(call.dataLocation())));
+    }
+
 private:
     // If m_fixedWidth is true, we will generate a fixed number of instructions.
     // Otherwise, we can emit any number of instructions.
Comment 2 Chao-ying Fu 2011-11-30 14:55:58 PST
Created attachment 117281 [details]
Add MIPS readCallTarget()

I tested release and debug versions of JSC by running run-javascriptcore-tests.  The results are ok.  Thanks a lot!

Regards,
Chao-ying
Comment 3 Zoltan Herczeg 2011-12-01 03:31:31 PST
Comment on attachment 117281 [details]
Add MIPS readCallTarget()

r=me
Comment 4 WebKit Review Bot 2011-12-01 04:42:23 PST
Comment on attachment 117281 [details]
Add MIPS readCallTarget()

Clearing flags on attachment: 117281

Committed r101658: <http://trac.webkit.org/changeset/101658>
Comment 5 WebKit Review Bot 2011-12-01 04:42:28 PST
All reviewed patches have been landed.  Closing bug.