diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2019-04-20 17:18:34 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2019-04-23 11:26:07 +0800 |
commit | eb23b176d8c7122af6add5ee38f87044288d3d39 (patch) | |
tree | 46a5aa800eb31a0510254ee03dcd35ee2bbcf220 /tools | |
parent | bf5dadeef07250763948765e9902edd2ecee5448 (diff) | |
download | android-node-v8-eb23b176d8c7122af6add5ee38f87044288d3d39.tar.gz android-node-v8-eb23b176d8c7122af6add5ee38f87044288d3d39.tar.bz2 android-node-v8-eb23b176d8c7122af6add5ee38f87044288d3d39.zip |
src: enable context snapshot after running per-context scripts
At build time, snapshot the context after running per-context scripts
in the main instance, and in the final build, deserialize the
context in the main instance.
This provides a ~5% in the misc/startup benchmark when the instance
is launched within a process that runs test/fixtures/semicolon.js.
PR-URL: https://github.com/nodejs/node/pull/27321
Refs: https://github.com/nodejs/node/issues/17058
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/snapshot/snapshot_builder.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/snapshot/snapshot_builder.cc b/tools/snapshot/snapshot_builder.cc index d1ec17e302..835fca9f46 100644 --- a/tools/snapshot/snapshot_builder.cc +++ b/tools/snapshot/snapshot_builder.cc @@ -104,6 +104,9 @@ std::string SnapshotBuilder::Generate( HandleScope scope(isolate); creator.SetDefaultContext(Context::New(isolate)); isolate_data_indexes = main_instance->isolate_data()->Serialize(&creator); + + size_t index = creator.AddContext(NewContext(isolate)); + CHECK_EQ(index, NodeMainInstance::kNodeContextIndex); } // Must be out of HandleScope |