aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4profiling_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2016-07-25 17:09:38 +0200
committerUlf Hermann <ulf.hermann@qt.io>2016-07-28 11:03:25 +0000
commit901b975fb5be147b9bb446c7b9f61c2d448a94ab (patch)
tree48edb0198ef109c7d3ea7faa0a83fadc6a80c185 /src/qml/jsruntime/qv4profiling_p.h
parentc685165038e10464da877896d1accb7b75d9086e (diff)
V4: Don't pass size and pointer through allocation trackers
By not relying on the return value of the macros we can #define them away later, when compiling with -no-qml-debug Change-Id: I24d50fa3f5d8e8765a42b050c81ddfae20f20a23 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.h41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/qml/jsruntime/qv4profiling_p.h b/src/qml/jsruntime/qv4profiling_p.h
index a422dd0fb6..c684d48368 100644
--- a/src/qml/jsruntime/qv4profiling_p.h
+++ b/src/qml/jsruntime/qv4profiling_p.h
@@ -59,6 +59,22 @@
QT_BEGIN_NAMESPACE
+#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)\
+ (engine->profiler &&\
+ (engine->profiler->featuresEnabled & (1 << Profiling::FeatureFunctionCall)) ?\
+ Profiling::FunctionCallProfiler::profileCall(engine->profiler, engine, function) :\
+ function->code(engine, function->codeData))
+
namespace QV4 {
namespace Profiling {
@@ -150,25 +166,8 @@ private:
qint64 m_end;
};
-#define Q_V4_PROFILE_ALLOC(engine, size, type)\
- (engine->profiler &&\
- (engine->profiler->featuresEnabled & (1 << Profiling::FeatureMemoryAllocation)) ?\
- engine->profiler->trackAlloc(size, type) : size)
-
-#define Q_V4_PROFILE_DEALLOC(engine, pointer, size, type) \
- (engine->profiler &&\
- (engine->profiler->featuresEnabled & (1 << Profiling::FeatureMemoryAllocation)) ?\
- engine->profiler->trackDealloc(pointer, size, type) : pointer)
-
-#define Q_V4_PROFILE(engine, function)\
- (engine->profiler &&\
- (engine->profiler->featuresEnabled & (1 << Profiling::FeatureFunctionCall)) ?\
- Profiling::FunctionCallProfiler::profileCall(engine->profiler, engine, function) :\
- function->code(engine, function->codeData))
-
class Q_QML_EXPORT Profiler : public QObject {
Q_OBJECT
- Q_DISABLE_COPY(Profiler)
public:
struct SentMarker {
SentMarker() : m_function(nullptr) {}
@@ -212,18 +211,18 @@ public:
Profiler(QV4::ExecutionEngine *engine);
- size_t trackAlloc(size_t size, MemoryType type)
+ bool trackAlloc(size_t size, MemoryType type)
{
MemoryAllocationProperties allocation = {m_timer.nsecsElapsed(), (qint64)size, type};
m_memory_data.append(allocation);
- return size;
+ return true;
}
- void *trackDealloc(void *pointer, size_t size, MemoryType type)
+ bool trackDealloc(size_t size, MemoryType type)
{
MemoryAllocationProperties allocation = {m_timer.nsecsElapsed(), -(qint64)size, type};
m_memory_data.append(allocation);
- return pointer;
+ return true;
}
quint64 featuresEnabled;