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

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:c83702330755
1 #include "gdb-tests.h"
2 #include "jsapi.h"
3
4 FRAGMENT(Root, null) {
5 JS::Rooted<JSObject *> null(cx, nullptr);
6
7 breakpoint();
8
9 (void) null;
10 }
11
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 }
19
20 FRAGMENT(Root, handle) {
21 JS::Rooted<JSObject *> global(cx, JS::CurrentGlobalOrNull(cx));
22 callee(global, &global);
23 (void) global;
24 }
25
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));
29
30 breakpoint();
31
32 (void) plinth;
33 (void) array;
34 }

mercurial