Revert of [Tracing] Embed V8 runtime call stats into tracing. (patchset #8 id:140001 of https://codereview.chromium.org/2187693002/ )
Reason for revert: Leaks block chromium roll: https://codereview.chromium.org/2219083003/ Example build: https://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_asan_rel_ng/builds/205435 You can add the trybot from tryserver.chromium.linux, linux_chromium_asan_rel_ng, on reland. Original issue's description: > [Reland][Tracing] Embed V8 runtime call stats into tracing. > > Currently we have V8 RuntimeCallStats that is independently from tracing when > running d8 with flag --runtime_call_stats. This patch embeds V8 runtime call > stats into tracing, by having a global table of runtime call counters each > isolate, resetting the table each time we enter a top level trace event, and > dumping the table for each top level trace event. This will make trace file more > compat, as well as enable runtime call stats in tracing system. > > This patch adds ~5% overhead to V8 when the category is enabled, we measure the > overhead by running a script when category is enabled. > > BUG=v8:5089 > > Committed: https://crrev.com/d014866173eaa2b548c566217b2c94b1d49385fa > Committed: https://crrev.com/1ca3b73bba4a7253ca8eeef39321d70e7d414331 > Committed: https://crrev.com/3f936a5b17754783e92d2146eaf66c88a78ee45b > Cr-Original-Original-Commit-Position: refs/heads/master@{#38270} > Cr-Original-Commit-Position: refs/heads/master@{#38314} > Cr-Commit-Position: refs/heads/master@{#38403} TBR=cbruni@chromium.org,fmeawad@chromium.org,bmeurer@chromium.org,adamk@chromium.org,rmcilroy@chromium.org,lpy@chromium.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=v8:5089 NOTRY=true NOPRESUBMIT=true Review-Url: https://codereview.chromium.org/2221853002 Cr-Commit-Position: refs/heads/master@{#38412}
This commit is contained in:
parent
2c8b51448c
commit
12ee7ec0a8
@ -20,8 +20,6 @@ namespace internal {
|
||||
Handle<Name> name) { \
|
||||
Isolate* isolate = this->isolate(); \
|
||||
RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( \
|
||||
isolate, &tracing::TraceEventStatsTable::Function); \
|
||||
VMState<EXTERNAL> state(isolate); \
|
||||
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
|
||||
PropertyCallbackInfo<ApiReturn> info(begin()); \
|
||||
@ -46,8 +44,6 @@ FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(WRITE_CALL_1_NAME)
|
||||
uint32_t index) { \
|
||||
Isolate* isolate = this->isolate(); \
|
||||
RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( \
|
||||
isolate, &tracing::TraceEventStatsTable::Function); \
|
||||
VMState<EXTERNAL> state(isolate); \
|
||||
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
|
||||
PropertyCallbackInfo<ApiReturn> info(begin()); \
|
||||
@ -68,9 +64,6 @@ Handle<Object> PropertyCallbackArguments::Call(
|
||||
Isolate* isolate = this->isolate();
|
||||
RuntimeCallTimerScope timer(
|
||||
isolate, &RuntimeCallStats::GenericNamedPropertySetterCallback);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate,
|
||||
&tracing::TraceEventStatsTable::GenericNamedPropertySetterCallback);
|
||||
VMState<EXTERNAL> state(isolate);
|
||||
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
|
||||
PropertyCallbackInfo<v8::Value> info(begin());
|
||||
@ -86,8 +79,6 @@ Handle<Object> PropertyCallbackArguments::Call(IndexedPropertySetterCallback f,
|
||||
Isolate* isolate = this->isolate();
|
||||
RuntimeCallTimerScope timer(isolate,
|
||||
&RuntimeCallStats::IndexedPropertySetterCallback);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::IndexedPropertySetterCallback);
|
||||
VMState<EXTERNAL> state(isolate);
|
||||
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
|
||||
PropertyCallbackInfo<v8::Value> info(begin());
|
||||
@ -102,8 +93,6 @@ void PropertyCallbackArguments::Call(AccessorNameSetterCallback f,
|
||||
Isolate* isolate = this->isolate();
|
||||
RuntimeCallTimerScope timer(isolate,
|
||||
&RuntimeCallStats::AccessorNameSetterCallback);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::AccessorNameSetterCallback);
|
||||
VMState<EXTERNAL> state(isolate);
|
||||
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
|
||||
PropertyCallbackInfo<void> info(begin());
|
||||
|
@ -13,8 +13,6 @@ namespace internal {
|
||||
Handle<Object> FunctionCallbackArguments::Call(FunctionCallback f) {
|
||||
Isolate* isolate = this->isolate();
|
||||
RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::FunctionCallback);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &internal::tracing::TraceEventStatsTable::FunctionCallback);
|
||||
VMState<EXTERNAL> state(isolate);
|
||||
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
|
||||
FunctionCallbackInfo<v8::Value> info(begin(), argv_, argc_);
|
||||
@ -26,8 +24,6 @@ Handle<JSObject> PropertyCallbackArguments::Call(
|
||||
IndexedPropertyEnumeratorCallback f) {
|
||||
Isolate* isolate = this->isolate();
|
||||
RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::PropertyCallback);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &internal::tracing::TraceEventStatsTable::PropertyCallback);
|
||||
VMState<EXTERNAL> state(isolate);
|
||||
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
|
||||
PropertyCallbackInfo<v8::Array> info(begin());
|
||||
|
22
src/api.cc
22
src/api.cc
@ -75,9 +75,6 @@ namespace v8 {
|
||||
#define LOG_API(isolate, class_name, function_name) \
|
||||
i::RuntimeCallTimerScope _runtime_timer( \
|
||||
isolate, &i::RuntimeCallStats::API_##class_name##_##function_name); \
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( \
|
||||
isolate, &internal::tracing::TraceEventStatsTable:: \
|
||||
API_##class_name##_##function_name); \
|
||||
LOG(isolate, ApiEntryCall("v8::" #class_name "::" #function_name))
|
||||
|
||||
#define ENTER_V8(isolate) i::VMState<v8::OTHER> __state__((isolate))
|
||||
@ -1840,7 +1837,7 @@ MaybeLocal<Value> Script::Run(Local<Context> context) {
|
||||
i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true);
|
||||
i::AggregatingHistogramTimerScope timer(isolate->counters()->compile_lazy());
|
||||
i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
|
||||
TRACE_EVENT_CALL_STATS_SCOPED(isolate, "v8", "V8.Execute");
|
||||
TRACE_EVENT0("v8", "V8.Execute");
|
||||
auto fun = i::Handle<i::JSFunction>::cast(Utils::OpenHandle(this));
|
||||
i::Handle<i::Object> receiver = isolate->global_proxy();
|
||||
Local<Value> result;
|
||||
@ -1875,7 +1872,7 @@ MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal(
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
||||
PREPARE_FOR_EXECUTION_WITH_ISOLATE(isolate, ScriptCompiler, CompileUnbound,
|
||||
UnboundScript);
|
||||
TRACE_EVENT_CALL_STATS_SCOPED(isolate, "v8", "V8.ScriptCompiler");
|
||||
TRACE_EVENT0("v8", "V8.ScriptCompiler");
|
||||
|
||||
// Don't try to produce any kind of cache when the debugger is loaded.
|
||||
if (isolate->debug()->is_loaded() &&
|
||||
@ -4414,7 +4411,7 @@ MaybeLocal<Value> Object::CallAsFunction(Local<Context> context,
|
||||
Local<Value> argv[]) {
|
||||
PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, Object, CallAsFunction, Value);
|
||||
i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
|
||||
TRACE_EVENT_CALL_STATS_SCOPED(isolate, "v8", "V8.Execute");
|
||||
TRACE_EVENT0("v8", "V8.Execute");
|
||||
auto self = Utils::OpenHandle(this);
|
||||
auto recv_obj = Utils::OpenHandle(*recv);
|
||||
STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**));
|
||||
@ -4441,7 +4438,7 @@ MaybeLocal<Value> Object::CallAsConstructor(Local<Context> context, int argc,
|
||||
PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, Object, CallAsConstructor,
|
||||
Value);
|
||||
i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
|
||||
TRACE_EVENT_CALL_STATS_SCOPED(isolate, "v8", "V8.Execute");
|
||||
TRACE_EVENT0("v8", "V8.Execute");
|
||||
auto self = Utils::OpenHandle(this);
|
||||
STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**));
|
||||
i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
|
||||
@ -4491,7 +4488,7 @@ MaybeLocal<Object> Function::NewInstance(Local<Context> context, int argc,
|
||||
v8::Local<v8::Value> argv[]) const {
|
||||
PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, Function, NewInstance, Object);
|
||||
i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
|
||||
TRACE_EVENT_CALL_STATS_SCOPED(isolate, "v8", "V8.Execute");
|
||||
TRACE_EVENT0("v8", "V8.Execute");
|
||||
auto self = Utils::OpenHandle(this);
|
||||
STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**));
|
||||
i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
|
||||
@ -4515,7 +4512,7 @@ MaybeLocal<v8::Value> Function::Call(Local<Context> context,
|
||||
v8::Local<v8::Value> argv[]) {
|
||||
PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, Function, Call, Value);
|
||||
i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
|
||||
TRACE_EVENT_CALL_STATS_SCOPED(isolate, "v8", "V8.Execute");
|
||||
TRACE_EVENT0("v8", "V8.Execute");
|
||||
auto self = Utils::OpenHandle(this);
|
||||
i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv);
|
||||
STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**));
|
||||
@ -5713,7 +5710,6 @@ Local<Context> NewContext(v8::Isolate* external_isolate,
|
||||
size_t context_snapshot_index) {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate);
|
||||
LOG_API(isolate, Context, New);
|
||||
TRACE_EVENT_CALL_STATS_SCOPED(isolate, "v8", "V8.NewContext");
|
||||
i::HandleScope scope(isolate);
|
||||
ExtensionConfiguration no_extensions;
|
||||
if (extensions == NULL) extensions = &no_extensions;
|
||||
@ -8977,9 +8973,6 @@ void InvokeAccessorGetterCallback(
|
||||
Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
|
||||
RuntimeCallTimerScope timer(isolate,
|
||||
&RuntimeCallStats::AccessorGetterCallback);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate,
|
||||
&internal::tracing::TraceEventStatsTable::AccessorGetterCallback);
|
||||
Address getter_address = reinterpret_cast<Address>(reinterpret_cast<intptr_t>(
|
||||
getter));
|
||||
VMState<EXTERNAL> state(isolate);
|
||||
@ -8993,9 +8986,6 @@ void InvokeFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>& info,
|
||||
Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
|
||||
RuntimeCallTimerScope timer(isolate,
|
||||
&RuntimeCallStats::InvokeFunctionCallback);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate,
|
||||
&internal::tracing::TraceEventStatsTable::InvokeFunctionCallback);
|
||||
Address callback_address =
|
||||
reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
|
||||
VMState<EXTERNAL> state(isolate);
|
||||
|
@ -88,17 +88,16 @@ double ClobberDoubleRegisters(double x1, double x2, double x3, double x4);
|
||||
V8_NOINLINE static Type Stats_##Name(int args_length, Object** args_object, \
|
||||
Isolate* isolate) { \
|
||||
RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Name); \
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.runtime"), \
|
||||
"V8.Runtime_" #Name); \
|
||||
Arguments args(args_length, args_object); \
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( \
|
||||
isolate, &tracing::TraceEventStatsTable::Name); \
|
||||
return __RT_impl_##Name(args, isolate); \
|
||||
} \
|
||||
\
|
||||
Type Name(int args_length, Object** args_object, Isolate* isolate) { \
|
||||
CHECK(isolate->context() == nullptr || isolate->context()->IsContext()); \
|
||||
CLOBBER_DOUBLE_REGISTERS(); \
|
||||
if (V8_UNLIKELY(TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED() || \
|
||||
FLAG_runtime_call_stats)) { \
|
||||
if (FLAG_runtime_call_stats) { \
|
||||
return Stats_##Name(args_length, args_object, isolate); \
|
||||
} \
|
||||
Arguments args(args_length, args_object); \
|
||||
|
@ -85,16 +85,15 @@ class BuiltinArguments : public Arguments {
|
||||
int args_length, Object** args_object, Isolate* isolate) { \
|
||||
BuiltinArguments args(args_length, args_object); \
|
||||
RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Builtin_##name); \
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( \
|
||||
isolate, &tracing::TraceEventStatsTable::Builtin_##name); \
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.runtime"), \
|
||||
"V8.Builtin_" #name); \
|
||||
return Builtin_Impl_##name(args, isolate); \
|
||||
} \
|
||||
\
|
||||
MUST_USE_RESULT Object* Builtin_##name( \
|
||||
int args_length, Object** args_object, Isolate* isolate) { \
|
||||
CHECK(isolate->context() == nullptr || isolate->context()->IsContext()); \
|
||||
if (V8_UNLIKELY(TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED() || \
|
||||
FLAG_runtime_call_stats)) { \
|
||||
if (FLAG_runtime_call_stats) { \
|
||||
return Builtin_Impl_Stats_##name(args_length, args_object, isolate); \
|
||||
} \
|
||||
BuiltinArguments args(args_length, args_object); \
|
||||
|
@ -672,8 +672,8 @@ bool GetOptimizedCodeNow(CompilationJob* job) {
|
||||
TimerEventScope<TimerEventRecompileSynchronous> timer(isolate);
|
||||
RuntimeCallTimerScope runtimeTimer(isolate,
|
||||
&RuntimeCallStats::RecompileSynchronous);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::RecompileSynchronous);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
|
||||
"V8.RecompileSynchronous");
|
||||
|
||||
if (job->CreateGraph() != CompilationJob::SUCCEEDED ||
|
||||
job->OptimizeGraph() != CompilationJob::SUCCEEDED ||
|
||||
@ -735,8 +735,8 @@ bool GetOptimizedCodeLater(CompilationJob* job) {
|
||||
TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate());
|
||||
RuntimeCallTimerScope runtimeTimer(info->isolate(),
|
||||
&RuntimeCallStats::RecompileSynchronous);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::RecompileSynchronous);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
|
||||
"V8.RecompileSynchronous");
|
||||
|
||||
if (job->CreateGraph() != CompilationJob::SUCCEEDED) return false;
|
||||
isolate->optimizing_compile_dispatcher()->QueueForOptimization(job);
|
||||
@ -814,8 +814,7 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
|
||||
CanonicalHandleScope canonical(isolate);
|
||||
TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate);
|
||||
RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::OptimizeCode);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::OptimizeCode);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.OptimizeCode");
|
||||
|
||||
// TurboFan can optimize directly from existing bytecode.
|
||||
if (FLAG_turbo_from_bytecode && use_turbofan && ShouldUseIgnition(info)) {
|
||||
@ -1014,8 +1013,7 @@ MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) {
|
||||
TimerEventScope<TimerEventCompileCode> compile_timer(isolate);
|
||||
RuntimeCallTimerScope runtimeTimer(isolate,
|
||||
&RuntimeCallStats::CompileCodeLazy);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::CompileCodeLazy);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode");
|
||||
AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy());
|
||||
|
||||
if (FLAG_turbo_cache_shared_code) {
|
||||
@ -1070,8 +1068,7 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
|
||||
Isolate* isolate = info->isolate();
|
||||
TimerEventScope<TimerEventCompileCode> timer(isolate);
|
||||
RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::CompileCode);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode");
|
||||
PostponeInterruptsScope postpone(isolate);
|
||||
DCHECK(!isolate->native_context().is_null());
|
||||
ParseInfo* parse_info = info->parse_info();
|
||||
@ -1145,10 +1142,8 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
|
||||
? info->isolate()->counters()->compile_eval()
|
||||
: info->isolate()->counters()->compile();
|
||||
HistogramTimerScope timer(rate);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate,
|
||||
(parse_info->is_eval() ? &tracing::TraceEventStatsTable::CompileEval
|
||||
: &tracing::TraceEventStatsTable::Compile));
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
|
||||
parse_info->is_eval() ? "V8.CompileEval" : "V8.Compile");
|
||||
|
||||
// Allocate a shared function info object.
|
||||
DCHECK_EQ(kNoSourcePosition, lit->function_token_position());
|
||||
@ -1618,8 +1613,8 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript(
|
||||
HistogramTimerScope timer(isolate->counters()->compile_deserialize());
|
||||
RuntimeCallTimerScope runtimeTimer(isolate,
|
||||
&RuntimeCallStats::CompileDeserialize);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::CompileDeserialize);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
|
||||
"V8.CompileDeserialize");
|
||||
Handle<SharedFunctionInfo> result;
|
||||
if (CodeSerializer::Deserialize(isolate, *cached_data, source)
|
||||
.ToHandle(&result)) {
|
||||
@ -1692,8 +1687,8 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript(
|
||||
isolate->counters()->compile_serialize());
|
||||
RuntimeCallTimerScope runtimeTimer(isolate,
|
||||
&RuntimeCallStats::CompileSerialize);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::CompileSerialize);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
|
||||
"V8.CompileSerialize");
|
||||
*cached_data = CodeSerializer::Serialize(isolate, result, source);
|
||||
if (FLAG_profile_deserialization) {
|
||||
PrintF("[Compiling and serializing took %0.3f ms]\n",
|
||||
@ -1809,8 +1804,7 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
|
||||
// Generate code
|
||||
TimerEventScope<TimerEventCompileCode> timer(isolate);
|
||||
RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::CompileCode);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode");
|
||||
if (lazy) {
|
||||
info.SetCode(isolate->builtins()->CompileLazy());
|
||||
} else if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) {
|
||||
@ -1885,8 +1879,8 @@ void Compiler::FinalizeCompilationJob(CompilationJob* raw_job) {
|
||||
TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate());
|
||||
RuntimeCallTimerScope runtimeTimer(isolate,
|
||||
&RuntimeCallStats::RecompileSynchronous);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::RecompileSynchronous);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
|
||||
"V8.RecompileSynchronous");
|
||||
|
||||
Handle<SharedFunctionInfo> shared = info->shared_info();
|
||||
shared->code()->set_profiler_ticks(0);
|
||||
|
@ -276,11 +276,6 @@ void RuntimeCallCounter::Reset() {
|
||||
time = base::TimeDelta();
|
||||
}
|
||||
|
||||
void RuntimeCallCounter::Dump(std::stringstream& out) {
|
||||
out << "\"" << name << "\":[" << count << "," << time.InMicroseconds()
|
||||
<< "],";
|
||||
}
|
||||
|
||||
// static
|
||||
void RuntimeCallStats::Enter(Isolate* isolate, RuntimeCallTimer* timer,
|
||||
CounterId counter_id) {
|
||||
|
@ -482,7 +482,6 @@ double AggregatedMemoryHistogram<Histogram>::Aggregate(double current_ms,
|
||||
struct RuntimeCallCounter {
|
||||
explicit RuntimeCallCounter(const char* name) : name(name) {}
|
||||
void Reset();
|
||||
V8_NOINLINE void Dump(std::stringstream& out);
|
||||
|
||||
const char* name;
|
||||
int64_t count = 0;
|
||||
|
@ -44,7 +44,6 @@
|
||||
# Generated source files need this explicitly:
|
||||
'include_dirs+': [
|
||||
'..',
|
||||
'<(DEPTH)',
|
||||
],
|
||||
'sources': [
|
||||
'd8.h',
|
||||
|
@ -366,8 +366,7 @@ void Deoptimizer::DeoptimizeAll(Isolate* isolate) {
|
||||
RuntimeCallTimerScope runtimeTimer(isolate,
|
||||
&RuntimeCallStats::DeoptimizeCode);
|
||||
TimerEventScope<TimerEventDeoptimizeCode> timer(isolate);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::DeoptimizeCode);
|
||||
TRACE_EVENT0("v8", "V8.DeoptimizeCode");
|
||||
if (FLAG_trace_deopt) {
|
||||
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
||||
PrintF(scope.file(), "[deoptimize all code in all contexts]\n");
|
||||
@ -388,8 +387,7 @@ void Deoptimizer::DeoptimizeMarkedCode(Isolate* isolate) {
|
||||
RuntimeCallTimerScope runtimeTimer(isolate,
|
||||
&RuntimeCallStats::DeoptimizeCode);
|
||||
TimerEventScope<TimerEventDeoptimizeCode> timer(isolate);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::DeoptimizeCode);
|
||||
TRACE_EVENT0("v8", "V8.DeoptimizeCode");
|
||||
if (FLAG_trace_deopt) {
|
||||
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
||||
PrintF(scope.file(), "[deoptimize marked code in all contexts]\n");
|
||||
@ -422,8 +420,7 @@ void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
|
||||
RuntimeCallTimerScope runtimeTimer(isolate,
|
||||
&RuntimeCallStats::DeoptimizeCode);
|
||||
TimerEventScope<TimerEventDeoptimizeCode> timer(isolate);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::DeoptimizeCode);
|
||||
TRACE_EVENT0("v8", "V8.DeoptimizeCode");
|
||||
Code* code = function->code();
|
||||
if (code->kind() == Code::OPTIMIZED_FUNCTION) {
|
||||
// Mark the code for deoptimization and unlink any functions that also
|
||||
|
@ -110,8 +110,6 @@ MUST_USE_RESULT MaybeHandle<Object> Invoke(Isolate* isolate, bool is_construct,
|
||||
PrintDeserializedCodeInfo(Handle<JSFunction>::cast(target));
|
||||
}
|
||||
RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::JS_Execution);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::JS_Execution);
|
||||
value = CALL_GENERATED_CODE(isolate, stub_entry, orig_func, func, recv,
|
||||
argc, argv);
|
||||
}
|
||||
|
@ -32,8 +32,7 @@ bool FullCodeGenerator::MakeCode(CompilationInfo* info) {
|
||||
RuntimeCallTimerScope runtimeTimer(isolate,
|
||||
&RuntimeCallStats::CompileFullCode);
|
||||
TimerEventScope<TimerEventCompileFullCode> timer(info->isolate());
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::CompileFullCode);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileFullCode");
|
||||
|
||||
Handle<Script> script = info->script();
|
||||
if (!script->IsUndefined(isolate) &&
|
||||
|
15
src/ic/ic.cc
15
src/ic/ic.cc
@ -2235,6 +2235,7 @@ void CallIC::HandleMiss(Handle<Object> function) {
|
||||
// Used from ic-<arch>.cc.
|
||||
RUNTIME_FUNCTION(Runtime_CallIC_Miss) {
|
||||
TimerEventScope<TimerEventIcMiss> timer(isolate);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
|
||||
HandleScope scope(isolate);
|
||||
DCHECK(args.length() == 3);
|
||||
Handle<Object> function = args.at<Object>(0);
|
||||
@ -2251,6 +2252,7 @@ RUNTIME_FUNCTION(Runtime_CallIC_Miss) {
|
||||
// Used from ic-<arch>.cc.
|
||||
RUNTIME_FUNCTION(Runtime_LoadIC_Miss) {
|
||||
TimerEventScope<TimerEventIcMiss> timer(isolate);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
|
||||
@ -2314,6 +2316,7 @@ RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Miss) {
|
||||
// Used from ic-<arch>.cc
|
||||
RUNTIME_FUNCTION(Runtime_KeyedLoadIC_Miss) {
|
||||
TimerEventScope<TimerEventIcMiss> timer(isolate);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<Object> key = args.at<Object>(1);
|
||||
@ -2331,6 +2334,7 @@ RUNTIME_FUNCTION(Runtime_KeyedLoadIC_Miss) {
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_KeyedLoadIC_MissFromStubFailure) {
|
||||
TimerEventScope<TimerEventIcMiss> timer(isolate);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
typedef LoadWithVectorDescriptor Descriptor;
|
||||
@ -2350,6 +2354,7 @@ RUNTIME_FUNCTION(Runtime_KeyedLoadIC_MissFromStubFailure) {
|
||||
// Used from ic-<arch>.cc.
|
||||
RUNTIME_FUNCTION(Runtime_StoreIC_Miss) {
|
||||
TimerEventScope<TimerEventIcMiss> timer(isolate);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<Name> key = args.at<Name>(1);
|
||||
@ -2377,6 +2382,7 @@ RUNTIME_FUNCTION(Runtime_StoreIC_Miss) {
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) {
|
||||
TimerEventScope<TimerEventIcMiss> timer(isolate);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(5, args.length());
|
||||
typedef StoreWithVectorDescriptor Descriptor;
|
||||
@ -2405,6 +2411,7 @@ RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) {
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_TransitionStoreIC_MissFromStubFailure) {
|
||||
TimerEventScope<TimerEventIcMiss> timer(isolate);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<Name> key = args.at<Name>(1);
|
||||
@ -2450,6 +2457,7 @@ RUNTIME_FUNCTION(Runtime_TransitionStoreIC_MissFromStubFailure) {
|
||||
// Used from ic-<arch>.cc.
|
||||
RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Miss) {
|
||||
TimerEventScope<TimerEventIcMiss> timer(isolate);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(5, args.length());
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
@ -2467,6 +2475,7 @@ RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Miss) {
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_KeyedStoreIC_MissFromStubFailure) {
|
||||
TimerEventScope<TimerEventIcMiss> timer(isolate);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(5, args.length());
|
||||
typedef StoreWithVectorDescriptor Descriptor;
|
||||
@ -2502,6 +2511,7 @@ RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Slow) {
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_ElementsTransitionAndStoreIC_Miss) {
|
||||
TimerEventScope<TimerEventIcMiss> timer(isolate);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
|
||||
HandleScope scope(isolate);
|
||||
// Length == 5 or 6, depending on whether the vector slot
|
||||
// is passed in a virtual register or not.
|
||||
@ -2643,6 +2653,7 @@ MaybeHandle<Object> BinaryOpIC::Transition(
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_BinaryOpIC_Miss) {
|
||||
TimerEventScope<TimerEventIcMiss> timer(isolate);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
typedef BinaryOpDescriptor Descriptor;
|
||||
@ -2656,6 +2667,7 @@ RUNTIME_FUNCTION(Runtime_BinaryOpIC_Miss) {
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_BinaryOpIC_MissWithAllocationSite) {
|
||||
TimerEventScope<TimerEventIcMiss> timer(isolate);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
typedef BinaryOpWithAllocationSiteDescriptor Descriptor;
|
||||
@ -2720,6 +2732,7 @@ Code* CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) {
|
||||
// Used from CompareICStub::GenerateMiss in code-stubs-<arch>.cc.
|
||||
RUNTIME_FUNCTION(Runtime_CompareIC_Miss) {
|
||||
TimerEventScope<TimerEventIcMiss> timer(isolate);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
|
||||
HandleScope scope(isolate);
|
||||
DCHECK(args.length() == 3);
|
||||
CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2)));
|
||||
@ -2745,6 +2758,7 @@ Handle<Object> ToBooleanIC::ToBoolean(Handle<Object> object) {
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_ToBooleanIC_Miss) {
|
||||
TimerEventScope<TimerEventIcMiss> timer(isolate);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
|
||||
DCHECK(args.length() == 1);
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> object = args.at<Object>(0);
|
||||
@ -2955,6 +2969,7 @@ RUNTIME_FUNCTION(Runtime_LoadElementWithInterceptor) {
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_LoadIC_MissFromStubFailure) {
|
||||
TimerEventScope<TimerEventIcMiss> timer(isolate);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
typedef LoadWithVectorDescriptor Descriptor;
|
||||
|
@ -136,8 +136,7 @@ bool Interpreter::MakeBytecode(CompilationInfo* info) {
|
||||
RuntimeCallTimerScope runtimeTimer(info->isolate(),
|
||||
&RuntimeCallStats::CompileIgnition);
|
||||
TimerEventScope<TimerEventCompileIgnition> timer(info->isolate());
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
info->isolate(), &tracing::TraceEventStatsTable::CompileIgnition);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileIgnition");
|
||||
|
||||
if (FLAG_print_bytecode || FLAG_print_ast) {
|
||||
OFStream os(stdout);
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "src/regexp/regexp-stack.h"
|
||||
#include "src/runtime-profiler.h"
|
||||
#include "src/runtime/runtime.h"
|
||||
#include "src/tracing/trace-event.h"
|
||||
#include "src/zone.h"
|
||||
|
||||
namespace v8 {
|
||||
@ -846,9 +845,6 @@ class Isolate {
|
||||
DCHECK(counters_ != NULL);
|
||||
return counters_;
|
||||
}
|
||||
tracing::TraceEventStatsTable* trace_event_stats_table() {
|
||||
return &trace_event_stats_table_;
|
||||
}
|
||||
RuntimeProfiler* runtime_profiler() { return runtime_profiler_; }
|
||||
CompilationCache* compilation_cache() { return compilation_cache_; }
|
||||
Logger* logger() {
|
||||
@ -1306,7 +1302,6 @@ class Isolate {
|
||||
RuntimeProfiler* runtime_profiler_;
|
||||
CompilationCache* compilation_cache_;
|
||||
Counters* counters_;
|
||||
tracing::TraceEventStatsTable trace_event_stats_table_;
|
||||
base::RecursiveMutex break_access_;
|
||||
Logger* logger_;
|
||||
StackGuard stack_guard_;
|
||||
|
@ -416,11 +416,6 @@ void LookupIterator::Delete() {
|
||||
isolate_, is_prototype_map
|
||||
? &RuntimeCallStats::PrototypeObject_DeleteProperty
|
||||
: &RuntimeCallStats::Object_DeleteProperty);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate_,
|
||||
(is_prototype_map
|
||||
? &tracing::TraceEventStatsTable::PrototypeObject_DeleteProperty
|
||||
: &tracing::TraceEventStatsTable::Object_DeleteProperty));
|
||||
|
||||
PropertyNormalizationMode mode =
|
||||
is_prototype_map ? KEEP_INOBJECT_PROPERTIES : CLEAR_INOBJECT_PROPERTIES;
|
||||
|
@ -9344,12 +9344,6 @@ Handle<Map> Map::TransitionToDataProperty(Handle<Map> map, Handle<Name> name,
|
||||
*map, map->is_prototype_map()
|
||||
? &RuntimeCallStats::PrototypeMap_TransitionToDataProperty
|
||||
: &RuntimeCallStats::Map_TransitionToDataProperty);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
map->GetIsolate(),
|
||||
(map->is_prototype_map()
|
||||
? &tracing::TraceEventStatsTable::
|
||||
PrototypeMap_TransitionToDataProperty
|
||||
: &tracing::TraceEventStatsTable::Map_TransitionToDataProperty))
|
||||
|
||||
DCHECK(name->IsUniqueName());
|
||||
DCHECK(!map->is_dictionary_map());
|
||||
@ -9436,12 +9430,6 @@ Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map,
|
||||
map->is_prototype_map()
|
||||
? &RuntimeCallStats::PrototypeMap_TransitionToAccessorProperty
|
||||
: &RuntimeCallStats::Map_TransitionToAccessorProperty);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate,
|
||||
(map->is_prototype_map()
|
||||
? &tracing::TraceEventStatsTable::
|
||||
PrototypeMap_TransitionToAccessorProperty
|
||||
: &tracing::TraceEventStatsTable::Map_TransitionToAccessorProperty));
|
||||
|
||||
// At least one of the accessors needs to be a new value.
|
||||
DCHECK(!getter->IsNull(isolate) || !setter->IsNull(isolate));
|
||||
@ -12338,8 +12326,6 @@ Handle<Cell> Map::GetOrCreatePrototypeChainValidityCell(Handle<Map> map,
|
||||
void Map::SetPrototype(Handle<Map> map, Handle<Object> prototype,
|
||||
PrototypeOptimizationMode proto_mode) {
|
||||
RuntimeCallTimerScope stats_scope(*map, &RuntimeCallStats::Map_SetPrototype);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
map->GetIsolate(), &tracing::TraceEventStatsTable::Map_SetPrototype);
|
||||
|
||||
bool is_hidden = false;
|
||||
if (prototype->IsJSObject()) {
|
||||
|
@ -928,8 +928,7 @@ FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) {
|
||||
|
||||
HistogramTimerScope timer_scope(isolate->counters()->parse(), true);
|
||||
RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::Parse);
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::Parse);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.Parse");
|
||||
Handle<String> source(String::cast(info->script()->source()));
|
||||
isolate->counters()->total_parse_size()->Increment(source->length());
|
||||
base::ElapsedTimer timer;
|
||||
@ -1093,8 +1092,7 @@ FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info) {
|
||||
DCHECK(parsing_on_main_thread_);
|
||||
RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::ParseLazy);
|
||||
HistogramTimerScope timer_scope(isolate->counters()->parse_lazy());
|
||||
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
|
||||
isolate, &tracing::TraceEventStatsTable::ParseLazy);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.ParseLazy");
|
||||
Handle<String> source(String::cast(info->script()->source()));
|
||||
isolate->counters()->total_parse_size()->Increment(source->length());
|
||||
base::ElapsedTimer timer;
|
||||
|
@ -4,136 +4,16 @@
|
||||
|
||||
#include "src/tracing/trace-event.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "src/isolate.h"
|
||||
#include "src/v8.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
namespace tracing {
|
||||
|
||||
// A global flag used as a shortcut to check for the
|
||||
// v8.runtime-call-stats category due to its high frequency use.
|
||||
base::Atomic32 kRuntimeCallStatsTracingEnabled = false;
|
||||
|
||||
v8::Platform* TraceEventHelper::GetCurrentPlatform() {
|
||||
return v8::internal::V8::GetCurrentPlatform();
|
||||
}
|
||||
|
||||
void CallStatsScopedTracer::AddEndTraceEvent() {
|
||||
if (!has_parent_scope_) {
|
||||
v8::internal::tracing::AddTraceEvent(
|
||||
TRACE_EVENT_PHASE_END, p_data_->category_group_enabled, p_data_->name,
|
||||
v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId,
|
||||
TRACE_EVENT_FLAG_NONE, v8::internal::tracing::kNoId,
|
||||
"runtime-call-stat",
|
||||
p_data_->isolate
|
||||
? TRACE_STR_COPY(
|
||||
p_data_->isolate->trace_event_stats_table()->Dump())
|
||||
: "");
|
||||
} else {
|
||||
v8::internal::tracing::AddTraceEvent(
|
||||
TRACE_EVENT_PHASE_END, p_data_->category_group_enabled, p_data_->name,
|
||||
v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId,
|
||||
TRACE_EVENT_FLAG_NONE, v8::internal::tracing::kNoId);
|
||||
}
|
||||
}
|
||||
|
||||
void CallStatsScopedTracer::Initialize(Isolate* isolate,
|
||||
const uint8_t* category_group_enabled,
|
||||
const char* name) {
|
||||
data_.isolate = isolate;
|
||||
data_.category_group_enabled = category_group_enabled;
|
||||
data_.name = name;
|
||||
p_data_ = &data_;
|
||||
TraceEventStatsTable* table = isolate->trace_event_stats_table();
|
||||
has_parent_scope_ = table->InUse();
|
||||
if (!has_parent_scope_) table->Reset();
|
||||
v8::internal::tracing::AddTraceEvent(
|
||||
TRACE_EVENT_PHASE_BEGIN, category_group_enabled, name,
|
||||
v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId,
|
||||
TRACE_EVENT_FLAG_NONE, v8::internal::tracing::kNoId);
|
||||
}
|
||||
|
||||
void TraceEventStatsTable::Enter(Isolate* isolate,
|
||||
TraceEventCallStatsTimer* timer,
|
||||
CounterId counter_id) {
|
||||
TraceEventStatsTable* table = isolate->trace_event_stats_table();
|
||||
RuntimeCallCounter* counter = &(table->*counter_id);
|
||||
timer->Start(counter, table->current_timer_);
|
||||
table->current_timer_ = timer;
|
||||
}
|
||||
|
||||
void TraceEventStatsTable::Leave(Isolate* isolate,
|
||||
TraceEventCallStatsTimer* timer) {
|
||||
TraceEventStatsTable* table = isolate->trace_event_stats_table();
|
||||
if (table->current_timer_ == timer) {
|
||||
table->current_timer_ = timer->Stop();
|
||||
}
|
||||
}
|
||||
|
||||
void TraceEventStatsTable::Reset() {
|
||||
in_use_ = true;
|
||||
current_timer_ = nullptr;
|
||||
#define RESET_COUNTER(name) this->name.Reset();
|
||||
FOR_EACH_MANUAL_COUNTER(RESET_COUNTER)
|
||||
#undef RESET_COUNTER
|
||||
|
||||
#define RESET_COUNTER(name, nargs, result_size) this->Runtime_##name.Reset();
|
||||
FOR_EACH_INTRINSIC(RESET_COUNTER)
|
||||
#undef RESET_COUNTER
|
||||
|
||||
#define RESET_COUNTER(name) this->Builtin_##name.Reset();
|
||||
BUILTIN_LIST_C(RESET_COUNTER)
|
||||
#undef RESET_COUNTER
|
||||
|
||||
#define RESET_COUNTER(name) this->API_##name.Reset();
|
||||
FOR_EACH_API_COUNTER(RESET_COUNTER)
|
||||
#undef RESET_COUNTER
|
||||
|
||||
#define RESET_COUNTER(name) this->Handler_##name.Reset();
|
||||
FOR_EACH_HANDLER_COUNTER(RESET_COUNTER)
|
||||
#undef RESET_COUNTER
|
||||
}
|
||||
|
||||
const char* TraceEventStatsTable::Dump() {
|
||||
buffer_.str("");
|
||||
buffer_.clear();
|
||||
buffer_ << "{";
|
||||
#define DUMP_COUNTER(name) \
|
||||
if (this->name.count > 0) this->name.Dump(buffer_);
|
||||
FOR_EACH_MANUAL_COUNTER(DUMP_COUNTER)
|
||||
#undef DUMP_COUNTER
|
||||
|
||||
#define DUMP_COUNTER(name, nargs, result_size) \
|
||||
if (this->Runtime_##name.count > 0) this->Runtime_##name.Dump(buffer_);
|
||||
FOR_EACH_INTRINSIC(DUMP_COUNTER)
|
||||
#undef DUMP_COUNTER
|
||||
|
||||
#define DUMP_COUNTER(name) \
|
||||
if (this->Builtin_##name.count > 0) this->Builtin_##name.Dump(buffer_);
|
||||
BUILTIN_LIST_C(DUMP_COUNTER)
|
||||
#undef DUMP_COUNTER
|
||||
|
||||
#define DUMP_COUNTER(name) \
|
||||
if (this->API_##name.count > 0) this->API_##name.Dump(buffer_);
|
||||
FOR_EACH_API_COUNTER(DUMP_COUNTER)
|
||||
#undef DUMP_COUNTER
|
||||
|
||||
#define DUMP_COUNTER(name) \
|
||||
if (this->Handler_##name.count > 0) this->Handler_##name.Dump(buffer_);
|
||||
FOR_EACH_HANDLER_COUNTER(DUMP_COUNTER)
|
||||
#undef DUMP_COUNTER
|
||||
buffer_ << "\"END\":[]}";
|
||||
std::string buffer_str = buffer_.str();
|
||||
size_t length = buffer_str.size();
|
||||
char* buffer_c_str = new char[length + 1];
|
||||
memcpy(buffer_c_str, buffer_str.c_str(), length + 1);
|
||||
in_use_ = false;
|
||||
return buffer_c_str;
|
||||
}
|
||||
|
||||
} // namespace tracing
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "include/v8-platform.h"
|
||||
#include "src/base/atomicops.h"
|
||||
#include "src/base/macros.h"
|
||||
#include "src/counters.h"
|
||||
|
||||
// This header file defines implementation details of how the trace macros in
|
||||
// trace_event_common.h collect and store trace events. Anything not
|
||||
@ -283,37 +282,6 @@ extern TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3];
|
||||
INTERNAL_TRACE_EVENT_UID(ScopedContext) \
|
||||
INTERNAL_TRACE_EVENT_UID(scoped_context)(context.raw_id());
|
||||
|
||||
#define TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED() \
|
||||
base::NoBarrier_Load(&v8::internal::tracing::kRuntimeCallStatsTracingEnabled)
|
||||
|
||||
#define TRACE_EVENT_CALL_STATS_SCOPED(isolate, category_group, name) \
|
||||
INTERNAL_TRACE_EVENT_CALL_STATS_SCOPED(isolate, category_group, name)
|
||||
|
||||
#define TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(isolate, counter_id) \
|
||||
INTERNAL_TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(isolate, counter_id)
|
||||
|
||||
#define INTERNAL_TRACE_EVENT_CALL_STATS_SCOPED(isolate, category_group, name) \
|
||||
{ \
|
||||
INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO( \
|
||||
TRACE_DISABLED_BY_DEFAULT("v8.runtime_stats")); \
|
||||
base::NoBarrier_Store( \
|
||||
&v8::internal::tracing::kRuntimeCallStatsTracingEnabled, \
|
||||
INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()); \
|
||||
} \
|
||||
INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
|
||||
v8::internal::tracing::CallStatsScopedTracer INTERNAL_TRACE_EVENT_UID( \
|
||||
tracer); \
|
||||
if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \
|
||||
INTERNAL_TRACE_EVENT_UID(tracer) \
|
||||
.Initialize(isolate, INTERNAL_TRACE_EVENT_UID(category_group_enabled), \
|
||||
name); \
|
||||
}
|
||||
|
||||
#define INTERNAL_TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(isolate, \
|
||||
counter_id) \
|
||||
v8::internal::tracing::CounterScope INTERNAL_TRACE_EVENT_UID(scope)( \
|
||||
isolate, counter_id);
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
namespace tracing {
|
||||
@ -324,8 +292,6 @@ const int kZeroNumArgs = 0;
|
||||
const decltype(nullptr) kGlobalScope = nullptr;
|
||||
const uint64_t kNoId = 0;
|
||||
|
||||
extern base::Atomic32 kRuntimeCallStatsTracingEnabled;
|
||||
|
||||
class TraceEventHelper {
|
||||
public:
|
||||
static v8::Platform* GetCurrentPlatform();
|
||||
@ -624,143 +590,6 @@ class TraceEventSamplingStateScope {
|
||||
const char* previous_state_;
|
||||
};
|
||||
|
||||
// Do not use directly.
|
||||
class CallStatsScopedTracer {
|
||||
public:
|
||||
CallStatsScopedTracer() : p_data_(nullptr) {}
|
||||
~CallStatsScopedTracer() {
|
||||
if (V8_UNLIKELY(p_data_ && *data_.category_group_enabled)) {
|
||||
AddEndTraceEvent();
|
||||
}
|
||||
}
|
||||
|
||||
void Initialize(Isolate* isolate, const uint8_t* category_group_enabled,
|
||||
const char* name);
|
||||
|
||||
private:
|
||||
void AddEndTraceEvent();
|
||||
struct Data {
|
||||
const uint8_t* category_group_enabled;
|
||||
const char* name;
|
||||
Isolate* isolate;
|
||||
};
|
||||
bool has_parent_scope_;
|
||||
Data* p_data_;
|
||||
Data data_;
|
||||
};
|
||||
|
||||
// TraceEventCallStatsTimer is used to keep track of the stack of currently
|
||||
// active timers used for properly measuring the own time of a
|
||||
// RuntimeCallCounter.
|
||||
class TraceEventCallStatsTimer {
|
||||
public:
|
||||
TraceEventCallStatsTimer() : counter_(nullptr), parent_(nullptr) {}
|
||||
RuntimeCallCounter* counter() { return counter_; }
|
||||
base::ElapsedTimer timer() { return timer_; }
|
||||
|
||||
private:
|
||||
friend class TraceEventStatsTable;
|
||||
|
||||
V8_INLINE void Start(RuntimeCallCounter* counter,
|
||||
TraceEventCallStatsTimer* parent) {
|
||||
counter_ = counter;
|
||||
parent_ = parent;
|
||||
timer_.Start();
|
||||
}
|
||||
|
||||
V8_INLINE TraceEventCallStatsTimer* Stop() {
|
||||
base::TimeDelta delta = timer_.Elapsed();
|
||||
timer_.Stop();
|
||||
counter_->count++;
|
||||
counter_->time += delta;
|
||||
if (parent_ != nullptr) {
|
||||
// Adjust parent timer so that it does not include sub timer's time.
|
||||
parent_->counter_->time -= delta;
|
||||
}
|
||||
return parent_;
|
||||
}
|
||||
|
||||
RuntimeCallCounter* counter_;
|
||||
TraceEventCallStatsTimer* parent_;
|
||||
base::ElapsedTimer timer_;
|
||||
};
|
||||
|
||||
class TraceEventStatsTable {
|
||||
public:
|
||||
typedef RuntimeCallCounter TraceEventStatsTable::*CounterId;
|
||||
|
||||
#define CALL_RUNTIME_COUNTER(name) \
|
||||
RuntimeCallCounter name = RuntimeCallCounter(#name);
|
||||
FOR_EACH_MANUAL_COUNTER(CALL_RUNTIME_COUNTER)
|
||||
#undef CALL_RUNTIME_COUNTER
|
||||
#define CALL_RUNTIME_COUNTER(name, nargs, ressize) \
|
||||
RuntimeCallCounter Runtime_##name = RuntimeCallCounter(#name);
|
||||
FOR_EACH_INTRINSIC(CALL_RUNTIME_COUNTER)
|
||||
#undef CALL_RUNTIME_COUNTER
|
||||
#define CALL_BUILTIN_COUNTER(name) \
|
||||
RuntimeCallCounter Builtin_##name = RuntimeCallCounter(#name);
|
||||
BUILTIN_LIST_C(CALL_BUILTIN_COUNTER)
|
||||
#undef CALL_BUILTIN_COUNTER
|
||||
#define CALL_BUILTIN_COUNTER(name) \
|
||||
RuntimeCallCounter API_##name = RuntimeCallCounter("API_" #name);
|
||||
FOR_EACH_API_COUNTER(CALL_BUILTIN_COUNTER)
|
||||
#undef CALL_BUILTIN_COUNTER
|
||||
#define CALL_BUILTIN_COUNTER(name) \
|
||||
RuntimeCallCounter Handler_##name = RuntimeCallCounter(#name);
|
||||
FOR_EACH_HANDLER_COUNTER(CALL_BUILTIN_COUNTER)
|
||||
#undef CALL_BUILTIN_COUNTER
|
||||
|
||||
// Starting measuring the time for a function. This will establish the
|
||||
// connection to the parent counter for properly calculating the own times.
|
||||
static void Enter(Isolate* isolate, TraceEventCallStatsTimer* timer,
|
||||
CounterId counter_id);
|
||||
|
||||
// Leave a scope for a measured runtime function. This will properly add
|
||||
// the time delta to the current_counter and subtract the delta from its
|
||||
// parent.
|
||||
static void Leave(Isolate* isolate, TraceEventCallStatsTimer* timer);
|
||||
|
||||
void Reset();
|
||||
const char* Dump();
|
||||
|
||||
TraceEventStatsTable() {
|
||||
Reset();
|
||||
in_use_ = false;
|
||||
}
|
||||
TraceEventCallStatsTimer* current_timer() { return current_timer_; }
|
||||
bool InUse() { return in_use_; }
|
||||
|
||||
private:
|
||||
std::stringstream buffer_;
|
||||
// Counter to track recursive time events.
|
||||
TraceEventCallStatsTimer* current_timer_ = nullptr;
|
||||
bool in_use_;
|
||||
};
|
||||
|
||||
class CounterScope {
|
||||
public:
|
||||
CounterScope(Isolate* isolate, TraceEventStatsTable::CounterId counter_id)
|
||||
: isolate_(nullptr) {
|
||||
if (V8_UNLIKELY(TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED())) {
|
||||
isolate_ = isolate;
|
||||
TraceEventStatsTable::Enter(isolate_, &timer_, counter_id);
|
||||
}
|
||||
}
|
||||
~CounterScope() {
|
||||
// A non-nullptr isolate_ means the stats table already entered the scope
|
||||
// and started the timer, we need to leave the scope and reset the timer
|
||||
// even when we stop tracing, otherwise we have the risk to have a dangling
|
||||
// pointer.
|
||||
if (V8_UNLIKELY(isolate_ != nullptr)) {
|
||||
TraceEventStatsTable::Leave(isolate_, &timer_);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Isolate* isolate_;
|
||||
TraceEventCallStatsTimer timer_;
|
||||
};
|
||||
|
||||
} // namespace tracing
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
@ -179,7 +179,6 @@
|
||||
],
|
||||
'include_dirs+': [
|
||||
'..',
|
||||
'<(DEPTH)',
|
||||
],
|
||||
'sources': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
|
||||
@ -238,7 +237,6 @@
|
||||
],
|
||||
'include_dirs+': [
|
||||
'..',
|
||||
'<(DEPTH)',
|
||||
],
|
||||
'sources': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
|
||||
@ -301,7 +299,6 @@
|
||||
],
|
||||
'include_dirs+': [
|
||||
'..',
|
||||
'<(DEPTH)',
|
||||
],
|
||||
'sources': [
|
||||
'snapshot/natives-external.cc',
|
||||
@ -2356,7 +2353,6 @@
|
||||
'dependencies': ['v8_base', 'v8_nosnapshot', 'v8_libplatform'],
|
||||
'include_dirs+': [
|
||||
'..',
|
||||
'<(DEPTH)',
|
||||
],
|
||||
'sources': [
|
||||
'snapshot/mksnapshot.cc',
|
||||
|
Loading…
Reference in New Issue
Block a user