summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/offlineasm/backends.rb
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/offlineasm/backends.rb
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/JavaScriptCore/offlineasm/backends.rb')
-rw-r--r--Source/JavaScriptCore/offlineasm/backends.rb64
1 files changed, 56 insertions, 8 deletions
diff --git a/Source/JavaScriptCore/offlineasm/backends.rb b/Source/JavaScriptCore/offlineasm/backends.rb
index bf01b59b5..ba1633591 100644
--- a/Source/JavaScriptCore/offlineasm/backends.rb
+++ b/Source/JavaScriptCore/offlineasm/backends.rb
@@ -1,4 +1,4 @@
-# Copyright (C) 2011 Apple Inc. All rights reserved.
+# Copyright (C) 2011, 2016 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -27,19 +27,19 @@ require "arm64"
require "ast"
require "x86"
require "mips"
-require "sh4"
require "cloop"
BACKENDS =
[
"X86",
+ "X86_WIN",
"X86_64",
+ "X86_64_WIN",
"ARM",
"ARMv7",
"ARMv7_TRADITIONAL",
"ARM64",
"MIPS",
- "SH4",
"C_LOOP"
]
@@ -51,26 +51,67 @@ BACKENDS =
WORKING_BACKENDS =
[
"X86",
+ "X86_WIN",
"X86_64",
+ "X86_64_WIN",
"ARM",
"ARMv7",
"ARMv7_TRADITIONAL",
"ARM64",
"MIPS",
- "SH4",
"C_LOOP"
]
BACKEND_PATTERN = Regexp.new('\\A(' + BACKENDS.join(')|(') + ')\\Z')
+$allBackends = {}
+$validBackends = {}
+BACKENDS.each {
+ | backend |
+ $validBackends[backend] = true
+ $allBackends[backend] = true
+}
+
+def includeOnlyBackends(list)
+ newValidBackends = {}
+ list.each {
+ | backend |
+ if $validBackends[backend]
+ newValidBackends[backend] = true
+ end
+ }
+ $validBackends = newValidBackends
+end
+
+def isBackend?(backend)
+ $allBackends[backend]
+end
+
+def isValidBackend?(backend)
+ $validBackends[backend]
+end
+
+def validBackends
+ $validBackends.keys
+end
+
+class LoweringError < StandardError
+ attr_reader :originString
+
+ def initialize(e, originString)
+ super "#{e} (due to #{originString})"
+ @originString = originString
+ set_backtrace e.backtrace
+ end
+end
+
class Node
def lower(name)
begin
$activeBackend = name
send("lower" + name)
rescue => e
- e.message << "At #{codeOriginString}"
- raise e
+ raise LoweringError.new(e, codeOriginString)
end
end
end
@@ -79,7 +120,8 @@ end
class Label
def lower(name)
- $asm.putsLabel(self.name[1..-1])
+ $asm.debugAnnotation codeOrigin.debugDirective if $enableDebugAnnotations
+ $asm.putsLabel(self.name[1..-1], @global)
end
end
@@ -91,8 +133,13 @@ end
class LabelReference
def asmLabel
- Assembler.labelReference(name[1..-1])
+ if extern?
+ Assembler.externLabelReference(name[1..-1])
+ else
+ Assembler.labelReference(name[1..-1])
+ end
end
+
def cLabel
Assembler.cLabelReference(name[1..-1])
end
@@ -102,6 +149,7 @@ class LocalLabelReference
def asmLabel
Assembler.localLabelReference("_offlineasm_"+name[1..-1])
end
+
def cLabel
Assembler.cLocalLabelReference("_offlineasm_"+name[1..-1])
end