[gjs: 6/25] js: Various API renames
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 6/25] js: Various API renames
- Date: Sun, 26 Jan 2020 04:49:13 +0000 (UTC)
commit f052c29c84437f9f8c5a42664ec256ab14fd8a1a
Author: Philip Chimento <philip chimento gmail com>
Date: Sat May 18 23:18:33 2019 -0700
js: Various API renames
These are straightforward renames that happened between SpiderMonkey 60
and 68.
gi/object.cpp | 2 +-
gjs/deprecation.cpp | 4 ++--
gjs/jsapi-dynamic-class.cpp | 5 ++---
gjs/jsapi-util-root.h | 8 ++++----
gjs/jsapi-util.cpp | 2 +-
gjs/jsapi-util.h | 8 +++++---
gjs/profiler.cpp | 6 +++---
7 files changed, 18 insertions(+), 17 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index be1b0b7d..035d66eb 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -2321,7 +2321,7 @@ bool ObjectPrototype::hook_up_vfunc_impl(JSContext* cx,
offset = g_field_info_get_offset(field_info);
method_ptr = G_STRUCT_MEMBER_P(implementor_vtable, offset);
- if (!JS_ObjectIsFunction(cx, function)) {
+ if (!js::IsFunctionObject(function)) {
gjs_throw(cx, "Tried to deal with a vfunc that wasn't a function");
return false;
}
diff --git a/gjs/deprecation.cpp b/gjs/deprecation.cpp
index 9fd95e84..b271f334 100644
--- a/gjs/deprecation.cpp
+++ b/gjs/deprecation.cpp
@@ -97,8 +97,8 @@ void _gjs_warn_deprecated_once_per_callsite(JSContext* cx,
JS::UniqueChars callsite(get_callsite(cx));
DeprecationEntry entry(id, callsite.get());
if (!logged_messages.count(entry)) {
- JS::UniqueChars stack_dump = JS::FormatStackDump(cx, nullptr, false,
- false, false);
+ JS::UniqueChars stack_dump =
+ JS::FormatStackDump(cx, false, false, false);
g_warning("%s\n%s", messages[id], stack_dump.get());
logged_messages.insert(std::move(entry));
}
diff --git a/gjs/jsapi-dynamic-class.cpp b/gjs/jsapi-dynamic-class.cpp
index a1a16a70..59addd14 100644
--- a/gjs/jsapi-dynamic-class.cpp
+++ b/gjs/jsapi-dynamic-class.cpp
@@ -240,9 +240,8 @@ gjs_define_property_dynamic(JSContext *cx,
flags |= JSPROP_GETTER | JSPROP_SETTER;
- return JS_DefineProperty(
- cx, proto, prop_name, JS_DATA_TO_FUNC_PTR(JSNative, getter_obj.get()),
- JS_DATA_TO_FUNC_PTR(JSNative, setter_obj.get()), flags);
+ return JS_DefineProperty(cx, proto, prop_name, getter_obj, setter_obj,
+ flags);
}
/**
diff --git a/gjs/jsapi-util-root.h b/gjs/jsapi-util-root.h
index 9e9b5b91..ccb05600 100644
--- a/gjs/jsapi-util-root.h
+++ b/gjs/jsapi-util-root.h
@@ -93,7 +93,7 @@ struct GjsHeapOperation<JSObject *> {
/* If the object has been swept already, then the zone is nullptr */
if (!obj || !js::gc::detail::GetGCThingZone(uintptr_t(obj)))
return;
- if (!JS::CurrentThreadIsHeapCollecting())
+ if (!JS::RuntimeHeapIsCollecting())
JS::ExposeObjectToActiveJS(obj);
}
};
@@ -104,7 +104,7 @@ struct GjsHeapOperation<JSFunction*> {
JSFunction* func = thing.unbarrieredGet();
if (!func || !js::gc::detail::GetGCThingZone(uintptr_t(func)))
return;
- if (!JS::CurrentThreadIsHeapCollecting())
+ if (!JS::RuntimeHeapIsCollecting())
js::gc::ExposeGCThingToActiveJS(JS::GCCellPtr(func));
}
};
@@ -246,7 +246,7 @@ class GjsMaybeOwned {
{
debug("root()");
g_assert(!m_root);
- g_assert(m_heap.get() == JS::GCPolicy<T>::initial());
+ g_assert(m_heap.get() == JS::SafelyInitialized<T>());
m_heap.~Heap();
m_root = std::make_unique<JS::PersistentRooted<T>>(cx, thing);
@@ -275,7 +275,7 @@ class GjsMaybeOwned {
void reset() {
debug("reset()");
if (!m_root) {
- m_heap = JS::GCPolicy<T>::initial();
+ m_heap = JS::SafelyInitialized<T>();
return;
}
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 4e2c1efb..4a0648ae 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -554,7 +554,7 @@ gjs_gc_if_needed (JSContext *context)
*/
if (rss_size > linux_rss_trigger) {
linux_rss_trigger = (gulong) MIN(G_MAXULONG, rss_size * 1.25);
- JS::GCForReason(context, GC_SHRINK, JS::gcreason::Reason::API);
+ JS::NonIncrementalGC(context, GC_SHRINK, JS::GCReason::API);
} else if (rss_size < (0.75 * linux_rss_trigger)) {
/* If we've shrunk by 75%, lower the trigger */
linux_rss_trigger = (rss_size * 1.25);
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index 06f57b5b..0a6be3b5 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -188,9 +188,11 @@ struct GCPolicy<GjsAutoParam> : public IgnoreGCPolicy<GjsAutoParam> {};
* A convenience macro for getting the 'this' object a function was called with.
* Use in any JSNative function.
*/
-#define GJS_GET_THIS(cx, argc, vp, args, to) \
- JS::CallArgs args = JS::CallArgsFromVp(argc, vp); \
- JS::RootedObject to(cx, &args.computeThis(cx).toObject())
+#define GJS_GET_THIS(cx, argc, vp, args, to) \
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp); \
+ JS::RootedObject to(cx); \
+ if (!args.computeThis(cx, &to)) \
+ return false;
GJS_USE
JSObject* gjs_get_import_global (JSContext *context);
diff --git a/gjs/profiler.cpp b/gjs/profiler.cpp
index c8b94f8a..f3661dd2 100644
--- a/gjs/profiler.cpp
+++ b/gjs/profiler.cpp
@@ -103,7 +103,7 @@ struct _GjsProfiler {
* information while executing. We will look into this during our
* SIGPROF handler.
*/
- PseudoStack stack;
+ ProfilingStack stack;
/* The context being profiled */
JSContext *cx;
@@ -270,7 +270,7 @@ _gjs_profiler_free(GjsProfiler *self)
if (self->fd != -1)
close(self->fd);
- self->stack.~PseudoStack();
+ self->stack.~ProfilingStack();
#endif
g_free(self);
}
@@ -328,7 +328,7 @@ static void gjs_profiler_sigprof(int signum G_GNUC_UNUSED, siginfo_t* info,
static_cast<SysprofCaptureAddress*>(alloca(sizeof *addrs * depth));
for (uint32_t ix = 0; ix < depth; ix++) {
- js::ProfileEntry& entry = self->stack.entries[ix];
+ js::ProfilingStackFrame& entry = self->stack.frames[ix];
const char *label = entry.label();
const char *dynamic_string = entry.dynamicString();
uint32_t flipped = depth - 1 - ix;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]