aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4profiling_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-09 16:02:55 +0200
committerLars Knoll <lars.knoll@qt.io>2017-08-10 08:19:59 +0000
commit6a91dcba2e4fa85dc345c2d403c757ab7676e28c (patch)
tree502b483cd437f4a1a039717af0a59e493d40f7a2 /src/qml/jsruntime/qv4profiling_p.h
parent5571b666e6b9534a55347adcd249fa07b2e25c01 (diff)
Always create a valid CallData object for interpreter calls
This will allow removing a few more special cases and to simplify the code further. Change-Id: I3a958e9f68e3c103ea4f2ee6825f893e5931b11d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4profiling_p.h')
-rw-r--r--src/qml/jsruntime/qv4profiling_p.h39
1 files changed, 11 insertions, 28 deletions
diff --git a/src/qml/jsruntime/qv4profiling_p.h b/src/qml/jsruntime/qv4profiling_p.h
index be38690a49..9b71342467 100644
--- a/src/qml/jsruntime/qv4profiling_p.h
+++ b/src/qml/jsruntime/qv4profiling_p.h
@@ -59,9 +59,6 @@
#ifdef QT_NO_QML_DEBUGGER
-#define Q_V4_PROFILE_ALLOC(engine, size, type) (!engine)
-#define Q_V4_PROFILE_DEALLOC(engine, size, type) (!engine)
-#define Q_V4_PROFILE(engine, context, function, jsFunction) (function->code(context, function, jsFunction))
QT_BEGIN_NAMESPACE
@@ -75,22 +72,6 @@ QT_END_NAMESPACE
#else
-#define Q_V4_PROFILE_ALLOC(engine, size, type)\
- (engine->profiler() &&\
- (engine->profiler()->featuresEnabled & (1 << Profiling::FeatureMemoryAllocation)) ?\
- engine->profiler()->trackAlloc(size, type) : false)
-
-#define Q_V4_PROFILE_DEALLOC(engine, size, type) \
- (engine->profiler() &&\
- (engine->profiler()->featuresEnabled & (1 << Profiling::FeatureMemoryAllocation)) ?\
- engine->profiler()->trackDealloc(size, type) : false)
-
-#define Q_V4_PROFILE(engine, context, function, jsFunction)\
- (Q_UNLIKELY(engine->profiler()) &&\
- (engine->profiler()->featuresEnabled & (1 << Profiling::FeatureFunctionCall)) ?\
- Profiling::FunctionCallProfiler::profileCall(engine->profiler(), context, function, jsFunction) :\
- function->code(context, function, jsFunction))
-
QT_BEGIN_NAMESPACE
namespace QV4 {
@@ -270,19 +251,21 @@ public:
// It's enough to ref() the function in the destructor as it will probably not disappear while
// it's executing ...
- FunctionCallProfiler(Profiler *profiler, Function *function) :
- profiler(profiler), function(function), startTime(profiler->m_timer.nsecsElapsed())
- {}
-
- ~FunctionCallProfiler()
+ FunctionCallProfiler(ExecutionEngine *engine, Function *f)
+ : profiler(0)
{
- profiler->m_data.append(FunctionCall(function, startTime, profiler->m_timer.nsecsElapsed()));
+ Profiler *p = engine->profiler();
+ if (Q_UNLIKELY(p) && (p->featuresEnabled & (1 << Profiling::FeatureFunctionCall))) {
+ profiler = p;
+ function = f;
+ startTime = profiler->m_timer.nsecsElapsed();
+ }
}
- static ReturnedValue profileCall(Profiler *profiler, Heap::ExecutionContext *context, Function *function, const FunctionObject *jsFunction)
+ ~FunctionCallProfiler()
{
- FunctionCallProfiler callProfiler(profiler, function);
- return function->code(context, function, jsFunction);
+ if (profiler)
+ profiler->m_data.append(FunctionCall(function, startTime, profiler->m_timer.nsecsElapsed()));
}
Profiler *profiler;