[Webkit-unassigned] [Bug 163663] RangeError with deep self recursion (Proper tail call)
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Oct 19 13:43:34 PDT 2016
https://bugs.webkit.org/show_bug.cgi?id=163663
--- Comment #4 from Filip Pizlo <fpizlo at apple.com> ---
(In reply to comment #3)
> > Does it work if you write your code this way:
> >
> > function decToZero(n) {
> > if (n>0)
> > return decToZero(n-1);
> > return n;
> > }
>
> 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.
I bet you forgot "use strict" at the top of the file, or inside decToZero.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20161019/7b4f24b5/attachment.html>
More information about the webkit-unassigned
mailing list