diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-11-21 12:29:40 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-11-21 12:29:40 +0100 |
commit | d373d5e7d70e968cfba8957596ed6fe4f46990c8 (patch) | |
tree | c52bf2b0fbbfdb13d644b4050aa7a931ef4b7109 /src/qml/jsruntime/qv4profiling_p.h | |
parent | 9880acb424fd814501ba5fc4ae1caa989e23fafa (diff) | |
parent | 9af8a47746b69b6040fc149c1d24602a1e25b08f (diff) |
Merge remote-tracking branch 'origin/wip/new-backend' into dev
Conflicts:
src/qml/compiler/qv4isel_moth.cpp
src/qml/compiler/qv4jsir_p.h
src/qml/jsruntime/qv4engine_p.h
src/qml/jsruntime/qv4vme_moth.cpp
tests/auto/qml/qml.pro
Change-Id: Ia7b6ec24c7fcbcbb1786d9e798d2df294020ae37
Diffstat (limited to 'src/qml/jsruntime/qv4profiling_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4profiling_p.h | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/src/qml/jsruntime/qv4profiling_p.h b/src/qml/jsruntime/qv4profiling_p.h index 6b2369e795..8a24c71815 100644 --- a/src/qml/jsruntime/qv4profiling_p.h +++ b/src/qml/jsruntime/qv4profiling_p.h @@ -59,9 +59,6 @@ #if !QT_CONFIG(qml_debug) -#define Q_V4_PROFILE_ALLOC(engine, size, type) (!engine) -#define Q_V4_PROFILE_DEALLOC(engine, size, type) (!engine) -#define Q_V4_PROFILE(engine, function) (function->code(engine, function->codeData)) 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, function)\ - (Q_UNLIKELY(engine->profiler()) &&\ - (engine->profiler()->featuresEnabled & (1 << Profiling::FeatureFunctionCall)) ?\ - Profiling::FunctionCallProfiler::profileCall(engine->profiler(), engine, function) :\ - function->code(engine, function->codeData)) - 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, ExecutionEngine *engine, Function *function) + ~FunctionCallProfiler() { - FunctionCallProfiler callProfiler(profiler, function); - return function->code(engine, function->codeData); + if (profiler) + profiler->m_data.append(FunctionCall(function, startTime, profiler->m_timer.nsecsElapsed())); } Profiler *profiler; |