-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: use RAII to manage the main isolate data #27220
Conversation
isolate_ = | ||
NewIsolate(¶ms, event_loop, per_process::v8_platform.Platform()); | ||
CHECK_NOT_NULL(isolate_); | ||
isolate_data_.reset(CreateIsolateData(isolate_, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When implementing snapshot this needs to be changed to something like DeserializeIsolateData()
which uses GetDataFromSnapshotOnce()
(instead of doing e.g. String::NewFromOneByte
).
isolate_->GetHeapProfiler()->StartTrackingHeapObjects(true); | ||
} | ||
|
||
Local<Context> context = NewContext(isolate_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When implementing snapshot this needs to be changed to Context::FromSnapshot()
and skips RunBootstrapping()
below. The Environment
construction would also need to be changed in order to deserialize per-Environment data.
This patch encapsulates the main isolate management into a NodeMainInstance class that manages the resources with RAII and controls the Isolate::CreateParams (which is necessary for deserializing snapshots with external references)
*exit_code = 1; | ||
} | ||
|
||
return env; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it's existing behavior but *exit_code
isn't assigned on the happy path. It works because the caller sets it to zero before calling this method but still...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an out parameter so at least in my understanding it's fine to not override in the happy path (think of it as overriding an default, whichever the default might be). But I guess with the current implementation resetting it to 0 at the beginning does not hurt either..
Landed in cab1dc5 |
This patch encapsulates the main isolate management into a NodeMainInstance class that manages the resources with RAII and controls the Isolate::CreateParams (which is necessary for deserializing snapshots with external references) PR-URL: #27220 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
Refs: #27220 PR-URL: #27251 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: James M Snell <[email protected]>
This function was not actually available during any part of the Node 12 release line because it had been removed earlier (likely accidentally). Refs: nodejs#27220
This function was not actually available during any part of the Node 12 release line because it had been removed earlier (likely accidentally). Refs: #27220 PR-URL: #30098 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Jiawen Geng <[email protected]>
This function was not actually available during any part of the Node 12 release line because it had been removed earlier (likely accidentally). Refs: #27220 PR-URL: #30098 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Jiawen Geng <[email protected]>
This function was not actually available during any part of the Node 12 release line because it had been removed earlier (likely accidentally). Refs: #27220 PR-URL: #30098 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Jiawen Geng <[email protected]>
This function was not actually available during any part of the Node 12 release line because it had been removed earlier (likely accidentally). Refs: #27220 PR-URL: #30098 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Jiawen Geng <[email protected]>
This patch encapsulates the main isolate management into a
NodeMainInstance class that manages the resources with RAII
and controls the Isolate::CreateParams (which is necessary
for deserializing snapshots with external references)
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes