From 3f9631f2c07352c5454497770db009c49447568b Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Mon, 12 May 2014 15:02:10 -0700 Subject: [PATCH] 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 --- js/src/gdb/mozilla/Root.py | 10 +--------- js/src/gdb/tests/test-Root.cpp | 27 +++++++++++++++++++++++++++ js/src/gdb/tests/test-Root.py | 12 ++++++++++-- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/js/src/gdb/mozilla/Root.py b/js/src/gdb/mozilla/Root.py index 62906d2bb8b..81e9623588f 100644 --- a/js/src/gdb/mozilla/Root.py +++ b/js/src/gdb/mozilla/Root.py @@ -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 diff --git a/js/src/gdb/tests/test-Root.cpp b/js/src/gdb/tests/test-Root.cpp index 86f33cc5271..004c0c059cb 100644 --- a/js/src/gdb/tests/test-Root.cpp +++ b/js/src/gdb/tests/test-Root.cpp @@ -1,5 +1,9 @@ #include "gdb-tests.h" + #include "jsapi.h" +#include "jsobj.h" + +#include "gc/Barrier.h" FRAGMENT(Root, null) { JS::Rooted 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 prebarriered(obj); + js::HeapPtr heapptr(obj); + js::RelocatablePtr 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; +} + diff --git a/js/src/gdb/tests/test-Root.py b/js/src/gdb/tests/test-Root.py index 5e14c7a9017..22091fde40c 100644 --- a/js/src/gdb/tests/test-Root.py +++ b/js/src/gdb/tests/test-Root.py @@ -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])');