[gjs: 1/6] jsapi-dynamic-class: Use interned strings to link prototype
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 1/6] jsapi-dynamic-class: Use interned strings to link prototype
- Date: Sat, 3 Feb 2018 00:08:47 +0000 (UTC)
commit 28da35a15d3cd9247abfda9ff899d0e7f5398ef8
Author: Philip Chimento <philip chimento gmail com>
Date: Sun Jan 28 23:51:40 2018 -0800
jsapi-dynamic-class: Use interned strings to link prototype
This saves a lookup of the strings "constructor" and "prototype" in the
interned strings table.
gjs/jsapi-dynamic-class.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gjs/jsapi-dynamic-class.cpp b/gjs/jsapi-dynamic-class.cpp
index b787a7b9..cb343495 100644
--- a/gjs/jsapi-dynamic-class.cpp
+++ b/gjs/jsapi-dynamic-class.cpp
@@ -120,11 +120,13 @@ gjs_init_class_dynamic(JSContext *context,
} else {
/* Have to fake it with JSPROP_RESOLVING, otherwise it will trigger
* the resolve hook */
- if (!JS_DefineProperty(context, constructor, "prototype", prototype,
- JSPROP_PERMANENT | JSPROP_READONLY | JSPROP_RESOLVING))
+ if (!gjs_object_define_property(context, constructor,
+ GJS_STRING_PROTOTYPE, prototype,
+ JSPROP_PERMANENT | JSPROP_READONLY | JSPROP_RESOLVING))
goto out;
- if (!JS_DefineProperty(context, prototype, "constructor", constructor,
- JSPROP_RESOLVING))
+ if (!gjs_object_define_property(context, prototype,
+ GJS_STRING_CONSTRUCTOR, constructor,
+ JSPROP_RESOLVING))
goto out;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]