[INFER] Only prematurely release script code when calling destroy script hook from GC, bug 679461.

This commit is contained in:
Brian Hackett 2011-08-29 20:45:33 -07:00
parent 639ecd7257
commit 2daef6ad8a

View File

@ -1359,10 +1359,6 @@ js_CallDestroyScriptHook(JSContext *cx, JSScript *script)
{
JSDestroyScriptHook hook;
#ifdef JS_METHODJIT
mjit::ReleaseScriptCode(cx, script);
#endif
hook = cx->debugHooks->destroyScriptHook;
if (hook)
hook(cx, script, cx->debugHooks->destroyScriptHookData);
@ -1455,6 +1451,12 @@ void
js_DestroyScriptFromGC(JSContext *cx, JSScript *script, JSObject *owner)
{
JS_ASSERT(cx->runtime->gcRunning);
#ifdef JS_METHODJIT
/* Keep the hook from trying to recompile while the GC is running. */
mjit::ReleaseScriptCode(cx, script);
#endif
js_CallDestroyScriptHook(cx, script);
DestroyScript(cx, script, owner, 100);
}