Title: [195926] trunk/Source/_javascript_Core
Revision
195926
Author
[email protected]
Date
2016-01-31 03:41:52 -0800 (Sun, 31 Jan 2016)

Log Message

[mips] don't save to a callee saved register too early
https://bugs.webkit.org/show_bug.cgi?id=153463

If we save $gp to $s4 in pichdr, then in some cases, we were
overwriting $s4 before LLInt's pushCalleeSaves() is called (as pichdr
is at the very beginning of a function). Now we save $gp to $s4 at the
end of pushCalleeSaves().

Patch by Guillaume Emont <[email protected]> on 2016-01-31
Reviewed by Michael Saboff.

* offlineasm/mips.rb:
* llint/LowLevelInterpreter.asm:
Move the saving of $gp to $s4 from pichdr to pushCalleeSaves(). Take
the opportunity to only save $s4 as we never use the other callee
saved registers.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (195925 => 195926)


--- trunk/Source/_javascript_Core/ChangeLog	2016-01-31 11:41:44 UTC (rev 195925)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-01-31 11:41:52 UTC (rev 195926)
@@ -1,3 +1,21 @@
+2016-01-31  Guillaume Emont  <[email protected]>
+
+        [mips] don't save to a callee saved register too early
+        https://bugs.webkit.org/show_bug.cgi?id=153463
+
+        If we save $gp to $s4 in pichdr, then in some cases, we were
+        overwriting $s4 before LLInt's pushCalleeSaves() is called (as pichdr
+        is at the very beginning of a function). Now we save $gp to $s4 at the
+        end of pushCalleeSaves().
+
+        Reviewed by Michael Saboff.
+
+        * offlineasm/mips.rb:
+        * llint/LowLevelInterpreter.asm:
+        Move the saving of $gp to $s4 from pichdr to pushCalleeSaves(). Take
+        the opportunity to only save $s4 as we never use the other callee
+        saved registers.
+
 2016-01-30  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r195799 and r195828.

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (195925 => 195926)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2016-01-31 11:41:44 UTC (rev 195925)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2016-01-31 11:41:52 UTC (rev 195926)
@@ -430,8 +430,10 @@
     const CalleeSaveRegisterCount = 0
 elsif ARM or ARMv7_TRADITIONAL or ARMv7
     const CalleeSaveRegisterCount = 7
-elsif SH4 or MIPS
+elsif SH4
     const CalleeSaveRegisterCount = 5
+elsif MIPS
+    const CalleeSaveRegisterCount = 1
 elsif X86 or X86_WIN
     const CalleeSaveRegisterCount = 3
 end
@@ -449,12 +451,10 @@
     elsif ARMv7
         emit "push {r4-r6, r8-r11}"
     elsif MIPS
-        emit "addiu $sp, $sp, -20"
-        emit "sw $20, 16($sp)"
-        emit "sw $19, 12($sp)"
-        emit "sw $18, 8($sp)"
-        emit "sw $17, 4($sp)"
-        emit "sw $16, 0($sp)"
+        emit "addiu $sp, $sp, -4"
+        emit "sw $s4, 0($sp)"
+        # save $gp to $s4 so that we can restore it after a function call
+        emit "move $s4, $gp"
     elsif SH4
         emit "mov.l r13, @-r15"
         emit "mov.l r11, @-r15"
@@ -479,12 +479,8 @@
     elsif ARMv7
         emit "pop {r4-r6, r8-r11}"
     elsif MIPS
-        emit "lw $16, 0($sp)"
-        emit "lw $17, 4($sp)"
-        emit "lw $18, 8($sp)"
-        emit "lw $19, 12($sp)"
-        emit "lw $20, 16($sp)"
-        emit "addiu $sp, $sp, 20"
+        emit "lw $s4, 0($sp)"
+        emit "addiu $sp, $sp, 4"
     elsif SH4
         emit "mov.l @r15+, r8"
         emit "mov.l @r15+, r9"

Modified: trunk/Source/_javascript_Core/offlineasm/mips.rb (195925 => 195926)


--- trunk/Source/_javascript_Core/offlineasm/mips.rb	2016-01-31 11:41:44 UTC (rev 195925)
+++ trunk/Source/_javascript_Core/offlineasm/mips.rb	2016-01-31 11:41:52 UTC (rev 195926)
@@ -1041,7 +1041,6 @@
             $asm.puts "sltu #{operands[0].mipsOperand}, #{operands[1].mipsOperand}, #{operands[2].mipsOperand}"
         when "pichdr"
             $asm.putStr("OFFLINE_ASM_CPLOAD(#{MIPS_CALL_REG.mipsOperand})")
-            $asm.puts "move #{MIPS_GPSAVE_REG.mipsOperand}, #{MIPS_GP_REG.mipsOperand}"
         when "memfence"
             $asm.puts "sync"
         else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to