@@ -665,6 +665,16 @@ class ContextifyScript : public BaseObject {
665
665
ContextifyScript* contextify_script =
666
666
new ContextifyScript (env, args.This ());
667
667
668
+ if (*TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED (
669
+ TRACING_CATEGORY_NODE2 (vm, script)) != 0 ) {
670
+ Utf8Value fn (isolate, filename);
671
+ TRACE_EVENT_NESTABLE_ASYNC_BEGIN1 (
672
+ TRACING_CATEGORY_NODE2 (vm, script),
673
+ " ContextifyScript::New" ,
674
+ contextify_script,
675
+ " filename" , TRACE_STR_COPY (*fn));
676
+ }
677
+
668
678
ScriptCompiler::CachedData* cached_data = nullptr ;
669
679
if (!cached_data_buf.IsEmpty ()) {
670
680
ArrayBuffer::Contents contents = cached_data_buf->Buffer ()->GetContents ();
@@ -694,6 +704,10 @@ class ContextifyScript : public BaseObject {
694
704
DecorateErrorStack (env, try_catch);
695
705
no_abort_scope.Close ();
696
706
try_catch.ReThrow ();
707
+ TRACE_EVENT_NESTABLE_ASYNC_END0 (
708
+ TRACING_CATEGORY_NODE2 (vm, script),
709
+ " ContextifyScript::New" ,
710
+ contextify_script);
697
711
return ;
698
712
}
699
713
contextify_script->script_ .Reset (isolate, v8_script.ToLocalChecked ());
@@ -717,6 +731,10 @@ class ContextifyScript : public BaseObject {
717
731
env->cached_data_produced_string (),
718
732
Boolean::New (isolate, cached_data_produced));
719
733
}
734
+ TRACE_EVENT_NESTABLE_ASYNC_END0 (
735
+ TRACING_CATEGORY_NODE2 (vm, script),
736
+ " ContextifyScript::New" ,
737
+ contextify_script);
720
738
}
721
739
722
740
@@ -729,6 +747,12 @@ class ContextifyScript : public BaseObject {
729
747
static void RunInThisContext (const FunctionCallbackInfo<Value>& args) {
730
748
Environment* env = Environment::GetCurrent (args);
731
749
750
+ ContextifyScript* wrapped_script;
751
+ ASSIGN_OR_RETURN_UNWRAP (&wrapped_script, args.Holder ());
752
+
753
+ TRACE_EVENT_NESTABLE_ASYNC_BEGIN0 (
754
+ TRACING_CATEGORY_NODE2 (vm, script), " RunInThisContext" , wrapped_script);
755
+
732
756
CHECK_EQ (args.Length (), 3 );
733
757
734
758
CHECK (args[0 ]->IsNumber ());
@@ -742,11 +766,17 @@ class ContextifyScript : public BaseObject {
742
766
743
767
// Do the eval within this context
744
768
EvalMachine (env, timeout, display_errors, break_on_sigint, args);
769
+
770
+ TRACE_EVENT_NESTABLE_ASYNC_END0 (
771
+ TRACING_CATEGORY_NODE2 (vm, script), " RunInThisContext" , wrapped_script);
745
772
}
746
773
747
774
static void RunInContext (const FunctionCallbackInfo<Value>& args) {
748
775
Environment* env = Environment::GetCurrent (args);
749
776
777
+ ContextifyScript* wrapped_script;
778
+ ASSIGN_OR_RETURN_UNWRAP (&wrapped_script, args.Holder ());
779
+
750
780
CHECK_EQ (args.Length (), 4 );
751
781
752
782
CHECK (args[0 ]->IsObject ());
@@ -759,6 +789,9 @@ class ContextifyScript : public BaseObject {
759
789
if (contextify_context->context ().IsEmpty ())
760
790
return ;
761
791
792
+ TRACE_EVENT_NESTABLE_ASYNC_BEGIN0 (
793
+ TRACING_CATEGORY_NODE2 (vm, script), " RunInContext" , wrapped_script);
794
+
762
795
CHECK (args[1 ]->IsNumber ());
763
796
int64_t timeout = args[1 ]->IntegerValue (env->context ()).FromJust ();
764
797
@@ -775,6 +808,9 @@ class ContextifyScript : public BaseObject {
775
808
display_errors,
776
809
break_on_sigint,
777
810
args);
811
+
812
+ TRACE_EVENT_NESTABLE_ASYNC_END0 (
813
+ TRACING_CATEGORY_NODE2 (vm, script), " RunInContext" , wrapped_script);
778
814
}
779
815
780
816
static void DecorateErrorStack (Environment* env, const TryCatch& try_catch) {
0 commit comments