Title: [195236] trunk/Source/_javascript_Core
Revision
195236
Author
[email protected]
Date
2016-01-18 13:07:08 -0800 (Mon, 18 Jan 2016)

Log Message

[MIPS] LLInt: fix calculation of Global Offset Table
https://bugs.webkit.org/show_bug.cgi?id=150381

Offlineasm adds a .cpload $t9 when we create a label in MIPS, which
computes address of GOT. However, this instruction requires $t9 to
contain address of current function. So we need to set $t9 to pcBase,
otherwise GOT-related calculations will be invalid.

Since offlineasm does not allow direct move to $t9 on MIPS, added new
instruction setcallreg which does exactly that.

Patch by Konstantin Tokarev <[email protected]> on 2016-01-18
Reviewed by Michael Saboff.

* llint/LowLevelInterpreter.asm:
* offlineasm/instructions.rb:
* offlineasm/mips.rb:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (195235 => 195236)


--- trunk/Source/_javascript_Core/ChangeLog	2016-01-18 20:26:42 UTC (rev 195235)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-01-18 21:07:08 UTC (rev 195236)
@@ -1,3 +1,22 @@
+2016-01-18  Konstantin Tokarev  <[email protected]>
+
+        [MIPS] LLInt: fix calculation of Global Offset Table
+        https://bugs.webkit.org/show_bug.cgi?id=150381
+
+        Offlineasm adds a .cpload $t9 when we create a label in MIPS, which
+        computes address of GOT. However, this instruction requires $t9 to
+        contain address of current function. So we need to set $t9 to pcBase,
+        otherwise GOT-related calculations will be invalid.
+
+        Since offlineasm does not allow direct move to $t9 on MIPS, added new
+        instruction setcallreg which does exactly that.
+
+        Reviewed by Michael Saboff.
+
+        * llint/LowLevelInterpreter.asm:
+        * offlineasm/instructions.rb:
+        * offlineasm/mips.rb:
+
 2016-01-18  Csaba Osztrogonác  <[email protected]>
 
         REGRESSION(r194601): Fix the jsc timeout option of jsc.cpp

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (195235 => 195236)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2016-01-18 20:26:42 UTC (rev 195235)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2016-01-18 21:07:08 UTC (rev 195236)
@@ -1087,6 +1087,7 @@
             subp 8, pcBase
         elsif MIPS
             la _relativePCBase, pcBase
+            setcallreg pcBase # needed to set $t9 to the right value for the .cpload created by the label.
         _relativePCBase:
         elsif SH4
             mova _relativePCBase, t0

Modified: trunk/Source/_javascript_Core/offlineasm/instructions.rb (195235 => 195236)


--- trunk/Source/_javascript_Core/offlineasm/instructions.rb	2016-01-18 20:26:42 UTC (rev 195235)
+++ trunk/Source/_javascript_Core/offlineasm/instructions.rb	2016-01-18 21:07:08 UTC (rev 195236)
@@ -284,6 +284,7 @@
     "la",
     "movz",
     "movn",
+    "setcallreg",
     "slt",
     "sltu",
     "pichdr"

Modified: trunk/Source/_javascript_Core/offlineasm/mips.rb (195235 => 195236)


--- trunk/Source/_javascript_Core/offlineasm/mips.rb	2016-01-18 20:26:42 UTC (rev 195235)
+++ trunk/Source/_javascript_Core/offlineasm/mips.rb	2016-01-18 21:07:08 UTC (rev 195236)
@@ -1033,6 +1033,8 @@
             $asm.puts "movz #{operands[0].mipsOperand}, #{operands[1].mipsOperand}, #{operands[2].mipsOperand}"
         when "movn"
             $asm.puts "movn #{operands[0].mipsOperand}, #{operands[1].mipsOperand}, #{operands[2].mipsOperand}"
+        when "setcallreg"
+            $asm.puts "move #{MIPS_CALL_REG.mipsOperand}, #{operands[0].mipsOperand}"
         when "slt", "sltb"
             $asm.puts "slt #{operands[0].mipsOperand}, #{operands[1].mipsOperand}, #{operands[2].mipsOperand}"
         when "sltu", "sltub"
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to