aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4mm.cpp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-06-13 20:51:00 +0200
committerHolger Freyther <holger+qt@freyther.de>2014-07-20 09:51:33 +0200
commit9da3da656e47f8924d3f886fff71b847e8daac63 (patch)
treefaf21c89e92eb1cd08ff9bc6c6bef1ac73336b89 /src/qml/jsruntime/qv4mm.cpp
parent3aa02fb3f2dd3e39869cdcf942d8f5a26cc7ad22 (diff)
v4: Manually inline the access to the execution engine
Executing an allocation heavy testcase of JavaScriptCore on my i7 Sandy Bridge notebook 6.85% is spent inside the ::engine() call as gcc 4.8.2 of Debian didn't inline the call. Inline the call sites by hand. I removed the protected ::engine() as it is now unused. $ time qmljs JavaScriptCore/tests/perf/bench-allocate-nonretained.js before (best run of three) real 0m2.234s user 0m2.228s sys 0m0.008s after (worse run of three) real 0m2.097s user 0m2.088s sys 0m0.008s Change-Id: I20b73b3b3dac630eb1d5e7d66bcb50c839630567 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4mm.cpp')
-rw-r--r--src/qml/jsruntime/qv4mm.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/qml/jsruntime/qv4mm.cpp b/src/qml/jsruntime/qv4mm.cpp
index f3374d48e6..3998857291 100644
--- a/src/qml/jsruntime/qv4mm.cpp
+++ b/src/qml/jsruntime/qv4mm.cpp
@@ -195,7 +195,7 @@ Managed *MemoryManager::alloc(std::size_t size)
if (size >= MemoryManager::Data::MaxItemSize) {
// we use malloc for this
MemoryManager::Data::LargeItem *item = static_cast<MemoryManager::Data::LargeItem *>(
- malloc(Q_V4_PROFILE_ALLOC(engine(), size + sizeof(MemoryManager::Data::LargeItem),
+ malloc(Q_V4_PROFILE_ALLOC(m_d->engine, size + sizeof(MemoryManager::Data::LargeItem),
Profiling::LargeItem)));
memset(item, 0, size + sizeof(MemoryManager::Data::LargeItem));
item->next = m_d->largeItems;
@@ -226,7 +226,7 @@ Managed *MemoryManager::alloc(std::size_t size)
allocSize = roundUpToMultipleOf(WTF::pageSize(), allocSize);
Data::Chunk allocation;
allocation.memory = PageAllocation::allocate(
- Q_V4_PROFILE_ALLOC(engine(), allocSize, Profiling::HeapPage),
+ Q_V4_PROFILE_ALLOC(m_d->engine, allocSize, Profiling::HeapPage),
OSAllocator::JSGCHeapPages);
allocation.chunkSize = int(size);
m_d->heapChunks.append(allocation);
@@ -256,7 +256,7 @@ Managed *MemoryManager::alloc(std::size_t size)
#ifdef V4_USE_VALGRIND
VALGRIND_MEMPOOL_ALLOC(this, m, size);
#endif
- Q_V4_PROFILE_ALLOC(engine(), size, Profiling::SmallItem);
+ Q_V4_PROFILE_ALLOC(m_d->engine, size, Profiling::SmallItem);
++m_d->allocCount[pos];
++m_d->totalAlloc;
@@ -373,7 +373,7 @@ void MemoryManager::sweep(bool lastSweep)
m->internalClass->vtable->destroy(m);
*last = i->next;
- free(Q_V4_PROFILE_DEALLOC(engine(), i, i->size + sizeof(Data::LargeItem),
+ free(Q_V4_PROFILE_DEALLOC(m_d->engine, i, i->size + sizeof(Data::LargeItem),
Profiling::LargeItem));
i = *last;
}
@@ -420,7 +420,7 @@ void MemoryManager::sweep(char *chunkStart, std::size_t chunkSize, size_t size)
VALGRIND_DISABLE_ERROR_REPORTING;
VALGRIND_MEMPOOL_FREE(this, m);
#endif
- Q_V4_PROFILE_DEALLOC(engine(), m, size, Profiling::SmallItem);
+ Q_V4_PROFILE_DEALLOC(m_d->engine, m, size, Profiling::SmallItem);
*f = m;
}
}
@@ -552,11 +552,6 @@ void MemoryManager::registerDeletable(GCDeletable *d)
m_d->deletable = d;
}
-ExecutionEngine *MemoryManager::engine() const
-{
- return m_d->engine;
-}
-
#ifdef DETAILED_MM_STATS
void MemoryManager::willAllocate(std::size_t size)
{
@@ -571,8 +566,8 @@ void MemoryManager::willAllocate(std::size_t size)
void MemoryManager::collectFromJSStack() const
{
- Value *v = engine()->jsStackBase;
- Value *top = engine()->jsStackTop;
+ Value *v = m_d->engine->jsStackBase;
+ Value *top = m_d->engine->jsStackTop;
while (v < top) {
Managed *m = v->asManaged();
if (m && m->inUse)