RESOLVED FIXED 161948
TaggedTemplateString function calls should emit tail position calls
https://bugs.webkit.org/show_bug.cgi?id=161948
Summary TaggedTemplateString function calls should emit tail position calls
Joseph Pecoraro
Reported 2016-09-13 22:53:16 PDT
Summary: TaggedTemplateString function calls should emit tail position calls. Test: <script> "use strict"; function tag() { debugger; return "test"; } function templateTagPath() { return tag`test`; } function testTemplateTagPath() { return templateTagPath(); } function normalPath() { return tag(); } function testNormalPath() { return normalPath(); } testNormalPath(); testTemplateTagPath(); </script> Steps to reproduce: 1. Inspect test page 2. Reload (to hit breakpoints) 3. First breakpoint is in normal function call path => normalPath and testNormalPath are shown to be tail deleted frames in the debugger sidebar 4. Continue 5. Second pause is in tagged template string function call path => testTemplateTagPath is shown to be tail deleted but templateTagPath is not. It should be! Spec: https://tc39.github.io/ecma262/#sec-tagged-templates-runtime-semantics-evaluation > MemberExpression:MemberExpressionTemplateLiteral > > 1. Let tagRef be the result of evaluating MemberExpression. > 2. Let thisCall be this MemberExpression. > 3. Let tailCall be IsInTailPosition(thisCall). > 4. Return ? EvaluateCall(tagRef, TemplateLiteral, tailCall). > > CallExpression:CallExpressionTemplateLiteral > > 1. Let tagRef be the result of evaluating CallExpression. > 2. Let thisCall be this CallExpression. > 3. Let tailCall be IsInTailPosition(thisCall). > 4. Return ? EvaluateCall(tagRef, TemplateLiteral, tailCall).
Attachments
[PATCH] Proposed Fix (2.93 KB, patch)
2016-09-14 01:26 PDT, Joseph Pecoraro
no flags
[PATCH] Proposed Fix (4.38 KB, patch)
2016-09-14 01:34 PDT, Joseph Pecoraro
no flags
Joseph Pecoraro
Comment 1 2016-09-14 00:35:08 PDT
Should be as simple as changing the emitCall to emitCallInTailPosition. I'm doing a build now.
Joseph Pecoraro
Comment 2 2016-09-14 01:25:59 PDT
This is tested by: test262/test/language/expressions/tagged-template/tco-call.js Not sure if I need to do anything about that. I'll just add to the existing simple test for checking tail calls.
Joseph Pecoraro
Comment 3 2016-09-14 01:26:41 PDT
Created attachment 288786 [details] [PATCH] Proposed Fix
Joseph Pecoraro
Comment 4 2016-09-14 01:28:47 PDT
Comment on attachment 288786 [details] [PATCH] Proposed Fix I should be able to update the test262.yaml if I can verify the single test succeeds now.
Joseph Pecoraro
Comment 5 2016-09-14 01:34:56 PDT
Created attachment 288787 [details] [PATCH] Proposed Fix
Yusuke Suzuki
Comment 6 2016-09-14 10:28:59 PDT
Comment on attachment 288787 [details] [PATCH] Proposed Fix r=me
WebKit Commit Bot
Comment 7 2016-09-14 10:50:20 PDT
Comment on attachment 288787 [details] [PATCH] Proposed Fix Clearing flags on attachment: 288787 Committed r205916: <http://trac.webkit.org/changeset/205916>
WebKit Commit Bot
Comment 8 2016-09-14 10:50:24 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.