In chapter 4 of the Zone JS primer the following is mentioned:

So far, we have discussed how zones are created, forked and how they maintain their state across asynchronous operations. Zones are nested at runtime in the same way that execution stack frames are nested (but usually with lower depth.) There is one zone which is special in the context of nesting, and it is the top most zone. When that zone exists the execution transitions from JavaScript to native host environment. (Another way of saying it is that when the top most execution stack frame exits the control is returned to the native code.) We will call topmost zone a Task.

To my knowledge, the call stack was flat (meaning there aren’t stack frames inside of stack frames), and the execution context is just the address of the last time the function was called for nested subroutines

Can someone provide some clarification as to what’s really going on in the v8 engine and what the difference is between a regular stack frame and an execution stack frame? Thanks

  • Which JavaScript engine are you talking about? I wouldn't expect e.g. Narcissus to work the same as IronJS or TruffleJavaScript to work the same as BESEN. I'm pretty sure the ECMAScript implementation on the Parrot VM has no stack at all, simply because the Parrot VM has no stack at all. Also, what is your definition of "nested stack frames" and are you 100% sure that your definition matches to author's definition? I know many people who would call the two stack frames created from one function calling another "nested", but I am not sure whether that is also your definition. – Jörg W Mittag Jul 31 at 14:00
  • @JörgWMittag I’ve updated my question to specifically say v8. I’m not sure, it’s the documentation for Zone JS that’s confusing me. I’ve never heard of a “nested stack frame” before, but the Wikipedia link I linked said that for any lexically nested procedure the call stack has a frame pointer to that specific one – p32094 Jul 31 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.