author | Bill McCloskey <wmccloskey@mozilla.com> |
Thu, 21 Mar 2013 18:15:39 -0700 | |
changeset 125940 | 7de024ba26d38bdbaa26a9be3772fb8ba3a60f8f |
parent 125939 | b170e3ee24c07c764325ca6e4e9d9a6c2b2a3d8e |
child 125941 | 7ccd3fb99cd9269e2999962a9538d56538a4d195 |
push id | 25180 |
push user | wmccloskey@mozilla.com |
push date | Fri, 22 Mar 2013 18:01:41 +0000 |
treeherder | mozilla-inbound@4b3ba25df1af [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | luke |
bugs | 853228 |
milestone | 22.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
js/src/jsdbgapi.cpp | file | annotate | diff | comparison | revisions | |
js/src/jsdbgapi.h | file | annotate | diff | comparison | revisions | |
js/src/jsobj.h | file | annotate | diff | comparison | revisions | |
js/src/jsobjinlines.h | file | annotate | diff | comparison | revisions |
--- a/js/src/jsdbgapi.cpp +++ b/js/src/jsdbgapi.cpp @@ -825,99 +825,16 @@ JS_SetDebugErrorHook(JSRuntime *rt, JSDe { rt->debugHooks.debugErrorHook = hook; rt->debugHooks.debugErrorHookData = closure; return JS_TRUE; } /************************************************************************/ -JS_PUBLIC_API(size_t) -JS_GetObjectTotalSize(JSContext *cx, JSObject *obj) -{ - return obj->computedSizeOfThisSlotsElements(); -} - -static size_t -GetAtomTotalSize(JSContext *cx, JSAtom *atom) -{ - return sizeof(AtomStateEntry) + sizeof(HashNumber) + - sizeof(JSString) + - (atom->length() + 1) * sizeof(jschar); -} - -JS_PUBLIC_API(size_t) -JS_GetFunctionTotalSize(JSContext *cx, JSFunction *fun) -{ - size_t nbytes = sizeof *fun; - nbytes += JS_GetObjectTotalSize(cx, fun); - if (fun->isInterpreted()) - nbytes += JS_GetScriptTotalSize(cx, fun->nonLazyScript()); - if (fun->displayAtom()) - nbytes += GetAtomTotalSize(cx, fun->displayAtom()); - return nbytes; -} - -JS_PUBLIC_API(size_t) -JS_GetScriptTotalSize(JSContext *cx, JSScript *script) -{ - size_t nbytes, pbytes; - jssrcnote *sn, *notes; - ObjectArray *objarray; - JSPrincipals *principals; - - nbytes = sizeof *script; - nbytes += script->length * sizeof script->code[0]; - nbytes += script->natoms * sizeof script->atoms[0]; - for (size_t i = 0; i < script->natoms; i++) - nbytes += GetAtomTotalSize(cx, script->atoms[i]); - - if (script->filename()) - nbytes += strlen(script->filename()) + 1; - - notes = script->notes(); - for (sn = notes; !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) - continue; - nbytes += (sn - notes + 1) * sizeof *sn; - - if (script->hasObjects()) { - objarray = script->objects(); - size_t i = objarray->length; - nbytes += sizeof *objarray + i * sizeof objarray->vector[0]; - do { - nbytes += JS_GetObjectTotalSize(cx, objarray->vector[--i]); - } while (i != 0); - } - - if (script->hasRegexps()) { - objarray = script->regexps(); - size_t i = objarray->length; - nbytes += sizeof *objarray + i * sizeof objarray->vector[0]; - do { - nbytes += JS_GetObjectTotalSize(cx, objarray->vector[--i]); - } while (i != 0); - } - - if (script->hasTrynotes()) - nbytes += sizeof(TryNoteArray) + script->trynotes()->length * sizeof(JSTryNote); - - principals = script->principals(); - if (principals) { - JS_ASSERT(principals->refcount); - pbytes = sizeof *principals; - if (principals->refcount > 1) - pbytes = JS_HOWMANY(pbytes, principals->refcount); - nbytes += pbytes; - } - - return nbytes; -} - -/************************************************************************/ - JS_FRIEND_API(void) js_RevertVersion(JSContext *cx) { cx->clearVersionOverride(); } JS_PUBLIC_API(const JSDebugHooks *) JS_GetGlobalDebugHooks(JSRuntime *rt)
--- a/js/src/jsdbgapi.h +++ b/js/src/jsdbgapi.h @@ -426,27 +426,16 @@ JS_SetCallHook(JSRuntime *rt, JSInterpre extern JS_PUBLIC_API(JSBool) JS_SetThrowHook(JSRuntime *rt, JSThrowHook hook, void *closure); extern JS_PUBLIC_API(JSBool) JS_SetDebugErrorHook(JSRuntime *rt, JSDebugErrorHook hook, void *closure); /************************************************************************/ -extern JS_PUBLIC_API(size_t) -JS_GetObjectTotalSize(JSContext *cx, JSObject *obj); - -extern JS_PUBLIC_API(size_t) -JS_GetFunctionTotalSize(JSContext *cx, JSFunction *fun); - -extern JS_PUBLIC_API(size_t) -JS_GetScriptTotalSize(JSContext *cx, JSScript *script); - -/************************************************************************/ - extern JS_FRIEND_API(void) js_RevertVersion(JSContext *cx); extern JS_PUBLIC_API(const JSDebugHooks *) JS_GetGlobalDebugHooks(JSRuntime *rt); /** * Add various profiling-related functions as properties of the given object.
--- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -382,18 +382,16 @@ class JSObject : public js::ObjectImpl * the object's elements. */ inline bool isIndexed() const; inline uint32_t propertyCount() const; inline bool hasShapeTable() const; - inline size_t computedSizeOfThisSlotsElements() const; - inline void sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf, JS::ObjectsExtraSizes *sizes); bool hasIdempotentProtoChain() const; static const uint32_t MAX_FIXED_SLOTS = 16; public:
--- a/js/src/jsobjinlines.h +++ b/js/src/jsobjinlines.h @@ -1077,36 +1077,16 @@ JSObject::propertyCount() const } inline bool JSObject::hasShapeTable() const { return lastProperty()->hasTable(); } -inline size_t -JSObject::computedSizeOfThisSlotsElements() const -{ - size_t n = sizeOfThis(); - - if (hasDynamicSlots()) - n += numDynamicSlots() * sizeof(js::Value); - - if (hasDynamicElements()) { - if (isArrayBuffer()) { - n += getElementsHeader()->initializedLength; - } else { - n += (js::ObjectElements::VALUES_PER_HEADER + getElementsHeader()->capacity) * - sizeof(js::Value); - } - } - - return n; -} - inline void JSObject::sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf, JS::ObjectsExtraSizes *sizes) { if (hasDynamicSlots()) sizes->slots = mallocSizeOf(slots); if (hasDynamicElements()) { js::ObjectElements *elements = getElementsHeader();