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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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