forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chakrashim: Fix bug in repl scenario
Earlier whenever repl was created (`node.exe` with zero parameters), global context was reused. However https://github.com/nodejs/node/ pull/5703 fixed it by creating new context for repl. This broke the chakrashim because the context was getting collected immediately. The reason was we were adding the reference of global context to the sandboxed object instead of newly created context. Fixed it by ensuring we add reference to right context. Also contextShim is always initialized when current context was pushed on the scope. However for scenarios like this, we might just create the context and access the objects like global, etc. of that context without going to push scope path. In that case ensure that things are initialized in the new context. But, @jianchun brought a good point offline of perf impact because of additional checks if context is initialized in getters. So I re-verified all the references of getters and noticed that all of them are called on ` ContextShim::GetCurrent()`. Context returned through this API is always the one that is set in PushScope/ PopScope code path, where we do initialize contextShim. Hence I have reverted `EnsureInitialize()` call in all the getters except ` GetProxyOfGlobal()`. Once nodejs#95 is fixed, this need to be revisited and `EnsureInitialized` will need to be added in getters that can be called from different context. PR-URL: nodejs/node-chakracore#96 Reviewed-By: Jianchun Xu <Jianchun.Xu@microsoft.com>
- Loading branch information
1 parent
11db4f2
commit 983c0b8
Showing
4 changed files
with
83 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters