Commit 738bc388 authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[runtime] Add RCS counters for API functions

Bug: v8:9805
Change-Id: I995ae89331cc46b564a1003588df9fe9b82a22a4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2610728Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Sathya Gunasekaran  <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71947}
parent 2326005f
...@@ -186,6 +186,8 @@ Object GetIntrinsic(Isolate* isolate, v8::Intrinsic intrinsic) { ...@@ -186,6 +186,8 @@ Object GetIntrinsic(Isolate* isolate, v8::Intrinsic intrinsic) {
template <typename TemplateInfoT> template <typename TemplateInfoT>
MaybeHandle<JSObject> ConfigureInstance(Isolate* isolate, Handle<JSObject> obj, MaybeHandle<JSObject> ConfigureInstance(Isolate* isolate, Handle<JSObject> obj,
Handle<TemplateInfoT> data) { Handle<TemplateInfoT> data) {
RuntimeCallTimerScope timer(isolate,
RuntimeCallCounterId::kConfigureInstance);
HandleScope scope(isolate); HandleScope scope(isolate);
// Disable access checks while instantiating the object. // Disable access checks while instantiating the object.
AccessCheckDisableScope access_check_scope(isolate, obj); AccessCheckDisableScope access_check_scope(isolate, obj);
...@@ -371,6 +373,8 @@ MaybeHandle<JSObject> InstantiateObject(Isolate* isolate, ...@@ -371,6 +373,8 @@ MaybeHandle<JSObject> InstantiateObject(Isolate* isolate,
Handle<ObjectTemplateInfo> info, Handle<ObjectTemplateInfo> info,
Handle<JSReceiver> new_target, Handle<JSReceiver> new_target,
bool is_prototype) { bool is_prototype) {
RuntimeCallTimerScope timer(isolate,
RuntimeCallCounterId::kInstantiateObject);
Handle<JSFunction> constructor; Handle<JSFunction> constructor;
int serial_number = info->serial_number(); int serial_number = info->serial_number();
if (!new_target.is_null()) { if (!new_target.is_null()) {
...@@ -463,6 +467,8 @@ MaybeHandle<Object> GetInstancePrototype(Isolate* isolate, ...@@ -463,6 +467,8 @@ MaybeHandle<Object> GetInstancePrototype(Isolate* isolate,
MaybeHandle<JSFunction> InstantiateFunction( MaybeHandle<JSFunction> InstantiateFunction(
Isolate* isolate, Handle<NativeContext> native_context, Isolate* isolate, Handle<NativeContext> native_context,
Handle<FunctionTemplateInfo> data, MaybeHandle<Name> maybe_name) { Handle<FunctionTemplateInfo> data, MaybeHandle<Name> maybe_name) {
RuntimeCallTimerScope timer(isolate,
RuntimeCallCounterId::kInstantiateFunction);
int serial_number = data->serial_number(); int serial_number = data->serial_number();
if (serial_number) { if (serial_number) {
Handle<JSObject> result; Handle<JSObject> result;
...@@ -646,6 +652,8 @@ Handle<JSFunction> ApiNatives::CreateApiFunction( ...@@ -646,6 +652,8 @@ Handle<JSFunction> ApiNatives::CreateApiFunction(
Isolate* isolate, Handle<NativeContext> native_context, Isolate* isolate, Handle<NativeContext> native_context,
Handle<FunctionTemplateInfo> obj, Handle<Object> prototype, Handle<FunctionTemplateInfo> obj, Handle<Object> prototype,
InstanceType type, MaybeHandle<Name> maybe_name) { InstanceType type, MaybeHandle<Name> maybe_name) {
RuntimeCallTimerScope timer(isolate,
RuntimeCallCounterId::kCreateApiFunction);
Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo> shared =
FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(isolate, obj, FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(isolate, obj,
maybe_name); maybe_name);
......
...@@ -23,6 +23,8 @@ namespace { ...@@ -23,6 +23,8 @@ namespace {
// TODO(dcarney): CallOptimization duplicates this logic, merge. // TODO(dcarney): CallOptimization duplicates this logic, merge.
JSReceiver GetCompatibleReceiver(Isolate* isolate, FunctionTemplateInfo info, JSReceiver GetCompatibleReceiver(Isolate* isolate, FunctionTemplateInfo info,
JSReceiver receiver) { JSReceiver receiver) {
RuntimeCallTimerScope timer(isolate,
RuntimeCallCounterId::kGetCompatibleReceiver);
Object recv_type = info.signature(); Object recv_type = info.signature();
// No signature, return holder. // No signature, return holder.
if (!recv_type.IsFunctionTemplateInfo()) return receiver; if (!recv_type.IsFunctionTemplateInfo()) return receiver;
......
...@@ -977,6 +977,8 @@ class RuntimeCallTimer final { ...@@ -977,6 +977,8 @@ class RuntimeCallTimer final {
V(CompilePublishBackgroundFinalization) \ V(CompilePublishBackgroundFinalization) \
V(CompileSerialize) \ V(CompileSerialize) \
V(CompileWaitForDispatcher) \ V(CompileWaitForDispatcher) \
V(ConfigureInstance) \
V(CreateApiFunction) \
V(DeoptimizeCode) \ V(DeoptimizeCode) \
V(DeserializeContext) \ V(DeserializeContext) \
V(DeserializeIsolate) \ V(DeserializeIsolate) \
...@@ -991,6 +993,7 @@ class RuntimeCallTimer final { ...@@ -991,6 +993,7 @@ class RuntimeCallTimer final {
V(GCEpilogueCallback) \ V(GCEpilogueCallback) \
V(GCPrologueCallback) \ V(GCPrologueCallback) \
V(Genesis) \ V(Genesis) \
V(GetCompatibleReceiver) \
V(GetMoreDataCallback) \ V(GetMoreDataCallback) \
V(IndexedDefinerCallback) \ V(IndexedDefinerCallback) \
V(IndexedDeleterCallback) \ V(IndexedDeleterCallback) \
...@@ -999,9 +1002,14 @@ class RuntimeCallTimer final { ...@@ -999,9 +1002,14 @@ class RuntimeCallTimer final {
V(IndexedGetterCallback) \ V(IndexedGetterCallback) \
V(IndexedQueryCallback) \ V(IndexedQueryCallback) \
V(IndexedSetterCallback) \ V(IndexedSetterCallback) \
V(InstantiateFunction) \
V(InstantiateObject) \
V(Invoke) \ V(Invoke) \
V(InvokeApiFunction) \ V(InvokeApiFunction) \
V(InvokeApiInterruptCallbacks) \ V(InvokeApiInterruptCallbacks) \
V(IsCompatibleReceiver) \
V(IsCompatibleReceiverMap) \
V(IsTemplateFor) \
V(JS_Execution) \ V(JS_Execution) \
V(Map_SetPrototype) \ V(Map_SetPrototype) \
V(Map_TransitionToAccessorProperty) \ V(Map_TransitionToAccessorProperty) \
...@@ -1018,8 +1026,8 @@ class RuntimeCallTimer final { ...@@ -1018,8 +1026,8 @@ class RuntimeCallTimer final {
V(ObjectVerify) \ V(ObjectVerify) \
V(OptimizeBackgroundDispatcherJob) \ V(OptimizeBackgroundDispatcherJob) \
V(OptimizeCode) \ V(OptimizeCode) \
V(OptimizeConcurrentPrepare) \
V(OptimizeConcurrentFinalize) \ V(OptimizeConcurrentFinalize) \
V(OptimizeConcurrentPrepare) \
V(OptimizeFinalizePipelineJob) \ V(OptimizeFinalizePipelineJob) \
V(OptimizeHeapBrokerInitialization) \ V(OptimizeHeapBrokerInitialization) \
V(OptimizeNonConcurrent) \ V(OptimizeNonConcurrent) \
......
...@@ -1312,6 +1312,8 @@ Handle<SharedFunctionInfo> FunctionTemplateInfo::GetOrCreateSharedFunctionInfo( ...@@ -1312,6 +1312,8 @@ Handle<SharedFunctionInfo> FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(
} }
bool FunctionTemplateInfo::IsTemplateFor(Map map) { bool FunctionTemplateInfo::IsTemplateFor(Map map) {
RuntimeCallTimerScope timer(GetIsolate(),
RuntimeCallCounterId::kIsTemplateFor);
// There is a constraint on the object; check. // There is a constraint on the object; check.
if (!map.IsJSObjectMap()) return false; if (!map.IsJSObjectMap()) return false;
// Fetch the constructor function of the object. // Fetch the constructor function of the object.
......
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