[gjs/wip/ptomato/mozjs52: 27/40] js: Adapt to new JS::TraceEdge<T> API
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs52: 27/40] js: Adapt to new JS::TraceEdge<T> API
- Date: Sun, 11 Jun 2017 02:48:27 +0000 (UTC)
commit 5725a75e56475c50cf077332568729c37f869829
Author: Philip Chimento <philip chimento gmail com>
Date: Mon May 1 22:30:16 2017 -0700
js: Adapt to new JS::TraceEdge<T> API
Replacing the old JS_CallFooTracer() API is a new C++ JS::TraceEdge<T>()
function. It works the same, but is templated. The old API will be going
away in SpiderMonkey 52.
gi/boxed.cpp | 8 ++++----
gi/fundamental.cpp | 4 ++--
gjs/context.cpp | 2 +-
gjs/coverage.cpp | 3 ++-
gjs/jsapi-util-root.h | 24 ++----------------------
5 files changed, 11 insertions(+), 30 deletions(-)
---
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index a1d24c3..f5fd4bc 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -915,10 +915,10 @@ boxed_trace(JSTracer *tracer,
if (priv == NULL)
return;
- JS_CallIdTracer(tracer, &priv->zero_args_constructor_name,
- "Boxed::zero_args_constructor_name");
- JS_CallIdTracer(tracer, &priv->default_constructor_name,
- "Boxed::default_constructor_name");
+ JS::TraceEdge<jsid>(tracer, &priv->zero_args_constructor_name,
+ "Boxed::zero_args_constructor_name");
+ JS::TraceEdge<jsid>(tracer, &priv->default_constructor_name,
+ "Boxed::default_constructor_name");
}
/* The bizarre thing about this vtable is that it applies to both
diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp
index a213d35..677fd65 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -537,8 +537,8 @@ fundamental_trace(JSTracer *tracer,
if (priv == nullptr || !fundamental_is_prototype(priv))
return; /* Only prototypes need tracing */
- JS_CallIdTracer(tracer, &priv->constructor_name,
- "Fundamental::constructor_name");
+ JS::TraceEdge<jsid>(tracer, &priv->constructor_name,
+ "Fundamental::constructor_name");
}
/* The bizarre thing about this vtable is that it applies to both
diff --git a/gjs/context.cpp b/gjs/context.cpp
index c7bb686..f802361 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -385,7 +385,7 @@ static void
gjs_context_tracer(JSTracer *trc, void *data)
{
GjsContext *gjs_context = reinterpret_cast<GjsContext *>(data);
- JS_CallObjectTracer(trc, &gjs_context->global, "GJS global object");
+ JS::TraceEdge<JSObject *>(trc, &gjs_context->global, "GJS global object");
}
static void
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index 1ca90c1..42e44c7 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -1503,7 +1503,8 @@ coverage_statistics_tracer(JSTracer *trc, void *data)
GjsCoverage *coverage = (GjsCoverage *) data;
GjsCoveragePrivate *priv = (GjsCoveragePrivate *) gjs_coverage_get_instance_private(coverage);
- JS_CallObjectTracer(trc, &priv->coverage_statistics, "coverage_statistics");
+ JS::TraceEdge<JSObject *>(trc, &priv->coverage_statistics,
+ "coverage_statistics");
}
/* This function is mainly used in the tests in order to fiddle with
diff --git a/gjs/jsapi-util-root.h b/gjs/jsapi-util-root.h
index 1bdf029..55ca481 100644
--- a/gjs/jsapi-util-root.h
+++ b/gjs/jsapi-util-root.h
@@ -66,23 +66,11 @@
*/
template<typename T>
struct GjsHeapOperation {
- static void trace(JSTracer *tracer,
- JS::Heap<T> *thing,
- const char *name);
-
static bool update_after_gc(JS::Heap<T> *location);
};
template<>
struct GjsHeapOperation<JSObject *> {
- static void
- trace(JSTracer *tracer,
- JS::Heap<JSObject *> *thing,
- const char *name)
- {
- JS_CallObjectTracer(tracer, thing, name);
- }
-
static bool
update_after_gc(JS::Heap<JSObject *> *location)
{
@@ -92,15 +80,7 @@ struct GjsHeapOperation<JSObject *> {
};
template<>
-struct GjsHeapOperation<JS::Value> {
- static void
- trace(JSTracer *tracer,
- JS::Heap<JS::Value> *thing,
- const char *name)
- {
- JS_CallValueTracer(tracer, thing, name);
- }
-};
+struct GjsHeapOperation<JS::Value> {};
/* GjsMaybeOwned is intended only for use in heap allocation. Do not allocate it
* on the stack, and do not allocate any instances of structures that have it as
@@ -315,7 +295,7 @@ public:
{
debug("trace()");
g_assert(!m_rooted);
- GjsHeapOperation<T>::trace(tracer, &m_heap, name);
+ JS::TraceEdge<T>(tracer, &m_heap, name);
}
/* If not tracing, then you must call this method during GC in order to
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]