Changeset 281321 in webkit
- Timestamp:
- Aug 20, 2021 10:01:00 AM (3 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r281319 r281321 1 2021-08-20 Mark Lam <mark.lam@apple.com> 2 3 Add some offlineasm enhancements. 4 https://bugs.webkit.org/show_bug.cgi?id=229332 5 rdar://82163923 6 7 Reviewed by Keith Miller. 8 9 1. Enhance "include" offlineasm Instruction to always attempt to include an asm 10 file from <build-products>/usr/local/include/WebKitAdditions/ first. If the 11 specified file is not available there, then it will attempt to include the file 12 from the same directory as the current source file (which in practice, means 13 Source/JavaScriptCore/llint/). 14 15 2. Enhance "include" offlineasm Instruction to allow an optional file to be 16 included if it exists. For example, the following offlineasm code: 17 18 include? LowLevelInterpreterAdditions 19 20 ... will attempt to include a file LowLevelInterpreterAdditions.asm. If the 21 file does not exist, this will be a no-op. Note: the "?" after the "include" 22 means the include is optional. 23 24 3. Enhanced "emit" offlineasm Instruction to be able to take more than one operand. 25 26 "emit" used to just copy the string operand that follows into the generated 27 LLIntAssembly.h. Now, "emit" can take multiple comma separated operands, and 28 will concatenate all the operands. 29 30 Additionally, "emit" can now take a LocalLabelReference as an operand. For 31 example, this offline asm code: 32 33 emit "b ", .done 34 ... 35 .done: 36 37 ... will generate this inline asm code in LLIntAssembly.h: 38 39 "b " LOCAL_LABEL_STRING(_offlineasm_someLabel_done) "\n" 40 41 This makes it easier to emit branches to local labels. 42 43 4. Also fixed LLInt code alignment for ARM_THUMB2 and ARM64. 44 45 Previously, it was aligned using ".align 4" which means aligned on a 4 46 instruction boundary. Note: the interpretation of .align varies for different 47 target CPU architectures. 48 49 Now, we do the alignment using ".balign 4" which means align on a 4 byte 50 boundary. This is the intended alignment because ARM64 instruction size is 51 4 bytes, and ARM_THUMB2 instruction size is either 2 bytes or 4 bytes. 52 Using .align before was potentially wasting some code space. 53 54 * llint/LowLevelInterpreter.asm: 55 * llint/LowLevelInterpreter.cpp: 56 * offlineasm/ast.rb: 57 * offlineasm/parser.rb: 58 1 59 2021-08-20 Mark Lam <mark.lam@apple.com> 2 60 -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r281115 r281321 1965 1965 crash() 1966 1966 1967 include? LowLevelInterpreterAdditions 1968 1967 1969 # Value-representation-specific code. 1968 1970 if JSVALUE64 -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp
r271586 r281321 496 496 #define OFFLINE_ASM_GLOBAL_LABEL(label) \ 497 497 ".text\n" \ 498 ". align 4\n" \498 ".balign 4\n" \ 499 499 ".globl " SYMBOL_STRING(label) "\n" \ 500 500 HIDE_SYMBOL(label) "\n" \ … … 505 505 #define OFFLINE_ASM_GLOBAL_LABEL(label) \ 506 506 ".text\n" \ 507 ". align 4\n" \507 ".balign 4\n" \ 508 508 ".globl " SYMBOL_STRING(label) "\n" \ 509 509 HIDE_SYMBOL(label) "\n" \ -
trunk/Source/JavaScriptCore/offlineasm/ast.rb
r275597 r281321 945 945 $asm.putGlobalAnnotation 946 946 when "emit" 947 $asm.puts "#{operands[0].dump}" 947 str = ""; 948 for operand in operands do 949 if (operand.is_a? LocalLabelReference) 950 str += operand.asmLabel 951 else 952 str += "#{operand.dump}" 953 end 954 end 955 $asm.puts "#{str}" 948 956 when "tagCodePtr", "tagReturnAddress", "untagReturnAddress", "removeCodePtrTag", "untagArrayPtr", "removeArrayPtrTag" 949 957 else -
trunk/Source/JavaScriptCore/offlineasm/parser.rb
r254637 r281321 201 201 when /\A".*"/ 202 202 result << Token.new(CodeOrigin.new(file, lineNumber), $&) 203 when /\?/ 204 result << Token.new(CodeOrigin.new(file, lineNumber), $&) 203 205 else 204 206 raise "Lexer error at #{CodeOrigin.new(file, lineNumber).to_s}, unexpected sequence #{str[0..20].inspect}" … … 262 264 @idx = 0 263 265 @annotation = nil 266 # FIXME: CMake does not currently set BUILT_PRODUCTS_DIR. 267 # https://bugs.webkit.org/show_bug.cgi?id=229340 268 @buildProductsDirectory = ENV['BUILT_PRODUCTS_DIR']; 264 269 end 265 270 … … 818 823 elsif @tokens[@idx] == "include" 819 824 @idx += 1 825 isOptional = false 826 if @tokens[@idx] == "?" 827 isOptional = true 828 @idx += 1 829 end 820 830 parseError unless isIdentifier(@tokens[@idx]) 821 831 moduleName = @tokens[@idx].string 822 fileName = IncludeFile.new(moduleName, @tokens[@idx].codeOrigin.fileName.dirname).fileName 823 @idx += 1 824 list << parse(fileName) 832 @idx += 1 833 additionsDirectoryName = "#{@buildProductsDirectory}/usr/local/include/WebKitAdditions/" 834 fileName = IncludeFile.new(moduleName, additionsDirectoryName).fileName 835 if not File.exists?(fileName) 836 fileName = IncludeFile.new(moduleName, @tokens[@idx].codeOrigin.fileName.dirname).fileName 837 end 838 fileExists = File.exists?(fileName) 839 raise "File not found: #{fileName}" if not fileExists and not isOptional 840 list << parse(fileName) if fileExists 825 841 else 826 842 parseError "Expecting terminal #{final} #{comment}" … … 839 855 elsif @tokens[@idx] == "include" 840 856 @idx += 1 857 isOptional = false 858 if @tokens[@idx] == "?" 859 isOptional = true 860 @idx += 1 861 end 841 862 parseError unless isIdentifier(@tokens[@idx]) 842 863 moduleName = @tokens[@idx].string 843 fileName = IncludeFile.new(moduleName, @tokens[@idx].codeOrigin.fileName.dirname).fileName 844 @idx += 1 845 846 fileList << fileName 864 @idx += 1 865 additionsDirectoryName = "#{@buildProductsDirectory}/usr/local/include/WebKitAdditions/" 866 fileName = IncludeFile.new(moduleName, additionsDirectoryName).fileName 867 if not File.exists?(fileName) 868 fileName = IncludeFile.new(moduleName, @tokens[@idx].codeOrigin.fileName.dirname).fileName 869 end 870 fileExists = File.exists?(fileName) 871 raise "File not found: #{fileName}" if not fileExists and not isOptional 872 fileList << fileName if fileExists 847 873 else 848 874 @idx += 1
Note: See TracChangeset
for help on using the changeset viewer.