js/src/gdb/tests/test-Root.cpp
author Nicholas Nethercote <nnethercote@mozilla.com>
Thu, 05 Sep 2013 16:08:57 -0700
changeset 158706 c1262e2db2912441cc4f7326e2c1ab161c8b947c
parent 152752 d19b33105ded79448f91e023e721960fd8a610c4
child 162434 5d34afe94163e58ad32ded6f3bc47e3c389b1e60
permissions -rw-r--r--
Bug 912411 (part 3) - Remove lots of jsapi.h includes in SpiderMonkey. r=luke.

#include "gdb-tests.h"
#include "jsapi.h"

FRAGMENT(Root, null) {
  JS::Rooted<JSObject *> null(cx, NULL);

  breakpoint();

  (void) null;
}

void callee(JS::Handle<JSObject *> obj, JS::MutableHandle<JSObject *> mutableObj)
{
  // Prevent the linker from unifying this function with others that are
  // equivalent in machine code but not type.
  fprintf(stderr, "Called " __FILE__ ":callee\n");
  breakpoint();
}

FRAGMENT(Root, handle) {
  JS::Rooted<JSObject *> global(cx, JS::CurrentGlobalOrNull(cx));
  callee(global, &global);
  (void) global;
}

FRAGMENT(Root, HeapSlot) {
  JS::Rooted<jsval> plinth(cx, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, "plinth")));
  JS::Rooted<JSObject *> array(cx, JS_NewArrayObject(cx, 1, plinth.address()));

  breakpoint();

  (void) plinth;
  (void) array;
}