Commit ba6e348f authored by cbruni's avatar cbruni Committed by Commit bot

[api] Remove HistogramTimerScope from high-frequency API-Functions

The timing scopes don't come for free and in the case of wrapper creation only add
overhead. This CL removes the histogram timer for CallAs(Function|Constructor) and
Function::(NewInstance|Call).

BUG=chromium:630217

Review-Url: https://codereview.chromium.org/2188193002
Cr-Commit-Position: refs/heads/master@{#38138}
parent 76812cc7
......@@ -4479,7 +4479,6 @@ MaybeLocal<Value> Object::CallAsFunction(Local<Context> context,
Local<Value> recv, int argc,
Local<Value> argv[]) {
PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, Object, CallAsFunction, Value);
i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true);
i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
TRACE_EVENT0("v8", "V8.Execute");
auto self = Utils::OpenHandle(this);
......@@ -4507,7 +4506,6 @@ MaybeLocal<Value> Object::CallAsConstructor(Local<Context> context, int argc,
Local<Value> argv[]) {
PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, Object, CallAsConstructor,
Value);
i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true);
i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
TRACE_EVENT0("v8", "V8.Execute");
auto self = Utils::OpenHandle(this);
......@@ -4558,7 +4556,6 @@ Local<v8::Object> Function::NewInstance() const {
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::HistogramTimerScope execute_timer(isolate->counters()->execute(), true);
i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
TRACE_EVENT0("v8", "V8.Execute");
auto self = Utils::OpenHandle(this);
......@@ -4583,7 +4580,6 @@ MaybeLocal<v8::Value> Function::Call(Local<Context> context,
v8::Local<v8::Value> recv, int argc,
v8::Local<v8::Value> argv[]) {
PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, Function, Call, Value);
i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true);
i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
TRACE_EVENT0("v8", "V8.Execute");
auto self = Utils::OpenHandle(this);
......
......@@ -39,6 +39,12 @@ void Logger::CallEventLogger(Isolate* isolate, const char* name, StartEnd se,
}
}
template <class TimerEvent>
void TimerEventScope<TimerEvent>::LogTimerEvent(Logger::StartEnd se) {
Logger::CallEventLogger(isolate_, TimerEvent::name(), se,
TimerEvent::expose_to_api());
}
} // namespace internal
} // namespace v8
......
......@@ -895,14 +895,6 @@ void Logger::LeaveExternal(Isolate* isolate) {
isolate->set_current_vm_state(JS);
}
template <class TimerEvent>
void TimerEventScope<TimerEvent>::LogTimerEvent(Logger::StartEnd se) {
Logger::CallEventLogger(isolate_, TimerEvent::name(), se,
TimerEvent::expose_to_api());
}
// Instantiate template methods.
#define V(TimerName, expose) \
template void TimerEventScope<TimerEvent##TimerName>::LogTimerEvent( \
......
......@@ -380,9 +380,8 @@ class TimerEventScope {
~TimerEventScope() { LogTimerEvent(Logger::END); }
void LogTimerEvent(Logger::StartEnd se);
private:
void LogTimerEvent(Logger::StartEnd se);
Isolate* isolate_;
};
......
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