![]() We call the context of the function that is currently running (i.e., the context of the function that is on the top of the stack) a current context. When that function returns, the function is popped from the stack and the control returns to the caller function that is now on the top of the stack. When one function calls another function, the callee function is pushed onto the stack. The first stack is a stack of JavaScript functions. To understand the difference, you need to understand two kinds of runtime stacks. Here we have a concept of an entered context and a current context. In other words, the relationship between isolates and contexts is 1:N over the lifetime of the isolate. This means that the context associated with the isolate changes over time. One isolate has to execute JavaScripts in multiple frames, each of which has its own context. Entered context and current contextĪ relationship between isolates and contexts is interesting. ![]() Each context has its own global variable scope and prototype chains. In summary, each frame has a window object. log ( foo ) // undefined var bar = "aaaa". substr = function ( position, length ) Ĭonsole. Since these contexts create their own global variable scopes, global variables and prototype chains of the are isolated from the ones of the parent frame. So the context of the is different from the context of the parent frame. For example, has a window object different from a window object of its parent frame. Roughly speaking, one window object corresponds to one context. ContextĪ context is a concept of a global variable scope in V8. An exception is a compositor worker where one isolate is shared by multiple compositor workers. One isolate is associated with one worker thread. One isolate is associated with the main thread. In Blink, isolates and threads are in 1:1 relationship. A relationship between isolates, contexts, worlds and framesĪn isolate is a concept of an instance in V8. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |