Skip to content

Commit

Permalink
src: remove preview for heap dump utilities
Browse files Browse the repository at this point in the history
At least `createHeapSnapshotStream()` and `triggerHeapSnapshot()`
do have side effects, and more importantly, they should not be
run transparently. Without this, typing e.g. `v8.getHeapSnapshot()`
into the REPL will result in a crash or infinite loop while the REPL
evaluates the expression for a preview.

PR-URL: #31570
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
addaleax authored and codebytere committed Feb 17, 2020
1 parent 2638110 commit 6d5c3cd
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/heap_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,9 @@ void Initialize(Local<Object> target,
void* priv) {
Environment* env = Environment::GetCurrent(context);

env->SetMethodNoSideEffect(target,
"buildEmbedderGraph",
BuildEmbedderGraph);
env->SetMethodNoSideEffect(target,
"triggerHeapSnapshot",
TriggerHeapSnapshot);
env->SetMethodNoSideEffect(target,
"createHeapSnapshotStream",
CreateHeapSnapshotStream);
env->SetMethod(target, "buildEmbedderGraph", BuildEmbedderGraph);
env->SetMethod(target, "triggerHeapSnapshot", TriggerHeapSnapshot);
env->SetMethod(target, "createHeapSnapshotStream", CreateHeapSnapshotStream);

// Create FunctionTemplate for HeapSnapshotStream
Local<FunctionTemplate> os = FunctionTemplate::New(env->isolate());
Expand Down

0 comments on commit 6d5c3cd

Please sign in to comment.