Repository navigation
src: implement minimal v8 snapshot integration #27321
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
Changes from 1 commit
076c31f
e354795
de02be6
52c5c05
8248be6
3055cb1
2ac1d81
1e0210b
0324fe3
90b5d8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Allows instantiating a NodeMainInstance with an isolate whose initialization and disposal are controlled by the caller.
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -885,8 +885,12 @@ int Start(int argc, char** argv) { | |
| } | ||
|
|
||
| { | ||
| NodeMainInstance main_instance( | ||
| uv_default_loop(), result.args, result.exec_args); | ||
| Isolate::CreateParams params; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not move this bit into the NodeMainInstance main_instance({nullptr},
uv_default_loop(),
per_process::v8_platform.Platform(),
result.args,
result.exec_args);
...
NodeMainInstance main_instance(const std::vector<intptr_t> external_references&&,
uv_loop_t* event_loop,
MultiIsolatePlatform* platform,
const std::vector<std::string>& args,
const std::vector<std::string>& exec_args);
Isolate::CreateParams params;
v8::StartupData* blob = NodeMainInstance::GetEmbeddedSnapshotBlob();
const NodeMainInstance::IndexArray* indexes =
NodeMainInstance::GetIsolateDataIndexes();
if (blob != nullptr) {
params.external_references = external_references.data();
params.snapshot_blob = blob;
}
...
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking about moving the |
||
| NodeMainInstance main_instance(¶ms, | ||
| uv_default_loop(), | ||
| per_process::v8_platform.Platform(), | ||
| result.args, | ||
| result.exec_args); | ||
| result.exit_code = main_instance.Run(); | ||
| } | ||
|
|
||
|
|
||
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.
This is kind of a bad API (although it's not a public API so it matters less) in that order might be important but that's easy to get wrong for callers. A single call where you pass in an options bitmask would be more robust.
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.
For the APIs that are called here...I don't think the order actually matters for now? The only dangerous bit is that you could call with one category twice, but that's also true before this change.
I think the current categories is not good as final for sure, but I don't really know the use cases for this other than this patch, so we might as well polish it as we add more use cases (I tried to organize the setup a bit better in another cctest attempt before but that didn't really go anywhere).
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.
No, but as a caller I don't know that unless I (closely) read the function's source. It would just be a bit easier all around if I could just say "do this and that" without having to worry about order. Declarative vs. imperative if you will.
Uh oh!
There was an error while loading. Please reload this page.
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.
This is more like a temporary DRY thing here, when we figure out other use cases we could just tweak it for them, but it’s probably too early to spend time designing it. In the initial prototype I actually copy pasted this into SetIsolateUpForSnapshot() but it looked worse..