Commit 597315dc authored by ishell's avatar ishell Committed by Commit bot

[ic] Detailize some IC-specific runtime call stats counters.

This CL adds Load/StoreIC_Premonomorphic and detailizes IC_HandlerCacheHit bucket.

BUG=v8:5561

Review-Url: https://codereview.chromium.org/2459333003
Cr-Commit-Position: refs/heads/master@{#40679}
parent 5319b50c
......@@ -744,6 +744,14 @@ class RuntimeCallTimer {
V(KeyedStoreIC_StoreElementStub) \
V(KeyedStoreIC_Polymorphic) \
V(LoadIC_FunctionPrototypeStub) \
V(LoadIC_HandlerCacheHit_AccessCheck) \
V(LoadIC_HandlerCacheHit_Exotic) \
V(LoadIC_HandlerCacheHit_Interceptor) \
V(LoadIC_HandlerCacheHit_JSProxy) \
V(LoadIC_HandlerCacheHit_NonExistent) \
V(LoadIC_HandlerCacheHit_Accessor) \
V(LoadIC_HandlerCacheHit_Data) \
V(LoadIC_HandlerCacheHit_Transition) \
V(LoadIC_LoadApiGetterStub) \
V(LoadIC_LoadCallback) \
V(LoadIC_LoadConstantDH) \
......@@ -760,8 +768,18 @@ class RuntimeCallTimer {
V(LoadIC_LoadNormal) \
V(LoadIC_LoadScriptContextFieldStub) \
V(LoadIC_LoadViaGetter) \
V(LoadIC_Premonomorphic) \
V(LoadIC_SlowStub) \
V(LoadIC_StringLengthStub) \
V(StoreIC_HandlerCacheHit_AccessCheck) \
V(StoreIC_HandlerCacheHit_Exotic) \
V(StoreIC_HandlerCacheHit_Interceptor) \
V(StoreIC_HandlerCacheHit_JSProxy) \
V(StoreIC_HandlerCacheHit_NonExistent) \
V(StoreIC_HandlerCacheHit_Accessor) \
V(StoreIC_HandlerCacheHit_Data) \
V(StoreIC_HandlerCacheHit_Transition) \
V(StoreIC_Premonomorphic) \
V(StoreIC_SlowStub) \
V(StoreIC_StoreCallback) \
V(StoreIC_StoreField) \
......
......@@ -65,7 +65,10 @@ Handle<Code> NamedLoadHandlerCompiler::ComputeLoadNonexistent(
// name specific if there are global objects involved.
Handle<Code> handler = PropertyHandlerCompiler::Find(
cache_name, stub_holder_map, Code::LOAD_IC, flag);
if (!handler.is_null()) return handler;
if (!handler.is_null()) {
TRACE_HANDLER_STATS(isolate, LoadIC_HandlerCacheHit_NonExistent);
return handler;
}
TRACE_HANDLER_STATS(isolate, LoadIC_LoadNonexistent);
NamedLoadHandlerCompiler compiler(isolate, receiver_map, last, flag);
......
......@@ -993,6 +993,7 @@ void LoadIC::UpdateCaches(LookupIterator* lookup) {
if (state() == UNINITIALIZED && kind() != Code::LOAD_GLOBAL_IC) {
// This is the first time we execute this inline cache. Set the target to
// the pre monomorphic stub to delay setting the monomorphic state.
TRACE_HANDLER_STATS(isolate(), LoadIC_Premonomorphic);
ConfigureVectorState(PREMONOMORPHIC, Handle<Object>());
TRACE_IC("LoadIC", lookup->name());
return;
......@@ -1108,6 +1109,69 @@ void IC::UpdateMegamorphicCache(Map* map, Name* name, Object* handler) {
stub_cache()->Set(name, map, handler);
}
void IC::TraceHandlerCacheHitStats(LookupIterator* lookup) {
if (!FLAG_runtime_call_stats) return;
if (kind() == Code::LOAD_IC || kind() == Code::LOAD_GLOBAL_IC ||
kind() == Code::KEYED_LOAD_IC) {
switch (lookup->state()) {
case LookupIterator::ACCESS_CHECK:
TRACE_HANDLER_STATS(isolate(), LoadIC_HandlerCacheHit_AccessCheck);
break;
case LookupIterator::INTEGER_INDEXED_EXOTIC:
TRACE_HANDLER_STATS(isolate(), LoadIC_HandlerCacheHit_Exotic);
break;
case LookupIterator::INTERCEPTOR:
TRACE_HANDLER_STATS(isolate(), LoadIC_HandlerCacheHit_Interceptor);
break;
case LookupIterator::JSPROXY:
TRACE_HANDLER_STATS(isolate(), LoadIC_HandlerCacheHit_JSProxy);
break;
case LookupIterator::NOT_FOUND:
TRACE_HANDLER_STATS(isolate(), LoadIC_HandlerCacheHit_NonExistent);
break;
case LookupIterator::ACCESSOR:
TRACE_HANDLER_STATS(isolate(), LoadIC_HandlerCacheHit_Accessor);
break;
case LookupIterator::DATA:
TRACE_HANDLER_STATS(isolate(), LoadIC_HandlerCacheHit_Data);
break;
case LookupIterator::TRANSITION:
TRACE_HANDLER_STATS(isolate(), LoadIC_HandlerCacheHit_Transition);
break;
}
} else if (kind() == Code::STORE_IC || kind() == Code::KEYED_STORE_IC) {
switch (lookup->state()) {
case LookupIterator::ACCESS_CHECK:
TRACE_HANDLER_STATS(isolate(), StoreIC_HandlerCacheHit_AccessCheck);
break;
case LookupIterator::INTEGER_INDEXED_EXOTIC:
TRACE_HANDLER_STATS(isolate(), StoreIC_HandlerCacheHit_Exotic);
break;
case LookupIterator::INTERCEPTOR:
TRACE_HANDLER_STATS(isolate(), StoreIC_HandlerCacheHit_Interceptor);
break;
case LookupIterator::JSPROXY:
TRACE_HANDLER_STATS(isolate(), StoreIC_HandlerCacheHit_JSProxy);
break;
case LookupIterator::NOT_FOUND:
TRACE_HANDLER_STATS(isolate(), StoreIC_HandlerCacheHit_NonExistent);
break;
case LookupIterator::ACCESSOR:
TRACE_HANDLER_STATS(isolate(), StoreIC_HandlerCacheHit_Accessor);
break;
case LookupIterator::DATA:
TRACE_HANDLER_STATS(isolate(), StoreIC_HandlerCacheHit_Data);
break;
case LookupIterator::TRANSITION:
TRACE_HANDLER_STATS(isolate(), StoreIC_HandlerCacheHit_Transition);
break;
}
} else {
TRACE_HANDLER_STATS(isolate(), IC_HandlerCacheHit);
}
}
Handle<Object> IC::ComputeHandler(LookupIterator* lookup,
Handle<Object> value) {
// Try to find a globally shared handler stub.
......@@ -1142,7 +1206,7 @@ Handle<Object> IC::ComputeHandler(LookupIterator* lookup,
Handle<Object> handler;
if (maybe_handler_.ToHandle(&handler)) {
if (!handler.is_identical_to(code)) {
TRACE_HANDLER_STATS(isolate(), IC_HandlerCacheHit);
TraceHandlerCacheHitStats(lookup);
return code;
}
} else {
......@@ -1154,11 +1218,11 @@ Handle<Object> IC::ComputeHandler(LookupIterator* lookup,
Object* megamorphic_cached_handler =
stub_cache()->Get(*lookup->name(), map);
if (megamorphic_cached_handler != *code) {
TRACE_HANDLER_STATS(isolate(), IC_HandlerCacheHit);
TraceHandlerCacheHitStats(lookup);
return code;
}
} else {
TRACE_HANDLER_STATS(isolate(), IC_HandlerCacheHit);
TraceHandlerCacheHitStats(lookup);
return code;
}
}
......@@ -1728,6 +1792,7 @@ void StoreIC::UpdateCaches(LookupIterator* lookup, Handle<Object> value,
if (state() == UNINITIALIZED) {
// This is the first time we execute this inline cache. Set the target to
// the pre monomorphic stub to delay setting the monomorphic state.
TRACE_HANDLER_STATS(isolate(), StoreIC_Premonomorphic);
ConfigureVectorState(PREMONOMORPHIC, Handle<Object>());
TRACE_IC("StoreIC", lookup->name());
return;
......
......@@ -140,6 +140,8 @@ class IC {
static void OnTypeFeedbackChanged(Isolate* isolate, Code* host);
static void PostPatching(Address address, Code* target, Code* old_target);
void TraceHandlerCacheHitStats(LookupIterator* lookup);
// Compute the handler either by compiling or by retrieving a cached version.
Handle<Object> ComputeHandler(LookupIterator* lookup,
Handle<Object> value = Handle<Code>::null());
......
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