summaryrefslogtreecommitdiff
path: root/src/node_perf_common.h
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-04-21 12:47:32 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2020-07-18 11:15:57 +0800
commit1faf6f459f220bb67866f12b30626ef7856876ee (patch)
treed1308396c07e8289f8d987178c294141f4687889 /src/node_perf_common.h
parentf04538761f5bb3c334d3c8d16d093ac0916ff3bc (diff)
downloadnode-new-1faf6f459f220bb67866f12b30626ef7856876ee.tar.gz
src: snapshot Environment upon instantiation
This includes the initial Environment (without running bootstrap scripts) into the builtin snapshot PR-URL: https://github.com/nodejs/node/pull/32984 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Diffstat (limited to 'src/node_perf_common.h')
-rw-r--r--src/node_perf_common.h29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/node_perf_common.h b/src/node_perf_common.h
index 75d266afc2..6c4c98813e 100644
--- a/src/node_perf_common.h
+++ b/src/node_perf_common.h
@@ -8,6 +8,7 @@
#include "v8.h"
#include <algorithm>
+#include <iostream>
#include <map>
#include <string>
@@ -54,23 +55,17 @@ enum PerformanceEntryType {
class PerformanceState {
public:
- explicit PerformanceState(v8::Isolate* isolate) :
- root(
- isolate,
- sizeof(performance_state_internal)),
- milestones(
- isolate,
- offsetof(performance_state_internal, milestones),
- NODE_PERFORMANCE_MILESTONE_INVALID,
- root),
- observers(
- isolate,
- offsetof(performance_state_internal, observers),
- NODE_PERFORMANCE_ENTRY_TYPE_INVALID,
- root) {
- for (size_t i = 0; i < milestones.Length(); i++)
- milestones[i] = -1.;
- }
+ struct SerializeInfo {
+ AliasedBufferInfo root;
+ AliasedBufferInfo milestones;
+ AliasedBufferInfo observers;
+ };
+
+ explicit PerformanceState(v8::Isolate* isolate, const SerializeInfo* info);
+ SerializeInfo Serialize(v8::Local<v8::Context> context,
+ v8::SnapshotCreator* creator);
+ void Deserialize(v8::Local<v8::Context> context);
+ friend std::ostream& operator<<(std::ostream& o, const SerializeInfo& i);
AliasedUint8Array root;
AliasedFloat64Array milestones;