<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - RangeError with deep self recursion (Proper tail call)"
   href="https://bugs.webkit.org/show_bug.cgi?id=163663#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - RangeError with deep self recursion (Proper tail call)"
   href="https://bugs.webkit.org/show_bug.cgi?id=163663">bug 163663</a>
              from <span class="vcard"><a class="email" href="mailto:fpizlo&#64;apple.com" title="Filip Pizlo &lt;fpizlo&#64;apple.com&gt;"> <span class="fn">Filip Pizlo</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=163663#c3">comment #3</a>)
<span class="quote">&gt; &gt; Does it work if you write your code this way:
&gt; &gt; 
&gt; &gt; function decToZero(n) {
&gt; &gt;   if (n&gt;0)
&gt; &gt;     return decToZero(n-1);
&gt; &gt;   return n;
&gt; &gt; }
&gt; 
&gt; decToZero#DYBUcA:[0x104588310-&gt;0x1045a37c0, NoneFunctionCall, 43]: 43
&gt; m_instructions; 344 bytes; 2 parameter(s); 16 callee register(s); 6
&gt; variable(s); scope at loc3
&gt; [   0] enter             
&gt; [   1] get_scope         loc3
&gt; [   3] mov               loc4, loc3
&gt; [   6] jngreater         arg1, Int32: 0(const0), 35(-&gt;41)
&gt; [  10] resolve_scope     loc10, loc3, decToZero(&#64;id0), &lt;GlobalVar&gt;, 1,
&gt; 0x1045dc0a0
&gt; [  17] get_from_scope    loc6, loc10, decToZero(&#64;id0),
&gt; 2049&lt;ThrowIfNotFound|GlobalVar|NotInitialization&gt;, 60435336    predicting
&gt; None
&gt; [  25] sub               loc9, arg1, Int32: 1(const1)    results:
&gt; Result:&lt;Int32&gt; LHS ObservedType:&lt;&gt; RHS ObservedType:&lt;&gt; LHS ResultType:&lt;0x3e&gt;
&gt; RHS ResultType:&lt;0x3&gt;
&gt; [  30] call              loc6, loc6, 2, 16 (this at loc10) status(Could Take
&gt; Slow Path)    Original; predicting None
&gt; [  39] ret               loc6
&gt; [  41] ret               arg1
&gt; 
&gt; Identifiers:
&gt;   id0 = decToZero
&gt; 
&gt; Constants:
&gt;    k0 = Int32: 0: in source as integer
&gt;    k1 = Int32: 1: in source as integer
&gt; 
&gt; --&gt; RangeError: Maximum call stack size exceeded.</span >

I bet you forgot &quot;use strict&quot; at the top of the file, or inside decToZero.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>