diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/offlineasm/settings.rb | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/JavaScriptCore/offlineasm/settings.rb')
-rw-r--r-- | Source/JavaScriptCore/offlineasm/settings.rb | 59 |
1 files changed, 51 insertions, 8 deletions
diff --git a/Source/JavaScriptCore/offlineasm/settings.rb b/Source/JavaScriptCore/offlineasm/settings.rb index 601934f99..eec092584 100644 --- a/Source/JavaScriptCore/offlineasm/settings.rb +++ b/Source/JavaScriptCore/offlineasm/settings.rb @@ -54,7 +54,28 @@ def computeSettingsCombinations(ast) settingsCombinator(settingsCombinations, newMap, remaining[1..-1]) end - settingsCombinator(settingsCombinations, {}, (ast.filter(Setting).uniq.collect{|v| v.name} + BACKENDS).uniq) + nonBackendSettings = ast.filter(Setting).uniq.collect{ |v| v.name } + nonBackendSettings.delete_if { + | setting | + isBackend? setting + } + + allBackendsFalse = {} + BACKENDS.each { + | backend | + allBackendsFalse[backend] = false + } + + # This will create entries for invalid backends. That's fine. It's necessary + # because it ensures that generate_offsets_extractor (which knows about valid + # backends) has settings indices that are compatible with what asm will see + # (asm doesn't know about valid backends). + BACKENDS.each { + | backend | + map = allBackendsFalse.clone + map[backend] = true + settingsCombinator(settingsCombinations, map, nonBackendSettings) + } settingsCombinations end @@ -73,15 +94,13 @@ def forSettings(concreteSettings, ast) selectedBackend = nil BACKENDS.each { | backend | - isSupported = concreteSettings[backend] - raise unless isSupported != nil - numClaimedBackends += if isSupported then 1 else 0 end - if isSupported + if concreteSettings[backend] + raise if selectedBackend selectedBackend = backend end } - return if numClaimedBackends > 1 + return unless isValidBackend? selectedBackend # Resolve the AST down to a low-level form (no macros or conditionals). lowLevelAST = ast.resolveSettings(concreteSettings) @@ -172,7 +191,17 @@ end # def emitCodeInConfiguration(concreteSettings, ast, backend) - $output.puts cppSettingsTest(concreteSettings) + Label.resetReferenced + + if !$emitWinAsm + $output.puts cppSettingsTest(concreteSettings) + else + if backend == "X86_WIN" + $output.puts ".MODEL FLAT, C" + end + $output.puts "INCLUDE #{File.basename($output.path)}.sym" + $output.puts "_TEXT SEGMENT" + end if isASTErroneous(ast) $output.puts "#error \"Invalid configuration.\"" @@ -182,7 +211,21 @@ def emitCodeInConfiguration(concreteSettings, ast, backend) yield concreteSettings, ast, backend end - $output.puts "#endif" + if !$emitWinAsm + $output.puts "#endif" + else + $output.puts "_TEXT ENDS" + $output.puts "END" + + # Write symbols needed by MASM + File.open("#{File.basename($output.path)}.sym", "w") { + | outp | + Label.forReferencedExtern { + | name | + outp.puts "EXTERN #{name[1..-1]} : near" + } + } + end end # |