Skip to content

Commit

Permalink
deps: cherry-pick 2363cdf from upstream V8
Browse files Browse the repository at this point in the history
Original commit message:

    [tracing] do not add traces when disabled

    nodejs#21038

    Change-Id: Ic4c9f403b5e54a97d3170b2311dd5aab8c8357c8
    Reviewed-on: https://chromium-review.googlesource.com/1217726
    Commit-Queue: Ali Ijaz Sheikh <ofrobots@google.com>
    Reviewed-by: Yang Guo <yangguo@chromium.org>
    Cr-Commit-Position: refs/heads/master@{nodejs#55809}

Refs: v8/v8@2363cdf
  • Loading branch information
targos committed Sep 22, 2018
1 parent 08f21fc commit 062dfd5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,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.1',
'v8_embedder_string': '-node.2',

# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,
Expand Down
32 changes: 18 additions & 14 deletions deps/v8/src/libplatform/tracing/tracing-controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,15 @@ uint64_t TracingController::AddTraceEvent(
const uint64_t* arg_values,
std::unique_ptr<v8::ConvertableToTraceFormat>* arg_convertables,
unsigned int flags) {
uint64_t handle;
TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle);
if (trace_object) {
trace_object->Initialize(
phase, category_enabled_flag, name, scope, id, bind_id, num_args,
arg_names, arg_types, arg_values, arg_convertables, flags,
CurrentTimestampMicroseconds(), CurrentCpuTimestampMicroseconds());
uint64_t handle = 0;
if (mode_ != DISABLED) {
TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle);
if (trace_object) {
trace_object->Initialize(
phase, category_enabled_flag, name, scope, id, bind_id, num_args,
arg_names, arg_types, arg_values, arg_convertables, flags,
CurrentTimestampMicroseconds(), CurrentCpuTimestampMicroseconds());
}
}
return handle;
}
Expand All @@ -95,13 +97,15 @@ uint64_t TracingController::AddTraceEventWithTimestamp(
const uint64_t* arg_values,
std::unique_ptr<v8::ConvertableToTraceFormat>* arg_convertables,
unsigned int flags, int64_t timestamp) {
uint64_t handle;
TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle);
if (trace_object) {
trace_object->Initialize(phase, category_enabled_flag, name, scope, id,
bind_id, num_args, arg_names, arg_types,
arg_values, arg_convertables, flags, timestamp,
CurrentCpuTimestampMicroseconds());
uint64_t handle = 0;
if (mode_ != DISABLED) {
TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle);
if (trace_object) {
trace_object->Initialize(phase, category_enabled_flag, name, scope, id,
bind_id, num_args, arg_names, arg_types,
arg_values, arg_convertables, flags, timestamp,
CurrentCpuTimestampMicroseconds());
}
}
return handle;
}
Expand Down

0 comments on commit 062dfd5

Please sign in to comment.