Skip to content

Commit

Permalink
Normative: phrase tail calls as discarding resources rather than popp…
Browse files Browse the repository at this point in the history
…ing execution context stack
  • Loading branch information
bakkot committed Aug 23, 2021
1 parent f72dd16 commit 9d7d735
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -18766,7 +18766,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 @@ -24905,10 +24904,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

0 comments on commit 9d7d735

Please sign in to comment.