Title: [205916] trunk
Revision
205916
Author
[email protected]
Date
2016-09-14 10:48:13 -0700 (Wed, 14 Sep 2016)

Log Message

TaggedTemplateString function calls should emit tail position calls
https://bugs.webkit.org/show_bug.cgi?id=161948

Patch by Joseph Pecoraro <[email protected]> on 2016-09-14
Reviewed by Yusuke Suzuki.

JSTests:

* stress/tail-call-recognize.js:
(runTests):
Ensure a tagged template string function call is tail call.

* test262.yaml:
These now pass.

Source/_javascript_Core:

* bytecompiler/NodesCodegen.cpp:
(JSC::TaggedTemplateNode::emitBytecode):
The tagged template string function call can be a tail call:
https://tc39.github.io/ecma262/#sec-tagged-templates-runtime-semantics-evaluation

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (205915 => 205916)


--- trunk/JSTests/ChangeLog	2016-09-14 17:44:31 UTC (rev 205915)
+++ trunk/JSTests/ChangeLog	2016-09-14 17:48:13 UTC (rev 205916)
@@ -1,5 +1,19 @@
 2016-09-14  Joseph Pecoraro  <[email protected]>
 
+        TaggedTemplateString function calls should emit tail position calls
+        https://bugs.webkit.org/show_bug.cgi?id=161948
+
+        Reviewed by Yusuke Suzuki.
+
+        * stress/tail-call-recognize.js:
+        (runTests):
+        Ensure a tagged template string function call is tail call.
+
+        * test262.yaml:
+        These now pass.
+
+2016-09-14  Joseph Pecoraro  <[email protected]>
+
         test262: Array.prototype.slice should always set length
         https://bugs.webkit.org/show_bug.cgi?id=161953
 

Modified: trunk/JSTests/stress/tail-call-recognize.js (205915 => 205916)


--- trunk/JSTests/stress/tail-call-recognize.js	2016-09-14 17:44:31 UTC (rev 205915)
+++ trunk/JSTests/stress/tail-call-recognize.js	2016-09-14 17:48:13 UTC (rev 205916)
@@ -117,6 +117,11 @@
         dummy: return callerMustBeRun();
     })();
 
+    (function tailCallInTaggedTemplateString() {
+        "use strict";
+        return callerMustBeRun`test`;
+    })();
+
     // _expression_ tests, we don't enumerate all the cases where there
     // *shouldn't* be a tail call
 

Modified: trunk/JSTests/test262.yaml (205915 => 205916)


--- trunk/JSTests/test262.yaml	2016-09-14 17:44:31 UTC (rev 205915)
+++ trunk/JSTests/test262.yaml	2016-09-14 17:48:13 UTC (rev 205916)
@@ -68174,9 +68174,9 @@
 - path: test262/test/language/expressions/tagged-template/member-_expression_-context.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/expressions/tagged-template/tco-call.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/tco-helper.js"], [:strict]
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/tco-helper.js"], [:strict]
 - path: test262/test/language/expressions/tagged-template/tco-member.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/tco-helper.js"], [:strict]
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/tco-helper.js"], [:strict]
 - path: test262/test/language/expressions/tagged-template/template-object-frozen-non-strict.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/expressions/tagged-template/template-object-frozen-strict.js

Modified: trunk/Source/_javascript_Core/ChangeLog (205915 => 205916)


--- trunk/Source/_javascript_Core/ChangeLog	2016-09-14 17:44:31 UTC (rev 205915)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-09-14 17:48:13 UTC (rev 205916)
@@ -1,5 +1,17 @@
 2016-09-14  Joseph Pecoraro  <[email protected]>
 
+        TaggedTemplateString function calls should emit tail position calls
+        https://bugs.webkit.org/show_bug.cgi?id=161948
+
+        Reviewed by Yusuke Suzuki.
+
+        * bytecompiler/NodesCodegen.cpp:
+        (JSC::TaggedTemplateNode::emitBytecode):
+        The tagged template string function call can be a tail call:
+        https://tc39.github.io/ecma262/#sec-tagged-templates-runtime-semantics-evaluation
+
+2016-09-14  Joseph Pecoraro  <[email protected]>
+
         test262: Array.prototype.slice should always set length
         https://bugs.webkit.org/show_bug.cgi?id=161953
 

Modified: trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp (205915 => 205916)


--- trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2016-09-14 17:44:31 UTC (rev 205915)
+++ trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2016-09-14 17:48:13 UTC (rev 205916)
@@ -343,7 +343,7 @@
     for (TemplateExpressionListNode* templateExpression = m_templateLiteral->templateExpressions(); templateExpression; templateExpression = templateExpression->next())
         generator.emitNode(callArguments.argumentRegister(argumentIndex++), templateExpression->value());
 
-    return generator.emitCall(generator.finalDestination(dst, tag.get()), tag.get(), expectedFunction, callArguments, divot(), divotStart(), divotEnd());
+    return generator.emitCallInTailPosition(generator.finalDestination(dst, tag.get()), tag.get(), expectedFunction, callArguments, divot(), divotStart(), divotEnd());
 }
 
 // ------------------------------ ArrayNode ------------------------------------
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to