Title: [238761] trunk/Source/_javascript_Core
Revision
238761
Author
[email protected]
Date
2018-11-30 16:14:02 -0800 (Fri, 30 Nov 2018)

Log Message

Fix the bytecode code generator scripts to pretty print Bytecodes.h.
https://bugs.webkit.org/show_bug.cgi?id=192258

Reviewed by Keith Miller.

This makes Bytecodes.h more human readable.

* generator/DSL.rb:
* generator/Section.rb:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (238760 => 238761)


--- trunk/Source/_javascript_Core/ChangeLog	2018-12-01 00:11:49 UTC (rev 238760)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-12-01 00:14:02 UTC (rev 238761)
@@ -1,5 +1,17 @@
 2018-11-30  Mark Lam  <[email protected]>
 
+        Fix the bytecode code generator scripts to pretty print Bytecodes.h.
+        https://bugs.webkit.org/show_bug.cgi?id=192258
+
+        Reviewed by Keith Miller.
+
+        This makes Bytecodes.h more human readable.
+
+        * generator/DSL.rb:
+        * generator/Section.rb:
+
+2018-11-30  Mark Lam  <[email protected]>
+
         Add the generator directory to the Xcode project.
         https://bugs.webkit.org/show_bug.cgi?id=192252
 

Modified: trunk/Source/_javascript_Core/generator/DSL.rb (238760 => 238761)


--- trunk/Source/_javascript_Core/generator/DSL.rb	2018-12-01 00:11:49 UTC (rev 238760)
+++ trunk/Source/_javascript_Core/generator/DSL.rb	2018-12-01 00:14:02 UTC (rev 238761)
@@ -99,13 +99,12 @@
 
     def self.write_bytecodes(bytecode_list, bytecodes_filename)
         GeneratedFile::create(bytecodes_filename, bytecode_list) do |template|
-            template.prefix = "#pragma once"
+            template.prefix = "#pragma once\n"
             num_opcodes = @sections.map(&:opcodes).flatten.size
             template.body = <<-EOF
-                #{@sections.map { |s| s.header_helpers(num_opcodes) }.join("\n")}
-
-                #define FOR_EACH_BYTECODE_STRUCT(macro) \\
-                #{opcodes_for(:emit_in_structs_file).map { |op| "macro(#{op.capitalized_name}) \\" }.join("\n")}
+#{@sections.map { |s| s.header_helpers(num_opcodes) }.join("\n")}
+#define FOR_EACH_BYTECODE_STRUCT(macro) \\
+#{opcodes_for(:emit_in_structs_file).map { |op| "    macro(#{op.capitalized_name}) \\" }.join("\n")}
             EOF
         end
     end

Modified: trunk/Source/_javascript_Core/generator/Section.rb (238760 => 238761)


--- trunk/Source/_javascript_Core/generator/Section.rb	2018-12-01 00:11:49 UTC (rev 238760)
+++ trunk/Source/_javascript_Core/generator/Section.rb	2018-12-01 00:14:02 UTC (rev 238761)
@@ -61,7 +61,7 @@
       out = StringIO.new
       if config[:emit_in_h_file]
           out.write("#define FOR_EACH_#{config[:macro_name_component]}_ID(macro) \\\n")
-          opcodes.each { |opcode| out.write("macro(#{opcode.name}, #{opcode.length}) \\\n") }
+          opcodes.each { |opcode| out.write("    macro(#{opcode.name}, #{opcode.length}) \\\n") }
           out << "\n"
 
           out.write("#define NUMBER_OF_#{config[:macro_name_component]}_IDS #{opcodes.length}\n")
@@ -77,7 +77,7 @@
                   break
               end
 
-              out.write("macro(sizeof(#{opcodes[i].capitalized_name}::Metadata))\\\n")
+              out.write("    macro(sizeof(#{opcodes[i].capitalized_name}::Metadata))\\\n")
               i += 1
           end
           out << "\n"
@@ -90,14 +90,12 @@
                   break
               end
 
-              out.write("macro(alignof(#{opcodes[i].capitalized_name}::Metadata))\\\n")
+              out.write("    macro(alignof(#{opcodes[i].capitalized_name}::Metadata))\\\n")
               i += 1
           end
-          out << "\n"
       end
 
       if config[:emit_opcode_id_string_values_in_h_file]
-          out << "\n"
           opcodes.each { |opcode|
               out.write("#define #{opcode.name}_value_string \"#{opcode.id}\"\n")
           }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to