Bug 1063247: Allow implicit construction of JS::ubi::Node from JS::HandleValue. r=terrence
authorJim Blandy <jimb@mozilla.com>
Fri, 19 Sep 2014 15:10:00 -0700
changeset 206325 b1cbc5079834
parent 206324 e739ab313ce7
child 206326 ef6d81ac0bba
push id27524
push usercbook@mozilla.com
push date2014-09-22 10:59 +0000
treeherdermozilla-central@53f7f5b6d7bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs1063247
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1063247: Allow implicit construction of JS::ubi::Node from JS::HandleValue. r=terrence This seems reasonable, since a ubi::Node is really just a pointer with some introspection support, so the value and the Node are pretty similar. And I don't see cases where you'd want an error.
js/public/UbiNode.h
js/src/vm/UbiNode.cpp
--- a/js/public/UbiNode.h
+++ b/js/public/UbiNode.h
@@ -266,17 +266,17 @@ class Node {
     }
     template<typename T>
     Node &operator=(const Rooted<T *> &root) {
         construct(root.get());
         return *this;
     }
 
     // Constructors accepting SpiderMonkey's other generic-pointer-ish types.
-    explicit Node(JS::Value value);
+    Node(JS::HandleValue value);
     Node(JSGCTraceKind kind, void *ptr);
 
     // copy construction and copy assignment just use memcpy, since we know
     // instances contain nothing but a vtable pointer and a data pointer.
     //
     // To be completely correct, concrete classes could provide a virtual
     // 'construct' member function, which we could invoke on rhs to construct an
     // instance in our storage. But this is good enough; there's no need to jump
--- a/js/src/vm/UbiNode.cpp
+++ b/js/src/vm/UbiNode.cpp
@@ -55,17 +55,17 @@ Node::Node(JSGCTraceKind kind, void *ptr
       case JSTRACE_BASE_SHAPE:  construct(static_cast<js::BaseShape *>(ptr));         break;
       case JSTRACE_TYPE_OBJECT: construct(static_cast<js::types::TypeObject *>(ptr)); break;
 
       default:
         MOZ_CRASH("bad JSGCTraceKind passed to JS::ubi::Node::Node");
     }
 }
 
-Node::Node(Value value)
+Node::Node(HandleValue value)
 {
     if (value.isObject())
         construct(&value.toObject());
     else if (value.isString())
         construct(value.toString());
     else if (value.isSymbol())
         construct(value.toSymbol());
     else