Title: [202015] trunk/Source/_javascript_Core
Revision
202015
Author
oli...@apple.com
Date
2016-06-13 16:17:00 -0700 (Mon, 13 Jun 2016)

Log Message

DFG Validation fails when performing a concatenation with only a single entry
https://bugs.webkit.org/show_bug.cgi?id=158699

Reviewed by Saam Barati.

Fairly simple short circuiting of a single replacement template string
without any padding to be planted as a simple to string rather than
op_strcat.

* bytecompiler/NodesCodegen.cpp:
(JSC::TemplateLiteralNode::emitBytecode):
* tests/stress/template-literal.js:
(testSingleNode):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (202014 => 202015)


--- trunk/Source/_javascript_Core/ChangeLog	2016-06-13 23:05:20 UTC (rev 202014)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-06-13 23:17:00 UTC (rev 202015)
@@ -1,3 +1,19 @@
+2016-06-13  Oliver Hunt  <oli...@apple.com>
+
+        DFG Validation fails when performing a concatenation with only a single entry
+        https://bugs.webkit.org/show_bug.cgi?id=158699
+
+        Reviewed by Saam Barati.
+
+        Fairly simple short circuiting of a single replacement template string
+        without any padding to be planted as a simple to string rather than
+        op_strcat.
+
+        * bytecompiler/NodesCodegen.cpp:
+        (JSC::TemplateLiteralNode::emitBytecode):
+        * tests/stress/template-literal.js:
+        (testSingleNode):
+
 2016-06-13  Filip Pizlo  <fpi...@apple.com>
 
         FTL::Output methods should be out-of-line whenever possible

Modified: trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp (202014 => 202015)


--- trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2016-06-13 23:05:20 UTC (rev 202014)
+++ trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2016-06-13 23:17:00 UTC (rev 202015)
@@ -272,6 +272,9 @@
         generator.emitNode(temporaryRegisters.last().get(), templateString->value());
     }
 
+    if (temporaryRegisters.size() == 1)
+        return generator.emitToString(generator.finalDestination(dst, temporaryRegisters[0].get()), temporaryRegisters[0].get());
+
     return generator.emitStrcat(generator.finalDestination(dst, temporaryRegisters[0].get()), temporaryRegisters[0].get(), temporaryRegisters.size());
 }
 

Modified: trunk/Source/_javascript_Core/tests/stress/template-literal.js (202014 => 202015)


--- trunk/Source/_javascript_Core/tests/stress/template-literal.js	2016-06-13 23:05:20 UTC (rev 202014)
+++ trunk/Source/_javascript_Core/tests/stress/template-literal.js	2016-06-13 23:17:00 UTC (rev 202015)
@@ -205,3 +205,35 @@
     test(stat[1], undefined);
     test(stat[2], undefined);
 }());
+
+dfgTests =[
+    function testSingleNode() {
+        for (var i = 0; i < 1000; i++)
+            `${1}`
+    },
+    function testPreNode() {
+        for (var i = 0; i < 1000; i++)
+            `n${1}`
+    },
+    function testPostNode() {
+        for (var i = 0; i < 1000; i++)
+            `${1}n`
+    },
+    function testSingleObjectNode() {
+        for (var i = 0; i < 1000; i++)
+            `${{}}`
+    },
+    function testObjectPreNode() {
+        for (var i = 0; i < 1000; i++)
+            `n${{}}`
+    },
+    function testObjectPostNode() {
+        for (var i = 0; i < 1000; i++)
+            `${{}}n`
+    },
+];
+
+for(var f of dfgTests) {
+    noInline(f)
+    f();
+}
\ No newline at end of file
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to