cloop.rb shouldn't use a method called 'dump' for code generation
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2013 00:59:21 +0000 (00:59 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2013 00:59:21 +0000 (00:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108251

Reviewed by Mark Hahnenberg.

Revert http://trac.webkit.org/changeset/141178 and rename 'dump' to 'clDump'.

Also made trivial build fixes for !ENABLE(JIT).

* offlineasm/cloop.rb:
* runtime/Executable.h:
(ExecutableBase):
(JSC::ExecutableBase::intrinsicFor):
* runtime/JSGlobalData.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141185 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/offlineasm/cloop.rb
Source/JavaScriptCore/runtime/Executable.h
Source/JavaScriptCore/runtime/JSGlobalData.h

index 35a916b..c1e06d8 100644 (file)
@@ -1,3 +1,20 @@
+2013-01-29  Filip Pizlo  <fpizlo@apple.com>
+
+        cloop.rb shouldn't use a method called 'dump' for code generation
+        https://bugs.webkit.org/show_bug.cgi?id=108251
+
+        Reviewed by Mark Hahnenberg.
+        
+        Revert http://trac.webkit.org/changeset/141178 and rename 'dump' to 'clDump'.
+        
+        Also made trivial build fixes for !ENABLE(JIT).
+
+        * offlineasm/cloop.rb:
+        * runtime/Executable.h:
+        (ExecutableBase):
+        (JSC::ExecutableBase::intrinsicFor):
+        * runtime/JSGlobalData.h:
+
 2013-01-29  Geoffrey Garen  <ggaren@apple.com>
 
         Removed GGC because it has been disabled for a long time
index bb0e29d..8d7b8fe 100644 (file)
@@ -55,7 +55,7 @@ end
 
 
 class SpecialRegister < NoChildren
-    def dump
+    def clDump
         @name
     end
     def clValue(type=:int)
@@ -66,18 +66,67 @@ end
 C_LOOP_SCRATCH_FPR = SpecialRegister.new("d8")
 
 class RegisterID
+    def clDump
+        case name
+        when "t0"
+            "t0"
+        when "t1"
+            "t1"
+        when "t2"
+            "t2"
+        when "t3"
+            "t3"
+        when "t4"
+            "rPC"
+        when "t6"
+            "rBasePC"
+        when "csr1"
+            "tagTypeNumber"
+        when "csr2"
+            "tagMask"
+        when "cfr"
+            "cfr"
+        when "lr"
+            "rRetVPC"
+        when "sp"
+            "sp"
+        else
+            raise "Bad register #{name} for C_LOOP at #{codeOriginString}"
+        end
+    end
     def clValue(type=:int)
-        dump + cloopMapType(type)
+        clDump + cloopMapType(type)
     end
 end
 
 class FPRegisterID
+    def clDump
+        case name
+        when "ft0", "fr"
+            "d0"
+        when "ft1"
+            "d1"
+        when "ft2"
+            "d2"
+        when "ft3"
+            "d3"
+        when "ft4"
+            "d4"
+        when "ft5"
+            "d5"
+        else
+            raise "Bad register #{name} for C_LOOP at #{codeOriginString}"
+        end
+    end
     def clValue(type=:int)
-        dump + cloopMapType(type)
+        clDump + cloopMapType(type)
     end
 end
 
 class Immediate
+    def clDump
+        "#{value}"
+    end
     def clValue(type=:int)
         # There is a case of a very large unsigned number (0x8000000000000000)
         # which we wish to encode.  Unfortunately, the C/C++ compiler
@@ -107,6 +156,9 @@ class Immediate
 end
 
 class Address
+    def clDump
+        "[#{base.clDump}, #{offset.value}]"
+    end
     def clValue(type=:int)
         case type
         when :int8;         int8MemRef
@@ -177,6 +229,9 @@ class Address
 end
 
 class BaseIndex
+    def clDump
+        "[#{base.clDump}, #{offset.clDump}, #{index.clDump} << #{scaleShift}]"
+    end
     def clValue(type=:int)
         case type
         when :int8;       int8MemRef
@@ -239,8 +294,11 @@ class BaseIndex
 end
 
 class AbsoluteAddress
+    def clDump
+        "#{codeOriginString}"
+    end
     def clValue
-        dump
+        clDump
     end
 end
 
@@ -290,7 +348,7 @@ class Sequence
 end
 
 def clOperands(operands)
-    operands.map{|v| v.dump}.join(", ")
+    operands.map{|v| v.clDump}.join(", ")
 end
 
 
@@ -300,14 +358,14 @@ def cloopEmitOperation(operands, type, operator)
     if operands.size == 3
         $asm.putc "#{operands[2].clValue(type)} = #{operands[1].clValue(type)} #{operator} #{operands[0].clValue(type)};"
         if operands[2].is_a? RegisterID and (type == :int32 or type == :uint32)
-            $asm.putc "#{operands[2].dump}.clearHighWord();" # Just clear it. It does nothing on the 32-bit port.
+            $asm.putc "#{operands[2].clDump}.clearHighWord();" # Just clear it. It does nothing on the 32-bit port.
         end
     else
         raise unless operands.size == 2
         raise unless not operands[1].is_a? Immediate
         $asm.putc "#{operands[1].clValue(type)} = #{operands[1].clValue(type)} #{operator} #{operands[0].clValue(type)};"
         if operands[1].is_a? RegisterID and (type == :int32 or type == :uint32)
-            $asm.putc "#{operands[1].dump}.clearHighWord();" # Just clear it. It does nothing on the 32-bit port.
+            $asm.putc "#{operands[1].clDump}.clearHighWord();" # Just clear it. It does nothing on the 32-bit port.
         end
     end
 end
@@ -317,14 +375,14 @@ def cloopEmitShiftOperation(operands, type, operator)
     if operands.size == 3
         $asm.putc "#{operands[2].clValue(type)} = #{operands[1].clValue(type)} #{operator} (#{operands[0].clValue(:int)} & 0x1f);"
         if operands[2].is_a? RegisterID and (type == :int32 or type == :uint32)
-            $asm.putc "#{operands[2].dump}.clearHighWord();" # Just clear it. It does nothing on the 32-bit port.
+            $asm.putc "#{operands[2].clDump}.clearHighWord();" # Just clear it. It does nothing on the 32-bit port.
         end
     else
         raise unless operands.size == 2
         raise unless not operands[1].is_a? Immediate
         $asm.putc "#{operands[1].clValue(type)} = #{operands[1].clValue(type)} #{operator} (#{operands[0].clValue(:int)} & 0x1f);"
         if operands[1].is_a? RegisterID and (type == :int32 or type == :uint32)
-            $asm.putc "#{operands[1].dump}.clearHighWord();" # Just clear it. It does nothing on the 32-bit port.
+            $asm.putc "#{operands[1].clDump}.clearHighWord();" # Just clear it. It does nothing on the 32-bit port.
         end
     end
 end
@@ -335,7 +393,7 @@ def cloopEmitUnaryOperation(operands, type, operator)
     raise unless not operands[0].is_a? Immediate
     $asm.putc "#{operands[0].clValue(type)} = #{operator}#{operands[0].clValue(type)};"
     if operands[0].is_a? RegisterID and (type == :int32 or type == :uint32)
-        $asm.putc "#{operands[0].dump}.clearHighWord();" # Just clear it. It does nothing on the 32-bit port.
+        $asm.putc "#{operands[0].clDump}.clearHighWord();" # Just clear it. It does nothing on the 32-bit port.
     end
 end
 
@@ -645,7 +703,7 @@ class Instruction
 
         when "td2i"
             $asm.putc "#{operands[1].clValue(:int)} = #{operands[0].clValue(:double)};"
-            $asm.putc "#{operands[1].dump}.clearHighWord();"
+            $asm.putc "#{operands[1].clDump}.clearHighWord();"
 
         when "bcd2i"  # operands: srcDbl dstInt slowPath
             $asm.putc "{"
@@ -654,7 +712,7 @@ class Instruction
             $asm.putc "    if (asInt32 != d || (!asInt32 && signbit(d))) // true for -0.0"
             $asm.putc "        goto  #{operands[2].cLabel};"
             $asm.putc "    #{operands[1].clValue} = asInt32;"            
-            $asm.putc "    #{operands[1].dump}.clearHighWord();"
+            $asm.putc "    #{operands[1].clDump}.clearHighWord();"
             $asm.putc "}"
 
         when "move"
index 1b42b7f..96dee30 100644 (file)
@@ -176,16 +176,6 @@ namespace JSC {
             return hasJITCodeForConstruct();
         }
 
-        // Intrinsics are only for calls, currently.
-        Intrinsic intrinsic() const;
-        
-        Intrinsic intrinsicFor(CodeSpecializationKind kind) const
-        {
-            if (isCall(kind))
-                return intrinsic();
-            return NoIntrinsic;
-        }
-        
         static ptrdiff_t offsetOfJITCodeFor(CodeSpecializationKind kind)
         {
             if (kind == CodeForCall)
@@ -211,6 +201,16 @@ namespace JSC {
         }
 #endif // ENABLE(JIT)
 
+        // Intrinsics are only for calls, currently.
+        Intrinsic intrinsic() const;
+        
+        Intrinsic intrinsicFor(CodeSpecializationKind kind) const
+        {
+            if (isCall(kind))
+                return intrinsic();
+            return NoIntrinsic;
+        }
+        
 #if ENABLE(JIT) || ENABLE(LLINT_C_LOOP)
         MacroAssemblerCodePtr hostCodeEntryFor(CodeSpecializationKind kind)
         {
index b961a87..88364e5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009, 2013 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -39,6 +39,7 @@
 #include "JSCJSValue.h"
 #include "JSLock.h"
 #include "LLIntData.h"
+#include "MacroAssemblerCodeRef.h"
 #include "NumericStrings.h"
 #include "ProfilerDatabase.h"
 #include "PrivateName.h"