Title: [171264] trunk/Source/WebCore
Revision
171264
Author
[email protected]
Date
2014-07-19 11:07:43 -0700 (Sat, 19 Jul 2014)

Log Message

<https://webkit.org/b/135085> Ensure that make_names.pl generates the same result when run multiple times.

Perl 5.18 introduced hash randomization. This results in the iteration order of hashes being different
from one run to the next. To ensure identical output we can iterate over the hash keys in sorted order.

Reviewed by Alexey Proskuryakov.

* bindings/scripts/StaticString.pm:
(GenerateStrings):
(GenerateStringAsserts):
* dom/make_names.pl:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (171263 => 171264)


--- trunk/Source/WebCore/ChangeLog	2014-07-19 16:16:39 UTC (rev 171263)
+++ trunk/Source/WebCore/ChangeLog	2014-07-19 18:07:43 UTC (rev 171264)
@@ -1,3 +1,17 @@
+2014-07-19  Mark Rowe  <[email protected]>
+
+        <https://webkit.org/b/135085> Ensure that make_names.pl generates the same result when run multiple times.
+
+        Perl 5.18 introduced hash randomization. This results in the iteration order of hashes being different
+        from one run to the next. To ensure identical output we can iterate over the hash keys in sorted order.
+
+        Reviewed by Alexey Proskuryakov.
+
+        * bindings/scripts/StaticString.pm:
+        (GenerateStrings):
+        (GenerateStringAsserts):
+        * dom/make_names.pl:
+
 2014-07-19  Zan Dobersek  <[email protected]>
 
         Document::unregisterNodeListforInvalidation() and Document::unregisterCollection() have incorrect assertions

Modified: trunk/Source/WebCore/bindings/scripts/StaticString.pm (171263 => 171264)


--- trunk/Source/WebCore/bindings/scripts/StaticString.pm	2014-07-19 16:16:39 UTC (rev 171263)
+++ trunk/Source/WebCore/bindings/scripts/StaticString.pm	2014-07-19 18:07:43 UTC (rev 171264)
@@ -33,13 +33,14 @@
 
     my @result = ();
 
-    while ( my ($name, $value) = each %strings ) {
-        push(@result, "static const LChar ${name}String8[] = \"${value}\";\n");
+    for my $name (sort keys %strings) {
+        push(@result, "static const LChar ${name}String8[] = \"$strings{$name}\";\n");
     }
 
     push(@result, "\n");
 
-    while ( my ($name, $value) = each %strings ) {
+    for my $name (sort keys %strings) {
+        my $value = $strings{$name};
         my $length = length($value);
         my $hash = Hasher::GenerateHashValue($value);
         push(@result, <<END);
@@ -66,7 +67,7 @@
 
     push(@result, "#ifndef NDEBUG\n");
 
-    while ( my ($name, $value) = each %strings ) {
+    for my $name (sort keys %strings) {
         push(@result, "    reinterpret_cast<StringImpl*>(&${name}Data)->assertHashIsCorrect();\n");
     }
 

Modified: trunk/Source/WebCore/dom/make_names.pl (171263 => 171264)


--- trunk/Source/WebCore/dom/make_names.pl	2014-07-19 16:16:39 UTC (rev 171263)
+++ trunk/Source/WebCore/dom/make_names.pl	2014-07-19 18:07:43 UTC (rev 171264)
@@ -119,7 +119,7 @@
 
     print F StaticString::GenerateStrings(\%parameters);
 
-    while ( my ($name, $identifier) = each %parameters ) {
+    for my $name (sort keys %parameters) {
         print F "DEFINE_GLOBAL(AtomicString, $name)\n";
     }
 
@@ -128,7 +128,7 @@
     print F "\n";
     print F StaticString::GenerateStringAsserts(\%parameters);
 
-    while ( my ($name, $identifier) = each %parameters ) {
+    for my $name (sort keys %parameters) {
         # FIXME: Would like to use static_cast here, but there are differences in const
         # depending on whether SKIP_STATIC_CONSTRUCTORS_ON_GCC is used, so stick with a
         # C-style cast for now.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to