<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#c3">Comment # 3</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:ggaren@apple.com" title="Geoffrey Garen <ggaren@apple.com>"> <span class="fn">Geoffrey Garen</span></a>
</span></b>
<pre><span class="quote">> Does it work if you write your code this way:
>
> function decToZero(n) {
> if (n>0)
> return decToZero(n-1);
> return n;
> }</span >
decToZero#DYBUcA:[0x104588310->0x1045a37c0, NoneFunctionCall, 43]: 43 m_instructions; 344 bytes; 2 parameter(s); 16 callee register(s); 6 variable(s); scope at loc3
[ 0] enter
[ 1] get_scope loc3
[ 3] mov loc4, loc3
[ 6] jngreater arg1, Int32: 0(const0), 35(->41)
[ 10] resolve_scope loc10, loc3, decToZero(@id0), <GlobalVar>, 1, 0x1045dc0a0
[ 17] get_from_scope loc6, loc10, decToZero(@id0), 2049<ThrowIfNotFound|GlobalVar|NotInitialization>, 60435336 predicting None
[ 25] sub loc9, arg1, Int32: 1(const1) results: Result:<Int32> LHS ObservedType:<> RHS ObservedType:<> LHS ResultType:<0x3e> RHS ResultType:<0x3>
[ 30] call loc6, loc6, 2, 16 (this at loc10) status(Could Take Slow Path) Original; predicting None
[ 39] ret loc6
[ 41] ret arg1
Identifiers:
id0 = decToZero
Constants:
k0 = Int32: 0: in source as integer
k1 = Int32: 1: in source as integer
--> RangeError: Maximum call stack size exceeded.</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>