js/src/gdb/tests/test-Root.cpp

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 #include "gdb-tests.h"
     2 #include "jsapi.h"
     4 FRAGMENT(Root, null) {
     5   JS::Rooted<JSObject *> null(cx, nullptr);
     7   breakpoint();
     9   (void) null;
    10 }
    12 void callee(JS::Handle<JSObject *> obj, JS::MutableHandle<JSObject *> mutableObj)
    13 {
    14   // Prevent the linker from unifying this function with others that are
    15   // equivalent in machine code but not type.
    16   fprintf(stderr, "Called " __FILE__ ":callee\n");
    17   breakpoint();
    18 }
    20 FRAGMENT(Root, handle) {
    21   JS::Rooted<JSObject *> global(cx, JS::CurrentGlobalOrNull(cx));
    22   callee(global, &global);
    23   (void) global;
    24 }
    26 FRAGMENT(Root, HeapSlot) {
    27   JS::Rooted<jsval> plinth(cx, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, "plinth")));
    28   JS::Rooted<JSObject *> array(cx, JS_NewArrayObject(cx, plinth));
    30   breakpoint();
    32   (void) plinth;
    33   (void) array;
    34 }

mercurial