Bug 1075564: Give JS::ubi::Node its implicit constructor back, with the right annotation this time. r=luke

This commit is contained in:
Jim Blandy 2014-10-02 10:19:10 +01:00
parent 5d3c893ed4
commit eb0712728b
2 changed files with 5 additions and 2 deletions

View File

@ -274,7 +274,10 @@ class Node {
}
// Constructors accepting SpiderMonkey's other generic-pointer-ish types.
explicit Node(JS::HandleValue value);
// Note that we *do* want an implicit constructor here: JS::Value and
// JS::ubi::Node are both essentially tagged references to other sorts of
// objects, so letting conversions happen automatically is appropriate.
MOZ_IMPLICIT Node(JS::HandleValue value);
Node(JSGCTraceKind kind, void *ptr);
// copy construction and copy assignment just use memcpy, since we know

View File

@ -2069,7 +2069,7 @@ ByteSize(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
mozilla::MallocSizeOf mallocSizeOf = cx->runtime()->debuggerMallocSizeOf;
JS::ubi::Node node(args.get(0));
JS::ubi::Node node = args.get(0);
if (node)
args.rval().set(NumberValue(node.size(mallocSizeOf)));
else