Changeset 291142 in webkit for trunk/Source/JavaScriptCore/offlineasm
- Timestamp:
- Mar 10, 2022, 6:35:06 PM (3 years ago)
- Location:
- trunk/Source/JavaScriptCore/offlineasm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/offlineasm/asm.rb
r290990 r291142 34 34 require "self_hash" 35 35 require "settings" 36 require "shellwords" 36 37 require "transform" 37 38 … … 348 349 $options = {} 349 350 OptionParser.new do |opts| 350 opts.banner = "Usage: asm.rb asmFile offsetsFile outputFileName [--assembler=<ASM>] [--webkit-additions-path=<path>] [--binary-format=<format>] "351 opts.banner = "Usage: asm.rb asmFile offsetsFile outputFileName [--assembler=<ASM>] [--webkit-additions-path=<path>] [--binary-format=<format>] [--depfile=<depfile>]" 351 352 # This option is currently only used to specify the masm assembler 352 353 opts.on("--assembler=[ASM]", "Specify an assembler to use.") do |assembler| … … 358 359 opts.on("--binary-format=FORMAT", "Specify the binary format used by the target system.") do |format| 359 360 $options[:binary_format] = format 361 end 362 opts.on("--depfile=DEPFILE", "Path to write Makefile-style discovered dependencies to.") do |path| 363 $options[:depfile] = path 360 364 end 361 365 end.parse! … … 385 389 " " + Digest::SHA1.hexdigest($options.has_key?(:assembler) ? $options[:assembler] : "") 386 390 387 if FileTest.exist? outputFlnm391 if FileTest.exist?(outputFlnm) and (not $options[:depfile] or FileTest.exist?($options[:depfile])) 388 392 lastLine = nil 389 393 File.open(outputFlnm, "r") { … … 408 412 409 413 $asm = Assembler.new($output) 410 411 ast = parse(asmFile, $options) 414 415 sources = Set.new 416 ast = parse(asmFile, $options, sources) 412 417 settingsCombinations = computeSettingsCombinations(ast) 418 419 if $options[:depfile] 420 depfile = File.open($options[:depfile], "w") 421 depfile.print(Shellwords.escape(outputFlnm), ": ") 422 depfile.puts(Shellwords.join(sources.sort)) 423 end 413 424 414 425 configurationList.each { -
trunk/Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb
r290990 r291142 34 34 require "self_hash" 35 35 require "settings" 36 require "shellwords" 36 37 require "transform" 37 38 … … 49 50 $options = {} 50 51 OptionParser.new do |opts| 51 opts.banner = "Usage: generate_offset_extractor.rb asmFile settingFile outputFileName backends variants [--webkit-additions-path=<path>] "52 opts.banner = "Usage: generate_offset_extractor.rb asmFile settingFile outputFileName backends variants [--webkit-additions-path=<path>] [--depfile=<depfile>]" 52 53 opts.on("--webkit-additions-path=PATH", "WebKitAdditions path.") do |path| 53 54 $options[:webkit_additions_path] = path 55 end 56 opts.on("--depfile=DEPFILE", "path to write Makefile-style discovered dependencies to.") do |path| 57 $options[:depfile] = path 54 58 end 55 59 end.parse! … … 72 76 inputHash = "// OffsetExtractor input hash: #{parseHash(inputFlnm, $options)} #{configurationHash} #{selfHash}" 73 77 74 if FileTest.exist? outputFlnm78 if FileTest.exist?(outputFlnm) and (not $options[:depfile] or FileTest.exist?($options[:depfile])) 75 79 File.open(outputFlnm, "r") { 76 80 | inp | … … 83 87 end 84 88 85 ast = parse(inputFlnm, $options) 89 sources = Set.new 90 ast = parse(inputFlnm, $options, sources) 86 91 settingsCombinations = computeSettingsCombinations(ast) 92 93 if $options[:depfile] 94 depfile = File.open($options[:depfile], "w") 95 depfile.print(Shellwords.escape(outputFlnm), ": ") 96 depfile.puts(Shellwords.join(sources.sort)) 97 end 87 98 88 99 File.open(outputFlnm, "w") { -
trunk/Source/JavaScriptCore/offlineasm/generate_settings_extractor.rb
r290990 r291142 34 34 require "self_hash" 35 35 require "settings" 36 require "shellwords" 36 37 require "transform" 37 38 … … 46 47 $options = {} 47 48 OptionParser.new do |opts| 48 opts.banner = "Usage: generate_settings_extractor.rb asmFile settingFile [--webkit-additions-path=<path>] "49 opts.banner = "Usage: generate_settings_extractor.rb asmFile settingFile [--webkit-additions-path=<path>] [--depfile=<depfile>]" 49 50 opts.on("--webkit-additions-path=PATH", "WebKitAdditions path.") do |path| 50 51 $options[:webkit_additions_path] = path 52 end 53 opts.on("--depfile=DEPFILE", "path to write Makefile-style discovered dependencies to.") do |path| 54 $options[:depfile] = path 51 55 end 52 56 end.parse! … … 54 58 inputHash = "// SettingsExtractor input hash: #{parseHash(inputFlnm, $options)} #{selfHash}" 55 59 56 if FileTest.exist? outputFlnm60 if FileTest.exist?(outputFlnm) and (not $options[:depfile] or FileTest.exist?($options[:depfile])) 57 61 File.open(outputFlnm, "r") { 58 62 | inp | … … 65 69 end 66 70 67 originalAST = parse(inputFlnm, $options) 71 sources = Set.new 72 originalAST = parse(inputFlnm, $options, sources) 68 73 prunedAST = Sequence.new(originalAST.codeOrigin, originalAST.filter(Setting)) 74 75 if $options[:depfile] 76 depfile = File.open($options[:depfile], "w") 77 depfile.print(Shellwords.escape(outputFlnm), ": ") 78 depfile.puts(Shellwords.join(sources.sort)) 79 end 69 80 70 81 File.open(outputFlnm, "w") { -
trunk/Source/JavaScriptCore/offlineasm/parser.rb
r290990 r291142 261 261 262 262 class Parser 263 def initialize(data, fileName, options )263 def initialize(data, fileName, options, sources=nil) 264 264 @tokens = lex(data, fileName) 265 265 @idx = 0 … … 269 269 @buildProductsDirectory = ENV['BUILT_PRODUCTS_DIR']; 270 270 @options = options 271 @sources = sources 271 272 end 272 273 … … 844 845 fileExists = File.exists?(fileName) 845 846 raise "File not found: #{fileName}" if not fileExists and not isOptional 846 list << parse(fileName, @options ) if fileExists847 list << parse(fileName, @options, @sources) if fileExists 847 848 else 848 849 parseError "Expecting terminal #{final} #{comment}" … … 901 902 end 902 903 903 def parseData(data, fileName, options )904 parser = Parser.new(data, SourceFile.new(fileName), options )904 def parseData(data, fileName, options, sources) 905 parser = Parser.new(data, SourceFile.new(fileName), options, sources) 905 906 parser.parseSequence(nil, "") 906 907 end 907 908 908 def parse(fileName, options) 909 parseData(readTextFile(fileName), fileName, options) 909 def parse(fileName, options, sources=nil) 910 sources << fileName if sources 911 parseData(readTextFile(fileName), fileName, options, sources) 910 912 end 911 913
Note:
See TracChangeset
for help on using the changeset viewer.