Fix an assertion hit when printing a JSFunction

3 views
Skip to first unread message

redna...@gmail.com

unread,
Nov 24, 2013, 9:47:42 AM11/24/13
to v8-...@googlegroups.com
Hi all,

When printing a JSFunction instance in a debugger, with MaybeObject::PrintLn() which eventually calls JSFunction::JSFunctionPrint(FILE*), it may hit an assertion calling JSFunction::literal() if the function instance is a bound function.

#
# Fatal error in ../src/objects-inl.h, line 5161
# CHECK(!shared()->bound()) failed
#

Here's a quick patch to fix the problem:

diff --git a/src/objects-printer.cc b/src/objects-printer.cc
index 9f1b939..10fe4ef 100644
--- a/src/objects-printer.cc
+++ b/src/objects-printer.cc
@@ -862,8 +862,13 @@ void JSFunction::JSFunctionPrint(FILE* out) {
   shared()->name()->Print(out);
   PrintF(out, "\n - context = ");
   context()->ShortPrint(out);
-  PrintF(out, "\n - literals = ");
-  literals()->ShortPrint(out);
+  if (!shared()->bound()) {
+    PrintF(out, "\n - literals = ");
+    literals()->ShortPrint(out);
+  } else {
+    PrintF(out, "\n - bindings = ");
+    function_bindings()->ShortPrint(out);
+  }
   PrintF(out, "\n - code = ");
   code()->ShortPrint(out);
   PrintF(out, "\n");


Best regards,
Kris

Sven Panne

unread,
Nov 25, 2013, 7:14:27 AM11/25/13
to v8-...@googlegroups.com
Fix under review: https://codereview.chromium.org/85613003/

Thanks for the bug report and fix,
   S.

Krystal Mok

unread,
Nov 25, 2013, 10:34:22 AM11/25/13
to v8-...@googlegroups.com
Hi Sven,

Thanks for taking care of the patch!

- Kris


--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to a topic in the Google Groups "v8-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/v8-dev/U5f7LTiAQvQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to v8-dev+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages