Commit 58b36c72 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[counters] Add more runtime call stats timers

- Message listener callbacks
- Bootstrapper and deserialization
- ObjectVerify
- Invoke and InvokeApiFunction

Drive-by-fix: sort RCS counters list.

Change-Id: I9acec3a3b94cb126c23575aae749c60b5257549d
Reviewed-on: https://chromium-review.googlesource.com/c/1356509Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57970}
parent 5b343483
......@@ -5799,6 +5799,7 @@ Genesis::Genesis(
v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer,
GlobalContextType context_type)
: isolate_(isolate), active_(isolate->bootstrapper()) {
RuntimeCallTimerScope rcs_timer(isolate, RuntimeCallCounterId::kGenesis);
result_ = Handle<Context>::null();
global_proxy_ = Handle<JSGlobalProxy>::null();
......
......@@ -167,6 +167,8 @@ MaybeHandle<Object> Builtins::InvokeApiFunction(Isolate* isolate,
Handle<Object> receiver,
int argc, Handle<Object> args[],
Handle<HeapObject> new_target) {
RuntimeCallTimerScope timer(isolate,
RuntimeCallCounterId::kInvokeApiFunction);
DCHECK(function->IsFunctionTemplateInfo() ||
(function->IsJSFunction() &&
JSFunction::cast(*function)->shared()->IsApiFunction()));
......
......@@ -719,11 +719,11 @@ class RuntimeCallTimer final {
V(ArrayBuffer_New) \
V(Array_CloneElementAt) \
V(Array_New) \
V(BigInt_NewFromWords) \
V(BigInt64Array_New) \
V(BigUint64Array_New) \
V(BigIntObject_New) \
V(BigInt_NewFromWords) \
V(BigIntObject_BigIntValue) \
V(BigIntObject_New) \
V(BigUint64Array_New) \
V(BooleanObject_BooleanValue) \
V(BooleanObject_New) \
V(Context_New) \
......@@ -757,9 +757,6 @@ class RuntimeCallTimer final {
V(Map_Has) \
V(Map_New) \
V(Map_Set) \
V(WeakMap_Get) \
V(WeakMap_Set) \
V(WeakMap_New) \
V(Message_GetEndColumn) \
V(Message_GetLineNumber) \
V(Message_GetSourceLine) \
......@@ -814,8 +811,8 @@ class RuntimeCallTimer final {
V(Promise_Chain) \
V(Promise_HasRejectHandler) \
V(Promise_Resolver_New) \
V(Promise_Resolver_Resolve) \
V(Promise_Resolver_Reject) \
V(Promise_Resolver_Resolve) \
V(Promise_Result) \
V(Promise_Status) \
V(Promise_Then) \
......@@ -859,35 +856,38 @@ class RuntimeCallTimer final {
V(UnboundScript_GetName) \
V(UnboundScript_GetSourceMappingURL) \
V(UnboundScript_GetSourceURL) \
V(ValueDeserializer_ReadHeader) \
V(ValueDeserializer_ReadValue) \
V(ValueSerializer_WriteValue) \
V(Value_InstanceOf) \
V(Value_IntegerValue) \
V(Value_Int32Value) \
V(Value_IntegerValue) \
V(Value_NumberValue) \
V(Value_TypeOf) \
V(Value_Uint32Value) \
V(ValueDeserializer_ReadHeader) \
V(ValueDeserializer_ReadValue) \
V(ValueSerializer_WriteValue)
V(WeakMap_Get) \
V(WeakMap_New) \
V(WeakMap_Set)
#define FOR_EACH_MANUAL_COUNTER(V) \
V(AccessorGetterCallback) \
V(AccessorSetterCallback) \
V(ArrayLengthGetter) \
V(ArrayLengthSetter) \
V(BoundFunctionNameGetter) \
V(BoundFunctionLengthGetter) \
V(BoundFunctionNameGetter) \
V(CompileAnalyse) \
V(CompileBackgroundAnalyse) \
V(CompileBackgroundCompileTask) \
V(CompileBackgroundEval) \
V(CompileBackgroundFunction) \
V(CompileBackgroundIgnition) \
V(CompileBackgroundScript) \
V(CompileBackgroundRewriteReturnResult) \
V(CompileBackgroundScopeAnalysis) \
V(CompileBackgroundScript) \
V(CompileDeserialize) \
V(CompileEval) \
V(CompileAnalyse) \
V(CompileEnqueueOnDispatcher) \
V(CompileEval) \
V(CompileFinalizeBackgroundCompileTask) \
V(CompileFinishNowOnDispatcher) \
V(CompileFunction) \
......@@ -900,37 +900,44 @@ class RuntimeCallTimer final {
V(CompileSerialize) \
V(CompileWaitForDispatcher) \
V(DeoptimizeCode) \
V(DeserializeContext) \
V(DeserializeIsolate) \
V(FunctionCallback) \
V(FunctionLengthGetter) \
V(FunctionPrototypeGetter) \
V(FunctionPrototypeSetter) \
V(FunctionLengthGetter) \
V(GC_Custom_AllAvailableGarbage) \
V(GC_Custom_IncrementalMarkingObserver) \
V(GC_Custom_SlowAllocateRaw) \
V(GCEpilogueCallback) \
V(GCPrologueCallback) \
V(Genesis) \
V(GetMoreDataCallback) \
V(NamedDefinerCallback) \
V(NamedDeleterCallback) \
V(NamedDescriptorCallback) \
V(NamedQueryCallback) \
V(NamedSetterCallback) \
V(NamedGetterCallback) \
V(NamedEnumeratorCallback) \
V(IndexedDefinerCallback) \
V(IndexedDeleterCallback) \
V(IndexedDescriptorCallback) \
V(IndexedEnumeratorCallback) \
V(IndexedGetterCallback) \
V(IndexedQueryCallback) \
V(IndexedSetterCallback) \
V(IndexedEnumeratorCallback) \
V(Invoke) \
V(InvokeApiFunction) \
V(InvokeApiInterruptCallbacks) \
V(InvokeFunctionCallback) \
V(JS_Execution) \
V(Map_SetPrototype) \
V(Map_TransitionToAccessorProperty) \
V(Map_TransitionToDataProperty) \
V(MessageListenerCallback) \
V(NamedDefinerCallback) \
V(NamedDeleterCallback) \
V(NamedDescriptorCallback) \
V(NamedEnumeratorCallback) \
V(NamedGetterCallback) \
V(NamedQueryCallback) \
V(NamedSetterCallback) \
V(Object_DeleteProperty) \
V(ObjectVerify) \
V(OptimizeCode) \
V(ParseArrowFunctionLiteral) \
V(ParseBackgroundArrowFunctionLiteral) \
......@@ -957,17 +964,16 @@ class RuntimeCallTimer final {
V(TestCounter3)
#define FOR_EACH_HANDLER_COUNTER(V) \
V(KeyedLoadIC_LoadIndexedInterceptorStub) \
V(KeyedLoadIC_KeyedLoadSloppyArgumentsStub) \
V(KeyedLoadIC_LoadElementDH) \
V(KeyedLoadIC_LoadIndexedInterceptorStub) \
V(KeyedLoadIC_LoadIndexedStringDH) \
V(KeyedLoadIC_SlowStub) \
V(KeyedStoreIC_ElementsTransitionAndStoreStub) \
V(KeyedStoreIC_KeyedStoreSloppyArgumentsStub) \
V(KeyedStoreIC_SlowStub) \
V(KeyedStoreIC_StoreFastElementStub) \
V(KeyedStoreIC_StoreElementStub) \
V(StoreInArrayLiteralIC_SlowStub) \
V(KeyedStoreIC_StoreFastElementStub) \
V(LoadGlobalIC_LoadScriptContextField) \
V(LoadGlobalIC_SlowStub) \
V(LoadIC_FunctionPrototypeStub) \
......@@ -984,11 +990,11 @@ class RuntimeCallTimer final {
V(LoadIC_LoadGlobalFromPrototypeDH) \
V(LoadIC_LoadIntegerIndexedExoticDH) \
V(LoadIC_LoadInterceptorDH) \
V(LoadIC_LoadNonMaskingInterceptorDH) \
V(LoadIC_LoadInterceptorFromPrototypeDH) \
V(LoadIC_LoadNativeDataPropertyDH) \
V(LoadIC_LoadNativeDataPropertyFromPrototypeDH) \
V(LoadIC_LoadNonexistentDH) \
V(LoadIC_LoadNonMaskingInterceptorDH) \
V(LoadIC_LoadNormalDH) \
V(LoadIC_LoadNormalFromPrototypeDH) \
V(LoadIC_NonReceiver) \
......@@ -996,8 +1002,8 @@ class RuntimeCallTimer final {
V(LoadIC_SlowStub) \
V(LoadIC_StringLength) \
V(LoadIC_StringWrapperLength) \
V(StoreGlobalIC_StoreScriptContextField) \
V(StoreGlobalIC_SlowStub) \
V(StoreGlobalIC_StoreScriptContextField) \
V(StoreIC_HandlerCacheHit_Accessor) \
V(StoreIC_NonReceiver) \
V(StoreIC_Premonomorphic) \
......@@ -1012,7 +1018,8 @@ class RuntimeCallTimer final {
V(StoreIC_StoreNativeDataPropertyDH) \
V(StoreIC_StoreNativeDataPropertyOnPrototypeDH) \
V(StoreIC_StoreNormalDH) \
V(StoreIC_StoreTransitionDH)
V(StoreIC_StoreTransitionDH) \
V(StoreInArrayLiteralIC_SlowStub)
enum RuntimeCallCounterId {
#define CALL_RUNTIME_COUNTER(name) kGC_##name,
......
......@@ -54,6 +54,7 @@ V8_WARN_UNUSED_RESULT MaybeHandle<Object> Invoke(
Handle<Object> receiver, int argc, Handle<Object> args[],
Handle<Object> new_target, Execution::MessageHandling message_handling,
Execution::Target execution_target) {
RuntimeCallTimerScope timer(isolate, RuntimeCallCounterId::kInvoke);
DCHECK(!receiver->IsJSGlobalObject());
#ifdef USE_SIMULATOR
......
......@@ -7,6 +7,7 @@
#include <memory>
#include "src/api-inl.h"
#include "src/counters.h"
#include "src/execution.h"
#include "src/isolate-inl.h"
#include "src/keys.h"
......@@ -157,6 +158,8 @@ void MessageHandler::ReportMessageNoExceptions(
FUNCTION_CAST<v8::MessageCallback>(callback_obj->foreign_address());
Handle<Object> callback_data(listener->get(1), isolate);
{
RuntimeCallTimerScope timer(
isolate, RuntimeCallCounterId::kMessageListenerCallback);
// Do not allow exceptions to propagate.
v8::TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate));
callback(api_message_obj, callback_data->IsUndefined(isolate)
......
......@@ -6,6 +6,7 @@
#include "src/assembler-inl.h"
#include "src/bootstrapper.h"
#include "src/counters.h"
#include "src/date.h"
#include "src/disasm.h"
#include "src/disassembler.h"
......@@ -84,6 +85,7 @@ namespace internal {
#ifdef VERIFY_HEAP
void Object::ObjectVerify(Isolate* isolate) {
RuntimeCallTimerScope timer(isolate, RuntimeCallCounterId::kObjectVerify);
if (IsSmi()) {
Smi::cast(this)->SmiVerify(isolate);
} else {
......
......@@ -7,6 +7,7 @@
#include "src/snapshot/snapshot.h"
#include "src/base/platform/platform.h"
#include "src/counters.h"
#include "src/snapshot/partial-deserializer.h"
#include "src/snapshot/startup-deserializer.h"
#include "src/version.h"
......@@ -31,6 +32,8 @@ bool Snapshot::HasContextSnapshot(Isolate* isolate, size_t index) {
bool Snapshot::Initialize(Isolate* isolate) {
if (!isolate->snapshot_available()) return false;
RuntimeCallTimerScope rcs_timer(isolate,
RuntimeCallCounterId::kDeserializeIsolate);
base::ElapsedTimer timer;
if (FLAG_profile_deserialization) timer.Start();
......@@ -57,6 +60,8 @@ MaybeHandle<Context> Snapshot::NewContextFromSnapshot(
Isolate* isolate, Handle<JSGlobalProxy> global_proxy, size_t context_index,
v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer) {
if (!isolate->snapshot_available()) return Handle<Context>();
RuntimeCallTimerScope rcs_timer(isolate,
RuntimeCallCounterId::kDeserializeContext);
base::ElapsedTimer timer;
if (FLAG_profile_deserialization) timer.Start();
......
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