Skip to content

Commit

Permalink
deps: V8: cherry-pick 5d0cf6b
Browse files Browse the repository at this point in the history
Original commit message:

    [snapshot] Use Handle to track name in `CodeSerializer::Deserialize`

    The `Script::InitLineEnds(Handle<Script>(script, isolate));` line
    may lead to objects being moved around on the heap, so it’s necessary
    to use a `Handle` to track that.

    This was causing crashes in Node.js in Debug mode when using the
    code cache in combination with the CPU profiler.

    Refs: #27307
    Change-Id: I392b4c00c6ebad44753f87fcbf2e3278ea7799a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1575698
    Reviewed-by: Jakob Gruber <jgruber@chromium.org>
    Reviewed-by: Peter Marshall <petermarshall@chromium.org>
    Commit-Queue: Peter Marshall <petermarshall@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#61036}

Refs: v8/v8@5d0cf6b

PR-URL: #27423
Fixes: #27307
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
joyeecheung authored and targos committed Apr 29, 2019
1 parent 7d80999 commit 7c25dce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.16',
'v8_embedder_string': '-node.17',

##### V8 defaults for Node.js #####

Expand Down
13 changes: 7 additions & 6 deletions deps/v8/src/snapshot/code-serializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,12 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
Script script = Script::cast(result->script());
Handle<Script> script_handle(script, isolate);
if (script->name()->IsString()) name = String::cast(script->name());
Handle<String> name_handle(name, isolate);
if (FLAG_log_function_events) {
LOG(isolate,
FunctionEvent("deserialize", script->id(),
timer.Elapsed().InMillisecondsF(),
result->StartPosition(), result->EndPosition(), name));
LOG(isolate, FunctionEvent("deserialize", script->id(),
timer.Elapsed().InMillisecondsF(),
result->StartPosition(), result->EndPosition(),
*name_handle));
}
if (log_code_creation) {
Script::InitLineEnds(Handle<Script>(script, isolate));
Expand All @@ -274,8 +275,8 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
int line_num = script->GetLineNumber(info->StartPosition()) + 1;
int column_num = script->GetColumnNumber(info->StartPosition()) + 1;
PROFILE(isolate, CodeCreateEvent(CodeEventListener::SCRIPT_TAG,
info->abstract_code(), info, name,
line_num, column_num));
info->abstract_code(), info,
*name_handle, line_num, column_num));
}
}
}
Expand Down

0 comments on commit 7c25dce

Please sign in to comment.