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 <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
addaleax authored and codebytere committed Mar 30, 2020
1 parent b2e571e commit 9c9dc4b
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 9c9dc4b

Please sign in to comment.