Closed tudorms closed 2 years ago
isolate_->Enter();
In Chakra, we used to enter the VM on each methods in runtime and exit at the end of method .. With V8, it looks like the isolate stays bound to a single thread.. but we take a lock on each entry to a method, which i think ensures that the isolate is running something only in one thread ..
In V8, does it make sense to exit and enter the isolate on each entry point to the runtime ?
I hope other threads such as JIT/GC etc. are also respecting the locks ..
In reply to: 1273741990
Refers to: src/V8JsiRuntime.cpp:411 in 26bc84a. [](commit_id = 26bc84a567bcf3d005c59dd15bcb6d4c4c333b37, deletion_comment = False)
v8::Isolate *isolate = v8::Isolate::GetCurrent();
These methods can be called back during the remote-thread entry ? Does v8::Isolate::GetCurrent() return the correct isolate in that case ?
Refers to: src/V8JsiRuntime.cpp:69 in 26bc84a. [](commit_id = 26bc84a567bcf3d005c59dd15bcb6d4c4c333b37, deletion_comment = False)
isolate_->Enter();
We do Enter and Exit on each entry point (Isolate::Scope is just a RAII that does Enter / Exit). This is needed here for simple cases where you create the Isolate and immediately use it for something (for example a few unit tests will fail if we remove it).
In reply to: 1273741990
Refers to: src/V8JsiRuntime.cpp:411 in 26bc84a. [](commit_id = 26bc84a567bcf3d005c59dd15bcb6d4c4c333b37, deletion_comment = False)
v8::Isolate *isolate = v8::Isolate::GetCurrent();
I'm not sure this code is ever used. Tried setting enableMessageTracing = true but never hit this in the debugger.
In reply to: 1273743613
Refers to: src/V8JsiRuntime.cpp:69 in 26bc84a. [](commit_id = 26bc84a567bcf3d005c59dd15bcb6d4c4c333b37, deletion_comment = False)
It is a relatively big change. It would be nice to have an overview in the description of the PR.
Do we need a similar change for Node-API?
Added it now (a bit ugly due to the opaque napienv thing, let me know if there's a cleaner approach).
In reply to: 1273855892
Hello @tudorms!
Because this pull request has the auto merge
label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.
@msftbot
) and give me an instruction to get started! Learn more here.
null
Microsoft Reviewers: Open in CodeFlow