typedef QVector<quint64> Counters;
QHash<const char *, Counters> counters;
+ inline void count(const char *func) {
+ QVector<quint64> &cnt = counters[func];
+ if (cnt.isEmpty())
+ cnt.resize(64);
+ cnt[0] += 1;
+ }
+
inline void count(const char *func, unsigned tag) {
QVector<quint64> &cnt = counters[func];
if (cnt.isEmpty())
delete d;
}
+void RuntimeCounters::count(const char *func)
+{
+ d->count(func);
+}
+
void RuntimeCounters::count(const char *func, uint tag)
{
d->count(func, tag);
ReturnedValue __qmljs_value_to_double(const ValueRef value)
{
+ TRACE1(value);
return Encode(value->toNumber());
}
int __qmljs_value_to_int32(const ValueRef value)
{
+ TRACE1(value);
return value->toInt32();
}
int __qmljs_double_to_int32(const double &d)
{
+ TRACE0();
return Primitive::toInt32(d);
}
unsigned __qmljs_value_to_uint32(const ValueRef value)
{
+ TRACE1(value);
return value->toUInt32();
}
unsigned __qmljs_double_to_uint32(const double &d)
{
+ TRACE0();
return Primitive::toUInt32(d);
}
ReturnedValue __qmljs_value_from_string(String *string)
{
+ TRACE0();
return string->asReturnedValue();
}
static RuntimeCounters *instance;
+ void count(const char *func);
void count(const char *func, uint tag);
void count(const char *func, uint tag1, uint tag2);
Data *d;
};
+# define TRACE0() RuntimeCounters::instance->count(Q_FUNC_INFO);
# define TRACE1(x) RuntimeCounters::instance->count(Q_FUNC_INFO, x->type());
# define TRACE2(x, y) RuntimeCounters::instance->count(Q_FUNC_INFO, x->type(), y->type());
#else
+# define TRACE0()
# define TRACE1(x)
# define TRACE2(x, y)
#endif // QV4_COUNT_RUNTIME_FUNCTIONS