mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 720219 (part 4) - Clean up JS script measurement. r=bhackett.
--HG-- extra : rebase_source : 5c237412c6f3409f81ef23b1ab38b982540e14c3
This commit is contained in:
parent
ca4887ca0c
commit
8d17f2415b
@ -168,9 +168,9 @@ CellCallback(JSContext *cx, void *vdata, void *thing, JSGCTraceKind traceKind,
|
|||||||
{
|
{
|
||||||
JSScript *script = static_cast<JSScript *>(thing);
|
JSScript *script = static_cast<JSScript *>(thing);
|
||||||
curr->gcHeapScripts += thingSize;
|
curr->gcHeapScripts += thingSize;
|
||||||
curr->scriptData += script->dataSize(data->mallocSizeOf);
|
curr->scriptData += script->sizeOfData(data->mallocSizeOf);
|
||||||
#ifdef JS_METHODJIT
|
#ifdef JS_METHODJIT
|
||||||
curr->mjitData += script->jitDataSize(data->mallocSizeOf);
|
curr->mjitData += script->sizeOfJitScripts(data->mallocSizeOf);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
if (typeof mjitdatastats == "function")
|
|
||||||
mjitdatastats();
|
|
@ -1267,7 +1267,7 @@ JSScript::NewScriptFromEmitter(JSContext *cx, BytecodeEmitter *bce)
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
JSScript::dataSize()
|
JSScript::computedSizeOfData()
|
||||||
{
|
{
|
||||||
#if JS_SCRIPT_INLINE_DATA_LIMIT
|
#if JS_SCRIPT_INLINE_DATA_LIMIT
|
||||||
if (data == inlineData)
|
if (data == inlineData)
|
||||||
@ -1280,14 +1280,14 @@ JSScript::dataSize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
JSScript::dataSize(JSMallocSizeOfFun mallocSizeOf)
|
JSScript::sizeOfData(JSMallocSizeOfFun mallocSizeOf)
|
||||||
{
|
{
|
||||||
#if JS_SCRIPT_INLINE_DATA_LIMIT
|
#if JS_SCRIPT_INLINE_DATA_LIMIT
|
||||||
if (data == inlineData)
|
if (data == inlineData)
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return mallocSizeOf(data, dataSize());
|
return mallocSizeOf(data, computedSizeOfData());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1370,7 +1370,7 @@ JSScript::finalize(JSContext *cx, bool background)
|
|||||||
if (data != inlineData)
|
if (data != inlineData)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
JS_POISON(data, 0xdb, dataSize());
|
JS_POISON(data, 0xdb, computedSizeOfData());
|
||||||
cx->free_(data);
|
cx->free_(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -638,7 +638,7 @@ struct JSScript : public js::gc::Cell {
|
|||||||
void resetUseCount() { useCount = 0; }
|
void resetUseCount() { useCount = 0; }
|
||||||
|
|
||||||
/* Size of the JITScript and all sections. (This method is implemented in MethodJIT.cpp.) */
|
/* Size of the JITScript and all sections. (This method is implemented in MethodJIT.cpp.) */
|
||||||
size_t jitDataSize(JSMallocSizeOfFun mallocSizeOf);
|
size_t sizeOfJitScripts(JSMallocSizeOfFun mallocSizeOf);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -656,12 +656,13 @@ struct JSScript : public js::gc::Cell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The first dataSize() is the in-use size of all the data sections, the
|
* computedSizeOfData() is the in-use size of all the data sections.
|
||||||
* second is the size of the block allocated to hold all the data sections
|
* sizeOfData() is the size of the block allocated to hold all the data sections
|
||||||
* (which can be larger than the in-use size).
|
* (which can be larger than the in-use size).
|
||||||
*/
|
*/
|
||||||
JS_FRIEND_API(size_t) dataSize(); /* Size of all data sections */
|
size_t computedSizeOfData();
|
||||||
JS_FRIEND_API(size_t) dataSize(JSMallocSizeOfFun mallocSizeOf); /* Size of all data sections */
|
size_t sizeOfData(JSMallocSizeOfFun mallocSizeOf);
|
||||||
|
|
||||||
uint32_t numNotes(); /* Number of srcnote slots in the srcnotes section */
|
uint32_t numNotes(); /* Number of srcnote slots in the srcnotes section */
|
||||||
|
|
||||||
/* Script notes are allocated right after the code. */
|
/* Script notes are allocated right after the code. */
|
||||||
|
@ -1334,7 +1334,7 @@ mjit::Compiler::finishThisUp()
|
|||||||
nNmapLive++;
|
nNmapLive++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Please keep in sync with JITChunk::scriptDataSize! */
|
/* Please keep in sync with JITChunk::sizeOfIncludingThis! */
|
||||||
size_t dataSize = sizeof(JITChunk) +
|
size_t dataSize = sizeof(JITChunk) +
|
||||||
sizeof(NativeMapEntry) * nNmapLive +
|
sizeof(NativeMapEntry) * nNmapLive +
|
||||||
sizeof(InlineFrame) * inlineFrames.length() +
|
sizeof(InlineFrame) * inlineFrames.length() +
|
||||||
@ -1726,8 +1726,8 @@ mjit::Compiler::finishThisUp()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
JS_ASSERT(size_t(cursor - (uint8_t*)chunk) == dataSize);
|
JS_ASSERT(size_t(cursor - (uint8_t*)chunk) == dataSize);
|
||||||
/* Pass in NULL here -- we don't want slop bytes to be counted. */
|
/* Use the computed size here -- we don't want slop bytes to be counted. */
|
||||||
JS_ASSERT(chunk->scriptDataSize(NULL) == dataSize);
|
JS_ASSERT(chunk->computedSizeOfIncludingThis() == dataSize);
|
||||||
|
|
||||||
/* Link fast and slow paths together. */
|
/* Link fast and slow paths together. */
|
||||||
stubcc.fixCrossJumps(result, masm.size(), masm.size() + stubcc.size());
|
stubcc.fixCrossJumps(result, masm.size(), masm.size() + stubcc.size());
|
||||||
|
@ -1362,54 +1362,58 @@ JITScript::destroyChunk(JSContext *cx, unsigned chunkIndex, bool resetUses)
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
JSScript::jitDataSize(JSMallocSizeOfFun mallocSizeOf)
|
JSScript::sizeOfJitScripts(JSMallocSizeOfFun mallocSizeOf)
|
||||||
{
|
{
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
if (jitNormal)
|
if (jitNormal)
|
||||||
n += jitNormal->scriptDataSize(mallocSizeOf);
|
n += jitNormal->sizeOfIncludingThis(mallocSizeOf);
|
||||||
if (jitCtor)
|
if (jitCtor)
|
||||||
n += jitCtor->scriptDataSize(mallocSizeOf);
|
n += jitCtor->sizeOfIncludingThis(mallocSizeOf);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
mjit::JITScript::scriptDataSize(JSMallocSizeOfFun mallocSizeOf)
|
mjit::JITScript::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf)
|
||||||
{
|
{
|
||||||
size_t usable = mallocSizeOf(this,
|
size_t computedSize = sizeof(JITScript) +
|
||||||
sizeof(JITScript)
|
(nchunks * sizeof(ChunkDescriptor)) +
|
||||||
+ (nchunks * sizeof(ChunkDescriptor))
|
(nedges * sizeof(CrossChunkEdge));
|
||||||
+ (nedges * sizeof(CrossChunkEdge)));
|
size_t n = mallocSizeOf(this, computedSize);
|
||||||
for (unsigned i = 0; i < nchunks; i++) {
|
for (unsigned i = 0; i < nchunks; i++) {
|
||||||
const ChunkDescriptor &desc = chunkDescriptor(i);
|
const ChunkDescriptor &desc = chunkDescriptor(i);
|
||||||
if (desc.chunk)
|
if (desc.chunk)
|
||||||
usable += desc.chunk->scriptDataSize(mallocSizeOf);
|
n += desc.chunk->sizeOfIncludingThis(mallocSizeOf);
|
||||||
}
|
}
|
||||||
return usable;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Please keep in sync with Compiler::finishThisUp! */
|
/* Please keep in sync with Compiler::finishThisUp! */
|
||||||
size_t
|
size_t
|
||||||
mjit::JITChunk::scriptDataSize(JSMallocSizeOfFun mallocSizeOf)
|
mjit::JITChunk::computedSizeOfIncludingThis()
|
||||||
{
|
{
|
||||||
size_t computedSize =
|
return sizeof(JITChunk) +
|
||||||
sizeof(JITChunk) +
|
sizeof(NativeMapEntry) * nNmapPairs +
|
||||||
sizeof(NativeMapEntry) * nNmapPairs +
|
sizeof(InlineFrame) * nInlineFrames +
|
||||||
sizeof(InlineFrame) * nInlineFrames +
|
sizeof(CallSite) * nCallSites +
|
||||||
sizeof(CallSite) * nCallSites +
|
|
||||||
#if defined JS_MONOIC
|
#if defined JS_MONOIC
|
||||||
sizeof(ic::GetGlobalNameIC) * nGetGlobalNames +
|
sizeof(ic::GetGlobalNameIC) * nGetGlobalNames +
|
||||||
sizeof(ic::SetGlobalNameIC) * nSetGlobalNames +
|
sizeof(ic::SetGlobalNameIC) * nSetGlobalNames +
|
||||||
sizeof(ic::CallICInfo) * nCallICs +
|
sizeof(ic::CallICInfo) * nCallICs +
|
||||||
sizeof(ic::EqualityICInfo) * nEqualityICs +
|
sizeof(ic::EqualityICInfo) * nEqualityICs +
|
||||||
#endif
|
#endif
|
||||||
#if defined JS_POLYIC
|
#if defined JS_POLYIC
|
||||||
sizeof(ic::PICInfo) * nPICs +
|
sizeof(ic::PICInfo) * nPICs +
|
||||||
sizeof(ic::GetElementIC) * nGetElems +
|
sizeof(ic::GetElementIC) * nGetElems +
|
||||||
sizeof(ic::SetElementIC) * nSetElems +
|
sizeof(ic::SetElementIC) * nSetElems +
|
||||||
#endif
|
#endif
|
||||||
0;
|
0;
|
||||||
/* |mallocSizeOf| can be null here. */
|
}
|
||||||
return mallocSizeOf ? mallocSizeOf(this, computedSize) : computedSize;
|
|
||||||
|
/* Please keep in sync with Compiler::finishThisUp! */
|
||||||
|
size_t
|
||||||
|
mjit::JITChunk::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf)
|
||||||
|
{
|
||||||
|
return mallocSizeOf(this, computedSizeOfIncludingThis());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -719,8 +719,8 @@ struct JITChunk
|
|||||||
|
|
||||||
void nukeScriptDependentICs();
|
void nukeScriptDependentICs();
|
||||||
|
|
||||||
/* |mallocSizeOf| can be NULL here, in which case the fallback size computation will be used. */
|
size_t computedSizeOfIncludingThis();
|
||||||
size_t scriptDataSize(JSMallocSizeOfFun mallocSizeOf);
|
size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf);
|
||||||
|
|
||||||
~JITChunk();
|
~JITChunk();
|
||||||
|
|
||||||
@ -842,7 +842,7 @@ struct JITScript
|
|||||||
|
|
||||||
jsbytecode *nativeToPC(void *returnAddress, CallSite **pinline);
|
jsbytecode *nativeToPC(void *returnAddress, CallSite **pinline);
|
||||||
|
|
||||||
size_t scriptDataSize(JSMallocSizeOfFun mallocSizeOf);
|
size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf);
|
||||||
|
|
||||||
void destroy(JSContext *cx);
|
void destroy(JSContext *cx);
|
||||||
void destroyChunk(JSContext *cx, unsigned chunkIndex, bool resetUses = true);
|
void destroyChunk(JSContext *cx, unsigned chunkIndex, bool resetUses = true);
|
||||||
|
@ -3813,43 +3813,6 @@ MJitCodeStats(JSContext *cx, uintN argc, jsval *vp)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef JS_METHODJIT
|
|
||||||
|
|
||||||
static size_t
|
|
||||||
computedSize(const void *p, size_t size)
|
|
||||||
{
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
SumJitDataSizeCallback(JSContext *cx, void *data, void *thing,
|
|
||||||
JSGCTraceKind traceKind, size_t thingSize)
|
|
||||||
{
|
|
||||||
size_t *sump = static_cast<size_t *>(data);
|
|
||||||
JS_ASSERT(traceKind == JSTRACE_SCRIPT);
|
|
||||||
JSScript *script = static_cast<JSScript *>(thing);
|
|
||||||
/*
|
|
||||||
* Passing in |computedSize| causes jitDataSize to fall back to its
|
|
||||||
* secondary size computation.
|
|
||||||
*/
|
|
||||||
*sump += script->jitDataSize(computedSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
JSBool
|
|
||||||
MJitDataStats(JSContext *cx, uintN argc, jsval *vp)
|
|
||||||
{
|
|
||||||
#ifdef JS_METHODJIT
|
|
||||||
size_t n = 0;
|
|
||||||
IterateCells(cx, NULL, gc::FINALIZE_SCRIPT, &n, SumJitDataSizeCallback);
|
|
||||||
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(n));
|
|
||||||
#else
|
|
||||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
|
||||||
#endif
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
JSBool
|
JSBool
|
||||||
MJitChunkLimit(JSContext *cx, uintN argc, jsval *vp)
|
MJitChunkLimit(JSContext *cx, uintN argc, jsval *vp)
|
||||||
{
|
{
|
||||||
@ -4041,7 +4004,6 @@ static JSFunctionSpec shell_functions[] = {
|
|||||||
JS_FN("deserialize", Deserialize, 1,0),
|
JS_FN("deserialize", Deserialize, 1,0),
|
||||||
#ifdef JS_METHODJIT
|
#ifdef JS_METHODJIT
|
||||||
JS_FN("mjitcodestats", MJitCodeStats, 0,0),
|
JS_FN("mjitcodestats", MJitCodeStats, 0,0),
|
||||||
JS_FN("mjitdatastats", MJitDataStats, 0,0),
|
|
||||||
#endif
|
#endif
|
||||||
JS_FN("mjitChunkLimit", MJitChunkLimit, 1,0),
|
JS_FN("mjitChunkLimit", MJitChunkLimit, 1,0),
|
||||||
JS_FN("stringstats", StringStats, 0,0),
|
JS_FN("stringstats", StringStats, 0,0),
|
||||||
@ -4189,7 +4151,6 @@ static const char *const shell_help_messages[] = {
|
|||||||
"deserialize(a) Deserialize data generated by serialize.",
|
"deserialize(a) Deserialize data generated by serialize.",
|
||||||
#ifdef JS_METHODJIT
|
#ifdef JS_METHODJIT
|
||||||
"mjitcodestats() Return stats on mjit code memory usage.",
|
"mjitcodestats() Return stats on mjit code memory usage.",
|
||||||
"mjitdatastats() Return stats on mjit data memory usage.",
|
|
||||||
#endif
|
#endif
|
||||||
"mjitChunkLimit(N) Specify limit on compiled chunk size during mjit compilation.",
|
"mjitChunkLimit(N) Specify limit on compiled chunk size during mjit compilation.",
|
||||||
"stringstats() Return stats on string memory usage.",
|
"stringstats() Return stats on string memory usage.",
|
||||||
|
Loading…
Reference in New Issue
Block a user