Subject: [gjs/wip/ptomato/mozjs38: 17/17] WIP - mozjs38



commit 55ca64591cbac5b63f626990dd7d65a9b6cdd3bf
Author: Philip Chimento <[email protected]>
Date: Wed Jan 11 23:45:59 2017 -0800

WIP - mozjs38

gi/boxed.cpp | 4 ++--
gjs/byteArray.cpp | 3 ++-
gjs/context.cpp | 1 +
gjs/importer.cpp | 2 +-
gjs/jsapi-util-string.cpp | 11 +++++++++--
gjs/jsapi-util.cpp | 8 ++++----
gjs/runtime.cpp | 2 +-
7 files changed, 20 insertions(+), 11 deletions(-)
---
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index c20b5aa..c32f009 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -842,8 +842,8 @@ define_boxed_class_fields (JSContext *context,
bool result;

result = JS_DefineProperty(context, proto, field_name,
JS::NullHandleValue,
- JSPROP_PERMANENT | JSPROP_SHARED,
- boxed_field_getter, boxed_field_setter);
+ JSPROP_PERMANENT | JSPROP_SHARED |
JSPROP_PROPOP_ACCESSORS,
+ (JSNative) boxed_field_getter, (JSNative)
boxed_field_setter);

g_base_info_unref ((GIBaseInfo *)field);

diff --git a/gjs/byteArray.cpp b/gjs/byteArray.cpp
index b3e5444..f60d4bf 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -607,8 +607,9 @@ from_string_func(JSContext *context,
GError *error;
const char16_t *u16_chars;
gsize u16_len;
+ JS::AutoCheckCannotGC nogc;

- u16_chars = JS_GetStringCharsAndLength(context, argv[0].toString(),
&u16_len);
+ u16_chars = JS_GetTwoByteStringCharsAndLength(context, nogc,
argv[0].toString(), &u16_len);
if (u16_chars == NULL)
return false;

diff --git a/gjs/context.cpp b/gjs/context.cpp
index efcdbac..7d80621 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -78,6 +78,7 @@ struct _GjsContext {

guint auto_gc_id;

+ /* FIXME - array of PersistentRooted<jsid>? */
jsid const_strings[GJS_STRING_LAST];
};

diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index a019054..02809cc 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -213,7 +213,7 @@ seal_import(JSContext *cx,

if (!JS_DefineProperty(cx, descr.object(), name, descr.value(),
descr.attributes() | JSPROP_PERMANENT,
- descr.getter(), descr.setter())) {
+ (JSNative) descr.getter(), (JSNative)
descr.setter())) {
gjs_debug(GJS_DEBUG_IMPORTER,
"Failed to redefine attributes to seal '%s' in importer",
name);
diff --git a/gjs/jsapi-util-string.cpp b/gjs/jsapi-util-string.cpp
index 6143b47..509413f 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -191,7 +191,12 @@ gjs_string_get_char16_data(JSContext *context,
goto out;
}

- js_data = JS_GetStringCharsAndLength(context, value.toString(), len_p);
+ /* Scope for nogc */
+ {
+ JS::AutoCheckCannotGC nogc;
+ js_data = JS_GetTwoByteStringCharsAndLength(context, nogc,
+ value.toString(), len_p);
+ }
if (js_data == NULL)
goto out;

@@ -231,7 +236,9 @@ gjs_string_to_ucs4(JSContext *cx,
size_t utf16_len;
GError *error = NULL;

- const char16_t *utf16 = JS_GetStringCharsAndLength(cx, str, &utf16_len);
+ JS::AutoCheckCannotGC nogc;
+ const char16_t *utf16 = JS_GetTwoByteStringCharsAndLength(cx, nogc, str,
+ &utf16_len);
if (utf16 == NULL) {
gjs_throw(cx, "Failed to get UTF-16 string data");
return false;
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 51300ef..9229d62 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -88,9 +88,8 @@ gjs_init_context_standard (JSContext *context,
*
* setExtraWarnings: Report warnings to error reporter function.
*/
- JS::ContextOptionsRef(context)
- .setDontReportUncaught(true)
- .setExtraWarnings(extra_warnings);
+ JS::ContextOptionsRef(context).setDontReportUncaught(true);
+ JS::RuntimeOptionsRef(context).setExtraWarnings(extra_warnings);

if (!g_getenv("GJS_DISABLE_JIT")) {
gjs_debug(GJS_DEBUG_CONTEXT, "Enabling JIT");
@@ -377,7 +376,8 @@ gjs_string_readable (JSContext *context,
size_t i, len;
const char16_t *uchars;

- uchars = JS_GetStringCharsAndLength(context, string, &len);
+ JS::AutoCheckCannotGC nogc;
+ uchars = JS_GetTwoByteStringCharsAndLength(context, nogc, string,
&len);

for (i = 0; i < len; i++) {
char16_t c = uchars[i];
diff --git a/gjs/runtime.cpp b/gjs/runtime.cpp
index 5ddf4b0..902fcd9 100644
--- a/gjs/runtime.cpp
+++ b/gjs/runtime.cpp
@@ -256,7 +256,7 @@ gjs_runtime_for_current_thread(void)

if (!runtime) {
g_assert(gjs_is_inited);
- runtime = JS_NewRuntime(32*1024*1024 /* max bytes */,
JS_USE_HELPER_THREADS);
+ runtime = JS_NewRuntime(32 * 1024 * 1024 /* max bytes */);
if (runtime == NULL)
g_error("Failed to create javascript runtime");

_______________________________________________
commits-list mailing list (read only)
https://mail.gnome.org/mailman/listinfo/commits-list

Want to limit the commits to a few modules? Go to above URL, log in to edit
your options and select the modules ('topics') you want.



Programming list archiving by: Enterprise Git Hosting