Node Architecture: Is the libuv event loop open for V8?

At the end of this article (EventLoop section), it says that the libuv event loop is passed to V8. On first reading, it seems to be something like: The V8 browser has its own event loop, in Node it gets the value libuv. But then I started digging into the code and could not find evidence when the cycle is being transmitted to V8.

After several steps, StartNodeInstance leads to the creation of a new Environment . The constructor is passed in by the newly created V8 Context , which is created from V8 isolation, as well as a pointer to the default libuv loop.

Then the loop is passed to instantiate IsolateData . I could not find a hint that the loop was actually transmitted or registered on V8. It also Environment::Newbelongs to the V8 namespace, as stated at the end of the article above.

Isolation is an instance of the V8 virtual machine with its own heap. Context is a runtime environment that allows you to split, unrelated, JavaScript code to run in a single instance of V8. You must explicitly specify the context in which you want any JavaScript code to run.

+4
source share

All Articles