Bug 878495 - In shell, print "[native code]" for native functions. r=luke
authorBenjamin Bouvier <bbouvier@mozilla.com>
Fri, 07 Jun 2013 10:57:21 -0700
changeset 134398 5860d85b0006388563f52a188584181fb71b57d3
parent 134397 d65ae86e598839196d88ea016575af20a5562c96
child 134399 859ee3960254a5f0fd6206a73172b4bc7cb614fb
push id29194
push userryanvm@gmail.com
push dateFri, 07 Jun 2013 19:22:07 +0000
treeherdermozilla-inbound@859ee3960254 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs878495
milestone24.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 878495 - In shell, print "[native code]" for native functions. r=luke
js/src/jit-test/tests/asm.js/testBug878495.js
js/src/shell/js.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/asm.js/testBug878495.js
@@ -0,0 +1,10 @@
+var disassemble = disassemble || false;
+if (disassemble)
+{
+    disassemble("-r", (function() {
+        (function() {
+            "use asm"
+            return {}
+        })()
+    }))
+}
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -1906,17 +1906,19 @@ DisassembleScript(JSContext *cx, HandleS
         ObjectArray *objects = script->objects();
         for (unsigned i = 0; i != objects->length; ++i) {
             JSObject *obj = objects->vector[i];
             if (obj->isFunction()) {
                 Sprint(sp, "\n");
                 RootedFunction f(cx, obj->toFunction());
                 RootedScript script(cx);
                 JSFunction::maybeGetOrCreateScript(cx, f, &script);
-                if (!DisassembleScript(cx, script, fun, lines, recursive, sp))
+                if (!script)
+                    Sprint(sp, "[native code]\n");
+                else if (!DisassembleScript(cx, script, fun, lines, recursive, sp))
                     return false;
             }
         }
     }
     return true;
 }
 
 namespace {