зеркало из https://github.com/mozilla/pjs.git
Bug 637393 - Give JSScript control over the lifetime of JSPCCounters, to allow freeing with cx (r=dmandelin)
--HG-- extra : rebase_source : 9e94ec8506bc3aac28c1dd0ef5b9047e33ff6e8d
This commit is contained in:
Родитель
aeebf45b27
Коммит
0474b2589d
|
@ -757,6 +757,15 @@ JSPCCounters::init(JSContext *cx, size_t numBytecodes)
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
JSPCCounters::destroy(JSContext *cx)
|
||||
{
|
||||
if (counts) {
|
||||
cx->free_(counts);
|
||||
counts = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
script_finalize(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
|
@ -1499,6 +1508,8 @@ DestroyScript(JSContext *cx, JSScript *script)
|
|||
#endif
|
||||
JS_REMOVE_LINK(&script->links);
|
||||
|
||||
script->pcCounters.destroy(cx);
|
||||
|
||||
cx->free_(script);
|
||||
}
|
||||
|
||||
|
|
|
@ -404,10 +404,11 @@ class JSPCCounters {
|
|||
}
|
||||
|
||||
~JSPCCounters() {
|
||||
js::UnwantedForeground::free_(counts);
|
||||
JS_ASSERT(!counts);
|
||||
}
|
||||
|
||||
bool init(JSContext *cx, size_t numBytecodes);
|
||||
void destroy(JSContext *cx);
|
||||
|
||||
// Boolean conversion, for 'if (counters) ...'
|
||||
operator void*() const {
|
||||
|
|
Загрузка…
Ссылка в новой задаче