summaryrefslogtreecommitdiffstats
path: root/js/src/gc/Heap.h
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-11-20 09:47:03 +0000
committerMoonchild <moonchild@palemoon.org>2020-11-20 09:47:03 +0000
commit5165ed02285315cc0bed7977c7bac6d0a90ca43c (patch)
tree9b761a21eb924915e51c2d803208e6c01b505a45 /js/src/gc/Heap.h
parente1db27e19989db11fef70f439cf95821316535b3 (diff)
parentca9abcdf1702c37bf00048dab3f460b2252873a3 (diff)
downloadUXP-RC_20201120.tar
UXP-RC_20201120.tar.gz
UXP-RC_20201120.tar.lz
UXP-RC_20201120.tar.xz
UXP-RC_20201120.zip
Merge branch 'redwood' into releaseRELBASE_20201124RELBASE_20201120RC_20201120
Diffstat (limited to 'js/src/gc/Heap.h')
-rw-r--r--js/src/gc/Heap.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/js/src/gc/Heap.h b/js/src/gc/Heap.h
index 697803380..7f2c5fb4f 100644
--- a/js/src/gc/Heap.h
+++ b/js/src/gc/Heap.h
@@ -29,6 +29,7 @@
#include "js/HeapAPI.h"
#include "js/RootingAPI.h"
#include "js/TracingAPI.h"
+#include "js/TraceKind.h"
struct JSRuntime;
@@ -273,6 +274,23 @@ struct Cell
static MOZ_ALWAYS_INLINE bool needWriteBarrierPre(JS::Zone* zone);
+ template <class T>
+ inline bool is() const {
+ return getTraceKind() == JS::MapTypeToTraceKind<T>::kind;
+ }
+
+ template<class T>
+ inline T* as() {
+ MOZ_ASSERT(is<T>());
+ return static_cast<T*>(this);
+ }
+
+ template <class T>
+ inline const T* as() const {
+ MOZ_ASSERT(is<T>());
+ return static_cast<const T*>(this);
+ }
+
#ifdef DEBUG
inline bool isAligned() const;
void dump(FILE* fp) const;