Title: [228402] trunk/Source/_javascript_Core
Revision
228402
Author
mark....@apple.com
Date
2018-02-12 15:43:30 -0800 (Mon, 12 Feb 2018)

Log Message

Miscellaneous refactoring of offlineasm.
https://bugs.webkit.org/show_bug.cgi?id=182702
<rdar://problem/37467887>

Reviewed by Filip Pizlo.

1. Refactor out the emission of $asm.comment, $asm.codeOrigin, $asm.annotation,
   and $asm.debugAnnotation into a recordMetaData method.  This standardizes how
   we emit this metadata and makes all backends do it the same way.

2. Add the ability to include custom offlineasm scripts from WebKitAdditions in
   the future.

* offlineasm/arm.rb:
* offlineasm/arm64.rb:
* offlineasm/ast.rb:
* offlineasm/backends.rb:
* offlineasm/cloop.rb:
* offlineasm/config.rb:
* offlineasm/mips.rb:
* offlineasm/risc.rb:
* offlineasm/x86.rb:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (228401 => 228402)


--- trunk/Source/_javascript_Core/ChangeLog	2018-02-12 23:41:17 UTC (rev 228401)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-02-12 23:43:30 UTC (rev 228402)
@@ -1,3 +1,28 @@
+2018-02-12  Mark Lam  <mark....@apple.com>
+
+        Miscellaneous refactoring of offlineasm.
+        https://bugs.webkit.org/show_bug.cgi?id=182702
+        <rdar://problem/37467887>
+
+        Reviewed by Filip Pizlo.
+
+        1. Refactor out the emission of $asm.comment, $asm.codeOrigin, $asm.annotation,
+           and $asm.debugAnnotation into a recordMetaData method.  This standardizes how
+           we emit this metadata and makes all backends do it the same way.
+
+        2. Add the ability to include custom offlineasm scripts from WebKitAdditions in
+           the future.
+
+        * offlineasm/arm.rb:
+        * offlineasm/arm64.rb:
+        * offlineasm/ast.rb:
+        * offlineasm/backends.rb:
+        * offlineasm/cloop.rb:
+        * offlineasm/config.rb:
+        * offlineasm/mips.rb:
+        * offlineasm/risc.rb:
+        * offlineasm/x86.rb:
+
 2018-02-12  Saam Barati  <sbar...@apple.com>
 
         DFG::emitCodeToGetArgumentsArrayLength needs to handle NewArrayBuffer/PhantomNewArrayBuffer

Modified: trunk/Source/_javascript_Core/offlineasm/arm.rb (228401 => 228402)


--- trunk/Source/_javascript_Core/offlineasm/arm.rb	2018-02-12 23:41:17 UTC (rev 228401)
+++ trunk/Source/_javascript_Core/offlineasm/arm.rb	2018-02-12 23:43:30 UTC (rev 228402)
@@ -1,4 +1,4 @@
-# Copyright (C) 2011, 2012, 2015-2016 Apple Inc. All rights reserved.
+# Copyright (C) 2011-2018 Apple Inc. All rights reserved.
 # Copyright (C) 2013 University of Szeged. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -348,10 +348,6 @@
     end
 
     def lowerARMCommon
-        $asm.codeOrigin codeOriginString if $enableCodeOriginComments
-        $asm.annotation annotation if $enableInstrAnnotations
-        $asm.debugAnnotation codeOrigin.debugDirective if $enableDebugAnnotations
-
         case opcode
         when "addi", "addp", "addis", "addps"
             if opcode == "addis" or opcode == "addps"

Modified: trunk/Source/_javascript_Core/offlineasm/arm64.rb (228401 => 228402)


--- trunk/Source/_javascript_Core/offlineasm/arm64.rb	2018-02-12 23:41:17 UTC (rev 228401)
+++ trunk/Source/_javascript_Core/offlineasm/arm64.rb	2018-02-12 23:43:30 UTC (rev 228402)
@@ -1,4 +1,4 @@
-# Copyright (C) 2011, 2012, 2014-2016 Apple Inc. All rights reserved.
+# Copyright (C) 2011-2018 Apple Inc. All rights reserved.
 # Copyright (C) 2014 University of Szeged. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -511,10 +511,6 @@
 
 class Instruction
     def lowerARM64
-        $asm.comment codeOriginString
-        $asm.annotation annotation if $enableInstrAnnotations
-        $asm.debugAnnotation codeOrigin.debugDirective if $enableDebugAnnotations
-
         case opcode
         when 'addi'
             emitARM64Add("add", operands, :int)

Modified: trunk/Source/_javascript_Core/offlineasm/ast.rb (228401 => 228402)


--- trunk/Source/_javascript_Core/offlineasm/ast.rb	2018-02-12 23:41:17 UTC (rev 228401)
+++ trunk/Source/_javascript_Core/offlineasm/ast.rb	2018-02-12 23:43:30 UTC (rev 228402)
@@ -1,4 +1,4 @@
-# Copyright (C) 2011 Apple Inc. All rights reserved.
+# Copyright (C) 2011-2018 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -933,6 +933,20 @@
             raise "Unhandled opcode #{opcode} at #{codeOriginString}"
         end
     end
+
+    def prepareToLower(backendName)
+        if respond_to?("recordMetaData#{backendName}")
+            send("recordMetaData#{backendName}")
+        else
+            recordMetaDataDefault
+        end
+    end
+
+    def recordMetaDataDefault
+        $asm.codeOrigin codeOriginString if $enableCodeOriginComments
+        $asm.annotation annotation if $enableInstrAnnotations
+        $asm.debugAnnotation codeOrigin.debugDirective if $enableDebugAnnotations
+    end
 end
 
 class Error < NoChildren

Modified: trunk/Source/_javascript_Core/offlineasm/backends.rb (228401 => 228402)


--- trunk/Source/_javascript_Core/offlineasm/backends.rb	2018-02-12 23:41:17 UTC (rev 228401)
+++ trunk/Source/_javascript_Core/offlineasm/backends.rb	2018-02-12 23:43:30 UTC (rev 228402)
@@ -1,4 +1,4 @@
-# Copyright (C) 2011, 2016 Apple Inc. All rights reserved.
+# Copyright (C) 2011-2018 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -124,7 +124,8 @@
     def lower(name)
         begin
             $activeBackend = name
-            send("lower" + name)
+            send("prepareToLower", name)
+            send("lower#{name}")
         rescue => e
             raise LoweringError.new(e, codeOriginString)
         end

Modified: trunk/Source/_javascript_Core/offlineasm/cloop.rb (228401 => 228402)


--- trunk/Source/_javascript_Core/offlineasm/cloop.rb	2018-02-12 23:41:17 UTC (rev 228401)
+++ trunk/Source/_javascript_Core/offlineasm/cloop.rb	2018-02-12 23:43:30 UTC (rev 228402)
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2017 Apple Inc. All rights reserved.
+# Copyright (C) 2012-2018 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -567,9 +567,6 @@
     @@didReturnFromJSLabelCounter = 0
 
     def lowerC_LOOP
-        $asm.codeOrigin codeOriginString if $enableCodeOriginComments
-        $asm.annotation annotation if $enableInstrAnnotations && (opcode != "cloopDo")
-
         case opcode
         when "addi"
             cloopEmitOperation(operands, :int32, "+")
@@ -1165,4 +1162,10 @@
             lowerDefault
         end
     end
+
+    def recordMetaDataC_LOOP
+        $asm.codeOrigin codeOriginString if $enableCodeOriginComments
+        $asm.annotation annotation if $enableInstrAnnotations && (opcode != "cloopDo")
+        $asm.debugAnnotation codeOrigin.debugDirective if $enableDebugAnnotations
+    end
 end

Modified: trunk/Source/_javascript_Core/offlineasm/config.rb (228401 => 228402)


--- trunk/Source/_javascript_Core/offlineasm/config.rb	2018-02-12 23:41:17 UTC (rev 228401)
+++ trunk/Source/_javascript_Core/offlineasm/config.rb	2018-02-12 23:43:30 UTC (rev 228402)
@@ -1,4 +1,4 @@
-# Copyright (C) 2012, 2016 Apple Inc. All rights reserved.
+# Copyright (C) 2012-2018 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -21,6 +21,16 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 # THE POSSIBILITY OF SUCH DAMAGE.
 
+buildProductsDirectory = ENV['BUILT_PRODUCTS_DIR'];
+if buildProductsDirectory and File.exists?(buildProductsDirectory)
+    $: << "#{buildProductsDirectory}/usr/local/include/WebKitAdditions/Scripts"
+end
+sdkRootDirectory = ENV['SDKROOT'];
+if sdkRootDirectory and File.exists?(sdkRootDirectory)
+    $: << "#{sdkRootDirectory}/usr/local/include/WebKitAdditions/Scripts"
+end
+
+
 $preferredCommentStartColumn = 60
 
 

Modified: trunk/Source/_javascript_Core/offlineasm/mips.rb (228401 => 228402)


--- trunk/Source/_javascript_Core/offlineasm/mips.rb	2018-02-12 23:41:17 UTC (rev 228401)
+++ trunk/Source/_javascript_Core/offlineasm/mips.rb	2018-02-12 23:43:30 UTC (rev 228402)
@@ -1,4 +1,4 @@
-# Copyright (C) 2012 Apple Inc. All rights reserved.
+# Copyright (C) 2012-2018 Apple Inc. All rights reserved.
 # Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -825,7 +825,6 @@
 
 class Instruction
     def lowerMIPS
-        $asm.comment codeOriginString
         case opcode
         when "addi", "addp", "addis"
             if operands.size == 3 and operands[0].is_a? Immediate

Modified: trunk/Source/_javascript_Core/offlineasm/risc.rb (228401 => 228402)


--- trunk/Source/_javascript_Core/offlineasm/risc.rb	2018-02-12 23:41:17 UTC (rev 228401)
+++ trunk/Source/_javascript_Core/offlineasm/risc.rb	2018-02-12 23:43:30 UTC (rev 228402)
@@ -1,4 +1,4 @@
-# Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
+# Copyright (C) 2011-2018 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -575,7 +575,7 @@
         if node.is_a? Instruction
             case node.opcode
             when "noti", "notp"
-                raise "Wrong nubmer of operands at #{node.codeOriginString}" unless node.operands.size == 1
+                raise "Wrong number of operands at #{node.codeOriginString}" unless node.operands.size == 1
                 suffix = node.opcode[-1..-1]
                 newList << Instruction.new(node.codeOrigin, "xor" + suffix,
                                            [Immediate.new(node.codeOrigin, -1), node.operands[0]])

Modified: trunk/Source/_javascript_Core/offlineasm/x86.rb (228401 => 228402)


--- trunk/Source/_javascript_Core/offlineasm/x86.rb	2018-02-12 23:41:17 UTC (rev 228401)
+++ trunk/Source/_javascript_Core/offlineasm/x86.rb	2018-02-12 23:43:30 UTC (rev 228402)
@@ -1,4 +1,4 @@
-# Copyright (C) 2012, 2014-2016 Apple Inc. All rights reserved.
+# Copyright (C) 2012-2018 Apple Inc. All rights reserved.
 # Copyright (C) 2013 Digia Plc. and/or its subsidiary(-ies)
 #
 # Redistribution and use in source and binary forms, with or without
@@ -890,10 +890,6 @@
     end
 
     def lowerX86Common
-        $asm.codeOrigin codeOriginString if $enableCodeOriginComments
-        $asm.annotation annotation if $enableInstrAnnotations
-        $asm.debugAnnotation codeOrigin.debugDirective if $enableDebugAnnotations
-
         case opcode
         when "addi"
             handleX86Add(:int)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to