Commit ca217776 authored by Sami Kyostila's avatar Sami Kyostila Committed by Commit Bot

[tracing] Remove id mangling

Remove trace id mangling since it's been deprecated (and is also being
removed) in Chromium [1] and the actual id mangling operation was never
implemented in V8's version.

This patch doesn't introduce the upstream replacement
(TRACE_ID_{LOCAL,GLOBAL}), since nothing in V8 needs it and it'll be
shortly brought in with the transition to the Perfetto client library[2].

Bug: chromium:639003

[1] crbug.com/639003
[2] https://docs.google.com/document/d/1f7tt4cb-JcA5bQFR1oXk60ncJPpkL02_Hi_Bc6MfTQk/

Change-Id: Ifabda63b9c56918fafcc24dfc589b8e513a3f29b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2016592
Commit-Queue: Sami Kyöstilä <skyostil@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Auto-Submit: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65946}
parent 7d140328
......@@ -38,14 +38,6 @@ enum CategoryGroupEnabledFlags {
// and will not be copied. Use this macro to force a const char* to be copied.
#define TRACE_STR_COPY(str) v8::internal::tracing::TraceStringWithCopy(str)
// By default, uint64 ID argument values are not mangled with the Process ID in
// TRACE_EVENT_ASYNC macros. Use this macro to force Process ID mangling.
#define TRACE_ID_MANGLE(id) v8::internal::tracing::TraceID::ForceMangle(id)
// By default, pointers are mangled with the Process ID in TRACE_EVENT_ASYNC
// macros. Use this macro to prevent Process ID mangling.
#define TRACE_ID_DONT_MANGLE(id) v8::internal::tracing::TraceID::DontMangle(id)
// By default, trace IDs are eventually converted to a single 64-bit number. Use
// this macro to add a scope string.
#define TRACE_ID_WITH_SCOPE(scope, id) \
......@@ -303,9 +295,7 @@ class TraceEventHelper {
V8_EXPORT_PRIVATE static v8::TracingController* GetTracingController();
};
// TraceID encapsulates an ID that can either be an integer or pointer. Pointers
// are by default mangled with the Process ID so that they are unlikely to
// collide when the same pointer is used on different processes.
// TraceID encapsulates an ID that can either be an integer or pointer.
class TraceID {
public:
class WithScope {
......@@ -320,59 +310,8 @@ class TraceID {
uint64_t raw_id_;
};
class DontMangle {
public:
explicit DontMangle(const void* raw_id)
: raw_id_(static_cast<uint64_t>(reinterpret_cast<uintptr_t>(raw_id))) {}
explicit DontMangle(uint64_t raw_id) : raw_id_(raw_id) {}
explicit DontMangle(unsigned int raw_id) : raw_id_(raw_id) {}
explicit DontMangle(uint16_t raw_id) : raw_id_(raw_id) {}
explicit DontMangle(unsigned char raw_id) : raw_id_(raw_id) {}
explicit DontMangle(int64_t raw_id)
: raw_id_(static_cast<uint64_t>(raw_id)) {}
explicit DontMangle(int raw_id) : raw_id_(static_cast<uint64_t>(raw_id)) {}
explicit DontMangle(int16_t raw_id)
: raw_id_(static_cast<uint64_t>(raw_id)) {}
explicit DontMangle(signed char raw_id)
: raw_id_(static_cast<uint64_t>(raw_id)) {}
explicit DontMangle(WithScope scoped_id)
: scope_(scoped_id.scope()), raw_id_(scoped_id.raw_id()) {}
const char* scope() const { return scope_; }
uint64_t raw_id() const { return raw_id_; }
private:
const char* scope_ = nullptr;
uint64_t raw_id_;
};
class ForceMangle {
public:
explicit ForceMangle(uint64_t raw_id) : raw_id_(raw_id) {}
explicit ForceMangle(unsigned int raw_id) : raw_id_(raw_id) {}
explicit ForceMangle(uint16_t raw_id) : raw_id_(raw_id) {}
explicit ForceMangle(unsigned char raw_id) : raw_id_(raw_id) {}
explicit ForceMangle(int64_t raw_id)
: raw_id_(static_cast<uint64_t>(raw_id)) {}
explicit ForceMangle(int raw_id) : raw_id_(static_cast<uint64_t>(raw_id)) {}
explicit ForceMangle(int16_t raw_id)
: raw_id_(static_cast<uint64_t>(raw_id)) {}
explicit ForceMangle(signed char raw_id)
: raw_id_(static_cast<uint64_t>(raw_id)) {}
uint64_t raw_id() const { return raw_id_; }
private:
uint64_t raw_id_;
};
TraceID(const void* raw_id, unsigned int* flags)
: raw_id_(static_cast<uint64_t>(reinterpret_cast<uintptr_t>(raw_id))) {
*flags |= TRACE_EVENT_FLAG_MANGLE_ID;
}
TraceID(ForceMangle raw_id, unsigned int* flags) : raw_id_(raw_id.raw_id()) {
*flags |= TRACE_EVENT_FLAG_MANGLE_ID;
}
TraceID(DontMangle maybe_scoped_id, unsigned int* flags)
: scope_(maybe_scoped_id.scope()), raw_id_(maybe_scoped_id.raw_id()) {}
: raw_id_(static_cast<uint64_t>(reinterpret_cast<uintptr_t>(raw_id))) {}
TraceID(uint64_t raw_id, unsigned int* flags) : raw_id_(raw_id) {
(void)flags;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment