Bug 832026 - Measure JSRuntime::bumpAlloc_ in the JS memory reporter. r=sstangl.

--HG--
rename : js/src/tests/lib/jittests.py => js/src/jit-test/jit_test.py
rename : layout/reftests/w3c-css/submitted/values3/calc-background-image-gradient-1-ref.html => layout/reftests/css-calc/background-image-gradient-1-ref.html
rename : layout/reftests/w3c-css/submitted/values3/calc-background-image-gradient-1.html => layout/reftests/css-calc/background-image-gradient-1.html
rename : layout/reftests/w3c-css/submitted/values3/reftest.list => layout/reftests/css-calc/reftest.list
rename : layout/reftests/text/auto-hyphenation-10-ref.html => layout/reftests/text/auto-hyphenation-10.html
rename : layout/reftests/text/auto-hyphenation-8-ref.html => layout/reftests/text/auto-hyphenation-8.html
rename : layout/reftests/text/auto-hyphenation-9-ref.html => layout/reftests/text/auto-hyphenation-9.html
rename : services/common/servicesComponents.manifest => services/sync/SyncComponents.manifest
extra : rebase_source : 6b9d955241e189e52c6145f3fb4c3169ec834b78
This commit is contained in:
Nicholas Nethercote 2013-01-17 17:50:21 -08:00
parent a926ada6e0
commit 3d1624e9a0
4 changed files with 31 additions and 19 deletions

View File

@ -120,22 +120,7 @@ struct HugeStringInfo
// compartments within it.
struct RuntimeSizes
{
RuntimeSizes()
: object(0)
, atomsTable(0)
, contexts(0)
, dtoa(0)
, temporary(0)
, jaegerCode(0)
, ionCode(0)
, regexpCode(0)
, unusedCode(0)
, stack(0)
, gcMarker(0)
, mathCache(0)
, scriptFilenames(0)
, scriptSources(0)
{}
RuntimeSizes() { memset(this, 0, sizeof(RuntimeSizes)); }
size_t object;
size_t atomsTable;
@ -146,6 +131,7 @@ struct RuntimeSizes
size_t ionCode;
size_t regexpCode;
size_t unusedCode;
size_t regexpData;
size_t stack;
size_t gcMarker;
size_t mathCache;

View File

@ -134,6 +134,8 @@ JSRuntime::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, RuntimeSizes *rtS
rtSizes->unusedCode = 0;
}
rtSizes->regexpData = bumpAlloc_ ? bumpAlloc_->sizeOfNonHeapData() : 0;
rtSizes->stack = stackSpace.sizeOf();
rtSizes->gcMarker = gcMarker.sizeOfExcludingThis(mallocSizeOf);
@ -148,15 +150,18 @@ JSRuntime::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, RuntimeSizes *rtS
size_t
JSRuntime::sizeOfExplicitNonHeap()
{
size_t size = stackSpace.sizeOf();
size_t n = stackSpace.sizeOf();
if (execAlloc_) {
size_t jaegerCode, ionCode, regexpCode, unusedCode;
execAlloc_->sizeOfCode(&jaegerCode, &ionCode, &regexpCode, &unusedCode);
size += jaegerCode + ionCode + regexpCode + unusedCode;
n += jaegerCode + ionCode + regexpCode + unusedCode;
}
return size;
if (bumpAlloc_)
n += bumpAlloc_->sizeOfNonHeapData();
return n;
}
void

View File

@ -96,6 +96,18 @@ public:
return deallocCrossPool(this, position);
}
size_t sizeOfNonHeapData() const
{
ASSERT(!m_previous);
size_t n = 0;
const BumpPointerPool *curr = this;
while (curr) {
n += m_allocation.size();
curr = curr->m_next;
}
return n;
}
private:
// Placement operator new, returns the last 'size' bytes of allocation for use as this.
void* operator new(size_t size, const PageAllocation& allocation)
@ -249,6 +261,11 @@ public:
m_head->shrink();
}
size_t sizeOfNonHeapData() const
{
return m_head ? m_head->sizeOfNonHeapData() : 0;
}
private:
BumpPointerPool* m_head;
};

View File

@ -1857,6 +1857,10 @@ ReportJSRuntimeExplicitTreeStats(const JS::RuntimeStats &rtStats,
"Memory allocated by one of the JITs to hold the "
"runtime's code, but which is currently unused.");
RREPORT_BYTES(rtPath + NS_LITERAL_CSTRING("runtime/regexp-data"),
nsIMemoryReporter::KIND_NONHEAP, rtStats.runtime.regexpData,
"Memory used by the regexp JIT to hold data.");
RREPORT_BYTES(rtPath + NS_LITERAL_CSTRING("runtime/stack"),
nsIMemoryReporter::KIND_NONHEAP, rtStats.runtime.stack,
"Memory used for the JS call stack. This is the committed "