Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normative: phrase tail calls as discarding resources rather than popping execution context stack #2495

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -18753,7 +18753,6 @@ <h1>
1. If IsCallable(_func_) is *false*, throw a *TypeError* exception.
1. If _tailPosition_ is *true*, perform PrepareForTailCall().
1. Let _result_ be Call(_func_, _thisValue_, _argList_).
1. Assert: If _tailPosition_ is *true*, the above call will not return here, but instead evaluation will continue as if the following return has already occurred.
1. Assert: If _result_ is not an abrupt completion, then Type(_result_) is an ECMAScript language type.
1. Return _result_.
</emu-alg>
Expand Down Expand Up @@ -24977,10 +24976,8 @@ <h1>PrepareForTailCall ( )</h1>
<dl class="header">
</dl>
<emu-alg>
1. Let _leafContext_ be the running execution context.
1. Suspend _leafContext_.
1. Pop _leafContext_ from the execution context stack. The execution context now on the top of the stack becomes the running execution context.
1. Assert: _leafContext_ has no further use. It will never be activated as the running execution context.
1. Assert: The current execution context will not subsequently be used for the evaluation of any ECMAScript code or built-in functions. The invocation of Call subsequent to the invocation of this abstract operation will create and push a new execution context before performing any such evaluation.
1. Discard all resources associated with the current execution context.
</emu-alg>
<p>A tail position call must either release any transient internal resources associated with the currently executing function execution context before invoking the target function or reuse those resources in support of the target function.</p>
<emu-note>
Expand Down