I have a simple program that defines the Ackermann function in JavaScript:
function ack(m,n,p){
    if(p==0) return m+n;
    if(n==0&&p==1) return 0;
    if(n==0&&p==2) return 1;
    if(n==0&&p>2) return m;
    return ack(m,ack(m,n-1,p),p-1)
}
as defined by here, for the purposes of evaluating tetration and higher extensions. This works for the adding of integers, as:
ack(m,n,0);
Multiplication:
ack(m,n,1);
Expontiation:
ack(m,n,2);
And, Tetration:
ack(m,n,3);
This attempt fails at values m, n > 2, throwing: InternalError: too much recursion. I know this typically occurs with non-terminating recursive functions (like var inf_rec = x => inf_rec(x)), but this function does terminate.
Question
Is there any way to bypass the InternalError?
Edit
What should I do instead, since I obviously need a deeper cell stack?
 
     
     
     
    