Backout bug 798510 because of xpcshell orange

This commit is contained in:
Ehsan Akhgari 2012-10-11 20:17:33 -04:00
parent 9bd722d6b8
commit b648831e48
5 changed files with 17 additions and 81 deletions

View File

@ -53,7 +53,7 @@ struct RuntimeSizes
, ionCode(0)
, regexpCode(0)
, unusedCode(0)
, stack(0)
, stackCommitted(0)
, gcMarker(0)
, mathCache(0)
, scriptFilenames(0)
@ -69,7 +69,7 @@ struct RuntimeSizes
size_t ionCode;
size_t regexpCode;
size_t unusedCode;
size_t stack;
size_t stackCommitted;
size_t gcMarker;
size_t mathCache;
size_t scriptFilenames;

View File

@ -125,7 +125,7 @@ JSRuntime::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, RuntimeSizes *rtS
rtSizes->unusedCode = 0;
}
rtSizes->stack = stackSpace.sizeOf();
rtSizes->stackCommitted = stackSpace.sizeOfCommitted();
rtSizes->gcMarker = gcMarker.sizeOfExcludingThis(mallocSizeOf);
@ -139,15 +139,12 @@ JSRuntime::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, RuntimeSizes *rtS
size_t
JSRuntime::sizeOfExplicitNonHeap()
{
size_t size = stackSpace.sizeOf();
if (!execAlloc_)
return 0;
if (execAlloc_) {
size_t jaegerCode, ionCode, regexpCode, unusedCode;
execAlloc_->sizeOfCode(&jaegerCode, &ionCode, &regexpCode, &unusedCode);
size += jaegerCode + ionCode + regexpCode + unusedCode;
}
return size;
size_t jaegerCode, ionCode, regexpCode, unusedCode;
execAlloc_->sizeOfCode(&jaegerCode, &ionCode, &regexpCode, &unusedCode);
return jaegerCode + ionCode + regexpCode + unusedCode + stackSpace.sizeOfCommitted();
}
void

View File

@ -810,58 +810,11 @@ StackSpace::tryBumpLimit(JSContext *cx, Value *from, unsigned nvals, Value **lim
}
size_t
StackSpace::sizeOf()
StackSpace::sizeOfCommitted()
{
#if defined(XP_UNIX)
/*
* Measure how many of our pages are resident in RAM using mincore, and
* return that as our size. This is slow, but hopefully nobody expects
* this method to be fast.
*
* Note that using mincore means that we don't count pages of the stack
* which are swapped out to disk. We really should, but what we have here
* is better than counting the whole stack!
*/
const int pageSize = getpagesize();
size_t numBytes = (trustedEnd_ - base_) * sizeof(Value);
size_t numPages = (numBytes + pageSize - 1) / pageSize;
// On Linux, mincore's third argument has type unsigned char*. On Mac, it
// has type char*.
#if defined(XP_MACOSX)
typedef char MincoreArgType;
#else
typedef unsigned char MincoreArgType;
#endif
MincoreArgType *vec = (MincoreArgType *) js_malloc(numPages);
int result = mincore(base_, numBytes, vec);
if (result) {
js_free(vec);
/*
* If mincore fails us, return the vsize (like we do below if we're not
* on Windows or Unix).
*/
return (trustedEnd_ - base_) * sizeof(Value);
}
size_t residentBytes = 0;
for (size_t i = 0; i < numPages; i++) {
/* vec[i] has its least-significant bit set iff page i is in RAM. */
if (vec[i] & 0x1)
residentBytes += pageSize;
}
js_free(vec);
return residentBytes;
#elif defined(XP_WIN)
#ifdef XP_WIN
return (commitEnd_ - base_) * sizeof(Value);
#else
/*
* Return the stack's virtual size, which is at least an upper bound on its
* resident size.
*/
return (trustedEnd_ - base_) * sizeof(Value);
#endif
}

View File

@ -1439,12 +1439,8 @@ class StackSpace
/* Called during GC: sets active flag on compartments with active frames. */
void markActiveCompartments();
/*
* On Windows, report the committed size; on *nix, we report the resident
* size (which means that if part of the stack is swapped to disk, we say
* it's shrunk).
*/
JS_FRIEND_API(size_t) sizeOf();
/* We only report the committed size; uncommitted size is uninteresting. */
JS_FRIEND_API(size_t) sizeOfCommitted();
#ifdef DEBUG
/* Only used in assertion of debuggers API. */

View File

@ -1743,21 +1743,11 @@ ReportJSRuntimeExplicitTreeStats(const JS::RuntimeStats &rtStats,
"Memory allocated by one of the JITs to hold the "
"runtime's code, but which is currently unused.");
nsCString stackDescription;
stackDescription.AppendASCII(
"Memory used for the JS call stack. This is the committed portion of "
"the stack on Windows; on *nix, it is the resident portion of the "
"stack. Therefore, on *nix, if part of the stack is swapped out to "
"disk, we do not count it here.");
#ifdef DEBUG
stackDescription.AppendASCII(
" Note: You are running a debug build, which likely has stack "
"poisoning enabled, which causes the whole stack to be committed (and "
"likely resident).");
#endif
RREPORT_BYTES(rtPath + NS_LITERAL_CSTRING("runtime/stack"),
nsIMemoryReporter::KIND_NONHEAP, rtStats.runtime.stack,
stackDescription.get());
RREPORT_BYTES(rtPath + NS_LITERAL_CSTRING("runtime/stack-committed"),
nsIMemoryReporter::KIND_NONHEAP, rtStats.runtime.stackCommitted,
"Memory used for the JS call stack. This is the committed "
"portion of the stack; the uncommitted portion is not "
"measured because it hardly costs anything.");
RREPORT_BYTES(rtPath + NS_LITERAL_CSTRING("runtime/gc-marker"),
nsIMemoryReporter::KIND_HEAP, rtStats.runtime.gcMarker,