]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - offlineasm/transform.rb
JavaScriptCore-7600.1.4.13.1.tar.gz
[apple/javascriptcore.git] / offlineasm / transform.rb
index 86c72be676cbaffb0572a02ad7acb0492964fd49..c77bf63a231b299db063c1887b4d5eda50073a9d 100644 (file)
@@ -21,6 +21,7 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 # THE POSSIBILITY OF SUCH DAMAGE.
 
+require "config"
 require "ast"
 
 #
@@ -228,6 +229,9 @@ class Sequence
                         mapping[myMacros[item.name].variables[idx]] = item.operands[idx]
                     end
                 }
+                if item.annotation
+                    newList << Instruction.new(item.codeOrigin, "localAnnotation", [], item.annotation)
+                end
                 newList += myMacros[item.name].body.substitute(mapping).demacroify(myMyMacros).renameLabels(item.name).list
             else
                 newList << item.demacroify(myMacros)
@@ -400,6 +404,17 @@ end
 class Sequence
     def validate
         validateChildren
+        
+        # Further verify that this list contains only instructions, labels, and skips.
+        @list.each {
+            | node |
+            unless node.is_a? Instruction or
+                    node.is_a? Label or
+                    node.is_a? LocalLabel or
+                    node.is_a? Skip
+                raise "Unexpected #{node.inspect} at #{node.codeOrigin}" 
+            end
+        }
     end
 end
 
@@ -442,6 +457,13 @@ class Instruction
     end
 end
 
+class SubImmediates
+    def validate
+      raise "Invalid operand #{left.dump} to immediate subtraction" unless left.immediateOperand?
+      raise "Invalid operand #{right.dump} to immediate subtraction" unless right.immediateOperand?
+    end
+end
+
 class Error
     def validate
     end