Commit 8934994e authored by machenbach's avatar machenbach Committed by Commit bot

Revert of Add Scoped Context Info (Isolate) to V8 Traces (patchset #5 id:80001...

Revert of Add Scoped Context Info (Isolate) to V8 Traces (patchset #5 id:80001 of https://codereview.chromium.org/1686233002/ )

Reason for revert:
[Sheriff] Breaks arm cross-compile:
https://build.chromium.org/p/client.v8/builders/V8%20Arm%20-%20debug%20builder/builds/7825/

Original issue's description:
> Add Scoped Context Info (Isolate) to V8 Traces
>
> This patch adds the newly added support for contexts in V8 Tracing, as well
> as use it to mark all the entry points for a V8 Isolate.
>
> BUG=v8:4565
> LOG=N
>
> Committed: https://crrev.com/44823c3c6965966c63b7e2e2361d0f2a58d196ea
> Cr-Commit-Position: refs/heads/master@{#34092}

TBR=jochen@chromium.org,fmeawad@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:4565

Review URL: https://codereview.chromium.org/1710573002

Cr-Commit-Position: refs/heads/master@{#34095}
parent 528bb4b9
......@@ -150,20 +150,6 @@ class Platform {
* used by the trace macros. The returned handle can be used by
* UpdateTraceEventDuration to update the duration of COMPLETE events.
*/
virtual uint64_t AddTraceEvent(
char phase, const uint8_t* category_enabled_flag, const char* name,
const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args,
const char** arg_names, const uint8_t* arg_types,
const uint64_t* arg_values, unsigned int flags) {
return AddTraceEvent(phase, category_enabled_flag, name, id, bind_id,
num_args, arg_names, arg_types, arg_values, flags);
}
/**
* This method will soon be depreacted in favor of the version with the 'const
* char* scope' parameter. If you do not already override this method, please
* implement the other version instead.
*/
virtual uint64_t AddTraceEvent(
char phase, const uint8_t* category_enabled_flag, const char* name,
uint64_t id, uint64_t bind_id, int32_t num_args, const char** arg_names,
......
......@@ -58,7 +58,6 @@
#include "src/snapshot/natives.h"
#include "src/snapshot/snapshot.h"
#include "src/startup-data-util.h"
#include "src/tracing/trace-event.h"
#include "src/unicode-inl.h"
#include "src/v8.h"
#include "src/v8threads.h"
......@@ -80,7 +79,6 @@ namespace v8 {
if (IsExecutionTerminatingCheck(isolate)) { \
return bailout_value; \
} \
TRACE_EVENT_SCOPED_CONTEXT("v8", "Isolate", isolate); \
HandleScopeClass handle_scope(isolate); \
CallDepthScope call_depth_scope(isolate, context, do_callback); \
LOG_API(isolate, function_name); \
......@@ -197,7 +195,6 @@ class CallDepthScope {
static ScriptOrigin GetScriptOriginForScript(i::Isolate* isolate,
i::Handle<i::Script> script) {
TRACE_EVENT_SCOPED_CONTEXT("v8", "Isolate", isolate);
i::Handle<i::Object> scriptName(i::Script::GetNameOrSourceURL(script));
i::Handle<i::Object> source_map_url(script->source_mapping_url(), isolate);
v8::Isolate* v8_isolate =
......@@ -376,7 +373,6 @@ StartupData V8::CreateSnapshotDataBlob(const char* custom_source) {
ArrayBufferAllocator allocator;
internal_isolate->set_array_buffer_allocator(&allocator);
Isolate* isolate = reinterpret_cast<Isolate*>(internal_isolate);
TRACE_EVENT_SCOPED_CONTEXT("v8", "Isolate", isolate);
StartupData result = {NULL, 0};
{
base::ElapsedTimer timer;
......@@ -1854,7 +1850,6 @@ MaybeLocal<Script> ScriptCompiler::CompileModule(Local<Context> context,
CompileOptions options) {
CHECK(i::FLAG_harmony_modules);
auto isolate = context->GetIsolate();
TRACE_EVENT_SCOPED_CONTEXT("V8", "Isolate", isolate);
auto maybe = CompileUnboundInternal(isolate, source, options, true);
Local<UnboundScript> generic;
if (!maybe.ToLocal(&generic)) return MaybeLocal<Script>();
......@@ -2281,7 +2276,6 @@ void v8::TryCatch::SetCaptureMessage(bool value) {
Local<String> Message::Get() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
TRACE_EVENT_SCOPED_CONTEXT("v8", "Isolate", isolate);
ENTER_V8(isolate);
EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Handle<i::Object> obj = Utils::OpenHandle(this);
......@@ -2308,7 +2302,6 @@ v8::Local<Value> Message::GetScriptResourceName() const {
v8::Local<v8::StackTrace> Message::GetStackTrace() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
TRACE_EVENT_SCOPED_CONTEXT("v8", "Isolate", isolate);
ENTER_V8(isolate);
EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
auto message = i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
......@@ -5517,7 +5510,6 @@ Local<Context> v8::Context::New(v8::Isolate* external_isolate,
v8::Local<ObjectTemplate> global_template,
v8::Local<Value> global_object) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate);
TRACE_EVENT_SCOPED_CONTEXT("v8", "Isolate", isolate);
LOG_API(isolate, "Context::New");
i::HandleScope scope(isolate);
ExtensionConfiguration no_extensions;
......@@ -7156,7 +7148,6 @@ Isolate* Isolate::GetCurrent() {
Isolate* Isolate::New(const Isolate::CreateParams& params) {
i::Isolate* isolate = new i::Isolate(false);
Isolate* v8_isolate = reinterpret_cast<Isolate*>(isolate);
TRACE_EVENT_SCOPED_CONTEXT("v8", "Isolate", isolate);
CHECK(params.array_buffer_allocator != NULL);
isolate->set_array_buffer_allocator(params.array_buffer_allocator);
if (params.snapshot_blob != NULL) {
......
......@@ -137,8 +137,8 @@ class PredictablePlatform : public Platform {
}
uint64_t AddTraceEvent(char phase, const uint8_t* categoryEnabledFlag,
const char* name, const char* scope, uint64_t id,
uint64_t bind_id, int numArgs, const char** argNames,
const char* name, uint64_t id, uint64_t bind_id,
int numArgs, const char** argNames,
const uint8_t* argTypes, const uint64_t* argValues,
unsigned int flags) override {
return 0;
......
......@@ -172,9 +172,8 @@ double DefaultPlatform::MonotonicallyIncreasingTime() {
uint64_t DefaultPlatform::AddTraceEvent(
char phase, const uint8_t* category_enabled_flag, const char* name,
const char* scope, uint64_t id, uint64_t bind_id, int num_args,
const char** arg_names, const uint8_t* arg_types,
const uint64_t* arg_values, unsigned int flags) {
uint64_t id, uint64_t bind_id, int num_args, const char** arg_names,
const uint8_t* arg_types, const uint64_t* arg_values, unsigned int flags) {
return 0;
}
......
......@@ -47,10 +47,9 @@ class DefaultPlatform : public Platform {
const char* GetCategoryGroupName(
const uint8_t* category_enabled_flag) override;
uint64_t AddTraceEvent(char phase, const uint8_t* category_enabled_flag,
const char* name, const char* scope, uint64_t id,
uint64_t bind_id, int32_t num_args,
const char** arg_names, const uint8_t* arg_types,
const uint64_t* arg_values,
const char* name, uint64_t id, uint64_t bind_id,
int32_t num_args, const char** arg_names,
const uint8_t* arg_types, const uint64_t* arg_values,
unsigned int flags) override;
void UpdateTraceEventDuration(const uint8_t* category_enabled_flag,
const char* name, uint64_t handle) override;
......
......@@ -38,9 +38,6 @@ void Logger::CallEventLogger(Isolate* isolate, const char* name, StartEnd se,
isolate->event_logger()(name, se);
}
}
// We make 2 different macro calls instead of precalculating the category
// name because the category enabled status is cached based on its line no.
if (expose_to_api) {
if (se == START) {
TRACE_EVENT_BEGIN0("v8", name);
......
......@@ -10,7 +10,6 @@
#include "base/trace_event/common/trace_event_common.h"
#include "include/v8-platform.h"
#include "src/base/atomicops.h"
#include "src/base/macros.h"
// This header file defines implementation details of how the trace macros in
// trace_event_common.h collect and store trace events. Anything not
......@@ -43,11 +42,6 @@ enum CategoryGroupEnabledFlags {
// 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) \
trace_event_internal::TraceID::WithScope(scope, id)
// Sets the current sample state to the given category and name (both must be
// constant strings). These states are intended for a sampling profiler.
// Implementation note: we store category and name together because we don't
......@@ -112,7 +106,6 @@ enum CategoryGroupEnabledFlags {
// char phase,
// const uint8_t* category_group_enabled,
// const char* name,
// const char* scope,
// uint64_t id,
// uint64_t bind_id,
// int num_args,
......@@ -188,8 +181,8 @@ extern TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3];
if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \
v8::internal::tracing::AddTraceEvent( \
phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, \
v8::internal::tracing::kNoId, flags, ##__VA_ARGS__); \
v8::internal::tracing::kNoId, v8::internal::tracing::kNoId, flags, \
##__VA_ARGS__); \
} \
} while (0)
......@@ -203,8 +196,8 @@ extern TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3];
uint64_t h = v8::internal::tracing::AddTraceEvent( \
TRACE_EVENT_PHASE_COMPLETE, \
INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, \
v8::internal::tracing::kNoId, TRACE_EVENT_FLAG_NONE, ##__VA_ARGS__); \
v8::internal::tracing::kNoId, v8::internal::tracing::kNoId, \
TRACE_EVENT_FLAG_NONE, ##__VA_ARGS__); \
INTERNAL_TRACE_EVENT_UID(tracer) \
.Initialize(INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
h); \
......@@ -221,8 +214,8 @@ extern TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3];
uint64_t h = v8::internal::tracing::AddTraceEvent( \
TRACE_EVENT_PHASE_COMPLETE, \
INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, \
trace_event_bind_id.raw_id(), trace_event_flags, ##__VA_ARGS__); \
v8::internal::tracing::kNoId, trace_event_bind_id.data(), \
trace_event_flags, ##__VA_ARGS__); \
INTERNAL_TRACE_EVENT_UID(tracer) \
.Initialize(INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
h); \
......@@ -240,8 +233,8 @@ extern TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3];
&trace_event_flags); \
v8::internal::tracing::AddTraceEvent( \
phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
trace_event_trace_id.scope(), trace_event_trace_id.raw_id(), \
v8::internal::tracing::kNoId, trace_event_flags, ##__VA_ARGS__); \
trace_event_trace_id.data(), v8::internal::tracing::kNoId, \
trace_event_flags, ##__VA_ARGS__); \
} \
} while (0)
......@@ -261,27 +254,6 @@ extern TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3];
phase, category_group, name, id, thread_id, timestamp, flags, ...) \
UNIMPLEMENTED()
// Enter and leave a context based on the current scope.
#define INTERNAL_TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context) \
struct INTERNAL_TRACE_EVENT_UID(ScopedContext) { \
public: \
INTERNAL_TRACE_EVENT_UID(ScopedContext)(uint64_t cid) : cid_(cid) { \
TRACE_EVENT_ENTER_CONTEXT(category_group, name, cid_); \
} \
~INTERNAL_TRACE_EVENT_UID(ScopedContext)() { \
TRACE_EVENT_LEAVE_CONTEXT(category_group, name, cid_); \
} \
\
private: \
/* Local class friendly DISALLOW_COPY_AND_ASSIGN */ \
INTERNAL_TRACE_EVENT_UID(ScopedContext) \
(const INTERNAL_TRACE_EVENT_UID(ScopedContext)&) {} \
void operator=(const INTERNAL_TRACE_EVENT_UID(ScopedContext)&) {} \
uint64_t cid_; \
}; \
INTERNAL_TRACE_EVENT_UID(ScopedContext) \
INTERNAL_TRACE_EVENT_UID(scoped_context)(context.raw_id());
namespace v8 {
namespace internal {
namespace tracing {
......@@ -289,7 +261,6 @@ namespace tracing {
// Specify these values when the corresponding argument of AddTraceEvent is not
// used.
const int kZeroNumArgs = 0;
const decltype(nullptr) kGlobalScope = nullptr;
const uint64_t kNoId = 0;
class TraceEventHelper {
......@@ -302,108 +273,70 @@ class TraceEventHelper {
// collide when the same pointer is used on different processes.
class TraceID {
public:
class WithScope {
public:
WithScope(const char* scope, uint64_t raw_id)
: scope_(scope), raw_id_(raw_id) {}
uint64_t raw_id() const { return raw_id_; }
const char* scope() const { return scope_; }
private:
const char* scope_ = nullptr;
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_; }
explicit DontMangle(const void* id)
: data_(static_cast<uint64_t>(reinterpret_cast<uintptr_t>(id))) {}
explicit DontMangle(uint64_t id) : data_(id) {}
explicit DontMangle(unsigned int id) : data_(id) {}
explicit DontMangle(uint16_t id) : data_(id) {}
explicit DontMangle(unsigned char id) : data_(id) {}
explicit DontMangle(int64_t id) : data_(static_cast<uint64_t>(id)) {}
explicit DontMangle(int id) : data_(static_cast<uint64_t>(id)) {}
explicit DontMangle(int16_t id) : data_(static_cast<uint64_t>(id)) {}
explicit DontMangle(signed char id) : data_(static_cast<uint64_t>(id)) {}
uint64_t data() const { return data_; }
private:
const char* scope_ = nullptr;
uint64_t raw_id_;
uint64_t data_;
};
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_; }
explicit ForceMangle(uint64_t id) : data_(id) {}
explicit ForceMangle(unsigned int id) : data_(id) {}
explicit ForceMangle(uint16_t id) : data_(id) {}
explicit ForceMangle(unsigned char id) : data_(id) {}
explicit ForceMangle(int64_t id) : data_(static_cast<uint64_t>(id)) {}
explicit ForceMangle(int id) : data_(static_cast<uint64_t>(id)) {}
explicit ForceMangle(int16_t id) : data_(static_cast<uint64_t>(id)) {}
explicit ForceMangle(signed char id) : data_(static_cast<uint64_t>(id)) {}
uint64_t data() const { return data_; }
private:
uint64_t raw_id_;
uint64_t data_;
};
TraceID(const void* raw_id, unsigned int* flags)
: raw_id_(static_cast<uint64_t>(reinterpret_cast<uintptr_t>(raw_id))) {
TraceID(const void* id, unsigned int* flags)
: data_(static_cast<uint64_t>(reinterpret_cast<uintptr_t>(id))) {
*flags |= TRACE_EVENT_FLAG_MANGLE_ID;
}
TraceID(ForceMangle raw_id, unsigned int* flags) : raw_id_(raw_id.raw_id()) {
TraceID(ForceMangle id, unsigned int* flags) : data_(id.data()) {
*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()) {}
TraceID(uint64_t raw_id, unsigned int* flags) : raw_id_(raw_id) {
TraceID(DontMangle id, unsigned int* flags) : data_(id.data()) {}
TraceID(uint64_t id, unsigned int* flags) : data_(id) { (void)flags; }
TraceID(unsigned int id, unsigned int* flags) : data_(id) { (void)flags; }
TraceID(uint16_t id, unsigned int* flags) : data_(id) { (void)flags; }
TraceID(unsigned char id, unsigned int* flags) : data_(id) { (void)flags; }
TraceID(int64_t id, unsigned int* flags) : data_(static_cast<uint64_t>(id)) {
(void)flags;
}
TraceID(unsigned int raw_id, unsigned int* flags) : raw_id_(raw_id) {
TraceID(int id, unsigned int* flags) : data_(static_cast<uint64_t>(id)) {
(void)flags;
}
TraceID(uint16_t raw_id, unsigned int* flags) : raw_id_(raw_id) {
TraceID(int16_t id, unsigned int* flags) : data_(static_cast<uint64_t>(id)) {
(void)flags;
}
TraceID(unsigned char raw_id, unsigned int* flags) : raw_id_(raw_id) {
TraceID(signed char id, unsigned int* flags)
: data_(static_cast<uint64_t>(id)) {
(void)flags;
}
TraceID(int64_t raw_id, unsigned int* flags)
: raw_id_(static_cast<uint64_t>(raw_id)) {
(void)flags;
}
TraceID(int raw_id, unsigned int* flags)
: raw_id_(static_cast<uint64_t>(raw_id)) {
(void)flags;
}
TraceID(int16_t raw_id, unsigned int* flags)
: raw_id_(static_cast<uint64_t>(raw_id)) {
(void)flags;
}
TraceID(signed char raw_id, unsigned int* flags)
: raw_id_(static_cast<uint64_t>(raw_id)) {
(void)flags;
}
TraceID(WithScope scoped_id, unsigned int* flags)
: scope_(scoped_id.scope()), raw_id_(scoped_id.raw_id()) {}
uint64_t raw_id() const { return raw_id_; }
const char* scope() const { return scope_; }
uint64_t data() const { return data_; }
private:
const char* scope_ = nullptr;
uint64_t raw_id_;
uint64_t data_;
};
// Simple union to store various types as uint64_t.
......@@ -474,33 +407,34 @@ INTERNAL_DECLARE_SET_TRACE_VALUE(const TraceStringWithCopy&, as_string,
static V8_INLINE uint64_t AddTraceEvent(char phase,
const uint8_t* category_group_enabled,
const char* name, const char* scope,
uint64_t id, uint64_t bind_id,
unsigned int flags) {
const char* name, uint64_t id,
uint64_t bind_id, unsigned int flags) {
return TRACE_EVENT_API_ADD_TRACE_EVENT(phase, category_group_enabled, name,
scope, id, bind_id, kZeroNumArgs, NULL,
NULL, NULL, flags);
id, bind_id, kZeroNumArgs, NULL, NULL,
NULL, flags);
}
template <class ARG1_TYPE>
static V8_INLINE uint64_t AddTraceEvent(
char phase, const uint8_t* category_group_enabled, const char* name,
const char* scope, uint64_t id, uint64_t bind_id, unsigned int flags,
const char* arg1_name, const ARG1_TYPE& arg1_val) {
static V8_INLINE uint64_t AddTraceEvent(char phase,
const uint8_t* category_group_enabled,
const char* name, uint64_t id,
uint64_t bind_id, unsigned int flags,
const char* arg1_name,
const ARG1_TYPE& arg1_val) {
const int num_args = 1;
uint8_t arg_types[1];
uint64_t arg_values[1];
SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]);
return TRACE_EVENT_API_ADD_TRACE_EVENT(
phase, category_group_enabled, name, scope, id, bind_id, num_args,
&arg1_name, arg_types, arg_values, flags);
return TRACE_EVENT_API_ADD_TRACE_EVENT(phase, category_group_enabled, name,
id, bind_id, num_args, &arg1_name,
arg_types, arg_values, flags);
}
template <class ARG1_TYPE, class ARG2_TYPE>
static V8_INLINE uint64_t AddTraceEvent(
char phase, const uint8_t* category_group_enabled, const char* name,
const char* scope, uint64_t id, uint64_t bind_id, unsigned int flags,
const char* arg1_name, const ARG1_TYPE& arg1_val, const char* arg2_name,
uint64_t id, uint64_t bind_id, unsigned int flags, const char* arg1_name,
const ARG1_TYPE& arg1_val, const char* arg2_name,
const ARG2_TYPE& arg2_val) {
const int num_args = 2;
const char* arg_names[2] = {arg1_name, arg2_name};
......@@ -508,9 +442,9 @@ static V8_INLINE uint64_t AddTraceEvent(
uint64_t arg_values[2];
SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]);
SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]);
return TRACE_EVENT_API_ADD_TRACE_EVENT(
phase, category_group_enabled, name, scope, id, bind_id, num_args,
arg_names, arg_types, arg_values, flags);
return TRACE_EVENT_API_ADD_TRACE_EVENT(phase, category_group_enabled, name,
id, bind_id, num_args, arg_names,
arg_types, arg_values, flags);
}
// Used by TRACE_EVENTx macros. Do not use directly.
......
......@@ -256,27 +256,3 @@ TEST(TestEventWithId) {
i::V8::SetPlatformForTesting(old_platform);
}
TEST(TestEventInContext) {
v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockTracingPlatform platform(old_platform);
i::V8::SetPlatformForTesting(&platform);
static uint64_t isolate_id = 0x20151021;
{
TRACE_EVENT_SCOPED_CONTEXT("v8-cat", "Isolate", isolate_id);
TRACE_EVENT0("v8-cat", "e");
}
CHECK_EQ(3, GET_TRACE_OBJECTS_LIST->length());
CHECK_EQ(TRACE_EVENT_PHASE_ENTER_CONTEXT, GET_TRACE_OBJECT(0)->phase);
CHECK_EQ("Isolate", GET_TRACE_OBJECT(0)->name);
CHECK_EQ(isolate_id, GET_TRACE_OBJECT(0)->id);
CHECK_EQ(TRACE_EVENT_PHASE_COMPLETE, GET_TRACE_OBJECT(1)->phase);
CHECK_EQ("e", GET_TRACE_OBJECT(1)->name);
CHECK_EQ(TRACE_EVENT_PHASE_LEAVE_CONTEXT, GET_TRACE_OBJECT(2)->phase);
CHECK_EQ("Isolate", GET_TRACE_OBJECT(2)->name);
CHECK_EQ(isolate_id, GET_TRACE_OBJECT(2)->id);
i::V8::SetPlatformForTesting(old_platform);
}
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