diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-30 12:48:17 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-30 12:48:17 +0200 |
commit | 881da28418d380042aa95a97f0cbd42560a64f7c (patch) | |
tree | a794dff3274695e99c651902dde93d934ea7a5af /Source/JavaScriptCore/offlineasm/settings.rb | |
parent | 7e104c57a70fdf551bb3d22a5d637cdcbc69dbea (diff) | |
parent | 0fcedcd17cc00d3dd44c718b3cb36c1033319671 (diff) | |
download | qtwebkit-881da28418d380042aa95a97f0cbd42560a64f7c.tar.gz |
Merge 'wip/next' into dev
Change-Id: Iff9ee5e23bb326c4371ec8ed81d56f2f05d680e9
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 # |