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

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

mercurial