You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you call "setInstructionObserverThreshold," it just inserts code that
calls Context.observeInstructionCount() every N instructions. The default
implementation of that function does nothing.
If you want to actually do something like throw an exception, then you need
to create a subclass of Context and override that method:
(Typically you do this by overriding ContextFactory to create your own
subclass of Context.)
Then, whatever exception you throw will percolate up to the caller.
Finally, I am pretty sure that "MaximumInterpreterStackDepth" only affects
the code if you are running in interpreted mode, which would only happen if
you explicitly called "setOptimizationLevel" to set the level to -1. The
default is 0, so the code is compiled.
On Tue, Apr 21, 2015 at 9:12 AM, EnricoScoda [email protected]
wrote:
The following code:
var c = function() {
return c.call();
}
c();
doesn't stop even if I limit recursion and block code after 10 seconds
using instruction observer:
cx.setInstructionObserverThreshold(10000);
// limit recursion...
cx.setMaximumInterpreterStackDepth(1000);
—
Reply to this email directly or view it on GitHub #175.
Hi Greg,
what you describe is implemented in my code and works pretty well in common cases (long evaluations or deep recursions). I played more with it. The following throws "Exceeded maximum stack depth":
varc=function(){c();}c();
instead this one goes on forever:
varc=function(){returnc();}c();
I can provide you my extended ContextFactory and my extended Context, I you like.
Thanks a lot for the quick response,
Enrico
The following code:
doesn't stop even if I limit recursion and block code after 10 seconds using instruction observer:
The text was updated successfully, but these errors were encountered: