summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2017-05-01 22:30:16 -0700
committerPhilip Chimento <philip.chimento@gmail.com>2017-05-05 23:26:30 -0700
commitf63d37e4de8d117262a6c28a2f1a239c8bc88b0b (patch)
tree1c35aa5b45e776dab938d859a5e7db366d5e009d
parent40f5bafff8f6c79a677917d72d2a2fb042775340 (diff)
downloadgjs-f63d37e4de8d117262a6c28a2f1a239c8bc88b0b.tar.gz
js: Adapt to new JS::TraceEdge<T> APIwip/ptomato/mozjs45
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.
-rw-r--r--gi/boxed.cpp8
-rw-r--r--gi/fundamental.cpp4
-rw-r--r--gjs/context.cpp2
-rw-r--r--gjs/coverage.cpp3
-rw-r--r--gjs/jsapi-util-root.h24
5 files changed, 11 insertions, 30 deletions
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index a1d24c3f..f5fd4bcc 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 a213d351..677fd65d 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 c7bb686a..f802361f 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 1ca90c10..42e44c74 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 1bdf0295..55ca4814 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