[gjs/wip/ptomato/mozjs52: 22/35] 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: 22/35] js: Adapt to new JS::TraceEdge<T> API
- Date: Sun, 11 Jun 2017 03:14:03 +0000 (UTC)
commit f9c6d01504aa38880cc5baeedb398e1a0f14d91c
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 d5d830f..361165c 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -904,10 +904,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 c2623b1..dcacd1b 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -531,8 +531,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 403c77b..a1000b5 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -382,7 +382,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 e527a39..0f88f51 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -1504,7 +1504,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]