Bug 815010 - Create lazy interpreted function's script in the jsdbg API's JS_GetFunctionScript. r=luke
authorTill Schneidereit <tschneidereit@gmail.com>
Mon, 10 Dec 2012 15:46:52 +0100
changeset 125181 ff71c0ea0cb2ea48a8cbffd4578a1f1eb3428eb0
parent 125180 8afa0fd12d00acec7182b99a5e99042c156a5ed3
child 125182 95d8473212953b3eb9ec036b58293e224fdee60f
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs815010
milestone20.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
Bug 815010 - Create lazy interpreted function's script in the jsdbg API's JS_GetFunctionScript. r=luke
js/src/jsdbgapi.cpp
--- a/js/src/jsdbgapi.cpp
+++ b/js/src/jsdbgapi.cpp
@@ -443,17 +443,28 @@ extern JS_PUBLIC_API(void)
 JS_ReleaseFunctionLocalNameArray(JSContext *cx, void *mark)
 {
     cx->tempLifoAlloc().release(mark);
 }
 
 JS_PUBLIC_API(JSScript *)
 JS_GetFunctionScript(JSContext *cx, JSFunction *fun)
 {
-    return fun->maybeNonLazyScript();
+    if (fun->isNative())
+        return NULL;
+    RawScript script;
+    if (fun->isInterpretedLazy()) {
+       AutoCompartment funCompartment(cx, fun);
+       script = fun->getOrCreateScript(cx);
+        if (!script)
+            MOZ_CRASH();
+    } else {
+        script = fun->nonLazyScript();
+    }
+    return script;
 }
 
 JS_PUBLIC_API(JSNative)
 JS_GetFunctionNative(JSContext *cx, JSFunction *fun)
 {
     return fun->maybeNative();
 }