From 018c3e8949e925efc8077801d44c2b2feb974750 Mon Sep 17 00:00:00 2001 From: Kirill Fomichev Date: Fri, 13 Sep 2019 17:25:31 +0300 Subject: perf_hooks: add property flags to GCPerformanceEntry PR-URL: https://github.com/nodejs/node/pull/29547 Reviewed-By: James M Snell Reviewed-By: Chengzhong Wu --- src/node_perf.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/node_perf.cc') diff --git a/src/node_perf.cc b/src/node_perf.cc index 0536c39f6c7..68b015f33ed 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -244,6 +244,10 @@ void PerformanceGCCallback(Environment* env, env->kind_string(), Integer::New(env->isolate(), entry->gckind()), attr).Check(); + obj->DefineOwnProperty(context, + env->flags_string(), + Integer::New(env->isolate(), entry->gcflags()), + attr).Check(); PerformanceEntry::Notify(env, entry->kind(), obj); } } @@ -270,6 +274,7 @@ void MarkGarbageCollectionEnd(Isolate* isolate, auto entry = std::make_unique( env, static_cast(type), + static_cast(flags), state->performance_last_gc_start_mark, PERFORMANCE_NOW()); env->SetUnrefImmediate([entry = std::move(entry)](Environment* env) mutable { @@ -587,6 +592,21 @@ void Initialize(Local target, NODE_DEFINE_CONSTANT(constants, NODE_PERFORMANCE_GC_INCREMENTAL); NODE_DEFINE_CONSTANT(constants, NODE_PERFORMANCE_GC_WEAKCB); + NODE_DEFINE_CONSTANT( + constants, NODE_PERFORMANCE_GC_FLAGS_NO); + NODE_DEFINE_CONSTANT( + constants, NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED); + NODE_DEFINE_CONSTANT( + constants, NODE_PERFORMANCE_GC_FLAGS_FORCED); + NODE_DEFINE_CONSTANT( + constants, NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING); + NODE_DEFINE_CONSTANT( + constants, NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE); + NODE_DEFINE_CONSTANT( + constants, NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY); + NODE_DEFINE_CONSTANT( + constants, NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE); + #define V(name, _) \ NODE_DEFINE_HIDDEN_CONSTANT(constants, NODE_PERFORMANCE_ENTRY_TYPE_##name); NODE_PERFORMANCE_ENTRY_TYPES(V) -- cgit v1.2.3