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) {
template <typename TemplateInfoT>
MaybeHandle<JSObject> ConfigureInstance(Isolate* isolate, Handle<JSObject> obj,
Handle<TemplateInfoT> data) {
RuntimeCallTimerScope timer(isolate,
RuntimeCallCounterId::kConfigureInstance);
HandleScope scope(isolate);
// Disable access checks while instantiating the object.
AccessCheckDisableScope access_check_scope(isolate, obj);
......@@ -371,6 +373,8 @@ MaybeHandle<JSObject> InstantiateObject(Isolate* isolate,
Handle<ObjectTemplateInfo> info,
Handle<JSReceiver> new_target,
bool is_prototype) {
RuntimeCallTimerScope timer(isolate,
RuntimeCallCounterId::kInstantiateObject);
Handle<JSFunction> constructor;
int serial_number = info->serial_number();
if (!new_target.is_null()) {
......@@ -463,6 +467,8 @@ MaybeHandle<Object> GetInstancePrototype(Isolate* isolate,
MaybeHandle<JSFunction> InstantiateFunction(
Isolate* isolate, Handle<NativeContext> native_context,
Handle<FunctionTemplateInfo> data, MaybeHandle<Name> maybe_name) {
RuntimeCallTimerScope timer(isolate,
RuntimeCallCounterId::kInstantiateFunction);
int serial_number = data->serial_number();
if (serial_number) {
Handle<JSObject> result;
......@@ -646,6 +652,8 @@ Handle<JSFunction> ApiNatives::CreateApiFunction(
Isolate* isolate, Handle<NativeContext> native_context,
Handle<FunctionTemplateInfo> obj, Handle<Object> prototype,
InstanceType type, MaybeHandle<Name> maybe_name) {
RuntimeCallTimerScope timer(isolate,
RuntimeCallCounterId::kCreateApiFunction);
Handle<SharedFunctionInfo> shared =
FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(isolate, obj,
maybe_name);
......
......@@ -23,6 +23,8 @@ namespace {
// TODO(dcarney): CallOptimization duplicates this logic, merge.
JSReceiver GetCompatibleReceiver(Isolate* isolate, FunctionTemplateInfo info,
JSReceiver receiver) {
RuntimeCallTimerScope timer(isolate,
RuntimeCallCounterId::kGetCompatibleReceiver);
Object recv_type = info.signature();
// No signature, return holder.
if (!recv_type.IsFunctionTemplateInfo()) return receiver;
......
......@@ -977,6 +977,8 @@ class RuntimeCallTimer final {
V(CompilePublishBackgroundFinalization) \
V(CompileSerialize) \
V(CompileWaitForDispatcher) \
V(ConfigureInstance) \
V(CreateApiFunction) \
V(DeoptimizeCode) \
V(DeserializeContext) \
V(DeserializeIsolate) \
......@@ -991,6 +993,7 @@ class RuntimeCallTimer final {
V(GCEpilogueCallback) \
V(GCPrologueCallback) \
V(Genesis) \
V(GetCompatibleReceiver) \
V(GetMoreDataCallback) \
V(IndexedDefinerCallback) \
V(IndexedDeleterCallback) \
......@@ -999,9 +1002,14 @@ class RuntimeCallTimer final {
V(IndexedGetterCallback) \
V(IndexedQueryCallback) \
V(IndexedSetterCallback) \
V(InstantiateFunction) \
V(InstantiateObject) \
V(Invoke) \
V(InvokeApiFunction) \
V(InvokeApiInterruptCallbacks) \
V(IsCompatibleReceiver) \
V(IsCompatibleReceiverMap) \
V(IsTemplateFor) \
V(JS_Execution) \
V(Map_SetPrototype) \
V(Map_TransitionToAccessorProperty) \
......@@ -1018,8 +1026,8 @@ class RuntimeCallTimer final {
V(ObjectVerify) \
V(OptimizeBackgroundDispatcherJob) \
V(OptimizeCode) \
V(OptimizeConcurrentPrepare) \
V(OptimizeConcurrentFinalize) \
V(OptimizeConcurrentPrepare) \
V(OptimizeFinalizePipelineJob) \
V(OptimizeHeapBrokerInitialization) \
V(OptimizeNonConcurrent) \
......
......@@ -1312,6 +1312,8 @@ Handle<SharedFunctionInfo> FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(
}
bool FunctionTemplateInfo::IsTemplateFor(Map map) {
RuntimeCallTimerScope timer(GetIsolate(),
RuntimeCallCounterId::kIsTemplateFor);
// There is a constraint on the object; check.
if (!map.IsJSObjectMap()) return false;
// 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