diff --git a/include/ircd/js/root.h b/include/ircd/js/root.h index 672e308ea..56c417464 100644 --- a/include/ircd/js/root.h +++ b/include/ircd/js/root.h @@ -93,6 +93,23 @@ struct root root &operator=(const root &) = delete; }; +// This conversion is missing in the jsapi. Is this object not gc rooted? Can it not have a handle? +template +JS::Handle +operator&(const JS::Heap &h) +{ + return JS::Handle::fromMarkedLocation(h.address()); +} + +// This conversion is missing in the jsapi. Is this object not gc rooted? Can it not have a handle? +template +JS::MutableHandle +operator&(JS::Heap &h) +{ + const auto ptr(const_cast(h.address())); + return JS::MutableHandle::fromMarkedLocation(ptr); +} + template struct root :JS::Heap @@ -112,16 +129,6 @@ struct root return JS::MutableHandle::fromMarkedLocation(ptr); } - auto operator&() const - { - return static_cast(*this); - } - - auto operator&() - { - return static_cast(*this); - } - root(const handle &h) :JS::Heap{h} { @@ -154,6 +161,23 @@ struct root root &operator=(const root &) = default; }; +// This conversion is missing in the jsapi. Is this object not gc rooted? Can it not have a handle? +template +JS::Handle +operator&(const JS::TenuredHeap &h) +{ + return JS::Handle::fromMarkedLocation(h.address()); +} + +// This conversion is missing in the jsapi. Is this object not gc rooted? Can it not have a handle? +template +JS::MutableHandle +operator&(JS::TenuredHeap &h) +{ + const auto ptr(const_cast(h.address())); + return JS::MutableHandle::fromMarkedLocation(ptr); +} + template struct root :JS::TenuredHeap