Changeset 123147 in webkit for trunk/Source/JavaScriptCore/offlineasm/asm.rb
- Timestamp:
- Jul 19, 2012, 1:53:22 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/offlineasm/asm.rb
r122650 r123147 46 46 @numLocalLabels = 0 47 47 @numGlobalLabels = 0 48 49 @newlineSpacerState = :none 48 50 end 49 51 … … 67 69 # Concatenates all the various components of the comment to dump. 68 70 def lastComment 71 separator = " " 69 72 result = "" 70 result = " #{@comment} ." if @comment 71 result += " #{@annotation} ." if @annotation and $enableTrailingInstrAnnotations 72 result += " #{@internalComment} ." if @internalComment 73 result += " #{@codeOrigin} ." if @codeOrigin and $enableCodeOriginComments 73 result = "#{@comment}" if @comment 74 if @annotation and $enableInstrAnnotations 75 result += separator if result != "" 76 result += "#{@annotation}" 77 end 78 if @internalComment 79 result += separator if result != "" 80 result += "#{@internalComment}" 81 end 82 if @codeOrigin and $enableCodeOriginComments 83 result += separator if result != "" 84 result += "#{@codeOrigin}" 85 end 74 86 if result != "" 75 result = " //" + result87 result = "// " + result 76 88 end 77 89 … … 79 91 @commentState = :none 80 92 @comment = nil 81 @internalComment = nil82 93 @annotation = nil 83 94 @codeOrigin = nil 95 @internalComment = nil 84 96 result 85 97 end 86 98 87 # Dumps the current instruction annotation in interlaced mode if appropriate. 88 def putInterlacedAnnotation() 89 raise unless @state == :asm 90 if $enableInterlacedInstrAnnotations 91 @outp.puts(" // #{@annotation}") if @annotation 99 def formatDump(dumpStr, comment, commentColumns=$preferredCommentStartColumn) 100 if comment.length > 0 101 "%-#{commentColumns}s %s" % [dumpStr, comment] 102 else 103 dumpStr 104 end 105 end 106 107 # private method for internal use only. 108 def putAnnotation(text) 109 raise unless @state == :asm 110 if $enableInstrAnnotations 111 @outp.puts text 92 112 @annotation = nil 93 113 end 114 end 115 116 def putLocalAnnotation() 117 putAnnotation " // #{@annotation}" if @annotation 118 end 119 120 def putGlobalAnnotation() 121 putsNewlineSpacerIfAppropriate(:annotation) 122 putAnnotation "// #{@annotation}" if @annotation 94 123 end 95 124 … … 103 132 def puts(*line) 104 133 raise unless @state == :asm 105 putInterlacedAnnotation 106 @outp.puts(" \"\\t" + line.join('') + "\\n\"#{lastComment}") 134 @outp.puts(formatDump(" \"\\t" + line.join('') + "\\n\"", lastComment)) 107 135 end 108 136 … … 112 140 end 113 141 142 def putsNewlineSpacerIfAppropriate(state) 143 if @newlineSpacerState != state 144 @outp.puts("\n") 145 @newlineSpacerState = state 146 end 147 end 148 114 149 def putsLabel(labelName) 115 150 raise unless @state == :asm 116 151 @numGlobalLabels += 1 117 @outp.puts("\n")152 putsNewlineSpacerIfAppropriate(:global) 118 153 @internalComment = $enableLabelCountComments ? "Global Label #{@numGlobalLabels}" : nil 119 @outp.puts("OFFLINE_ASM_GLOBAL_LABEL(#{labelName})#{lastComment}") 154 @outp.puts(formatDump("OFFLINE_ASM_GLOBAL_LABEL(#{labelName})", lastComment)) 155 @newlineSpacerState = :none # After a global label, we can use another spacer. 120 156 end 121 157 … … 125 161 @outp.puts("\n") 126 162 @internalComment = $enableLabelCountComments ? "Local Label #{@numLocalLabels}" : nil 127 @outp.puts( "OFFLINE_ASM_LOCAL_LABEL(#{labelName})#{lastComment}")163 @outp.puts(formatDump(" OFFLINE_ASM_LOCAL_LABEL(#{labelName})", lastComment)) 128 164 end 129 165
Note:
See TracChangeset
for help on using the changeset viewer.