Bug 1007862 - Update name of barriered base class in SpiderMonkey's GDB pretty-printers, r=jimb,sfink

This patch fixes test failures in js/src/gdb/tests/test-Root.py.

js::PreBarriered is no longer the common base class for SpiderMonkey's GC graph
edge types; now js::BarrieredBase is the best choice for pretty-printers to
support. Also, there is no longer a separate hierarchy for non-pointer types
(eg JS::Value). Update the pretty-printers and their tests.

--HG--
extra : rebase_source : 9c8190c47fcdb5be60c94e20b2eebdfff2394c96
This commit is contained in:
Jim Blandy 2014-05-12 15:02:10 -07:00
parent c5f689a020
commit 3f9631f2c0
3 changed files with 38 additions and 11 deletions

View File

@ -63,18 +63,10 @@ class Handle(Common):
class MutableHandle(Common):
handle = True
@template_pretty_printer("js::PreBarriered")
@template_pretty_printer("js::BarrieredBase")
class PreBarriered(Common):
member = 'value'
@pretty_printer("js::PreBarrieredValue")
class PreBarrieredValue(Common):
member = 'value'
@pretty_printer("js::BarrieredValue")
class BarrieredValue(Common):
member = 'value'
# Return the referent of a HeapPtr, Rooted, or Handle.
def deref(root):
tag = root.type.strip_typedefs().tag

View File

@ -1,5 +1,9 @@
#include "gdb-tests.h"
#include "jsapi.h"
#include "jsobj.h"
#include "gc/Barrier.h"
FRAGMENT(Root, null) {
JS::Rooted<JSObject *> null(cx, nullptr);
@ -32,3 +36,26 @@ FRAGMENT(Root, HeapSlot) {
(void) plinth;
(void) array;
}
FRAGMENT(Root, barriers) {
JSObject *obj = JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr());
js::PreBarriered<JSObject *> prebarriered(obj);
js::HeapPtr<JSObject *> heapptr(obj);
js::RelocatablePtr<JSObject *> relocatable(obj);
JS::Value val = JS::ObjectValue(*obj);
js::PreBarrieredValue prebarrieredValue(JS::ObjectValue(*obj));
js::HeapValue heapValue(JS::ObjectValue(*obj));
js::RelocatableValue relocatableValue(JS::ObjectValue(*obj));
breakpoint();
(void) prebarriered;
(void) heapptr;
(void) relocatable;
(void) val;
(void) prebarrieredValue;
(void) heapValue;
(void) relocatableValue;
}

View File

@ -3,8 +3,7 @@
assert_subprinter_registered('SpiderMonkey', 'instantiations-of-JS::Rooted')
assert_subprinter_registered('SpiderMonkey', 'instantiations-of-JS::Handle')
assert_subprinter_registered('SpiderMonkey', 'instantiations-of-JS::MutableHandle')
assert_subprinter_registered('SpiderMonkey', 'instantiations-of-js::PreBarriered')
assert_subprinter_registered('SpiderMonkey', 'js::PreBarrieredValue')
assert_subprinter_registered('SpiderMonkey', 'instantiations-of-js::BarrieredBase')
run_fragment('Root.handle')
@ -17,3 +16,12 @@ run_fragment('Root.HeapSlot')
# not a public type, I'm not sure how to avoid doing *something* ugly.
assert_pretty('array->elements[0]', '$jsval("plinth")')
run_fragment('Root.barriers');
assert_pretty('prebarriered', '(JSObject *) [object Object]');
assert_pretty('heapptr', '(JSObject *) [object Object]');
assert_pretty('relocatable', '(JSObject *) [object Object]');
assert_pretty('val', '$jsval((JSObject *) [object Object])');
assert_pretty('heapValue', '$jsval((JSObject *) [object Object])');
assert_pretty('prebarrieredValue', '$jsval((JSObject *) [object Object])');
assert_pretty('relocatableValue', '$jsval((JSObject *) [object Object])');