Title: [194144] trunk/Source/_javascript_Core
Revision
194144
Author
[email protected]
Date
2015-12-16 09:30:49 -0800 (Wed, 16 Dec 2015)

Log Message

Builtin source should be minified more
https://bugs.webkit.org/show_bug.cgi?id=152290

Patch by Joseph Pecoraro <[email protected]> on 2015-12-16
Reviewed by Darin Adler.

* Scripts/builtins/builtins_model.py:
(BuiltinFunction.fromString):
Remove primarily empty lines that would just introduce clutter.
We only do the minification in non-Debug configurations, which
is determined by the CONFIGURATION environment variable. You can
see how tests would generate differently, like so:
shell> CONFIGURATION=Release ./Tools/Scripts/run-builtins-generator-tests

Modified Paths

Property Changed

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (194143 => 194144)


--- trunk/Source/_javascript_Core/ChangeLog	2015-12-16 14:53:28 UTC (rev 194143)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-12-16 17:30:49 UTC (rev 194144)
@@ -1,3 +1,18 @@
+2015-12-16  Joseph Pecoraro  <[email protected]>
+
+        Builtin source should be minified more
+        https://bugs.webkit.org/show_bug.cgi?id=152290
+
+        Reviewed by Darin Adler.
+
+        * Scripts/builtins/builtins_model.py:
+        (BuiltinFunction.fromString):
+        Remove primarily empty lines that would just introduce clutter.
+        We only do the minification in non-Debug configurations, which
+        is determined by the CONFIGURATION environment variable. You can
+        see how tests would generate differently, like so:
+        shell> CONFIGURATION=Release ./Tools/Scripts/run-builtins-generator-tests
+
 2015-12-16  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r194135.

Modified: trunk/Source/_javascript_Core/Scripts/builtins/builtins_model.py (194143 => 194144)


--- trunk/Source/_javascript_Core/Scripts/builtins/builtins_model.py	2015-12-16 14:53:28 UTC (rev 194143)
+++ trunk/Source/_javascript_Core/Scripts/builtins/builtins_model.py	2015-12-16 17:30:49 UTC (rev 194144)
@@ -49,6 +49,9 @@
 singleLineCommentRegExp = re.compile(r"\/\/.*?\n", re.MULTILINE | re.S)
 keyValueAnnotationCommentRegExp = re.compile(r"^\/\/ @(\w+)=([^=]+?)\n", re.MULTILINE | re.S)
 flagAnnotationCommentRegExp = re.compile(r"^\/\/ @(\w+)[^=]*?\n", re.MULTILINE | re.S)
+lineWithOnlySingleLineCommentRegExp = re.compile(r"^\s*\/\/\n", re.MULTILINE | re.S)
+lineWithTrailingSingleLineCommentRegExp = re.compile(r"\s*\/\/\n", re.MULTILINE | re.S)
+multipleEmptyLinesRegExp = re.compile(r"\n{2,}", re.MULTILINE | re.S)
 
 class ParseException(Exception):
     pass
@@ -100,6 +103,11 @@
     @staticmethod
     def fromString(function_string):
         function_source = multilineCommentRegExp.sub("", function_string)
+        if os.getenv("CONFIGURATION", "Debug").startswith("Debug"):
+            function_source = lineWithOnlySingleLineCommentRegExp.sub("", function_source)
+            function_source = lineWithTrailingSingleLineCommentRegExp.sub("\n", function_source)
+            function_source = multipleEmptyLinesRegExp.sub("\n", function_source)
+
         function_name = functionNameRegExp.findall(function_source)[0]
         is_constructor = functionIsConstructorRegExp.match(function_source) != None
         parameters = [s.strip() for s in functionParameterFinder.findall(function_source)[0].split(',')]
Property changes on: trunk/Source/_javascript_Core/Scripts/builtins/builtins_model.py
___________________________________________________________________

Added: svn:executable

_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to