summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile7
-rw-r--r--Makefile.defaults9
-rw-r--r--README.md8
-rw-r--r--content/fetchers/about/certificate.c521
-rw-r--r--content/fetchers/about/chart.c2
-rw-r--r--content/handlers/image/bmp.c12
-rw-r--r--content/handlers/image/gif.c391
-rw-r--r--content/handlers/image/ico.c49
-rw-r--r--content/handlers/image/image.c3
-rw-r--r--content/handlers/image/image_cache.c12
-rw-r--r--content/handlers/image/jpeg.c182
-rw-r--r--content/handlers/image/nssprite.c22
-rw-r--r--content/handlers/image/png.c53
-rw-r--r--content/handlers/image/rsvg.c44
-rw-r--r--content/handlers/image/webp.c38
-rw-r--r--content/handlers/javascript/duktape/CanvasRenderingContext2D.bnd6
-rw-r--r--content/handlers/javascript/duktape/duk_config.h51
-rw-r--r--content/handlers/javascript/duktape/duktape.c26721
-rw-r--r--content/handlers/javascript/duktape/duktape.h21
-rw-r--r--content/llcache.c10
-rw-r--r--desktop/Makefile2
-rw-r--r--desktop/bitmap.c338
-rw-r--r--desktop/bitmap.h147
-rw-r--r--desktop/browser_history.c4
-rw-r--r--desktop/browser_window.c5
-rw-r--r--desktop/gui_factory.c12
-rw-r--r--desktop/hotlist.c10
-rw-r--r--desktop/save_complete.c4
-rw-r--r--desktop/searchweb.c6
-rw-r--r--desktop/searchweb.h2
-rw-r--r--desktop/textarea.c101
-rw-r--r--desktop/treeview.c97
-rw-r--r--docs/PACKAGING-GTK15
-rw-r--r--docs/env.sh2
-rw-r--r--frontends/amiga/bitmap.c75
-rwxr-xr-xfrontends/amiga/bitmap.h16
-rw-r--r--frontends/amiga/dist/Rexx/YT_download_page.nsrx21
-rw-r--r--frontends/amiga/dist/Rexx/YT_open.nsrx21
-rw-r--r--frontends/amiga/dist/Rexx/YT_play.nsrx19
-rw-r--r--frontends/amiga/dt_anim.c2
-rw-r--r--frontends/amiga/dt_picture.c4
-rw-r--r--frontends/amiga/icon.c2
-rw-r--r--frontends/amiga/libs.c4
-rw-r--r--frontends/amiga/pkg/SearchEngines2
-rw-r--r--frontends/amiga/plotters.c26
-rw-r--r--frontends/atari/bitmap.c96
-rw-r--r--frontends/atari/bitmap.h2
-rw-r--r--frontends/atari/plot/font_freetype.c1
-rw-r--r--frontends/atari/plot/font_internal.c1
-rw-r--r--frontends/beos/bitmap.cpp76
-rw-r--r--frontends/framebuffer/bitmap.c69
-rw-r--r--frontends/gtk/bitmap.c270
-rw-r--r--frontends/gtk/bitmap.h2
-rw-r--r--frontends/gtk/gui.c14
-rw-r--r--frontends/gtk/misc.c2
-rw-r--r--frontends/gtk/scaffolding.c1
-rw-r--r--frontends/gtk/search.c1
-rw-r--r--frontends/gtk/toolbar.c6
-rw-r--r--frontends/monkey/bitmap.c45
-rw-r--r--frontends/riscos/Makefile4
-rw-r--r--frontends/riscos/Makefile.tools50
-rw-r--r--frontends/riscos/appdir/Resources/SearchEngines43
-rw-r--r--frontends/riscos/bitmap.c84
-rw-r--r--frontends/riscos/bitmap.h11
-rw-r--r--frontends/riscos/configure/con_image.c1
-rw-r--r--frontends/riscos/content-handlers/artworks.c2
-rw-r--r--frontends/riscos/content-handlers/awrender.s82
-rw-r--r--frontends/riscos/download.c19
-rw-r--r--frontends/riscos/gui.c20
-rw-r--r--frontends/riscos/gui/button_bar.c3
-rw-r--r--frontends/riscos/gui/throbber.c4
-rw-r--r--frontends/riscos/gui/url_bar.c2
-rw-r--r--frontends/riscos/iconbar.c2
-rw-r--r--frontends/riscos/print.c6
-rw-r--r--frontends/riscos/save.c12
-rw-r--r--frontends/riscos/scripts/Run3
-rw-r--r--frontends/riscos/templates/de2
-rw-r--r--frontends/riscos/templates/en2
-rw-r--r--frontends/riscos/templates/fr2
-rw-r--r--frontends/riscos/templates/nl4
-rw-r--r--frontends/riscos/window.c13
-rw-r--r--frontends/windows/bitmap.c65
-rw-r--r--frontends/windows/bitmap.h2
-rw-r--r--frontends/windows/res/installer.nsi6
-rw-r--r--frontends/windows/window.c6
-rw-r--r--include/netsurf/bitmap.h154
-rw-r--r--include/netsurf/inttypes.h5
-rw-r--r--include/netsurf/keypress.h2
-rw-r--r--include/netsurf/plot_style.h4
-rw-r--r--resources/SearchEngines39
-rw-r--r--resources/ca-bundle555
-rw-r--r--resources/de/welcome.html30
-rw-r--r--resources/en/licence.html42
-rw-r--r--resources/en/welcome.html32
-rw-r--r--resources/it/licence.html42
-rw-r--r--resources/it/welcome.html30
-rw-r--r--resources/ja/welcome.html30
-rw-r--r--resources/nl/licence.html42
-rw-r--r--resources/nl/welcome.html36
-rw-r--r--resources/zh_CN/licence.html42
-rw-r--r--resources/zh_CN/welcome.html30
-rw-r--r--utils/useragent.c15
102 files changed, 17880 insertions, 13385 deletions
diff --git a/Makefile b/Makefile
index ac38b50ea..f66f79649 100644
--- a/Makefile
+++ b/Makefile
@@ -329,12 +329,17 @@ IFLAGS = $(addprefix -I,$(INCLUDE_DIRS))
$(EXETARGET): $(OBJECTS) $(RESOURCES) $(MESSAGES) tools/linktrace-to-depfile.pl
$(VQ)echo " LINK: $(EXETARGET)"
-ifneq ($(TARGET)$(SUBTARGET),riscos-elf)
+ifneq ($(TARGET),riscos)
$(Q)$(CC) -o $(EXETARGET) $(OBJECTS) $(LDFLAGS) > $(DEPROOT)/link-raw.d
else
+ @# RISC OS targets are a bit special: we need to convert ELF -> AIF
+ ifeq ($(SUBTARGET),riscos-aof)
+ $(Q)$(CC) -o $(EXETARGET) $(OBJECTS) $(LDFLAGS) > $(DEPROOT)/link-raw.d
+ else
$(Q)$(CXX) -o $(EXETARGET:,ff8=,e1f) $(OBJECTS) $(LDFLAGS) > $(DEPROOT)/link-raw.d
$(Q)$(ELF2AIF) $(EXETARGET:,ff8=,e1f) $(EXETARGET)
$(Q)$(RM) $(EXETARGET:,ff8=,e1f)
+ endif
endif
$(VQ)echo "LINKDEPS: $(EXETARGET)"
$(Q)echo -n "$(EXETARGET) $(DEPROOT)/link.d: " > $(DEPROOT)/link.d
diff --git a/Makefile.defaults b/Makefile.defaults
index edf491a6f..85be74802 100644
--- a/Makefile.defaults
+++ b/Makefile.defaults
@@ -101,10 +101,11 @@ NETSURF_USE_UTF8PROC := YES
# Valid options: YES, NO
NETSURF_STRIP_BINARY := NO
-# Template used for constructing the User Agent: string. The first two
-# replacements are major/minor version, next is OS.
-# Please don't be tempted to mention Mozilla here! Let's let that lie die.
-NETSURF_UA_FORMAT_STRING := "NetSurf/%d.%d (%s)"
+# Template used for constructing the User Agent: string. The first
+# replacement is OS, the next two are major/minor version.
+# Note that the "Mozilla/5.0" prefix is a requirement to enable modern
+# web standards on many websites. It should not be removed or modified.
+NETSURF_UA_FORMAT_STRING := "Mozilla/5.0 (%s) NetSurf/%d.%d"
# Default home page, if one is not defined by the user. Note that this
# option does not apply to the RISC OS version, as it has its own local
diff --git a/README.md b/README.md
index a6b688430..8f3843042 100644
--- a/README.md
+++ b/README.md
@@ -15,13 +15,13 @@ Creating a new port
Look at the existing front ends for example implementations.
The framebuffer front end is simplest and most self-contained.
-Also, you can [contact the developers](http://www.netsurf-browser.org/contact/)
+Also, you can [contact the developers](https://www.netsurf-browser.org/contact/)
for help.
Further documentation
---------------------
-* [Developer documentation](http://www.netsurf-browser.org/developers/)
-* [Developer wiki](http://wiki.netsurf-browser.org/Documentation/)
-* [Code style guide](http://www.netsurf-browser.org/developers/StyleGuide.pdf)
+* [Developer documentation](https://www.netsurf-browser.org/developers/)
+* [Developer wiki](https://wiki.netsurf-browser.org/Documentation/)
+* [Code style guide](https://www.netsurf-browser.org/developers/StyleGuide.pdf)
diff --git a/content/fetchers/about/certificate.c b/content/fetchers/about/certificate.c
index 0d0d6f5dc..554f06eb8 100644
--- a/content/fetchers/about/certificate.c
+++ b/content/fetchers/about/certificate.c
@@ -165,21 +165,137 @@ static const BIGNUM *ns_RSA_get0_e(const RSA *d)
return d->e;
}
-static int ns_RSA_bits(const RSA *rsa)
-{
- return RSA_size(rsa) * 8;
+static int ns_EVP_PKEY_get_bn_param(const EVP_PKEY *pkey,
+ const char *key_name, BIGNUM **bn) {
+ RSA *rsa;
+ BIGNUM *result = NULL;
+
+ /* Check parameters: only support allocation-form *bn */
+ if (pkey == NULL || key_name == NULL || bn == NULL || *bn != NULL)
+ return 0;
+
+ /* Only support RSA keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_RSA)
+ return 0;
+
+ rsa = EVP_PKEY_get1_RSA((EVP_PKEY *) pkey);
+ if (rsa == NULL)
+ return 0;
+
+ if (strcmp(key_name, "n") == 0) {
+ const BIGNUM *n = ns_RSA_get0_n(rsa);
+ if (n != NULL)
+ result = BN_dup(n);
+ } else if (strcmp(key_name, "e") == 0) {
+ const BIGNUM *e = ns_RSA_get0_e(rsa);
+ if (e != NULL)
+ result = BN_dup(e);
+ }
+
+ RSA_free(rsa);
+
+ *bn = result;
+
+ return (result != NULL) ? 1 : 0;
}
-static int ns_DSA_bits(const DSA *dsa)
+static int ns_EVP_PKEY_get_utf8_string_param(const EVP_PKEY *pkey,
+ const char *key_name, char *str, size_t max_len,
+ size_t *out_len)
{
- return DSA_size(dsa) * 8;
+ const EC_GROUP *ecgroup;
+ const char *group;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ /* Only support fetching the group */
+ if (strcmp(key_name, "group") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup == NULL) {
+ group = "";
+ } else {
+ group = OBJ_nid2ln(EC_GROUP_get_curve_name(ecgroup));
+ }
+
+ if (str != NULL && max_len > strlen(group)) {
+ strcpy(str, group);
+ str[strlen(group)] = '\0';
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = strlen(group);
+
+ EC_KEY_free(ec);
+
+ return ret;
}
-static int ns_DH_bits(const DH *dh)
+static int ns_EVP_PKEY_get_octet_string_param(const EVP_PKEY *pkey,
+ const char *key_name, unsigned char *buf, size_t max_len,
+ size_t *out_len)
{
- return DH_size(dh) * 8;
-}
+ const EC_GROUP *ecgroup;
+ const EC_POINT *ecpoint;
+ size_t len;
+ BN_CTX *bnctx;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ if (strcmp(key_name, "encoded-pub-key") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+ if (ec == NULL)
+ return 0;
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup != NULL) {
+ ecpoint = EC_KEY_get0_public_key(ec);
+ if (ecpoint != NULL) {
+ bnctx = BN_CTX_new();
+ len = EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ NULL,
+ 0,
+ bnctx);
+ if (len != 0 && len <= max_len) {
+ if (EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ buf,
+ len,
+ bnctx) == len)
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = len;
+ BN_CTX_free(bnctx);
+ }
+ }
+
+ EC_KEY_free(ec);
+
+ return ret;
+}
#elif (OPENSSL_VERSION_NUMBER < 0x1010100fL)
/* 1.1.0 */
#define ns_X509_get_signature_nid X509_get_signature_nid
@@ -203,19 +319,284 @@ static const BIGNUM *ns_RSA_get0_e(const RSA *r)
return e;
}
-#define ns_RSA_bits RSA_bits
-#define ns_DSA_bits DSA_bits
-#define ns_DH_bits DH_bits
+static int ns_EVP_PKEY_get_bn_param(const EVP_PKEY *pkey,
+ const char *key_name, BIGNUM **bn) {
+ RSA *rsa;
+ BIGNUM *result = NULL;
+
+ /* Check parameters: only support allocation-form *bn */
+ if (pkey == NULL || key_name == NULL || bn == NULL || *bn != NULL)
+ return 0;
+
+ /* Only support RSA keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_RSA)
+ return 0;
+
+ rsa = EVP_PKEY_get1_RSA((EVP_PKEY *) pkey);
+ if (rsa == NULL)
+ return 0;
+
+ if (strcmp(key_name, "n") == 0) {
+ const BIGNUM *n = ns_RSA_get0_n(rsa);
+ if (n != NULL)
+ result = BN_dup(n);
+ } else if (strcmp(key_name, "e") == 0) {
+ const BIGNUM *e = ns_RSA_get0_e(rsa);
+ if (e != NULL)
+ result = BN_dup(e);
+ }
+
+ RSA_free(rsa);
+
+ *bn = result;
+
+ return (result != NULL) ? 1 : 0;
+}
+
+static int ns_EVP_PKEY_get_utf8_string_param(const EVP_PKEY *pkey,
+ const char *key_name, char *str, size_t max_len,
+ size_t *out_len)
+{
+ const EC_GROUP *ecgroup;
+ const char *group;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ /* Only support fetching the group */
+ if (strcmp(key_name, "group") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup == NULL) {
+ group = "";
+ } else {
+ group = OBJ_nid2ln(EC_GROUP_get_curve_name(ecgroup));
+ }
+
+ if (str != NULL && max_len > strlen(group)) {
+ strcpy(str, group);
+ str[strlen(group)] = '\0';
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = strlen(group);
+
+ EC_KEY_free(ec);
+
+ return ret;
+}
+
+static int ns_EVP_PKEY_get_octet_string_param(const EVP_PKEY *pkey,
+ const char *key_name, unsigned char *buf, size_t max_len,
+ size_t *out_len)
+{
+ const EC_GROUP *ecgroup;
+ const EC_POINT *ecpoint;
+ size_t len;
+ BN_CTX *bnctx;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ if (strcmp(key_name, "encoded-pub-key") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+ if (ec == NULL)
+ return 0;
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup != NULL) {
+ ecpoint = EC_KEY_get0_public_key(ec);
+ if (ecpoint != NULL) {
+ bnctx = BN_CTX_new();
+ len = EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ NULL,
+ 0,
+ bnctx);
+ if (len != 0 && len <= max_len) {
+ if (EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ buf,
+ len,
+ bnctx) == len)
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = len;
+ BN_CTX_free(bnctx);
+ }
+ }
+ EC_KEY_free(ec);
+
+ return ret;
+}
+#elif (OPENSSL_VERSION_NUMBER < 0x30000000L)
+/* 1.1.1 */
+#define ns_X509_get_signature_nid X509_get_signature_nid
+#define ns_ASN1_STRING_get0_data ASN1_STRING_get0_data
+#define ns_RSA_get0_n RSA_get0_n
+#define ns_RSA_get0_e RSA_get0_e
+
+static int ns_EVP_PKEY_get_bn_param(const EVP_PKEY *pkey,
+ const char *key_name, BIGNUM **bn) {
+ RSA *rsa;
+ BIGNUM *result = NULL;
+
+ /* Check parameters: only support allocation-form *bn */
+ if (pkey == NULL || key_name == NULL || bn == NULL || *bn != NULL)
+ return 0;
+
+ /* Only support RSA keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_RSA)
+ return 0;
+
+ rsa = EVP_PKEY_get1_RSA((EVP_PKEY *) pkey);
+ if (rsa == NULL)
+ return 0;
+
+ if (strcmp(key_name, "n") == 0) {
+ const BIGNUM *n = ns_RSA_get0_n(rsa);
+ if (n != NULL)
+ result = BN_dup(n);
+ } else if (strcmp(key_name, "e") == 0) {
+ const BIGNUM *e = ns_RSA_get0_e(rsa);
+ if (e != NULL)
+ result = BN_dup(e);
+ }
+
+ RSA_free(rsa);
+
+ *bn = result;
+
+ return (result != NULL) ? 1 : 0;
+}
+
+static int ns_EVP_PKEY_get_utf8_string_param(const EVP_PKEY *pkey,
+ const char *key_name, char *str, size_t max_len,
+ size_t *out_len)
+{
+ const EC_GROUP *ecgroup;
+ const char *group;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ /* Only support fetching the group */
+ if (strcmp(key_name, "group") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup == NULL) {
+ group = "";
+ } else {
+ group = OBJ_nid2ln(EC_GROUP_get_curve_name(ecgroup));
+ }
+
+ if (str != NULL && max_len > strlen(group)) {
+ strcpy(str, group);
+ str[strlen(group)] = '\0';
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = strlen(group);
+
+ EC_KEY_free(ec);
+
+ return ret;
+}
+
+static int ns_EVP_PKEY_get_octet_string_param(const EVP_PKEY *pkey,
+ const char *key_name, unsigned char *buf, size_t max_len,
+ size_t *out_len)
+{
+ const EC_GROUP *ecgroup;
+ const EC_POINT *ecpoint;
+ size_t len;
+ BN_CTX *bnctx;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ if (strcmp(key_name, "encoded-pub-key") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+ if (ec == NULL)
+ return 0;
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup != NULL) {
+ ecpoint = EC_KEY_get0_public_key(ec);
+ if (ecpoint != NULL) {
+ bnctx = BN_CTX_new();
+ len = EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ NULL,
+ 0,
+ bnctx);
+ if (len != 0 && len <= max_len) {
+ if (EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ buf,
+ len,
+ bnctx) == len)
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = len;
+ BN_CTX_free(bnctx);
+ }
+ }
+
+ EC_KEY_free(ec);
+
+ return ret;
+}
#else
-/* 1.1.1 and later */
+/* 3.x and later */
#define ns_X509_get_signature_nid X509_get_signature_nid
#define ns_ASN1_STRING_get0_data ASN1_STRING_get0_data
#define ns_RSA_get0_n RSA_get0_n
#define ns_RSA_get0_e RSA_get0_e
-#define ns_RSA_bits RSA_bits
-#define ns_DSA_bits DSA_bits
-#define ns_DH_bits DH_bits
+#define ns_EVP_PKEY_get_bn_param EVP_PKEY_get_bn_param
+#define ns_EVP_PKEY_get_octet_string_param EVP_PKEY_get_octet_string_param
+#define ns_EVP_PKEY_get_utf8_string_param EVP_PKEY_get_utf8_string_param
#endif
/**
@@ -365,36 +746,43 @@ static char *bindup(unsigned char *bin, unsigned int binlen)
/**
* extract RSA key information to info structure
*
- * \param rsa The RSA key to examine. The reference is dropped on return
+ * \param pkey The RSA key to examine.
* \param ikey The public key info structure to fill
* \rerun NSERROR_OK on success else error code.
*/
static nserror
-rsa_to_info(RSA *rsa, struct ns_cert_pkey *ikey)
+rsa_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
{
+ BIGNUM *n = NULL, *e = NULL;
char *tmp;
- if (rsa == NULL) {
+ if (ns_EVP_PKEY_get_bn_param(pkey, "n", &n) != 1) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ if (ns_EVP_PKEY_get_bn_param(pkey, "e", &e) != 1) {
+ BN_free(n);
return NSERROR_BAD_PARAMETER;
}
ikey->algor = strdup("RSA");
- ikey->size = ns_RSA_bits(rsa);
+ ikey->size = EVP_PKEY_bits(pkey);
- tmp = BN_bn2hex(ns_RSA_get0_n(rsa));
+ tmp = BN_bn2hex(n);
if (tmp != NULL) {
ikey->modulus = hexdup(tmp);
OPENSSL_free(tmp);
}
- tmp = BN_bn2dec(ns_RSA_get0_e(rsa));
+ tmp = BN_bn2dec(e);
if (tmp != NULL) {
ikey->exponent = strdup(tmp);
OPENSSL_free(tmp);
}
- RSA_free(rsa);
+ BN_free(e);
+ BN_free(n);
return NSERROR_OK;
}
@@ -403,22 +791,16 @@ rsa_to_info(RSA *rsa, struct ns_cert_pkey *ikey)
/**
* extract DSA key information to info structure
*
- * \param dsa The RSA key to examine. The reference is dropped on return
+ * \param pkey The DSA key to examine.
* \param ikey The public key info structure to fill
* \rerun NSERROR_OK on success else error code.
*/
static nserror
-dsa_to_info(DSA *dsa, struct ns_cert_pkey *ikey)
+dsa_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
{
- if (dsa == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
-
ikey->algor = strdup("DSA");
- ikey->size = ns_DSA_bits(dsa);
-
- DSA_free(dsa);
+ ikey->size = EVP_PKEY_bits(pkey);
return NSERROR_OK;
}
@@ -427,22 +809,16 @@ dsa_to_info(DSA *dsa, struct ns_cert_pkey *ikey)
/**
* extract DH key information to info structure
*
- * \param dsa The RSA key to examine. The reference is dropped on return
+ * \param pkey The DH key to examine.
* \param ikey The public key info structure to fill
* \rerun NSERROR_OK on success else error code.
*/
static nserror
-dh_to_info(DH *dh, struct ns_cert_pkey *ikey)
+dh_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
{
- if (dh == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
-
ikey->algor = strdup("Diffie Hellman");
- ikey->size = ns_DH_bits(dh);
-
- DH_free(dh);
+ ikey->size = EVP_PKEY_bits(pkey);
return NSERROR_OK;
}
@@ -451,49 +827,50 @@ dh_to_info(DH *dh, struct ns_cert_pkey *ikey)
/**
* extract EC key information to info structure
*
- * \param ec The EC key to examine. The reference is dropped on return
+ * \param pkey The EC key to examine.
* \param ikey The public key info structure to fill
* \rerun NSERROR_OK on success else error code.
*/
static nserror
-ec_to_info(EC_KEY *ec, struct ns_cert_pkey *ikey)
+ec_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
{
- const EC_GROUP *ecgroup;
- const EC_POINT *ecpoint;
- BN_CTX *bnctx;
- char *ecpoint_hex;
-
- if (ec == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
+ size_t len;
ikey->algor = strdup("Elliptic Curve");
- ecgroup = EC_KEY_get0_group(ec);
-
- if (ecgroup != NULL) {
- ikey->size = EC_GROUP_get_degree(ecgroup);
-
- ikey->curve = strdup(OBJ_nid2ln(EC_GROUP_get_curve_name(ecgroup)));
+ ikey->size = EVP_PKEY_bits(pkey);
+
+ len = 0;
+ ns_EVP_PKEY_get_utf8_string_param(pkey, "group", NULL, 0, &len);
+ if (len != 0) {
+ ikey->curve = malloc(len + 1);
+ if (ikey->curve != NULL) {
+ if (ns_EVP_PKEY_get_utf8_string_param(pkey, "group",
+ ikey->curve, len + 1, NULL) == 0) {
+ free(ikey->curve);
+ ikey->curve = NULL;
+ }
+ }
+ }
- ecpoint = EC_KEY_get0_public_key(ec);
- if (ecpoint != NULL) {
- bnctx = BN_CTX_new();
- ecpoint_hex = EC_POINT_point2hex(ecgroup,
- ecpoint,
- POINT_CONVERSION_UNCOMPRESSED,
- bnctx);
- ikey->public = hexdup(ecpoint_hex);
- OPENSSL_free(ecpoint_hex);
- BN_CTX_free(bnctx);
+ len = 0;
+ ns_EVP_PKEY_get_octet_string_param(pkey, "encoded-pub-key",
+ NULL, 0, &len);
+ if (len != 0) {
+ unsigned char *point = malloc(len);
+ if (point != NULL) {
+ if (ns_EVP_PKEY_get_octet_string_param(pkey,
+ "encoded-pub-key", point, len,
+ NULL) == 1) {
+ ikey->public = bindup(point, len);
+ }
+ free(point);
}
}
- EC_KEY_free(ec);
return NSERROR_OK;
}
-
/**
* extract public key information to info structure
*
@@ -512,19 +889,19 @@ pkey_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
switch (EVP_PKEY_base_id(pkey)) {
case EVP_PKEY_RSA:
- res = rsa_to_info(EVP_PKEY_get1_RSA(pkey), ikey);
+ res = rsa_to_info(pkey, ikey);
break;
case EVP_PKEY_DSA:
- res = dsa_to_info(EVP_PKEY_get1_DSA(pkey), ikey);
+ res = dsa_to_info(pkey, ikey);
break;
case EVP_PKEY_DH:
- res = dh_to_info(EVP_PKEY_get1_DH(pkey), ikey);
+ res = dh_to_info(pkey, ikey);
break;
case EVP_PKEY_EC:
- res = ec_to_info(EVP_PKEY_get1_EC_KEY(pkey), ikey);
+ res = ec_to_info(pkey, ikey);
break;
default:
diff --git a/content/fetchers/about/chart.c b/content/fetchers/about/chart.c
index 1565c54d8..c030c12b4 100644
--- a/content/fetchers/about/chart.c
+++ b/content/fetchers/about/chart.c
@@ -33,7 +33,9 @@
#include <math.h>
#include <stdio.h>
+#include "utils/config.h"
#include "netsurf/inttypes.h"
+#include "utils/config.h"
#include "utils/utils.h"
#include "utils/errors.h"
#include "utils/nsurl.h"
diff --git a/content/handlers/image/bmp.c b/content/handlers/image/bmp.c
index a723022fe..3fec2cc75 100644
--- a/content/handlers/image/bmp.c
+++ b/content/handlers/image/bmp.c
@@ -35,6 +35,7 @@
#include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h"
+#include "desktop/bitmap.h"
#include "image/bmp.h"
@@ -57,12 +58,12 @@ typedef struct nsbmp_content {
*/
static void *nsbmp_bitmap_create(int width, int height, unsigned int bmp_state)
{
- unsigned int bitmap_state = BITMAP_NEW;
+ unsigned int bitmap_state = BITMAP_NONE;
/* set bitmap state based on bmp state */
bitmap_state |= (bmp_state & BMP_OPAQUE) ? BITMAP_OPAQUE : 0;
bitmap_state |= (bmp_state & BMP_CLEAR_MEMORY) ?
- BITMAP_CLEAR_MEMORY : 0;
+ BITMAP_CLEAR : 0;
/* return the created bitmap */
return guit->bitmap->create(width, height, bitmap_state);
@@ -74,7 +75,6 @@ static nserror nsbmp_create_bmp_data(nsbmp_content *bmp)
.bitmap_create = nsbmp_bitmap_create,
.bitmap_destroy = guit->bitmap->destroy,
.bitmap_get_buffer = guit->bitmap->get_buffer,
- .bitmap_get_bpp = guit->bitmap->get_bpp
};
bmp->bmp = calloc(sizeof(struct bmp_image), 1);
@@ -151,8 +151,7 @@ static bool nsbmp_convert(struct content *c)
/* Store our content width and description */
c->width = bmp->bmp->width;
c->height = bmp->bmp->height;
- swidth = bmp->bmp->bitmap_callbacks.bitmap_get_bpp(bmp->bmp->bitmap) *
- bmp->bmp->width;
+ swidth = sizeof(uint32_t) * bmp->bmp->width;
c->size += (swidth * bmp->bmp->height) + 16 + 44;
/* set title text */
@@ -191,6 +190,9 @@ static bool nsbmp_redraw(struct content *c, struct content_redraw_data *data,
return false;
}
+ bitmap_format_to_client(bmp->bitmap, &(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_R8G8B8A8,
+ });
guit->bitmap->modified(bmp->bitmap);
}
diff --git a/content/handlers/image/gif.c b/content/handlers/image/gif.c
index e2a0ca5db..deabd0adc 100644
--- a/content/handlers/image/gif.c
+++ b/content/handlers/image/gif.c
@@ -34,8 +34,12 @@
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
-#include <libnsgif.h>
+#include <nsutils/assert.h>
+
+#include <nsgif.h>
+
+#include "utils/log.h"
#include "utils/utils.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
@@ -47,17 +51,36 @@
#include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h"
+#include "desktop/bitmap.h"
#include "image/image.h"
#include "image/gif.h"
-typedef struct nsgif_content {
+typedef struct gif_content {
struct content base;
- struct gif_animation *gif; /**< GIF animation data */
- int current_frame; /**< current frame to display [0...(max-1)] */
-} nsgif_content;
+ nsgif_t *gif; /**< GIF animation data */
+ uint32_t current_frame; /**< current frame to display [0...(max-1)] */
+} gif_content;
+static inline nserror gif__nsgif_error_to_ns(nsgif_error gif_res)
+{
+ nserror err;
+
+ switch (gif_res) {
+ case NSGIF_OK:
+ err = NSERROR_OK;
+ break;
+ case NSGIF_ERR_OOM:
+ err = NSERROR_NOMEM;
+ break;
+ default:
+ err = NSERROR_GIF_ERROR;
+ break;
+ }
+
+ return err;
+}
/**
* Callback for libnsgif; forwards the call to bitmap_create()
@@ -66,44 +89,60 @@ typedef struct nsgif_content {
* \param height width of image in pixels
* \return an opaque struct bitmap, or NULL on memory exhaustion
*/
-static void *nsgif_bitmap_create(int width, int height)
+static void *gif_bitmap_create(int width, int height)
{
- return guit->bitmap->create(width, height, BITMAP_NEW);
+ return guit->bitmap->create(width, height, BITMAP_NONE);
}
+/**
+ * Convert client bitmap format to a LibNSGIF format specifier.
+ */
+static nsgif_bitmap_fmt_t nsgif__get_bitmap_format(void)
+{
+ ns_static_assert((int)BITMAP_LAYOUT_R8G8B8A8 == (int)NSGIF_BITMAP_FMT_R8G8B8A8);
+ ns_static_assert((int)BITMAP_LAYOUT_B8G8R8A8 == (int)NSGIF_BITMAP_FMT_B8G8R8A8);
+ ns_static_assert((int)BITMAP_LAYOUT_A8R8G8B8 == (int)NSGIF_BITMAP_FMT_A8R8G8B8);
+ ns_static_assert((int)BITMAP_LAYOUT_A8B8G8R8 == (int)NSGIF_BITMAP_FMT_A8B8G8R8);
+ ns_static_assert((int)BITMAP_LAYOUT_RGBA8888 == (int)NSGIF_BITMAP_FMT_RGBA8888);
+ ns_static_assert((int)BITMAP_LAYOUT_BGRA8888 == (int)NSGIF_BITMAP_FMT_BGRA8888);
+ ns_static_assert((int)BITMAP_LAYOUT_ARGB8888 == (int)NSGIF_BITMAP_FMT_ARGB8888);
+ ns_static_assert((int)BITMAP_LAYOUT_ABGR8888 == (int)NSGIF_BITMAP_FMT_ABGR8888);
+
+ return (nsgif_bitmap_fmt_t)bitmap_fmt.layout;
+}
-static nserror nsgif_create_gif_data(nsgif_content *c)
+static nserror gif_create_gif_data(gif_content *c)
{
- gif_bitmap_callback_vt gif_bitmap_callbacks = {
- .bitmap_create = nsgif_bitmap_create,
- .bitmap_destroy = guit->bitmap->destroy,
- .bitmap_get_buffer = guit->bitmap->get_buffer,
- .bitmap_set_opaque = guit->bitmap->set_opaque,
- .bitmap_test_opaque = guit->bitmap->test_opaque,
- .bitmap_modified = guit->bitmap->modified
+ nsgif_error gif_res;
+ const nsgif_bitmap_cb_vt gif_bitmap_callbacks = {
+ .create = gif_bitmap_create,
+ .destroy = guit->bitmap->destroy,
+ .get_buffer = guit->bitmap->get_buffer,
+ .set_opaque = guit->bitmap->set_opaque,
+ .test_opaque = bitmap_test_opaque,
+ .modified = guit->bitmap->modified,
};
- /* Initialise our data structure */
- c->gif = calloc(sizeof(gif_animation), 1);
- if (c->gif == NULL) {
- content_broadcast_error(&c->base, NSERROR_NOMEM, NULL);
- return NSERROR_NOMEM;
+ gif_res = nsgif_create(&gif_bitmap_callbacks,
+ nsgif__get_bitmap_format(), &c->gif);
+ if (gif_res != NSGIF_OK) {
+ nserror err = gif__nsgif_error_to_ns(gif_res);
+ content_broadcast_error(&c->base, err, NULL);
+ return err;
}
- gif_create(c->gif, &gif_bitmap_callbacks);
+
return NSERROR_OK;
}
-
-
-static nserror nsgif_create(const content_handler *handler,
- lwc_string *imime_type, const struct http_parameter *params,
+static nserror gif_create(const content_handler *handler,
+ lwc_string *imime_type, const struct http_parameter *params,
llcache_handle *llcache, const char *fallback_charset,
bool quirks, struct content **c)
{
- nsgif_content *result;
+ gif_content *result;
nserror error;
- result = calloc(1, sizeof(nsgif_content));
+ result = calloc(1, sizeof(gif_content));
if (result == NULL)
return NSERROR_NOMEM;
@@ -114,7 +153,7 @@ static nserror nsgif_create(const content_handler *handler,
return error;
}
- error = nsgif_create_gif_data(result);
+ error = gif_create_gif_data(result);
if (error != NSERROR_OK) {
free(result);
return error;
@@ -126,99 +165,65 @@ static nserror nsgif_create(const content_handler *handler,
}
/**
+ * Scheduler callback. Performs any necessary animation.
+ *
+ * \param p The content to animate
+*/
+static void gif_animate_cb(void *p);
+
+/**
* Performs any necessary animation.
*
* \param p The content to animate
*/
-static void nsgif_animate(void *p)
+static nserror gif__animate(gif_content *gif, bool redraw)
{
- nsgif_content *gif = p;
- union content_msg_data data;
- int delay;
- int f;
-
- /* Advance by a frame, updating the loop count accordingly */
- gif->current_frame++;
- if (gif->current_frame == (int)gif->gif->frame_count_partial) {
- gif->current_frame = 0;
-
- /* A loop count of 0 has a special meaning of infinite */
- if (gif->gif->loop_count != 0) {
- gif->gif->loop_count--;
- if (gif->gif->loop_count == 0) {
- gif->current_frame =
- gif->gif->frame_count_partial - 1;
- gif->gif->loop_count = -1;
- }
- }
+ nsgif_error gif_res;
+ nsgif_rect_t rect;
+ uint32_t delay;
+ uint32_t f;
+
+ gif_res = nsgif_frame_prepare(gif->gif, &rect, &delay, &f);
+ if (gif_res != NSGIF_OK) {
+ return gif__nsgif_error_to_ns(gif_res);
}
+ gif->current_frame = f;
+
/* Continue animating if we should */
- if (gif->gif->loop_count >= 0) {
- delay = gif->gif->frames[gif->current_frame].frame_delay;
- if (delay <= 1) {
- /* Assuming too fast to be intended, set default. */
- delay = 10;
- }
- guit->misc->schedule(delay * 10, nsgif_animate, gif);
+ if (nsoption_bool(animate_images) && delay != NSGIF_INFINITE) {
+ guit->misc->schedule(delay * 10, gif_animate_cb, gif);
}
- if ((!nsoption_bool(animate_images)) ||
- (!gif->gif->frames[gif->current_frame].display)) {
- return;
- }
+ if (redraw) {
+ union content_msg_data data;
- /* area within gif to redraw */
- f = gif->current_frame;
- data.redraw.x = gif->gif->frames[f].redraw_x;
- data.redraw.y = gif->gif->frames[f].redraw_y;
- data.redraw.width = gif->gif->frames[f].redraw_width;
- data.redraw.height = gif->gif->frames[f].redraw_height;
-
- /* redraw background (true) or plot on top (false) */
- if (gif->current_frame > 0) {
- /* previous frame needed clearing: expand the redraw area to
- * cover it */
- if (gif->gif->frames[f - 1].redraw_required) {
- if (data.redraw.x >
- (int)(gif->gif->frames[f - 1].redraw_x)) {
- data.redraw.width += data.redraw.x -
- gif->gif->frames[f - 1].redraw_x;
- data.redraw.x =
- gif->gif->frames[f - 1].redraw_x;
- }
- if (data.redraw.y >
- (int)(gif->gif->frames[f - 1].redraw_y)) {
- data.redraw.height += (data.redraw.y -
- gif->gif->frames[f - 1].redraw_y);
- data.redraw.y =
- gif->gif->frames[f - 1].redraw_y;
- }
- if ((int)(gif->gif->frames[f - 1].redraw_x +
- gif->gif->frames[f - 1].redraw_width) >
- (data.redraw.x + data.redraw.width))
- data.redraw.width =
- gif->gif->frames[f - 1].redraw_x -
- data.redraw.x +
- gif->gif->frames[f - 1].redraw_width;
- if ((int)(gif->gif->frames[f - 1].redraw_y +
- gif->gif->frames[f - 1].redraw_height) >
- (data.redraw.y + data.redraw.height))
- data.redraw.height =
- gif->gif->frames[f - 1].redraw_y -
- data.redraw.y +
- gif->gif->frames[f - 1].redraw_height;
- }
+ /* area within gif to redraw */
+ data.redraw.x = rect.x0;
+ data.redraw.y = rect.y0;
+ data.redraw.width = rect.x1 - rect.x0;
+ data.redraw.height = rect.y1 - rect.y0;
+
+ content_broadcast(&gif->base, CONTENT_MSG_REDRAW, &data);
}
- content_broadcast(&gif->base, CONTENT_MSG_REDRAW, &data);
+ return NSERROR_OK;
}
-static bool nsgif_convert(struct content *c)
+static void gif_animate_cb(void *p)
{
- nsgif_content *gif = (nsgif_content *) c;
- int res;
+ gif_content *gif = p;
+
+ gif__animate(gif, true);
+}
+
+static bool gif_convert(struct content *c)
+{
+ gif_content *gif = (gif_content *) c;
+ const nsgif_info_t *gif_info;
const uint8_t *data;
+ nsgif_error gif_err;
+ nserror err;
size_t size;
char *title;
@@ -226,37 +231,30 @@ static bool nsgif_convert(struct content *c)
data = content__get_source_data(c, &size);
/* Initialise the GIF */
- do {
- res = gif_initialise(gif->gif, size, (unsigned char *) data);
- if (res != GIF_OK && res != GIF_WORKING &&
- res != GIF_INSUFFICIENT_FRAME_DATA) {
- nserror error = NSERROR_UNKNOWN;
- switch (res) {
- case GIF_FRAME_DATA_ERROR:
- case GIF_INSUFFICIENT_DATA:
- case GIF_DATA_ERROR:
- error = NSERROR_GIF_ERROR;
- break;
- case GIF_INSUFFICIENT_MEMORY:
- error = NSERROR_NOMEM;
- break;
- }
- content_broadcast_error(c, error, NULL);
- return false;
- }
- } while (res != GIF_OK && res != GIF_INSUFFICIENT_FRAME_DATA);
+ gif_err = nsgif_data_scan(gif->gif, size, data);
+ if (gif_err != NSGIF_OK) {
+ NSLOG(netsurf, DEBUG, "%s", nsgif_strerror(gif_err));
+ /* Not fatal unless er have no frames. */
+ }
+
+ gif_info = nsgif_get_info(gif->gif);
+ assert(gif_info != NULL);
/* Abort on bad GIFs */
- if ((gif->gif->frame_count_partial == 0) || (gif->gif->width == 0) ||
- (gif->gif->height == 0)) {
- content_broadcast_error(c, NSERROR_GIF_ERROR, NULL);
+ if (gif_info->frame_count == 0) {
+ err = gif__nsgif_error_to_ns(gif_err);
+ content_broadcast_error(c, err, "GIF with no frames.");
+ return false;
+ } else if (gif_info->width == 0 || gif_info->height == 0) {
+ err = gif__nsgif_error_to_ns(gif_err);
+ content_broadcast_error(c, err, "Zero size image.");
return false;
}
/* Store our content width, height and calculate size */
- c->width = gif->gif->width;
- c->height = gif->gif->height;
- c->size += (gif->gif->width * gif->gif->height * 4) + 16 + 44;
+ c->width = gif_info->width;
+ c->height = gif_info->height;
+ c->size += (gif_info->width * gif_info->height * 4) + 16 + 44;
/* set title text */
title = messages_get_buff("GIFTitle",
@@ -267,12 +265,11 @@ static bool nsgif_convert(struct content *c)
free(title);
}
- /* Schedule the animation if we have one */
- gif->current_frame = 0;
- if (gif->gif->frame_count_partial > 1)
- guit->misc->schedule(gif->gif->frames[0].frame_delay * 10,
- nsgif_animate,
- c);
+ err = gif__animate(gif, false);
+ if (err != NSERROR_OK) {
+ content_broadcast_error(c, NSERROR_GIF_ERROR, NULL);
+ return false;
+ }
/* Exit as a success */
content_set_ready(c);
@@ -283,68 +280,51 @@ static bool nsgif_convert(struct content *c)
return true;
}
-
/**
* Updates the GIF bitmap to display the current frame
*
* \param gif The gif context to update.
- * \return GIF_OK on success else apropriate error code.
+ * \return NSGIF_OK on success else apropriate error code.
*/
-static gif_result nsgif_get_frame(nsgif_content *gif)
+static nsgif_error gif_get_frame(gif_content *gif,
+ nsgif_bitmap_t **bitmap)
{
- int previous_frame, current_frame, frame;
- gif_result res = GIF_OK;
-
- current_frame = gif->current_frame;
+ uint32_t current_frame = gif->current_frame;
if (!nsoption_bool(animate_images)) {
current_frame = 0;
}
- if (current_frame < gif->gif->decoded_frame) {
- previous_frame = 0;
- } else {
- previous_frame = gif->gif->decoded_frame + 1;
- }
-
- for (frame = previous_frame; frame <= current_frame; frame++) {
- res = gif_decode_frame(gif->gif, frame);
- }
-
- return res;
+ return nsgif_frame_decode(gif->gif, current_frame, bitmap);
}
-static bool nsgif_redraw(struct content *c, struct content_redraw_data *data,
+static bool gif_redraw(struct content *c, struct content_redraw_data *data,
const struct rect *clip, const struct redraw_context *ctx)
{
- nsgif_content *gif = (nsgif_content *) c;
+ gif_content *gif = (gif_content *) c;
+ nsgif_bitmap_t *bitmap;
- if (gif->current_frame != gif->gif->decoded_frame) {
- if (nsgif_get_frame(gif) != GIF_OK) {
- return false;
- }
+ if (gif_get_frame(gif, &bitmap) != NSGIF_OK) {
+ return false;
}
- return image_bitmap_plot(gif->gif->frame_image, data, clip, ctx);
+ return image_bitmap_plot(bitmap, data, clip, ctx);
}
-
-static void nsgif_destroy(struct content *c)
+static void gif_destroy(struct content *c)
{
- nsgif_content *gif = (nsgif_content *) c;
+ gif_content *gif = (gif_content *) c;
/* Free all the associated memory buffers */
- guit->misc->schedule(-1, nsgif_animate, c);
- gif_finalise(gif->gif);
- free(gif->gif);
+ guit->misc->schedule(-1, gif_animate_cb, c);
+ nsgif_destroy(gif->gif);
}
-
-static nserror nsgif_clone(const struct content *old, struct content **newc)
+static nserror gif_clone(const struct content *old, struct content **newc)
{
- nsgif_content *gif;
+ gif_content *gif;
nserror error;
- gif = calloc(1, sizeof(nsgif_content));
+ gif = calloc(1, sizeof(gif_content));
if (gif == NULL)
return NSERROR_NOMEM;
@@ -355,7 +335,7 @@ static nserror nsgif_clone(const struct content *old, struct content **newc)
}
/* Simply replay creation and conversion of content */
- error = nsgif_create_gif_data(gif);
+ error = gif_create_gif_data(gif);
if (error != NSERROR_OK) {
content_destroy(&gif->base);
return error;
@@ -363,7 +343,7 @@ static nserror nsgif_clone(const struct content *old, struct content **newc)
if (old->status == CONTENT_STATUS_READY ||
old->status == CONTENT_STATUS_DONE) {
- if (nsgif_convert(&gif->base) == false) {
+ if (gif_convert(&gif->base) == false) {
content_destroy(&gif->base);
return NSERROR_CLONE_FAILED;
}
@@ -374,9 +354,9 @@ static nserror nsgif_clone(const struct content *old, struct content **newc)
return NSERROR_OK;
}
-static void nsgif_add_user(struct content *c)
+static void gif_add_user(struct content *c)
{
- nsgif_content *gif = (nsgif_content *) c;
+ gif_content *gif = (gif_content *) c;
/* Ensure this content has already been converted.
* If it hasn't, the animation will start at the conversion phase instead. */
@@ -384,67 +364,66 @@ static void nsgif_add_user(struct content *c)
if (content_count_users(c) == 1) {
/* First user, and content already converted, so start the animation. */
- if (gif->gif->frame_count_partial > 1) {
- guit->misc->schedule(gif->gif->frames[0].frame_delay * 10,
- nsgif_animate, c);
+ if (nsgif_reset(gif->gif) == NSGIF_OK) {
+ gif__animate(gif, true);
}
}
}
-static void nsgif_remove_user(struct content *c)
+static void gif_remove_user(struct content *c)
{
if (content_count_users(c) == 1) {
/* Last user is about to be removed from this content, so stop the animation. */
- guit->misc->schedule(-1, nsgif_animate, c);
+ guit->misc->schedule(-1, gif_animate_cb, c);
}
}
-static void *nsgif_get_internal(const struct content *c, void *context)
+static nsgif_bitmap_t *gif_get_bitmap(
+ const struct content *c, void *context)
{
- nsgif_content *gif = (nsgif_content *) c;
+ gif_content *gif = (gif_content *) c;
+ nsgif_bitmap_t *bitmap;
- if (gif->current_frame != gif->gif->decoded_frame) {
- if (nsgif_get_frame(gif) != GIF_OK)
- return NULL;
+ if (gif_get_frame(gif, &bitmap) != NSGIF_OK) {
+ return NULL;
}
- return gif->gif->frame_image;
+ return bitmap;
}
-static content_type nsgif_content_type(void)
+static content_type gif_content_type(void)
{
return CONTENT_IMAGE;
}
-static bool nsgif_content_is_opaque(struct content *c)
+static bool gif_content_is_opaque(struct content *c)
{
- nsgif_content *gif = (nsgif_content *) c;
+ gif_content *gif = (gif_content *) c;
+ nsgif_bitmap_t *bitmap;
- if (gif->current_frame != gif->gif->decoded_frame) {
- if (nsgif_get_frame(gif) != GIF_OK) {
- return false;
- }
+ if (gif_get_frame(gif, &bitmap) != NSGIF_OK) {
+ return false;
}
- return guit->bitmap->get_opaque(gif->gif->frame_image);
+ return guit->bitmap->get_opaque(bitmap);
}
-static const content_handler nsgif_content_handler = {
- .create = nsgif_create,
- .data_complete = nsgif_convert,
- .destroy = nsgif_destroy,
- .redraw = nsgif_redraw,
- .clone = nsgif_clone,
- .add_user = nsgif_add_user,
- .remove_user = nsgif_remove_user,
- .get_internal = nsgif_get_internal,
- .type = nsgif_content_type,
- .is_opaque = nsgif_content_is_opaque,
+static const content_handler gif_content_handler = {
+ .create = gif_create,
+ .data_complete = gif_convert,
+ .destroy = gif_destroy,
+ .redraw = gif_redraw,
+ .clone = gif_clone,
+ .add_user = gif_add_user,
+ .remove_user = gif_remove_user,
+ .get_internal = gif_get_bitmap,
+ .type = gif_content_type,
+ .is_opaque = gif_content_is_opaque,
.no_share = false,
};
-static const char *nsgif_types[] = {
+static const char *gif_types[] = {
"image/gif"
};
-CONTENT_FACTORY_REGISTER_TYPES(nsgif, nsgif_types, nsgif_content_handler);
+CONTENT_FACTORY_REGISTER_TYPES(nsgif, gif_types, gif_content_handler);
diff --git a/content/handlers/image/ico.c b/content/handlers/image/ico.c
index 2d839b1d1..871da41a9 100644
--- a/content/handlers/image/ico.c
+++ b/content/handlers/image/ico.c
@@ -34,6 +34,7 @@
#include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h"
+#include "desktop/bitmap.h"
#include "image/image.h"
#include "image/ico.h"
@@ -54,12 +55,12 @@ typedef struct nsico_content {
*/
static void *nsico_bitmap_create(int width, int height, unsigned int bmp_state)
{
- unsigned int bitmap_state = BITMAP_NEW;
+ unsigned int bitmap_state = BITMAP_NONE;
/* set bitmap state based on bmp state */
bitmap_state |= (bmp_state & BMP_OPAQUE) ? BITMAP_OPAQUE : 0;
bitmap_state |= (bmp_state & BMP_CLEAR_MEMORY) ?
- BITMAP_CLEAR_MEMORY : 0;
+ BITMAP_CLEAR : 0;
/* return the created bitmap */
return guit->bitmap->create(width, height, bitmap_state);
@@ -71,7 +72,6 @@ static nserror nsico_create_ico_data(nsico_content *c)
.bitmap_create = nsico_bitmap_create,
.bitmap_destroy = guit->bitmap->destroy,
.bitmap_get_buffer = guit->bitmap->get_buffer,
- .bitmap_get_bpp = guit->bitmap->get_bpp
};
c->ico = calloc(sizeof(ico_collection), 1);
@@ -173,6 +173,23 @@ static bool nsico_convert(struct content *c)
return true;
}
+static bool nsico__decode(struct bmp_image *ico)
+{
+ if (ico->decoded == false) {
+ NSLOG(netsurf, DEBUG, "Decoding ICO %p", ico);
+ if (bmp_decode(ico) != BMP_OK) {
+ return false;
+ }
+
+ bitmap_format_to_client(ico->bitmap, &(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_R8G8B8A8,
+ });
+ guit->bitmap->modified(ico->bitmap);
+
+ }
+
+ return true;
+}
static bool nsico_redraw(struct content *c, struct content_redraw_data *data,
const struct rect *clip, const struct redraw_context *ctx)
@@ -189,14 +206,8 @@ static bool nsico_redraw(struct content *c, struct content_redraw_data *data,
}
/* ensure its decided */
- if (bmp->decoded == false) {
- if (bmp_decode(bmp) != BMP_OK) {
- return false;
- } else {
- NSLOG(netsurf, INFO, "Decoding bitmap");
- guit->bitmap->modified(bmp->bitmap);
- }
-
+ if (!nsico__decode(bmp)) {
+ return false;
}
return image_bitmap_plot(bmp->bitmap, data, clip, ctx);
@@ -260,12 +271,8 @@ static void *nsico_get_internal(const struct content *c, void *context)
return NULL;
}
- if (bmp->decoded == false) {
- if (bmp_decode(bmp) != BMP_OK) {
- return NULL;
- } else {
- guit->bitmap->modified(bmp->bitmap);
- }
+ if (!nsico__decode(bmp)) {
+ return NULL;
}
return bmp->bitmap;
@@ -292,12 +299,8 @@ static bool nsico_is_opaque(struct content *c)
return false;
}
- if (bmp->decoded == false) {
- if (bmp_decode(bmp) != BMP_OK) {
- return false;
- }
-
- guit->bitmap->modified(bmp->bitmap);
+ if (!nsico__decode(bmp)) {
+ return false;
}
return guit->bitmap->get_opaque(bmp->bitmap);
diff --git a/content/handlers/image/image.c b/content/handlers/image/image.c
index 4eb366e0b..3107ee495 100644
--- a/content/handlers/image/image.c
+++ b/content/handlers/image/image.c
@@ -26,6 +26,7 @@
#include "netsurf/bitmap.h"
#include "netsurf/content.h"
#include "desktop/gui_internal.h"
+#include "desktop/bitmap.h"
#include "image/bmp.h"
#include "image/gif.h"
@@ -124,7 +125,7 @@ bool image_bitmap_plot(struct bitmap *bitmap,
if (height == 1) {
/* optimise 1x1 bitmap plot */
pixel = guit->bitmap->get_buffer(bitmap);
- fill_style.fill_colour = pixel_to_colour(pixel);
+ fill_style.fill_colour = bitmap_pixel_to_colour(pixel);
if (guit->bitmap->get_opaque(bitmap) ||
((fill_style.fill_colour & 0xff000000) == 0xff000000)) {
diff --git a/content/handlers/image/image_cache.c b/content/handlers/image/image_cache.c
index bc0b91408..6ce6b5234 100644
--- a/content/handlers/image/image_cache.c
+++ b/content/handlers/image/image_cache.c
@@ -632,15 +632,15 @@ case chr : \
slen++;
break;
- FMTCHR('a', PRIssizet, params.limit);
- FMTCHR('b', PRIssizet, params.hysteresis);
- FMTCHR('c', PRIssizet, total_bitmap_size);
+ FMTCHR('a', PRIsizet, params.limit);
+ FMTCHR('b', PRIsizet, params.hysteresis);
+ FMTCHR('c', PRIsizet, total_bitmap_size);
FMTCHR('d', "d", bitmap_count);
FMTCHR('e', "u", current_age / 1000);
- FMTCHR('f', PRIssizet, max_bitmap_size);
+ FMTCHR('f', PRIsizet, max_bitmap_size);
FMTCHR('g', "d", max_bitmap_size_count);
FMTCHR('h', "d", max_bitmap_count);
- FMTCHR('i', PRIssizet, max_bitmap_count_size);
+ FMTCHR('i', PRIsizet, max_bitmap_count_size);
case 'j':
@@ -770,7 +770,7 @@ image_cache_snentryf(char *string,
if (centry->bitmap != NULL) {
slen += snprintf(string + slen,
size - slen,
- "%" PRIssizet,
+ "%" PRIsizet,
centry->bitmap_size);
} else {
slen += snprintf(string + slen,
diff --git a/content/handlers/image/jpeg.c b/content/handlers/image/jpeg.c
index 549c2b674..e07fb47bb 100644
--- a/content/handlers/image/jpeg.c
+++ b/content/handlers/image/jpeg.c
@@ -37,6 +37,7 @@
#include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h"
+#include "desktop/bitmap.h"
#include "image/image_cache.h"
@@ -49,13 +50,8 @@
*/
#define MIN_JPEG_SIZE 20
-#ifdef riscos
-/* We prefer the library to be configured with these options to save
- * copying data during decoding. */
-#if RGB_RED != 0 || RGB_GREEN != 1 || RGB_BLUE != 2 || RGB_PIXELSIZE != 4
-#warning JPEG library not optimally configured. Decoding will be slower.
-#endif
-/* but we don't care if we're not on RISC OS */
+#ifndef LIBJPEG_TURBO_VERSION
+#warning Using libjpeg (libjpeg-turbo is recommended)
#endif
static char nsjpeg_error_buffer[JMSG_LENGTH_MAX];
@@ -165,6 +161,94 @@ static void nsjpeg_error_exit(j_common_ptr cinfo)
}
/**
+ * Convert scan lines from CMYK to core client bitmap layout.
+ */
+static inline void nsjpeg__decode_cmyk(
+ struct jpeg_decompress_struct *cinfo,
+ uint8_t * volatile pixels,
+ size_t rowstride)
+{
+ int width = cinfo->output_width * 4;
+
+ do {
+ JSAMPROW scanlines[1] = {
+ [0] = (JSAMPROW)
+ (pixels + rowstride * cinfo->output_scanline),
+ };
+ jpeg_read_scanlines(cinfo, scanlines, 1);
+
+ for (int i = width - 4; 0 <= i; i -= 4) {
+ /* Trivial inverse CMYK -> RGBA */
+ const int c = scanlines[0][i + 0];
+ const int m = scanlines[0][i + 1];
+ const int y = scanlines[0][i + 2];
+ const int k = scanlines[0][i + 3];
+
+ const int ck = c * k;
+ const int mk = m * k;
+ const int yk = y * k;
+
+#define DIV255(x) ((x) + 1 + ((x) >> 8)) >> 8
+ scanlines[0][i + bitmap_layout.r] = DIV255(ck);
+ scanlines[0][i + bitmap_layout.g] = DIV255(mk);
+ scanlines[0][i + bitmap_layout.b] = DIV255(yk);
+ scanlines[0][i + bitmap_layout.a] = 0xff;
+#undef DIV255
+ }
+ } while (cinfo->output_scanline != cinfo->output_height);
+}
+
+/**
+ * Convert scan lines from CMYK to core client bitmap layout.
+ */
+static inline void nsjpeg__decode_rgb(
+ struct jpeg_decompress_struct *cinfo,
+ uint8_t * volatile pixels,
+ size_t rowstride)
+{
+ int width = cinfo->output_width;
+
+ do {
+ JSAMPROW scanlines[1] = {
+ [0] = (JSAMPROW)
+ (pixels + rowstride * cinfo->output_scanline),
+ };
+ jpeg_read_scanlines(cinfo, scanlines, 1);
+
+#if RGB_RED != 0 || RGB_GREEN != 1 || RGB_BLUE != 2 || RGB_PIXELSIZE != 4
+ /* Missmatch between configured libjpeg pixel format and
+ * NetSurf pixel format. Convert to RGBA */
+ for (int i = width - 1; 0 <= i; i--) {
+ int r = scanlines[0][i * RGB_PIXELSIZE + RGB_RED];
+ int g = scanlines[0][i * RGB_PIXELSIZE + RGB_GREEN];
+ int b = scanlines[0][i * RGB_PIXELSIZE + RGB_BLUE];
+ scanlines[0][i * 4 + bitmap_layout.r] = r;
+ scanlines[0][i * 4 + bitmap_layout.g] = g;
+ scanlines[0][i * 4 + bitmap_layout.b] = b;
+ scanlines[0][i * 4 + bitmap_layout.a] = 0xff;
+ }
+#endif
+ } while (cinfo->output_scanline != cinfo->output_height);
+}
+
+/**
+ * Convert scan lines from CMYK to core client bitmap layout.
+ */
+static inline void nsjpeg__decode_client_fmt(
+ struct jpeg_decompress_struct *cinfo,
+ uint8_t * volatile pixels,
+ size_t rowstride)
+{
+ do {
+ JSAMPROW scanlines[1] = {
+ [0] = (JSAMPROW)
+ (pixels + rowstride * cinfo->output_scanline),
+ };
+ jpeg_read_scanlines(cinfo, scanlines, 1);
+ } while (cinfo->output_scanline != cinfo->output_height);
+}
+
+/**
* create a bitmap from jpeg content.
*/
static struct bitmap *
@@ -175,8 +259,6 @@ jpeg_cache_convert(struct content *c)
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
jmp_buf setjmp_buffer;
- unsigned int height;
- unsigned int width;
struct bitmap * volatile bitmap = NULL;
uint8_t * volatile pixels = NULL;
size_t rowstride;
@@ -221,21 +303,42 @@ jpeg_cache_convert(struct content *c)
/* set output processing parameters */
if (cinfo.jpeg_color_space == JCS_CMYK ||
- cinfo.jpeg_color_space == JCS_YCCK) {
+ cinfo.jpeg_color_space == JCS_YCCK) {
cinfo.out_color_space = JCS_CMYK;
} else {
+#ifdef JCS_ALPHA_EXTENSIONS
+ switch (bitmap_fmt.layout) {
+ case BITMAP_LAYOUT_R8G8B8A8:
+ cinfo.out_color_space = JCS_EXT_RGBA;
+ break;
+ case BITMAP_LAYOUT_B8G8R8A8:
+ cinfo.out_color_space = JCS_EXT_BGRA;
+ break;
+ case BITMAP_LAYOUT_A8R8G8B8:
+ cinfo.out_color_space = JCS_EXT_ARGB;
+ break;
+ case BITMAP_LAYOUT_A8B8G8R8:
+ cinfo.out_color_space = JCS_EXT_ABGR;
+ break;
+ default:
+ NSLOG(netsurf, ERROR, "Unexpected bitmap format: %u",
+ bitmap_fmt.layout);
+ jpeg_destroy_decompress(&cinfo);
+ return NULL;
+ }
+#else
cinfo.out_color_space = JCS_RGB;
+#endif
}
cinfo.dct_method = JDCT_ISLOW;
/* commence the decompression, output parameters now valid */
jpeg_start_decompress(&cinfo);
- width = cinfo.output_width;
- height = cinfo.output_height;
-
/* create opaque bitmap (jpegs cannot be transparent) */
- bitmap = guit->bitmap->create(width, height, BITMAP_NEW | BITMAP_OPAQUE);
+ bitmap = guit->bitmap->create(
+ cinfo.output_width,
+ cinfo.output_height, BITMAP_OPAQUE);
if (bitmap == NULL) {
/* empty bitmap could not be created */
jpeg_destroy_decompress(&cinfo);
@@ -252,50 +355,21 @@ jpeg_cache_convert(struct content *c)
/* Convert scanlines from jpeg into bitmap */
rowstride = guit->bitmap->get_rowstride(bitmap);
- do {
- JSAMPROW scanlines[1];
- scanlines[0] = (JSAMPROW) (pixels +
- rowstride * cinfo.output_scanline);
- jpeg_read_scanlines(&cinfo, scanlines, 1);
+ switch (cinfo.out_color_space) {
+ case JCS_CMYK:
+ nsjpeg__decode_cmyk(&cinfo, pixels, rowstride);
+ break;
- if (cinfo.out_color_space == JCS_CMYK) {
- int i;
- for (i = width - 1; 0 <= i; i--) {
- /* Trivial inverse CMYK -> RGBA */
- const int c = scanlines[0][i * 4 + 0];
- const int m = scanlines[0][i * 4 + 1];
- const int y = scanlines[0][i * 4 + 2];
- const int k = scanlines[0][i * 4 + 3];
+ case JCS_RGB:
+ nsjpeg__decode_rgb(&cinfo, pixels, rowstride);
+ break;
- const int ck = c * k;
- const int mk = m * k;
- const int yk = y * k;
+ default:
+ nsjpeg__decode_client_fmt(&cinfo, pixels, rowstride);
+ break;
+ }
-#define DIV255(x) ((x) + 1 + ((x) >> 8)) >> 8
- scanlines[0][i * 4 + 0] = DIV255(ck);
- scanlines[0][i * 4 + 1] = DIV255(mk);
- scanlines[0][i * 4 + 2] = DIV255(yk);
- scanlines[0][i * 4 + 3] = 0xff;
-#undef DIV255
- }
- } else {
-#if RGB_RED != 0 || RGB_GREEN != 1 || RGB_BLUE != 2 || RGB_PIXELSIZE != 4
- /* Missmatch between configured libjpeg pixel format and
- * NetSurf pixel format. Convert to RGBA */
- int i;
- for (i = width - 1; 0 <= i; i--) {
- int r = scanlines[0][i * RGB_PIXELSIZE + RGB_RED];
- int g = scanlines[0][i * RGB_PIXELSIZE + RGB_GREEN];
- int b = scanlines[0][i * RGB_PIXELSIZE + RGB_BLUE];
- scanlines[0][i * 4 + 0] = r;
- scanlines[0][i * 4 + 1] = g;
- scanlines[0][i * 4 + 2] = b;
- scanlines[0][i * 4 + 3] = 0xff;
- }
-#endif
- }
- } while (cinfo.output_scanline != cinfo.output_height);
guit->bitmap->modified(bitmap);
jpeg_finish_decompress(&cinfo);
diff --git a/content/handlers/image/nssprite.c b/content/handlers/image/nssprite.c
index a4ce6b574..a98c48aa2 100644
--- a/content/handlers/image/nssprite.c
+++ b/content/handlers/image/nssprite.c
@@ -23,6 +23,8 @@
#include <stdbool.h>
#include <stdlib.h>
+#include <string.h>
+
#include <librosprite.h>
#include "utils/utils.h"
@@ -35,6 +37,7 @@
#include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h"
+#include "desktop/bitmap.h"
#include "image/nssprite.h"
@@ -116,7 +119,7 @@ static bool nssprite_convert(struct content *c)
struct rosprite* sprite = sprite_area->sprites[0];
- nssprite->bitmap = guit->bitmap->create(sprite->width, sprite->height, BITMAP_NEW);
+ nssprite->bitmap = guit->bitmap->create(sprite->width, sprite->height, BITMAP_NONE);
if (!nssprite->bitmap) {
content_broadcast_error(c, NSERROR_NOMEM, NULL);
return false;
@@ -128,19 +131,7 @@ static bool nssprite_convert(struct content *c)
}
unsigned char *spritebuf = (unsigned char *)sprite->image;
- /* reverse byte order of each word */
- for (uint32_t y = 0; y < sprite->height; y++) {
- for (uint32_t x = 0; x < sprite->width; x++) {
- int offset = 4 * (y * sprite->width + x);
-
- *imagebuf = (spritebuf[offset] << 24) |
- (spritebuf[offset + 1] << 16) |
- (spritebuf[offset + 2] << 8) |
- (spritebuf[offset + 3]);
-
- imagebuf++;
- }
- }
+ memcpy(imagebuf, spritebuf, sprite->width * sprite->height * 4);
c->width = sprite->width;
c->height = sprite->height;
@@ -154,6 +145,9 @@ static bool nssprite_convert(struct content *c)
free(title);
}
+ bitmap_format_to_client(nssprite->bitmap, &(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_A8B8G8R8,
+ });
guit->bitmap->modified(nssprite->bitmap);
content_set_ready(c);
diff --git a/content/handlers/image/png.c b/content/handlers/image/png.c
index 06a38ca0f..97a5795b3 100644
--- a/content/handlers/image/png.c
+++ b/content/handlers/image/png.c
@@ -32,6 +32,7 @@
#include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h"
+#include "desktop/bitmap.h"
#include "image/image_cache.h"
#include "image/png.h"
@@ -118,8 +119,37 @@ static void nspng_setup_transforms(png_structp png_ptr, png_infop info_ptr)
png_set_gray_to_rgb(png_ptr);
}
+ switch (bitmap_fmt.layout) {
+ case BITMAP_LAYOUT_B8G8R8A8: /* Fall through. */
+ case BITMAP_LAYOUT_A8B8G8R8:
+ png_set_bgr(png_ptr);
+ break;
+ default:
+ /* RGB is the default. */
+ break;
+ }
+
if (!(color_type & PNG_COLOR_MASK_ALPHA)) {
- png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
+ switch (bitmap_fmt.layout) {
+ case BITMAP_LAYOUT_A8R8G8B8: /* Fall through. */
+ case BITMAP_LAYOUT_A8B8G8R8:
+ png_set_filler(png_ptr, 0xff, PNG_FILLER_BEFORE);
+ break;
+
+ default:
+ png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
+ break;
+ }
+ } else {
+ switch (bitmap_fmt.layout) {
+ case BITMAP_LAYOUT_A8R8G8B8: /* Fall through. */
+ case BITMAP_LAYOUT_A8B8G8R8:
+ png_set_swap_alpha(png_ptr);
+ break;
+ default:
+ /* Alpha as final component is the default. */
+ break;
+ }
}
/* gamma correction - we use 2.2 as our screen gamma
@@ -163,14 +193,14 @@ static void info_callback(png_structp png_s, png_infop info)
}
/* Claim the required memory for the converted PNG */
- png_c->bitmap = guit->bitmap->create(width, height, BITMAP_NEW);
+ png_c->bitmap = guit->bitmap->create(width, height, BITMAP_NONE);
if (png_c->bitmap == NULL) {
/* Failed to create bitmap skip pre-conversion */
longjmp(png_jmpbuf(png_s), CBERR_NOPRE);
}
png_c->rowstride = guit->bitmap->get_rowstride(png_c->bitmap);
- png_c->bpp = guit->bitmap->get_bpp(png_c->bitmap);
+ png_c->bpp = sizeof(uint32_t);
nspng_setup_transforms(png_s, info);
@@ -483,7 +513,7 @@ png_cache_convert(struct content *c)
height = png_get_image_height(png_ptr, info_ptr);
/* Claim the required memory for the converted PNG */
- bitmap = guit->bitmap->create(width, height, BITMAP_NEW);
+ bitmap = guit->bitmap->create(width, height, BITMAP_NONE);
if (bitmap == NULL) {
/* cleanup and bail */
goto png_cache_convert_error;
@@ -508,7 +538,13 @@ png_cache_convert_error:
}
if (bitmap != NULL) {
- guit->bitmap->modified((struct bitmap *)bitmap);
+ bool opaque = bitmap_test_opaque((void *)bitmap);
+ guit->bitmap->set_opaque((void *)bitmap, opaque);
+ bitmap_format_to_client((void *)bitmap, &(bitmap_fmt_t) {
+ .layout = bitmap_fmt.layout,
+ .pma = opaque ? bitmap_fmt.pma : false,
+ });
+ guit->bitmap->modified((void *)bitmap);
}
return (struct bitmap *)bitmap;
@@ -535,7 +571,12 @@ static bool nspng_convert(struct content *c)
}
if (png_c->bitmap != NULL) {
- guit->bitmap->set_opaque(png_c->bitmap, guit->bitmap->test_opaque(png_c->bitmap));
+ bool opaque = bitmap_test_opaque(png_c->bitmap);
+ guit->bitmap->set_opaque(png_c->bitmap, opaque);
+ bitmap_format_to_client(png_c->bitmap, &(bitmap_fmt_t) {
+ .layout = bitmap_fmt.layout,
+ .pma = opaque ? bitmap_fmt.pma : false,
+ });
guit->bitmap->modified(png_c->bitmap);
}
diff --git a/content/handlers/image/rsvg.c b/content/handlers/image/rsvg.c
index 0051df38f..24fc1a4e0 100644
--- a/content/handlers/image/rsvg.c
+++ b/content/handlers/image/rsvg.c
@@ -51,6 +51,7 @@
#include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h"
+#include "desktop/bitmap.h"
#include "image/rsvg.h"
@@ -128,41 +129,6 @@ static bool rsvg_process_data(struct content *c, const char *data,
return true;
}
-/** Convert Cairo's ARGB output to NetSurf's favoured ABGR format. It converts
- * the data in-place.
- *
- * \param pixels Pixel data, in the form of ARGB. This will
- * be overwritten with new data in the form of ABGR.
- * \param width Width of the bitmap
- * \param height Height of the bitmap
- * \param rowstride Number of bytes to skip after each row (this
- * implementation requires this to be a multiple of 4.)
- */
-static inline void rsvg_argb_to_abgr(uint8_t *pixels,
- int width, int height, size_t rowstride)
-{
- uint8_t *p = pixels;
- int boff = 0, roff = 2;
-
- if (endian_host_is_le() == false) {
- boff = 1;
- roff = 3;
- }
-
- for (int y = 0; y < height; y++) {
- for (int x = 0; x < width; x++) {
- /* Swap R and B */
- const uint8_t r = p[4*x+roff];
-
- p[4*x+roff] = p[4*x+boff];
-
- p[4*x+boff] = r;
- }
-
- p += rowstride;
- }
-}
-
static bool rsvg_convert(struct content *c)
{
rsvg_content *d = (rsvg_content *) c;
@@ -187,7 +153,7 @@ static bool rsvg_convert(struct content *c)
c->height = rsvgsize.height;
if ((d->bitmap = guit->bitmap->create(c->width, c->height,
- BITMAP_NEW)) == NULL) {
+ BITMAP_NONE)) == NULL) {
NSLOG(netsurf, INFO,
"Failed to create bitmap for rsvg render.");
content_broadcast_error(c, NSERROR_NOMEM, NULL);
@@ -213,10 +179,10 @@ static bool rsvg_convert(struct content *c)
}
rsvg_handle_render_cairo(d->rsvgh, d->ct);
- rsvg_argb_to_abgr(guit->bitmap->get_buffer(d->bitmap),
- c->width, c->height,
- guit->bitmap->get_rowstride(d->bitmap));
+ bitmap_format_to_client(d->bitmap, &(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_ARGB8888,
+ });
guit->bitmap->modified(d->bitmap);
content_set_ready(c);
content_set_done(c);
diff --git a/content/handlers/image/webp.c b/content/handlers/image/webp.c
index 721e92438..da13316bc 100644
--- a/content/handlers/image/webp.c
+++ b/content/handlers/image/webp.c
@@ -38,6 +38,7 @@
#include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h"
+#include "desktop/bitmap.h"
#include "image/image_cache.h"
@@ -97,6 +98,9 @@ webp_cache_convert(struct content *c)
uint8_t *decoded;
size_t rowstride;
struct bitmap *bitmap = NULL;
+ bitmap_fmt_t webp_fmt = {
+ .layout = bitmap_fmt.layout,
+ };
source_data = content__get_source_data(c, &source_size);
@@ -107,9 +111,13 @@ webp_cache_convert(struct content *c)
}
if (webpfeatures.has_alpha == 0) {
- bmap_flags = BITMAP_NEW | BITMAP_OPAQUE;
+ bmap_flags = BITMAP_OPAQUE;
+ /* Image has no alpha. Premultiplied alpha makes no difference.
+ * Optimisation: Avoid unnecessary conversion by copying format.
+ */
+ webp_fmt.pma = bitmap_fmt.pma;
} else {
- bmap_flags = BITMAP_NEW;
+ bmap_flags = BITMAP_NONE;
}
/* create bitmap */
@@ -130,17 +138,33 @@ webp_cache_convert(struct content *c)
rowstride = guit->bitmap->get_rowstride(bitmap);
- decoded = WebPDecodeRGBAInto(source_data,
- source_size,
- pixels,
- webpfeatures.width * webpfeatures.height * 4,
- rowstride);
+ switch (webp_fmt.layout) {
+ default:
+ /* WebP has no ABGR function, fall back to default. */
+ webp_fmt.layout = BITMAP_LAYOUT_R8G8B8A8;
+ /* Fall through. */
+ case BITMAP_LAYOUT_R8G8B8A8:
+ decoded = WebPDecodeRGBAInto(source_data, source_size, pixels,
+ rowstride * webpfeatures.height, rowstride);
+ break;
+
+ case BITMAP_LAYOUT_B8G8R8A8:
+ decoded = WebPDecodeBGRAInto(source_data, source_size, pixels,
+ rowstride * webpfeatures.height, rowstride);
+ break;
+
+ case BITMAP_LAYOUT_A8R8G8B8:
+ decoded = WebPDecodeARGBInto(source_data, source_size, pixels,
+ rowstride * webpfeatures.height, rowstride);
+ break;
+ }
if (decoded == NULL) {
/* decode failed */
guit->bitmap->destroy(bitmap);
return NULL;
}
+ bitmap_format_to_client(bitmap, &webp_fmt);
guit->bitmap->modified(bitmap);
return bitmap;
diff --git a/content/handlers/javascript/duktape/CanvasRenderingContext2D.bnd b/content/handlers/javascript/duktape/CanvasRenderingContext2D.bnd
index db3c4efa3..2fe73f4e1 100644
--- a/content/handlers/javascript/duktape/CanvasRenderingContext2D.bnd
+++ b/content/handlers/javascript/duktape/CanvasRenderingContext2D.bnd
@@ -90,7 +90,7 @@ canvas2d_user_data_handler(dom_node_operation operation,
height = guit->bitmap->get_height(bitmap);
stride = guit->bitmap->get_rowstride(bitmap);
newbitmap = guit->bitmap->create(width, height,
- BITMAP_NEW);
+ BITMAP_NONE);
if (newbitmap != NULL) {
if (guit->bitmap->get_rowstride(newbitmap) == stride) {
// Compatible bitmap, bung the data over
@@ -173,7 +173,7 @@ static nserror canvas2d_create_bitmap(dom_node *node, struct bitmap **bitmap_out
bitmap = guit->bitmap->create(
(int)width, (int)height,
- BITMAP_NEW);
+ BITMAP_NONE);
if (bitmap == NULL) {
return NSERROR_NOMEM;
@@ -242,7 +242,7 @@ canvas2d__handle_dom_event(dom_event *evt, void *pw)
/* Okay, we need to reallocate our bitmap and re-cache values */
- newbitmap = guit->bitmap->create(width, height, BITMAP_NEW);
+ newbitmap = guit->bitmap->create(width, height, BITMAP_NONE);
stride = guit->bitmap->get_rowstride(newbitmap);
if (newbitmap != NULL) {
diff --git a/content/handlers/javascript/duktape/duk_config.h b/content/handlers/javascript/duktape/duk_config.h
index 0caed88cf..cba3e0f00 100644
--- a/content/handlers/javascript/duktape/duk_config.h
+++ b/content/handlers/javascript/duktape/duk_config.h
@@ -40,6 +40,8 @@
* - PowerPC 64-bit
* - SPARC 32-bit
* - SPARC 64-bit
+ * - RISC-V 32-bit
+ * - RISC-V 64-bit
* - SuperH
* - Motorola 68k
* - Emscripten
@@ -285,6 +287,22 @@
#endif
#endif
+/* RISC-V, https://github.com/riscv/riscv-toolchain-conventions#cc-preprocessor-definitions */
+#if defined(__riscv)
+#define DUK_F_RISCV
+#if defined(__riscv_xlen)
+#if (__riscv_xlen == 32)
+#define DUK_F_RISCV32
+#elif (__riscv_xlen == 64)
+#define DUK_F_RISCV64
+#else
+#error __riscv_xlen has unsupported value (not 32 or 64)
+#endif
+#else
+#error __riscv defined without __riscv_xlen
+#endif
+#endif /* __riscv */
+
/* SuperH */
#if defined(__sh__) || \
defined(__sh1__) || defined(__SH1__) || \
@@ -751,7 +769,7 @@
#define DUK_USE_BYTEORDER 3
#endif
#else /* DUK_F_OLD_SOLARIS */
-#include <ast/endian.h>
+#include <sys/param.h>
#endif /* DUK_F_OLD_SOLARIS */
#include <sys/param.h>
@@ -946,9 +964,7 @@
#elif defined(DUK_F_PPC64)
/* --- PowerPC 64-bit --- */
#define DUK_USE_ARCH_STRING "ppc64"
-#if !defined(DUK_USE_BYTEORDER)
-#define DUK_USE_BYTEORDER 3
-#endif
+/* No forced byteorder (both little and big endian are possible). */
#undef DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_SPARC32)
@@ -963,6 +979,18 @@
/* SPARC byte order varies so rely on autodetection. */
#undef DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
+#elif defined(DUK_F_RISCV32)
+/* --- RISC-V 32-bit --- */
+#define DUK_USE_ARCH_STRING "riscv32"
+#define DUK_USE_BYTEORDER 1
+#define DUK_USE_PACKED_TVAL
+#define DUK_F_PACKED_TVAL_PROVIDED
+#elif defined(DUK_F_RISCV64)
+/* --- RISC-V 64-bit --- */
+#define DUK_USE_ARCH_STRING "riscv64"
+#define DUK_USE_BYTEORDER 1
+#undef DUK_USE_PACKED_TVAL
+#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_SUPERH)
/* --- SuperH --- */
#define DUK_USE_ARCH_STRING "sh"
@@ -1103,7 +1131,7 @@
#define DUK_USE_FLEX_ZEROSIZE
#endif
-#undef DUK_USE_GCC_PRAGMAS
+#define DUK_USE_CLANG_PRAGMAS
#define DUK_USE_PACK_CLANG_ATTR
#if defined(__clang__) && defined(__has_builtin)
@@ -1243,6 +1271,7 @@
#define DUK_USE_FLEX_ZEROSIZE
#endif
+/* Since 4.6 one can '#pragma GCC diagnostic push/pop'. */
#if defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 40600)
#define DUK_USE_GCC_PRAGMAS
#else
@@ -2648,12 +2677,15 @@ typedef struct duk_hthread duk_context;
#define DUK_WO_NORETURN(stmt) do { stmt } while (0)
#endif
-#if !defined(DUK_UNREACHABLE)
+#if defined(DUK_UNREACHABLE)
+#define DUK_WO_UNREACHABLE(stmt) do { } while (0)
+#else
/* Don't know how to declare unreachable point, so don't do it; this
* may cause some spurious compilation warnings (e.g. "variable used
* uninitialized").
*/
#define DUK_UNREACHABLE() do { } while (0)
+#define DUK_WO_UNREACHABLE(stmt) do { stmt } while (0)
#endif
#if !defined(DUK_LOSE_CONST)
@@ -2882,6 +2914,10 @@ typedef struct duk_hthread duk_context;
#define DUK_USE_CACHE_ACTIVATION
#define DUK_USE_CACHE_CATCHER
#define DUK_USE_CALLSTACK_LIMIT 10000
+#define DUK_USE_CBOR_BUILTIN
+#define DUK_USE_CBOR_DEC_RECLIMIT 1000
+#define DUK_USE_CBOR_ENC_RECLIMIT 1000
+#define DUK_USE_CBOR_SUPPORT
#define DUK_USE_COMPILER_RECLIMIT 2500
#define DUK_USE_COROUTINE_SUPPORT
#undef DUK_USE_CPP_EXCEPTIONS
@@ -2945,7 +2981,7 @@ typedef struct duk_hthread duk_context;
#undef DUK_USE_GC_TORTURE
#undef DUK_USE_GET_MONOTONIC_TIME
#undef DUK_USE_GET_RANDOM_DOUBLE
-#undef DUK_USE_GLOBAL_BINDING
+#define DUK_USE_GLOBAL_BINDING
#define DUK_USE_GLOBAL_BUILTIN
#undef DUK_USE_HEAPPTR16
#undef DUK_USE_HEAPPTR_DEC16
@@ -2953,6 +2989,7 @@ typedef struct duk_hthread duk_context;
#define DUK_USE_HEX_FASTPATH
#define DUK_USE_HEX_SUPPORT
#define DUK_USE_HOBJECT_ARRAY_ABANDON_LIMIT 2
+#define DUK_USE_HOBJECT_ARRAY_ABANDON_MINSIZE 257
#define DUK_USE_HOBJECT_ARRAY_FAST_RESIZE_LIMIT 9
#define DUK_USE_HOBJECT_ARRAY_MINGROW_ADD 16
#define DUK_USE_HOBJECT_ARRAY_MINGROW_DIVISOR 8
diff --git a/content/handlers/javascript/duktape/duktape.c b/content/handlers/javascript/duktape/duktape.c
index 47621f038..18b2e99f9 100644
--- a/content/handlers/javascript/duktape/duktape.c
+++ b/content/handlers/javascript/duktape/duktape.c
@@ -1,7 +1,7 @@
/* Omit from static analysis. */
#ifndef __clang_analyzer__
/*
- * Single source autogenerated distributable for Duktape 2.4.0.
+ * Single source autogenerated distributable for Duktape 2.7.0.
*
* Git commit external (external).
* Git branch external.
@@ -18,7 +18,7 @@
*
* (http://opensource.org/licenses/MIT)
*
-* Copyright (c) 2013-2019 by Duktape authors (see AUTHORS.rst)
+* Copyright (c) 2013-present by Duktape authors (see AUTHORS.rst)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -106,6 +106,13 @@
* * James Swift (https://github.com/phraemer)
* * Luis de Bethencourt (https://github.com/luisbg)
* * Ian Whyman (https://github.com/v00d00)
+* * Rick Sayre (https://github.com/whorfin)
+* * Craig Leres (https://github.com/leres)
+* * Maurici Abad (https://github.com/mauriciabad)
+* * Nancy Li (https://github.com/NancyLi1013)
+* * William Parks (https://github.com/WilliamParks)
+* * Sam Hellawell (https://github.com/samhellawell)
+* * Vladislavs Sokurenko (https://github.com/sokurenko)
*
* Other contributions
* ===================
@@ -227,13 +234,14 @@
*
* A B C D E F G H Big endian (e.g. 68k) DUK_USE_DOUBLE_BE
* H G F E D C B A Little endian (e.g. x86) DUK_USE_DOUBLE_LE
- * D C B A H G F E Mixed/cross endian (e.g. ARM) DUK_USE_DOUBLE_ME
+ * D C B A H G F E Mixed endian (e.g. ARM FPA) DUK_USE_DOUBLE_ME
*
- * ARM is a special case: ARM double values are in mixed/cross endian
- * format while ARM duk_uint64_t values are in standard little endian
+ * Legacy ARM (FPA) is a special case: ARM double values are in mixed
+ * endian format while ARM duk_uint64_t values are in standard little endian
* format (H G F E D C B A). When a double is read as a duk_uint64_t
* from memory, the register will contain the (logical) value
* E F G H A B C D. This requires some special handling below.
+ * See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0056d/Bcfhgcgd.html.
*
* Indexes of various types (8-bit, 16-bit, 32-bit) in memory relative to
* the logical (big endian) order:
@@ -266,7 +274,7 @@ union duk_double_union {
duk_uint16_t us[4];
duk_uint8_t uc[8];
#if defined(DUK_USE_PACKED_TVAL)
- void *vp[2]; /* used by packed duk_tval, assumes sizeof(void *) == 4 */
+ void *vp[2]; /* used by packed duk_tval, assumes sizeof(void *) == 4 */
#endif
};
@@ -278,64 +286,64 @@ typedef union duk_double_union duk_double_union;
#if defined(DUK_USE_DOUBLE_LE)
#if defined(DUK_USE_64BIT_OPS)
-#define DUK_DBL_IDX_ULL0 0
-#endif
-#define DUK_DBL_IDX_UI0 1
-#define DUK_DBL_IDX_UI1 0
-#define DUK_DBL_IDX_US0 3
-#define DUK_DBL_IDX_US1 2
-#define DUK_DBL_IDX_US2 1
-#define DUK_DBL_IDX_US3 0
-#define DUK_DBL_IDX_UC0 7
-#define DUK_DBL_IDX_UC1 6
-#define DUK_DBL_IDX_UC2 5
-#define DUK_DBL_IDX_UC3 4
-#define DUK_DBL_IDX_UC4 3
-#define DUK_DBL_IDX_UC5 2
-#define DUK_DBL_IDX_UC6 1
-#define DUK_DBL_IDX_UC7 0
-#define DUK_DBL_IDX_VP0 DUK_DBL_IDX_UI0 /* packed tval */
-#define DUK_DBL_IDX_VP1 DUK_DBL_IDX_UI1 /* packed tval */
+#define DUK_DBL_IDX_ULL0 0
+#endif
+#define DUK_DBL_IDX_UI0 1
+#define DUK_DBL_IDX_UI1 0
+#define DUK_DBL_IDX_US0 3
+#define DUK_DBL_IDX_US1 2
+#define DUK_DBL_IDX_US2 1
+#define DUK_DBL_IDX_US3 0
+#define DUK_DBL_IDX_UC0 7
+#define DUK_DBL_IDX_UC1 6
+#define DUK_DBL_IDX_UC2 5
+#define DUK_DBL_IDX_UC3 4
+#define DUK_DBL_IDX_UC4 3
+#define DUK_DBL_IDX_UC5 2
+#define DUK_DBL_IDX_UC6 1
+#define DUK_DBL_IDX_UC7 0
+#define DUK_DBL_IDX_VP0 DUK_DBL_IDX_UI0 /* packed tval */
+#define DUK_DBL_IDX_VP1 DUK_DBL_IDX_UI1 /* packed tval */
#elif defined(DUK_USE_DOUBLE_BE)
#if defined(DUK_USE_64BIT_OPS)
-#define DUK_DBL_IDX_ULL0 0
-#endif
-#define DUK_DBL_IDX_UI0 0
-#define DUK_DBL_IDX_UI1 1
-#define DUK_DBL_IDX_US0 0
-#define DUK_DBL_IDX_US1 1
-#define DUK_DBL_IDX_US2 2
-#define DUK_DBL_IDX_US3 3
-#define DUK_DBL_IDX_UC0 0
-#define DUK_DBL_IDX_UC1 1
-#define DUK_DBL_IDX_UC2 2
-#define DUK_DBL_IDX_UC3 3
-#define DUK_DBL_IDX_UC4 4
-#define DUK_DBL_IDX_UC5 5
-#define DUK_DBL_IDX_UC6 6
-#define DUK_DBL_IDX_UC7 7
-#define DUK_DBL_IDX_VP0 DUK_DBL_IDX_UI0 /* packed tval */
-#define DUK_DBL_IDX_VP1 DUK_DBL_IDX_UI1 /* packed tval */
+#define DUK_DBL_IDX_ULL0 0
+#endif
+#define DUK_DBL_IDX_UI0 0
+#define DUK_DBL_IDX_UI1 1
+#define DUK_DBL_IDX_US0 0
+#define DUK_DBL_IDX_US1 1
+#define DUK_DBL_IDX_US2 2
+#define DUK_DBL_IDX_US3 3
+#define DUK_DBL_IDX_UC0 0
+#define DUK_DBL_IDX_UC1 1
+#define DUK_DBL_IDX_UC2 2
+#define DUK_DBL_IDX_UC3 3
+#define DUK_DBL_IDX_UC4 4
+#define DUK_DBL_IDX_UC5 5
+#define DUK_DBL_IDX_UC6 6
+#define DUK_DBL_IDX_UC7 7
+#define DUK_DBL_IDX_VP0 DUK_DBL_IDX_UI0 /* packed tval */
+#define DUK_DBL_IDX_VP1 DUK_DBL_IDX_UI1 /* packed tval */
#elif defined(DUK_USE_DOUBLE_ME)
#if defined(DUK_USE_64BIT_OPS)
-#define DUK_DBL_IDX_ULL0 0 /* not directly applicable, byte order differs from a double */
-#endif
-#define DUK_DBL_IDX_UI0 0
-#define DUK_DBL_IDX_UI1 1
-#define DUK_DBL_IDX_US0 1
-#define DUK_DBL_IDX_US1 0
-#define DUK_DBL_IDX_US2 3
-#define DUK_DBL_IDX_US3 2
-#define DUK_DBL_IDX_UC0 3
-#define DUK_DBL_IDX_UC1 2
-#define DUK_DBL_IDX_UC2 1
-#define DUK_DBL_IDX_UC3 0
-#define DUK_DBL_IDX_UC4 7
-#define DUK_DBL_IDX_UC5 6
-#define DUK_DBL_IDX_UC6 5
-#define DUK_DBL_IDX_UC7 4
-#define DUK_DBL_IDX_VP0 DUK_DBL_IDX_UI0 /* packed tval */
-#define DUK_DBL_IDX_VP1 DUK_DBL_IDX_UI1 /* packed tval */
+#define DUK_DBL_IDX_ULL0 0 /* not directly applicable, byte order differs from a double */
+#endif
+#define DUK_DBL_IDX_UI0 0
+#define DUK_DBL_IDX_UI1 1
+#define DUK_DBL_IDX_US0 1
+#define DUK_DBL_IDX_US1 0
+#define DUK_DBL_IDX_US2 3
+#define DUK_DBL_IDX_US3 2
+#define DUK_DBL_IDX_UC0 3
+#define DUK_DBL_IDX_UC1 2
+#define DUK_DBL_IDX_UC2 1
+#define DUK_DBL_IDX_UC3 0
+#define DUK_DBL_IDX_UC4 7
+#define DUK_DBL_IDX_UC5 6
+#define DUK_DBL_IDX_UC6 5
+#define DUK_DBL_IDX_UC7 4
+#define DUK_DBL_IDX_VP0 DUK_DBL_IDX_UI0 /* packed tval */
+#define DUK_DBL_IDX_VP1 DUK_DBL_IDX_UI1 /* packed tval */
#else
#error internal error
#endif
@@ -345,57 +353,63 @@ typedef union duk_double_union duk_double_union;
* by duk_numconv.c and duk_tval.h.
*/
-#define DUK_DBLUNION_SET_DOUBLE(u,v) do { \
+#define DUK_DBLUNION_SET_DOUBLE(u, v) \
+ do { \
(u)->d = (v); \
} while (0)
-#define DUK_DBLUNION_SET_HIGH32(u,v) do { \
+#define DUK_DBLUNION_SET_HIGH32(u, v) \
+ do { \
(u)->ui[DUK_DBL_IDX_UI0] = (duk_uint32_t) (v); \
} while (0)
#if defined(DUK_USE_64BIT_OPS)
#if defined(DUK_USE_DOUBLE_ME)
-#define DUK_DBLUNION_SET_HIGH32_ZERO_LOW32(u,v) do { \
+#define DUK_DBLUNION_SET_HIGH32_ZERO_LOW32(u, v) \
+ do { \
(u)->ull[DUK_DBL_IDX_ULL0] = (duk_uint64_t) (v); \
} while (0)
#else
-#define DUK_DBLUNION_SET_HIGH32_ZERO_LOW32(u,v) do { \
+#define DUK_DBLUNION_SET_HIGH32_ZERO_LOW32(u, v) \
+ do { \
(u)->ull[DUK_DBL_IDX_ULL0] = ((duk_uint64_t) (v)) << 32; \
} while (0)
#endif
-#else /* DUK_USE_64BIT_OPS */
-#define DUK_DBLUNION_SET_HIGH32_ZERO_LOW32(u,v) do { \
+#else /* DUK_USE_64BIT_OPS */
+#define DUK_DBLUNION_SET_HIGH32_ZERO_LOW32(u, v) \
+ do { \
(u)->ui[DUK_DBL_IDX_UI0] = (duk_uint32_t) (v); \
(u)->ui[DUK_DBL_IDX_UI1] = (duk_uint32_t) 0; \
} while (0)
-#endif /* DUK_USE_64BIT_OPS */
+#endif /* DUK_USE_64BIT_OPS */
-#define DUK_DBLUNION_SET_LOW32(u,v) do { \
+#define DUK_DBLUNION_SET_LOW32(u, v) \
+ do { \
(u)->ui[DUK_DBL_IDX_UI1] = (duk_uint32_t) (v); \
} while (0)
-#define DUK_DBLUNION_GET_DOUBLE(u) ((u)->d)
-#define DUK_DBLUNION_GET_HIGH32(u) ((u)->ui[DUK_DBL_IDX_UI0])
-#define DUK_DBLUNION_GET_LOW32(u) ((u)->ui[DUK_DBL_IDX_UI1])
+#define DUK_DBLUNION_GET_DOUBLE(u) ((u)->d)
+#define DUK_DBLUNION_GET_HIGH32(u) ((u)->ui[DUK_DBL_IDX_UI0])
+#define DUK_DBLUNION_GET_LOW32(u) ((u)->ui[DUK_DBL_IDX_UI1])
#if defined(DUK_USE_64BIT_OPS)
#if defined(DUK_USE_DOUBLE_ME)
-#define DUK_DBLUNION_SET_UINT64(u,v) do { \
+#define DUK_DBLUNION_SET_UINT64(u, v) \
+ do { \
(u)->ui[DUK_DBL_IDX_UI0] = (duk_uint32_t) ((v) >> 32); \
(u)->ui[DUK_DBL_IDX_UI1] = (duk_uint32_t) (v); \
} while (0)
-#define DUK_DBLUNION_GET_UINT64(u) \
- ((((duk_uint64_t) (u)->ui[DUK_DBL_IDX_UI0]) << 32) | \
- ((duk_uint64_t) (u)->ui[DUK_DBL_IDX_UI1]))
+#define DUK_DBLUNION_GET_UINT64(u) ((((duk_uint64_t) (u)->ui[DUK_DBL_IDX_UI0]) << 32) | ((duk_uint64_t) (u)->ui[DUK_DBL_IDX_UI1]))
#else
-#define DUK_DBLUNION_SET_UINT64(u,v) do { \
+#define DUK_DBLUNION_SET_UINT64(u, v) \
+ do { \
(u)->ull[DUK_DBL_IDX_ULL0] = (duk_uint64_t) (v); \
} while (0)
-#define DUK_DBLUNION_GET_UINT64(u) ((u)->ull[DUK_DBL_IDX_ULL0])
+#define DUK_DBLUNION_GET_UINT64(u) ((u)->ull[DUK_DBL_IDX_ULL0])
#endif
-#define DUK_DBLUNION_SET_INT64(u,v) DUK_DBLUNION_SET_UINT64((u), (duk_uint64_t) (v))
-#define DUK_DBLUNION_GET_INT64(u) ((duk_int64_t) DUK_DBLUNION_GET_UINT64((u)))
-#endif /* DUK_USE_64BIT_OPS */
+#define DUK_DBLUNION_SET_INT64(u, v) DUK_DBLUNION_SET_UINT64((u), (duk_uint64_t) (v))
+#define DUK_DBLUNION_GET_INT64(u) ((duk_int64_t) DUK_DBLUNION_GET_UINT64((u)))
+#endif /* DUK_USE_64BIT_OPS */
/*
* Double NaN manipulation macros related to NaN normalization needed when
@@ -426,103 +440,87 @@ typedef union duk_double_union duk_double_union;
#if defined(DUK_USE_64BIT_OPS)
#if defined(DUK_USE_DOUBLE_ME)
/* Macros for 64-bit ops + mixed endian doubles. */
-#define DUK__DBLUNION_SET_NAN_FULL(u) do { \
+#define DUK__DBLUNION_SET_NAN_FULL(u) \
+ do { \
(u)->ull[DUK_DBL_IDX_ULL0] = DUK_U64_CONSTANT(0x000000007ff80000); \
} while (0)
#define DUK__DBLUNION_IS_NAN_FULL(u) \
((((u)->ull[DUK_DBL_IDX_ULL0] & DUK_U64_CONSTANT(0x000000007ff00000)) == DUK_U64_CONSTANT(0x000000007ff00000)) && \
((((u)->ull[DUK_DBL_IDX_ULL0]) & DUK_U64_CONSTANT(0xffffffff000fffff)) != 0))
-#define DUK__DBLUNION_IS_NORMALIZED_NAN_FULL(u) \
- ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x000000007ff80000))
+#define DUK__DBLUNION_IS_NORMALIZED_NAN_FULL(u) ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x000000007ff80000))
#define DUK__DBLUNION_IS_ANYINF(u) \
(((u)->ull[DUK_DBL_IDX_ULL0] & DUK_U64_CONSTANT(0xffffffff7fffffff)) == DUK_U64_CONSTANT(0x000000007ff00000))
-#define DUK__DBLUNION_IS_POSINF(u) \
- ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x000000007ff00000))
-#define DUK__DBLUNION_IS_NEGINF(u) \
- ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x00000000fff00000))
+#define DUK__DBLUNION_IS_POSINF(u) ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x000000007ff00000))
+#define DUK__DBLUNION_IS_NEGINF(u) ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x00000000fff00000))
#define DUK__DBLUNION_IS_ANYZERO(u) \
(((u)->ull[DUK_DBL_IDX_ULL0] & DUK_U64_CONSTANT(0xffffffff7fffffff)) == DUK_U64_CONSTANT(0x0000000000000000))
-#define DUK__DBLUNION_IS_POSZERO(u) \
- ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x0000000000000000))
-#define DUK__DBLUNION_IS_NEGZERO(u) \
- ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x0000000080000000))
+#define DUK__DBLUNION_IS_POSZERO(u) ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x0000000000000000))
+#define DUK__DBLUNION_IS_NEGZERO(u) ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x0000000080000000))
#else
/* Macros for 64-bit ops + big/little endian doubles. */
-#define DUK__DBLUNION_SET_NAN_FULL(u) do { \
+#define DUK__DBLUNION_SET_NAN_FULL(u) \
+ do { \
(u)->ull[DUK_DBL_IDX_ULL0] = DUK_U64_CONSTANT(0x7ff8000000000000); \
} while (0)
#define DUK__DBLUNION_IS_NAN_FULL(u) \
((((u)->ull[DUK_DBL_IDX_ULL0] & DUK_U64_CONSTANT(0x7ff0000000000000)) == DUK_U64_CONSTANT(0x7ff0000000000000)) && \
((((u)->ull[DUK_DBL_IDX_ULL0]) & DUK_U64_CONSTANT(0x000fffffffffffff)) != 0))
-#define DUK__DBLUNION_IS_NORMALIZED_NAN_FULL(u) \
- ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x7ff8000000000000))
+#define DUK__DBLUNION_IS_NORMALIZED_NAN_FULL(u) ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x7ff8000000000000))
#define DUK__DBLUNION_IS_ANYINF(u) \
(((u)->ull[DUK_DBL_IDX_ULL0] & DUK_U64_CONSTANT(0x7fffffffffffffff)) == DUK_U64_CONSTANT(0x7ff0000000000000))
-#define DUK__DBLUNION_IS_POSINF(u) \
- ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x7ff0000000000000))
-#define DUK__DBLUNION_IS_NEGINF(u) \
- ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0xfff0000000000000))
+#define DUK__DBLUNION_IS_POSINF(u) ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x7ff0000000000000))
+#define DUK__DBLUNION_IS_NEGINF(u) ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0xfff0000000000000))
#define DUK__DBLUNION_IS_ANYZERO(u) \
(((u)->ull[DUK_DBL_IDX_ULL0] & DUK_U64_CONSTANT(0x7fffffffffffffff)) == DUK_U64_CONSTANT(0x0000000000000000))
-#define DUK__DBLUNION_IS_POSZERO(u) \
- ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x0000000000000000))
-#define DUK__DBLUNION_IS_NEGZERO(u) \
- ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x8000000000000000))
+#define DUK__DBLUNION_IS_POSZERO(u) ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x0000000000000000))
+#define DUK__DBLUNION_IS_NEGZERO(u) ((u)->ull[DUK_DBL_IDX_ULL0] == DUK_U64_CONSTANT(0x8000000000000000))
#endif
-#else /* DUK_USE_64BIT_OPS */
+#else /* DUK_USE_64BIT_OPS */
/* Macros for no 64-bit ops, any endianness. */
-#define DUK__DBLUNION_SET_NAN_FULL(u) do { \
+#define DUK__DBLUNION_SET_NAN_FULL(u) \
+ do { \
(u)->ui[DUK_DBL_IDX_UI0] = (duk_uint32_t) 0x7ff80000UL; \
(u)->ui[DUK_DBL_IDX_UI1] = (duk_uint32_t) 0x00000000UL; \
} while (0)
#define DUK__DBLUNION_IS_NAN_FULL(u) \
((((u)->ui[DUK_DBL_IDX_UI0] & 0x7ff00000UL) == 0x7ff00000UL) && \
- (((u)->ui[DUK_DBL_IDX_UI0] & 0x000fffffUL) != 0 || \
- (u)->ui[DUK_DBL_IDX_UI1] != 0))
+ (((u)->ui[DUK_DBL_IDX_UI0] & 0x000fffffUL) != 0 || (u)->ui[DUK_DBL_IDX_UI1] != 0))
#define DUK__DBLUNION_IS_NORMALIZED_NAN_FULL(u) \
- (((u)->ui[DUK_DBL_IDX_UI0] == 0x7ff80000UL) && \
- ((u)->ui[DUK_DBL_IDX_UI1] == 0x00000000UL))
+ (((u)->ui[DUK_DBL_IDX_UI0] == 0x7ff80000UL) && ((u)->ui[DUK_DBL_IDX_UI1] == 0x00000000UL))
#define DUK__DBLUNION_IS_ANYINF(u) \
- ((((u)->ui[DUK_DBL_IDX_UI0] & 0x7fffffffUL) == 0x7ff00000UL) && \
- ((u)->ui[DUK_DBL_IDX_UI1] == 0x00000000UL))
-#define DUK__DBLUNION_IS_POSINF(u) \
- (((u)->ui[DUK_DBL_IDX_UI0] == 0x7ff00000UL) && \
- ((u)->ui[DUK_DBL_IDX_UI1] == 0x00000000UL))
-#define DUK__DBLUNION_IS_NEGINF(u) \
- (((u)->ui[DUK_DBL_IDX_UI0] == 0xfff00000UL) && \
- ((u)->ui[DUK_DBL_IDX_UI1] == 0x00000000UL))
+ ((((u)->ui[DUK_DBL_IDX_UI0] & 0x7fffffffUL) == 0x7ff00000UL) && ((u)->ui[DUK_DBL_IDX_UI1] == 0x00000000UL))
+#define DUK__DBLUNION_IS_POSINF(u) (((u)->ui[DUK_DBL_IDX_UI0] == 0x7ff00000UL) && ((u)->ui[DUK_DBL_IDX_UI1] == 0x00000000UL))
+#define DUK__DBLUNION_IS_NEGINF(u) (((u)->ui[DUK_DBL_IDX_UI0] == 0xfff00000UL) && ((u)->ui[DUK_DBL_IDX_UI1] == 0x00000000UL))
#define DUK__DBLUNION_IS_ANYZERO(u) \
- ((((u)->ui[DUK_DBL_IDX_UI0] & 0x7fffffffUL) == 0x00000000UL) && \
- ((u)->ui[DUK_DBL_IDX_UI1] == 0x00000000UL))
-#define DUK__DBLUNION_IS_POSZERO(u) \
- (((u)->ui[DUK_DBL_IDX_UI0] == 0x00000000UL) && \
- ((u)->ui[DUK_DBL_IDX_UI1] == 0x00000000UL))
-#define DUK__DBLUNION_IS_NEGZERO(u) \
- (((u)->ui[DUK_DBL_IDX_UI0] == 0x80000000UL) && \
- ((u)->ui[DUK_DBL_IDX_UI1] == 0x00000000UL))
-#endif /* DUK_USE_64BIT_OPS */
-
-#define DUK__DBLUNION_SET_NAN_NOTFULL(u) do { \
+ ((((u)->ui[DUK_DBL_IDX_UI0] & 0x7fffffffUL) == 0x00000000UL) && ((u)->ui[DUK_DBL_IDX_UI1] == 0x00000000UL))
+#define DUK__DBLUNION_IS_POSZERO(u) (((u)->ui[DUK_DBL_IDX_UI0] == 0x00000000UL) && ((u)->ui[DUK_DBL_IDX_UI1] == 0x00000000UL))
+#define DUK__DBLUNION_IS_NEGZERO(u) (((u)->ui[DUK_DBL_IDX_UI0] == 0x80000000UL) && ((u)->ui[DUK_DBL_IDX_UI1] == 0x00000000UL))
+#endif /* DUK_USE_64BIT_OPS */
+
+#define DUK__DBLUNION_SET_NAN_NOTFULL(u) \
+ do { \
(u)->us[DUK_DBL_IDX_US0] = 0x7ff8UL; \
} while (0)
#define DUK__DBLUNION_IS_NAN_NOTFULL(u) \
/* E == 0x7ff, topmost four bits of F != 0 => assume NaN */ \
- ((((u)->us[DUK_DBL_IDX_US0] & 0x7ff0UL) == 0x7ff0UL) && \
- (((u)->us[DUK_DBL_IDX_US0] & 0x000fUL) != 0x0000UL))
+ ((((u)->us[DUK_DBL_IDX_US0] & 0x7ff0UL) == 0x7ff0UL) && (((u)->us[DUK_DBL_IDX_US0] & 0x000fUL) != 0x0000UL))
#define DUK__DBLUNION_IS_NORMALIZED_NAN_NOTFULL(u) \
/* E == 0x7ff, F == 8 => normalized NaN */ \
((u)->us[DUK_DBL_IDX_US0] == 0x7ff8UL)
-#define DUK__DBLUNION_NORMALIZE_NAN_CHECK_FULL(u) do { \
+#define DUK__DBLUNION_NORMALIZE_NAN_CHECK_FULL(u) \
+ do { \
if (DUK__DBLUNION_IS_NAN_FULL((u))) { \
DUK__DBLUNION_SET_NAN_FULL((u)); \
} \
} while (0)
-#define DUK__DBLUNION_NORMALIZE_NAN_CHECK_NOTFULL(u) do { \
- if (DUK__DBLUNION_IS_NAN_NOTFULL((u))) { \
+#define DUK__DBLUNION_NORMALIZE_NAN_CHECK_NOTFULL(u) \
+ do { \
+ /* Check must be full. */ \
+ if (DUK__DBLUNION_IS_NAN_FULL((u))) { \
DUK__DBLUNION_SET_NAN_NOTFULL((u)); \
} \
} while (0)
@@ -534,30 +532,30 @@ typedef union duk_double_union duk_double_union;
*/
#if defined(DUK_USE_PACKED_TVAL)
-#if defined(DUK_USE_FULL_TVAL)
-#define DUK_DBLUNION_NORMALIZE_NAN_CHECK(u) DUK__DBLUNION_NORMALIZE_NAN_CHECK_FULL((u))
-#define DUK_DBLUNION_IS_NAN(u) DUK__DBLUNION_IS_NAN_FULL((u))
-#define DUK_DBLUNION_IS_NORMALIZED_NAN(u) DUK__DBLUNION_IS_NORMALIZED_NAN_FULL((u))
-#define DUK_DBLUNION_SET_NAN(d) DUK__DBLUNION_SET_NAN_FULL((d))
-#else
-#define DUK_DBLUNION_NORMALIZE_NAN_CHECK(u) DUK__DBLUNION_NORMALIZE_NAN_CHECK_NOTFULL((u))
-#define DUK_DBLUNION_IS_NAN(u) DUK__DBLUNION_IS_NAN_NOTFULL((u))
-#define DUK_DBLUNION_IS_NORMALIZED_NAN(u) DUK__DBLUNION_IS_NORMALIZED_NAN_NOTFULL((u))
-#define DUK_DBLUNION_SET_NAN(d) DUK__DBLUNION_SET_NAN_NOTFULL((d))
+#define DUK_DBLUNION_NORMALIZE_NAN_CHECK(u) DUK__DBLUNION_NORMALIZE_NAN_CHECK_FULL((u))
+#define DUK_DBLUNION_IS_NAN(u) DUK__DBLUNION_IS_NAN_FULL((u))
+#define DUK_DBLUNION_IS_NORMALIZED_NAN(u) DUK__DBLUNION_IS_NORMALIZED_NAN_FULL((u))
+#define DUK_DBLUNION_SET_NAN(d) DUK__DBLUNION_SET_NAN_FULL((d))
+#if 0
+#define DUK_DBLUNION_NORMALIZE_NAN_CHECK(u) DUK__DBLUNION_NORMALIZE_NAN_CHECK_NOTFULL((u))
+#define DUK_DBLUNION_IS_NAN(u) DUK__DBLUNION_IS_NAN_NOTFULL((u))
+#define DUK_DBLUNION_IS_NORMALIZED_NAN(u) DUK__DBLUNION_IS_NORMALIZED_NAN_NOTFULL((u))
+#define DUK_DBLUNION_SET_NAN(d) DUK__DBLUNION_SET_NAN_NOTFULL((d))
#endif
#define DUK_DBLUNION_IS_NORMALIZED(u) \
- (!DUK_DBLUNION_IS_NAN((u)) || /* either not a NaN */ \
- DUK_DBLUNION_IS_NORMALIZED_NAN((u))) /* or is a normalized NaN */
-#else /* DUK_USE_PACKED_TVAL */
-#define DUK_DBLUNION_NORMALIZE_NAN_CHECK(u) /* nop: no need to normalize */
-#define DUK_DBLUNION_IS_NAN(u) DUK__DBLUNION_IS_NAN_FULL((u)) /* (DUK_ISNAN((u)->d)) */
-#define DUK_DBLUNION_IS_NORMALIZED_NAN(u) DUK__DBLUNION_IS_NAN_FULL((u)) /* (DUK_ISNAN((u)->d)) */
-#define DUK_DBLUNION_IS_NORMALIZED(u) 1 /* all doubles are considered normalized */
-#define DUK_DBLUNION_SET_NAN(u) do { \
+ (!DUK_DBLUNION_IS_NAN((u)) || /* either not a NaN */ \
+ DUK_DBLUNION_IS_NORMALIZED_NAN((u))) /* or is a normalized NaN */
+#else /* DUK_USE_PACKED_TVAL */
+#define DUK_DBLUNION_NORMALIZE_NAN_CHECK(u) /* nop: no need to normalize */
+#define DUK_DBLUNION_IS_NAN(u) DUK__DBLUNION_IS_NAN_FULL((u)) /* (DUK_ISNAN((u)->d)) */
+#define DUK_DBLUNION_IS_NORMALIZED_NAN(u) DUK__DBLUNION_IS_NAN_FULL((u)) /* (DUK_ISNAN((u)->d)) */
+#define DUK_DBLUNION_IS_NORMALIZED(u) 1 /* all doubles are considered normalized */
+#define DUK_DBLUNION_SET_NAN(u) \
+ do { \
/* in non-packed representation we don't care about which NaN is used */ \
(u)->d = DUK_DOUBLE_NAN; \
} while (0)
-#endif /* DUK_USE_PACKED_TVAL */
+#endif /* DUK_USE_PACKED_TVAL */
#define DUK_DBLUNION_IS_ANYINF(u) DUK__DBLUNION_IS_ANYINF((u))
#define DUK_DBLUNION_IS_POSINF(u) DUK__DBLUNION_IS_POSINF((u))
@@ -570,7 +568,8 @@ typedef union duk_double_union duk_double_union;
/* XXX: native 64-bit byteswaps when available */
/* 64-bit byteswap, same operation independent of target endianness. */
-#define DUK_DBLUNION_BSWAP64(u) do { \
+#define DUK_DBLUNION_BSWAP64(u) \
+ do { \
duk_uint32_t duk__bswaptmp1, duk__bswaptmp2; \
duk__bswaptmp1 = (u)->ui[0]; \
duk__bswaptmp2 = (u)->ui[1]; \
@@ -584,7 +583,8 @@ typedef union duk_double_union duk_double_union;
* order. For a big endian target this is a no-op.
*/
#if defined(DUK_USE_DOUBLE_LE)
-#define DUK_DBLUNION_DOUBLE_HTON(u) do { \
+#define DUK_DBLUNION_DOUBLE_HTON(u) \
+ do { \
duk_uint32_t duk__bswaptmp1, duk__bswaptmp2; \
duk__bswaptmp1 = (u)->ui[0]; \
duk__bswaptmp2 = (u)->ui[1]; \
@@ -594,7 +594,8 @@ typedef union duk_double_union duk_double_union;
(u)->ui[1] = duk__bswaptmp1; \
} while (0)
#elif defined(DUK_USE_DOUBLE_ME)
-#define DUK_DBLUNION_DOUBLE_HTON(u) do { \
+#define DUK_DBLUNION_DOUBLE_HTON(u) \
+ do { \
duk_uint32_t duk__bswaptmp1, duk__bswaptmp2; \
duk__bswaptmp1 = (u)->ui[0]; \
duk__bswaptmp2 = (u)->ui[1]; \
@@ -604,7 +605,9 @@ typedef union duk_double_union duk_double_union;
(u)->ui[1] = duk__bswaptmp2; \
} while (0)
#elif defined(DUK_USE_DOUBLE_BE)
-#define DUK_DBLUNION_DOUBLE_HTON(u) do { } while (0)
+#define DUK_DBLUNION_DOUBLE_HTON(u) \
+ do { \
+ } while (0)
#else
#error internal error, double endianness insane
#endif
@@ -621,7 +624,47 @@ typedef union duk_double_union duk_double_union;
#define DUK_DBLUNION_GET_SIGNBIT(u) (((u)->ui[DUK_DBL_IDX_UI0] >> 31U))
#endif
-#endif /* DUK_DBLUNION_H_INCLUDED */
+#endif /* DUK_DBLUNION_H_INCLUDED */
+/* #include duk_fltunion.h */
+/*
+ * Union to access IEEE float memory representation.
+ */
+
+#if !defined(DUK_FLTUNION_H_INCLUDED)
+#define DUK_FLTUNION_H_INCLUDED
+
+/* #include duk_internal.h -> already included */
+
+union duk_float_union {
+ float f;
+ duk_uint32_t ui[1];
+ duk_uint16_t us[2];
+ duk_uint8_t uc[4];
+};
+
+typedef union duk_float_union duk_float_union;
+
+#if defined(DUK_USE_DOUBLE_LE) || defined(DUK_USE_DOUBLE_ME)
+#define DUK_FLT_IDX_UI0 0
+#define DUK_FLT_IDX_US0 1
+#define DUK_FLT_IDX_US1 0
+#define DUK_FLT_IDX_UC0 3
+#define DUK_FLT_IDX_UC1 2
+#define DUK_FLT_IDX_UC2 1
+#define DUK_FLT_IDX_UC3 0
+#elif defined(DUK_USE_DOUBLE_BE)
+#define DUK_FLT_IDX_UI0 0
+#define DUK_FLT_IDX_US0 0
+#define DUK_FLT_IDX_US1 1
+#define DUK_FLT_IDX_UC0 0
+#define DUK_FLT_IDX_UC1 1
+#define DUK_FLT_IDX_UC2 2
+#define DUK_FLT_IDX_UC3 3
+#else
+#error internal error
+#endif
+
+#endif /* DUK_FLTUNION_H_INCLUDED */
/* #include duk_replacements.h */
#if !defined(DUK_REPLACEMENTS_H_INCLUDED)
#define DUK_REPLACEMENTS_H_INCLUDED
@@ -633,7 +676,7 @@ DUK_INTERNAL_DECL double duk_computed_infinity;
#if defined(DUK_USE_COMPUTED_NAN)
DUK_INTERNAL_DECL double duk_computed_nan;
#endif
-#endif /* !DUK_SINGLE_FILE */
+#endif /* !DUK_SINGLE_FILE */
#if defined(DUK_USE_REPL_FPCLASSIFY)
DUK_INTERNAL_DECL int duk_repl_fpclassify(double x);
@@ -651,7 +694,7 @@ DUK_INTERNAL_DECL int duk_repl_isnan(double x);
DUK_INTERNAL_DECL int duk_repl_isinf(double x);
#endif
-#endif /* DUK_REPLACEMENTS_H_INCLUDED */
+#endif /* DUK_REPLACEMENTS_H_INCLUDED */
/* #include duk_jmpbuf.h */
/*
* Wrapper for jmp_buf.
@@ -668,7 +711,7 @@ DUK_INTERNAL_DECL int duk_repl_isinf(double x);
#if defined(DUK_USE_CPP_EXCEPTIONS)
struct duk_jmpbuf {
- duk_small_int_t dummy; /* unused */
+ duk_small_int_t dummy; /* unused */
};
#else
struct duk_jmpbuf {
@@ -676,7 +719,7 @@ struct duk_jmpbuf {
};
#endif
-#endif /* DUK_JMPBUF_H_INCLUDED */
+#endif /* DUK_JMPBUF_H_INCLUDED */
/* #include duk_exception.h */
/*
* Exceptions for Duktape internal throws when C++ exceptions are used
@@ -702,12 +745,13 @@ class duk_internal_exception {
* aware of the "unsafe to continue" semantics.
*/
class duk_fatal_exception : public virtual std::runtime_error {
- public:
- duk_fatal_exception(const char *message) : std::runtime_error(message) {}
+ public:
+ duk_fatal_exception(const char *message) : std::runtime_error(message) {
+ }
};
#endif
-#endif /* DUK_EXCEPTION_H_INCLUDED */
+#endif /* DUK_EXCEPTION_H_INCLUDED */
/* #include duk_forwdecl.h */
/*
* Forward declarations for all Duktape structures.
@@ -842,7 +886,7 @@ typedef struct duk_compiler_ctx duk_compiler_ctx;
typedef struct duk_re_matcher_ctx duk_re_matcher_ctx;
typedef struct duk_re_compiler_ctx duk_re_compiler_ctx;
-#endif /* DUK_FORWDECL_H_INCLUDED */
+#endif /* DUK_FORWDECL_H_INCLUDED */
/* #include duk_tval.h */
/*
* Tagged type definition (duk_tval) and accessor macros.
@@ -887,30 +931,29 @@ typedef struct {
} duk_tval_unused;
/* tags */
-#define DUK_TAG_NORMALIZED_NAN 0x7ff8UL /* the NaN variant we use */
+#define DUK_TAG_NORMALIZED_NAN 0x7ff8UL /* the NaN variant we use */
/* avoid tag 0xfff0, no risk of confusion with negative infinity */
-#define DUK_TAG_MIN 0xfff1UL
+#define DUK_TAG_MIN 0xfff1UL
#if defined(DUK_USE_FASTINT)
-#define DUK_TAG_FASTINT 0xfff1UL /* embed: integer value */
+#define DUK_TAG_FASTINT 0xfff1UL /* embed: integer value */
#endif
-#define DUK_TAG_UNUSED 0xfff2UL /* marker; not actual tagged value */
-#define DUK_TAG_UNDEFINED 0xfff3UL /* embed: nothing */
-#define DUK_TAG_NULL 0xfff4UL /* embed: nothing */
-#define DUK_TAG_BOOLEAN 0xfff5UL /* embed: 0 or 1 (false or true) */
+#define DUK_TAG_UNUSED 0xfff2UL /* marker; not actual tagged value */
+#define DUK_TAG_UNDEFINED 0xfff3UL /* embed: nothing */
+#define DUK_TAG_NULL 0xfff4UL /* embed: nothing */
+#define DUK_TAG_BOOLEAN 0xfff5UL /* embed: 0 or 1 (false or true) */
/* DUK_TAG_NUMBER would logically go here, but it has multiple 'tags' */
-#define DUK_TAG_POINTER 0xfff6UL /* embed: void ptr */
-#define DUK_TAG_LIGHTFUNC 0xfff7UL /* embed: func ptr */
-#define DUK_TAG_STRING 0xfff8UL /* embed: duk_hstring ptr */
-#define DUK_TAG_OBJECT 0xfff9UL /* embed: duk_hobject ptr */
-#define DUK_TAG_BUFFER 0xfffaUL /* embed: duk_hbuffer ptr */
-#define DUK_TAG_MAX 0xfffaUL
+#define DUK_TAG_POINTER 0xfff6UL /* embed: void ptr */
+#define DUK_TAG_LIGHTFUNC 0xfff7UL /* embed: func ptr */
+#define DUK_TAG_STRING 0xfff8UL /* embed: duk_hstring ptr */
+#define DUK_TAG_OBJECT 0xfff9UL /* embed: duk_hobject ptr */
+#define DUK_TAG_BUFFER 0xfffaUL /* embed: duk_hbuffer ptr */
+#define DUK_TAG_MAX 0xfffaUL
/* for convenience */
-#define DUK_XTAG_BOOLEAN_FALSE 0xfff50000UL
-#define DUK_XTAG_BOOLEAN_TRUE 0xfff50001UL
+#define DUK_XTAG_BOOLEAN_FALSE 0xfff50000UL
+#define DUK_XTAG_BOOLEAN_TRUE 0xfff50001UL
-#define DUK_TVAL_IS_VALID_TAG(tv) \
- (DUK_TVAL_GET_TAG((tv)) - DUK_TAG_MIN <= DUK_TAG_MAX - DUK_TAG_MIN)
+#define DUK_TVAL_IS_VALID_TAG(tv) (DUK_TVAL_GET_TAG((tv)) - DUK_TAG_MIN <= DUK_TAG_MAX - DUK_TAG_MIN)
/* DUK_TVAL_UNUSED initializer for duk_tval_unused, works for any endianness. */
#define DUK_TVAL_UNUSED_INITIALIZER() \
@@ -919,116 +962,136 @@ typedef struct {
/* two casts to avoid gcc warning: "warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]" */
#if defined(DUK_USE_64BIT_OPS)
#if defined(DUK_USE_DOUBLE_ME)
-#define DUK__TVAL_SET_TAGGEDPOINTER(tv,h,tag) do { \
+#define DUK__TVAL_SET_TAGGEDPOINTER(tv, h, tag) \
+ do { \
(tv)->ull[DUK_DBL_IDX_ULL0] = (((duk_uint64_t) (tag)) << 16) | (((duk_uint64_t) (duk_uint32_t) (h)) << 32); \
} while (0)
#else
-#define DUK__TVAL_SET_TAGGEDPOINTER(tv,h,tag) do { \
+#define DUK__TVAL_SET_TAGGEDPOINTER(tv, h, tag) \
+ do { \
(tv)->ull[DUK_DBL_IDX_ULL0] = (((duk_uint64_t) (tag)) << 48) | ((duk_uint64_t) (duk_uint32_t) (h)); \
} while (0)
#endif
-#else /* DUK_USE_64BIT_OPS */
-#define DUK__TVAL_SET_TAGGEDPOINTER(tv,h,tag) do { \
+#else /* DUK_USE_64BIT_OPS */
+#define DUK__TVAL_SET_TAGGEDPOINTER(tv, h, tag) \
+ do { \
duk_tval *duk__tv; \
duk__tv = (tv); \
duk__tv->ui[DUK_DBL_IDX_UI0] = ((duk_uint32_t) (tag)) << 16; \
duk__tv->ui[DUK_DBL_IDX_UI1] = (duk_uint32_t) (h); \
} while (0)
-#endif /* DUK_USE_64BIT_OPS */
+#endif /* DUK_USE_64BIT_OPS */
#if defined(DUK_USE_64BIT_OPS)
/* Double casting for pointer to avoid gcc warning (cast from pointer to integer of different size) */
#if defined(DUK_USE_DOUBLE_ME)
-#define DUK__TVAL_SET_LIGHTFUNC(tv,fp,flags) do { \
- (tv)->ull[DUK_DBL_IDX_ULL0] = (((duk_uint64_t) DUK_TAG_LIGHTFUNC) << 16) | \
- ((duk_uint64_t) (flags)) | \
+#define DUK__TVAL_SET_LIGHTFUNC(tv, fp, flags) \
+ do { \
+ (tv)->ull[DUK_DBL_IDX_ULL0] = (((duk_uint64_t) DUK_TAG_LIGHTFUNC) << 16) | ((duk_uint64_t) (flags)) | \
(((duk_uint64_t) (duk_uint32_t) (fp)) << 32); \
} while (0)
#else
-#define DUK__TVAL_SET_LIGHTFUNC(tv,fp,flags) do { \
- (tv)->ull[DUK_DBL_IDX_ULL0] = (((duk_uint64_t) DUK_TAG_LIGHTFUNC) << 48) | \
- (((duk_uint64_t) (flags)) << 32) | \
+#define DUK__TVAL_SET_LIGHTFUNC(tv, fp, flags) \
+ do { \
+ (tv)->ull[DUK_DBL_IDX_ULL0] = (((duk_uint64_t) DUK_TAG_LIGHTFUNC) << 48) | (((duk_uint64_t) (flags)) << 32) | \
((duk_uint64_t) (duk_uint32_t) (fp)); \
} while (0)
#endif
-#else /* DUK_USE_64BIT_OPS */
-#define DUK__TVAL_SET_LIGHTFUNC(tv,fp,flags) do { \
+#else /* DUK_USE_64BIT_OPS */
+#define DUK__TVAL_SET_LIGHTFUNC(tv, fp, flags) \
+ do { \
duk_tval *duk__tv; \
duk__tv = (tv); \
duk__tv->ui[DUK_DBL_IDX_UI0] = (((duk_uint32_t) DUK_TAG_LIGHTFUNC) << 16) | ((duk_uint32_t) (flags)); \
duk__tv->ui[DUK_DBL_IDX_UI1] = (duk_uint32_t) (fp); \
} while (0)
-#endif /* DUK_USE_64BIT_OPS */
+#endif /* DUK_USE_64BIT_OPS */
#if defined(DUK_USE_FASTINT)
/* Note: masking is done for 'i' to deal with negative numbers correctly */
#if defined(DUK_USE_DOUBLE_ME)
-#define DUK__TVAL_SET_I48(tv,i) do { \
+#define DUK__TVAL_SET_I48(tv, i) \
+ do { \
duk_tval *duk__tv; \
duk__tv = (tv); \
- duk__tv->ui[DUK_DBL_IDX_UI0] = ((duk_uint32_t) DUK_TAG_FASTINT) << 16 | (((duk_uint32_t) ((i) >> 32)) & 0x0000ffffUL); \
+ duk__tv->ui[DUK_DBL_IDX_UI0] = \
+ ((duk_uint32_t) DUK_TAG_FASTINT) << 16 | (((duk_uint32_t) ((i) >> 32)) & 0x0000ffffUL); \
duk__tv->ui[DUK_DBL_IDX_UI1] = (duk_uint32_t) (i); \
} while (0)
-#define DUK__TVAL_SET_U32(tv,i) do { \
+#define DUK__TVAL_SET_U32(tv, i) \
+ do { \
duk_tval *duk__tv; \
duk__tv = (tv); \
duk__tv->ui[DUK_DBL_IDX_UI0] = ((duk_uint32_t) DUK_TAG_FASTINT) << 16; \
duk__tv->ui[DUK_DBL_IDX_UI1] = (duk_uint32_t) (i); \
} while (0)
#else
-#define DUK__TVAL_SET_I48(tv,i) do { \
- (tv)->ull[DUK_DBL_IDX_ULL0] = (((duk_uint64_t) DUK_TAG_FASTINT) << 48) | (((duk_uint64_t) (i)) & DUK_U64_CONSTANT(0x0000ffffffffffff)); \
+#define DUK__TVAL_SET_I48(tv, i) \
+ do { \
+ (tv)->ull[DUK_DBL_IDX_ULL0] = \
+ (((duk_uint64_t) DUK_TAG_FASTINT) << 48) | (((duk_uint64_t) (i)) & DUK_U64_CONSTANT(0x0000ffffffffffff)); \
} while (0)
-#define DUK__TVAL_SET_U32(tv,i) do { \
+#define DUK__TVAL_SET_U32(tv, i) \
+ do { \
(tv)->ull[DUK_DBL_IDX_ULL0] = (((duk_uint64_t) DUK_TAG_FASTINT) << 48) | (duk_uint64_t) (i); \
} while (0)
#endif
/* This needs to go through a cast because sign extension is needed. */
-#define DUK__TVAL_SET_I32(tv,i) do { \
+#define DUK__TVAL_SET_I32(tv, i) \
+ do { \
duk_int64_t duk__tmp = (duk_int64_t) (i); \
DUK_TVAL_SET_I48((tv), duk__tmp); \
} while (0)
/* XXX: Clumsy sign extend and masking of 16 topmost bits. */
#if defined(DUK_USE_DOUBLE_ME)
-#define DUK__TVAL_GET_FASTINT(tv) (((duk_int64_t) ((((duk_uint64_t) (tv)->ui[DUK_DBL_IDX_UI0]) << 32) | ((duk_uint64_t) (tv)->ui[DUK_DBL_IDX_UI1]))) << 16 >> 16)
+#define DUK__TVAL_GET_FASTINT(tv) \
+ (((duk_int64_t) ((((duk_uint64_t) (tv)->ui[DUK_DBL_IDX_UI0]) << 32) | ((duk_uint64_t) (tv)->ui[DUK_DBL_IDX_UI1]))) \
+ << 16 >> \
+ 16)
#else
-#define DUK__TVAL_GET_FASTINT(tv) ((((duk_int64_t) (tv)->ull[DUK_DBL_IDX_ULL0]) << 16) >> 16)
+#define DUK__TVAL_GET_FASTINT(tv) ((((duk_int64_t) (tv)->ull[DUK_DBL_IDX_ULL0]) << 16) >> 16)
#endif
-#define DUK__TVAL_GET_FASTINT_U32(tv) ((tv)->ui[DUK_DBL_IDX_UI1])
-#define DUK__TVAL_GET_FASTINT_I32(tv) ((duk_int32_t) (tv)->ui[DUK_DBL_IDX_UI1])
-#endif /* DUK_USE_FASTINT */
+#define DUK__TVAL_GET_FASTINT_U32(tv) ((tv)->ui[DUK_DBL_IDX_UI1])
+#define DUK__TVAL_GET_FASTINT_I32(tv) ((duk_int32_t) (tv)->ui[DUK_DBL_IDX_UI1])
+#endif /* DUK_USE_FASTINT */
-#define DUK_TVAL_SET_UNDEFINED(tv) do { \
+#define DUK_TVAL_SET_UNDEFINED(tv) \
+ do { \
(tv)->us[DUK_DBL_IDX_US0] = (duk_uint16_t) DUK_TAG_UNDEFINED; \
} while (0)
-#define DUK_TVAL_SET_UNUSED(tv) do { \
+#define DUK_TVAL_SET_UNUSED(tv) \
+ do { \
(tv)->us[DUK_DBL_IDX_US0] = (duk_uint16_t) DUK_TAG_UNUSED; \
} while (0)
-#define DUK_TVAL_SET_NULL(tv) do { \
+#define DUK_TVAL_SET_NULL(tv) \
+ do { \
(tv)->us[DUK_DBL_IDX_US0] = (duk_uint16_t) DUK_TAG_NULL; \
} while (0)
-#define DUK_TVAL_SET_BOOLEAN(tv,val) DUK_DBLUNION_SET_HIGH32((tv), (((duk_uint32_t) DUK_TAG_BOOLEAN) << 16) | ((duk_uint32_t) (val)))
+#define DUK_TVAL_SET_BOOLEAN(tv, val) \
+ DUK_DBLUNION_SET_HIGH32((tv), (((duk_uint32_t) DUK_TAG_BOOLEAN) << 16) | ((duk_uint32_t) (val)))
-#define DUK_TVAL_SET_NAN(tv) DUK_DBLUNION_SET_NAN_FULL((tv))
+#define DUK_TVAL_SET_NAN(tv) DUK_DBLUNION_SET_NAN_FULL((tv))
/* Assumes that caller has normalized NaNs, otherwise trouble ahead. */
#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_SET_DOUBLE(tv,d) do { \
+#define DUK_TVAL_SET_DOUBLE(tv, d) \
+ do { \
duk_double_t duk__dblval; \
duk__dblval = (d); \
DUK_ASSERT_DOUBLE_IS_NORMALIZED(duk__dblval); \
DUK_DBLUNION_SET_DOUBLE((tv), duk__dblval); \
} while (0)
-#define DUK_TVAL_SET_I48(tv,i) DUK__TVAL_SET_I48((tv), (i))
-#define DUK_TVAL_SET_I32(tv,i) DUK__TVAL_SET_I32((tv), (i))
-#define DUK_TVAL_SET_U32(tv,i) DUK__TVAL_SET_U32((tv), (i))
-#define DUK_TVAL_SET_NUMBER_CHKFAST_FAST(tv,d) duk_tval_set_number_chkfast_fast((tv), (d))
-#define DUK_TVAL_SET_NUMBER_CHKFAST_SLOW(tv,d) duk_tval_set_number_chkfast_slow((tv), (d))
-#define DUK_TVAL_SET_NUMBER(tv,d) DUK_TVAL_SET_DOUBLE((tv), (d))
-#define DUK_TVAL_CHKFAST_INPLACE_FAST(tv) do { \
+#define DUK_TVAL_SET_I48(tv, i) DUK__TVAL_SET_I48((tv), (i))
+#define DUK_TVAL_SET_I32(tv, i) DUK__TVAL_SET_I32((tv), (i))
+#define DUK_TVAL_SET_U32(tv, i) DUK__TVAL_SET_U32((tv), (i))
+#define DUK_TVAL_SET_NUMBER_CHKFAST_FAST(tv, d) duk_tval_set_number_chkfast_fast((tv), (d))
+#define DUK_TVAL_SET_NUMBER_CHKFAST_SLOW(tv, d) duk_tval_set_number_chkfast_slow((tv), (d))
+#define DUK_TVAL_SET_NUMBER(tv, d) DUK_TVAL_SET_DOUBLE((tv), (d))
+#define DUK_TVAL_CHKFAST_INPLACE_FAST(tv) \
+ do { \
duk_tval *duk__tv; \
duk_double_t duk__d; \
duk__tv = (tv); \
@@ -1037,7 +1100,8 @@ typedef struct {
DUK_TVAL_SET_NUMBER_CHKFAST_FAST(duk__tv, duk__d); \
} \
} while (0)
-#define DUK_TVAL_CHKFAST_INPLACE_SLOW(tv) do { \
+#define DUK_TVAL_CHKFAST_INPLACE_SLOW(tv) \
+ do { \
duk_tval *duk__tv; \
duk_double_t duk__d; \
duk__tv = (tv); \
@@ -1046,89 +1110,98 @@ typedef struct {
DUK_TVAL_SET_NUMBER_CHKFAST_SLOW(duk__tv, duk__d); \
} \
} while (0)
-#else /* DUK_USE_FASTINT */
-#define DUK_TVAL_SET_DOUBLE(tv,d) do { \
+#else /* DUK_USE_FASTINT */
+#define DUK_TVAL_SET_DOUBLE(tv, d) \
+ do { \
duk_double_t duk__dblval; \
duk__dblval = (d); \
DUK_ASSERT_DOUBLE_IS_NORMALIZED(duk__dblval); \
DUK_DBLUNION_SET_DOUBLE((tv), duk__dblval); \
} while (0)
-#define DUK_TVAL_SET_I48(tv,i) DUK_TVAL_SET_DOUBLE((tv), (duk_double_t) (i)) /* XXX: fast int-to-double */
-#define DUK_TVAL_SET_I32(tv,i) DUK_TVAL_SET_DOUBLE((tv), (duk_double_t) (i))
-#define DUK_TVAL_SET_U32(tv,i) DUK_TVAL_SET_DOUBLE((tv), (duk_double_t) (i))
-#define DUK_TVAL_SET_NUMBER_CHKFAST_FAST(tv,d) DUK_TVAL_SET_DOUBLE((tv), (d))
-#define DUK_TVAL_SET_NUMBER_CHKFAST_SLOW(tv,d) DUK_TVAL_SET_DOUBLE((tv), (d))
-#define DUK_TVAL_SET_NUMBER(tv,d) DUK_TVAL_SET_DOUBLE((tv), (d))
-#define DUK_TVAL_CHKFAST_INPLACE_FAST(tv) do { } while (0)
-#define DUK_TVAL_CHKFAST_INPLACE_SLOW(tv) do { } while (0)
-#endif /* DUK_USE_FASTINT */
-
-#define DUK_TVAL_SET_FASTINT(tv,i) DUK_TVAL_SET_I48((tv), (i)) /* alias */
-
-#define DUK_TVAL_SET_LIGHTFUNC(tv,fp,flags) DUK__TVAL_SET_LIGHTFUNC((tv), (fp), (flags))
-#define DUK_TVAL_SET_STRING(tv,h) DUK__TVAL_SET_TAGGEDPOINTER((tv), (h), DUK_TAG_STRING)
-#define DUK_TVAL_SET_OBJECT(tv,h) DUK__TVAL_SET_TAGGEDPOINTER((tv), (h), DUK_TAG_OBJECT)
-#define DUK_TVAL_SET_BUFFER(tv,h) DUK__TVAL_SET_TAGGEDPOINTER((tv), (h), DUK_TAG_BUFFER)
-#define DUK_TVAL_SET_POINTER(tv,p) DUK__TVAL_SET_TAGGEDPOINTER((tv), (p), DUK_TAG_POINTER)
-
-#define DUK_TVAL_SET_TVAL(tv,x) do { *(tv) = *(x); } while (0)
+#define DUK_TVAL_SET_I48(tv, i) DUK_TVAL_SET_DOUBLE((tv), (duk_double_t) (i)) /* XXX: fast int-to-double */
+#define DUK_TVAL_SET_I32(tv, i) DUK_TVAL_SET_DOUBLE((tv), (duk_double_t) (i))
+#define DUK_TVAL_SET_U32(tv, i) DUK_TVAL_SET_DOUBLE((tv), (duk_double_t) (i))
+#define DUK_TVAL_SET_NUMBER_CHKFAST_FAST(tv, d) DUK_TVAL_SET_DOUBLE((tv), (d))
+#define DUK_TVAL_SET_NUMBER_CHKFAST_SLOW(tv, d) DUK_TVAL_SET_DOUBLE((tv), (d))
+#define DUK_TVAL_SET_NUMBER(tv, d) DUK_TVAL_SET_DOUBLE((tv), (d))
+#define DUK_TVAL_CHKFAST_INPLACE_FAST(tv) \
+ do { \
+ } while (0)
+#define DUK_TVAL_CHKFAST_INPLACE_SLOW(tv) \
+ do { \
+ } while (0)
+#endif /* DUK_USE_FASTINT */
+
+#define DUK_TVAL_SET_FASTINT(tv, i) DUK_TVAL_SET_I48((tv), (i)) /* alias */
+
+#define DUK_TVAL_SET_LIGHTFUNC(tv, fp, flags) DUK__TVAL_SET_LIGHTFUNC((tv), (fp), (flags))
+#define DUK_TVAL_SET_STRING(tv, h) DUK__TVAL_SET_TAGGEDPOINTER((tv), (h), DUK_TAG_STRING)
+#define DUK_TVAL_SET_OBJECT(tv, h) DUK__TVAL_SET_TAGGEDPOINTER((tv), (h), DUK_TAG_OBJECT)
+#define DUK_TVAL_SET_BUFFER(tv, h) DUK__TVAL_SET_TAGGEDPOINTER((tv), (h), DUK_TAG_BUFFER)
+#define DUK_TVAL_SET_POINTER(tv, p) DUK__TVAL_SET_TAGGEDPOINTER((tv), (p), DUK_TAG_POINTER)
+
+#define DUK_TVAL_SET_TVAL(tv, x) \
+ do { \
+ *(tv) = *(x); \
+ } while (0)
/* getters */
-#define DUK_TVAL_GET_BOOLEAN(tv) ((duk_small_uint_t) (tv)->us[DUK_DBL_IDX_US1])
+#define DUK_TVAL_GET_BOOLEAN(tv) ((duk_small_uint_t) (tv)->us[DUK_DBL_IDX_US1])
#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_GET_DOUBLE(tv) ((tv)->d)
-#define DUK_TVAL_GET_FASTINT(tv) DUK__TVAL_GET_FASTINT((tv))
-#define DUK_TVAL_GET_FASTINT_U32(tv) DUK__TVAL_GET_FASTINT_U32((tv))
-#define DUK_TVAL_GET_FASTINT_I32(tv) DUK__TVAL_GET_FASTINT_I32((tv))
-#define DUK_TVAL_GET_NUMBER(tv) duk_tval_get_number_packed((tv))
+#define DUK_TVAL_GET_DOUBLE(tv) ((tv)->d)
+#define DUK_TVAL_GET_FASTINT(tv) DUK__TVAL_GET_FASTINT((tv))
+#define DUK_TVAL_GET_FASTINT_U32(tv) DUK__TVAL_GET_FASTINT_U32((tv))
+#define DUK_TVAL_GET_FASTINT_I32(tv) DUK__TVAL_GET_FASTINT_I32((tv))
+#define DUK_TVAL_GET_NUMBER(tv) duk_tval_get_number_packed((tv))
#else
-#define DUK_TVAL_GET_NUMBER(tv) ((tv)->d)
-#define DUK_TVAL_GET_DOUBLE(tv) ((tv)->d)
+#define DUK_TVAL_GET_NUMBER(tv) ((tv)->d)
+#define DUK_TVAL_GET_DOUBLE(tv) ((tv)->d)
#endif
-#define DUK_TVAL_GET_LIGHTFUNC(tv,out_fp,out_flags) do { \
+#define DUK_TVAL_GET_LIGHTFUNC(tv, out_fp, out_flags) \
+ do { \
(out_flags) = (tv)->ui[DUK_DBL_IDX_UI0] & 0xffffUL; \
(out_fp) = (duk_c_function) (tv)->ui[DUK_DBL_IDX_UI1]; \
} while (0)
-#define DUK_TVAL_GET_LIGHTFUNC_FUNCPTR(tv) ((duk_c_function) ((tv)->ui[DUK_DBL_IDX_UI1]))
-#define DUK_TVAL_GET_LIGHTFUNC_FLAGS(tv) (((duk_small_uint_t) (tv)->ui[DUK_DBL_IDX_UI0]) & 0xffffUL)
-#define DUK_TVAL_GET_STRING(tv) ((duk_hstring *) (tv)->vp[DUK_DBL_IDX_VP1])
-#define DUK_TVAL_GET_OBJECT(tv) ((duk_hobject *) (tv)->vp[DUK_DBL_IDX_VP1])
-#define DUK_TVAL_GET_BUFFER(tv) ((duk_hbuffer *) (tv)->vp[DUK_DBL_IDX_VP1])
-#define DUK_TVAL_GET_POINTER(tv) ((void *) (tv)->vp[DUK_DBL_IDX_VP1])
-#define DUK_TVAL_GET_HEAPHDR(tv) ((duk_heaphdr *) (tv)->vp[DUK_DBL_IDX_VP1])
+#define DUK_TVAL_GET_LIGHTFUNC_FUNCPTR(tv) ((duk_c_function) ((tv)->ui[DUK_DBL_IDX_UI1]))
+#define DUK_TVAL_GET_LIGHTFUNC_FLAGS(tv) (((duk_small_uint_t) (tv)->ui[DUK_DBL_IDX_UI0]) & 0xffffUL)
+#define DUK_TVAL_GET_STRING(tv) ((duk_hstring *) (tv)->vp[DUK_DBL_IDX_VP1])
+#define DUK_TVAL_GET_OBJECT(tv) ((duk_hobject *) (tv)->vp[DUK_DBL_IDX_VP1])
+#define DUK_TVAL_GET_BUFFER(tv) ((duk_hbuffer *) (tv)->vp[DUK_DBL_IDX_VP1])
+#define DUK_TVAL_GET_POINTER(tv) ((void *) (tv)->vp[DUK_DBL_IDX_VP1])
+#define DUK_TVAL_GET_HEAPHDR(tv) ((duk_heaphdr *) (tv)->vp[DUK_DBL_IDX_VP1])
/* decoding */
-#define DUK_TVAL_GET_TAG(tv) ((duk_small_uint_t) (tv)->us[DUK_DBL_IDX_US0])
-
-#define DUK_TVAL_IS_UNDEFINED(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_UNDEFINED)
-#define DUK_TVAL_IS_UNUSED(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_UNUSED)
-#define DUK_TVAL_IS_NULL(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_NULL)
-#define DUK_TVAL_IS_BOOLEAN(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_BOOLEAN)
-#define DUK_TVAL_IS_BOOLEAN_TRUE(tv) ((tv)->ui[DUK_DBL_IDX_UI0] == DUK_XTAG_BOOLEAN_TRUE)
-#define DUK_TVAL_IS_BOOLEAN_FALSE(tv) ((tv)->ui[DUK_DBL_IDX_UI0] == DUK_XTAG_BOOLEAN_FALSE)
-#define DUK_TVAL_IS_LIGHTFUNC(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_LIGHTFUNC)
-#define DUK_TVAL_IS_STRING(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_STRING)
-#define DUK_TVAL_IS_OBJECT(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_OBJECT)
-#define DUK_TVAL_IS_BUFFER(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_BUFFER)
-#define DUK_TVAL_IS_POINTER(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_POINTER)
+#define DUK_TVAL_GET_TAG(tv) ((duk_small_uint_t) (tv)->us[DUK_DBL_IDX_US0])
+
+#define DUK_TVAL_IS_UNDEFINED(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_UNDEFINED)
+#define DUK_TVAL_IS_UNUSED(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_UNUSED)
+#define DUK_TVAL_IS_NULL(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_NULL)
+#define DUK_TVAL_IS_BOOLEAN(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_BOOLEAN)
+#define DUK_TVAL_IS_BOOLEAN_TRUE(tv) ((tv)->ui[DUK_DBL_IDX_UI0] == DUK_XTAG_BOOLEAN_TRUE)
+#define DUK_TVAL_IS_BOOLEAN_FALSE(tv) ((tv)->ui[DUK_DBL_IDX_UI0] == DUK_XTAG_BOOLEAN_FALSE)
+#define DUK_TVAL_IS_LIGHTFUNC(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_LIGHTFUNC)
+#define DUK_TVAL_IS_STRING(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_STRING)
+#define DUK_TVAL_IS_OBJECT(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_OBJECT)
+#define DUK_TVAL_IS_BUFFER(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_BUFFER)
+#define DUK_TVAL_IS_POINTER(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_POINTER)
#if defined(DUK_USE_FASTINT)
/* 0xfff0 is -Infinity */
-#define DUK_TVAL_IS_DOUBLE(tv) (DUK_TVAL_GET_TAG((tv)) <= 0xfff0UL)
-#define DUK_TVAL_IS_FASTINT(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_FASTINT)
-#define DUK_TVAL_IS_NUMBER(tv) (DUK_TVAL_GET_TAG((tv)) <= 0xfff1UL)
+#define DUK_TVAL_IS_DOUBLE(tv) (DUK_TVAL_GET_TAG((tv)) <= 0xfff0UL)
+#define DUK_TVAL_IS_FASTINT(tv) (DUK_TVAL_GET_TAG((tv)) == DUK_TAG_FASTINT)
+#define DUK_TVAL_IS_NUMBER(tv) (DUK_TVAL_GET_TAG((tv)) <= 0xfff1UL)
#else
-#define DUK_TVAL_IS_NUMBER(tv) (DUK_TVAL_GET_TAG((tv)) <= 0xfff0UL)
-#define DUK_TVAL_IS_DOUBLE(tv) DUK_TVAL_IS_NUMBER((tv))
+#define DUK_TVAL_IS_NUMBER(tv) (DUK_TVAL_GET_TAG((tv)) <= 0xfff0UL)
+#define DUK_TVAL_IS_DOUBLE(tv) DUK_TVAL_IS_NUMBER((tv))
#endif
/* This is performance critical because it appears in every DECREF. */
-#define DUK_TVAL_IS_HEAP_ALLOCATED(tv) (DUK_TVAL_GET_TAG((tv)) >= DUK_TAG_STRING)
+#define DUK_TVAL_IS_HEAP_ALLOCATED(tv) (DUK_TVAL_GET_TAG((tv)) >= DUK_TAG_STRING)
#if defined(DUK_USE_FASTINT)
DUK_INTERNAL_DECL duk_double_t duk_tval_get_number_packed(duk_tval *tv);
#endif
-#else /* DUK_USE_PACKED_TVAL */
+#else /* DUK_USE_PACKED_TVAL */
/* ======================================================================== */
/*
@@ -1152,7 +1225,7 @@ struct duk_tval_struct {
duk_double_t d;
duk_small_int_t i;
#if defined(DUK_USE_FASTINT)
- duk_int64_t fi; /* if present, forces 16-byte duk_tval */
+ duk_int64_t fi; /* if present, forces 16-byte duk_tval */
#endif
void *voidptr;
duk_hstring *hstring;
@@ -1180,24 +1253,23 @@ typedef struct {
#define DUK_TVAL_UNUSED_INITIALIZER() \
{ DUK_TAG_UNUSED, 0, 0.0 }
-#define DUK_TAG_MIN 0
-#define DUK_TAG_NUMBER 0 /* DUK_TAG_NUMBER only defined for non-packed duk_tval */
+#define DUK_TAG_MIN 0
+#define DUK_TAG_NUMBER 0 /* DUK_TAG_NUMBER only defined for non-packed duk_tval */
#if defined(DUK_USE_FASTINT)
-#define DUK_TAG_FASTINT 1
-#endif
-#define DUK_TAG_UNDEFINED 2
-#define DUK_TAG_NULL 3
-#define DUK_TAG_BOOLEAN 4
-#define DUK_TAG_POINTER 5
-#define DUK_TAG_LIGHTFUNC 6
-#define DUK_TAG_UNUSED 7 /* marker; not actual tagged type */
-#define DUK_TAG_STRING 8 /* first heap allocated, match bit boundary */
-#define DUK_TAG_OBJECT 9
-#define DUK_TAG_BUFFER 10
-#define DUK_TAG_MAX 10
-
-#define DUK_TVAL_IS_VALID_TAG(tv) \
- (DUK_TVAL_GET_TAG((tv)) - DUK_TAG_MIN <= DUK_TAG_MAX - DUK_TAG_MIN)
+#define DUK_TAG_FASTINT 1
+#endif
+#define DUK_TAG_UNDEFINED 2
+#define DUK_TAG_NULL 3
+#define DUK_TAG_BOOLEAN 4
+#define DUK_TAG_POINTER 5
+#define DUK_TAG_LIGHTFUNC 6
+#define DUK_TAG_UNUSED 7 /* marker; not actual tagged type */
+#define DUK_TAG_STRING 8 /* first heap allocated, match bit boundary */
+#define DUK_TAG_OBJECT 9
+#define DUK_TAG_BUFFER 10
+#define DUK_TAG_MAX 10
+
+#define DUK_TVAL_IS_VALID_TAG(tv) (DUK_TVAL_GET_TAG((tv)) - DUK_TAG_MIN <= DUK_TAG_MAX - DUK_TAG_MIN)
/* DUK_TAG_NUMBER is intentionally first, as it is the default clause in code
* to support the 8-byte representation. Further, it is a non-heap-allocated
@@ -1206,25 +1278,29 @@ typedef struct {
*/
/* setters */
-#define DUK_TVAL_SET_UNDEFINED(tv) do { \
+#define DUK_TVAL_SET_UNDEFINED(tv) \
+ do { \
duk_tval *duk__tv; \
duk__tv = (tv); \
duk__tv->t = DUK_TAG_UNDEFINED; \
} while (0)
-#define DUK_TVAL_SET_UNUSED(tv) do { \
+#define DUK_TVAL_SET_UNUSED(tv) \
+ do { \
duk_tval *duk__tv; \
duk__tv = (tv); \
duk__tv->t = DUK_TAG_UNUSED; \
} while (0)
-#define DUK_TVAL_SET_NULL(tv) do { \
+#define DUK_TVAL_SET_NULL(tv) \
+ do { \
duk_tval *duk__tv; \
duk__tv = (tv); \
duk__tv->t = DUK_TAG_NULL; \
} while (0)
-#define DUK_TVAL_SET_BOOLEAN(tv,val) do { \
+#define DUK_TVAL_SET_BOOLEAN(tv, val) \
+ do { \
duk_tval *duk__tv; \
duk__tv = (tv); \
duk__tv->t = DUK_TAG_BOOLEAN; \
@@ -1232,7 +1308,8 @@ typedef struct {
} while (0)
#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_SET_DOUBLE(tv,val) do { \
+#define DUK_TVAL_SET_DOUBLE(tv, val) \
+ do { \
duk_tval *duk__tv; \
duk_double_t duk__dblval; \
duk__dblval = (val); \
@@ -1241,31 +1318,32 @@ typedef struct {
duk__tv->t = DUK_TAG_NUMBER; \
duk__tv->v.d = duk__dblval; \
} while (0)
-#define DUK_TVAL_SET_I48(tv,val) do { \
+#define DUK_TVAL_SET_I48(tv, val) \
+ do { \
duk_tval *duk__tv; \
duk__tv = (tv); \
duk__tv->t = DUK_TAG_FASTINT; \
duk__tv->v.fi = (val); \
} while (0)
-#define DUK_TVAL_SET_U32(tv,val) do { \
+#define DUK_TVAL_SET_U32(tv, val) \
+ do { \
duk_tval *duk__tv; \
duk__tv = (tv); \
duk__tv->t = DUK_TAG_FASTINT; \
duk__tv->v.fi = (duk_int64_t) (val); \
} while (0)
-#define DUK_TVAL_SET_I32(tv,val) do { \
+#define DUK_TVAL_SET_I32(tv, val) \
+ do { \
duk_tval *duk__tv; \
duk__tv = (tv); \
duk__tv->t = DUK_TAG_FASTINT; \
duk__tv->v.fi = (duk_int64_t) (val); \
} while (0)
-#define DUK_TVAL_SET_NUMBER_CHKFAST_FAST(tv,d) \
- duk_tval_set_number_chkfast_fast((tv), (d))
-#define DUK_TVAL_SET_NUMBER_CHKFAST_SLOW(tv,d) \
- duk_tval_set_number_chkfast_slow((tv), (d))
-#define DUK_TVAL_SET_NUMBER(tv,val) \
- DUK_TVAL_SET_DOUBLE((tv), (val))
-#define DUK_TVAL_CHKFAST_INPLACE_FAST(tv) do { \
+#define DUK_TVAL_SET_NUMBER_CHKFAST_FAST(tv, d) duk_tval_set_number_chkfast_fast((tv), (d))
+#define DUK_TVAL_SET_NUMBER_CHKFAST_SLOW(tv, d) duk_tval_set_number_chkfast_slow((tv), (d))
+#define DUK_TVAL_SET_NUMBER(tv, val) DUK_TVAL_SET_DOUBLE((tv), (val))
+#define DUK_TVAL_CHKFAST_INPLACE_FAST(tv) \
+ do { \
duk_tval *duk__tv; \
duk_double_t duk__d; \
duk__tv = (tv); \
@@ -1274,7 +1352,8 @@ typedef struct {
DUK_TVAL_SET_NUMBER_CHKFAST_FAST(duk__tv, duk__d); \
} \
} while (0)
-#define DUK_TVAL_CHKFAST_INPLACE_SLOW(tv) do { \
+#define DUK_TVAL_CHKFAST_INPLACE_SLOW(tv) \
+ do { \
duk_tval *duk__tv; \
duk_double_t duk__d; \
duk__tv = (tv); \
@@ -1283,16 +1362,13 @@ typedef struct {
DUK_TVAL_SET_NUMBER_CHKFAST_SLOW(duk__tv, duk__d); \
} \
} while (0)
-#else /* DUK_USE_FASTINT */
-#define DUK_TVAL_SET_DOUBLE(tv,d) \
- DUK_TVAL_SET_NUMBER((tv), (d))
-#define DUK_TVAL_SET_I48(tv,val) \
- DUK_TVAL_SET_NUMBER((tv), (duk_double_t) (val)) /* XXX: fast int-to-double */
-#define DUK_TVAL_SET_U32(tv,val) \
- DUK_TVAL_SET_NUMBER((tv), (duk_double_t) (val))
-#define DUK_TVAL_SET_I32(tv,val) \
- DUK_TVAL_SET_NUMBER((tv), (duk_double_t) (val))
-#define DUK_TVAL_SET_NUMBER(tv,val) do { \
+#else /* DUK_USE_FASTINT */
+#define DUK_TVAL_SET_DOUBLE(tv, d) DUK_TVAL_SET_NUMBER((tv), (d))
+#define DUK_TVAL_SET_I48(tv, val) DUK_TVAL_SET_NUMBER((tv), (duk_double_t) (val)) /* XXX: fast int-to-double */
+#define DUK_TVAL_SET_U32(tv, val) DUK_TVAL_SET_NUMBER((tv), (duk_double_t) (val))
+#define DUK_TVAL_SET_I32(tv, val) DUK_TVAL_SET_NUMBER((tv), (duk_double_t) (val))
+#define DUK_TVAL_SET_NUMBER(tv, val) \
+ do { \
duk_tval *duk__tv; \
duk_double_t duk__dblval; \
duk__dblval = (val); \
@@ -1301,25 +1377,28 @@ typedef struct {
duk__tv->t = DUK_TAG_NUMBER; \
duk__tv->v.d = duk__dblval; \
} while (0)
-#define DUK_TVAL_SET_NUMBER_CHKFAST_FAST(tv,d) \
- DUK_TVAL_SET_NUMBER((tv), (d))
-#define DUK_TVAL_SET_NUMBER_CHKFAST_SLOW(tv,d) \
- DUK_TVAL_SET_NUMBER((tv), (d))
-#define DUK_TVAL_CHKFAST_INPLACE_FAST(tv) do { } while (0)
-#define DUK_TVAL_CHKFAST_INPLACE_SLOW(tv) do { } while (0)
-#endif /* DUK_USE_FASTINT */
-
-#define DUK_TVAL_SET_FASTINT(tv,i) \
- DUK_TVAL_SET_I48((tv), (i)) /* alias */
-
-#define DUK_TVAL_SET_POINTER(tv,hptr) do { \
+#define DUK_TVAL_SET_NUMBER_CHKFAST_FAST(tv, d) DUK_TVAL_SET_NUMBER((tv), (d))
+#define DUK_TVAL_SET_NUMBER_CHKFAST_SLOW(tv, d) DUK_TVAL_SET_NUMBER((tv), (d))
+#define DUK_TVAL_CHKFAST_INPLACE_FAST(tv) \
+ do { \
+ } while (0)
+#define DUK_TVAL_CHKFAST_INPLACE_SLOW(tv) \
+ do { \
+ } while (0)
+#endif /* DUK_USE_FASTINT */
+
+#define DUK_TVAL_SET_FASTINT(tv, i) DUK_TVAL_SET_I48((tv), (i)) /* alias */
+
+#define DUK_TVAL_SET_POINTER(tv, hptr) \
+ do { \
duk_tval *duk__tv; \
duk__tv = (tv); \
duk__tv->t = DUK_TAG_POINTER; \
duk__tv->v.voidptr = (hptr); \
} while (0)
-#define DUK_TVAL_SET_LIGHTFUNC(tv,fp,flags) do { \
+#define DUK_TVAL_SET_LIGHTFUNC(tv, fp, flags) \
+ do { \
duk_tval *duk__tv; \
duk__tv = (tv); \
duk__tv->t = DUK_TAG_LIGHTFUNC; \
@@ -1327,28 +1406,32 @@ typedef struct {
duk__tv->v.lightfunc = (duk_c_function) (fp); \
} while (0)
-#define DUK_TVAL_SET_STRING(tv,hptr) do { \
+#define DUK_TVAL_SET_STRING(tv, hptr) \
+ do { \
duk_tval *duk__tv; \
duk__tv = (tv); \
duk__tv->t = DUK_TAG_STRING; \
duk__tv->v.hstring = (hptr); \
} while (0)
-#define DUK_TVAL_SET_OBJECT(tv,hptr) do { \
+#define DUK_TVAL_SET_OBJECT(tv, hptr) \
+ do { \
duk_tval *duk__tv; \
duk__tv = (tv); \
duk__tv->t = DUK_TAG_OBJECT; \
duk__tv->v.hobject = (hptr); \
} while (0)
-#define DUK_TVAL_SET_BUFFER(tv,hptr) do { \
+#define DUK_TVAL_SET_BUFFER(tv, hptr) \
+ do { \
duk_tval *duk__tv; \
duk__tv = (tv); \
duk__tv->t = DUK_TAG_BUFFER; \
duk__tv->v.hbuffer = (hptr); \
} while (0)
-#define DUK_TVAL_SET_NAN(tv) do { \
+#define DUK_TVAL_SET_NAN(tv) \
+ do { \
/* in non-packed representation we don't care about which NaN is used */ \
duk_tval *duk__tv; \
duk__tv = (tv); \
@@ -1356,32 +1439,32 @@ typedef struct {
duk__tv->v.d = DUK_DOUBLE_NAN; \
} while (0)
-#define DUK_TVAL_SET_TVAL(tv,x) do { *(tv) = *(x); } while (0)
+#define DUK_TVAL_SET_TVAL(tv, x) \
+ do { \
+ *(tv) = *(x); \
+ } while (0)
/* getters */
-#define DUK_TVAL_GET_BOOLEAN(tv) ((duk_small_uint_t) (tv)->v.i)
+#define DUK_TVAL_GET_BOOLEAN(tv) ((duk_small_uint_t) (tv)->v.i)
#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_GET_DOUBLE(tv) ((tv)->v.d)
-#define DUK_TVAL_GET_FASTINT(tv) ((tv)->v.fi)
-#define DUK_TVAL_GET_FASTINT_U32(tv) ((duk_uint32_t) ((tv)->v.fi))
-#define DUK_TVAL_GET_FASTINT_I32(tv) ((duk_int32_t) ((tv)->v.fi))
+#define DUK_TVAL_GET_DOUBLE(tv) ((tv)->v.d)
+#define DUK_TVAL_GET_FASTINT(tv) ((tv)->v.fi)
+#define DUK_TVAL_GET_FASTINT_U32(tv) ((duk_uint32_t) ((tv)->v.fi))
+#define DUK_TVAL_GET_FASTINT_I32(tv) ((duk_int32_t) ((tv)->v.fi))
#if 0
-#define DUK_TVAL_GET_NUMBER(tv) (DUK_TVAL_IS_FASTINT((tv)) ? \
- (duk_double_t) DUK_TVAL_GET_FASTINT((tv)) : \
- DUK_TVAL_GET_DOUBLE((tv)))
-#define DUK_TVAL_GET_NUMBER(tv) duk_tval_get_number_unpacked((tv))
+#define DUK_TVAL_GET_NUMBER(tv) (DUK_TVAL_IS_FASTINT((tv)) ? (duk_double_t) DUK_TVAL_GET_FASTINT((tv)) : DUK_TVAL_GET_DOUBLE((tv)))
+#define DUK_TVAL_GET_NUMBER(tv) duk_tval_get_number_unpacked((tv))
#else
/* This seems reasonable overall. */
-#define DUK_TVAL_GET_NUMBER(tv) (DUK_TVAL_IS_FASTINT((tv)) ? \
- duk_tval_get_number_unpacked_fastint((tv)) : \
- DUK_TVAL_GET_DOUBLE((tv)))
+#define DUK_TVAL_GET_NUMBER(tv) (DUK_TVAL_IS_FASTINT((tv)) ? duk_tval_get_number_unpacked_fastint((tv)) : DUK_TVAL_GET_DOUBLE((tv)))
#endif
#else
-#define DUK_TVAL_GET_NUMBER(tv) ((tv)->v.d)
-#define DUK_TVAL_GET_DOUBLE(tv) ((tv)->v.d)
-#endif /* DUK_USE_FASTINT */
-#define DUK_TVAL_GET_POINTER(tv) ((tv)->v.voidptr)
-#define DUK_TVAL_GET_LIGHTFUNC(tv,out_fp,out_flags) do { \
+#define DUK_TVAL_GET_NUMBER(tv) ((tv)->v.d)
+#define DUK_TVAL_GET_DOUBLE(tv) ((tv)->v.d)
+#endif /* DUK_USE_FASTINT */
+#define DUK_TVAL_GET_POINTER(tv) ((tv)->v.voidptr)
+#define DUK_TVAL_GET_LIGHTFUNC(tv, out_fp, out_flags) \
+ do { \
(out_flags) = (duk_uint32_t) (tv)->v_extra; \
(out_fp) = (tv)->v.lightfunc; \
} while (0)
@@ -1401,19 +1484,18 @@ typedef struct {
#define DUK_TVAL_IS_BOOLEAN_TRUE(tv) (((tv)->t == DUK_TAG_BOOLEAN) && ((tv)->v.i != 0))
#define DUK_TVAL_IS_BOOLEAN_FALSE(tv) (((tv)->t == DUK_TAG_BOOLEAN) && ((tv)->v.i == 0))
#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_IS_DOUBLE(tv) ((tv)->t == DUK_TAG_NUMBER)
-#define DUK_TVAL_IS_FASTINT(tv) ((tv)->t == DUK_TAG_FASTINT)
-#define DUK_TVAL_IS_NUMBER(tv) ((tv)->t == DUK_TAG_NUMBER || \
- (tv)->t == DUK_TAG_FASTINT)
+#define DUK_TVAL_IS_DOUBLE(tv) ((tv)->t == DUK_TAG_NUMBER)
+#define DUK_TVAL_IS_FASTINT(tv) ((tv)->t == DUK_TAG_FASTINT)
+#define DUK_TVAL_IS_NUMBER(tv) ((tv)->t == DUK_TAG_NUMBER || (tv)->t == DUK_TAG_FASTINT)
#else
-#define DUK_TVAL_IS_NUMBER(tv) ((tv)->t == DUK_TAG_NUMBER)
-#define DUK_TVAL_IS_DOUBLE(tv) DUK_TVAL_IS_NUMBER((tv))
-#endif /* DUK_USE_FASTINT */
-#define DUK_TVAL_IS_POINTER(tv) ((tv)->t == DUK_TAG_POINTER)
-#define DUK_TVAL_IS_LIGHTFUNC(tv) ((tv)->t == DUK_TAG_LIGHTFUNC)
-#define DUK_TVAL_IS_STRING(tv) ((tv)->t == DUK_TAG_STRING)
-#define DUK_TVAL_IS_OBJECT(tv) ((tv)->t == DUK_TAG_OBJECT)
-#define DUK_TVAL_IS_BUFFER(tv) ((tv)->t == DUK_TAG_BUFFER)
+#define DUK_TVAL_IS_NUMBER(tv) ((tv)->t == DUK_TAG_NUMBER)
+#define DUK_TVAL_IS_DOUBLE(tv) DUK_TVAL_IS_NUMBER((tv))
+#endif /* DUK_USE_FASTINT */
+#define DUK_TVAL_IS_POINTER(tv) ((tv)->t == DUK_TAG_POINTER)
+#define DUK_TVAL_IS_LIGHTFUNC(tv) ((tv)->t == DUK_TAG_LIGHTFUNC)
+#define DUK_TVAL_IS_STRING(tv) ((tv)->t == DUK_TAG_STRING)
+#define DUK_TVAL_IS_OBJECT(tv) ((tv)->t == DUK_TAG_OBJECT)
+#define DUK_TVAL_IS_BUFFER(tv) ((tv)->t == DUK_TAG_BUFFER)
/* This is performance critical because it's needed for every DECREF.
* Take advantage of the fact that the first heap allocated tag is 8,
@@ -1421,68 +1503,68 @@ typedef struct {
* non-heap-allocated tags).
*/
#if 0
-#define DUK_TVAL_IS_HEAP_ALLOCATED(tv) ((tv)->t >= DUK_TAG_STRING)
+#define DUK_TVAL_IS_HEAP_ALLOCATED(tv) ((tv)->t >= DUK_TAG_STRING)
#endif
-#define DUK_TVAL_IS_HEAP_ALLOCATED(tv) ((tv)->t & 0x08)
+#define DUK_TVAL_IS_HEAP_ALLOCATED(tv) ((tv)->t & 0x08)
#if defined(DUK_USE_FASTINT)
#if 0
DUK_INTERNAL_DECL duk_double_t duk_tval_get_number_unpacked(duk_tval *tv);
#endif
-DUK_INTERNAL_DECL DUK_INLINE duk_double_t duk_tval_get_number_unpacked_fastint(duk_tval *tv);
+DUK_INTERNAL_DECL duk_double_t duk_tval_get_number_unpacked_fastint(duk_tval *tv);
#endif
-#endif /* DUK_USE_PACKED_TVAL */
+#endif /* DUK_USE_PACKED_TVAL */
/*
* Convenience (independent of representation)
*/
-#define DUK_TVAL_SET_BOOLEAN_TRUE(tv) DUK_TVAL_SET_BOOLEAN((tv), 1)
-#define DUK_TVAL_SET_BOOLEAN_FALSE(tv) DUK_TVAL_SET_BOOLEAN((tv), 0)
+#define DUK_TVAL_SET_BOOLEAN_TRUE(tv) DUK_TVAL_SET_BOOLEAN((tv), 1)
+#define DUK_TVAL_SET_BOOLEAN_FALSE(tv) DUK_TVAL_SET_BOOLEAN((tv), 0)
-#define DUK_TVAL_STRING_IS_SYMBOL(tv) \
- DUK_HSTRING_HAS_SYMBOL(DUK_TVAL_GET_STRING((tv)))
+#define DUK_TVAL_STRING_IS_SYMBOL(tv) DUK_HSTRING_HAS_SYMBOL(DUK_TVAL_GET_STRING((tv)))
/* Lightfunc flags packing and unpacking. */
/* Sign extend: 0x0000##00 -> 0x##000000 -> sign extend to 0xssssss##.
* Avoid signed shifts due to portability limitations.
*/
-#define DUK_LFUNC_FLAGS_GET_MAGIC(lf_flags) \
- ((duk_int32_t) (duk_int8_t) (((duk_uint16_t) (lf_flags)) >> 8))
-#define DUK_LFUNC_FLAGS_GET_LENGTH(lf_flags) \
- (((lf_flags) >> 4) & 0x0fU)
-#define DUK_LFUNC_FLAGS_GET_NARGS(lf_flags) \
- ((lf_flags) & 0x0fU)
-#define DUK_LFUNC_FLAGS_PACK(magic,length,nargs) \
- ((((duk_small_uint_t) (magic)) & 0xffU) << 8) | ((length) << 4) | (nargs)
-
-#define DUK_LFUNC_NARGS_VARARGS 0x0f /* varargs marker */
-#define DUK_LFUNC_NARGS_MIN 0x00
-#define DUK_LFUNC_NARGS_MAX 0x0e /* max, excl. varargs marker */
-#define DUK_LFUNC_LENGTH_MIN 0x00
-#define DUK_LFUNC_LENGTH_MAX 0x0f
-#define DUK_LFUNC_MAGIC_MIN (-0x80)
-#define DUK_LFUNC_MAGIC_MAX 0x7f
+#define DUK_LFUNC_FLAGS_GET_MAGIC(lf_flags) ((duk_int32_t) (duk_int8_t) (((duk_uint16_t) (lf_flags)) >> 8))
+#define DUK_LFUNC_FLAGS_GET_LENGTH(lf_flags) (((lf_flags) >> 4) & 0x0fU)
+#define DUK_LFUNC_FLAGS_GET_NARGS(lf_flags) ((lf_flags) &0x0fU)
+#define DUK_LFUNC_FLAGS_PACK(magic, length, nargs) ((((duk_small_uint_t) (magic)) & 0xffU) << 8) | ((length) << 4) | (nargs)
+
+#define DUK_LFUNC_NARGS_VARARGS 0x0f /* varargs marker */
+#define DUK_LFUNC_NARGS_MIN 0x00
+#define DUK_LFUNC_NARGS_MAX 0x0e /* max, excl. varargs marker */
+#define DUK_LFUNC_LENGTH_MIN 0x00
+#define DUK_LFUNC_LENGTH_MAX 0x0f
+#define DUK_LFUNC_MAGIC_MIN (-0x80)
+#define DUK_LFUNC_MAGIC_MAX 0x7f
/* fastint constants etc */
#if defined(DUK_USE_FASTINT)
-#define DUK_FASTINT_MIN (DUK_I64_CONSTANT(-0x800000000000))
-#define DUK_FASTINT_MAX (DUK_I64_CONSTANT(0x7fffffffffff))
-#define DUK_FASTINT_BITS 48
+#define DUK_FASTINT_MIN (DUK_I64_CONSTANT(-0x800000000000))
+#define DUK_FASTINT_MAX (DUK_I64_CONSTANT(0x7fffffffffff))
+#define DUK_FASTINT_BITS 48
-DUK_INTERNAL_DECL DUK_INLINE void duk_tval_set_number_chkfast_fast(duk_tval *tv, duk_double_t x);
+DUK_INTERNAL_DECL void duk_tval_set_number_chkfast_fast(duk_tval *tv, duk_double_t x);
DUK_INTERNAL_DECL void duk_tval_set_number_chkfast_slow(duk_tval *tv, duk_double_t x);
#endif
#if defined(DUK_USE_ASSERTIONS)
DUK_INTERNAL_DECL void duk_tval_assert_valid(duk_tval *tv);
-#define DUK_TVAL_ASSERT_VALID(tv) do { duk_tval_assert_valid((tv)); } while (0)
+#define DUK_TVAL_ASSERT_VALID(tv) \
+ do { \
+ duk_tval_assert_valid((tv)); \
+ } while (0)
#else
-#define DUK_TVAL_ASSERT_VALID(tv) do {} while (0)
+#define DUK_TVAL_ASSERT_VALID(tv) \
+ do { \
+ } while (0)
#endif
-#endif /* DUK_TVAL_H_INCLUDED */
+#endif /* DUK_TVAL_H_INCLUDED */
/* #include duk_builtins.h */
/*
* Automatically generated by genbuiltins.py, do not edit!
@@ -1512,9 +1594,9 @@ DUK_INTERNAL_DECL void duk_tval_assert_valid(duk_tval *tv);
#define DUK_STRIDX_UC_FUNCTION 5 /* 'Function' */
#define DUK_HEAP_STRING_UC_FUNCTION(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_FUNCTION)
#define DUK_HTHREAD_STRING_UC_FUNCTION(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_FUNCTION)
-#define DUK_STRIDX_ARRAY 6 /* 'Array' */
-#define DUK_HEAP_STRING_ARRAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ARRAY)
-#define DUK_HTHREAD_STRING_ARRAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ARRAY)
+#define DUK_STRIDX_UC_ARRAY 6 /* 'Array' */
+#define DUK_HEAP_STRING_UC_ARRAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_ARRAY)
+#define DUK_HTHREAD_STRING_UC_ARRAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_ARRAY)
#define DUK_STRIDX_UC_STRING 7 /* 'String' */
#define DUK_HEAP_STRING_UC_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_STRING)
#define DUK_HTHREAD_STRING_UC_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_STRING)
@@ -1524,9 +1606,9 @@ DUK_INTERNAL_DECL void duk_tval_assert_valid(duk_tval *tv);
#define DUK_STRIDX_UC_NUMBER 9 /* 'Number' */
#define DUK_HEAP_STRING_UC_NUMBER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_NUMBER)
#define DUK_HTHREAD_STRING_UC_NUMBER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_NUMBER)
-#define DUK_STRIDX_DATE 10 /* 'Date' */
-#define DUK_HEAP_STRING_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DATE)
-#define DUK_HTHREAD_STRING_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DATE)
+#define DUK_STRIDX_UC_DATE 10 /* 'Date' */
+#define DUK_HEAP_STRING_UC_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_DATE)
+#define DUK_HTHREAD_STRING_UC_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_DATE)
#define DUK_STRIDX_REG_EXP 11 /* 'RegExp' */
#define DUK_HEAP_STRING_REG_EXP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REG_EXP)
#define DUK_HTHREAD_STRING_REG_EXP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REG_EXP)
@@ -1752,260 +1834,263 @@ DUK_INTERNAL_DECL void duk_tval_assert_valid(duk_tval *tv);
#define DUK_STRIDX_DATA 85 /* 'data' */
#define DUK_HEAP_STRING_DATA(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DATA)
#define DUK_HTHREAD_STRING_DATA(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DATA)
-#define DUK_STRIDX_LENGTH 86 /* 'length' */
+#define DUK_STRIDX_LC_BUFFER 86 /* 'buffer' */
+#define DUK_HEAP_STRING_LC_BUFFER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_BUFFER)
+#define DUK_HTHREAD_STRING_LC_BUFFER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_BUFFER)
+#define DUK_STRIDX_LENGTH 87 /* 'length' */
#define DUK_HEAP_STRING_LENGTH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LENGTH)
#define DUK_HTHREAD_STRING_LENGTH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LENGTH)
-#define DUK_STRIDX_SET 87 /* 'set' */
+#define DUK_STRIDX_SET 88 /* 'set' */
#define DUK_HEAP_STRING_SET(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET)
#define DUK_HTHREAD_STRING_SET(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET)
-#define DUK_STRIDX_STACK 88 /* 'stack' */
+#define DUK_STRIDX_STACK 89 /* 'stack' */
#define DUK_HEAP_STRING_STACK(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_STACK)
#define DUK_HTHREAD_STRING_STACK(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_STACK)
-#define DUK_STRIDX_PC 89 /* 'pc' */
+#define DUK_STRIDX_PC 90 /* 'pc' */
#define DUK_HEAP_STRING_PC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PC)
#define DUK_HTHREAD_STRING_PC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PC)
-#define DUK_STRIDX_LINE_NUMBER 90 /* 'lineNumber' */
+#define DUK_STRIDX_LINE_NUMBER 91 /* 'lineNumber' */
#define DUK_HEAP_STRING_LINE_NUMBER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LINE_NUMBER)
#define DUK_HTHREAD_STRING_LINE_NUMBER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LINE_NUMBER)
-#define DUK_STRIDX_INT_TRACEDATA 91 /* '\x82Tracedata' */
+#define DUK_STRIDX_INT_TRACEDATA 92 /* '\x82Tracedata' */
#define DUK_HEAP_STRING_INT_TRACEDATA(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_TRACEDATA)
#define DUK_HTHREAD_STRING_INT_TRACEDATA(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_TRACEDATA)
-#define DUK_STRIDX_NAME 92 /* 'name' */
+#define DUK_STRIDX_NAME 93 /* 'name' */
#define DUK_HEAP_STRING_NAME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NAME)
#define DUK_HTHREAD_STRING_NAME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NAME)
-#define DUK_STRIDX_FILE_NAME 93 /* 'fileName' */
+#define DUK_STRIDX_FILE_NAME 94 /* 'fileName' */
#define DUK_HEAP_STRING_FILE_NAME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FILE_NAME)
#define DUK_HTHREAD_STRING_FILE_NAME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FILE_NAME)
-#define DUK_STRIDX_LC_POINTER 94 /* 'pointer' */
+#define DUK_STRIDX_LC_POINTER 95 /* 'pointer' */
#define DUK_HEAP_STRING_LC_POINTER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_POINTER)
#define DUK_HTHREAD_STRING_LC_POINTER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_POINTER)
-#define DUK_STRIDX_INT_TARGET 95 /* '\x82Target' */
+#define DUK_STRIDX_INT_TARGET 96 /* '\x82Target' */
#define DUK_HEAP_STRING_INT_TARGET(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_TARGET)
#define DUK_HTHREAD_STRING_INT_TARGET(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_TARGET)
-#define DUK_STRIDX_INT_NEXT 96 /* '\x82Next' */
+#define DUK_STRIDX_INT_NEXT 97 /* '\x82Next' */
#define DUK_HEAP_STRING_INT_NEXT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_NEXT)
#define DUK_HTHREAD_STRING_INT_NEXT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_NEXT)
-#define DUK_STRIDX_INT_BYTECODE 97 /* '\x82Bytecode' */
+#define DUK_STRIDX_INT_BYTECODE 98 /* '\x82Bytecode' */
#define DUK_HEAP_STRING_INT_BYTECODE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_BYTECODE)
#define DUK_HTHREAD_STRING_INT_BYTECODE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_BYTECODE)
-#define DUK_STRIDX_INT_FORMALS 98 /* '\x82Formals' */
+#define DUK_STRIDX_INT_FORMALS 99 /* '\x82Formals' */
#define DUK_HEAP_STRING_INT_FORMALS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_FORMALS)
#define DUK_HTHREAD_STRING_INT_FORMALS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_FORMALS)
-#define DUK_STRIDX_INT_VARMAP 99 /* '\x82Varmap' */
+#define DUK_STRIDX_INT_VARMAP 100 /* '\x82Varmap' */
#define DUK_HEAP_STRING_INT_VARMAP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_VARMAP)
#define DUK_HTHREAD_STRING_INT_VARMAP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_VARMAP)
-#define DUK_STRIDX_INT_SOURCE 100 /* '\x82Source' */
+#define DUK_STRIDX_INT_SOURCE 101 /* '\x82Source' */
#define DUK_HEAP_STRING_INT_SOURCE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_SOURCE)
#define DUK_HTHREAD_STRING_INT_SOURCE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_SOURCE)
-#define DUK_STRIDX_INT_PC2LINE 101 /* '\x82Pc2line' */
+#define DUK_STRIDX_INT_PC2LINE 102 /* '\x82Pc2line' */
#define DUK_HEAP_STRING_INT_PC2LINE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_PC2LINE)
#define DUK_HTHREAD_STRING_INT_PC2LINE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_PC2LINE)
-#define DUK_STRIDX_INT_MAP 102 /* '\x82Map' */
+#define DUK_STRIDX_INT_MAP 103 /* '\x82Map' */
#define DUK_HEAP_STRING_INT_MAP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_MAP)
#define DUK_HTHREAD_STRING_INT_MAP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_MAP)
-#define DUK_STRIDX_INT_VARENV 103 /* '\x82Varenv' */
+#define DUK_STRIDX_INT_VARENV 104 /* '\x82Varenv' */
#define DUK_HEAP_STRING_INT_VARENV(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_VARENV)
#define DUK_HTHREAD_STRING_INT_VARENV(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_VARENV)
-#define DUK_STRIDX_INT_FINALIZER 104 /* '\x82Finalizer' */
+#define DUK_STRIDX_INT_FINALIZER 105 /* '\x82Finalizer' */
#define DUK_HEAP_STRING_INT_FINALIZER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_FINALIZER)
#define DUK_HTHREAD_STRING_INT_FINALIZER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_FINALIZER)
-#define DUK_STRIDX_INT_VALUE 105 /* '\x82Value' */
+#define DUK_STRIDX_INT_VALUE 106 /* '\x82Value' */
#define DUK_HEAP_STRING_INT_VALUE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_VALUE)
#define DUK_HTHREAD_STRING_INT_VALUE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_VALUE)
-#define DUK_STRIDX_COMPILE 106 /* 'compile' */
+#define DUK_STRIDX_COMPILE 107 /* 'compile' */
#define DUK_HEAP_STRING_COMPILE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_COMPILE)
#define DUK_HTHREAD_STRING_COMPILE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_COMPILE)
-#define DUK_STRIDX_INPUT 107 /* 'input' */
+#define DUK_STRIDX_INPUT 108 /* 'input' */
#define DUK_HEAP_STRING_INPUT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INPUT)
#define DUK_HTHREAD_STRING_INPUT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INPUT)
-#define DUK_STRIDX_ERR_CREATE 108 /* 'errCreate' */
+#define DUK_STRIDX_ERR_CREATE 109 /* 'errCreate' */
#define DUK_HEAP_STRING_ERR_CREATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ERR_CREATE)
#define DUK_HTHREAD_STRING_ERR_CREATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ERR_CREATE)
-#define DUK_STRIDX_ERR_THROW 109 /* 'errThrow' */
+#define DUK_STRIDX_ERR_THROW 110 /* 'errThrow' */
#define DUK_HEAP_STRING_ERR_THROW(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ERR_THROW)
#define DUK_HTHREAD_STRING_ERR_THROW(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ERR_THROW)
-#define DUK_STRIDX_ENV 110 /* 'env' */
+#define DUK_STRIDX_ENV 111 /* 'env' */
#define DUK_HEAP_STRING_ENV(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENV)
#define DUK_HTHREAD_STRING_ENV(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENV)
-#define DUK_STRIDX_HEX 111 /* 'hex' */
+#define DUK_STRIDX_HEX 112 /* 'hex' */
#define DUK_HEAP_STRING_HEX(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_HEX)
#define DUK_HTHREAD_STRING_HEX(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_HEX)
-#define DUK_STRIDX_BASE64 112 /* 'base64' */
+#define DUK_STRIDX_BASE64 113 /* 'base64' */
#define DUK_HEAP_STRING_BASE64(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_BASE64)
#define DUK_HTHREAD_STRING_BASE64(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_BASE64)
-#define DUK_STRIDX_JX 113 /* 'jx' */
+#define DUK_STRIDX_JX 114 /* 'jx' */
#define DUK_HEAP_STRING_JX(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JX)
#define DUK_HTHREAD_STRING_JX(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JX)
-#define DUK_STRIDX_JC 114 /* 'jc' */
+#define DUK_STRIDX_JC 115 /* 'jc' */
#define DUK_HEAP_STRING_JC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JC)
#define DUK_HTHREAD_STRING_JC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JC)
-#define DUK_STRIDX_JSON_EXT_UNDEFINED 115 /* '{"_undef":true}' */
+#define DUK_STRIDX_JSON_EXT_UNDEFINED 116 /* '{"_undef":true}' */
#define DUK_HEAP_STRING_JSON_EXT_UNDEFINED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JSON_EXT_UNDEFINED)
#define DUK_HTHREAD_STRING_JSON_EXT_UNDEFINED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JSON_EXT_UNDEFINED)
-#define DUK_STRIDX_JSON_EXT_NAN 116 /* '{"_nan":true}' */
+#define DUK_STRIDX_JSON_EXT_NAN 117 /* '{"_nan":true}' */
#define DUK_HEAP_STRING_JSON_EXT_NAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JSON_EXT_NAN)
#define DUK_HTHREAD_STRING_JSON_EXT_NAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JSON_EXT_NAN)
-#define DUK_STRIDX_JSON_EXT_POSINF 117 /* '{"_inf":true}' */
+#define DUK_STRIDX_JSON_EXT_POSINF 118 /* '{"_inf":true}' */
#define DUK_HEAP_STRING_JSON_EXT_POSINF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JSON_EXT_POSINF)
#define DUK_HTHREAD_STRING_JSON_EXT_POSINF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JSON_EXT_POSINF)
-#define DUK_STRIDX_JSON_EXT_NEGINF 118 /* '{"_ninf":true}' */
+#define DUK_STRIDX_JSON_EXT_NEGINF 119 /* '{"_ninf":true}' */
#define DUK_HEAP_STRING_JSON_EXT_NEGINF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JSON_EXT_NEGINF)
#define DUK_HTHREAD_STRING_JSON_EXT_NEGINF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JSON_EXT_NEGINF)
-#define DUK_STRIDX_JSON_EXT_FUNCTION1 119 /* '{"_func":true}' */
+#define DUK_STRIDX_JSON_EXT_FUNCTION1 120 /* '{"_func":true}' */
#define DUK_HEAP_STRING_JSON_EXT_FUNCTION1(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JSON_EXT_FUNCTION1)
#define DUK_HTHREAD_STRING_JSON_EXT_FUNCTION1(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JSON_EXT_FUNCTION1)
-#define DUK_STRIDX_JSON_EXT_FUNCTION2 120 /* '{_func:true}' */
+#define DUK_STRIDX_JSON_EXT_FUNCTION2 121 /* '{_func:true}' */
#define DUK_HEAP_STRING_JSON_EXT_FUNCTION2(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JSON_EXT_FUNCTION2)
#define DUK_HTHREAD_STRING_JSON_EXT_FUNCTION2(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JSON_EXT_FUNCTION2)
-#define DUK_STRIDX_BREAK 121 /* 'break' */
+#define DUK_STRIDX_BREAK 122 /* 'break' */
#define DUK_HEAP_STRING_BREAK(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_BREAK)
#define DUK_HTHREAD_STRING_BREAK(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_BREAK)
-#define DUK_STRIDX_CASE 122 /* 'case' */
+#define DUK_STRIDX_CASE 123 /* 'case' */
#define DUK_HEAP_STRING_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CASE)
#define DUK_HTHREAD_STRING_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CASE)
-#define DUK_STRIDX_CATCH 123 /* 'catch' */
+#define DUK_STRIDX_CATCH 124 /* 'catch' */
#define DUK_HEAP_STRING_CATCH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CATCH)
#define DUK_HTHREAD_STRING_CATCH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CATCH)
-#define DUK_STRIDX_CONTINUE 124 /* 'continue' */
+#define DUK_STRIDX_CONTINUE 125 /* 'continue' */
#define DUK_HEAP_STRING_CONTINUE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CONTINUE)
#define DUK_HTHREAD_STRING_CONTINUE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CONTINUE)
-#define DUK_STRIDX_DEBUGGER 125 /* 'debugger' */
+#define DUK_STRIDX_DEBUGGER 126 /* 'debugger' */
#define DUK_HEAP_STRING_DEBUGGER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEBUGGER)
#define DUK_HTHREAD_STRING_DEBUGGER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEBUGGER)
-#define DUK_STRIDX_DEFAULT 126 /* 'default' */
+#define DUK_STRIDX_DEFAULT 127 /* 'default' */
#define DUK_HEAP_STRING_DEFAULT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEFAULT)
#define DUK_HTHREAD_STRING_DEFAULT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEFAULT)
-#define DUK_STRIDX_DELETE 127 /* 'delete' */
+#define DUK_STRIDX_DELETE 128 /* 'delete' */
#define DUK_HEAP_STRING_DELETE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DELETE)
#define DUK_HTHREAD_STRING_DELETE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DELETE)
-#define DUK_STRIDX_DO 128 /* 'do' */
+#define DUK_STRIDX_DO 129 /* 'do' */
#define DUK_HEAP_STRING_DO(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DO)
#define DUK_HTHREAD_STRING_DO(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DO)
-#define DUK_STRIDX_ELSE 129 /* 'else' */
+#define DUK_STRIDX_ELSE 130 /* 'else' */
#define DUK_HEAP_STRING_ELSE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ELSE)
#define DUK_HTHREAD_STRING_ELSE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ELSE)
-#define DUK_STRIDX_FINALLY 130 /* 'finally' */
+#define DUK_STRIDX_FINALLY 131 /* 'finally' */
#define DUK_HEAP_STRING_FINALLY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FINALLY)
#define DUK_HTHREAD_STRING_FINALLY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FINALLY)
-#define DUK_STRIDX_FOR 131 /* 'for' */
+#define DUK_STRIDX_FOR 132 /* 'for' */
#define DUK_HEAP_STRING_FOR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FOR)
#define DUK_HTHREAD_STRING_FOR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FOR)
-#define DUK_STRIDX_LC_FUNCTION 132 /* 'function' */
+#define DUK_STRIDX_LC_FUNCTION 133 /* 'function' */
#define DUK_HEAP_STRING_LC_FUNCTION(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_FUNCTION)
#define DUK_HTHREAD_STRING_LC_FUNCTION(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_FUNCTION)
-#define DUK_STRIDX_IF 133 /* 'if' */
+#define DUK_STRIDX_IF 134 /* 'if' */
#define DUK_HEAP_STRING_IF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IF)
#define DUK_HTHREAD_STRING_IF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IF)
-#define DUK_STRIDX_IN 134 /* 'in' */
+#define DUK_STRIDX_IN 135 /* 'in' */
#define DUK_HEAP_STRING_IN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IN)
#define DUK_HTHREAD_STRING_IN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IN)
-#define DUK_STRIDX_INSTANCEOF 135 /* 'instanceof' */
+#define DUK_STRIDX_INSTANCEOF 136 /* 'instanceof' */
#define DUK_HEAP_STRING_INSTANCEOF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INSTANCEOF)
#define DUK_HTHREAD_STRING_INSTANCEOF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INSTANCEOF)
-#define DUK_STRIDX_NEW 136 /* 'new' */
+#define DUK_STRIDX_NEW 137 /* 'new' */
#define DUK_HEAP_STRING_NEW(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NEW)
#define DUK_HTHREAD_STRING_NEW(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NEW)
-#define DUK_STRIDX_RETURN 137 /* 'return' */
+#define DUK_STRIDX_RETURN 138 /* 'return' */
#define DUK_HEAP_STRING_RETURN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_RETURN)
#define DUK_HTHREAD_STRING_RETURN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_RETURN)
-#define DUK_STRIDX_SWITCH 138 /* 'switch' */
+#define DUK_STRIDX_SWITCH 139 /* 'switch' */
#define DUK_HEAP_STRING_SWITCH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SWITCH)
#define DUK_HTHREAD_STRING_SWITCH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SWITCH)
-#define DUK_STRIDX_THIS 139 /* 'this' */
+#define DUK_STRIDX_THIS 140 /* 'this' */
#define DUK_HEAP_STRING_THIS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_THIS)
#define DUK_HTHREAD_STRING_THIS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_THIS)
-#define DUK_STRIDX_THROW 140 /* 'throw' */
+#define DUK_STRIDX_THROW 141 /* 'throw' */
#define DUK_HEAP_STRING_THROW(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_THROW)
#define DUK_HTHREAD_STRING_THROW(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_THROW)
-#define DUK_STRIDX_TRY 141 /* 'try' */
+#define DUK_STRIDX_TRY 142 /* 'try' */
#define DUK_HEAP_STRING_TRY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TRY)
#define DUK_HTHREAD_STRING_TRY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TRY)
-#define DUK_STRIDX_TYPEOF 142 /* 'typeof' */
+#define DUK_STRIDX_TYPEOF 143 /* 'typeof' */
#define DUK_HEAP_STRING_TYPEOF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TYPEOF)
#define DUK_HTHREAD_STRING_TYPEOF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TYPEOF)
-#define DUK_STRIDX_VAR 143 /* 'var' */
+#define DUK_STRIDX_VAR 144 /* 'var' */
#define DUK_HEAP_STRING_VAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_VAR)
#define DUK_HTHREAD_STRING_VAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_VAR)
-#define DUK_STRIDX_CONST 144 /* 'const' */
+#define DUK_STRIDX_CONST 145 /* 'const' */
#define DUK_HEAP_STRING_CONST(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CONST)
#define DUK_HTHREAD_STRING_CONST(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CONST)
-#define DUK_STRIDX_VOID 145 /* 'void' */
+#define DUK_STRIDX_VOID 146 /* 'void' */
#define DUK_HEAP_STRING_VOID(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_VOID)
#define DUK_HTHREAD_STRING_VOID(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_VOID)
-#define DUK_STRIDX_WHILE 146 /* 'while' */
+#define DUK_STRIDX_WHILE 147 /* 'while' */
#define DUK_HEAP_STRING_WHILE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_WHILE)
#define DUK_HTHREAD_STRING_WHILE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_WHILE)
-#define DUK_STRIDX_WITH 147 /* 'with' */
+#define DUK_STRIDX_WITH 148 /* 'with' */
#define DUK_HEAP_STRING_WITH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_WITH)
#define DUK_HTHREAD_STRING_WITH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_WITH)
-#define DUK_STRIDX_CLASS 148 /* 'class' */
+#define DUK_STRIDX_CLASS 149 /* 'class' */
#define DUK_HEAP_STRING_CLASS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CLASS)
#define DUK_HTHREAD_STRING_CLASS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CLASS)
-#define DUK_STRIDX_ENUM 149 /* 'enum' */
+#define DUK_STRIDX_ENUM 150 /* 'enum' */
#define DUK_HEAP_STRING_ENUM(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENUM)
#define DUK_HTHREAD_STRING_ENUM(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENUM)
-#define DUK_STRIDX_EXPORT 150 /* 'export' */
+#define DUK_STRIDX_EXPORT 151 /* 'export' */
#define DUK_HEAP_STRING_EXPORT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EXPORT)
#define DUK_HTHREAD_STRING_EXPORT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EXPORT)
-#define DUK_STRIDX_EXTENDS 151 /* 'extends' */
+#define DUK_STRIDX_EXTENDS 152 /* 'extends' */
#define DUK_HEAP_STRING_EXTENDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EXTENDS)
#define DUK_HTHREAD_STRING_EXTENDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EXTENDS)
-#define DUK_STRIDX_IMPORT 152 /* 'import' */
+#define DUK_STRIDX_IMPORT 153 /* 'import' */
#define DUK_HEAP_STRING_IMPORT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IMPORT)
#define DUK_HTHREAD_STRING_IMPORT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IMPORT)
-#define DUK_STRIDX_SUPER 153 /* 'super' */
+#define DUK_STRIDX_SUPER 154 /* 'super' */
#define DUK_HEAP_STRING_SUPER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SUPER)
#define DUK_HTHREAD_STRING_SUPER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SUPER)
-#define DUK_STRIDX_LC_NULL 154 /* 'null' */
+#define DUK_STRIDX_LC_NULL 155 /* 'null' */
#define DUK_HEAP_STRING_LC_NULL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_NULL)
#define DUK_HTHREAD_STRING_LC_NULL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_NULL)
-#define DUK_STRIDX_TRUE 155 /* 'true' */
+#define DUK_STRIDX_TRUE 156 /* 'true' */
#define DUK_HEAP_STRING_TRUE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TRUE)
#define DUK_HTHREAD_STRING_TRUE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TRUE)
-#define DUK_STRIDX_FALSE 156 /* 'false' */
+#define DUK_STRIDX_FALSE 157 /* 'false' */
#define DUK_HEAP_STRING_FALSE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FALSE)
#define DUK_HTHREAD_STRING_FALSE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FALSE)
-#define DUK_STRIDX_IMPLEMENTS 157 /* 'implements' */
+#define DUK_STRIDX_IMPLEMENTS 158 /* 'implements' */
#define DUK_HEAP_STRING_IMPLEMENTS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IMPLEMENTS)
#define DUK_HTHREAD_STRING_IMPLEMENTS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IMPLEMENTS)
-#define DUK_STRIDX_INTERFACE 158 /* 'interface' */
+#define DUK_STRIDX_INTERFACE 159 /* 'interface' */
#define DUK_HEAP_STRING_INTERFACE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INTERFACE)
#define DUK_HTHREAD_STRING_INTERFACE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INTERFACE)
-#define DUK_STRIDX_LET 159 /* 'let' */
+#define DUK_STRIDX_LET 160 /* 'let' */
#define DUK_HEAP_STRING_LET(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LET)
#define DUK_HTHREAD_STRING_LET(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LET)
-#define DUK_STRIDX_PACKAGE 160 /* 'package' */
+#define DUK_STRIDX_PACKAGE 161 /* 'package' */
#define DUK_HEAP_STRING_PACKAGE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PACKAGE)
#define DUK_HTHREAD_STRING_PACKAGE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PACKAGE)
-#define DUK_STRIDX_PRIVATE 161 /* 'private' */
+#define DUK_STRIDX_PRIVATE 162 /* 'private' */
#define DUK_HEAP_STRING_PRIVATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PRIVATE)
#define DUK_HTHREAD_STRING_PRIVATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PRIVATE)
-#define DUK_STRIDX_PROTECTED 162 /* 'protected' */
+#define DUK_STRIDX_PROTECTED 163 /* 'protected' */
#define DUK_HEAP_STRING_PROTECTED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PROTECTED)
#define DUK_HTHREAD_STRING_PROTECTED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PROTECTED)
-#define DUK_STRIDX_PUBLIC 163 /* 'public' */
+#define DUK_STRIDX_PUBLIC 164 /* 'public' */
#define DUK_HEAP_STRING_PUBLIC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PUBLIC)
#define DUK_HTHREAD_STRING_PUBLIC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PUBLIC)
-#define DUK_STRIDX_STATIC 164 /* 'static' */
+#define DUK_STRIDX_STATIC 165 /* 'static' */
#define DUK_HEAP_STRING_STATIC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_STATIC)
#define DUK_HTHREAD_STRING_STATIC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_STATIC)
-#define DUK_STRIDX_YIELD 165 /* 'yield' */
+#define DUK_STRIDX_YIELD 166 /* 'yield' */
#define DUK_HEAP_STRING_YIELD(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_YIELD)
#define DUK_HTHREAD_STRING_YIELD(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_YIELD)
-#define DUK_HEAP_NUM_STRINGS 166
-#define DUK_STRIDX_START_RESERVED 121
-#define DUK_STRIDX_START_STRICT_RESERVED 157
-#define DUK_STRIDX_END_RESERVED 166 /* exclusive endpoint */
+#define DUK_HEAP_NUM_STRINGS 167
+#define DUK_STRIDX_START_RESERVED 122
+#define DUK_STRIDX_START_STRICT_RESERVED 158
+#define DUK_STRIDX_END_RESERVED 167 /* exclusive endpoint */
/* To convert a heap stridx to a token number, subtract
* DUK_STRIDX_START_RESERVED and add DUK_TOK_START_RESERVED.
*/
#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const duk_uint8_t duk_strings_data[967];
+DUK_INTERNAL_DECL const duk_uint8_t duk_strings_data[972];
#endif /* !DUK_SINGLE_FILE */
#define DUK_STRDATA_MAX_STRLEN 27
-#define DUK_STRDATA_DATA_LENGTH 967
+#define DUK_STRDATA_DATA_LENGTH 972
#endif /* DUK_USE_ROM_STRINGS */
#if defined(DUK_USE_ROM_OBJECTS)
@@ -2188,13 +2273,15 @@ DUK_INTERNAL_DECL duk_ret_t duk_bi_nodejs_buffer_tojson(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_nodejs_buffer_fill(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_nodejs_buffer_copy(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_nodejs_buffer_write(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_cbor_encode(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_cbor_decode(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_textencoder_prototype_encoding_getter(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_textencoder_prototype_encode(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_textdecoder_prototype_shared_getter(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_textdecoder_prototype_decode(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_performance_now(duk_context *ctx);
#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const duk_c_function duk_bi_native_functions[183];
+DUK_INTERNAL_DECL const duk_c_function duk_bi_native_functions[185];
#endif /* !DUK_SINGLE_FILE */
#define DUK_BIDX_GLOBAL 0
#define DUK_BIDX_GLOBAL_ENV 1
@@ -2249,22 +2336,22 @@ DUK_INTERNAL_DECL const duk_c_function duk_bi_native_functions[183];
#define DUK_BIDX_NODEJS_BUFFER_PROTOTYPE 50
#define DUK_NUM_BUILTINS 51
#define DUK_NUM_BIDX_BUILTINS 51
-#define DUK_NUM_ALL_BUILTINS 79
+#define DUK_NUM_ALL_BUILTINS 80
#if defined(DUK_USE_DOUBLE_LE)
#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const duk_uint8_t duk_builtins_data[4251];
+DUK_INTERNAL_DECL const duk_uint8_t duk_builtins_data[4281];
#endif /* !DUK_SINGLE_FILE */
-#define DUK_BUILTINS_DATA_LENGTH 4251
+#define DUK_BUILTINS_DATA_LENGTH 4281
#elif defined(DUK_USE_DOUBLE_BE)
#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const duk_uint8_t duk_builtins_data[4251];
+DUK_INTERNAL_DECL const duk_uint8_t duk_builtins_data[4281];
#endif /* !DUK_SINGLE_FILE */
-#define DUK_BUILTINS_DATA_LENGTH 4251
+#define DUK_BUILTINS_DATA_LENGTH 4281
#elif defined(DUK_USE_DOUBLE_ME)
#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const duk_uint8_t duk_builtins_data[4251];
+DUK_INTERNAL_DECL const duk_uint8_t duk_builtins_data[4281];
#endif /* !DUK_SINGLE_FILE */
-#define DUK_BUILTINS_DATA_LENGTH 4251
+#define DUK_BUILTINS_DATA_LENGTH 4281
#else
#error invalid endianness defines
#endif
@@ -2279,20 +2366,14 @@ DUK_INTERNAL_DECL const duk_uint8_t duk_builtins_data[4251];
#if !defined(DUK_UTIL_H_INCLUDED)
#define DUK_UTIL_H_INCLUDED
-#if defined(DUK_USE_GET_RANDOM_DOUBLE)
-#define DUK_UTIL_GET_RANDOM_DOUBLE(thr) DUK_USE_GET_RANDOM_DOUBLE((thr)->heap_udata)
-#else
-#define DUK_UTIL_GET_RANDOM_DOUBLE(thr) duk_util_tinyrandom_get_double(thr)
-#endif
-
/*
* Some useful constants
*/
-#define DUK_DOUBLE_2TO32 4294967296.0
-#define DUK_DOUBLE_2TO31 2147483648.0
-#define DUK_DOUBLE_LOG2E 1.4426950408889634
-#define DUK_DOUBLE_LOG10E 0.4342944819032518
+#define DUK_DOUBLE_2TO32 4294967296.0
+#define DUK_DOUBLE_2TO31 2147483648.0
+#define DUK_DOUBLE_LOG2E 1.4426950408889634
+#define DUK_DOUBLE_LOG10E 0.4342944819032518
/*
* Endian conversion
@@ -2341,40 +2422,51 @@ struct duk_bitencoder_ctx {
/*
* Raw write/read macros for big endian, unaligned basic values.
- * Caller ensures there's enough space. The macros update the pointer
- * argument automatically on resizes. The idiom seems a bit odd, but
- * leads to compact code.
+ * Caller ensures there's enough space. The INC macro variants
+ * update the pointer argument automatically.
*/
-#define DUK_RAW_WRITE_U8(ptr,val) do { \
- *(ptr)++ = (duk_uint8_t) (val); \
- } while (0)
-#define DUK_RAW_WRITE_U16_BE(ptr,val) duk_raw_write_u16_be(&(ptr), (duk_uint16_t) (val))
-#define DUK_RAW_WRITE_U32_BE(ptr,val) duk_raw_write_u32_be(&(ptr), (duk_uint32_t) (val))
-#define DUK_RAW_WRITE_DOUBLE_BE(ptr,val) duk_raw_write_double_be(&(ptr), (duk_double_t) (val))
-#define DUK_RAW_WRITE_XUTF8(ptr,val) do { \
- /* 'ptr' is evaluated both as LHS and RHS. */ \
- duk_uint8_t *duk__ptr; \
- duk_small_int_t duk__len; \
- duk__ptr = (duk_uint8_t *) (ptr); \
- duk__len = duk_unicode_encode_xutf8((duk_ucodepoint_t) (val), duk__ptr); \
- duk__ptr += duk__len; \
- (ptr) = duk__ptr; \
+#define DUK_RAW_WRITE_U8(ptr, val) \
+ do { \
+ *(ptr) = (duk_uint8_t) (val); \
} while (0)
-#define DUK_RAW_WRITE_CESU8(ptr,val) do { \
- /* 'ptr' is evaluated both as LHS and RHS. */ \
- duk_uint8_t *duk__ptr; \
- duk_small_int_t duk__len; \
- duk__ptr = (duk_uint8_t *) (ptr); \
- duk__len = duk_unicode_encode_cesu8((duk_ucodepoint_t) (val), duk__ptr); \
- duk__ptr += duk__len; \
- (ptr) = duk__ptr; \
+#define DUK_RAW_WRITE_U16_BE(ptr, val) duk_raw_write_u16_be((ptr), (duk_uint16_t) (val))
+#define DUK_RAW_WRITE_U32_BE(ptr, val) duk_raw_write_u32_be((ptr), (duk_uint32_t) (val))
+#define DUK_RAW_WRITE_FLOAT_BE(ptr, val) duk_raw_write_float_be((ptr), (duk_float_t) (val))
+#define DUK_RAW_WRITE_DOUBLE_BE(ptr, val) duk_raw_write_double_be((ptr), (duk_double_t) (val))
+#define DUK_RAW_WRITE_XUTF8(ptr, val) duk_raw_write_xutf8((ptr), (duk_ucodepoint_t) (val))
+
+#define DUK_RAW_WRITEINC_U8(ptr, val) \
+ do { \
+ *(ptr)++ = (duk_uint8_t) (val); \
} while (0)
+#define DUK_RAW_WRITEINC_U16_BE(ptr, val) duk_raw_writeinc_u16_be(&(ptr), (duk_uint16_t) (val))
+#define DUK_RAW_WRITEINC_U32_BE(ptr, val) duk_raw_writeinc_u32_be(&(ptr), (duk_uint32_t) (val))
+#define DUK_RAW_WRITEINC_FLOAT_BE(ptr, val) duk_raw_writeinc_float_be(&(ptr), (duk_float_t) (val))
+#define DUK_RAW_WRITEINC_DOUBLE_BE(ptr, val) duk_raw_writeinc_double_be(&(ptr), (duk_double_t) (val))
+#define DUK_RAW_WRITEINC_XUTF8(ptr, val) duk_raw_writeinc_xutf8(&(ptr), (duk_ucodepoint_t) (val))
+#define DUK_RAW_WRITEINC_CESU8(ptr, val) duk_raw_writeinc_cesu8(&(ptr), (duk_ucodepoint_t) (val))
+
+#define DUK_RAW_READ_U8(ptr) ((duk_uint8_t) (*(ptr)))
+#define DUK_RAW_READ_U16_BE(ptr) duk_raw_read_u16_be((ptr));
+#define DUK_RAW_READ_U32_BE(ptr) duk_raw_read_u32_be((ptr));
+#define DUK_RAW_READ_DOUBLE_BE(ptr) duk_raw_read_double_be((ptr));
-#define DUK_RAW_READ_U8(ptr) ((duk_uint8_t) (*(ptr)++))
-#define DUK_RAW_READ_U16_BE(ptr) duk_raw_read_u16_be(&(ptr));
-#define DUK_RAW_READ_U32_BE(ptr) duk_raw_read_u32_be(&(ptr));
-#define DUK_RAW_READ_DOUBLE_BE(ptr) duk_raw_read_double_be(&(ptr));
+#define DUK_RAW_READINC_U8(ptr) ((duk_uint8_t) (*(ptr)++))
+#define DUK_RAW_READINC_U16_BE(ptr) duk_raw_readinc_u16_be(&(ptr));
+#define DUK_RAW_READINC_U32_BE(ptr) duk_raw_readinc_u32_be(&(ptr));
+#define DUK_RAW_READINC_DOUBLE_BE(ptr) duk_raw_readinc_double_be(&(ptr));
+
+/*
+ * Double and float byte order operations.
+ */
+
+DUK_INTERNAL_DECL void duk_dblunion_host_to_little(duk_double_union *u);
+DUK_INTERNAL_DECL void duk_dblunion_little_to_host(duk_double_union *u);
+DUK_INTERNAL_DECL void duk_dblunion_host_to_big(duk_double_union *u);
+DUK_INTERNAL_DECL void duk_dblunion_big_to_host(duk_double_union *u);
+DUK_INTERNAL_DECL void duk_fltunion_host_to_big(duk_float_union *u);
+DUK_INTERNAL_DECL void duk_fltunion_big_to_host(duk_float_union *u);
/*
* Buffer writer (dynamic buffer only)
@@ -2409,29 +2501,31 @@ struct duk_bufwriter_ctx {
};
#if defined(DUK_USE_PREFER_SIZE)
-#define DUK_BW_SLACK_ADD 64
-#define DUK_BW_SLACK_SHIFT 4 /* 2^4 -> 1/16 = 6.25% slack */
+#define DUK_BW_SLACK_ADD 64
+#define DUK_BW_SLACK_SHIFT 4 /* 2^4 -> 1/16 = 6.25% slack */
#else
-#define DUK_BW_SLACK_ADD 64
-#define DUK_BW_SLACK_SHIFT 2 /* 2^2 -> 1/4 = 25% slack */
+#define DUK_BW_SLACK_ADD 64
+#define DUK_BW_SLACK_SHIFT 2 /* 2^2 -> 1/4 = 25% slack */
#endif
/* Initialization and finalization (compaction), converting to other types. */
-#define DUK_BW_INIT_PUSHBUF(thr,bw_ctx,sz) do { \
+#define DUK_BW_INIT_PUSHBUF(thr, bw_ctx, sz) \
+ do { \
duk_bw_init_pushbuf((thr), (bw_ctx), (sz)); \
} while (0)
-#define DUK_BW_INIT_WITHBUF(thr,bw_ctx,buf) do { \
+#define DUK_BW_INIT_WITHBUF(thr, bw_ctx, buf) \
+ do { \
duk_bw_init((thr), (bw_ctx), (buf)); \
} while (0)
-#define DUK_BW_COMPACT(thr,bw_ctx) do { \
+#define DUK_BW_COMPACT(thr, bw_ctx) \
+ do { \
/* Make underlying buffer compact to match DUK_BW_GET_SIZE(). */ \
duk_bw_compact((thr), (bw_ctx)); \
} while (0)
-#define DUK_BW_PUSH_AS_STRING(thr,bw_ctx) do { \
- duk_push_lstring((thr), \
- (const char *) (bw_ctx)->p_base, \
- (duk_size_t) ((bw_ctx)->p - (bw_ctx)->p_base)); \
+#define DUK_BW_PUSH_AS_STRING(thr, bw_ctx) \
+ do { \
+ duk_push_lstring((thr), (const char *) (bw_ctx)->p_base, (duk_size_t) ((bw_ctx)->p - (bw_ctx)->p_base)); \
} while (0)
/* Pointers may be NULL for a while when 'buf' size is zero and before any
@@ -2441,43 +2535,48 @@ struct duk_bufwriter_ctx {
*/
#if defined(DUK_USE_ASSERTIONS)
DUK_INTERNAL_DECL void duk_bw_assert_valid(duk_hthread *thr, duk_bufwriter_ctx *bw_ctx);
-#define DUK_BW_ASSERT_VALID_EXPR(thr,bw_ctx) (duk_bw_assert_valid((thr), (bw_ctx)))
-#define DUK_BW_ASSERT_VALID(thr,bw_ctx) do { duk_bw_assert_valid((thr), (bw_ctx)); } while (0)
+#define DUK_BW_ASSERT_VALID_EXPR(thr, bw_ctx) (duk_bw_assert_valid((thr), (bw_ctx)))
+#define DUK_BW_ASSERT_VALID(thr, bw_ctx) \
+ do { \
+ duk_bw_assert_valid((thr), (bw_ctx)); \
+ } while (0)
#else
-#define DUK_BW_ASSERT_VALID_EXPR(thr,bw_ctx) DUK_ASSERT_EXPR(1)
-#define DUK_BW_ASSERT_VALID(thr,bw_ctx) do {} while (0)
+#define DUK_BW_ASSERT_VALID_EXPR(thr, bw_ctx) DUK_ASSERT_EXPR(1)
+#define DUK_BW_ASSERT_VALID(thr, bw_ctx) \
+ do { \
+ } while (0)
#endif
/* Working with the pointer and current size. */
-#define DUK_BW_GET_PTR(thr,bw_ctx) \
- ((bw_ctx)->p)
-#define DUK_BW_SET_PTR(thr,bw_ctx,ptr) do { \
+#define DUK_BW_GET_PTR(thr, bw_ctx) ((bw_ctx)->p)
+#define DUK_BW_SET_PTR(thr, bw_ctx, ptr) \
+ do { \
(bw_ctx)->p = (ptr); \
} while (0)
-#define DUK_BW_ADD_PTR(thr,bw_ctx,delta) do { \
+#define DUK_BW_ADD_PTR(thr, bw_ctx, delta) \
+ do { \
(bw_ctx)->p += (delta); \
} while (0)
-#define DUK_BW_GET_BASEPTR(thr,bw_ctx) \
- ((bw_ctx)->p_base)
-#define DUK_BW_GET_LIMITPTR(thr,bw_ctx) \
- ((bw_ctx)->p_limit)
-#define DUK_BW_GET_SIZE(thr,bw_ctx) \
- ((duk_size_t) ((bw_ctx)->p - (bw_ctx)->p_base))
-#define DUK_BW_SET_SIZE(thr,bw_ctx,sz) do { \
+#define DUK_BW_GET_BASEPTR(thr, bw_ctx) ((bw_ctx)->p_base)
+#define DUK_BW_GET_LIMITPTR(thr, bw_ctx) ((bw_ctx)->p_limit)
+#define DUK_BW_GET_SIZE(thr, bw_ctx) ((duk_size_t) ((bw_ctx)->p - (bw_ctx)->p_base))
+#define DUK_BW_SET_SIZE(thr, bw_ctx, sz) \
+ do { \
DUK_ASSERT((duk_size_t) (sz) <= (duk_size_t) ((bw_ctx)->p - (bw_ctx)->p_base)); \
(bw_ctx)->p = (bw_ctx)->p_base + (sz); \
} while (0)
-#define DUK_BW_RESET_SIZE(thr,bw_ctx) do { \
+#define DUK_BW_RESET_SIZE(thr, bw_ctx) \
+ do { \
/* Reset to zero size, keep current limit. */ \
(bw_ctx)->p = (bw_ctx)->p_base; \
} while (0)
-#define DUK_BW_GET_BUFFER(thr,bw_ctx) \
- ((bw_ctx)->buf)
+#define DUK_BW_GET_BUFFER(thr, bw_ctx) ((bw_ctx)->buf)
/* Ensuring (reserving) space. */
-#define DUK_BW_ENSURE(thr,bw_ctx,sz) do { \
+#define DUK_BW_ENSURE(thr, bw_ctx, sz) \
+ do { \
duk_size_t duk__sz, duk__space; \
DUK_BW_ASSERT_VALID((thr), (bw_ctx)); \
duk__sz = (sz); \
@@ -2488,22 +2587,21 @@ DUK_INTERNAL_DECL void duk_bw_assert_valid(duk_hthread *thr, duk_bufwriter_ctx *
} while (0)
/* NOTE: Multiple evaluation of 'ptr' in this macro. */
/* XXX: Rework to use an always-inline function? */
-#define DUK_BW_ENSURE_RAW(thr,bw_ctx,sz,ptr) \
- (((duk_size_t) ((bw_ctx)->p_limit - (ptr)) >= (sz)) ? \
- (ptr) : \
- ((bw_ctx)->p = (ptr), duk_bw_resize((thr),(bw_ctx),(sz))))
-#define DUK_BW_ENSURE_GETPTR(thr,bw_ctx,sz) \
- DUK_BW_ENSURE_RAW((thr), (bw_ctx), (sz), (bw_ctx)->p)
-#define DUK_BW_ASSERT_SPACE_EXPR(thr,bw_ctx,sz) \
+#define DUK_BW_ENSURE_RAW(thr, bw_ctx, sz, ptr) \
+ (((duk_size_t) ((bw_ctx)->p_limit - (ptr)) >= (sz)) ? (ptr) : ((bw_ctx)->p = (ptr), duk_bw_resize((thr), (bw_ctx), (sz))))
+#define DUK_BW_ENSURE_GETPTR(thr, bw_ctx, sz) DUK_BW_ENSURE_RAW((thr), (bw_ctx), (sz), (bw_ctx)->p)
+#define DUK_BW_ASSERT_SPACE_EXPR(thr, bw_ctx, sz) \
(DUK_BW_ASSERT_VALID_EXPR((thr), (bw_ctx)), \
DUK_ASSERT_EXPR((duk_size_t) ((bw_ctx)->p_limit - (bw_ctx)->p) >= (duk_size_t) (sz)))
-#define DUK_BW_ASSERT_SPACE(thr,bw_ctx,sz) do { \
+#define DUK_BW_ASSERT_SPACE(thr, bw_ctx, sz) \
+ do { \
DUK_BW_ASSERT_SPACE_EXPR((thr), (bw_ctx), (sz)); \
} while (0)
/* Miscellaneous. */
-#define DUK_BW_SETPTR_AND_COMPACT(thr,bw_ctx,ptr) do { \
+#define DUK_BW_SETPTR_AND_COMPACT(thr, bw_ctx, ptr) \
+ do { \
(bw_ctx)->p = (ptr); \
duk_bw_compact((thr), (bw_ctx)); \
} while (0)
@@ -2514,11 +2612,13 @@ DUK_INTERNAL_DECL void duk_bw_assert_valid(duk_hthread *thr, duk_bufwriter_ctx *
* explicit pointer load/stores get generated (e.g. gcc -Os).
*/
-#define DUK_BW_WRITE_RAW_U8(thr,bw_ctx,val) do { \
+#define DUK_BW_WRITE_RAW_U8(thr, bw_ctx, val) \
+ do { \
DUK_BW_ASSERT_SPACE((thr), (bw_ctx), 1); \
*(bw_ctx)->p++ = (duk_uint8_t) (val); \
} while (0)
-#define DUK_BW_WRITE_RAW_U8_2(thr,bw_ctx,val1,val2) do { \
+#define DUK_BW_WRITE_RAW_U8_2(thr, bw_ctx, val1, val2) \
+ do { \
duk_uint8_t *duk__p; \
DUK_BW_ASSERT_SPACE((thr), (bw_ctx), 2); \
duk__p = (bw_ctx)->p; \
@@ -2526,7 +2626,8 @@ DUK_INTERNAL_DECL void duk_bw_assert_valid(duk_hthread *thr, duk_bufwriter_ctx *
*duk__p++ = (duk_uint8_t) (val2); \
(bw_ctx)->p = duk__p; \
} while (0)
-#define DUK_BW_WRITE_RAW_U8_3(thr,bw_ctx,val1,val2,val3) do { \
+#define DUK_BW_WRITE_RAW_U8_3(thr, bw_ctx, val1, val2, val3) \
+ do { \
duk_uint8_t *duk__p; \
DUK_BW_ASSERT_SPACE((thr), (bw_ctx), 3); \
duk__p = (bw_ctx)->p; \
@@ -2535,7 +2636,8 @@ DUK_INTERNAL_DECL void duk_bw_assert_valid(duk_hthread *thr, duk_bufwriter_ctx *
*duk__p++ = (duk_uint8_t) (val3); \
(bw_ctx)->p = duk__p; \
} while (0)
-#define DUK_BW_WRITE_RAW_U8_4(thr,bw_ctx,val1,val2,val3,val4) do { \
+#define DUK_BW_WRITE_RAW_U8_4(thr, bw_ctx, val1, val2, val3, val4) \
+ do { \
duk_uint8_t *duk__p; \
DUK_BW_ASSERT_SPACE((thr), (bw_ctx), 4); \
duk__p = (bw_ctx)->p; \
@@ -2545,7 +2647,8 @@ DUK_INTERNAL_DECL void duk_bw_assert_valid(duk_hthread *thr, duk_bufwriter_ctx *
*duk__p++ = (duk_uint8_t) (val4); \
(bw_ctx)->p = duk__p; \
} while (0)
-#define DUK_BW_WRITE_RAW_U8_5(thr,bw_ctx,val1,val2,val3,val4,val5) do { \
+#define DUK_BW_WRITE_RAW_U8_5(thr, bw_ctx, val1, val2, val3, val4, val5) \
+ do { \
duk_uint8_t *duk__p; \
DUK_BW_ASSERT_SPACE((thr), (bw_ctx), 5); \
duk__p = (bw_ctx)->p; \
@@ -2556,7 +2659,8 @@ DUK_INTERNAL_DECL void duk_bw_assert_valid(duk_hthread *thr, duk_bufwriter_ctx *
*duk__p++ = (duk_uint8_t) (val5); \
(bw_ctx)->p = duk__p; \
} while (0)
-#define DUK_BW_WRITE_RAW_U8_6(thr,bw_ctx,val1,val2,val3,val4,val5,val6) do { \
+#define DUK_BW_WRITE_RAW_U8_6(thr, bw_ctx, val1, val2, val3, val4, val5, val6) \
+ do { \
duk_uint8_t *duk__p; \
DUK_BW_ASSERT_SPACE((thr), (bw_ctx), 6); \
duk__p = (bw_ctx)->p; \
@@ -2568,7 +2672,8 @@ DUK_INTERNAL_DECL void duk_bw_assert_valid(duk_hthread *thr, duk_bufwriter_ctx *
*duk__p++ = (duk_uint8_t) (val6); \
(bw_ctx)->p = duk__p; \
} while (0)
-#define DUK_BW_WRITE_RAW_XUTF8(thr,bw_ctx,cp) do { \
+#define DUK_BW_WRITE_RAW_XUTF8(thr, bw_ctx, cp) \
+ do { \
duk_ucodepoint_t duk__cp; \
duk_small_int_t duk__enc_len; \
duk__cp = (duk_ucodepoint_t) (cp); \
@@ -2576,7 +2681,8 @@ DUK_INTERNAL_DECL void duk_bw_assert_valid(duk_hthread *thr, duk_bufwriter_ctx *
duk__enc_len = duk_unicode_encode_xutf8(duk__cp, (bw_ctx)->p); \
(bw_ctx)->p += duk__enc_len; \
} while (0)
-#define DUK_BW_WRITE_RAW_CESU8(thr,bw_ctx,cp) do { \
+#define DUK_BW_WRITE_RAW_CESU8(thr, bw_ctx, cp) \
+ do { \
duk_ucodepoint_t duk__cp; \
duk_small_int_t duk__enc_len; \
duk__cp = (duk_ucodepoint_t) (cp); \
@@ -2586,7 +2692,8 @@ DUK_INTERNAL_DECL void duk_bw_assert_valid(duk_hthread *thr, duk_bufwriter_ctx *
} while (0)
/* XXX: add temporary duk__p pointer here too; sharing */
/* XXX: avoid unsafe variants */
-#define DUK_BW_WRITE_RAW_BYTES(thr,bw_ctx,valptr,valsz) do { \
+#define DUK_BW_WRITE_RAW_BYTES(thr, bw_ctx, valptr, valsz) \
+ do { \
const void *duk__valptr; \
duk_size_t duk__valsz; \
duk__valptr = (const void *) (valptr); \
@@ -2594,7 +2701,8 @@ DUK_INTERNAL_DECL void duk_bw_assert_valid(duk_hthread *thr, duk_bufwriter_ctx *
duk_memcpy_unsafe((void *) ((bw_ctx)->p), duk__valptr, duk__valsz); \
(bw_ctx)->p += duk__valsz; \
} while (0)
-#define DUK_BW_WRITE_RAW_CSTRING(thr,bw_ctx,val) do { \
+#define DUK_BW_WRITE_RAW_CSTRING(thr, bw_ctx, val) \
+ do { \
const duk_uint8_t *duk__val; \
duk_size_t duk__val_len; \
duk__val = (const duk_uint8_t *) (val); \
@@ -2602,93 +2710,107 @@ DUK_INTERNAL_DECL void duk_bw_assert_valid(duk_hthread *thr, duk_bufwriter_ctx *
duk_memcpy_unsafe((void *) ((bw_ctx)->p), (const void *) duk__val, duk__val_len); \
(bw_ctx)->p += duk__val_len; \
} while (0)
-#define DUK_BW_WRITE_RAW_HSTRING(thr,bw_ctx,val) do { \
+#define DUK_BW_WRITE_RAW_HSTRING(thr, bw_ctx, val) \
+ do { \
duk_size_t duk__val_len; \
duk__val_len = DUK_HSTRING_GET_BYTELEN((val)); \
duk_memcpy_unsafe((void *) ((bw_ctx)->p), (const void *) DUK_HSTRING_GET_DATA((val)), duk__val_len); \
(bw_ctx)->p += duk__val_len; \
} while (0)
-#define DUK_BW_WRITE_RAW_HBUFFER(thr,bw_ctx,val) do { \
+#define DUK_BW_WRITE_RAW_HBUFFER(thr, bw_ctx, val) \
+ do { \
duk_size_t duk__val_len; \
duk__val_len = DUK_HBUFFER_GET_SIZE((val)); \
- duk_memcpy_unsafe((void *) ((bw_ctx)->p), (const void *) DUK_HBUFFER_GET_DATA_PTR((thr)->heap, (val)), duk__val_len); \
+ duk_memcpy_unsafe((void *) ((bw_ctx)->p), \
+ (const void *) DUK_HBUFFER_GET_DATA_PTR((thr)->heap, (val)), \
+ duk__val_len); \
(bw_ctx)->p += duk__val_len; \
} while (0)
-#define DUK_BW_WRITE_RAW_HBUFFER_FIXED(thr,bw_ctx,val) do { \
+#define DUK_BW_WRITE_RAW_HBUFFER_FIXED(thr, bw_ctx, val) \
+ do { \
duk_size_t duk__val_len; \
duk__val_len = DUK_HBUFFER_FIXED_GET_SIZE((val)); \
- duk_memcpy_unsafe((void *) ((bw_ctx)->p), (const void *) DUK_HBUFFER_FIXED_GET_DATA_PTR((thr)->heap, (val)), duk__val_len); \
+ duk_memcpy_unsafe((void *) ((bw_ctx)->p), \
+ (const void *) DUK_HBUFFER_FIXED_GET_DATA_PTR((thr)->heap, (val)), \
+ duk__val_len); \
(bw_ctx)->p += duk__val_len; \
} while (0)
-#define DUK_BW_WRITE_RAW_HBUFFER_DYNAMIC(thr,bw_ctx,val) do { \
+#define DUK_BW_WRITE_RAW_HBUFFER_DYNAMIC(thr, bw_ctx, val) \
+ do { \
duk_size_t duk__val_len; \
duk__val_len = DUK_HBUFFER_DYNAMIC_GET_SIZE((val)); \
- duk_memcpy_unsafe((void *) ((bw_ctx)->p), (const void *) DUK_HBUFFER_DYNAMIC_GET_DATA_PTR((thr)->heap, (val)), duk__val_len); \
+ duk_memcpy_unsafe((void *) ((bw_ctx)->p), \
+ (const void *) DUK_HBUFFER_DYNAMIC_GET_DATA_PTR((thr)->heap, (val)), \
+ duk__val_len); \
(bw_ctx)->p += duk__val_len; \
} while (0)
/* Append bytes from a slice already in the buffer. */
-#define DUK_BW_WRITE_RAW_SLICE(thr,bw,dst_off,dst_len) \
- duk_bw_write_raw_slice((thr), (bw), (dst_off), (dst_len))
+#define DUK_BW_WRITE_RAW_SLICE(thr, bw, dst_off, dst_len) duk_bw_write_raw_slice((thr), (bw), (dst_off), (dst_len))
/* Insert bytes in the middle of the buffer from an external buffer. */
-#define DUK_BW_INSERT_RAW_BYTES(thr,bw,dst_off,buf,len) \
- duk_bw_insert_raw_bytes((thr), (bw), (dst_off), (buf), (len))
+#define DUK_BW_INSERT_RAW_BYTES(thr, bw, dst_off, buf, len) duk_bw_insert_raw_bytes((thr), (bw), (dst_off), (buf), (len))
/* Insert bytes in the middle of the buffer from a slice already
* in the buffer. Source offset is interpreted "before" the operation.
*/
-#define DUK_BW_INSERT_RAW_SLICE(thr,bw,dst_off,src_off,len) \
- duk_bw_insert_raw_slice((thr), (bw), (dst_off), (src_off), (len))
+#define DUK_BW_INSERT_RAW_SLICE(thr, bw, dst_off, src_off, len) duk_bw_insert_raw_slice((thr), (bw), (dst_off), (src_off), (len))
/* Insert a reserved area somewhere in the buffer; caller fills it.
* Evaluates to a (duk_uint_t *) pointing to the start of the reserved
* area for convenience.
*/
-#define DUK_BW_INSERT_RAW_AREA(thr,bw,off,len) \
- duk_bw_insert_raw_area((thr), (bw), (off), (len))
+#define DUK_BW_INSERT_RAW_AREA(thr, bw, off, len) duk_bw_insert_raw_area((thr), (bw), (off), (len))
/* Remove a slice from inside buffer. */
-#define DUK_BW_REMOVE_RAW_SLICE(thr,bw,off,len) \
- duk_bw_remove_raw_slice((thr), (bw), (off), (len))
+#define DUK_BW_REMOVE_RAW_SLICE(thr, bw, off, len) duk_bw_remove_raw_slice((thr), (bw), (off), (len))
/* Safe write calls which will ensure space first. */
-#define DUK_BW_WRITE_ENSURE_U8(thr,bw_ctx,val) do { \
+#define DUK_BW_WRITE_ENSURE_U8(thr, bw_ctx, val) \
+ do { \
DUK_BW_ENSURE((thr), (bw_ctx), 1); \
DUK_BW_WRITE_RAW_U8((thr), (bw_ctx), (val)); \
} while (0)
-#define DUK_BW_WRITE_ENSURE_U8_2(thr,bw_ctx,val1,val2) do { \
+#define DUK_BW_WRITE_ENSURE_U8_2(thr, bw_ctx, val1, val2) \
+ do { \
DUK_BW_ENSURE((thr), (bw_ctx), 2); \
DUK_BW_WRITE_RAW_U8_2((thr), (bw_ctx), (val1), (val2)); \
} while (0)
-#define DUK_BW_WRITE_ENSURE_U8_3(thr,bw_ctx,val1,val2,val3) do { \
+#define DUK_BW_WRITE_ENSURE_U8_3(thr, bw_ctx, val1, val2, val3) \
+ do { \
DUK_BW_ENSURE((thr), (bw_ctx), 3); \
DUK_BW_WRITE_RAW_U8_3((thr), (bw_ctx), (val1), (val2), (val3)); \
} while (0)
-#define DUK_BW_WRITE_ENSURE_U8_4(thr,bw_ctx,val1,val2,val3,val4) do { \
+#define DUK_BW_WRITE_ENSURE_U8_4(thr, bw_ctx, val1, val2, val3, val4) \
+ do { \
DUK_BW_ENSURE((thr), (bw_ctx), 4); \
DUK_BW_WRITE_RAW_U8_4((thr), (bw_ctx), (val1), (val2), (val3), (val4)); \
} while (0)
-#define DUK_BW_WRITE_ENSURE_U8_5(thr,bw_ctx,val1,val2,val3,val4,val5) do { \
+#define DUK_BW_WRITE_ENSURE_U8_5(thr, bw_ctx, val1, val2, val3, val4, val5) \
+ do { \
DUK_BW_ENSURE((thr), (bw_ctx), 5); \
DUK_BW_WRITE_RAW_U8_5((thr), (bw_ctx), (val1), (val2), (val3), (val4), (val5)); \
} while (0)
-#define DUK_BW_WRITE_ENSURE_U8_6(thr,bw_ctx,val1,val2,val3,val4,val5,val6) do { \
+#define DUK_BW_WRITE_ENSURE_U8_6(thr, bw_ctx, val1, val2, val3, val4, val5, val6) \
+ do { \
DUK_BW_ENSURE((thr), (bw_ctx), 6); \
DUK_BW_WRITE_RAW_U8_6((thr), (bw_ctx), (val1), (val2), (val3), (val4), (val5), (val6)); \
} while (0)
-#define DUK_BW_WRITE_ENSURE_XUTF8(thr,bw_ctx,cp) do { \
+#define DUK_BW_WRITE_ENSURE_XUTF8(thr, bw_ctx, cp) \
+ do { \
DUK_BW_ENSURE((thr), (bw_ctx), DUK_UNICODE_MAX_XUTF8_LENGTH); \
DUK_BW_WRITE_RAW_XUTF8((thr), (bw_ctx), (cp)); \
} while (0)
-#define DUK_BW_WRITE_ENSURE_CESU8(thr,bw_ctx,cp) do { \
+#define DUK_BW_WRITE_ENSURE_CESU8(thr, bw_ctx, cp) \
+ do { \
DUK_BW_ENSURE((thr), (bw_ctx), DUK_UNICODE_MAX_CESU8_LENGTH); \
DUK_BW_WRITE_RAW_CESU8((thr), (bw_ctx), (cp)); \
} while (0)
/* XXX: add temporary duk__p pointer here too; sharing */
/* XXX: avoid unsafe */
-#define DUK_BW_WRITE_ENSURE_BYTES(thr,bw_ctx,valptr,valsz) do { \
+#define DUK_BW_WRITE_ENSURE_BYTES(thr, bw_ctx, valptr, valsz) \
+ do { \
const void *duk__valptr; \
duk_size_t duk__valsz; \
duk__valptr = (const void *) (valptr); \
@@ -2697,7 +2819,8 @@ DUK_INTERNAL_DECL void duk_bw_assert_valid(duk_hthread *thr, duk_bufwriter_ctx *
duk_memcpy_unsafe((void *) ((bw_ctx)->p), duk__valptr, duk__valsz); \
(bw_ctx)->p += duk__valsz; \
} while (0)
-#define DUK_BW_WRITE_ENSURE_CSTRING(thr,bw_ctx,val) do { \
+#define DUK_BW_WRITE_ENSURE_CSTRING(thr, bw_ctx, val) \
+ do { \
const duk_uint8_t *duk__val; \
duk_size_t duk__val_len; \
duk__val = (const duk_uint8_t *) (val); \
@@ -2706,45 +2829,53 @@ DUK_INTERNAL_DECL void duk_bw_assert_valid(duk_hthread *thr, duk_bufwriter_ctx *
duk_memcpy_unsafe((void *) ((bw_ctx)->p), (const void *) duk__val, duk__val_len); \
(bw_ctx)->p += duk__val_len; \
} while (0)
-#define DUK_BW_WRITE_ENSURE_HSTRING(thr,bw_ctx,val) do { \
+#define DUK_BW_WRITE_ENSURE_HSTRING(thr, bw_ctx, val) \
+ do { \
duk_size_t duk__val_len; \
duk__val_len = DUK_HSTRING_GET_BYTELEN((val)); \
DUK_BW_ENSURE((thr), (bw_ctx), duk__val_len); \
duk_memcpy_unsafe((void *) ((bw_ctx)->p), (const void *) DUK_HSTRING_GET_DATA((val)), duk__val_len); \
(bw_ctx)->p += duk__val_len; \
} while (0)
-#define DUK_BW_WRITE_ENSURE_HBUFFER(thr,bw_ctx,val) do { \
+#define DUK_BW_WRITE_ENSURE_HBUFFER(thr, bw_ctx, val) \
+ do { \
duk_size_t duk__val_len; \
duk__val_len = DUK_HBUFFER_GET_SIZE((val)); \
DUK_BW_ENSURE((thr), (bw_ctx), duk__val_len); \
- duk_memcpy_unsafe((void *) ((bw_ctx)->p), (const void *) DUK_HBUFFER_GET_DATA_PTR((thr)->heap, (val)), duk__val_len); \
+ duk_memcpy_unsafe((void *) ((bw_ctx)->p), \
+ (const void *) DUK_HBUFFER_GET_DATA_PTR((thr)->heap, (val)), \
+ duk__val_len); \
(bw_ctx)->p += duk__val_len; \
} while (0)
-#define DUK_BW_WRITE_ENSURE_HBUFFER_FIXED(thr,bw_ctx,val) do { \
+#define DUK_BW_WRITE_ENSURE_HBUFFER_FIXED(thr, bw_ctx, val) \
+ do { \
duk_size_t duk__val_len; \
duk__val_len = DUK_HBUFFER_FIXED_GET_SIZE((val)); \
DUK_BW_ENSURE((thr), (bw_ctx), duk__val_len); \
- duk_memcpy_unsafe((void *) ((bw_ctx)->p), (const void *) DUK_HBUFFER_FIXED_GET_DATA_PTR((thr)->heap, (val)), duk__val_len); \
+ duk_memcpy_unsafe((void *) ((bw_ctx)->p), \
+ (const void *) DUK_HBUFFER_FIXED_GET_DATA_PTR((thr)->heap, (val)), \
+ duk__val_len); \
(bw_ctx)->p += duk__val_len; \
} while (0)
-#define DUK_BW_WRITE_ENSURE_HBUFFER_DYNAMIC(thr,bw_ctx,val) do { \
+#define DUK_BW_WRITE_ENSURE_HBUFFER_DYNAMIC(thr, bw_ctx, val) \
+ do { \
duk_size_t duk__val_len; \
duk__val_len = DUK_HBUFFER_DYNAMIC_GET_SIZE((val)); \
DUK_BW_ENSURE((thr), (bw_ctx), duk__val_len); \
- duk_memcpy_unsafe((void *) ((bw_ctx)->p), (const void *) DUK_HBUFFER_DYNAMIC_GET_DATA_PTR((thr)->heap, (val)), duk__val_len); \
+ duk_memcpy_unsafe((void *) ((bw_ctx)->p), \
+ (const void *) DUK_HBUFFER_DYNAMIC_GET_DATA_PTR((thr)->heap, (val)), \
+ duk__val_len); \
(bw_ctx)->p += duk__val_len; \
} while (0)
-#define DUK_BW_WRITE_ENSURE_SLICE(thr,bw,dst_off,dst_len) \
- duk_bw_write_ensure_slice((thr), (bw), (dst_off), (dst_len))
-#define DUK_BW_INSERT_ENSURE_BYTES(thr,bw,dst_off,buf,len) \
- duk_bw_insert_ensure_bytes((thr), (bw), (dst_off), (buf), (len))
-#define DUK_BW_INSERT_ENSURE_SLICE(thr,bw,dst_off,src_off,len) \
+#define DUK_BW_WRITE_ENSURE_SLICE(thr, bw, dst_off, dst_len) duk_bw_write_ensure_slice((thr), (bw), (dst_off), (dst_len))
+#define DUK_BW_INSERT_ENSURE_BYTES(thr, bw, dst_off, buf, len) duk_bw_insert_ensure_bytes((thr), (bw), (dst_off), (buf), (len))
+#define DUK_BW_INSERT_ENSURE_SLICE(thr, bw, dst_off, src_off, len) \
duk_bw_insert_ensure_slice((thr), (bw), (dst_off), (src_off), (len))
-#define DUK_BW_INSERT_ENSURE_AREA(thr,bw,off,len) \
+#define DUK_BW_INSERT_ENSURE_AREA(thr, bw, off, len) \
/* Evaluates to (duk_uint8_t *) pointing to start of area. */ \
duk_bw_insert_ensure_area((thr), (bw), (off), (len))
-#define DUK_BW_REMOVE_ENSURE_SLICE(thr,bw,off,len) \
+#define DUK_BW_REMOVE_ENSURE_SLICE(thr, bw, off, len) \
/* No difference between raw/ensure because the buffer shrinks. */ \
DUK_BW_REMOVE_RAW_SLICE((thr), (bw), (off), (len))
@@ -2760,13 +2891,13 @@ DUK_INTERNAL_DECL const duk_int8_t duk_hex_dectab[256];
DUK_INTERNAL_DECL const duk_int16_t duk_hex_dectab_shift4[256];
DUK_INTERNAL_DECL const duk_uint16_t duk_hex_enctab[256];
#endif
-#endif /* !DUK_SINGLE_FILE */
+#endif /* !DUK_SINGLE_FILE */
/* Note: assumes that duk_util_probe_steps size is 32 */
#if defined(DUK_USE_HOBJECT_HASH_PART)
#if !defined(DUK_SINGLE_FILE)
DUK_INTERNAL_DECL duk_uint8_t duk_util_probe_steps[32];
-#endif /* !DUK_SINGLE_FILE */
+#endif /* !DUK_SINGLE_FILE */
#endif
#if defined(DUK_USE_STRHASH_DENSE)
@@ -2794,26 +2925,58 @@ DUK_INTERNAL_DECL duk_uint8_t *duk_bw_resize(duk_hthread *thr, duk_bufwriter_ctx
DUK_INTERNAL_DECL void duk_bw_compact(duk_hthread *thr, duk_bufwriter_ctx *bw_ctx);
DUK_INTERNAL_DECL void duk_bw_write_raw_slice(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t src_off, duk_size_t len);
DUK_INTERNAL_DECL void duk_bw_write_ensure_slice(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t src_off, duk_size_t len);
-DUK_INTERNAL_DECL void duk_bw_insert_raw_bytes(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t dst_off, const duk_uint8_t *buf, duk_size_t len);
-DUK_INTERNAL_DECL void duk_bw_insert_ensure_bytes(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t dst_off, const duk_uint8_t *buf, duk_size_t len);
-DUK_INTERNAL_DECL void duk_bw_insert_raw_slice(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t dst_off, duk_size_t src_off, duk_size_t len);
-DUK_INTERNAL_DECL void duk_bw_insert_ensure_slice(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t dst_off, duk_size_t src_off, duk_size_t len);
+DUK_INTERNAL_DECL void duk_bw_insert_raw_bytes(duk_hthread *thr,
+ duk_bufwriter_ctx *bw,
+ duk_size_t dst_off,
+ const duk_uint8_t *buf,
+ duk_size_t len);
+DUK_INTERNAL_DECL void duk_bw_insert_ensure_bytes(duk_hthread *thr,
+ duk_bufwriter_ctx *bw,
+ duk_size_t dst_off,
+ const duk_uint8_t *buf,
+ duk_size_t len);
+DUK_INTERNAL_DECL void duk_bw_insert_raw_slice(duk_hthread *thr,
+ duk_bufwriter_ctx *bw,
+ duk_size_t dst_off,
+ duk_size_t src_off,
+ duk_size_t len);
+DUK_INTERNAL_DECL void duk_bw_insert_ensure_slice(duk_hthread *thr,
+ duk_bufwriter_ctx *bw,
+ duk_size_t dst_off,
+ duk_size_t src_off,
+ duk_size_t len);
DUK_INTERNAL_DECL duk_uint8_t *duk_bw_insert_raw_area(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t off, duk_size_t len);
DUK_INTERNAL_DECL duk_uint8_t *duk_bw_insert_ensure_area(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t off, duk_size_t len);
DUK_INTERNAL_DECL void duk_bw_remove_raw_slice(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t off, duk_size_t len);
/* No duk_bw_remove_ensure_slice(), functionality would be identical. */
-DUK_INTERNAL_DECL DUK_INLINE duk_uint16_t duk_raw_read_u16_be(duk_uint8_t **p);
-DUK_INTERNAL_DECL DUK_INLINE duk_uint32_t duk_raw_read_u32_be(duk_uint8_t **p);
-DUK_INTERNAL_DECL DUK_INLINE duk_double_t duk_raw_read_double_be(duk_uint8_t **p);
-DUK_INTERNAL_DECL DUK_INLINE void duk_raw_write_u16_be(duk_uint8_t **p, duk_uint16_t val);
-DUK_INTERNAL_DECL DUK_INLINE void duk_raw_write_u32_be(duk_uint8_t **p, duk_uint32_t val);
-DUK_INTERNAL_DECL DUK_INLINE void duk_raw_write_double_be(duk_uint8_t **p, duk_double_t val);
-
-#if defined(DUK_USE_DEBUGGER_SUPPORT) /* For now only needed by the debugger. */
+DUK_INTERNAL_DECL duk_uint16_t duk_raw_read_u16_be(const duk_uint8_t *p);
+DUK_INTERNAL_DECL duk_uint32_t duk_raw_read_u32_be(const duk_uint8_t *p);
+DUK_INTERNAL_DECL duk_float_t duk_raw_read_float_be(const duk_uint8_t *p);
+DUK_INTERNAL_DECL duk_double_t duk_raw_read_double_be(const duk_uint8_t *p);
+DUK_INTERNAL_DECL duk_uint16_t duk_raw_readinc_u16_be(const duk_uint8_t **p);
+DUK_INTERNAL_DECL duk_uint32_t duk_raw_readinc_u32_be(const duk_uint8_t **p);
+DUK_INTERNAL_DECL duk_float_t duk_raw_readinc_float_be(const duk_uint8_t **p);
+DUK_INTERNAL_DECL duk_double_t duk_raw_readinc_double_be(const duk_uint8_t **p);
+DUK_INTERNAL_DECL void duk_raw_write_u16_be(duk_uint8_t *p, duk_uint16_t val);
+DUK_INTERNAL_DECL void duk_raw_write_u32_be(duk_uint8_t *p, duk_uint32_t val);
+DUK_INTERNAL_DECL void duk_raw_write_float_be(duk_uint8_t *p, duk_float_t val);
+DUK_INTERNAL_DECL void duk_raw_write_double_be(duk_uint8_t *p, duk_double_t val);
+DUK_INTERNAL_DECL duk_small_int_t duk_raw_write_xutf8(duk_uint8_t *p, duk_ucodepoint_t val);
+DUK_INTERNAL_DECL duk_small_int_t duk_raw_write_cesu8(duk_uint8_t *p, duk_ucodepoint_t val);
+DUK_INTERNAL_DECL void duk_raw_writeinc_u16_be(duk_uint8_t **p, duk_uint16_t val);
+DUK_INTERNAL_DECL void duk_raw_writeinc_u32_be(duk_uint8_t **p, duk_uint32_t val);
+DUK_INTERNAL_DECL void duk_raw_writeinc_float_be(duk_uint8_t **p, duk_float_t val);
+DUK_INTERNAL_DECL void duk_raw_writeinc_double_be(duk_uint8_t **p, duk_double_t val);
+DUK_INTERNAL_DECL void duk_raw_writeinc_xutf8(duk_uint8_t **p, duk_ucodepoint_t val);
+DUK_INTERNAL_DECL void duk_raw_writeinc_cesu8(duk_uint8_t **p, duk_ucodepoint_t val);
+
+#if defined(DUK_USE_DEBUGGER_SUPPORT) /* For now only needed by the debugger. */
DUK_INTERNAL_DECL void duk_byteswap_bytes(duk_uint8_t *p, duk_small_uint_t len);
#endif
+DUK_INTERNAL_DECL duk_double_t duk_util_get_random_double(duk_hthread *thr);
+
/* memcpy(), memmove() etc wrappers. The plain variants like duk_memcpy()
* assume C99+ and 'src' and 'dst' pointers must be non-NULL even when the
* operation size is zero. The unsafe variants like duk_memcpy_safe() deal
@@ -2824,7 +2987,8 @@ DUK_INTERNAL_DECL void duk_byteswap_bytes(duk_uint8_t *p, duk_small_uint_t len);
* few extra bytes per call site adds up to ~1kB footprint.
*/
#if defined(DUK_USE_ALLOW_UNDEFINED_BEHAVIOR)
-#define duk_memcpy(dst,src,len) do { \
+#define duk_memcpy(dst, src, len) \
+ do { \
void *duk__dst = (dst); \
const void *duk__src = (src); \
duk_size_t duk__len = (len); \
@@ -2832,8 +2996,9 @@ DUK_INTERNAL_DECL void duk_byteswap_bytes(duk_uint8_t *p, duk_small_uint_t len);
DUK_ASSERT(duk__src != NULL || duk__len == 0U); \
(void) DUK_MEMCPY(duk__dst, duk__src, (size_t) duk__len); \
} while (0)
-#define duk_memcpy_unsafe(dst,src,len) duk_memcpy((dst), (src), (len))
-#define duk_memmove(dst,src,len) do { \
+#define duk_memcpy_unsafe(dst, src, len) duk_memcpy((dst), (src), (len))
+#define duk_memmove(dst, src, len) \
+ do { \
void *duk__dst = (dst); \
const void *duk__src = (src); \
duk_size_t duk__len = (len); \
@@ -2841,24 +3006,27 @@ DUK_INTERNAL_DECL void duk_byteswap_bytes(duk_uint8_t *p, duk_small_uint_t len);
DUK_ASSERT(duk__src != NULL || duk__len == 0U); \
(void) DUK_MEMMOVE(duk__dst, duk__src, (size_t) duk__len); \
} while (0)
-#define duk_memmove_unsafe(dst,src,len) duk_memmove((dst), (src), (len))
-#define duk_memset(dst,val,len) do { \
+#define duk_memmove_unsafe(dst, src, len) duk_memmove((dst), (src), (len))
+#define duk_memset(dst, val, len) \
+ do { \
void *duk__dst = (dst); \
duk_small_int_t duk__val = (val); \
duk_size_t duk__len = (len); \
DUK_ASSERT(duk__dst != NULL || duk__len == 0U); \
(void) DUK_MEMSET(duk__dst, duk__val, (size_t) duk__len); \
} while (0)
-#define duk_memset_unsafe(dst,val,len) duk_memset((dst), (val), (len))
-#define duk_memzero(dst,len) do { \
+#define duk_memset_unsafe(dst, val, len) duk_memset((dst), (val), (len))
+#define duk_memzero(dst, len) \
+ do { \
void *duk__dst = (dst); \
duk_size_t duk__len = (len); \
DUK_ASSERT(duk__dst != NULL || duk__len == 0U); \
(void) DUK_MEMZERO(duk__dst, (size_t) duk__len); \
} while (0)
-#define duk_memzero_unsafe(dst,len) duk_memzero((dst), (len))
-#else /* DUK_USE_ALLOW_UNDEFINED_BEHAVIOR */
-#define duk_memcpy(dst,src,len) do { \
+#define duk_memzero_unsafe(dst, len) duk_memzero((dst), (len))
+#else /* DUK_USE_ALLOW_UNDEFINED_BEHAVIOR */
+#define duk_memcpy(dst, src, len) \
+ do { \
void *duk__dst = (dst); \
const void *duk__src = (src); \
duk_size_t duk__len = (len); \
@@ -2866,7 +3034,8 @@ DUK_INTERNAL_DECL void duk_byteswap_bytes(duk_uint8_t *p, duk_small_uint_t len);
DUK_ASSERT(duk__src != NULL); \
(void) DUK_MEMCPY(duk__dst, duk__src, (size_t) duk__len); \
} while (0)
-#define duk_memcpy_unsafe(dst,src,len) do { \
+#define duk_memcpy_unsafe(dst, src, len) \
+ do { \
void *duk__dst = (dst); \
const void *duk__src = (src); \
duk_size_t duk__len = (len); \
@@ -2878,7 +3047,8 @@ DUK_INTERNAL_DECL void duk_byteswap_bytes(duk_uint8_t *p, duk_small_uint_t len);
(void) DUK_MEMCPY(duk__dst, duk__src, (size_t) duk__len); \
} \
} while (0)
-#define duk_memmove(dst,src,len) do { \
+#define duk_memmove(dst, src, len) \
+ do { \
void *duk__dst = (dst); \
const void *duk__src = (src); \
duk_size_t duk__len = (len); \
@@ -2886,7 +3056,8 @@ DUK_INTERNAL_DECL void duk_byteswap_bytes(duk_uint8_t *p, duk_small_uint_t len);
DUK_ASSERT(duk__src != NULL); \
(void) DUK_MEMMOVE(duk__dst, duk__src, (size_t) duk__len); \
} while (0)
-#define duk_memmove_unsafe(dst,src,len) do { \
+#define duk_memmove_unsafe(dst, src, len) \
+ do { \
void *duk__dst = (dst); \
const void *duk__src = (src); \
duk_size_t duk__len = (len); \
@@ -2898,14 +3069,16 @@ DUK_INTERNAL_DECL void duk_byteswap_bytes(duk_uint8_t *p, duk_small_uint_t len);
(void) DUK_MEMMOVE(duk__dst, duk__src, (size_t) duk__len); \
} \
} while (0)
-#define duk_memset(dst,val,len) do { \
+#define duk_memset(dst, val, len) \
+ do { \
void *duk__dst = (dst); \
duk_small_int_t duk__val = (val); \
duk_size_t duk__len = (len); \
DUK_ASSERT(duk__dst != NULL); \
(void) DUK_MEMSET(duk__dst, duk__val, (size_t) duk__len); \
} while (0)
-#define duk_memset_unsafe(dst,val,len) do { \
+#define duk_memset_unsafe(dst, val, len) \
+ do { \
void *duk__dst = (dst); \
duk_small_int_t duk__val = (val); \
duk_size_t duk__len = (len); \
@@ -2915,13 +3088,15 @@ DUK_INTERNAL_DECL void duk_byteswap_bytes(duk_uint8_t *p, duk_small_uint_t len);
(void) DUK_MEMSET(duk__dst, duk__val, (size_t) duk__len); \
} \
} while (0)
-#define duk_memzero(dst,len) do { \
+#define duk_memzero(dst, len) \
+ do { \
void *duk__dst = (dst); \
duk_size_t duk__len = (len); \
DUK_ASSERT(duk__dst != NULL); \
(void) DUK_MEMZERO(duk__dst, (size_t) duk__len); \
} while (0)
-#define duk_memzero_unsafe(dst,len) do { \
+#define duk_memzero_unsafe(dst, len) \
+ do { \
void *duk__dst = (dst); \
duk_size_t duk__len = (len); \
DUK_ASSERT(duk__dst != NULL || duk__len == 0U); \
@@ -2930,10 +3105,10 @@ DUK_INTERNAL_DECL void duk_byteswap_bytes(duk_uint8_t *p, duk_small_uint_t len);
(void) DUK_MEMZERO(duk__dst, (size_t) duk__len); \
} \
} while (0)
-#endif /* DUK_USE_ALLOW_UNDEFINED_BEHAVIOR */
+#endif /* DUK_USE_ALLOW_UNDEFINED_BEHAVIOR */
-DUK_INTERNAL_DECL DUK_INLINE duk_small_int_t duk_memcmp(const void *s1, const void *s2, duk_size_t len);
-DUK_INTERNAL_DECL DUK_INLINE duk_small_int_t duk_memcmp_unsafe(const void *s1, const void *s2, duk_size_t len);
+DUK_INTERNAL_DECL duk_small_int_t duk_memcmp(const void *s1, const void *s2, duk_size_t len);
+DUK_INTERNAL_DECL duk_small_int_t duk_memcmp_unsafe(const void *s1, const void *s2, duk_size_t len);
DUK_INTERNAL_DECL duk_bool_t duk_is_whole_get_int32_nonegzero(duk_double_t x, duk_int32_t *ival);
DUK_INTERNAL_DECL duk_bool_t duk_is_whole_get_int32(duk_double_t x, duk_int32_t *ival);
@@ -2953,12 +3128,14 @@ DUK_INTERNAL_DECL duk_bool_t duk_double_is_finite(duk_double_t x);
DUK_INTERNAL_DECL duk_bool_t duk_double_is_integer(duk_double_t x);
DUK_INTERNAL_DECL duk_bool_t duk_double_is_safe_integer(duk_double_t x);
-DUK_INTERNAL_DECL DUK_INLINE duk_double_t duk_double_div(duk_double_t x, duk_double_t y);
+DUK_INTERNAL_DECL duk_double_t duk_double_div(duk_double_t x, duk_double_t y);
DUK_INTERNAL_DECL duk_int_t duk_double_to_int_t(duk_double_t x);
DUK_INTERNAL_DECL duk_uint_t duk_double_to_uint_t(duk_double_t x);
DUK_INTERNAL_DECL duk_int32_t duk_double_to_int32_t(duk_double_t x);
DUK_INTERNAL_DECL duk_uint32_t duk_double_to_uint32_t(duk_double_t x);
DUK_INTERNAL_DECL duk_float_t duk_double_to_float_t(duk_double_t x);
+DUK_INTERNAL_DECL duk_bool_t duk_double_equals(duk_double_t x, duk_double_t y);
+DUK_INTERNAL_DECL duk_bool_t duk_float_equals(duk_float_t x, duk_float_t y);
/*
* Miscellaneous
@@ -2974,10 +3151,9 @@ DUK_INTERNAL_DECL duk_float_t duk_double_to_float_t(duk_double_t x);
*
* However, incorrectly true for x == 0 so check for that explicitly.
*/
-#define DUK_IS_POWER_OF_TWO(x) \
- ((x) != 0U && ((x) & ((x) - 1U)) == 0U)
+#define DUK_IS_POWER_OF_TWO(x) ((x) != 0U && ((x) & ((x) -1U)) == 0U)
-#endif /* DUK_UTIL_H_INCLUDED */
+#endif /* DUK_UTIL_H_INCLUDED */
/* #include duk_strings.h */
/*
* Shared string macros.
@@ -3003,149 +3179,151 @@ DUK_INTERNAL_DECL duk_float_t duk_double_to_float_t(duk_double_t x);
#define DUK_ERRMSG_H_INCLUDED
/* Mostly API and built-in method related */
-#define DUK_STR_INTERNAL_ERROR "internal error"
-#define DUK_STR_UNSUPPORTED "unsupported"
-#define DUK_STR_INVALID_COUNT "invalid count"
-#define DUK_STR_INVALID_ARGS "invalid args"
-#define DUK_STR_INVALID_STATE "invalid state"
-#define DUK_STR_INVALID_INPUT "invalid input"
-#define DUK_STR_INVALID_LENGTH "invalid length"
-#define DUK_STR_NOT_CONSTRUCTABLE "not constructable"
-#define DUK_STR_CONSTRUCT_ONLY "constructor requires 'new'"
-#define DUK_STR_NOT_CALLABLE "not callable"
-#define DUK_STR_NOT_EXTENSIBLE "not extensible"
-#define DUK_STR_NOT_WRITABLE "not writable"
-#define DUK_STR_NOT_CONFIGURABLE "not configurable"
-#define DUK_STR_INVALID_CONTEXT "invalid context"
-#define DUK_STR_INVALID_INDEX "invalid args"
-#define DUK_STR_PUSH_BEYOND_ALLOC_STACK "cannot push beyond allocated stack"
-#define DUK_STR_NOT_UNDEFINED "unexpected type"
-#define DUK_STR_NOT_NULL "unexpected type"
-#define DUK_STR_NOT_BOOLEAN "unexpected type"
-#define DUK_STR_NOT_NUMBER "unexpected type"
-#define DUK_STR_NOT_STRING "unexpected type"
-#define DUK_STR_NOT_OBJECT "unexpected type"
-#define DUK_STR_NOT_POINTER "unexpected type"
-#define DUK_STR_NOT_BUFFER "not buffer" /* still in use with verbose messages */
-#define DUK_STR_UNEXPECTED_TYPE "unexpected type"
-#define DUK_STR_NOT_THREAD "unexpected type"
-#define DUK_STR_NOT_COMPFUNC "unexpected type"
-#define DUK_STR_NOT_NATFUNC "unexpected type"
-#define DUK_STR_NOT_C_FUNCTION "unexpected type"
-#define DUK_STR_NOT_FUNCTION "unexpected type"
-#define DUK_STR_NOT_REGEXP "unexpected type"
-#define DUK_STR_TOPRIMITIVE_FAILED "coercion to primitive failed"
-#define DUK_STR_NUMBER_OUTSIDE_RANGE "number outside range"
-#define DUK_STR_NOT_OBJECT_COERCIBLE "not object coercible"
-#define DUK_STR_CANNOT_NUMBER_COERCE_SYMBOL "cannot number coerce Symbol"
-#define DUK_STR_CANNOT_STRING_COERCE_SYMBOL "cannot string coerce Symbol"
-#define DUK_STR_STRING_TOO_LONG "string too long"
-#define DUK_STR_BUFFER_TOO_LONG "buffer too long"
-#define DUK_STR_ALLOC_FAILED "alloc failed"
-#define DUK_STR_WRONG_BUFFER_TYPE "wrong buffer type"
-#define DUK_STR_BASE64_ENCODE_FAILED "base64 encode failed"
-#define DUK_STR_SOURCE_DECODE_FAILED "source decode failed"
-#define DUK_STR_UTF8_DECODE_FAILED "utf-8 decode failed"
-#define DUK_STR_BASE64_DECODE_FAILED "base64 decode failed"
-#define DUK_STR_HEX_DECODE_FAILED "hex decode failed"
-#define DUK_STR_INVALID_BYTECODE "invalid bytecode"
-#define DUK_STR_NO_SOURCECODE "no sourcecode"
-#define DUK_STR_RESULT_TOO_LONG "result too long"
-#define DUK_STR_INVALID_CFUNC_RC "invalid C function rc"
-#define DUK_STR_INVALID_INSTANCEOF_RVAL "invalid instanceof rval"
-#define DUK_STR_INVALID_INSTANCEOF_RVAL_NOPROTO "instanceof rval has no .prototype"
+#define DUK_STR_INTERNAL_ERROR "internal error"
+#define DUK_STR_UNSUPPORTED "unsupported"
+#define DUK_STR_INVALID_COUNT "invalid count"
+#define DUK_STR_INVALID_ARGS "invalid args"
+#define DUK_STR_INVALID_STATE "invalid state"
+#define DUK_STR_INVALID_INPUT "invalid input"
+#define DUK_STR_INVALID_LENGTH "invalid length"
+#define DUK_STR_NOT_CONSTRUCTABLE "not constructable"
+#define DUK_STR_CONSTRUCT_ONLY "constructor requires 'new'"
+#define DUK_STR_NOT_CALLABLE "not callable"
+#define DUK_STR_NOT_EXTENSIBLE "not extensible"
+#define DUK_STR_NOT_WRITABLE "not writable"
+#define DUK_STR_NOT_CONFIGURABLE "not configurable"
+#define DUK_STR_INVALID_CONTEXT "invalid context"
+#define DUK_STR_INVALID_INDEX "invalid args"
+#define DUK_STR_PUSH_BEYOND_ALLOC_STACK "cannot push beyond allocated stack"
+#define DUK_STR_NOT_UNDEFINED "unexpected type"
+#define DUK_STR_NOT_NULL "unexpected type"
+#define DUK_STR_NOT_BOOLEAN "unexpected type"
+#define DUK_STR_NOT_NUMBER "unexpected type"
+#define DUK_STR_NOT_STRING "unexpected type"
+#define DUK_STR_NOT_OBJECT "unexpected type"
+#define DUK_STR_NOT_POINTER "unexpected type"
+#define DUK_STR_NOT_BUFFER "not buffer" /* still in use with verbose messages */
+#define DUK_STR_UNEXPECTED_TYPE "unexpected type"
+#define DUK_STR_NOT_THREAD "unexpected type"
+#define DUK_STR_NOT_COMPFUNC "unexpected type"
+#define DUK_STR_NOT_NATFUNC "unexpected type"
+#define DUK_STR_NOT_C_FUNCTION "unexpected type"
+#define DUK_STR_NOT_FUNCTION "unexpected type"
+#define DUK_STR_NOT_REGEXP "unexpected type"
+#define DUK_STR_TOPRIMITIVE_FAILED "coercion to primitive failed"
+#define DUK_STR_NUMBER_OUTSIDE_RANGE "number outside range"
+#define DUK_STR_NOT_OBJECT_COERCIBLE "not object coercible"
+#define DUK_STR_CANNOT_NUMBER_COERCE_SYMBOL "cannot number coerce Symbol"
+#define DUK_STR_CANNOT_STRING_COERCE_SYMBOL "cannot string coerce Symbol"
+#define DUK_STR_STRING_TOO_LONG "string too long"
+#define DUK_STR_BUFFER_TOO_LONG "buffer too long"
+#define DUK_STR_ALLOC_FAILED "alloc failed"
+#define DUK_STR_WRONG_BUFFER_TYPE "wrong buffer type"
+#define DUK_STR_BASE64_ENCODE_FAILED "base64 encode failed"
+#define DUK_STR_SOURCE_DECODE_FAILED "source decode failed"
+#define DUK_STR_UTF8_DECODE_FAILED "utf-8 decode failed"
+#define DUK_STR_BASE64_DECODE_FAILED "base64 decode failed"
+#define DUK_STR_HEX_DECODE_FAILED "hex decode failed"
+#define DUK_STR_INVALID_BYTECODE "invalid bytecode"
+#define DUK_STR_NO_SOURCECODE "no sourcecode"
+#define DUK_STR_RESULT_TOO_LONG "result too long"
+#define DUK_STR_INVALID_CFUNC_RC "invalid C function rc"
+#define DUK_STR_INVALID_INSTANCEOF_RVAL "invalid instanceof rval"
+#define DUK_STR_INVALID_INSTANCEOF_RVAL_NOPROTO "instanceof rval has no .prototype"
/* JSON */
-#define DUK_STR_FMT_PTR "%p"
-#define DUK_STR_FMT_INVALID_JSON "invalid json (at offset %ld)"
-#define DUK_STR_JSONDEC_RECLIMIT "json decode recursion limit"
-#define DUK_STR_JSONENC_RECLIMIT "json encode recursion limit"
-#define DUK_STR_CYCLIC_INPUT "cyclic input"
+#define DUK_STR_FMT_PTR "%p"
+#define DUK_STR_FMT_INVALID_JSON "invalid json (at offset %ld)"
+#define DUK_STR_CYCLIC_INPUT "cyclic input"
+
+/* Generic codec */
+#define DUK_STR_DEC_RECLIMIT "decode recursion limit"
+#define DUK_STR_ENC_RECLIMIT "encode recursion limit"
/* Object property access */
-#define DUK_STR_INVALID_BASE "invalid base value"
-#define DUK_STR_STRICT_CALLER_READ "cannot read strict 'caller'"
-#define DUK_STR_PROXY_REJECTED "proxy rejected"
-#define DUK_STR_INVALID_ARRAY_LENGTH "invalid array length"
-#define DUK_STR_SETTER_UNDEFINED "setter undefined"
-#define DUK_STR_INVALID_DESCRIPTOR "invalid descriptor"
+#define DUK_STR_INVALID_BASE "invalid base value"
+#define DUK_STR_STRICT_CALLER_READ "cannot read strict 'caller'"
+#define DUK_STR_PROXY_REJECTED "proxy rejected"
+#define DUK_STR_INVALID_ARRAY_LENGTH "invalid array length"
+#define DUK_STR_SETTER_UNDEFINED "setter undefined"
+#define DUK_STR_INVALID_DESCRIPTOR "invalid descriptor"
/* Proxy */
-#define DUK_STR_PROXY_REVOKED "proxy revoked"
-#define DUK_STR_INVALID_TRAP_RESULT "invalid trap result"
+#define DUK_STR_PROXY_REVOKED "proxy revoked"
+#define DUK_STR_INVALID_TRAP_RESULT "invalid trap result"
/* Variables */
/* Lexer */
-#define DUK_STR_INVALID_ESCAPE "invalid escape"
-#define DUK_STR_UNTERMINATED_STRING "unterminated string"
-#define DUK_STR_UNTERMINATED_COMMENT "unterminated comment"
-#define DUK_STR_UNTERMINATED_REGEXP "unterminated regexp"
-#define DUK_STR_TOKEN_LIMIT "token limit"
-#define DUK_STR_REGEXP_SUPPORT_DISABLED "regexp support disabled"
-#define DUK_STR_INVALID_NUMBER_LITERAL "invalid number literal"
-#define DUK_STR_INVALID_TOKEN "invalid token"
+#define DUK_STR_INVALID_ESCAPE "invalid escape"
+#define DUK_STR_UNTERMINATED_STRING "unterminated string"
+#define DUK_STR_UNTERMINATED_COMMENT "unterminated comment"
+#define DUK_STR_UNTERMINATED_REGEXP "unterminated regexp"
+#define DUK_STR_TOKEN_LIMIT "token limit"
+#define DUK_STR_REGEXP_SUPPORT_DISABLED "regexp support disabled"
+#define DUK_STR_INVALID_NUMBER_LITERAL "invalid number literal"
+#define DUK_STR_INVALID_TOKEN "invalid token"
/* Compiler */
-#define DUK_STR_PARSE_ERROR "parse error"
-#define DUK_STR_DUPLICATE_LABEL "duplicate label"
-#define DUK_STR_INVALID_LABEL "invalid label"
-#define DUK_STR_INVALID_ARRAY_LITERAL "invalid array literal"
-#define DUK_STR_INVALID_OBJECT_LITERAL "invalid object literal"
-#define DUK_STR_INVALID_VAR_DECLARATION "invalid variable declaration"
-#define DUK_STR_CANNOT_DELETE_IDENTIFIER "cannot delete identifier"
-#define DUK_STR_INVALID_EXPRESSION "invalid expression"
-#define DUK_STR_INVALID_LVALUE "invalid lvalue"
-#define DUK_STR_INVALID_NEWTARGET "invalid new.target"
-#define DUK_STR_EXPECTED_IDENTIFIER "expected identifier"
-#define DUK_STR_EMPTY_EXPR_NOT_ALLOWED "empty expression not allowed"
-#define DUK_STR_INVALID_FOR "invalid for statement"
-#define DUK_STR_INVALID_SWITCH "invalid switch statement"
-#define DUK_STR_INVALID_BREAK_CONT_LABEL "invalid break/continue label"
-#define DUK_STR_INVALID_RETURN "invalid return"
-#define DUK_STR_INVALID_TRY "invalid try"
-#define DUK_STR_INVALID_THROW "invalid throw"
-#define DUK_STR_WITH_IN_STRICT_MODE "with in strict mode"
-#define DUK_STR_FUNC_STMT_NOT_ALLOWED "function statement not allowed"
-#define DUK_STR_UNTERMINATED_STMT "unterminated statement"
-#define DUK_STR_INVALID_ARG_NAME "invalid argument name"
-#define DUK_STR_INVALID_FUNC_NAME "invalid function name"
-#define DUK_STR_INVALID_GETSET_NAME "invalid getter/setter name"
-#define DUK_STR_FUNC_NAME_REQUIRED "function name required"
+#define DUK_STR_PARSE_ERROR "parse error"
+#define DUK_STR_DUPLICATE_LABEL "duplicate label"
+#define DUK_STR_INVALID_LABEL "invalid label"
+#define DUK_STR_INVALID_ARRAY_LITERAL "invalid array literal"
+#define DUK_STR_INVALID_OBJECT_LITERAL "invalid object literal"
+#define DUK_STR_INVALID_VAR_DECLARATION "invalid variable declaration"
+#define DUK_STR_CANNOT_DELETE_IDENTIFIER "cannot delete identifier"
+#define DUK_STR_INVALID_EXPRESSION "invalid expression"
+#define DUK_STR_INVALID_LVALUE "invalid lvalue"
+#define DUK_STR_INVALID_NEWTARGET "invalid new.target"
+#define DUK_STR_EXPECTED_IDENTIFIER "expected identifier"
+#define DUK_STR_EMPTY_EXPR_NOT_ALLOWED "empty expression not allowed"
+#define DUK_STR_INVALID_FOR "invalid for statement"
+#define DUK_STR_INVALID_SWITCH "invalid switch statement"
+#define DUK_STR_INVALID_BREAK_CONT_LABEL "invalid break/continue label"
+#define DUK_STR_INVALID_RETURN "invalid return"
+#define DUK_STR_INVALID_TRY "invalid try"
+#define DUK_STR_INVALID_THROW "invalid throw"
+#define DUK_STR_WITH_IN_STRICT_MODE "with in strict mode"
+#define DUK_STR_FUNC_STMT_NOT_ALLOWED "function statement not allowed"
+#define DUK_STR_UNTERMINATED_STMT "unterminated statement"
+#define DUK_STR_INVALID_ARG_NAME "invalid argument name"
+#define DUK_STR_INVALID_FUNC_NAME "invalid function name"
+#define DUK_STR_INVALID_GETSET_NAME "invalid getter/setter name"
+#define DUK_STR_FUNC_NAME_REQUIRED "function name required"
/* RegExp */
-#define DUK_STR_INVALID_QUANTIFIER "invalid regexp quantifier"
-#define DUK_STR_INVALID_QUANTIFIER_NO_ATOM "quantifier without preceding atom"
-#define DUK_STR_INVALID_QUANTIFIER_VALUES "quantifier values invalid (qmin > qmax)"
-#define DUK_STR_QUANTIFIER_TOO_MANY_COPIES "quantifier requires too many atom copies"
-#define DUK_STR_UNEXPECTED_CLOSING_PAREN "unexpected closing parenthesis"
-#define DUK_STR_UNEXPECTED_END_OF_PATTERN "unexpected end of pattern"
-#define DUK_STR_UNEXPECTED_REGEXP_TOKEN "unexpected token in regexp"
-#define DUK_STR_INVALID_REGEXP_FLAGS "invalid regexp flags"
-#define DUK_STR_INVALID_REGEXP_ESCAPE "invalid regexp escape"
-#define DUK_STR_INVALID_BACKREFS "invalid backreference(s)"
-#define DUK_STR_INVALID_REGEXP_CHARACTER "invalid regexp character"
-#define DUK_STR_INVALID_REGEXP_GROUP "invalid regexp group"
-#define DUK_STR_UNTERMINATED_CHARCLASS "unterminated character class"
-#define DUK_STR_INVALID_RANGE "invalid range"
+#define DUK_STR_INVALID_QUANTIFIER "invalid regexp quantifier"
+#define DUK_STR_INVALID_QUANTIFIER_NO_ATOM "quantifier without preceding atom"
+#define DUK_STR_INVALID_QUANTIFIER_VALUES "quantifier values invalid (qmin > qmax)"
+#define DUK_STR_QUANTIFIER_TOO_MANY_COPIES "quantifier requires too many atom copies"
+#define DUK_STR_UNEXPECTED_CLOSING_PAREN "unexpected closing parenthesis"
+#define DUK_STR_UNEXPECTED_END_OF_PATTERN "unexpected end of pattern"
+#define DUK_STR_UNEXPECTED_REGEXP_TOKEN "unexpected token in regexp"
+#define DUK_STR_INVALID_REGEXP_FLAGS "invalid regexp flags"
+#define DUK_STR_INVALID_REGEXP_ESCAPE "invalid regexp escape"
+#define DUK_STR_INVALID_BACKREFS "invalid backreference(s)"
+#define DUK_STR_INVALID_REGEXP_CHARACTER "invalid regexp character"
+#define DUK_STR_INVALID_REGEXP_GROUP "invalid regexp group"
+#define DUK_STR_UNTERMINATED_CHARCLASS "unterminated character class"
+#define DUK_STR_INVALID_RANGE "invalid range"
/* Limits */
-#define DUK_STR_VALSTACK_LIMIT "valstack limit"
-#define DUK_STR_CALLSTACK_LIMIT "callstack limit"
-#define DUK_STR_PROTOTYPE_CHAIN_LIMIT "prototype chain limit"
-#define DUK_STR_BOUND_CHAIN_LIMIT "function call bound chain limit"
-#define DUK_STR_NATIVE_STACK_LIMIT "C stack depth limit"
-#define DUK_STR_COMPILER_RECURSION_LIMIT "compiler recursion limit"
-#define DUK_STR_BYTECODE_LIMIT "bytecode limit"
-#define DUK_STR_REG_LIMIT "register limit"
-#define DUK_STR_TEMP_LIMIT "temp limit"
-#define DUK_STR_CONST_LIMIT "const limit"
-#define DUK_STR_FUNC_LIMIT "function limit"
-#define DUK_STR_REGEXP_COMPILER_RECURSION_LIMIT "regexp compiler recursion limit"
-#define DUK_STR_REGEXP_EXECUTOR_RECURSION_LIMIT "regexp executor recursion limit"
-#define DUK_STR_REGEXP_EXECUTOR_STEP_LIMIT "regexp step limit"
-
-#endif /* DUK_ERRMSG_H_INCLUDED */
+#define DUK_STR_VALSTACK_LIMIT "valstack limit"
+#define DUK_STR_CALLSTACK_LIMIT "callstack limit"
+#define DUK_STR_PROTOTYPE_CHAIN_LIMIT "prototype chain limit"
+#define DUK_STR_BOUND_CHAIN_LIMIT "function call bound chain limit"
+#define DUK_STR_NATIVE_STACK_LIMIT "C stack depth limit"
+#define DUK_STR_COMPILER_RECURSION_LIMIT "compiler recursion limit"
+#define DUK_STR_BYTECODE_LIMIT "bytecode limit"
+#define DUK_STR_REG_LIMIT "register limit"
+#define DUK_STR_TEMP_LIMIT "temp limit"
+#define DUK_STR_CONST_LIMIT "const limit"
+#define DUK_STR_FUNC_LIMIT "function limit"
+#define DUK_STR_REGEXP_COMPILER_RECURSION_LIMIT "regexp compiler recursion limit"
+#define DUK_STR_REGEXP_EXECUTOR_RECURSION_LIMIT "regexp executor recursion limit"
+#define DUK_STR_REGEXP_EXECUTOR_STEP_LIMIT "regexp step limit"
+
+#endif /* DUK_ERRMSG_H_INCLUDED */
/* #include duk_js_bytecode.h */
/*
* ECMAScript bytecode
@@ -3232,403 +3410,394 @@ DUK_INTERNAL_DECL duk_float_t duk_double_to_float_t(duk_double_t x);
typedef duk_uint32_t duk_instr_t;
-#define DUK_BC_SHIFT_OP 0
-#define DUK_BC_SHIFT_A 8
-#define DUK_BC_SHIFT_B 16
-#define DUK_BC_SHIFT_C 24
-#define DUK_BC_SHIFT_BC DUK_BC_SHIFT_B
-#define DUK_BC_SHIFT_ABC DUK_BC_SHIFT_A
-
-#define DUK_BC_UNSHIFTED_MASK_OP 0xffUL
-#define DUK_BC_UNSHIFTED_MASK_A 0xffUL
-#define DUK_BC_UNSHIFTED_MASK_B 0xffUL
-#define DUK_BC_UNSHIFTED_MASK_C 0xffUL
-#define DUK_BC_UNSHIFTED_MASK_BC 0xffffUL
-#define DUK_BC_UNSHIFTED_MASK_ABC 0xffffffUL
-
-#define DUK_BC_SHIFTED_MASK_OP (DUK_BC_UNSHIFTED_MASK_OP << DUK_BC_SHIFT_OP)
-#define DUK_BC_SHIFTED_MASK_A (DUK_BC_UNSHIFTED_MASK_A << DUK_BC_SHIFT_A)
-#define DUK_BC_SHIFTED_MASK_B (DUK_BC_UNSHIFTED_MASK_B << DUK_BC_SHIFT_B)
-#define DUK_BC_SHIFTED_MASK_C (DUK_BC_UNSHIFTED_MASK_C << DUK_BC_SHIFT_C)
-#define DUK_BC_SHIFTED_MASK_BC (DUK_BC_UNSHIFTED_MASK_BC << DUK_BC_SHIFT_BC)
-#define DUK_BC_SHIFTED_MASK_ABC (DUK_BC_UNSHIFTED_MASK_ABC << DUK_BC_SHIFT_ABC)
-
-#define DUK_DEC_OP(x) ((x) & 0xffUL)
-#define DUK_DEC_A(x) (((x) >> 8) & 0xffUL)
-#define DUK_DEC_B(x) (((x) >> 16) & 0xffUL)
-#define DUK_DEC_C(x) (((x) >> 24) & 0xffUL)
-#define DUK_DEC_BC(x) (((x) >> 16) & 0xffffUL)
-#define DUK_DEC_ABC(x) (((x) >> 8) & 0xffffffUL)
-
-#define DUK_ENC_OP(op) ((duk_instr_t) (op))
-#define DUK_ENC_OP_ABC(op,abc) ((duk_instr_t) ( \
- (((duk_instr_t) (abc)) << 8) | \
- ((duk_instr_t) (op)) \
- ))
-#define DUK_ENC_OP_A_BC(op,a,bc) ((duk_instr_t) ( \
- (((duk_instr_t) (bc)) << 16) | \
- (((duk_instr_t) (a)) << 8) | \
- ((duk_instr_t) (op)) \
- ))
-#define DUK_ENC_OP_A_B_C(op,a,b,c) ((duk_instr_t) ( \
- (((duk_instr_t) (c)) << 24) | \
- (((duk_instr_t) (b)) << 16) | \
- (((duk_instr_t) (a)) << 8) | \
- ((duk_instr_t) (op)) \
- ))
-#define DUK_ENC_OP_A_B(op,a,b) DUK_ENC_OP_A_B_C((op),(a),(b),0)
-#define DUK_ENC_OP_A(op,a) DUK_ENC_OP_A_B_C((op),(a),0,0)
-#define DUK_ENC_OP_BC(op,bc) DUK_ENC_OP_A_BC((op),0,(bc))
+#define DUK_BC_SHIFT_OP 0
+#define DUK_BC_SHIFT_A 8
+#define DUK_BC_SHIFT_B 16
+#define DUK_BC_SHIFT_C 24
+#define DUK_BC_SHIFT_BC DUK_BC_SHIFT_B
+#define DUK_BC_SHIFT_ABC DUK_BC_SHIFT_A
+
+#define DUK_BC_UNSHIFTED_MASK_OP 0xffUL
+#define DUK_BC_UNSHIFTED_MASK_A 0xffUL
+#define DUK_BC_UNSHIFTED_MASK_B 0xffUL
+#define DUK_BC_UNSHIFTED_MASK_C 0xffUL
+#define DUK_BC_UNSHIFTED_MASK_BC 0xffffUL
+#define DUK_BC_UNSHIFTED_MASK_ABC 0xffffffUL
+
+#define DUK_BC_SHIFTED_MASK_OP (DUK_BC_UNSHIFTED_MASK_OP << DUK_BC_SHIFT_OP)
+#define DUK_BC_SHIFTED_MASK_A (DUK_BC_UNSHIFTED_MASK_A << DUK_BC_SHIFT_A)
+#define DUK_BC_SHIFTED_MASK_B (DUK_BC_UNSHIFTED_MASK_B << DUK_BC_SHIFT_B)
+#define DUK_BC_SHIFTED_MASK_C (DUK_BC_UNSHIFTED_MASK_C << DUK_BC_SHIFT_C)
+#define DUK_BC_SHIFTED_MASK_BC (DUK_BC_UNSHIFTED_MASK_BC << DUK_BC_SHIFT_BC)
+#define DUK_BC_SHIFTED_MASK_ABC (DUK_BC_UNSHIFTED_MASK_ABC << DUK_BC_SHIFT_ABC)
+
+#define DUK_DEC_OP(x) ((x) &0xffUL)
+#define DUK_DEC_A(x) (((x) >> 8) & 0xffUL)
+#define DUK_DEC_B(x) (((x) >> 16) & 0xffUL)
+#define DUK_DEC_C(x) (((x) >> 24) & 0xffUL)
+#define DUK_DEC_BC(x) (((x) >> 16) & 0xffffUL)
+#define DUK_DEC_ABC(x) (((x) >> 8) & 0xffffffUL)
+
+#define DUK_ENC_OP(op) ((duk_instr_t) (op))
+#define DUK_ENC_OP_ABC(op, abc) ((duk_instr_t) ((((duk_instr_t) (abc)) << 8) | ((duk_instr_t) (op))))
+#define DUK_ENC_OP_A_BC(op, a, bc) \
+ ((duk_instr_t) ((((duk_instr_t) (bc)) << 16) | (((duk_instr_t) (a)) << 8) | ((duk_instr_t) (op))))
+#define DUK_ENC_OP_A_B_C(op, a, b, c) \
+ ((duk_instr_t) ((((duk_instr_t) (c)) << 24) | (((duk_instr_t) (b)) << 16) | (((duk_instr_t) (a)) << 8) | \
+ ((duk_instr_t) (op))))
+#define DUK_ENC_OP_A_B(op, a, b) DUK_ENC_OP_A_B_C((op), (a), (b), 0)
+#define DUK_ENC_OP_A(op, a) DUK_ENC_OP_A_B_C((op), (a), 0, 0)
+#define DUK_ENC_OP_BC(op, bc) DUK_ENC_OP_A_BC((op), 0, (bc))
/* Get opcode base value with B/C reg/const flags cleared. */
-#define DUK_BC_NOREGCONST_OP(op) ((op) & 0xfc)
+#define DUK_BC_NOREGCONST_OP(op) ((op) &0xfc)
/* Constants should be signed so that signed arithmetic involving them
* won't cause values to be coerced accidentally to unsigned.
*/
-#define DUK_BC_OP_MIN 0
-#define DUK_BC_OP_MAX 0xffL
-#define DUK_BC_A_MIN 0
-#define DUK_BC_A_MAX 0xffL
-#define DUK_BC_B_MIN 0
-#define DUK_BC_B_MAX 0xffL
-#define DUK_BC_C_MIN 0
-#define DUK_BC_C_MAX 0xffL
-#define DUK_BC_BC_MIN 0
-#define DUK_BC_BC_MAX 0xffffL
-#define DUK_BC_ABC_MIN 0
-#define DUK_BC_ABC_MAX 0xffffffL
+#define DUK_BC_OP_MIN 0
+#define DUK_BC_OP_MAX 0xffL
+#define DUK_BC_A_MIN 0
+#define DUK_BC_A_MAX 0xffL
+#define DUK_BC_B_MIN 0
+#define DUK_BC_B_MAX 0xffL
+#define DUK_BC_C_MIN 0
+#define DUK_BC_C_MAX 0xffL
+#define DUK_BC_BC_MIN 0
+#define DUK_BC_BC_MAX 0xffffL
+#define DUK_BC_ABC_MIN 0
+#define DUK_BC_ABC_MAX 0xffffffL
/* Masks for B/C reg/const indicator in opcode field. */
-#define DUK_BC_REGCONST_B (0x01UL)
-#define DUK_BC_REGCONST_C (0x02UL)
+#define DUK_BC_REGCONST_B (0x01UL)
+#define DUK_BC_REGCONST_C (0x02UL)
/* Misc. masks for opcode field. */
-#define DUK_BC_INCDECP_FLAG_DEC (0x04UL)
-#define DUK_BC_INCDECP_FLAG_POST (0x08UL)
+#define DUK_BC_INCDECP_FLAG_DEC (0x04UL)
+#define DUK_BC_INCDECP_FLAG_POST (0x08UL)
/* Opcodes. */
-#define DUK_OP_LDREG 0
-#define DUK_OP_STREG 1
-#define DUK_OP_JUMP 2
-#define DUK_OP_LDCONST 3
-#define DUK_OP_LDINT 4
-#define DUK_OP_LDINTX 5
-#define DUK_OP_LDTHIS 6
-#define DUK_OP_LDUNDEF 7
-#define DUK_OP_LDNULL 8
-#define DUK_OP_LDTRUE 9
-#define DUK_OP_LDFALSE 10
-#define DUK_OP_GETVAR 11
-#define DUK_OP_BNOT 12
-#define DUK_OP_LNOT 13
-#define DUK_OP_UNM 14
-#define DUK_OP_UNP 15
-#define DUK_OP_EQ 16
-#define DUK_OP_EQ_RR 16
-#define DUK_OP_EQ_CR 17
-#define DUK_OP_EQ_RC 18
-#define DUK_OP_EQ_CC 19
-#define DUK_OP_NEQ 20
-#define DUK_OP_NEQ_RR 20
-#define DUK_OP_NEQ_CR 21
-#define DUK_OP_NEQ_RC 22
-#define DUK_OP_NEQ_CC 23
-#define DUK_OP_SEQ 24
-#define DUK_OP_SEQ_RR 24
-#define DUK_OP_SEQ_CR 25
-#define DUK_OP_SEQ_RC 26
-#define DUK_OP_SEQ_CC 27
-#define DUK_OP_SNEQ 28
-#define DUK_OP_SNEQ_RR 28
-#define DUK_OP_SNEQ_CR 29
-#define DUK_OP_SNEQ_RC 30
-#define DUK_OP_SNEQ_CC 31
-#define DUK_OP_GT 32
-#define DUK_OP_GT_RR 32
-#define DUK_OP_GT_CR 33
-#define DUK_OP_GT_RC 34
-#define DUK_OP_GT_CC 35
-#define DUK_OP_GE 36
-#define DUK_OP_GE_RR 36
-#define DUK_OP_GE_CR 37
-#define DUK_OP_GE_RC 38
-#define DUK_OP_GE_CC 39
-#define DUK_OP_LT 40
-#define DUK_OP_LT_RR 40
-#define DUK_OP_LT_CR 41
-#define DUK_OP_LT_RC 42
-#define DUK_OP_LT_CC 43
-#define DUK_OP_LE 44
-#define DUK_OP_LE_RR 44
-#define DUK_OP_LE_CR 45
-#define DUK_OP_LE_RC 46
-#define DUK_OP_LE_CC 47
-#define DUK_OP_IFTRUE 48
-#define DUK_OP_IFTRUE_R 48
-#define DUK_OP_IFTRUE_C 49
-#define DUK_OP_IFFALSE 50
-#define DUK_OP_IFFALSE_R 50
-#define DUK_OP_IFFALSE_C 51
-#define DUK_OP_ADD 52
-#define DUK_OP_ADD_RR 52
-#define DUK_OP_ADD_CR 53
-#define DUK_OP_ADD_RC 54
-#define DUK_OP_ADD_CC 55
-#define DUK_OP_SUB 56
-#define DUK_OP_SUB_RR 56
-#define DUK_OP_SUB_CR 57
-#define DUK_OP_SUB_RC 58
-#define DUK_OP_SUB_CC 59
-#define DUK_OP_MUL 60
-#define DUK_OP_MUL_RR 60
-#define DUK_OP_MUL_CR 61
-#define DUK_OP_MUL_RC 62
-#define DUK_OP_MUL_CC 63
-#define DUK_OP_DIV 64
-#define DUK_OP_DIV_RR 64
-#define DUK_OP_DIV_CR 65
-#define DUK_OP_DIV_RC 66
-#define DUK_OP_DIV_CC 67
-#define DUK_OP_MOD 68
-#define DUK_OP_MOD_RR 68
-#define DUK_OP_MOD_CR 69
-#define DUK_OP_MOD_RC 70
-#define DUK_OP_MOD_CC 71
-#define DUK_OP_EXP 72
-#define DUK_OP_EXP_RR 72
-#define DUK_OP_EXP_CR 73
-#define DUK_OP_EXP_RC 74
-#define DUK_OP_EXP_CC 75
-#define DUK_OP_BAND 76
-#define DUK_OP_BAND_RR 76
-#define DUK_OP_BAND_CR 77
-#define DUK_OP_BAND_RC 78
-#define DUK_OP_BAND_CC 79
-#define DUK_OP_BOR 80
-#define DUK_OP_BOR_RR 80
-#define DUK_OP_BOR_CR 81
-#define DUK_OP_BOR_RC 82
-#define DUK_OP_BOR_CC 83
-#define DUK_OP_BXOR 84
-#define DUK_OP_BXOR_RR 84
-#define DUK_OP_BXOR_CR 85
-#define DUK_OP_BXOR_RC 86
-#define DUK_OP_BXOR_CC 87
-#define DUK_OP_BASL 88
-#define DUK_OP_BASL_RR 88
-#define DUK_OP_BASL_CR 89
-#define DUK_OP_BASL_RC 90
-#define DUK_OP_BASL_CC 91
-#define DUK_OP_BLSR 92
-#define DUK_OP_BLSR_RR 92
-#define DUK_OP_BLSR_CR 93
-#define DUK_OP_BLSR_RC 94
-#define DUK_OP_BLSR_CC 95
-#define DUK_OP_BASR 96
-#define DUK_OP_BASR_RR 96
-#define DUK_OP_BASR_CR 97
-#define DUK_OP_BASR_RC 98
-#define DUK_OP_BASR_CC 99
-#define DUK_OP_INSTOF 100
-#define DUK_OP_INSTOF_RR 100
-#define DUK_OP_INSTOF_CR 101
-#define DUK_OP_INSTOF_RC 102
-#define DUK_OP_INSTOF_CC 103
-#define DUK_OP_IN 104
-#define DUK_OP_IN_RR 104
-#define DUK_OP_IN_CR 105
-#define DUK_OP_IN_RC 106
-#define DUK_OP_IN_CC 107
-#define DUK_OP_GETPROP 108
-#define DUK_OP_GETPROP_RR 108
-#define DUK_OP_GETPROP_CR 109
-#define DUK_OP_GETPROP_RC 110
-#define DUK_OP_GETPROP_CC 111
-#define DUK_OP_PUTPROP 112
-#define DUK_OP_PUTPROP_RR 112
-#define DUK_OP_PUTPROP_CR 113
-#define DUK_OP_PUTPROP_RC 114
-#define DUK_OP_PUTPROP_CC 115
-#define DUK_OP_DELPROP 116
-#define DUK_OP_DELPROP_RR 116
-#define DUK_OP_DELPROP_CR_UNUSED 117 /* unused now */
-#define DUK_OP_DELPROP_RC 118
-#define DUK_OP_DELPROP_CC_UNUSED 119 /* unused now */
-#define DUK_OP_PREINCR 120 /* pre/post opcode values have constraints, */
-#define DUK_OP_PREDECR 121 /* see duk_js_executor.c and duk_js_compiler.c. */
-#define DUK_OP_POSTINCR 122
-#define DUK_OP_POSTDECR 123
-#define DUK_OP_PREINCV 124
-#define DUK_OP_PREDECV 125
-#define DUK_OP_POSTINCV 126
-#define DUK_OP_POSTDECV 127
-#define DUK_OP_PREINCP 128 /* pre/post inc/dec prop opcodes have constraints */
-#define DUK_OP_PREINCP_RR 128
-#define DUK_OP_PREINCP_CR 129
-#define DUK_OP_PREINCP_RC 130
-#define DUK_OP_PREINCP_CC 131
-#define DUK_OP_PREDECP 132
-#define DUK_OP_PREDECP_RR 132
-#define DUK_OP_PREDECP_CR 133
-#define DUK_OP_PREDECP_RC 134
-#define DUK_OP_PREDECP_CC 135
-#define DUK_OP_POSTINCP 136
-#define DUK_OP_POSTINCP_RR 136
-#define DUK_OP_POSTINCP_CR 137
-#define DUK_OP_POSTINCP_RC 138
-#define DUK_OP_POSTINCP_CC 139
-#define DUK_OP_POSTDECP 140
-#define DUK_OP_POSTDECP_RR 140
-#define DUK_OP_POSTDECP_CR 141
-#define DUK_OP_POSTDECP_RC 142
-#define DUK_OP_POSTDECP_CC 143
-#define DUK_OP_DECLVAR 144
-#define DUK_OP_DECLVAR_RR 144
-#define DUK_OP_DECLVAR_CR 145
-#define DUK_OP_DECLVAR_RC 146
-#define DUK_OP_DECLVAR_CC 147
-#define DUK_OP_REGEXP 148
-#define DUK_OP_REGEXP_RR 148
-#define DUK_OP_REGEXP_CR 149
-#define DUK_OP_REGEXP_RC 150
-#define DUK_OP_REGEXP_CC 151
-#define DUK_OP_CLOSURE 152
-#define DUK_OP_TYPEOF 153
-#define DUK_OP_TYPEOFID 154
-#define DUK_OP_PUTVAR 155
-#define DUK_OP_DELVAR 156
-#define DUK_OP_RETREG 157
-#define DUK_OP_RETUNDEF 158
-#define DUK_OP_RETCONST 159
-#define DUK_OP_RETCONSTN 160 /* return const without incref (e.g. number) */
-#define DUK_OP_LABEL 161
-#define DUK_OP_ENDLABEL 162
-#define DUK_OP_BREAK 163
-#define DUK_OP_CONTINUE 164
-#define DUK_OP_TRYCATCH 165
-#define DUK_OP_ENDTRY 166
-#define DUK_OP_ENDCATCH 167
-#define DUK_OP_ENDFIN 168
-#define DUK_OP_THROW 169
-#define DUK_OP_INVLHS 170
-#define DUK_OP_CSREG 171
-#define DUK_OP_CSVAR 172
-#define DUK_OP_CSVAR_RR 172
-#define DUK_OP_CSVAR_CR 173
-#define DUK_OP_CSVAR_RC 174
-#define DUK_OP_CSVAR_CC 175
-#define DUK_OP_CALL0 176 /* DUK_OP_CALL0 & 0x0F must be zero. */
-#define DUK_OP_CALL1 177
-#define DUK_OP_CALL2 178
-#define DUK_OP_CALL3 179
-#define DUK_OP_CALL4 180
-#define DUK_OP_CALL5 181
-#define DUK_OP_CALL6 182
-#define DUK_OP_CALL7 183
-#define DUK_OP_CALL8 184
-#define DUK_OP_CALL9 185
-#define DUK_OP_CALL10 186
-#define DUK_OP_CALL11 187
-#define DUK_OP_CALL12 188
-#define DUK_OP_CALL13 189
-#define DUK_OP_CALL14 190
-#define DUK_OP_CALL15 191
-#define DUK_OP_NEWOBJ 192
-#define DUK_OP_NEWARR 193
-#define DUK_OP_MPUTOBJ 194
-#define DUK_OP_MPUTOBJI 195
-#define DUK_OP_INITSET 196
-#define DUK_OP_INITGET 197
-#define DUK_OP_MPUTARR 198
-#define DUK_OP_MPUTARRI 199
-#define DUK_OP_SETALEN 200
-#define DUK_OP_INITENUM 201
-#define DUK_OP_NEXTENUM 202
-#define DUK_OP_NEWTARGET 203
-#define DUK_OP_DEBUGGER 204
-#define DUK_OP_NOP 205
-#define DUK_OP_INVALID 206
-#define DUK_OP_UNUSED207 207
-#define DUK_OP_GETPROPC 208
-#define DUK_OP_GETPROPC_RR 208
-#define DUK_OP_GETPROPC_CR 209
-#define DUK_OP_GETPROPC_RC 210
-#define DUK_OP_GETPROPC_CC 211
-#define DUK_OP_UNUSED212 212
-#define DUK_OP_UNUSED213 213
-#define DUK_OP_UNUSED214 214
-#define DUK_OP_UNUSED215 215
-#define DUK_OP_UNUSED216 216
-#define DUK_OP_UNUSED217 217
-#define DUK_OP_UNUSED218 218
-#define DUK_OP_UNUSED219 219
-#define DUK_OP_UNUSED220 220
-#define DUK_OP_UNUSED221 221
-#define DUK_OP_UNUSED222 222
-#define DUK_OP_UNUSED223 223
-#define DUK_OP_UNUSED224 224
-#define DUK_OP_UNUSED225 225
-#define DUK_OP_UNUSED226 226
-#define DUK_OP_UNUSED227 227
-#define DUK_OP_UNUSED228 228
-#define DUK_OP_UNUSED229 229
-#define DUK_OP_UNUSED230 230
-#define DUK_OP_UNUSED231 231
-#define DUK_OP_UNUSED232 232
-#define DUK_OP_UNUSED233 233
-#define DUK_OP_UNUSED234 234
-#define DUK_OP_UNUSED235 235
-#define DUK_OP_UNUSED236 236
-#define DUK_OP_UNUSED237 237
-#define DUK_OP_UNUSED238 238
-#define DUK_OP_UNUSED239 239
-#define DUK_OP_UNUSED240 240
-#define DUK_OP_UNUSED241 241
-#define DUK_OP_UNUSED242 242
-#define DUK_OP_UNUSED243 243
-#define DUK_OP_UNUSED244 244
-#define DUK_OP_UNUSED245 245
-#define DUK_OP_UNUSED246 246
-#define DUK_OP_UNUSED247 247
-#define DUK_OP_UNUSED248 248
-#define DUK_OP_UNUSED249 249
-#define DUK_OP_UNUSED250 250
-#define DUK_OP_UNUSED251 251
-#define DUK_OP_UNUSED252 252
-#define DUK_OP_UNUSED253 253
-#define DUK_OP_UNUSED254 254
-#define DUK_OP_UNUSED255 255
-#define DUK_OP_NONE 256 /* dummy value used as marker (doesn't fit in 8-bit field) */
+#define DUK_OP_LDREG 0
+#define DUK_OP_STREG 1
+#define DUK_OP_JUMP 2
+#define DUK_OP_LDCONST 3
+#define DUK_OP_LDINT 4
+#define DUK_OP_LDINTX 5
+#define DUK_OP_LDTHIS 6
+#define DUK_OP_LDUNDEF 7
+#define DUK_OP_LDNULL 8
+#define DUK_OP_LDTRUE 9
+#define DUK_OP_LDFALSE 10
+#define DUK_OP_GETVAR 11
+#define DUK_OP_BNOT 12
+#define DUK_OP_LNOT 13
+#define DUK_OP_UNM 14
+#define DUK_OP_UNP 15
+#define DUK_OP_EQ 16
+#define DUK_OP_EQ_RR 16
+#define DUK_OP_EQ_CR 17
+#define DUK_OP_EQ_RC 18
+#define DUK_OP_EQ_CC 19
+#define DUK_OP_NEQ 20
+#define DUK_OP_NEQ_RR 20
+#define DUK_OP_NEQ_CR 21
+#define DUK_OP_NEQ_RC 22
+#define DUK_OP_NEQ_CC 23
+#define DUK_OP_SEQ 24
+#define DUK_OP_SEQ_RR 24
+#define DUK_OP_SEQ_CR 25
+#define DUK_OP_SEQ_RC 26
+#define DUK_OP_SEQ_CC 27
+#define DUK_OP_SNEQ 28
+#define DUK_OP_SNEQ_RR 28
+#define DUK_OP_SNEQ_CR 29
+#define DUK_OP_SNEQ_RC 30
+#define DUK_OP_SNEQ_CC 31
+#define DUK_OP_GT 32
+#define DUK_OP_GT_RR 32
+#define DUK_OP_GT_CR 33
+#define DUK_OP_GT_RC 34
+#define DUK_OP_GT_CC 35
+#define DUK_OP_GE 36
+#define DUK_OP_GE_RR 36
+#define DUK_OP_GE_CR 37
+#define DUK_OP_GE_RC 38
+#define DUK_OP_GE_CC 39
+#define DUK_OP_LT 40
+#define DUK_OP_LT_RR 40
+#define DUK_OP_LT_CR 41
+#define DUK_OP_LT_RC 42
+#define DUK_OP_LT_CC 43
+#define DUK_OP_LE 44
+#define DUK_OP_LE_RR 44
+#define DUK_OP_LE_CR 45
+#define DUK_OP_LE_RC 46
+#define DUK_OP_LE_CC 47
+#define DUK_OP_IFTRUE 48
+#define DUK_OP_IFTRUE_R 48
+#define DUK_OP_IFTRUE_C 49
+#define DUK_OP_IFFALSE 50
+#define DUK_OP_IFFALSE_R 50
+#define DUK_OP_IFFALSE_C 51
+#define DUK_OP_ADD 52
+#define DUK_OP_ADD_RR 52
+#define DUK_OP_ADD_CR 53
+#define DUK_OP_ADD_RC 54
+#define DUK_OP_ADD_CC 55
+#define DUK_OP_SUB 56
+#define DUK_OP_SUB_RR 56
+#define DUK_OP_SUB_CR 57
+#define DUK_OP_SUB_RC 58
+#define DUK_OP_SUB_CC 59
+#define DUK_OP_MUL 60
+#define DUK_OP_MUL_RR 60
+#define DUK_OP_MUL_CR 61
+#define DUK_OP_MUL_RC 62
+#define DUK_OP_MUL_CC 63
+#define DUK_OP_DIV 64
+#define DUK_OP_DIV_RR 64
+#define DUK_OP_DIV_CR 65
+#define DUK_OP_DIV_RC 66
+#define DUK_OP_DIV_CC 67
+#define DUK_OP_MOD 68
+#define DUK_OP_MOD_RR 68
+#define DUK_OP_MOD_CR 69
+#define DUK_OP_MOD_RC 70
+#define DUK_OP_MOD_CC 71
+#define DUK_OP_EXP 72
+#define DUK_OP_EXP_RR 72
+#define DUK_OP_EXP_CR 73
+#define DUK_OP_EXP_RC 74
+#define DUK_OP_EXP_CC 75
+#define DUK_OP_BAND 76
+#define DUK_OP_BAND_RR 76
+#define DUK_OP_BAND_CR 77
+#define DUK_OP_BAND_RC 78
+#define DUK_OP_BAND_CC 79
+#define DUK_OP_BOR 80
+#define DUK_OP_BOR_RR 80
+#define DUK_OP_BOR_CR 81
+#define DUK_OP_BOR_RC 82
+#define DUK_OP_BOR_CC 83
+#define DUK_OP_BXOR 84
+#define DUK_OP_BXOR_RR 84
+#define DUK_OP_BXOR_CR 85
+#define DUK_OP_BXOR_RC 86
+#define DUK_OP_BXOR_CC 87
+#define DUK_OP_BASL 88
+#define DUK_OP_BASL_RR 88
+#define DUK_OP_BASL_CR 89
+#define DUK_OP_BASL_RC 90
+#define DUK_OP_BASL_CC 91
+#define DUK_OP_BLSR 92
+#define DUK_OP_BLSR_RR 92
+#define DUK_OP_BLSR_CR 93
+#define DUK_OP_BLSR_RC 94
+#define DUK_OP_BLSR_CC 95
+#define DUK_OP_BASR 96
+#define DUK_OP_BASR_RR 96
+#define DUK_OP_BASR_CR 97
+#define DUK_OP_BASR_RC 98
+#define DUK_OP_BASR_CC 99
+#define DUK_OP_INSTOF 100
+#define DUK_OP_INSTOF_RR 100
+#define DUK_OP_INSTOF_CR 101
+#define DUK_OP_INSTOF_RC 102
+#define DUK_OP_INSTOF_CC 103
+#define DUK_OP_IN 104
+#define DUK_OP_IN_RR 104
+#define DUK_OP_IN_CR 105
+#define DUK_OP_IN_RC 106
+#define DUK_OP_IN_CC 107
+#define DUK_OP_GETPROP 108
+#define DUK_OP_GETPROP_RR 108
+#define DUK_OP_GETPROP_CR 109
+#define DUK_OP_GETPROP_RC 110
+#define DUK_OP_GETPROP_CC 111
+#define DUK_OP_PUTPROP 112
+#define DUK_OP_PUTPROP_RR 112
+#define DUK_OP_PUTPROP_CR 113
+#define DUK_OP_PUTPROP_RC 114
+#define DUK_OP_PUTPROP_CC 115
+#define DUK_OP_DELPROP 116
+#define DUK_OP_DELPROP_RR 116
+#define DUK_OP_DELPROP_CR_UNUSED 117 /* unused now */
+#define DUK_OP_DELPROP_RC 118
+#define DUK_OP_DELPROP_CC_UNUSED 119 /* unused now */
+#define DUK_OP_PREINCR 120 /* pre/post opcode values have constraints, */
+#define DUK_OP_PREDECR 121 /* see duk_js_executor.c and duk_js_compiler.c. */
+#define DUK_OP_POSTINCR 122
+#define DUK_OP_POSTDECR 123
+#define DUK_OP_PREINCV 124
+#define DUK_OP_PREDECV 125
+#define DUK_OP_POSTINCV 126
+#define DUK_OP_POSTDECV 127
+#define DUK_OP_PREINCP 128 /* pre/post inc/dec prop opcodes have constraints */
+#define DUK_OP_PREINCP_RR 128
+#define DUK_OP_PREINCP_CR 129
+#define DUK_OP_PREINCP_RC 130
+#define DUK_OP_PREINCP_CC 131
+#define DUK_OP_PREDECP 132
+#define DUK_OP_PREDECP_RR 132
+#define DUK_OP_PREDECP_CR 133
+#define DUK_OP_PREDECP_RC 134
+#define DUK_OP_PREDECP_CC 135
+#define DUK_OP_POSTINCP 136
+#define DUK_OP_POSTINCP_RR 136
+#define DUK_OP_POSTINCP_CR 137
+#define DUK_OP_POSTINCP_RC 138
+#define DUK_OP_POSTINCP_CC 139
+#define DUK_OP_POSTDECP 140
+#define DUK_OP_POSTDECP_RR 140
+#define DUK_OP_POSTDECP_CR 141
+#define DUK_OP_POSTDECP_RC 142
+#define DUK_OP_POSTDECP_CC 143
+#define DUK_OP_DECLVAR 144
+#define DUK_OP_DECLVAR_RR 144
+#define DUK_OP_DECLVAR_CR 145
+#define DUK_OP_DECLVAR_RC 146
+#define DUK_OP_DECLVAR_CC 147
+#define DUK_OP_REGEXP 148
+#define DUK_OP_REGEXP_RR 148
+#define DUK_OP_REGEXP_CR 149
+#define DUK_OP_REGEXP_RC 150
+#define DUK_OP_REGEXP_CC 151
+#define DUK_OP_CLOSURE 152
+#define DUK_OP_TYPEOF 153
+#define DUK_OP_TYPEOFID 154
+#define DUK_OP_PUTVAR 155
+#define DUK_OP_DELVAR 156
+#define DUK_OP_RETREG 157
+#define DUK_OP_RETUNDEF 158
+#define DUK_OP_RETCONST 159
+#define DUK_OP_RETCONSTN 160 /* return const without incref (e.g. number) */
+#define DUK_OP_LABEL 161
+#define DUK_OP_ENDLABEL 162
+#define DUK_OP_BREAK 163
+#define DUK_OP_CONTINUE 164
+#define DUK_OP_TRYCATCH 165
+#define DUK_OP_ENDTRY 166
+#define DUK_OP_ENDCATCH 167
+#define DUK_OP_ENDFIN 168
+#define DUK_OP_THROW 169
+#define DUK_OP_INVLHS 170
+#define DUK_OP_CSREG 171
+#define DUK_OP_CSVAR 172
+#define DUK_OP_CSVAR_RR 172
+#define DUK_OP_CSVAR_CR 173
+#define DUK_OP_CSVAR_RC 174
+#define DUK_OP_CSVAR_CC 175
+#define DUK_OP_CALL0 176 /* DUK_OP_CALL0 & 0x0F must be zero. */
+#define DUK_OP_CALL1 177
+#define DUK_OP_CALL2 178
+#define DUK_OP_CALL3 179
+#define DUK_OP_CALL4 180
+#define DUK_OP_CALL5 181
+#define DUK_OP_CALL6 182
+#define DUK_OP_CALL7 183
+#define DUK_OP_CALL8 184
+#define DUK_OP_CALL9 185
+#define DUK_OP_CALL10 186
+#define DUK_OP_CALL11 187
+#define DUK_OP_CALL12 188
+#define DUK_OP_CALL13 189
+#define DUK_OP_CALL14 190
+#define DUK_OP_CALL15 191
+#define DUK_OP_NEWOBJ 192
+#define DUK_OP_NEWARR 193
+#define DUK_OP_MPUTOBJ 194
+#define DUK_OP_MPUTOBJI 195
+#define DUK_OP_INITSET 196
+#define DUK_OP_INITGET 197
+#define DUK_OP_MPUTARR 198
+#define DUK_OP_MPUTARRI 199
+#define DUK_OP_SETALEN 200
+#define DUK_OP_INITENUM 201
+#define DUK_OP_NEXTENUM 202
+#define DUK_OP_NEWTARGET 203
+#define DUK_OP_DEBUGGER 204
+#define DUK_OP_NOP 205
+#define DUK_OP_INVALID 206
+#define DUK_OP_UNUSED207 207
+#define DUK_OP_GETPROPC 208
+#define DUK_OP_GETPROPC_RR 208
+#define DUK_OP_GETPROPC_CR 209
+#define DUK_OP_GETPROPC_RC 210
+#define DUK_OP_GETPROPC_CC 211
+#define DUK_OP_UNUSED212 212
+#define DUK_OP_UNUSED213 213
+#define DUK_OP_UNUSED214 214
+#define DUK_OP_UNUSED215 215
+#define DUK_OP_UNUSED216 216
+#define DUK_OP_UNUSED217 217
+#define DUK_OP_UNUSED218 218
+#define DUK_OP_UNUSED219 219
+#define DUK_OP_UNUSED220 220
+#define DUK_OP_UNUSED221 221
+#define DUK_OP_UNUSED222 222
+#define DUK_OP_UNUSED223 223
+#define DUK_OP_UNUSED224 224
+#define DUK_OP_UNUSED225 225
+#define DUK_OP_UNUSED226 226
+#define DUK_OP_UNUSED227 227
+#define DUK_OP_UNUSED228 228
+#define DUK_OP_UNUSED229 229
+#define DUK_OP_UNUSED230 230
+#define DUK_OP_UNUSED231 231
+#define DUK_OP_UNUSED232 232
+#define DUK_OP_UNUSED233 233
+#define DUK_OP_UNUSED234 234
+#define DUK_OP_UNUSED235 235
+#define DUK_OP_UNUSED236 236
+#define DUK_OP_UNUSED237 237
+#define DUK_OP_UNUSED238 238
+#define DUK_OP_UNUSED239 239
+#define DUK_OP_UNUSED240 240
+#define DUK_OP_UNUSED241 241
+#define DUK_OP_UNUSED242 242
+#define DUK_OP_UNUSED243 243
+#define DUK_OP_UNUSED244 244
+#define DUK_OP_UNUSED245 245
+#define DUK_OP_UNUSED246 246
+#define DUK_OP_UNUSED247 247
+#define DUK_OP_UNUSED248 248
+#define DUK_OP_UNUSED249 249
+#define DUK_OP_UNUSED250 250
+#define DUK_OP_UNUSED251 251
+#define DUK_OP_UNUSED252 252
+#define DUK_OP_UNUSED253 253
+#define DUK_OP_UNUSED254 254
+#define DUK_OP_UNUSED255 255
+#define DUK_OP_NONE 256 /* dummy value used as marker (doesn't fit in 8-bit field) */
/* XXX: Allocate flags from opcode field? Would take 16 opcode slots
* but avoids shuffling in more cases. Maybe not worth it.
*/
/* DUK_OP_TRYCATCH flags in A. */
-#define DUK_BC_TRYCATCH_FLAG_HAVE_CATCH (1U << 0)
-#define DUK_BC_TRYCATCH_FLAG_HAVE_FINALLY (1U << 1)
-#define DUK_BC_TRYCATCH_FLAG_CATCH_BINDING (1U << 2)
-#define DUK_BC_TRYCATCH_FLAG_WITH_BINDING (1U << 3)
+#define DUK_BC_TRYCATCH_FLAG_HAVE_CATCH (1U << 0)
+#define DUK_BC_TRYCATCH_FLAG_HAVE_FINALLY (1U << 1)
+#define DUK_BC_TRYCATCH_FLAG_CATCH_BINDING (1U << 2)
+#define DUK_BC_TRYCATCH_FLAG_WITH_BINDING (1U << 3)
/* DUK_OP_DECLVAR flags in A; bottom bits are reserved for propdesc flags
* (DUK_PROPDESC_FLAG_XXX).
*/
-#define DUK_BC_DECLVAR_FLAG_FUNC_DECL (1U << 4) /* function declaration */
+#define DUK_BC_DECLVAR_FLAG_FUNC_DECL (1U << 4) /* function declaration */
/* DUK_OP_CALLn flags, part of opcode field. Three lowest bits must match
* DUK_CALL_FLAG_xxx directly.
*/
-#define DUK_BC_CALL_FLAG_TAILCALL (1U << 0)
-#define DUK_BC_CALL_FLAG_CONSTRUCT (1U << 1)
-#define DUK_BC_CALL_FLAG_CALLED_AS_EVAL (1U << 2)
-#define DUK_BC_CALL_FLAG_INDIRECT (1U << 3)
+#define DUK_BC_CALL_FLAG_TAILCALL (1U << 0)
+#define DUK_BC_CALL_FLAG_CONSTRUCT (1U << 1)
+#define DUK_BC_CALL_FLAG_CALLED_AS_EVAL (1U << 2)
+#define DUK_BC_CALL_FLAG_INDIRECT (1U << 3)
/* Misc constants and helper macros. */
-#define DUK_BC_LDINT_BIAS (1L << 15)
-#define DUK_BC_LDINTX_SHIFT 16
-#define DUK_BC_JUMP_BIAS (1L << 23)
+#define DUK_BC_LDINT_BIAS (1L << 15)
+#define DUK_BC_LDINTX_SHIFT 16
+#define DUK_BC_JUMP_BIAS (1L << 23)
-#endif /* DUK_JS_BYTECODE_H_INCLUDED */
+#endif /* DUK_JS_BYTECODE_H_INCLUDED */
/* #include duk_lexer.h */
/*
* Lexer defines.
@@ -3658,156 +3827,156 @@ typedef void (*duk_re_range_callback)(void *user, duk_codepoint_t r1, duk_codepo
* in a continuous range and in a particular order. See genstrings.py.
*/
-#define DUK_LEXER_INITCTX(ctx) duk_lexer_initctx((ctx))
+#define DUK_LEXER_INITCTX(ctx) duk_lexer_initctx((ctx))
-#define DUK_LEXER_SETPOINT(ctx,pt) duk_lexer_setpoint((ctx), (pt))
+#define DUK_LEXER_SETPOINT(ctx, pt) duk_lexer_setpoint((ctx), (pt))
-#define DUK_LEXER_GETPOINT(ctx,pt) duk_lexer_getpoint((ctx), (pt))
+#define DUK_LEXER_GETPOINT(ctx, pt) duk_lexer_getpoint((ctx), (pt))
/* Currently 6 characters of lookup are actually needed (duk_lexer.c). */
-#define DUK_LEXER_WINDOW_SIZE 6
+#define DUK_LEXER_WINDOW_SIZE 6
#if defined(DUK_USE_LEXER_SLIDING_WINDOW)
-#define DUK_LEXER_BUFFER_SIZE 64
+#define DUK_LEXER_BUFFER_SIZE 64
#endif
-#define DUK_TOK_MINVAL 0
+#define DUK_TOK_MINVAL 0
/* returned after EOF (infinite amount) */
-#define DUK_TOK_EOF 0
+#define DUK_TOK_EOF 0
/* identifier names (E5 Section 7.6) */
-#define DUK_TOK_IDENTIFIER 1
+#define DUK_TOK_IDENTIFIER 1
/* reserved words: keywords */
-#define DUK_TOK_START_RESERVED 2
-#define DUK_TOK_BREAK 2
-#define DUK_TOK_CASE 3
-#define DUK_TOK_CATCH 4
-#define DUK_TOK_CONTINUE 5
-#define DUK_TOK_DEBUGGER 6
-#define DUK_TOK_DEFAULT 7
-#define DUK_TOK_DELETE 8
-#define DUK_TOK_DO 9
-#define DUK_TOK_ELSE 10
-#define DUK_TOK_FINALLY 11
-#define DUK_TOK_FOR 12
-#define DUK_TOK_FUNCTION 13
-#define DUK_TOK_IF 14
-#define DUK_TOK_IN 15
-#define DUK_TOK_INSTANCEOF 16
-#define DUK_TOK_NEW 17
-#define DUK_TOK_RETURN 18
-#define DUK_TOK_SWITCH 19
-#define DUK_TOK_THIS 20
-#define DUK_TOK_THROW 21
-#define DUK_TOK_TRY 22
-#define DUK_TOK_TYPEOF 23
-#define DUK_TOK_VAR 24
-#define DUK_TOK_CONST 25
-#define DUK_TOK_VOID 26
-#define DUK_TOK_WHILE 27
-#define DUK_TOK_WITH 28
+#define DUK_TOK_START_RESERVED 2
+#define DUK_TOK_BREAK 2
+#define DUK_TOK_CASE 3
+#define DUK_TOK_CATCH 4
+#define DUK_TOK_CONTINUE 5
+#define DUK_TOK_DEBUGGER 6
+#define DUK_TOK_DEFAULT 7
+#define DUK_TOK_DELETE 8
+#define DUK_TOK_DO 9
+#define DUK_TOK_ELSE 10
+#define DUK_TOK_FINALLY 11
+#define DUK_TOK_FOR 12
+#define DUK_TOK_FUNCTION 13
+#define DUK_TOK_IF 14
+#define DUK_TOK_IN 15
+#define DUK_TOK_INSTANCEOF 16
+#define DUK_TOK_NEW 17
+#define DUK_TOK_RETURN 18
+#define DUK_TOK_SWITCH 19
+#define DUK_TOK_THIS 20
+#define DUK_TOK_THROW 21
+#define DUK_TOK_TRY 22
+#define DUK_TOK_TYPEOF 23
+#define DUK_TOK_VAR 24
+#define DUK_TOK_CONST 25
+#define DUK_TOK_VOID 26
+#define DUK_TOK_WHILE 27
+#define DUK_TOK_WITH 28
/* reserved words: future reserved words */
-#define DUK_TOK_CLASS 29
-#define DUK_TOK_ENUM 30
-#define DUK_TOK_EXPORT 31
-#define DUK_TOK_EXTENDS 32
-#define DUK_TOK_IMPORT 33
-#define DUK_TOK_SUPER 34
+#define DUK_TOK_CLASS 29
+#define DUK_TOK_ENUM 30
+#define DUK_TOK_EXPORT 31
+#define DUK_TOK_EXTENDS 32
+#define DUK_TOK_IMPORT 33
+#define DUK_TOK_SUPER 34
/* "null", "true", and "false" are always reserved words.
* Note that "get" and "set" are not!
*/
-#define DUK_TOK_NULL 35
-#define DUK_TOK_TRUE 36
-#define DUK_TOK_FALSE 37
+#define DUK_TOK_NULL 35
+#define DUK_TOK_TRUE 36
+#define DUK_TOK_FALSE 37
/* reserved words: additional future reserved words in strict mode */
-#define DUK_TOK_START_STRICT_RESERVED 38 /* inclusive */
-#define DUK_TOK_IMPLEMENTS 38
-#define DUK_TOK_INTERFACE 39
-#define DUK_TOK_LET 40
-#define DUK_TOK_PACKAGE 41
-#define DUK_TOK_PRIVATE 42
-#define DUK_TOK_PROTECTED 43
-#define DUK_TOK_PUBLIC 44
-#define DUK_TOK_STATIC 45
-#define DUK_TOK_YIELD 46
-
-#define DUK_TOK_END_RESERVED 47 /* exclusive */
+#define DUK_TOK_START_STRICT_RESERVED 38 /* inclusive */
+#define DUK_TOK_IMPLEMENTS 38
+#define DUK_TOK_INTERFACE 39
+#define DUK_TOK_LET 40
+#define DUK_TOK_PACKAGE 41
+#define DUK_TOK_PRIVATE 42
+#define DUK_TOK_PROTECTED 43
+#define DUK_TOK_PUBLIC 44
+#define DUK_TOK_STATIC 45
+#define DUK_TOK_YIELD 46
+
+#define DUK_TOK_END_RESERVED 47 /* exclusive */
/* "get" and "set" are tokens but NOT ReservedWords. They are currently
* parsed and identifiers and these defines are actually now unused.
*/
-#define DUK_TOK_GET 47
-#define DUK_TOK_SET 48
+#define DUK_TOK_GET 47
+#define DUK_TOK_SET 48
/* punctuators (unlike the spec, also includes "/" and "/=") */
-#define DUK_TOK_LCURLY 49
-#define DUK_TOK_RCURLY 50
-#define DUK_TOK_LBRACKET 51
-#define DUK_TOK_RBRACKET 52
-#define DUK_TOK_LPAREN 53
-#define DUK_TOK_RPAREN 54
-#define DUK_TOK_PERIOD 55
-#define DUK_TOK_SEMICOLON 56
-#define DUK_TOK_COMMA 57
-#define DUK_TOK_LT 58
-#define DUK_TOK_GT 59
-#define DUK_TOK_LE 60
-#define DUK_TOK_GE 61
-#define DUK_TOK_EQ 62
-#define DUK_TOK_NEQ 63
-#define DUK_TOK_SEQ 64
-#define DUK_TOK_SNEQ 65
-#define DUK_TOK_ADD 66
-#define DUK_TOK_SUB 67
-#define DUK_TOK_MUL 68
-#define DUK_TOK_DIV 69
-#define DUK_TOK_MOD 70
-#define DUK_TOK_EXP 71
-#define DUK_TOK_INCREMENT 72
-#define DUK_TOK_DECREMENT 73
-#define DUK_TOK_ALSHIFT 74 /* named "arithmetic" because result is signed */
-#define DUK_TOK_ARSHIFT 75
-#define DUK_TOK_RSHIFT 76
-#define DUK_TOK_BAND 77
-#define DUK_TOK_BOR 78
-#define DUK_TOK_BXOR 79
-#define DUK_TOK_LNOT 80
-#define DUK_TOK_BNOT 81
-#define DUK_TOK_LAND 82
-#define DUK_TOK_LOR 83
-#define DUK_TOK_QUESTION 84
-#define DUK_TOK_COLON 85
-#define DUK_TOK_EQUALSIGN 86
-#define DUK_TOK_ADD_EQ 87
-#define DUK_TOK_SUB_EQ 88
-#define DUK_TOK_MUL_EQ 89
-#define DUK_TOK_DIV_EQ 90
-#define DUK_TOK_MOD_EQ 91
-#define DUK_TOK_EXP_EQ 92
-#define DUK_TOK_ALSHIFT_EQ 93
-#define DUK_TOK_ARSHIFT_EQ 94
-#define DUK_TOK_RSHIFT_EQ 95
-#define DUK_TOK_BAND_EQ 96
-#define DUK_TOK_BOR_EQ 97
-#define DUK_TOK_BXOR_EQ 98
+#define DUK_TOK_LCURLY 49
+#define DUK_TOK_RCURLY 50
+#define DUK_TOK_LBRACKET 51
+#define DUK_TOK_RBRACKET 52
+#define DUK_TOK_LPAREN 53
+#define DUK_TOK_RPAREN 54
+#define DUK_TOK_PERIOD 55
+#define DUK_TOK_SEMICOLON 56
+#define DUK_TOK_COMMA 57
+#define DUK_TOK_LT 58
+#define DUK_TOK_GT 59
+#define DUK_TOK_LE 60
+#define DUK_TOK_GE 61
+#define DUK_TOK_EQ 62
+#define DUK_TOK_NEQ 63
+#define DUK_TOK_SEQ 64
+#define DUK_TOK_SNEQ 65
+#define DUK_TOK_ADD 66
+#define DUK_TOK_SUB 67
+#define DUK_TOK_MUL 68
+#define DUK_TOK_DIV 69
+#define DUK_TOK_MOD 70
+#define DUK_TOK_EXP 71
+#define DUK_TOK_INCREMENT 72
+#define DUK_TOK_DECREMENT 73
+#define DUK_TOK_ALSHIFT 74 /* named "arithmetic" because result is signed */
+#define DUK_TOK_ARSHIFT 75
+#define DUK_TOK_RSHIFT 76
+#define DUK_TOK_BAND 77
+#define DUK_TOK_BOR 78
+#define DUK_TOK_BXOR 79
+#define DUK_TOK_LNOT 80
+#define DUK_TOK_BNOT 81
+#define DUK_TOK_LAND 82
+#define DUK_TOK_LOR 83
+#define DUK_TOK_QUESTION 84
+#define DUK_TOK_COLON 85
+#define DUK_TOK_EQUALSIGN 86
+#define DUK_TOK_ADD_EQ 87
+#define DUK_TOK_SUB_EQ 88
+#define DUK_TOK_MUL_EQ 89
+#define DUK_TOK_DIV_EQ 90
+#define DUK_TOK_MOD_EQ 91
+#define DUK_TOK_EXP_EQ 92
+#define DUK_TOK_ALSHIFT_EQ 93
+#define DUK_TOK_ARSHIFT_EQ 94
+#define DUK_TOK_RSHIFT_EQ 95
+#define DUK_TOK_BAND_EQ 96
+#define DUK_TOK_BOR_EQ 97
+#define DUK_TOK_BXOR_EQ 98
/* literals (E5 Section 7.8), except null, true, false, which are treated
* like reserved words (above).
*/
-#define DUK_TOK_NUMBER 99
-#define DUK_TOK_STRING 100
-#define DUK_TOK_REGEXP 101
+#define DUK_TOK_NUMBER 99
+#define DUK_TOK_STRING 100
+#define DUK_TOK_REGEXP 101
-#define DUK_TOK_MAXVAL 101 /* inclusive */
+#define DUK_TOK_MAXVAL 101 /* inclusive */
-#define DUK_TOK_INVALID DUK_SMALL_UINT_MAX
+#define DUK_TOK_INVALID DUK_SMALL_UINT_MAX
/* Convert heap string index to a token (reserved words) */
-#define DUK_STRIDX_TO_TOK(x) ((x) - DUK_STRIDX_START_RESERVED + DUK_TOK_START_RESERVED)
+#define DUK_STRIDX_TO_TOK(x) ((x) -DUK_STRIDX_START_RESERVED + DUK_TOK_START_RESERVED)
/* Sanity check */
#if (DUK_TOK_MAXVAL > 255)
@@ -3952,57 +4121,57 @@ typedef void (*duk_re_range_callback)(void *user, duk_codepoint_t r1, duk_codepo
#endif
/* Regexp tokens */
-#define DUK_RETOK_EOF 0
-#define DUK_RETOK_DISJUNCTION 1
-#define DUK_RETOK_QUANTIFIER 2
-#define DUK_RETOK_ASSERT_START 3
-#define DUK_RETOK_ASSERT_END 4
-#define DUK_RETOK_ASSERT_WORD_BOUNDARY 5
-#define DUK_RETOK_ASSERT_NOT_WORD_BOUNDARY 6
-#define DUK_RETOK_ASSERT_START_POS_LOOKAHEAD 7
-#define DUK_RETOK_ASSERT_START_NEG_LOOKAHEAD 8
-#define DUK_RETOK_ATOM_PERIOD 9
-#define DUK_RETOK_ATOM_CHAR 10
-#define DUK_RETOK_ATOM_DIGIT 11 /* assumptions in regexp compiler */
-#define DUK_RETOK_ATOM_NOT_DIGIT 12 /* -""- */
-#define DUK_RETOK_ATOM_WHITE 13 /* -""- */
-#define DUK_RETOK_ATOM_NOT_WHITE 14 /* -""- */
-#define DUK_RETOK_ATOM_WORD_CHAR 15 /* -""- */
-#define DUK_RETOK_ATOM_NOT_WORD_CHAR 16 /* -""- */
-#define DUK_RETOK_ATOM_BACKREFERENCE 17
-#define DUK_RETOK_ATOM_START_CAPTURE_GROUP 18
-#define DUK_RETOK_ATOM_START_NONCAPTURE_GROUP 19
-#define DUK_RETOK_ATOM_START_CHARCLASS 20
-#define DUK_RETOK_ATOM_START_CHARCLASS_INVERTED 21
-#define DUK_RETOK_ATOM_END_GROUP 22
+#define DUK_RETOK_EOF 0
+#define DUK_RETOK_DISJUNCTION 1
+#define DUK_RETOK_QUANTIFIER 2
+#define DUK_RETOK_ASSERT_START 3
+#define DUK_RETOK_ASSERT_END 4
+#define DUK_RETOK_ASSERT_WORD_BOUNDARY 5
+#define DUK_RETOK_ASSERT_NOT_WORD_BOUNDARY 6
+#define DUK_RETOK_ASSERT_START_POS_LOOKAHEAD 7
+#define DUK_RETOK_ASSERT_START_NEG_LOOKAHEAD 8
+#define DUK_RETOK_ATOM_PERIOD 9
+#define DUK_RETOK_ATOM_CHAR 10
+#define DUK_RETOK_ATOM_DIGIT 11 /* assumptions in regexp compiler */
+#define DUK_RETOK_ATOM_NOT_DIGIT 12 /* -""- */
+#define DUK_RETOK_ATOM_WHITE 13 /* -""- */
+#define DUK_RETOK_ATOM_NOT_WHITE 14 /* -""- */
+#define DUK_RETOK_ATOM_WORD_CHAR 15 /* -""- */
+#define DUK_RETOK_ATOM_NOT_WORD_CHAR 16 /* -""- */
+#define DUK_RETOK_ATOM_BACKREFERENCE 17
+#define DUK_RETOK_ATOM_START_CAPTURE_GROUP 18
+#define DUK_RETOK_ATOM_START_NONCAPTURE_GROUP 19
+#define DUK_RETOK_ATOM_START_CHARCLASS 20
+#define DUK_RETOK_ATOM_START_CHARCLASS_INVERTED 21
+#define DUK_RETOK_ATOM_END_GROUP 22
/* Constants for duk_lexer_ctx.buf. */
-#define DUK_LEXER_TEMP_BUF_LIMIT 256
+#define DUK_LEXER_TEMP_BUF_LIMIT 256
/* A token value. Can be memcpy()'d, but note that slot1/slot2 values are on the valstack.
* Some fields (like num, str1, str2) are only valid for specific token types and may have
* stale values otherwise.
*/
struct duk_token {
- duk_small_uint_t t; /* token type (with reserved word identification) */
- duk_small_uint_t t_nores; /* token type (with reserved words as DUK_TOK_IDENTIFER) */
- duk_double_t num; /* numeric value of token */
- duk_hstring *str1; /* string 1 of token (borrowed, stored to ctx->slot1_idx) */
- duk_hstring *str2; /* string 2 of token (borrowed, stored to ctx->slot2_idx) */
- duk_size_t start_offset; /* start byte offset of token in lexer input */
- duk_int_t start_line; /* start line of token (first char) */
- duk_int_t num_escapes; /* number of escapes and line continuations (for directive prologue) */
- duk_bool_t lineterm; /* token was preceded by a lineterm */
- duk_bool_t allow_auto_semi; /* token allows automatic semicolon insertion (eof or preceded by newline) */
+ duk_small_uint_t t; /* token type (with reserved word identification) */
+ duk_small_uint_t t_nores; /* token type (with reserved words as DUK_TOK_IDENTIFER) */
+ duk_double_t num; /* numeric value of token */
+ duk_hstring *str1; /* string 1 of token (borrowed, stored to ctx->slot1_idx) */
+ duk_hstring *str2; /* string 2 of token (borrowed, stored to ctx->slot2_idx) */
+ duk_size_t start_offset; /* start byte offset of token in lexer input */
+ duk_int_t start_line; /* start line of token (first char) */
+ duk_int_t num_escapes; /* number of escapes and line continuations (for directive prologue) */
+ duk_bool_t lineterm; /* token was preceded by a lineterm */
+ duk_bool_t allow_auto_semi; /* token allows automatic semicolon insertion (eof or preceded by newline) */
};
-#define DUK_RE_QUANTIFIER_INFINITE ((duk_uint32_t) 0xffffffffUL)
+#define DUK_RE_QUANTIFIER_INFINITE ((duk_uint32_t) 0xffffffffUL)
/* A regexp token value. */
struct duk_re_token {
- duk_small_uint_t t; /* token type */
+ duk_small_uint_t t; /* token type */
duk_small_uint_t greedy;
- duk_uint32_t num; /* numeric value (character, count) */
+ duk_uint32_t num; /* numeric value (character, count) */
duk_uint32_t qmin;
duk_uint32_t qmax;
};
@@ -4029,23 +4198,23 @@ struct duk_lexer_ctx {
duk_lexer_codepoint window[DUK_LEXER_WINDOW_SIZE]; /* unicode code points, window[0] is always next */
#endif
- duk_hthread *thr; /* thread; minimizes argument passing */
+ duk_hthread *thr; /* thread; minimizes argument passing */
- const duk_uint8_t *input; /* input string (may be a user pointer) */
- duk_size_t input_length; /* input byte length */
- duk_size_t input_offset; /* input offset for window leading edge (not window[0]) */
- duk_int_t input_line; /* input linenumber at input_offset (not window[0]), init to 1 */
+ const duk_uint8_t *input; /* input string (may be a user pointer) */
+ duk_size_t input_length; /* input byte length */
+ duk_size_t input_offset; /* input offset for window leading edge (not window[0]) */
+ duk_int_t input_line; /* input linenumber at input_offset (not window[0]), init to 1 */
- duk_idx_t slot1_idx; /* valstack slot for 1st token value */
- duk_idx_t slot2_idx; /* valstack slot for 2nd token value */
- duk_idx_t buf_idx; /* valstack slot for temp buffer */
- duk_hbuffer_dynamic *buf; /* temp accumulation buffer */
- duk_bufwriter_ctx bw; /* bufwriter for temp accumulation */
+ duk_idx_t slot1_idx; /* valstack slot for 1st token value */
+ duk_idx_t slot2_idx; /* valstack slot for 2nd token value */
+ duk_idx_t buf_idx; /* valstack slot for temp buffer */
+ duk_hbuffer_dynamic *buf; /* temp accumulation buffer */
+ duk_bufwriter_ctx bw; /* bufwriter for temp accumulation */
- duk_int_t token_count; /* number of tokens parsed */
- duk_int_t token_limit; /* maximum token count before error (sanity backstop) */
+ duk_int_t token_count; /* number of tokens parsed */
+ duk_int_t token_limit; /* maximum token count before error (sanity backstop) */
- duk_small_uint_t flags; /* lexer flags, use compiler flag defines for now */
+ duk_small_uint_t flags; /* lexer flags, use compiler flag defines for now */
};
/*
@@ -4058,16 +4227,13 @@ DUK_INTERNAL_DECL void duk_lexer_getpoint(duk_lexer_ctx *lex_ctx, duk_lexer_poin
DUK_INTERNAL_DECL void duk_lexer_setpoint(duk_lexer_ctx *lex_ctx, duk_lexer_point *pt);
DUK_INTERNAL_DECL
-void duk_lexer_parse_js_input_element(duk_lexer_ctx *lex_ctx,
- duk_token *out_token,
- duk_bool_t strict_mode,
- duk_bool_t regexp_mode);
+void duk_lexer_parse_js_input_element(duk_lexer_ctx *lex_ctx, duk_token *out_token, duk_bool_t strict_mode, duk_bool_t regexp_mode);
#if defined(DUK_USE_REGEXP_SUPPORT)
DUK_INTERNAL_DECL void duk_lexer_parse_re_token(duk_lexer_ctx *lex_ctx, duk_re_token *out_token);
DUK_INTERNAL_DECL void duk_lexer_parse_re_ranges(duk_lexer_ctx *lex_ctx, duk_re_range_callback gen_range, void *userdata);
-#endif /* DUK_USE_REGEXP_SUPPORT */
+#endif /* DUK_USE_REGEXP_SUPPORT */
-#endif /* DUK_LEXER_H_INCLUDED */
+#endif /* DUK_LEXER_H_INCLUDED */
/* #include duk_js_compiler.h */
/*
* ECMAScript compiler.
@@ -4077,13 +4243,13 @@ DUK_INTERNAL_DECL void duk_lexer_parse_re_ranges(duk_lexer_ctx *lex_ctx, duk_re_
#define DUK_JS_COMPILER_H_INCLUDED
/* ECMAScript compiler limits */
-#define DUK_COMPILER_TOKEN_LIMIT 100000000L /* 1e8: protects against deeply nested inner functions */
+#define DUK_COMPILER_TOKEN_LIMIT 100000000L /* 1e8: protects against deeply nested inner functions */
/* maximum loopcount for peephole optimization */
-#define DUK_COMPILER_PEEPHOLE_MAXITER 3
+#define DUK_COMPILER_PEEPHOLE_MAXITER 3
/* maximum bytecode length in instructions */
-#define DUK_COMPILER_MAX_BYTECODE_LENGTH (256L * 1024L * 1024L) /* 1 GB */
+#define DUK_COMPILER_MAX_BYTECODE_LENGTH (256L * 1024L * 1024L) /* 1 GB */
/*
* Compiler intermediate values
@@ -4093,21 +4259,21 @@ DUK_INTERNAL_DECL void duk_lexer_parse_re_ranges(duk_lexer_ctx *lex_ctx, duk_re_
* either a left-hand-side or right-hand-side role (e.g. object property).
*/
-#define DUK_IVAL_NONE 0 /* no value */
-#define DUK_IVAL_PLAIN 1 /* register, constant, or value */
-#define DUK_IVAL_ARITH 2 /* binary arithmetic; DUK_OP_ADD, DUK_OP_EQ, other binary ops */
-#define DUK_IVAL_PROP 3 /* property access */
-#define DUK_IVAL_VAR 4 /* variable access */
+#define DUK_IVAL_NONE 0 /* no value */
+#define DUK_IVAL_PLAIN 1 /* register, constant, or value */
+#define DUK_IVAL_ARITH 2 /* binary arithmetic; DUK_OP_ADD, DUK_OP_EQ, other binary ops */
+#define DUK_IVAL_PROP 3 /* property access */
+#define DUK_IVAL_VAR 4 /* variable access */
-#define DUK_ISPEC_NONE 0 /* no value */
-#define DUK_ISPEC_VALUE 1 /* value resides in 'valstack_idx' */
-#define DUK_ISPEC_REGCONST 2 /* value resides in a register or constant */
+#define DUK_ISPEC_NONE 0 /* no value */
+#define DUK_ISPEC_VALUE 1 /* value resides in 'valstack_idx' */
+#define DUK_ISPEC_REGCONST 2 /* value resides in a register or constant */
/* Bit mask which indicates that a regconst is a constant instead of a register.
* Chosen so that when a regconst is cast to duk_int32_t, all consts are
* negative values.
*/
-#define DUK_REGCONST_CONST_MARKER DUK_INT32_MIN /* = -0x80000000 */
+#define DUK_REGCONST_CONST_MARKER DUK_INT32_MIN /* = -0x80000000 */
/* Type to represent a reg/const reference during compilation, with <0
* indicating a constant. Some call sites also use -1 to indicate 'none'.
@@ -4115,9 +4281,9 @@ DUK_INTERNAL_DECL void duk_lexer_parse_re_ranges(duk_lexer_ctx *lex_ctx, duk_re_
typedef duk_int32_t duk_regconst_t;
typedef struct {
- duk_small_uint_t t; /* DUK_ISPEC_XXX */
+ duk_small_uint_t t; /* DUK_ISPEC_XXX */
duk_regconst_t regconst;
- duk_idx_t valstack_idx; /* always set; points to a reserved valstack slot */
+ duk_idx_t valstack_idx; /* always set; points to a reserved valstack slot */
} duk_ispec;
typedef struct {
@@ -4129,8 +4295,8 @@ typedef struct {
*/
/* XXX: can be optimized for smaller footprint esp. on 32-bit environments */
- duk_small_uint_t t; /* DUK_IVAL_XXX */
- duk_small_uint_t op; /* bytecode opcode for binary ops */
+ duk_small_uint_t t; /* DUK_IVAL_XXX */
+ duk_small_uint_t op; /* bytecode opcode for binary ops */
duk_ispec x1;
duk_ispec x2;
} duk_ivalue;
@@ -4152,22 +4318,22 @@ struct duk_compiler_instr {
* Compiler state
*/
-#define DUK_LABEL_FLAG_ALLOW_BREAK (1U << 0)
-#define DUK_LABEL_FLAG_ALLOW_CONTINUE (1U << 1)
+#define DUK_LABEL_FLAG_ALLOW_BREAK (1U << 0)
+#define DUK_LABEL_FLAG_ALLOW_CONTINUE (1U << 1)
-#define DUK_DECL_TYPE_VAR 0
-#define DUK_DECL_TYPE_FUNC 1
+#define DUK_DECL_TYPE_VAR 0
+#define DUK_DECL_TYPE_FUNC 1
/* XXX: optimize to 16 bytes */
typedef struct {
duk_small_uint_t flags;
- duk_int_t label_id; /* numeric label_id (-1 reserved as marker) */
- duk_hstring *h_label; /* borrowed label name */
- duk_int_t catch_depth; /* catch depth at point of definition */
- duk_int_t pc_label; /* pc of label statement:
- * pc+1: break jump site
- * pc+2: continue jump site
- */
+ duk_int_t label_id; /* numeric label_id (-1 reserved as marker) */
+ duk_hstring *h_label; /* borrowed label name */
+ duk_int_t catch_depth; /* catch depth at point of definition */
+ duk_int_t pc_label; /* pc of label statement:
+ * pc+1: break jump site
+ * pc+2: continue jump site
+ */
/* Fast jumps (which avoid longjmp) jump directly to the jump sites
* which are always known even while the iteration/switch statement
@@ -4183,22 +4349,22 @@ struct duk_compiler_func {
* platforms (e.g. if int is 32 bits and pointers are 64 bits).
*/
- duk_bufwriter_ctx bw_code; /* bufwriter for code */
+ duk_bufwriter_ctx bw_code; /* bufwriter for code */
- duk_hstring *h_name; /* function name (borrowed reference), ends up in _name */
+ duk_hstring *h_name; /* function name (borrowed reference), ends up in _name */
/* h_code: held in bw_code */
- duk_hobject *h_consts; /* array */
- duk_hobject *h_funcs; /* array of function templates: [func1, offset1, line1, func2, offset2, line2]
- * offset/line points to closing brace to allow skipping on pass 2
- */
- duk_hobject *h_decls; /* array of declarations: [ name1, val1, name2, val2, ... ]
- * valN = (typeN) | (fnum << 8), where fnum is inner func number (0 for vars)
- * record function and variable declarations in pass 1
- */
- duk_hobject *h_labelnames; /* array of active label names */
- duk_hbuffer_dynamic *h_labelinfos; /* C array of duk_labelinfo */
- duk_hobject *h_argnames; /* array of formal argument names (-> _Formals) */
- duk_hobject *h_varmap; /* variable map for pass 2 (identifier -> register number or null (unmapped)) */
+ duk_hobject *h_consts; /* array */
+ duk_hobject *h_funcs; /* array of function templates: [func1, offset1, line1, func2, offset2, line2]
+ * offset/line points to closing brace to allow skipping on pass 2
+ */
+ duk_hobject *h_decls; /* array of declarations: [ name1, val1, name2, val2, ... ]
+ * valN = (typeN) | (fnum << 8), where fnum is inner func number (0 for vars)
+ * record function and variable declarations in pass 1
+ */
+ duk_hobject *h_labelnames; /* array of active label names */
+ duk_hbuffer_dynamic *h_labelinfos; /* C array of duk_labelinfo */
+ duk_hobject *h_argnames; /* array of formal argument names (-> _Formals) */
+ duk_hobject *h_varmap; /* variable map for pass 2 (identifier -> register number or null (unmapped)) */
/* Value stack indices for tracking objects. */
/* code_idx: not needed */
@@ -4211,9 +4377,9 @@ struct duk_compiler_func {
duk_idx_t varmap_idx;
/* Temp reg handling. */
- duk_regconst_t temp_first; /* first register that is a temporary (below: variables) */
- duk_regconst_t temp_next; /* next temporary register to allocate */
- duk_regconst_t temp_max; /* highest value of temp_reg (temp_max - 1 is highest used reg) */
+ duk_regconst_t temp_first; /* first register that is a temporary (below: variables) */
+ duk_regconst_t temp_next; /* next temporary register to allocate */
+ duk_regconst_t temp_max; /* highest value of temp_reg (temp_max - 1 is highest used reg) */
/* Shuffle registers if large number of regs/consts. */
duk_regconst_t shuffle1;
@@ -4223,49 +4389,51 @@ struct duk_compiler_func {
/* Stats for current expression being parsed. */
duk_int_t nud_count;
duk_int_t led_count;
- duk_int_t paren_level; /* parenthesis count, 0 = top level */
- duk_bool_t expr_lhs; /* expression is left-hand-side compatible */
- duk_bool_t allow_in; /* current paren level allows 'in' token */
+ duk_int_t paren_level; /* parenthesis count, 0 = top level */
+ duk_bool_t expr_lhs; /* expression is left-hand-side compatible */
+ duk_bool_t allow_in; /* current paren level allows 'in' token */
/* Misc. */
- duk_int_t stmt_next; /* statement id allocation (running counter) */
- duk_int_t label_next; /* label id allocation (running counter) */
- duk_int_t catch_depth; /* catch stack depth */
- duk_int_t with_depth; /* with stack depth (affects identifier lookups) */
- duk_int_t fnum_next; /* inner function numbering */
- duk_int_t num_formals; /* number of formal arguments */
- duk_regconst_t reg_stmt_value; /* register for writing value of 'non-empty' statements (global or eval code), -1 is marker */
+ duk_int_t stmt_next; /* statement id allocation (running counter) */
+ duk_int_t label_next; /* label id allocation (running counter) */
+ duk_int_t catch_depth; /* catch stack depth */
+ duk_int_t with_depth; /* with stack depth (affects identifier lookups) */
+ duk_int_t fnum_next; /* inner function numbering */
+ duk_int_t num_formals; /* number of formal arguments */
+ duk_regconst_t
+ reg_stmt_value; /* register for writing value of 'non-empty' statements (global or eval code), -1 is marker */
#if defined(DUK_USE_DEBUGGER_SUPPORT)
- duk_int_t min_line; /* XXX: typing (duk_hcompfunc has duk_uint32_t) */
+ duk_int_t min_line; /* XXX: typing (duk_hcompfunc has duk_uint32_t) */
duk_int_t max_line;
#endif
/* Status booleans. */
- duk_uint8_t is_function; /* is an actual function (not global/eval code) */
- duk_uint8_t is_eval; /* is eval code */
- duk_uint8_t is_global; /* is global code */
- duk_uint8_t is_namebinding; /* needs a name binding */
- duk_uint8_t is_constructable; /* result is constructable */
- duk_uint8_t is_setget; /* is a setter/getter */
- duk_uint8_t is_strict; /* function is strict */
- duk_uint8_t is_notail; /* function must not be tail called */
- duk_uint8_t in_directive_prologue; /* parsing in "directive prologue", recognize directives */
- duk_uint8_t in_scanning; /* parsing in "scanning" phase (first pass) */
- duk_uint8_t may_direct_eval; /* function may call direct eval */
- duk_uint8_t id_access_arguments; /* function refers to 'arguments' identifier */
- duk_uint8_t id_access_slow; /* function makes one or more slow path accesses that won't match own static variables */
- duk_uint8_t id_access_slow_own; /* function makes one or more slow path accesses that may match own static variables */
- duk_uint8_t is_arguments_shadowed; /* argument/function declaration shadows 'arguments' */
- duk_uint8_t needs_shuffle; /* function needs shuffle registers */
- duk_uint8_t reject_regexp_in_adv; /* reject RegExp literal on next advance() call; needed for handling IdentifierName productions */
- duk_uint8_t allow_regexp_in_adv; /* allow RegExp literal on next advance() call */
+ duk_uint8_t is_function; /* is an actual function (not global/eval code) */
+ duk_uint8_t is_eval; /* is eval code */
+ duk_uint8_t is_global; /* is global code */
+ duk_uint8_t is_namebinding; /* needs a name binding */
+ duk_uint8_t is_constructable; /* result is constructable */
+ duk_uint8_t is_setget; /* is a setter/getter */
+ duk_uint8_t is_strict; /* function is strict */
+ duk_uint8_t is_notail; /* function must not be tail called */
+ duk_uint8_t in_directive_prologue; /* parsing in "directive prologue", recognize directives */
+ duk_uint8_t in_scanning; /* parsing in "scanning" phase (first pass) */
+ duk_uint8_t may_direct_eval; /* function may call direct eval */
+ duk_uint8_t id_access_arguments; /* function refers to 'arguments' identifier */
+ duk_uint8_t id_access_slow; /* function makes one or more slow path accesses that won't match own static variables */
+ duk_uint8_t id_access_slow_own; /* function makes one or more slow path accesses that may match own static variables */
+ duk_uint8_t is_arguments_shadowed; /* argument/function declaration shadows 'arguments' */
+ duk_uint8_t needs_shuffle; /* function needs shuffle registers */
+ duk_uint8_t
+ reject_regexp_in_adv; /* reject RegExp literal on next advance() call; needed for handling IdentifierName productions */
+ duk_uint8_t allow_regexp_in_adv; /* allow RegExp literal on next advance() call */
};
struct duk_compiler_ctx {
duk_hthread *thr;
/* filename being compiled (ends up in functions' '_filename' property) */
- duk_hstring *h_filename; /* borrowed reference */
+ duk_hstring *h_filename; /* borrowed reference */
/* lexing (tokenization) state (contains two valstack slot indices) */
duk_lexer_ctx lex;
@@ -4273,10 +4441,10 @@ struct duk_compiler_ctx {
/* current and previous token for parsing */
duk_token prev_token;
duk_token curr_token;
- duk_idx_t tok11_idx; /* curr_token slot1 (matches 'lex' slot1_idx) */
- duk_idx_t tok12_idx; /* curr_token slot2 (matches 'lex' slot2_idx) */
- duk_idx_t tok21_idx; /* prev_token slot1 */
- duk_idx_t tok22_idx; /* prev_token slot2 */
+ duk_idx_t tok11_idx; /* curr_token slot1 (matches 'lex' slot1_idx) */
+ duk_idx_t tok12_idx; /* curr_token slot2 (matches 'lex' slot2_idx) */
+ duk_idx_t tok21_idx; /* prev_token slot1 */
+ duk_idx_t tok22_idx; /* prev_token slot2 */
/* recursion limit */
duk_int_t recursion_depth;
@@ -4293,9 +4461,12 @@ struct duk_compiler_ctx {
* Prototypes
*/
-DUK_INTERNAL_DECL void duk_js_compile(duk_hthread *thr, const duk_uint8_t *src_buffer, duk_size_t src_length, duk_small_uint_t flags);
+DUK_INTERNAL_DECL void duk_js_compile(duk_hthread *thr,
+ const duk_uint8_t *src_buffer,
+ duk_size_t src_length,
+ duk_small_uint_t flags);
-#endif /* DUK_JS_COMPILER_H_INCLUDED */
+#endif /* DUK_JS_COMPILER_H_INCLUDED */
/* #include duk_regexp.h */
/*
* Regular expression structs, constants, and bytecode defines.
@@ -4305,39 +4476,39 @@ DUK_INTERNAL_DECL void duk_js_compile(duk_hthread *thr, const duk_uint8_t *src_b
#define DUK_REGEXP_H_INCLUDED
/* maximum bytecode copies for {n,m} quantifiers */
-#define DUK_RE_MAX_ATOM_COPIES 1000
+#define DUK_RE_MAX_ATOM_COPIES 1000
/* regexp compilation limits */
-#define DUK_RE_COMPILE_TOKEN_LIMIT 100000000L /* 1e8 */
+#define DUK_RE_COMPILE_TOKEN_LIMIT 100000000L /* 1e8 */
/* regexp execution limits */
-#define DUK_RE_EXECUTE_STEPS_LIMIT 1000000000L /* 1e9 */
+#define DUK_RE_EXECUTE_STEPS_LIMIT 1000000000L /* 1e9 */
/* regexp opcodes */
-#define DUK_REOP_MATCH 1
-#define DUK_REOP_CHAR 2
-#define DUK_REOP_PERIOD 3
-#define DUK_REOP_RANGES 4
-#define DUK_REOP_INVRANGES 5
-#define DUK_REOP_JUMP 6
-#define DUK_REOP_SPLIT1 7
-#define DUK_REOP_SPLIT2 8
-#define DUK_REOP_SQMINIMAL 9
-#define DUK_REOP_SQGREEDY 10
-#define DUK_REOP_SAVE 11
-#define DUK_REOP_WIPERANGE 12
-#define DUK_REOP_LOOKPOS 13
-#define DUK_REOP_LOOKNEG 14
-#define DUK_REOP_BACKREFERENCE 15
-#define DUK_REOP_ASSERT_START 16
-#define DUK_REOP_ASSERT_END 17
-#define DUK_REOP_ASSERT_WORD_BOUNDARY 18
-#define DUK_REOP_ASSERT_NOT_WORD_BOUNDARY 19
+#define DUK_REOP_MATCH 1
+#define DUK_REOP_CHAR 2
+#define DUK_REOP_PERIOD 3
+#define DUK_REOP_RANGES 4
+#define DUK_REOP_INVRANGES 5
+#define DUK_REOP_JUMP 6
+#define DUK_REOP_SPLIT1 7
+#define DUK_REOP_SPLIT2 8
+#define DUK_REOP_SQMINIMAL 9
+#define DUK_REOP_SQGREEDY 10
+#define DUK_REOP_SAVE 11
+#define DUK_REOP_WIPERANGE 12
+#define DUK_REOP_LOOKPOS 13
+#define DUK_REOP_LOOKNEG 14
+#define DUK_REOP_BACKREFERENCE 15
+#define DUK_REOP_ASSERT_START 16
+#define DUK_REOP_ASSERT_END 17
+#define DUK_REOP_ASSERT_WORD_BOUNDARY 18
+#define DUK_REOP_ASSERT_NOT_WORD_BOUNDARY 19
/* flags */
-#define DUK_RE_FLAG_GLOBAL (1U << 0)
-#define DUK_RE_FLAG_IGNORE_CASE (1U << 1)
-#define DUK_RE_FLAG_MULTILINE (1U << 2)
+#define DUK_RE_FLAG_GLOBAL (1U << 0)
+#define DUK_RE_FLAG_IGNORE_CASE (1U << 1)
+#define DUK_RE_FLAG_MULTILINE (1U << 2)
struct duk_re_matcher_ctx {
duk_hthread *thr;
@@ -4347,7 +4518,7 @@ struct duk_re_matcher_ctx {
const duk_uint8_t *input_end;
const duk_uint8_t *bytecode;
const duk_uint8_t *bytecode_end;
- const duk_uint8_t **saved; /* allocated from valstack (fixed buffer) */
+ const duk_uint8_t **saved; /* allocated from valstack (fixed buffer) */
duk_uint32_t nsaved;
duk_uint32_t recursion_depth;
duk_uint32_t recursion_limit;
@@ -4362,11 +4533,11 @@ struct duk_re_compiler_ctx {
duk_lexer_ctx lex;
duk_re_token curr_token;
duk_bufwriter_ctx bw;
- duk_uint32_t captures; /* highest capture number emitted so far (used as: ++captures) */
+ duk_uint32_t captures; /* highest capture number emitted so far (used as: ++captures) */
duk_uint32_t highest_backref;
duk_uint32_t recursion_depth;
duk_uint32_t recursion_limit;
- duk_uint32_t nranges; /* internal temporary value, used for char classes */
+ duk_uint32_t nranges; /* internal temporary value, used for char classes */
};
/*
@@ -4377,10 +4548,10 @@ struct duk_re_compiler_ctx {
DUK_INTERNAL_DECL void duk_regexp_compile(duk_hthread *thr);
DUK_INTERNAL_DECL void duk_regexp_create_instance(duk_hthread *thr);
DUK_INTERNAL_DECL void duk_regexp_match(duk_hthread *thr);
-DUK_INTERNAL_DECL void duk_regexp_match_force_global(duk_hthread *thr); /* hacky helper for String.prototype.split() */
+DUK_INTERNAL_DECL void duk_regexp_match_force_global(duk_hthread *thr); /* hacky helper for String.prototype.split() */
#endif
-#endif /* DUK_REGEXP_H_INCLUDED */
+#endif /* DUK_REGEXP_H_INCLUDED */
/* #include duk_heaphdr.h */
/*
* Heap header definition and assorted macros, including ref counting.
@@ -4433,7 +4604,7 @@ struct duk_heaphdr {
#else
duk_size_t h_refcount;
#endif
-#endif /* DUK_USE_REFERENCE_COUNTING */
+#endif /* DUK_USE_REFERENCE_COUNTING */
#if defined(DUK_USE_HEAPPTR16)
duk_uint16_t h_next16;
@@ -4481,7 +4652,7 @@ struct duk_heaphdr_string {
#endif
#if defined(DUK_USE_REFCOUNT16)
duk_uint16_t h_refcount;
- duk_uint16_t h_strextra16; /* round out to 8 bytes */
+ duk_uint16_t h_strextra16; /* round out to 8 bytes */
#elif defined(DUK_USE_REFCOUNT32)
duk_uint32_t h_refcount;
#else
@@ -4489,160 +4660,169 @@ struct duk_heaphdr_string {
#endif
#else
duk_uint16_t h_strextra16;
-#endif /* DUK_USE_REFERENCE_COUNTING */
+#endif /* DUK_USE_REFERENCE_COUNTING */
duk_hstring *h_next;
/* No 'h_prev' pointer for strings. */
};
-#define DUK_HEAPHDR_FLAGS_TYPE_MASK 0x00000003UL
-#define DUK_HEAPHDR_FLAGS_FLAG_MASK (~DUK_HEAPHDR_FLAGS_TYPE_MASK)
+#define DUK_HEAPHDR_FLAGS_TYPE_MASK 0x00000003UL
+#define DUK_HEAPHDR_FLAGS_FLAG_MASK (~DUK_HEAPHDR_FLAGS_TYPE_MASK)
- /* 2 bits for heap type */
-#define DUK_HEAPHDR_FLAGS_HEAP_START 2 /* 5 heap flags */
-#define DUK_HEAPHDR_FLAGS_USER_START 7 /* 25 user flags */
+/* 2 bits for heap type */
+#define DUK_HEAPHDR_FLAGS_HEAP_START 2 /* 5 heap flags */
+#define DUK_HEAPHDR_FLAGS_USER_START 7 /* 25 user flags */
-#define DUK_HEAPHDR_HEAP_FLAG_NUMBER(n) (DUK_HEAPHDR_FLAGS_HEAP_START + (n))
-#define DUK_HEAPHDR_USER_FLAG_NUMBER(n) (DUK_HEAPHDR_FLAGS_USER_START + (n))
-#define DUK_HEAPHDR_HEAP_FLAG(n) (1UL << (DUK_HEAPHDR_FLAGS_HEAP_START + (n)))
-#define DUK_HEAPHDR_USER_FLAG(n) (1UL << (DUK_HEAPHDR_FLAGS_USER_START + (n)))
+#define DUK_HEAPHDR_HEAP_FLAG_NUMBER(n) (DUK_HEAPHDR_FLAGS_HEAP_START + (n))
+#define DUK_HEAPHDR_USER_FLAG_NUMBER(n) (DUK_HEAPHDR_FLAGS_USER_START + (n))
+#define DUK_HEAPHDR_HEAP_FLAG(n) (1UL << (DUK_HEAPHDR_FLAGS_HEAP_START + (n)))
+#define DUK_HEAPHDR_USER_FLAG(n) (1UL << (DUK_HEAPHDR_FLAGS_USER_START + (n)))
-#define DUK_HEAPHDR_FLAG_REACHABLE DUK_HEAPHDR_HEAP_FLAG(0) /* mark-and-sweep: reachable */
-#define DUK_HEAPHDR_FLAG_TEMPROOT DUK_HEAPHDR_HEAP_FLAG(1) /* mark-and-sweep: children not processed */
-#define DUK_HEAPHDR_FLAG_FINALIZABLE DUK_HEAPHDR_HEAP_FLAG(2) /* mark-and-sweep: finalizable (on current pass) */
-#define DUK_HEAPHDR_FLAG_FINALIZED DUK_HEAPHDR_HEAP_FLAG(3) /* mark-and-sweep: finalized (on previous pass) */
-#define DUK_HEAPHDR_FLAG_READONLY DUK_HEAPHDR_HEAP_FLAG(4) /* read-only object, in code section */
+#define DUK_HEAPHDR_FLAG_REACHABLE DUK_HEAPHDR_HEAP_FLAG(0) /* mark-and-sweep: reachable */
+#define DUK_HEAPHDR_FLAG_TEMPROOT DUK_HEAPHDR_HEAP_FLAG(1) /* mark-and-sweep: children not processed */
+#define DUK_HEAPHDR_FLAG_FINALIZABLE DUK_HEAPHDR_HEAP_FLAG(2) /* mark-and-sweep: finalizable (on current pass) */
+#define DUK_HEAPHDR_FLAG_FINALIZED DUK_HEAPHDR_HEAP_FLAG(3) /* mark-and-sweep: finalized (on previous pass) */
+#define DUK_HEAPHDR_FLAG_READONLY DUK_HEAPHDR_HEAP_FLAG(4) /* read-only object, in code section */
-#define DUK_HTYPE_MIN 0
-#define DUK_HTYPE_STRING 0
-#define DUK_HTYPE_OBJECT 1
-#define DUK_HTYPE_BUFFER 2
-#define DUK_HTYPE_MAX 2
+#define DUK_HTYPE_MIN 0
+#define DUK_HTYPE_STRING 0
+#define DUK_HTYPE_OBJECT 1
+#define DUK_HTYPE_BUFFER 2
+#define DUK_HTYPE_MAX 2
#if defined(DUK_USE_HEAPPTR16)
-#define DUK_HEAPHDR_GET_NEXT(heap,h) \
- ((duk_heaphdr *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->h_next16))
-#define DUK_HEAPHDR_SET_NEXT(heap,h,val) do { \
+#define DUK_HEAPHDR_GET_NEXT(heap, h) ((duk_heaphdr *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->h_next16))
+#define DUK_HEAPHDR_SET_NEXT(heap, h, val) \
+ do { \
(h)->h_next16 = DUK_USE_HEAPPTR_ENC16((heap)->heap_udata, (void *) val); \
} while (0)
#else
-#define DUK_HEAPHDR_GET_NEXT(heap,h) ((h)->h_next)
-#define DUK_HEAPHDR_SET_NEXT(heap,h,val) do { \
+#define DUK_HEAPHDR_GET_NEXT(heap, h) ((h)->h_next)
+#define DUK_HEAPHDR_SET_NEXT(heap, h, val) \
+ do { \
(h)->h_next = (val); \
} while (0)
#endif
#if defined(DUK_USE_DOUBLE_LINKED_HEAP)
#if defined(DUK_USE_HEAPPTR16)
-#define DUK_HEAPHDR_GET_PREV(heap,h) \
- ((duk_heaphdr *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->h_prev16))
-#define DUK_HEAPHDR_SET_PREV(heap,h,val) do { \
+#define DUK_HEAPHDR_GET_PREV(heap, h) ((duk_heaphdr *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->h_prev16))
+#define DUK_HEAPHDR_SET_PREV(heap, h, val) \
+ do { \
(h)->h_prev16 = DUK_USE_HEAPPTR_ENC16((heap)->heap_udata, (void *) (val)); \
} while (0)
#else
-#define DUK_HEAPHDR_GET_PREV(heap,h) ((h)->h_prev)
-#define DUK_HEAPHDR_SET_PREV(heap,h,val) do { \
+#define DUK_HEAPHDR_GET_PREV(heap, h) ((h)->h_prev)
+#define DUK_HEAPHDR_SET_PREV(heap, h, val) \
+ do { \
(h)->h_prev = (val); \
} while (0)
#endif
#endif
#if defined(DUK_USE_REFERENCE_COUNTING)
-#define DUK_HEAPHDR_GET_REFCOUNT(h) ((h)->h_refcount)
-#define DUK_HEAPHDR_SET_REFCOUNT(h,val) do { \
+#define DUK_HEAPHDR_GET_REFCOUNT(h) ((h)->h_refcount)
+#define DUK_HEAPHDR_SET_REFCOUNT(h, val) \
+ do { \
(h)->h_refcount = (val); \
- DUK_ASSERT((h)->h_refcount == (val)); /* No truncation. */ \
+ DUK_ASSERT((h)->h_refcount == (val)); /* No truncation. */ \
} while (0)
-#define DUK_HEAPHDR_PREINC_REFCOUNT(h) (++(h)->h_refcount) /* result: updated refcount */
-#define DUK_HEAPHDR_PREDEC_REFCOUNT(h) (--(h)->h_refcount) /* result: updated refcount */
+#define DUK_HEAPHDR_PREINC_REFCOUNT(h) (++(h)->h_refcount) /* result: updated refcount */
+#define DUK_HEAPHDR_PREDEC_REFCOUNT(h) (--(h)->h_refcount) /* result: updated refcount */
#else
/* refcount macros not defined without refcounting, caller must #if defined() now */
-#endif /* DUK_USE_REFERENCE_COUNTING */
+#endif /* DUK_USE_REFERENCE_COUNTING */
/*
* Note: type is treated as a field separate from flags, so some masking is
* involved in the macros below.
*/
-#define DUK_HEAPHDR_GET_FLAGS_RAW(h) ((h)->h_flags)
-#define DUK_HEAPHDR_SET_FLAGS_RAW(h,val) do { \
- (h)->h_flags = (val); } \
+#define DUK_HEAPHDR_GET_FLAGS_RAW(h) ((h)->h_flags)
+#define DUK_HEAPHDR_SET_FLAGS_RAW(h, val) \
+ do { \
+ (h)->h_flags = (val); \
+ } \
}
-#define DUK_HEAPHDR_GET_FLAGS(h) ((h)->h_flags & DUK_HEAPHDR_FLAGS_FLAG_MASK)
-#define DUK_HEAPHDR_SET_FLAGS(h,val) do { \
+#define DUK_HEAPHDR_GET_FLAGS(h) ((h)->h_flags & DUK_HEAPHDR_FLAGS_FLAG_MASK)
+#define DUK_HEAPHDR_SET_FLAGS(h, val) \
+ do { \
(h)->h_flags = ((h)->h_flags & ~(DUK_HEAPHDR_FLAGS_FLAG_MASK)) | (val); \
} while (0)
-#define DUK_HEAPHDR_GET_TYPE(h) ((h)->h_flags & DUK_HEAPHDR_FLAGS_TYPE_MASK)
-#define DUK_HEAPHDR_SET_TYPE(h,val) do { \
+#define DUK_HEAPHDR_GET_TYPE(h) ((h)->h_flags & DUK_HEAPHDR_FLAGS_TYPE_MASK)
+#define DUK_HEAPHDR_SET_TYPE(h, val) \
+ do { \
(h)->h_flags = ((h)->h_flags & ~(DUK_HEAPHDR_FLAGS_TYPE_MASK)) | (val); \
} while (0)
/* Comparison for type >= DUK_HTYPE_MIN skipped; because DUK_HTYPE_MIN is zero
* and the comparison is unsigned, it's always true and generates warnings.
*/
-#define DUK_HEAPHDR_HTYPE_VALID(h) ( \
- DUK_HEAPHDR_GET_TYPE((h)) <= DUK_HTYPE_MAX \
- )
+#define DUK_HEAPHDR_HTYPE_VALID(h) (DUK_HEAPHDR_GET_TYPE((h)) <= DUK_HTYPE_MAX)
-#define DUK_HEAPHDR_SET_TYPE_AND_FLAGS(h,tval,fval) do { \
- (h)->h_flags = ((tval) & DUK_HEAPHDR_FLAGS_TYPE_MASK) | \
- ((fval) & DUK_HEAPHDR_FLAGS_FLAG_MASK); \
+#define DUK_HEAPHDR_SET_TYPE_AND_FLAGS(h, tval, fval) \
+ do { \
+ (h)->h_flags = ((tval) &DUK_HEAPHDR_FLAGS_TYPE_MASK) | ((fval) &DUK_HEAPHDR_FLAGS_FLAG_MASK); \
} while (0)
-#define DUK_HEAPHDR_SET_FLAG_BITS(h,bits) do { \
+#define DUK_HEAPHDR_SET_FLAG_BITS(h, bits) \
+ do { \
DUK_ASSERT(((bits) & ~(DUK_HEAPHDR_FLAGS_FLAG_MASK)) == 0); \
(h)->h_flags |= (bits); \
} while (0)
-#define DUK_HEAPHDR_CLEAR_FLAG_BITS(h,bits) do { \
+#define DUK_HEAPHDR_CLEAR_FLAG_BITS(h, bits) \
+ do { \
DUK_ASSERT(((bits) & ~(DUK_HEAPHDR_FLAGS_FLAG_MASK)) == 0); \
(h)->h_flags &= ~((bits)); \
} while (0)
-#define DUK_HEAPHDR_CHECK_FLAG_BITS(h,bits) (((h)->h_flags & (bits)) != 0)
+#define DUK_HEAPHDR_CHECK_FLAG_BITS(h, bits) (((h)->h_flags & (bits)) != 0)
-#define DUK_HEAPHDR_SET_REACHABLE(h) DUK_HEAPHDR_SET_FLAG_BITS((h),DUK_HEAPHDR_FLAG_REACHABLE)
-#define DUK_HEAPHDR_CLEAR_REACHABLE(h) DUK_HEAPHDR_CLEAR_FLAG_BITS((h),DUK_HEAPHDR_FLAG_REACHABLE)
-#define DUK_HEAPHDR_HAS_REACHABLE(h) DUK_HEAPHDR_CHECK_FLAG_BITS((h),DUK_HEAPHDR_FLAG_REACHABLE)
+#define DUK_HEAPHDR_SET_REACHABLE(h) DUK_HEAPHDR_SET_FLAG_BITS((h), DUK_HEAPHDR_FLAG_REACHABLE)
+#define DUK_HEAPHDR_CLEAR_REACHABLE(h) DUK_HEAPHDR_CLEAR_FLAG_BITS((h), DUK_HEAPHDR_FLAG_REACHABLE)
+#define DUK_HEAPHDR_HAS_REACHABLE(h) DUK_HEAPHDR_CHECK_FLAG_BITS((h), DUK_HEAPHDR_FLAG_REACHABLE)
-#define DUK_HEAPHDR_SET_TEMPROOT(h) DUK_HEAPHDR_SET_FLAG_BITS((h),DUK_HEAPHDR_FLAG_TEMPROOT)
-#define DUK_HEAPHDR_CLEAR_TEMPROOT(h) DUK_HEAPHDR_CLEAR_FLAG_BITS((h),DUK_HEAPHDR_FLAG_TEMPROOT)
-#define DUK_HEAPHDR_HAS_TEMPROOT(h) DUK_HEAPHDR_CHECK_FLAG_BITS((h),DUK_HEAPHDR_FLAG_TEMPROOT)
+#define DUK_HEAPHDR_SET_TEMPROOT(h) DUK_HEAPHDR_SET_FLAG_BITS((h), DUK_HEAPHDR_FLAG_TEMPROOT)
+#define DUK_HEAPHDR_CLEAR_TEMPROOT(h) DUK_HEAPHDR_CLEAR_FLAG_BITS((h), DUK_HEAPHDR_FLAG_TEMPROOT)
+#define DUK_HEAPHDR_HAS_TEMPROOT(h) DUK_HEAPHDR_CHECK_FLAG_BITS((h), DUK_HEAPHDR_FLAG_TEMPROOT)
-#define DUK_HEAPHDR_SET_FINALIZABLE(h) DUK_HEAPHDR_SET_FLAG_BITS((h),DUK_HEAPHDR_FLAG_FINALIZABLE)
-#define DUK_HEAPHDR_CLEAR_FINALIZABLE(h) DUK_HEAPHDR_CLEAR_FLAG_BITS((h),DUK_HEAPHDR_FLAG_FINALIZABLE)
-#define DUK_HEAPHDR_HAS_FINALIZABLE(h) DUK_HEAPHDR_CHECK_FLAG_BITS((h),DUK_HEAPHDR_FLAG_FINALIZABLE)
+#define DUK_HEAPHDR_SET_FINALIZABLE(h) DUK_HEAPHDR_SET_FLAG_BITS((h), DUK_HEAPHDR_FLAG_FINALIZABLE)
+#define DUK_HEAPHDR_CLEAR_FINALIZABLE(h) DUK_HEAPHDR_CLEAR_FLAG_BITS((h), DUK_HEAPHDR_FLAG_FINALIZABLE)
+#define DUK_HEAPHDR_HAS_FINALIZABLE(h) DUK_HEAPHDR_CHECK_FLAG_BITS((h), DUK_HEAPHDR_FLAG_FINALIZABLE)
-#define DUK_HEAPHDR_SET_FINALIZED(h) DUK_HEAPHDR_SET_FLAG_BITS((h),DUK_HEAPHDR_FLAG_FINALIZED)
-#define DUK_HEAPHDR_CLEAR_FINALIZED(h) DUK_HEAPHDR_CLEAR_FLAG_BITS((h),DUK_HEAPHDR_FLAG_FINALIZED)
-#define DUK_HEAPHDR_HAS_FINALIZED(h) DUK_HEAPHDR_CHECK_FLAG_BITS((h),DUK_HEAPHDR_FLAG_FINALIZED)
+#define DUK_HEAPHDR_SET_FINALIZED(h) DUK_HEAPHDR_SET_FLAG_BITS((h), DUK_HEAPHDR_FLAG_FINALIZED)
+#define DUK_HEAPHDR_CLEAR_FINALIZED(h) DUK_HEAPHDR_CLEAR_FLAG_BITS((h), DUK_HEAPHDR_FLAG_FINALIZED)
+#define DUK_HEAPHDR_HAS_FINALIZED(h) DUK_HEAPHDR_CHECK_FLAG_BITS((h), DUK_HEAPHDR_FLAG_FINALIZED)
-#define DUK_HEAPHDR_SET_READONLY(h) DUK_HEAPHDR_SET_FLAG_BITS((h),DUK_HEAPHDR_FLAG_READONLY)
-#define DUK_HEAPHDR_CLEAR_READONLY(h) DUK_HEAPHDR_CLEAR_FLAG_BITS((h),DUK_HEAPHDR_FLAG_READONLY)
-#define DUK_HEAPHDR_HAS_READONLY(h) DUK_HEAPHDR_CHECK_FLAG_BITS((h),DUK_HEAPHDR_FLAG_READONLY)
+#define DUK_HEAPHDR_SET_READONLY(h) DUK_HEAPHDR_SET_FLAG_BITS((h), DUK_HEAPHDR_FLAG_READONLY)
+#define DUK_HEAPHDR_CLEAR_READONLY(h) DUK_HEAPHDR_CLEAR_FLAG_BITS((h), DUK_HEAPHDR_FLAG_READONLY)
+#define DUK_HEAPHDR_HAS_READONLY(h) DUK_HEAPHDR_CHECK_FLAG_BITS((h), DUK_HEAPHDR_FLAG_READONLY)
/* get or set a range of flags; m=first bit number, n=number of bits */
-#define DUK_HEAPHDR_GET_FLAG_RANGE(h,m,n) (((h)->h_flags >> (m)) & ((1UL << (n)) - 1UL))
+#define DUK_HEAPHDR_GET_FLAG_RANGE(h, m, n) (((h)->h_flags >> (m)) & ((1UL << (n)) - 1UL))
-#define DUK_HEAPHDR_SET_FLAG_RANGE(h,m,n,v) do { \
- (h)->h_flags = \
- ((h)->h_flags & (~(((1UL << (n)) - 1UL) << (m)))) \
- | ((v) << (m)); \
+#define DUK_HEAPHDR_SET_FLAG_RANGE(h, m, n, v) \
+ do { \
+ (h)->h_flags = ((h)->h_flags & (~(((1UL << (n)) - 1UL) << (m)))) | ((v) << (m)); \
} while (0)
/* init pointer fields to null */
#if defined(DUK_USE_DOUBLE_LINKED_HEAP)
-#define DUK_HEAPHDR_INIT_NULLS(h) do { \
+#define DUK_HEAPHDR_INIT_NULLS(h) \
+ do { \
DUK_HEAPHDR_SET_NEXT((h), (void *) NULL); \
DUK_HEAPHDR_SET_PREV((h), (void *) NULL); \
} while (0)
#else
-#define DUK_HEAPHDR_INIT_NULLS(h) do { \
+#define DUK_HEAPHDR_INIT_NULLS(h) \
+ do { \
DUK_HEAPHDR_SET_NEXT((h), (void *) NULL); \
} while (0)
#endif
-#define DUK_HEAPHDR_STRING_INIT_NULLS(h) do { \
+#define DUK_HEAPHDR_STRING_INIT_NULLS(h) \
+ do { \
(h)->h_next = NULL; \
} while (0)
@@ -4671,14 +4851,24 @@ struct duk_heaphdr_string {
DUK_INTERNAL_DECL void duk_heaphdr_assert_valid_subclassed(duk_heaphdr *h);
DUK_INTERNAL_DECL void duk_heaphdr_assert_links(duk_heap *heap, duk_heaphdr *h);
DUK_INTERNAL_DECL void duk_heaphdr_assert_valid(duk_heaphdr *h);
-#define DUK_HEAPHDR_ASSERT_LINKS(heap,h) do { duk_heaphdr_assert_links((heap), (h)); } while (0)
-#define DUK_HEAPHDR_ASSERT_VALID(h) do { duk_heaphdr_assert_valid((h)); } while (0)
+#define DUK_HEAPHDR_ASSERT_LINKS(heap, h) \
+ do { \
+ duk_heaphdr_assert_links((heap), (h)); \
+ } while (0)
+#define DUK_HEAPHDR_ASSERT_VALID(h) \
+ do { \
+ duk_heaphdr_assert_valid((h)); \
+ } while (0)
#else
-#define DUK_HEAPHDR_ASSERT_LINKS(heap,h) do {} while (0)
-#define DUK_HEAPHDR_ASSERT_VALID(h) do {} while (0)
+#define DUK_HEAPHDR_ASSERT_LINKS(heap, h) \
+ do { \
+ } while (0)
+#define DUK_HEAPHDR_ASSERT_VALID(h) \
+ do { \
+ } while (0)
#endif
-#endif /* DUK_HEAPHDR_H_INCLUDED */
+#endif /* DUK_HEAPHDR_H_INCLUDED */
/* #include duk_refcount.h */
/*
* Reference counting helper macros. The macros take a thread argument
@@ -4699,19 +4889,20 @@ DUK_INTERNAL_DECL void duk_heaphdr_assert_valid(duk_heaphdr *h);
/* XXX: double evaluation for 'tv' argument. */
#define DUK_TVAL_NEEDS_REFCOUNT_UPDATE(tv) \
(DUK_TVAL_IS_HEAP_ALLOCATED((tv)) && !DUK_HEAPHDR_HAS_READONLY(DUK_TVAL_GET_HEAPHDR((tv))))
-#define DUK_HEAPHDR_NEEDS_REFCOUNT_UPDATE(h) (!DUK_HEAPHDR_HAS_READONLY((h)))
-#else /* DUK_USE_ROM_OBJECTS */
+#define DUK_HEAPHDR_NEEDS_REFCOUNT_UPDATE(h) (!DUK_HEAPHDR_HAS_READONLY((h)))
+#else /* DUK_USE_ROM_OBJECTS */
/* Without ROM objects "needs refcount update" == is heap allocated. */
-#define DUK_TVAL_NEEDS_REFCOUNT_UPDATE(tv) DUK_TVAL_IS_HEAP_ALLOCATED((tv))
-#define DUK_HEAPHDR_NEEDS_REFCOUNT_UPDATE(h) 1
-#endif /* DUK_USE_ROM_OBJECTS */
+#define DUK_TVAL_NEEDS_REFCOUNT_UPDATE(tv) DUK_TVAL_IS_HEAP_ALLOCATED((tv))
+#define DUK_HEAPHDR_NEEDS_REFCOUNT_UPDATE(h) 1
+#endif /* DUK_USE_ROM_OBJECTS */
/* Fast variants, inline refcount operations except for refzero handling.
* Can be used explicitly when speed is always more important than size.
* For a good compiler and a single file build, these are basically the
* same as a forced inline.
*/
-#define DUK_TVAL_INCREF_FAST(thr,tv) do { \
+#define DUK_TVAL_INCREF_FAST(thr, tv) \
+ do { \
duk_tval *duk__tv = (tv); \
DUK_ASSERT(duk__tv != NULL); \
if (DUK_TVAL_NEEDS_REFCOUNT_UPDATE(duk__tv)) { \
@@ -4719,10 +4910,11 @@ DUK_INTERNAL_DECL void duk_heaphdr_assert_valid(duk_heaphdr *h);
DUK_ASSERT(duk__h != NULL); \
DUK_ASSERT(DUK_HEAPHDR_HTYPE_VALID(duk__h)); \
DUK_HEAPHDR_PREINC_REFCOUNT(duk__h); \
- DUK_ASSERT(DUK_HEAPHDR_GET_REFCOUNT(duk__h) != 0); /* No wrapping. */ \
+ DUK_ASSERT(DUK_HEAPHDR_GET_REFCOUNT(duk__h) != 0); /* No wrapping. */ \
} \
} while (0)
-#define DUK_TVAL_DECREF_FAST(thr,tv) do { \
+#define DUK_TVAL_DECREF_FAST(thr, tv) \
+ do { \
duk_tval *duk__tv = (tv); \
DUK_ASSERT(duk__tv != NULL); \
if (DUK_TVAL_NEEDS_REFCOUNT_UPDATE(duk__tv)) { \
@@ -4735,7 +4927,8 @@ DUK_INTERNAL_DECL void duk_heaphdr_assert_valid(duk_heaphdr *h);
} \
} \
} while (0)
-#define DUK_TVAL_DECREF_NORZ_FAST(thr,tv) do { \
+#define DUK_TVAL_DECREF_NORZ_FAST(thr, tv) \
+ do { \
duk_tval *duk__tv = (tv); \
DUK_ASSERT(duk__tv != NULL); \
if (DUK_TVAL_NEEDS_REFCOUNT_UPDATE(duk__tv)) { \
@@ -4748,16 +4941,18 @@ DUK_INTERNAL_DECL void duk_heaphdr_assert_valid(duk_heaphdr *h);
} \
} \
} while (0)
-#define DUK_HEAPHDR_INCREF_FAST(thr,h) do { \
+#define DUK_HEAPHDR_INCREF_FAST(thr, h) \
+ do { \
duk_heaphdr *duk__h = (duk_heaphdr *) (h); \
DUK_ASSERT(duk__h != NULL); \
DUK_ASSERT(DUK_HEAPHDR_HTYPE_VALID(duk__h)); \
if (DUK_HEAPHDR_NEEDS_REFCOUNT_UPDATE(duk__h)) { \
DUK_HEAPHDR_PREINC_REFCOUNT(duk__h); \
- DUK_ASSERT(DUK_HEAPHDR_GET_REFCOUNT(duk__h) != 0); /* No wrapping. */ \
+ DUK_ASSERT(DUK_HEAPHDR_GET_REFCOUNT(duk__h) != 0); /* No wrapping. */ \
} \
} while (0)
-#define DUK_HEAPHDR_DECREF_FAST_RAW(thr,h,rzcall,rzcast) do { \
+#define DUK_HEAPHDR_DECREF_FAST_RAW(thr, h, rzcall, rzcast) \
+ do { \
duk_heaphdr *duk__h = (duk_heaphdr *) (h); \
DUK_ASSERT(duk__h != NULL); \
DUK_ASSERT(DUK_HEAPHDR_HTYPE_VALID(duk__h)); \
@@ -4768,29 +4963,72 @@ DUK_INTERNAL_DECL void duk_heaphdr_assert_valid(duk_heaphdr *h);
} \
} \
} while (0)
-#define DUK_HEAPHDR_DECREF_FAST(thr,h) \
- DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_heaphdr_refzero,duk_heaphdr *)
-#define DUK_HEAPHDR_DECREF_NORZ_FAST(thr,h) \
- DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_heaphdr_refzero_norz,duk_heaphdr *)
+#define DUK_HEAPHDR_DECREF_FAST(thr, h) DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_heaphdr_refzero, duk_heaphdr *)
+#define DUK_HEAPHDR_DECREF_NORZ_FAST(thr, h) DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_heaphdr_refzero_norz, duk_heaphdr *)
/* Slow variants, call to a helper to reduce code size.
* Can be used explicitly when size is always more important than speed.
*/
-#define DUK_TVAL_INCREF_SLOW(thr,tv) do { duk_tval_incref((tv)); } while (0)
-#define DUK_TVAL_DECREF_SLOW(thr,tv) do { duk_tval_decref((thr), (tv)); } while (0)
-#define DUK_TVAL_DECREF_NORZ_SLOW(thr,tv) do { duk_tval_decref_norz((thr), (tv)); } while (0)
-#define DUK_HEAPHDR_INCREF_SLOW(thr,h) do { duk_heaphdr_incref((duk_heaphdr *) (h)); } while (0)
-#define DUK_HEAPHDR_DECREF_SLOW(thr,h) do { duk_heaphdr_decref((thr), (duk_heaphdr *) (h)); } while (0)
-#define DUK_HEAPHDR_DECREF_NORZ_SLOW(thr,h) do { duk_heaphdr_decref_norz((thr), (duk_heaphdr *) (h)); } while (0)
-#define DUK_HSTRING_INCREF_SLOW(thr,h) do { duk_heaphdr_incref((duk_heaphdr *) (h)); } while (0)
-#define DUK_HSTRING_DECREF_SLOW(thr,h) do { duk_heaphdr_decref((thr), (duk_heaphdr *) (h)); } while (0)
-#define DUK_HSTRING_DECREF_NORZ_SLOW(thr,h) do { duk_heaphdr_decref_norz((thr), (duk_heaphdr *) (h)); } while (0)
-#define DUK_HBUFFER_INCREF_SLOW(thr,h) do { duk_heaphdr_incref((duk_heaphdr *) (h)); } while (0)
-#define DUK_HBUFFER_DECREF_SLOW(thr,h) do { duk_heaphdr_decref((thr), (duk_heaphdr *) (h)); } while (0)
-#define DUK_HBUFFER_DECREF_NORZ_SLOW(thr,h) do { duk_heaphdr_decref_norz((thr), (duk_heaphdr *) (h)); } while (0)
-#define DUK_HOBJECT_INCREF_SLOW(thr,h) do { duk_heaphdr_incref((duk_heaphdr *) (h)); } while (0)
-#define DUK_HOBJECT_DECREF_SLOW(thr,h) do { duk_heaphdr_decref((thr), (duk_heaphdr *) (h)); } while (0)
-#define DUK_HOBJECT_DECREF_NORZ_SLOW(thr,h) do { duk_heaphdr_decref_norz((thr), (duk_heaphdr *) (h)); } while (0)
+#define DUK_TVAL_INCREF_SLOW(thr, tv) \
+ do { \
+ duk_tval_incref((tv)); \
+ } while (0)
+#define DUK_TVAL_DECREF_SLOW(thr, tv) \
+ do { \
+ duk_tval_decref((thr), (tv)); \
+ } while (0)
+#define DUK_TVAL_DECREF_NORZ_SLOW(thr, tv) \
+ do { \
+ duk_tval_decref_norz((thr), (tv)); \
+ } while (0)
+#define DUK_HEAPHDR_INCREF_SLOW(thr, h) \
+ do { \
+ duk_heaphdr_incref((duk_heaphdr *) (h)); \
+ } while (0)
+#define DUK_HEAPHDR_DECREF_SLOW(thr, h) \
+ do { \
+ duk_heaphdr_decref((thr), (duk_heaphdr *) (h)); \
+ } while (0)
+#define DUK_HEAPHDR_DECREF_NORZ_SLOW(thr, h) \
+ do { \
+ duk_heaphdr_decref_norz((thr), (duk_heaphdr *) (h)); \
+ } while (0)
+#define DUK_HSTRING_INCREF_SLOW(thr, h) \
+ do { \
+ duk_heaphdr_incref((duk_heaphdr *) (h)); \
+ } while (0)
+#define DUK_HSTRING_DECREF_SLOW(thr, h) \
+ do { \
+ duk_heaphdr_decref((thr), (duk_heaphdr *) (h)); \
+ } while (0)
+#define DUK_HSTRING_DECREF_NORZ_SLOW(thr, h) \
+ do { \
+ duk_heaphdr_decref_norz((thr), (duk_heaphdr *) (h)); \
+ } while (0)
+#define DUK_HBUFFER_INCREF_SLOW(thr, h) \
+ do { \
+ duk_heaphdr_incref((duk_heaphdr *) (h)); \
+ } while (0)
+#define DUK_HBUFFER_DECREF_SLOW(thr, h) \
+ do { \
+ duk_heaphdr_decref((thr), (duk_heaphdr *) (h)); \
+ } while (0)
+#define DUK_HBUFFER_DECREF_NORZ_SLOW(thr, h) \
+ do { \
+ duk_heaphdr_decref_norz((thr), (duk_heaphdr *) (h)); \
+ } while (0)
+#define DUK_HOBJECT_INCREF_SLOW(thr, h) \
+ do { \
+ duk_heaphdr_incref((duk_heaphdr *) (h)); \
+ } while (0)
+#define DUK_HOBJECT_DECREF_SLOW(thr, h) \
+ do { \
+ duk_heaphdr_decref((thr), (duk_heaphdr *) (h)); \
+ } while (0)
+#define DUK_HOBJECT_DECREF_NORZ_SLOW(thr, h) \
+ do { \
+ duk_heaphdr_decref_norz((thr), (duk_heaphdr *) (h)); \
+ } while (0)
/* Default variants. Selection depends on speed/size preference.
* Concretely: with gcc 4.8.1 -Os x64 the difference in final binary
@@ -4800,122 +5038,136 @@ DUK_INTERNAL_DECL void duk_heaphdr_assert_valid(duk_heaphdr *h);
/* XXX: It would be nice to specialize for specific duk_hobject subtypes
* but current refzero queue handling prevents that.
*/
-#define DUK_TVAL_INCREF(thr,tv) DUK_TVAL_INCREF_FAST((thr),(tv))
-#define DUK_TVAL_DECREF(thr,tv) DUK_TVAL_DECREF_FAST((thr),(tv))
-#define DUK_TVAL_DECREF_NORZ(thr,tv) DUK_TVAL_DECREF_NORZ_FAST((thr),(tv))
-#define DUK_HEAPHDR_INCREF(thr,h) DUK_HEAPHDR_INCREF_FAST((thr),(h))
-#define DUK_HEAPHDR_DECREF(thr,h) DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_heaphdr_refzero,duk_heaphdr *)
-#define DUK_HEAPHDR_DECREF_NORZ(thr,h) DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_heaphdr_refzero_norz,duk_heaphdr *)
-#define DUK_HSTRING_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) (h))
-#define DUK_HSTRING_DECREF(thr,h) DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_hstring_refzero,duk_hstring *)
-#define DUK_HSTRING_DECREF_NORZ(thr,h) DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_hstring_refzero,duk_hstring *) /* no 'norz' variant */
-#define DUK_HOBJECT_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) (h))
-#define DUK_HOBJECT_DECREF(thr,h) DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_hobject_refzero,duk_hobject *)
-#define DUK_HOBJECT_DECREF_NORZ(thr,h) DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_hobject_refzero_norz,duk_hobject *)
-#define DUK_HBUFFER_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) (h))
-#define DUK_HBUFFER_DECREF(thr,h) DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_hbuffer_refzero,duk_hbuffer *)
-#define DUK_HBUFFER_DECREF_NORZ(thr,h) DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_hbuffer_refzero,duk_hbuffer *) /* no 'norz' variant */
-#define DUK_HCOMPFUNC_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) &(h)->obj)
-#define DUK_HCOMPFUNC_DECREF(thr,h) DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_hobject_refzero,duk_hobject *)
-#define DUK_HCOMPFUNC_DECREF_NORZ(thr,h) DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_hobject_refzero_norz,duk_hobject *)
-#define DUK_HNATFUNC_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) &(h)->obj)
-#define DUK_HNATFUNC_DECREF(thr,h) DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_hobject_refzero,duk_hobject *)
-#define DUK_HNATFUNC_DECREF_NORZ(thr,h) DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_hobject_refzero_norz,duk_hobject *)
-#define DUK_HBUFOBJ_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) &(h)->obj)
-#define DUK_HBUFOBJ_DECREF(thr,h) DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_hobject_refzero,duk_hobject *)
-#define DUK_HBUFOBJ_DECREF_NORZ(thr,h) DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_hobject_refzero_norz,duk_hobject *)
-#define DUK_HTHREAD_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) &(h)->obj)
-#define DUK_HTHREAD_DECREF(thr,h) DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_hobject_refzero,duk_hobject *)
-#define DUK_HTHREAD_DECREF_NORZ(thr,h) DUK_HEAPHDR_DECREF_FAST_RAW((thr),(h),duk_hobject_refzero_norz,duk_hobject *)
+#define DUK_TVAL_INCREF(thr, tv) DUK_TVAL_INCREF_FAST((thr), (tv))
+#define DUK_TVAL_DECREF(thr, tv) DUK_TVAL_DECREF_FAST((thr), (tv))
+#define DUK_TVAL_DECREF_NORZ(thr, tv) DUK_TVAL_DECREF_NORZ_FAST((thr), (tv))
+#define DUK_HEAPHDR_INCREF(thr, h) DUK_HEAPHDR_INCREF_FAST((thr), (h))
+#define DUK_HEAPHDR_DECREF(thr, h) DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_heaphdr_refzero, duk_heaphdr *)
+#define DUK_HEAPHDR_DECREF_NORZ(thr, h) DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_heaphdr_refzero_norz, duk_heaphdr *)
+#define DUK_HSTRING_INCREF(thr, h) DUK_HEAPHDR_INCREF((thr), (duk_heaphdr *) (h))
+#define DUK_HSTRING_DECREF(thr, h) DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_hstring_refzero, duk_hstring *)
+#define DUK_HSTRING_DECREF_NORZ(thr, h) \
+ DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_hstring_refzero, duk_hstring *) /* no 'norz' variant */
+#define DUK_HOBJECT_INCREF(thr, h) DUK_HEAPHDR_INCREF((thr), (duk_heaphdr *) (h))
+#define DUK_HOBJECT_DECREF(thr, h) DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_hobject_refzero, duk_hobject *)
+#define DUK_HOBJECT_DECREF_NORZ(thr, h) DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_hobject_refzero_norz, duk_hobject *)
+#define DUK_HBUFFER_INCREF(thr, h) DUK_HEAPHDR_INCREF((thr), (duk_heaphdr *) (h))
+#define DUK_HBUFFER_DECREF(thr, h) DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_hbuffer_refzero, duk_hbuffer *)
+#define DUK_HBUFFER_DECREF_NORZ(thr, h) \
+ DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_hbuffer_refzero, duk_hbuffer *) /* no 'norz' variant */
+#define DUK_HCOMPFUNC_INCREF(thr, h) DUK_HEAPHDR_INCREF((thr), (duk_heaphdr *) &(h)->obj)
+#define DUK_HCOMPFUNC_DECREF(thr, h) DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_hobject_refzero, duk_hobject *)
+#define DUK_HCOMPFUNC_DECREF_NORZ(thr, h) DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_hobject_refzero_norz, duk_hobject *)
+#define DUK_HNATFUNC_INCREF(thr, h) DUK_HEAPHDR_INCREF((thr), (duk_heaphdr *) &(h)->obj)
+#define DUK_HNATFUNC_DECREF(thr, h) DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_hobject_refzero, duk_hobject *)
+#define DUK_HNATFUNC_DECREF_NORZ(thr, h) DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_hobject_refzero_norz, duk_hobject *)
+#define DUK_HBUFOBJ_INCREF(thr, h) DUK_HEAPHDR_INCREF((thr), (duk_heaphdr *) &(h)->obj)
+#define DUK_HBUFOBJ_DECREF(thr, h) DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_hobject_refzero, duk_hobject *)
+#define DUK_HBUFOBJ_DECREF_NORZ(thr, h) DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_hobject_refzero_norz, duk_hobject *)
+#define DUK_HTHREAD_INCREF(thr, h) DUK_HEAPHDR_INCREF((thr), (duk_heaphdr *) &(h)->obj)
+#define DUK_HTHREAD_DECREF(thr, h) DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_hobject_refzero, duk_hobject *)
+#define DUK_HTHREAD_DECREF_NORZ(thr, h) DUK_HEAPHDR_DECREF_FAST_RAW((thr), (h), duk_hobject_refzero_norz, duk_hobject *)
#else
-#define DUK_TVAL_INCREF(thr,tv) DUK_TVAL_INCREF_SLOW((thr),(tv))
-#define DUK_TVAL_DECREF(thr,tv) DUK_TVAL_DECREF_SLOW((thr),(tv))
-#define DUK_TVAL_DECREF_NORZ(thr,tv) DUK_TVAL_DECREF_NORZ_SLOW((thr),(tv))
-#define DUK_HEAPHDR_INCREF(thr,h) DUK_HEAPHDR_INCREF_SLOW((thr),(h))
-#define DUK_HEAPHDR_DECREF(thr,h) DUK_HEAPHDR_DECREF_SLOW((thr),(h))
-#define DUK_HEAPHDR_DECREF_NORZ(thr,h) DUK_HEAPHDR_DECREF_NORZ_SLOW((thr),(h))
-#define DUK_HSTRING_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) (h))
-#define DUK_HSTRING_DECREF(thr,h) DUK_HSTRING_DECREF_SLOW((thr),(h))
-#define DUK_HSTRING_DECREF_NORZ(thr,h) DUK_HSTRING_DECREF_NORZ_SLOW((thr),(h))
-#define DUK_HOBJECT_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) (h))
-#define DUK_HOBJECT_DECREF(thr,h) DUK_HOBJECT_DECREF_SLOW((thr),(h))
-#define DUK_HOBJECT_DECREF_NORZ(thr,h) DUK_HOBJECT_DECREF_NORZ_SLOW((thr),(h))
-#define DUK_HBUFFER_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) (h))
-#define DUK_HBUFFER_DECREF(thr,h) DUK_HBUFFER_DECREF_SLOW((thr),(h))
-#define DUK_HBUFFER_DECREF_NORZ(thr,h) DUK_HBUFFER_DECREF_NORZ_SLOW((thr),(h))
-#define DUK_HCOMPFUNC_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) &(h)->obj)
-#define DUK_HCOMPFUNC_DECREF(thr,h) DUK_HOBJECT_DECREF_SLOW((thr),(duk_hobject *) &(h)->obj)
-#define DUK_HCOMPFUNC_DECREF_NORZ(thr,h) DUK_HOBJECT_DECREF_NORZ_SLOW((thr),(duk_hobject *) &(h)->obj)
-#define DUK_HNATFUNC_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) &(h)->obj)
-#define DUK_HNATFUNC_DECREF(thr,h) DUK_HOBJECT_DECREF_SLOW((thr),(duk_hobject *) &(h)->obj)
-#define DUK_HNATFUNC_DECREF_NORZ(thr,h) DUK_HOBJECT_DECREF_NORZ_SLOW((thr),(duk_hobject *) &(h)->obj)
-#define DUK_HBUFOBJ_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) &(h)->obj)
-#define DUK_HBUFOBJ_DECREF(thr,h) DUK_HOBJECT_DECREF_SLOW((thr),(duk_hobject *) &(h)->obj)
-#define DUK_HBUFOB_DECREF_NORZ(thr,h) DUK_HOBJECT_DECREF_NORZ_SLOW((thr),(duk_hobject *) &(h)->obj)
-#define DUK_HTHREAD_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) &(h)->obj)
-#define DUK_HTHREAD_DECREF(thr,h) DUK_HOBJECT_DECREF_SLOW((thr),(duk_hobject *) &(h)->obj)
-#define DUK_HTHREAD_DECREF_NORZ(thr,h) DUK_HOBJECT_DECREF_NORZ_SLOW((thr),(duk_hobject *) &(h)->obj)
+#define DUK_TVAL_INCREF(thr, tv) DUK_TVAL_INCREF_SLOW((thr), (tv))
+#define DUK_TVAL_DECREF(thr, tv) DUK_TVAL_DECREF_SLOW((thr), (tv))
+#define DUK_TVAL_DECREF_NORZ(thr, tv) DUK_TVAL_DECREF_NORZ_SLOW((thr), (tv))
+#define DUK_HEAPHDR_INCREF(thr, h) DUK_HEAPHDR_INCREF_SLOW((thr), (h))
+#define DUK_HEAPHDR_DECREF(thr, h) DUK_HEAPHDR_DECREF_SLOW((thr), (h))
+#define DUK_HEAPHDR_DECREF_NORZ(thr, h) DUK_HEAPHDR_DECREF_NORZ_SLOW((thr), (h))
+#define DUK_HSTRING_INCREF(thr, h) DUK_HEAPHDR_INCREF((thr), (duk_heaphdr *) (h))
+#define DUK_HSTRING_DECREF(thr, h) DUK_HSTRING_DECREF_SLOW((thr), (h))
+#define DUK_HSTRING_DECREF_NORZ(thr, h) DUK_HSTRING_DECREF_NORZ_SLOW((thr), (h))
+#define DUK_HOBJECT_INCREF(thr, h) DUK_HEAPHDR_INCREF((thr), (duk_heaphdr *) (h))
+#define DUK_HOBJECT_DECREF(thr, h) DUK_HOBJECT_DECREF_SLOW((thr), (h))
+#define DUK_HOBJECT_DECREF_NORZ(thr, h) DUK_HOBJECT_DECREF_NORZ_SLOW((thr), (h))
+#define DUK_HBUFFER_INCREF(thr, h) DUK_HEAPHDR_INCREF((thr), (duk_heaphdr *) (h))
+#define DUK_HBUFFER_DECREF(thr, h) DUK_HBUFFER_DECREF_SLOW((thr), (h))
+#define DUK_HBUFFER_DECREF_NORZ(thr, h) DUK_HBUFFER_DECREF_NORZ_SLOW((thr), (h))
+#define DUK_HCOMPFUNC_INCREF(thr, h) DUK_HEAPHDR_INCREF((thr), (duk_heaphdr *) &(h)->obj)
+#define DUK_HCOMPFUNC_DECREF(thr, h) DUK_HOBJECT_DECREF_SLOW((thr), (duk_hobject *) &(h)->obj)
+#define DUK_HCOMPFUNC_DECREF_NORZ(thr, h) DUK_HOBJECT_DECREF_NORZ_SLOW((thr), (duk_hobject *) &(h)->obj)
+#define DUK_HNATFUNC_INCREF(thr, h) DUK_HEAPHDR_INCREF((thr), (duk_heaphdr *) &(h)->obj)
+#define DUK_HNATFUNC_DECREF(thr, h) DUK_HOBJECT_DECREF_SLOW((thr), (duk_hobject *) &(h)->obj)
+#define DUK_HNATFUNC_DECREF_NORZ(thr, h) DUK_HOBJECT_DECREF_NORZ_SLOW((thr), (duk_hobject *) &(h)->obj)
+#define DUK_HBUFOBJ_INCREF(thr, h) DUK_HEAPHDR_INCREF((thr), (duk_heaphdr *) &(h)->obj)
+#define DUK_HBUFOBJ_DECREF(thr, h) DUK_HOBJECT_DECREF_SLOW((thr), (duk_hobject *) &(h)->obj)
+#define DUK_HBUFOB_DECREF_NORZ(thr, h) DUK_HOBJECT_DECREF_NORZ_SLOW((thr), (duk_hobject *) &(h)->obj)
+#define DUK_HTHREAD_INCREF(thr, h) DUK_HEAPHDR_INCREF((thr), (duk_heaphdr *) &(h)->obj)
+#define DUK_HTHREAD_DECREF(thr, h) DUK_HOBJECT_DECREF_SLOW((thr), (duk_hobject *) &(h)->obj)
+#define DUK_HTHREAD_DECREF_NORZ(thr, h) DUK_HOBJECT_DECREF_NORZ_SLOW((thr), (duk_hobject *) &(h)->obj)
#endif
/* Convenience for some situations; the above macros don't allow NULLs
* for performance reasons. Macros cover only actually needed cases.
*/
-#define DUK_HEAPHDR_INCREF_ALLOWNULL(thr,h) do { \
+#define DUK_HEAPHDR_INCREF_ALLOWNULL(thr, h) \
+ do { \
if ((h) != NULL) { \
DUK_HEAPHDR_INCREF((thr), (duk_heaphdr *) (h)); \
} \
} while (0)
-#define DUK_HEAPHDR_DECREF_ALLOWNULL(thr,h) do { \
+#define DUK_HEAPHDR_DECREF_ALLOWNULL(thr, h) \
+ do { \
if ((h) != NULL) { \
DUK_HEAPHDR_DECREF((thr), (duk_heaphdr *) (h)); \
} \
} while (0)
-#define DUK_HEAPHDR_DECREF_NORZ_ALLOWNULL(thr,h) do { \
+#define DUK_HEAPHDR_DECREF_NORZ_ALLOWNULL(thr, h) \
+ do { \
if ((h) != NULL) { \
DUK_HEAPHDR_DECREF_NORZ((thr), (duk_heaphdr *) (h)); \
} \
} while (0)
-#define DUK_HOBJECT_INCREF_ALLOWNULL(thr,h) do { \
+#define DUK_HOBJECT_INCREF_ALLOWNULL(thr, h) \
+ do { \
if ((h) != NULL) { \
DUK_HOBJECT_INCREF((thr), (h)); \
} \
} while (0)
-#define DUK_HOBJECT_DECREF_ALLOWNULL(thr,h) do { \
+#define DUK_HOBJECT_DECREF_ALLOWNULL(thr, h) \
+ do { \
if ((h) != NULL) { \
DUK_HOBJECT_DECREF((thr), (h)); \
} \
} while (0)
-#define DUK_HOBJECT_DECREF_NORZ_ALLOWNULL(thr,h) do { \
+#define DUK_HOBJECT_DECREF_NORZ_ALLOWNULL(thr, h) \
+ do { \
if ((h) != NULL) { \
DUK_HOBJECT_DECREF_NORZ((thr), (h)); \
} \
} while (0)
-#define DUK_HBUFFER_INCREF_ALLOWNULL(thr,h) do { \
+#define DUK_HBUFFER_INCREF_ALLOWNULL(thr, h) \
+ do { \
if ((h) != NULL) { \
DUK_HBUFFER_INCREF((thr), (h)); \
} \
} while (0)
-#define DUK_HBUFFER_DECREF_ALLOWNULL(thr,h) do { \
+#define DUK_HBUFFER_DECREF_ALLOWNULL(thr, h) \
+ do { \
if ((h) != NULL) { \
DUK_HBUFFER_DECREF((thr), (h)); \
} \
} while (0)
-#define DUK_HBUFFER_DECREF_NORZ_ALLOWNULL(thr,h) do { \
+#define DUK_HBUFFER_DECREF_NORZ_ALLOWNULL(thr, h) \
+ do { \
if ((h) != NULL) { \
DUK_HBUFFER_DECREF_NORZ((thr), (h)); \
} \
} while (0)
-#define DUK_HTHREAD_INCREF_ALLOWNULL(thr,h) do { \
+#define DUK_HTHREAD_INCREF_ALLOWNULL(thr, h) \
+ do { \
if ((h) != NULL) { \
DUK_HTHREAD_INCREF((thr), (h)); \
} \
} while (0)
-#define DUK_HTHREAD_DECREF_ALLOWNULL(thr,h) do { \
+#define DUK_HTHREAD_DECREF_ALLOWNULL(thr, h) \
+ do { \
if ((h) != NULL) { \
DUK_HTHREAD_DECREF((thr), (h)); \
} \
} while (0)
-#define DUK_HTHREAD_DECREF_NORZ_ALLOWNULL(thr,h) do { \
+#define DUK_HTHREAD_DECREF_NORZ_ALLOWNULL(thr, h) \
+ do { \
if ((h) != NULL) { \
DUK_HTHREAD_DECREF_NORZ((thr), (h)); \
} \
@@ -4927,16 +5179,22 @@ DUK_INTERNAL_DECL void duk_heaphdr_assert_valid(duk_heaphdr *h);
* variant is performance critical.
*/
#if defined(DUK_USE_FINALIZER_SUPPORT)
-#define DUK_REFZERO_CHECK_FAST(thr) do { \
+#define DUK_REFZERO_CHECK_FAST(thr) \
+ do { \
duk_refzero_check_fast((thr)); \
} while (0)
-#define DUK_REFZERO_CHECK_SLOW(thr) do { \
+#define DUK_REFZERO_CHECK_SLOW(thr) \
+ do { \
duk_refzero_check_slow((thr)); \
} while (0)
-#else /* DUK_USE_FINALIZER_SUPPORT */
-#define DUK_REFZERO_CHECK_FAST(thr) do { } while (0)
-#define DUK_REFZERO_CHECK_SLOW(thr) do { } while (0)
-#endif /* DUK_USE_FINALIZER_SUPPORT */
+#else /* DUK_USE_FINALIZER_SUPPORT */
+#define DUK_REFZERO_CHECK_FAST(thr) \
+ do { \
+ } while (0)
+#define DUK_REFZERO_CHECK_SLOW(thr) \
+ do { \
+ } while (0)
+#endif /* DUK_USE_FINALIZER_SUPPORT */
/*
* Macros to set a duk_tval and update refcount of the target (decref the
@@ -4944,125 +5202,176 @@ DUK_INTERNAL_DECL void duk_heaphdr_assert_valid(duk_heaphdr *h);
* and footprint critical; any changes made should be measured for size/speed.
*/
-#define DUK_TVAL_SET_UNDEFINED_UPDREF_ALT0(thr,tvptr_dst) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_UNDEFINED_UPDREF_ALT0(thr, tvptr_dst) \
+ do { \
+ duk_tval *tv__dst; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_UNDEFINED(tv__dst); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
+ DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
} while (0)
-#define DUK_TVAL_SET_UNDEFINED_UPDREF_NORZ_ALT0(thr,tvptr_dst) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_UNDEFINED_UPDREF_NORZ_ALT0(thr, tvptr_dst) \
+ do { \
+ duk_tval *tv__dst; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_UNDEFINED(tv__dst); \
DUK_TVAL_DECREF_NORZ((thr), &tv__tmp); \
} while (0)
-#define DUK_TVAL_SET_UNUSED_UPDREF_ALT0(thr,tvptr_dst) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_UNUSED_UPDREF_ALT0(thr, tvptr_dst) \
+ do { \
+ duk_tval *tv__dst; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_UNUSED(tv__dst); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
+ DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
} while (0)
-#define DUK_TVAL_SET_NULL_UPDREF_ALT0(thr,tvptr_dst) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_NULL_UPDREF_ALT0(thr, tvptr_dst) \
+ do { \
+ duk_tval *tv__dst; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_NULL(tv__dst); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
+ DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
} while (0)
-#define DUK_TVAL_SET_BOOLEAN_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_BOOLEAN_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_BOOLEAN(tv__dst, (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
+ DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
} while (0)
-#define DUK_TVAL_SET_NUMBER_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_NUMBER_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_NUMBER(tv__dst, (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
+ DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
} while (0)
-#define DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_NUMBER_CHKFAST_FAST(tv__dst, (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
+ DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
} while (0)
-#define DUK_TVAL_SET_DOUBLE_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_DOUBLE_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_DOUBLE(tv__dst, (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
+ DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
} while (0)
-#define DUK_TVAL_SET_NAN_UPDREF_ALT0(thr,tvptr_dst) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_NAN_UPDREF_ALT0(thr, tvptr_dst) \
+ do { \
+ duk_tval *tv__dst; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_NAN(tv__dst); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
+ DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
} while (0)
#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_SET_I48_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_I48_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_I48(tv__dst, (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
+ DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
} while (0)
-#define DUK_TVAL_SET_I32_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_I32_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_I32(tv__dst, (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
+ DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
} while (0)
-#define DUK_TVAL_SET_U32_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_U32_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_U32(tv__dst, (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
+ DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
} while (0)
#else
-#define DUK_TVAL_SET_DOUBLE_CAST_UPDREF(thr,tvptr_dst,newval) \
+#define DUK_TVAL_SET_DOUBLE_CAST_UPDREF(thr, tvptr_dst, newval) \
DUK_TVAL_SET_DOUBLE_UPDREF((thr), (tvptr_dst), (duk_double_t) (newval))
-#endif /* DUK_USE_FASTINT */
+#endif /* DUK_USE_FASTINT */
-#define DUK_TVAL_SET_LIGHTFUNC_UPDREF_ALT0(thr,tvptr_dst,lf_v,lf_fp,lf_flags) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_LIGHTFUNC_UPDREF_ALT0(thr, tvptr_dst, lf_v, lf_fp, lf_flags) \
+ do { \
+ duk_tval *tv__dst; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_LIGHTFUNC(tv__dst, (lf_v), (lf_fp), (lf_flags)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
+ DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
} while (0)
-#define DUK_TVAL_SET_STRING_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_STRING_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_STRING(tv__dst, (newval)); \
DUK_HSTRING_INCREF((thr), (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
+ DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
} while (0)
-#define DUK_TVAL_SET_OBJECT_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_OBJECT_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_OBJECT(tv__dst, (newval)); \
DUK_HOBJECT_INCREF((thr), (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
+ DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
} while (0)
-#define DUK_TVAL_SET_BUFFER_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_BUFFER_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_BUFFER(tv__dst, (newval)); \
DUK_HBUFFER_INCREF((thr), (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
+ DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
} while (0)
-#define DUK_TVAL_SET_POINTER_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_POINTER_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_POINTER(tv__dst, (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
+ DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
} while (0)
/* DUK_TVAL_SET_TVAL_UPDREF() is used a lot in executor, property lookups,
@@ -5073,281 +5382,452 @@ DUK_INTERNAL_DECL void duk_heaphdr_assert_valid(duk_heaphdr *h);
*/
/* Original idiom used, minimal code size. */
-#define DUK_TVAL_SET_TVAL_UPDREF_ALT0(thr,tvptr_dst,tvptr_src) do { \
- duk_tval *tv__dst, *tv__src; duk_tval tv__tmp; \
- tv__dst = (tvptr_dst); tv__src = (tvptr_src); \
+#define DUK_TVAL_SET_TVAL_UPDREF_ALT0(thr, tvptr_dst, tvptr_src) \
+ do { \
+ duk_tval *tv__dst, *tv__src; \
+ duk_tval tv__tmp; \
+ tv__dst = (tvptr_dst); \
+ tv__src = (tvptr_src); \
DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
DUK_TVAL_SET_TVAL(tv__dst, tv__src); \
DUK_TVAL_INCREF((thr), tv__src); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
+ DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
} while (0)
/* Faster alternative: avoid making a temporary copy of tvptr_dst and use
* fast incref/decref macros.
*/
-#define DUK_TVAL_SET_TVAL_UPDREF_ALT1(thr,tvptr_dst,tvptr_src) do { \
- duk_tval *tv__dst, *tv__src; duk_heaphdr *h__obj; \
- tv__dst = (tvptr_dst); tv__src = (tvptr_src); \
+#define DUK_TVAL_SET_TVAL_UPDREF_ALT1(thr, tvptr_dst, tvptr_src) \
+ do { \
+ duk_tval *tv__dst, *tv__src; \
+ duk_heaphdr *h__obj; \
+ tv__dst = (tvptr_dst); \
+ tv__src = (tvptr_src); \
DUK_TVAL_INCREF_FAST((thr), tv__src); \
if (DUK_TVAL_NEEDS_REFCOUNT_UPDATE(tv__dst)) { \
h__obj = DUK_TVAL_GET_HEAPHDR(tv__dst); \
DUK_ASSERT(h__obj != NULL); \
DUK_TVAL_SET_TVAL(tv__dst, tv__src); \
- DUK_HEAPHDR_DECREF_FAST((thr), h__obj); /* side effects */ \
+ DUK_HEAPHDR_DECREF_FAST((thr), h__obj); /* side effects */ \
} else { \
DUK_TVAL_SET_TVAL(tv__dst, tv__src); \
} \
} while (0)
/* XXX: no optimized variants yet */
-#define DUK_TVAL_SET_UNDEFINED_UPDREF DUK_TVAL_SET_UNDEFINED_UPDREF_ALT0
-#define DUK_TVAL_SET_UNDEFINED_UPDREF_NORZ DUK_TVAL_SET_UNDEFINED_UPDREF_NORZ_ALT0
-#define DUK_TVAL_SET_UNUSED_UPDREF DUK_TVAL_SET_UNUSED_UPDREF_ALT0
-#define DUK_TVAL_SET_NULL_UPDREF DUK_TVAL_SET_NULL_UPDREF_ALT0
-#define DUK_TVAL_SET_BOOLEAN_UPDREF DUK_TVAL_SET_BOOLEAN_UPDREF_ALT0
-#define DUK_TVAL_SET_NUMBER_UPDREF DUK_TVAL_SET_NUMBER_UPDREF_ALT0
-#define DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF_ALT0
-#define DUK_TVAL_SET_DOUBLE_UPDREF DUK_TVAL_SET_DOUBLE_UPDREF_ALT0
-#define DUK_TVAL_SET_NAN_UPDREF DUK_TVAL_SET_NAN_UPDREF_ALT0
+#define DUK_TVAL_SET_UNDEFINED_UPDREF DUK_TVAL_SET_UNDEFINED_UPDREF_ALT0
+#define DUK_TVAL_SET_UNDEFINED_UPDREF_NORZ DUK_TVAL_SET_UNDEFINED_UPDREF_NORZ_ALT0
+#define DUK_TVAL_SET_UNUSED_UPDREF DUK_TVAL_SET_UNUSED_UPDREF_ALT0
+#define DUK_TVAL_SET_NULL_UPDREF DUK_TVAL_SET_NULL_UPDREF_ALT0
+#define DUK_TVAL_SET_BOOLEAN_UPDREF DUK_TVAL_SET_BOOLEAN_UPDREF_ALT0
+#define DUK_TVAL_SET_NUMBER_UPDREF DUK_TVAL_SET_NUMBER_UPDREF_ALT0
+#define DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF_ALT0
+#define DUK_TVAL_SET_DOUBLE_UPDREF DUK_TVAL_SET_DOUBLE_UPDREF_ALT0
+#define DUK_TVAL_SET_NAN_UPDREF DUK_TVAL_SET_NAN_UPDREF_ALT0
#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_SET_I48_UPDREF DUK_TVAL_SET_I48_UPDREF_ALT0
-#define DUK_TVAL_SET_I32_UPDREF DUK_TVAL_SET_I32_UPDREF_ALT0
-#define DUK_TVAL_SET_U32_UPDREF DUK_TVAL_SET_U32_UPDREF_ALT0
+#define DUK_TVAL_SET_I48_UPDREF DUK_TVAL_SET_I48_UPDREF_ALT0
+#define DUK_TVAL_SET_I32_UPDREF DUK_TVAL_SET_I32_UPDREF_ALT0
+#define DUK_TVAL_SET_U32_UPDREF DUK_TVAL_SET_U32_UPDREF_ALT0
#else
-#define DUK_TVAL_SET_I48_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF /* XXX: fast int-to-double */
-#define DUK_TVAL_SET_I32_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF
-#define DUK_TVAL_SET_U32_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF
-#endif /* DUK_USE_FASTINT */
-#define DUK_TVAL_SET_FASTINT_UPDREF DUK_TVAL_SET_I48_UPDREF /* convenience */
-#define DUK_TVAL_SET_LIGHTFUNC_UPDREF DUK_TVAL_SET_LIGHTFUNC_UPDREF_ALT0
-#define DUK_TVAL_SET_STRING_UPDREF DUK_TVAL_SET_STRING_UPDREF_ALT0
-#define DUK_TVAL_SET_OBJECT_UPDREF DUK_TVAL_SET_OBJECT_UPDREF_ALT0
-#define DUK_TVAL_SET_BUFFER_UPDREF DUK_TVAL_SET_BUFFER_UPDREF_ALT0
-#define DUK_TVAL_SET_POINTER_UPDREF DUK_TVAL_SET_POINTER_UPDREF_ALT0
+#define DUK_TVAL_SET_I48_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF /* XXX: fast int-to-double */
+#define DUK_TVAL_SET_I32_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF
+#define DUK_TVAL_SET_U32_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF
+#endif /* DUK_USE_FASTINT */
+#define DUK_TVAL_SET_FASTINT_UPDREF DUK_TVAL_SET_I48_UPDREF /* convenience */
+#define DUK_TVAL_SET_LIGHTFUNC_UPDREF DUK_TVAL_SET_LIGHTFUNC_UPDREF_ALT0
+#define DUK_TVAL_SET_STRING_UPDREF DUK_TVAL_SET_STRING_UPDREF_ALT0
+#define DUK_TVAL_SET_OBJECT_UPDREF DUK_TVAL_SET_OBJECT_UPDREF_ALT0
+#define DUK_TVAL_SET_BUFFER_UPDREF DUK_TVAL_SET_BUFFER_UPDREF_ALT0
+#define DUK_TVAL_SET_POINTER_UPDREF DUK_TVAL_SET_POINTER_UPDREF_ALT0
#if defined(DUK_USE_FAST_REFCOUNT_DEFAULT)
/* Optimized for speed. */
-#define DUK_TVAL_SET_TVAL_UPDREF DUK_TVAL_SET_TVAL_UPDREF_ALT1
-#define DUK_TVAL_SET_TVAL_UPDREF_FAST DUK_TVAL_SET_TVAL_UPDREF_ALT1
-#define DUK_TVAL_SET_TVAL_UPDREF_SLOW DUK_TVAL_SET_TVAL_UPDREF_ALT0
+#define DUK_TVAL_SET_TVAL_UPDREF DUK_TVAL_SET_TVAL_UPDREF_ALT1
+#define DUK_TVAL_SET_TVAL_UPDREF_FAST DUK_TVAL_SET_TVAL_UPDREF_ALT1
+#define DUK_TVAL_SET_TVAL_UPDREF_SLOW DUK_TVAL_SET_TVAL_UPDREF_ALT0
#else
/* Optimized for size. */
-#define DUK_TVAL_SET_TVAL_UPDREF DUK_TVAL_SET_TVAL_UPDREF_ALT0
-#define DUK_TVAL_SET_TVAL_UPDREF_FAST DUK_TVAL_SET_TVAL_UPDREF_ALT0
-#define DUK_TVAL_SET_TVAL_UPDREF_SLOW DUK_TVAL_SET_TVAL_UPDREF_ALT0
-#endif
-
-#else /* DUK_USE_REFERENCE_COUNTING */
-
-#define DUK_TVAL_NEEDS_REFCOUNT_UPDATE(tv) 0
-#define DUK_HEAPHDR_NEEDS_REFCOUNT_UPDATE(h) 0
-
-#define DUK_TVAL_INCREF_FAST(thr,v) do {} while (0) /* nop */
-#define DUK_TVAL_DECREF_FAST(thr,v) do {} while (0) /* nop */
-#define DUK_TVAL_DECREF_NORZ_FAST(thr,v) do {} while (0) /* nop */
-#define DUK_TVAL_INCREF_SLOW(thr,v) do {} while (0) /* nop */
-#define DUK_TVAL_DECREF_SLOW(thr,v) do {} while (0) /* nop */
-#define DUK_TVAL_DECREF_NORZ_SLOW(thr,v) do {} while (0) /* nop */
-#define DUK_TVAL_INCREF(thr,v) do {} while (0) /* nop */
-#define DUK_TVAL_DECREF(thr,v) do {} while (0) /* nop */
-#define DUK_TVAL_DECREF_NORZ(thr,v) do {} while (0) /* nop */
-#define DUK_HEAPHDR_INCREF_FAST(thr,h) do {} while (0) /* nop */
-#define DUK_HEAPHDR_DECREF_FAST(thr,h) do {} while (0) /* nop */
-#define DUK_HEAPHDR_DECREF_NORZ_FAST(thr,h) do {} while (0) /* nop */
-#define DUK_HEAPHDR_INCREF_SLOW(thr,h) do {} while (0) /* nop */
-#define DUK_HEAPHDR_DECREF_SLOW(thr,h) do {} while (0) /* nop */
-#define DUK_HEAPHDR_DECREF_NORZ_SLOW(thr,h) do {} while (0) /* nop */
-#define DUK_HEAPHDR_INCREF(thr,h) do {} while (0) /* nop */
-#define DUK_HEAPHDR_DECREF(thr,h) do {} while (0) /* nop */
-#define DUK_HEAPHDR_DECREF_NORZ(thr,h) do {} while (0) /* nop */
-#define DUK_HSTRING_INCREF_FAST(thr,h) do {} while (0) /* nop */
-#define DUK_HSTRING_DECREF_FAST(thr,h) do {} while (0) /* nop */
-#define DUK_HSTRING_DECREF_NORZ_FAST(thr,h) do {} while (0) /* nop */
-#define DUK_HSTRING_INCREF_SLOW(thr,h) do {} while (0) /* nop */
-#define DUK_HSTRING_DECREF_SLOW(thr,h) do {} while (0) /* nop */
-#define DUK_HSTRING_DECREF_NORZ_SLOW(thr,h) do {} while (0) /* nop */
-#define DUK_HSTRING_INCREF(thr,h) do {} while (0) /* nop */
-#define DUK_HSTRING_DECREF(thr,h) do {} while (0) /* nop */
-#define DUK_HSTRING_DECREF_NORZ(thr,h) do {} while (0) /* nop */
-#define DUK_HOBJECT_INCREF_FAST(thr,h) do {} while (0) /* nop */
-#define DUK_HOBJECT_DECREF_FAST(thr,h) do {} while (0) /* nop */
-#define DUK_HOBJECT_DECREF_NORZ_FAST(thr,h) do {} while (0) /* nop */
-#define DUK_HOBJECT_INCREF_SLOW(thr,h) do {} while (0) /* nop */
-#define DUK_HOBJECT_DECREF_SLOW(thr,h) do {} while (0) /* nop */
-#define DUK_HOBJECT_DECREF_NORZ_SLOW(thr,h) do {} while (0) /* nop */
-#define DUK_HOBJECT_INCREF(thr,h) do {} while (0) /* nop */
-#define DUK_HOBJECT_DECREF(thr,h) do {} while (0) /* nop */
-#define DUK_HOBJECT_DECREF_NORZ(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFFER_INCREF_FAST(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFFER_DECREF_FAST(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFFER_DECREF_NORZ_FAST(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFFER_INCREF_SLOW(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFFER_DECREF_SLOW(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFFER_DECREF_NORZ_SLOW(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFFER_INCREF(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFFER_DECREF(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFFER_DECREF_NORZ(thr,h) do {} while (0) /* nop */
-
-#define DUK_HCOMPFUNC_INCREF(thr,h) do {} while (0) /* nop */
-#define DUK_HCOMPFUNC_DECREF(thr,h) do {} while (0) /* nop */
-#define DUK_HCOMPFUNC_DECREF_NORZ(thr,h) do {} while (0) /* nop */
-#define DUK_HNATFUNC_INCREF(thr,h) do {} while (0) /* nop */
-#define DUK_HNATFUNC_DECREF(thr,h) do {} while (0) /* nop */
-#define DUK_HNATFUNC_DECREF_NORZ(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFOBJ_INCREF(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFOBJ_DECREF(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFOBJ_DECREF_NORZ(thr,h) do {} while (0) /* nop */
-#define DUK_HTHREAD_INCREF(thr,h) do {} while (0) /* nop */
-#define DUK_HTHREAD_DECREF(thr,h) do {} while (0) /* nop */
-#define DUK_HTHREAD_DECREF_NORZ(thr,h) do {} while (0) /* nop */
-#define DUK_HOBJECT_INCREF_ALLOWNULL(thr,h) do {} while (0) /* nop */
-#define DUK_HOBJECT_DECREF_ALLOWNULL(thr,h) do {} while (0) /* nop */
-#define DUK_HOBJECT_DECREF_NORZ_ALLOWNULL(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFFER_INCREF_ALLOWNULL(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFFER_DECREF_ALLOWNULL(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFFER_DECREF_NORZ_ALLOWNULL(thr,h) do {} while (0) /* nop */
-
-#define DUK_REFZERO_CHECK_FAST(thr) do {} while (0) /* nop */
-#define DUK_REFZERO_CHECK_SLOW(thr) do {} while (0) /* nop */
-
-#define DUK_TVAL_SET_UNDEFINED_UPDREF_ALT0(thr,tvptr_dst) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_TVAL_UPDREF DUK_TVAL_SET_TVAL_UPDREF_ALT0
+#define DUK_TVAL_SET_TVAL_UPDREF_FAST DUK_TVAL_SET_TVAL_UPDREF_ALT0
+#define DUK_TVAL_SET_TVAL_UPDREF_SLOW DUK_TVAL_SET_TVAL_UPDREF_ALT0
+#endif
+
+#else /* DUK_USE_REFERENCE_COUNTING */
+
+#define DUK_TVAL_NEEDS_REFCOUNT_UPDATE(tv) 0
+#define DUK_HEAPHDR_NEEDS_REFCOUNT_UPDATE(h) 0
+
+#define DUK_TVAL_INCREF_FAST(thr, v) \
+ do { \
+ } while (0) /* nop */
+#define DUK_TVAL_DECREF_FAST(thr, v) \
+ do { \
+ } while (0) /* nop */
+#define DUK_TVAL_DECREF_NORZ_FAST(thr, v) \
+ do { \
+ } while (0) /* nop */
+#define DUK_TVAL_INCREF_SLOW(thr, v) \
+ do { \
+ } while (0) /* nop */
+#define DUK_TVAL_DECREF_SLOW(thr, v) \
+ do { \
+ } while (0) /* nop */
+#define DUK_TVAL_DECREF_NORZ_SLOW(thr, v) \
+ do { \
+ } while (0) /* nop */
+#define DUK_TVAL_INCREF(thr, v) \
+ do { \
+ } while (0) /* nop */
+#define DUK_TVAL_DECREF(thr, v) \
+ do { \
+ } while (0) /* nop */
+#define DUK_TVAL_DECREF_NORZ(thr, v) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HEAPHDR_INCREF_FAST(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HEAPHDR_DECREF_FAST(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HEAPHDR_DECREF_NORZ_FAST(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HEAPHDR_INCREF_SLOW(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HEAPHDR_DECREF_SLOW(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HEAPHDR_DECREF_NORZ_SLOW(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HEAPHDR_INCREF(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HEAPHDR_DECREF(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HEAPHDR_DECREF_NORZ(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HSTRING_INCREF_FAST(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HSTRING_DECREF_FAST(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HSTRING_DECREF_NORZ_FAST(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HSTRING_INCREF_SLOW(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HSTRING_DECREF_SLOW(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HSTRING_DECREF_NORZ_SLOW(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HSTRING_INCREF(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HSTRING_DECREF(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HSTRING_DECREF_NORZ(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HOBJECT_INCREF_FAST(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HOBJECT_DECREF_FAST(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HOBJECT_DECREF_NORZ_FAST(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HOBJECT_INCREF_SLOW(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HOBJECT_DECREF_SLOW(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HOBJECT_DECREF_NORZ_SLOW(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HOBJECT_INCREF(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HOBJECT_DECREF(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HOBJECT_DECREF_NORZ(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HBUFFER_INCREF_FAST(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HBUFFER_DECREF_FAST(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HBUFFER_DECREF_NORZ_FAST(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HBUFFER_INCREF_SLOW(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HBUFFER_DECREF_SLOW(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HBUFFER_DECREF_NORZ_SLOW(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HBUFFER_INCREF(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HBUFFER_DECREF(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HBUFFER_DECREF_NORZ(thr, h) \
+ do { \
+ } while (0) /* nop */
+
+#define DUK_HCOMPFUNC_INCREF(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HCOMPFUNC_DECREF(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HCOMPFUNC_DECREF_NORZ(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HNATFUNC_INCREF(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HNATFUNC_DECREF(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HNATFUNC_DECREF_NORZ(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HBUFOBJ_INCREF(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HBUFOBJ_DECREF(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HBUFOBJ_DECREF_NORZ(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HTHREAD_INCREF(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HTHREAD_DECREF(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HTHREAD_DECREF_NORZ(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HOBJECT_INCREF_ALLOWNULL(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HOBJECT_DECREF_ALLOWNULL(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HOBJECT_DECREF_NORZ_ALLOWNULL(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HBUFFER_INCREF_ALLOWNULL(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HBUFFER_DECREF_ALLOWNULL(thr, h) \
+ do { \
+ } while (0) /* nop */
+#define DUK_HBUFFER_DECREF_NORZ_ALLOWNULL(thr, h) \
+ do { \
+ } while (0) /* nop */
+
+#define DUK_REFZERO_CHECK_FAST(thr) \
+ do { \
+ } while (0) /* nop */
+#define DUK_REFZERO_CHECK_SLOW(thr) \
+ do { \
+ } while (0) /* nop */
+
+#define DUK_TVAL_SET_UNDEFINED_UPDREF_ALT0(thr, tvptr_dst) \
+ do { \
+ duk_tval *tv__dst; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_UNDEFINED(tv__dst); \
DUK_UNREF((thr)); \
} while (0)
-#define DUK_TVAL_SET_UNUSED_UPDREF_ALT0(thr,tvptr_dst) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_UNUSED_UPDREF_ALT0(thr, tvptr_dst) \
+ do { \
+ duk_tval *tv__dst; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_UNUSED(tv__dst); \
DUK_UNREF((thr)); \
} while (0)
-#define DUK_TVAL_SET_NULL_UPDREF_ALT0(thr,tvptr_dst) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_NULL_UPDREF_ALT0(thr, tvptr_dst) \
+ do { \
+ duk_tval *tv__dst; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_NULL(tv__dst); \
DUK_UNREF((thr)); \
} while (0)
-#define DUK_TVAL_SET_BOOLEAN_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_BOOLEAN_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_BOOLEAN(tv__dst, (newval)); \
DUK_UNREF((thr)); \
} while (0)
-#define DUK_TVAL_SET_NUMBER_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_NUMBER_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_NUMBER(tv__dst, (newval)); \
DUK_UNREF((thr)); \
} while (0)
-#define DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_NUMBER_CHKFAST_FAST(tv__dst, (newval)); \
DUK_UNREF((thr)); \
} while (0)
-#define DUK_TVAL_SET_DOUBLE_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_DOUBLE_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_DOUBLE(tv__dst, (newval)); \
DUK_UNREF((thr)); \
} while (0)
-#define DUK_TVAL_SET_NAN_UPDREF_ALT0(thr,tvptr_dst) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_NAN_UPDREF_ALT0(thr, tvptr_dst) \
+ do { \
+ duk_tval *tv__dst; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_NAN(tv__dst); \
DUK_UNREF((thr)); \
} while (0)
#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_SET_I48_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_I48_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_I48(tv__dst, (newval)); \
DUK_UNREF((thr)); \
} while (0)
-#define DUK_TVAL_SET_I32_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_I32_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_I32(tv__dst, (newval)); \
DUK_UNREF((thr)); \
} while (0)
-#define DUK_TVAL_SET_U32_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_U32_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_U32(tv__dst, (newval)); \
DUK_UNREF((thr)); \
} while (0)
#else
-#define DUK_TVAL_SET_DOUBLE_CAST_UPDREF(thr,tvptr_dst,newval) \
+#define DUK_TVAL_SET_DOUBLE_CAST_UPDREF(thr, tvptr_dst, newval) \
DUK_TVAL_SET_DOUBLE_UPDREF((thr), (tvptr_dst), (duk_double_t) (newval))
-#endif /* DUK_USE_FASTINT */
+#endif /* DUK_USE_FASTINT */
-#define DUK_TVAL_SET_LIGHTFUNC_UPDREF_ALT0(thr,tvptr_dst,lf_v,lf_fp,lf_flags) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_LIGHTFUNC_UPDREF_ALT0(thr, tvptr_dst, lf_v, lf_fp, lf_flags) \
+ do { \
+ duk_tval *tv__dst; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_LIGHTFUNC(tv__dst, (lf_v), (lf_fp), (lf_flags)); \
DUK_UNREF((thr)); \
} while (0)
-#define DUK_TVAL_SET_STRING_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_STRING_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_STRING(tv__dst, (newval)); \
DUK_UNREF((thr)); \
} while (0)
-#define DUK_TVAL_SET_OBJECT_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_OBJECT_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_OBJECT(tv__dst, (newval)); \
DUK_UNREF((thr)); \
} while (0)
-#define DUK_TVAL_SET_BUFFER_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_BUFFER_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_BUFFER(tv__dst, (newval)); \
DUK_UNREF((thr)); \
} while (0)
-#define DUK_TVAL_SET_POINTER_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
+#define DUK_TVAL_SET_POINTER_UPDREF_ALT0(thr, tvptr_dst, newval) \
+ do { \
+ duk_tval *tv__dst; \
+ tv__dst = (tvptr_dst); \
DUK_TVAL_SET_POINTER(tv__dst, (newval)); \
DUK_UNREF((thr)); \
} while (0)
-#define DUK_TVAL_SET_TVAL_UPDREF_ALT0(thr,tvptr_dst,tvptr_src) do { \
+#define DUK_TVAL_SET_TVAL_UPDREF_ALT0(thr, tvptr_dst, tvptr_src) \
+ do { \
duk_tval *tv__dst, *tv__src; \
- tv__dst = (tvptr_dst); tv__src = (tvptr_src); \
+ tv__dst = (tvptr_dst); \
+ tv__src = (tvptr_src); \
DUK_TVAL_SET_TVAL(tv__dst, tv__src); \
DUK_UNREF((thr)); \
} while (0)
-#define DUK_TVAL_SET_UNDEFINED_UPDREF DUK_TVAL_SET_UNDEFINED_UPDREF_ALT0
-#define DUK_TVAL_SET_UNDEFINED_UPDREF_NORZ DUK_TVAL_SET_UNDEFINED_UPDREF_ALT0
-#define DUK_TVAL_SET_UNUSED_UPDREF DUK_TVAL_SET_UNUSED_UPDREF_ALT0
-#define DUK_TVAL_SET_NULL_UPDREF DUK_TVAL_SET_NULL_UPDREF_ALT0
-#define DUK_TVAL_SET_BOOLEAN_UPDREF DUK_TVAL_SET_BOOLEAN_UPDREF_ALT0
-#define DUK_TVAL_SET_NUMBER_UPDREF DUK_TVAL_SET_NUMBER_UPDREF_ALT0
-#define DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF_ALT0
-#define DUK_TVAL_SET_DOUBLE_UPDREF DUK_TVAL_SET_DOUBLE_UPDREF_ALT0
-#define DUK_TVAL_SET_NAN_UPDREF DUK_TVAL_SET_NAN_UPDREF_ALT0
+#define DUK_TVAL_SET_UNDEFINED_UPDREF DUK_TVAL_SET_UNDEFINED_UPDREF_ALT0
+#define DUK_TVAL_SET_UNDEFINED_UPDREF_NORZ DUK_TVAL_SET_UNDEFINED_UPDREF_ALT0
+#define DUK_TVAL_SET_UNUSED_UPDREF DUK_TVAL_SET_UNUSED_UPDREF_ALT0
+#define DUK_TVAL_SET_NULL_UPDREF DUK_TVAL_SET_NULL_UPDREF_ALT0
+#define DUK_TVAL_SET_BOOLEAN_UPDREF DUK_TVAL_SET_BOOLEAN_UPDREF_ALT0
+#define DUK_TVAL_SET_NUMBER_UPDREF DUK_TVAL_SET_NUMBER_UPDREF_ALT0
+#define DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF_ALT0
+#define DUK_TVAL_SET_DOUBLE_UPDREF DUK_TVAL_SET_DOUBLE_UPDREF_ALT0
+#define DUK_TVAL_SET_NAN_UPDREF DUK_TVAL_SET_NAN_UPDREF_ALT0
#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_SET_I48_UPDREF DUK_TVAL_SET_I48_UPDREF_ALT0
-#define DUK_TVAL_SET_I32_UPDREF DUK_TVAL_SET_I32_UPDREF_ALT0
-#define DUK_TVAL_SET_U32_UPDREF DUK_TVAL_SET_U32_UPDREF_ALT0
+#define DUK_TVAL_SET_I48_UPDREF DUK_TVAL_SET_I48_UPDREF_ALT0
+#define DUK_TVAL_SET_I32_UPDREF DUK_TVAL_SET_I32_UPDREF_ALT0
+#define DUK_TVAL_SET_U32_UPDREF DUK_TVAL_SET_U32_UPDREF_ALT0
#else
-#define DUK_TVAL_SET_I48_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF /* XXX: fast-int-to-double */
-#define DUK_TVAL_SET_I32_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF
-#define DUK_TVAL_SET_U32_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF
-#endif /* DUK_USE_FASTINT */
-#define DUK_TVAL_SET_FASTINT_UPDREF DUK_TVAL_SET_I48_UPDREF /* convenience */
-#define DUK_TVAL_SET_LIGHTFUNC_UPDREF DUK_TVAL_SET_LIGHTFUNC_UPDREF_ALT0
-#define DUK_TVAL_SET_STRING_UPDREF DUK_TVAL_SET_STRING_UPDREF_ALT0
-#define DUK_TVAL_SET_OBJECT_UPDREF DUK_TVAL_SET_OBJECT_UPDREF_ALT0
-#define DUK_TVAL_SET_BUFFER_UPDREF DUK_TVAL_SET_BUFFER_UPDREF_ALT0
-#define DUK_TVAL_SET_POINTER_UPDREF DUK_TVAL_SET_POINTER_UPDREF_ALT0
+#define DUK_TVAL_SET_I48_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF /* XXX: fast-int-to-double */
+#define DUK_TVAL_SET_I32_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF
+#define DUK_TVAL_SET_U32_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF
+#endif /* DUK_USE_FASTINT */
+#define DUK_TVAL_SET_FASTINT_UPDREF DUK_TVAL_SET_I48_UPDREF /* convenience */
+#define DUK_TVAL_SET_LIGHTFUNC_UPDREF DUK_TVAL_SET_LIGHTFUNC_UPDREF_ALT0
+#define DUK_TVAL_SET_STRING_UPDREF DUK_TVAL_SET_STRING_UPDREF_ALT0
+#define DUK_TVAL_SET_OBJECT_UPDREF DUK_TVAL_SET_OBJECT_UPDREF_ALT0
+#define DUK_TVAL_SET_BUFFER_UPDREF DUK_TVAL_SET_BUFFER_UPDREF_ALT0
+#define DUK_TVAL_SET_POINTER_UPDREF DUK_TVAL_SET_POINTER_UPDREF_ALT0
-#define DUK_TVAL_SET_TVAL_UPDREF DUK_TVAL_SET_TVAL_UPDREF_ALT0
-#define DUK_TVAL_SET_TVAL_UPDREF_FAST DUK_TVAL_SET_TVAL_UPDREF_ALT0
-#define DUK_TVAL_SET_TVAL_UPDREF_SLOW DUK_TVAL_SET_TVAL_UPDREF_ALT0
+#define DUK_TVAL_SET_TVAL_UPDREF DUK_TVAL_SET_TVAL_UPDREF_ALT0
+#define DUK_TVAL_SET_TVAL_UPDREF_FAST DUK_TVAL_SET_TVAL_UPDREF_ALT0
+#define DUK_TVAL_SET_TVAL_UPDREF_SLOW DUK_TVAL_SET_TVAL_UPDREF_ALT0
-#endif /* DUK_USE_REFERENCE_COUNTING */
+#endif /* DUK_USE_REFERENCE_COUNTING */
/*
* Some convenience macros that don't have optimized implementations now.
*/
-#define DUK_TVAL_SET_TVAL_UPDREF_NORZ(thr,tv_dst,tv_src) do { \
+#define DUK_TVAL_SET_TVAL_UPDREF_NORZ(thr, tv_dst, tv_src) \
+ do { \
duk_hthread *duk__thr = (thr); \
duk_tval *duk__dst = (tv_dst); \
duk_tval *duk__src = (tv_src); \
@@ -5357,7 +5837,8 @@ DUK_INTERNAL_DECL void duk_heaphdr_assert_valid(duk_heaphdr *h);
DUK_TVAL_INCREF(thr, duk__dst); \
} while (0)
-#define DUK_TVAL_SET_U32_UPDREF_NORZ(thr,tv_dst,val) do { \
+#define DUK_TVAL_SET_U32_UPDREF_NORZ(thr, tv_dst, val) \
+ do { \
duk_hthread *duk__thr = (thr); \
duk_tval *duk__dst = (tv_dst); \
duk_uint32_t duk__val = (duk_uint32_t) (val); \
@@ -5373,11 +5854,11 @@ DUK_INTERNAL_DECL void duk_heaphdr_assert_valid(duk_heaphdr *h);
#if defined(DUK_USE_REFERENCE_COUNTING)
#if defined(DUK_USE_FINALIZER_SUPPORT)
DUK_INTERNAL_DECL void duk_refzero_check_slow(duk_hthread *thr);
-DUK_INTERNAL_DECL DUK_INLINE void duk_refzero_check_fast(duk_hthread *thr);
+DUK_INTERNAL_DECL void duk_refzero_check_fast(duk_hthread *thr);
#endif
DUK_INTERNAL_DECL void duk_heaphdr_refcount_finalize_norz(duk_heap *heap, duk_heaphdr *hdr);
DUK_INTERNAL_DECL void duk_hobject_refcount_finalize_norz(duk_heap *heap, duk_hobject *h);
-#if 0 /* Not needed: fast path handles inline; slow path uses duk_heaphdr_decref() which is needed anyway. */
+#if 0 /* Not needed: fast path handles inline; slow path uses duk_heaphdr_decref() which is needed anyway. */
DUK_INTERNAL_DECL void duk_hstring_decref(duk_hthread *thr, duk_hstring *h);
DUK_INTERNAL_DECL void duk_hstring_decref_norz(duk_hthread *thr, duk_hstring *h);
DUK_INTERNAL_DECL void duk_hbuffer_decref(duk_hthread *thr, duk_hbuffer *h);
@@ -5388,8 +5869,8 @@ DUK_INTERNAL_DECL void duk_hobject_decref_norz(duk_hthread *thr, duk_hobject *h)
DUK_INTERNAL_DECL void duk_heaphdr_refzero(duk_hthread *thr, duk_heaphdr *h);
DUK_INTERNAL_DECL void duk_heaphdr_refzero_norz(duk_hthread *thr, duk_heaphdr *h);
#if defined(DUK_USE_FAST_REFCOUNT_DEFAULT)
-DUK_INTERNAL_DECL void duk_hstring_refzero(duk_hthread *thr, duk_hstring *h); /* no 'norz' variant */
-DUK_INTERNAL_DECL void duk_hbuffer_refzero(duk_hthread *thr, duk_hbuffer *h); /* no 'norz' variant */
+DUK_INTERNAL_DECL void duk_hstring_refzero(duk_hthread *thr, duk_hstring *h); /* no 'norz' variant */
+DUK_INTERNAL_DECL void duk_hbuffer_refzero(duk_hthread *thr, duk_hbuffer *h); /* no 'norz' variant */
DUK_INTERNAL_DECL void duk_hobject_refzero(duk_hthread *thr, duk_hobject *h);
DUK_INTERNAL_DECL void duk_hobject_refzero_norz(duk_hthread *thr, duk_hobject *h);
#else
@@ -5400,11 +5881,11 @@ DUK_INTERNAL_DECL void duk_heaphdr_incref(duk_heaphdr *h);
DUK_INTERNAL_DECL void duk_heaphdr_decref(duk_hthread *thr, duk_heaphdr *h);
DUK_INTERNAL_DECL void duk_heaphdr_decref_norz(duk_hthread *thr, duk_heaphdr *h);
#endif
-#else /* DUK_USE_REFERENCE_COUNTING */
+#else /* DUK_USE_REFERENCE_COUNTING */
/* no refcounting */
-#endif /* DUK_USE_REFERENCE_COUNTING */
+#endif /* DUK_USE_REFERENCE_COUNTING */
-#endif /* DUK_REFCOUNT_H_INCLUDED */
+#endif /* DUK_REFCOUNT_H_INCLUDED */
/* #include duk_api_internal.h */
/*
* Internal API calls which have (stack and other) semantics similar
@@ -5414,20 +5895,42 @@ DUK_INTERNAL_DECL void duk_heaphdr_decref_norz(duk_hthread *thr, duk_heaphdr *h)
#if !defined(DUK_API_INTERNAL_H_INCLUDED)
#define DUK_API_INTERNAL_H_INCLUDED
+/* Inline macro helpers. */
+#if defined(DUK_USE_PREFER_SIZE)
+#define DUK_INLINE_PERF
+#define DUK_ALWAYS_INLINE_PERF
+#define DUK_NOINLINE_PERF
+#else
+#define DUK_INLINE_PERF DUK_INLINE
+#define DUK_ALWAYS_INLINE_PERF DUK_ALWAYS_INLINE
+#define DUK_NOINLINE_PERF DUK_NOINLINE
+#endif
+
+/* Inline macro helpers, for bytecode executor. */
+#if defined(DUK_USE_EXEC_PREFER_SIZE)
+#define DUK_EXEC_INLINE_PERF
+#define DUK_EXEC_ALWAYS_INLINE_PERF
+#define DUK_EXEC_NOINLINE_PERF
+#else
+#define DUK_EXEC_INLINE_PERF DUK_INLINE
+#define DUK_EXEC_ALWAYS_INLINE_PERF DUK_ALWAYS_INLINE
+#define DUK_EXEC_NOINLINE_PERF DUK_NOINLINE
+#endif
+
/* duk_push_sprintf constants */
-#define DUK_PUSH_SPRINTF_INITIAL_SIZE 256L
-#define DUK_PUSH_SPRINTF_SANITY_LIMIT (1L * 1024L * 1024L * 1024L)
+#define DUK_PUSH_SPRINTF_INITIAL_SIZE 256L
+#define DUK_PUSH_SPRINTF_SANITY_LIMIT (1L * 1024L * 1024L * 1024L)
/* Flag ORed to err_code to indicate __FILE__ / __LINE__ is not
* blamed as source of error for error fileName / lineNumber.
*/
-#define DUK_ERRCODE_FLAG_NOBLAME_FILELINE (1L << 24)
+#define DUK_ERRCODE_FLAG_NOBLAME_FILELINE (1L << 24)
/* Current convention is to use duk_size_t for value stack sizes and global indices,
* and duk_idx_t for local frame indices.
*/
-DUK_INTERNAL_DECL DUK_INLINE void duk_valstack_grow_check_throw(duk_hthread *thr, duk_size_t min_bytes);
-DUK_INTERNAL_DECL DUK_INLINE duk_bool_t duk_valstack_grow_check_nothrow(duk_hthread *thr, duk_size_t min_bytes);
+DUK_INTERNAL_DECL void duk_valstack_grow_check_throw(duk_hthread *thr, duk_size_t min_bytes);
+DUK_INTERNAL_DECL duk_bool_t duk_valstack_grow_check_nothrow(duk_hthread *thr, duk_size_t min_bytes);
DUK_INTERNAL_DECL void duk_valstack_shrink_check_nothrow(duk_hthread *thr, duk_bool_t snug);
DUK_INTERNAL_DECL void duk_copy_tvals_incref(duk_hthread *thr, duk_tval *tv_dst, duk_tval *tv_src, duk_size_t count);
@@ -5483,24 +5986,17 @@ DUK_INTERNAL_DECL duk_hstring *duk_push_uint_to_hstring(duk_hthread *thr, duk_ui
DUK_INTERNAL_DECL duk_tval *duk_get_borrowed_this_tval(duk_hthread *thr);
/* XXX: add fastint support? */
-#define duk_push_u64(thr,val) \
- duk_push_number((thr), (duk_double_t) (val))
-#define duk_push_i64(thr,val) \
- duk_push_number((thr), (duk_double_t) (val))
+#define duk_push_u64(thr, val) duk_push_number((thr), (duk_double_t) (val))
+#define duk_push_i64(thr, val) duk_push_number((thr), (duk_double_t) (val))
/* duk_push_(u)int() is guaranteed to support at least (un)signed 32-bit range */
-#define duk_push_u32(thr,val) \
- duk_push_uint((thr), (duk_uint_t) (val))
-#define duk_push_i32(thr,val) \
- duk_push_int((thr), (duk_int_t) (val))
+#define duk_push_u32(thr, val) duk_push_uint((thr), (duk_uint_t) (val))
+#define duk_push_i32(thr, val) duk_push_int((thr), (duk_int_t) (val))
/* sometimes stack and array indices need to go on the stack */
-#define duk_push_idx(thr,val) \
- duk_push_int((thr), (duk_int_t) (val))
-#define duk_push_uarridx(thr,val) \
- duk_push_uint((thr), (duk_uint_t) (val))
-#define duk_push_size_t(thr,val) \
- duk_push_uint((thr), (duk_uint_t) (val)) /* XXX: assumed to fit for now */
+#define duk_push_idx(thr, val) duk_push_int((thr), (duk_int_t) (val))
+#define duk_push_uarridx(thr, val) duk_push_uint((thr), (duk_uint_t) (val))
+#define duk_push_size_t(thr, val) duk_push_uint((thr), (duk_uint_t) (val)) /* XXX: assumed to fit for now */
DUK_INTERNAL_DECL duk_bool_t duk_is_string_notsymbol(duk_hthread *thr, duk_idx_t idx);
@@ -5517,19 +6013,23 @@ DUK_INTERNAL_DECL duk_hthread *duk_get_hthread(duk_hthread *thr, duk_idx_t idx);
DUK_INTERNAL_DECL duk_hcompfunc *duk_get_hcompfunc(duk_hthread *thr, duk_idx_t idx);
DUK_INTERNAL_DECL duk_hnatfunc *duk_get_hnatfunc(duk_hthread *thr, duk_idx_t idx);
-DUK_INTERNAL_DECL void *duk_get_buffer_data_raw(duk_hthread *thr, duk_idx_t idx, duk_size_t *out_size, void *def_ptr, duk_size_t def_len, duk_bool_t throw_flag, duk_bool_t *out_isbuffer);
+DUK_INTERNAL_DECL void *duk_get_buffer_data_raw(duk_hthread *thr,
+ duk_idx_t idx,
+ duk_size_t *out_size,
+ void *def_ptr,
+ duk_size_t def_len,
+ duk_bool_t throw_flag,
+ duk_bool_t *out_isbuffer);
DUK_INTERNAL_DECL duk_hobject *duk_get_hobject_with_class(duk_hthread *thr, duk_idx_t idx, duk_small_uint_t classnum);
DUK_INTERNAL_DECL duk_hobject *duk_get_hobject_promote_mask(duk_hthread *thr, duk_idx_t idx, duk_uint_t type_mask);
DUK_INTERNAL_DECL duk_hobject *duk_require_hobject_promote_mask(duk_hthread *thr, duk_idx_t idx, duk_uint_t type_mask);
DUK_INTERNAL_DECL duk_hobject *duk_require_hobject_accept_mask(duk_hthread *thr, duk_idx_t idx, duk_uint_t type_mask);
-#define duk_require_hobject_promote_lfunc(thr,idx) \
- duk_require_hobject_promote_mask((thr), (idx), DUK_TYPE_MASK_LIGHTFUNC)
-#define duk_get_hobject_promote_lfunc(thr,idx) \
- duk_get_hobject_promote_mask((thr), (idx), DUK_TYPE_MASK_LIGHTFUNC)
+#define duk_require_hobject_promote_lfunc(thr, idx) duk_require_hobject_promote_mask((thr), (idx), DUK_TYPE_MASK_LIGHTFUNC)
+#define duk_get_hobject_promote_lfunc(thr, idx) duk_get_hobject_promote_mask((thr), (idx), DUK_TYPE_MASK_LIGHTFUNC)
-#if 0 /*unused*/
+#if 0 /*unused*/
DUK_INTERNAL_DECL void *duk_get_voidptr(duk_hthread *thr, duk_idx_t idx);
#endif
@@ -5552,12 +6052,16 @@ DUK_INTERNAL_DECL duk_double_t duk_to_number_m2(duk_hthread *thr);
DUK_INTERNAL_DECL duk_bool_t duk_to_boolean_top_pop(duk_hthread *thr);
-#if defined(DUK_USE_DEBUGGER_SUPPORT) /* only needed by debugger for now */
+#if defined(DUK_USE_DEBUGGER_SUPPORT) /* only needed by debugger for now */
DUK_INTERNAL_DECL duk_hstring *duk_safe_to_hstring(duk_hthread *thr, duk_idx_t idx);
#endif
DUK_INTERNAL_DECL void duk_push_class_string_tval(duk_hthread *thr, duk_tval *tv, duk_bool_t avoid_side_effects);
-DUK_INTERNAL_DECL duk_int_t duk_to_int_clamped_raw(duk_hthread *thr, duk_idx_t idx, duk_int_t minval, duk_int_t maxval, duk_bool_t *out_clamped); /* out_clamped=NULL, RangeError if outside range */
+DUK_INTERNAL_DECL duk_int_t duk_to_int_clamped_raw(duk_hthread *thr,
+ duk_idx_t idx,
+ duk_int_t minval,
+ duk_int_t maxval,
+ duk_bool_t *out_clamped); /* out_clamped=NULL, RangeError if outside range */
DUK_INTERNAL_DECL duk_int_t duk_to_int_clamped(duk_hthread *thr, duk_idx_t idx, duk_int_t minval, duk_int_t maxval);
DUK_INTERNAL_DECL duk_int_t duk_to_int_check_range(duk_hthread *thr, duk_idx_t idx, duk_int_t minval, duk_int_t maxval);
#if defined(DUK_USE_BUFFEROBJECT_SUPPORT)
@@ -5582,13 +6086,15 @@ DUK_INTERNAL_DECL void duk_push_hstring_stridx(duk_hthread *thr, duk_small_uint_
DUK_INTERNAL_DECL void duk_push_hstring_empty(duk_hthread *thr);
DUK_INTERNAL_DECL void duk_push_hobject(duk_hthread *thr, duk_hobject *h);
DUK_INTERNAL_DECL void duk_push_hbuffer(duk_hthread *thr, duk_hbuffer *h);
-#define duk_push_hthread(thr,h) \
- duk_push_hobject((thr), (duk_hobject *) (h))
-#define duk_push_hnatfunc(thr,h) \
- duk_push_hobject((thr), (duk_hobject *) (h))
+#define duk_push_hthread(thr, h) duk_push_hobject((thr), (duk_hobject *) (h))
+#define duk_push_hnatfunc(thr, h) duk_push_hobject((thr), (duk_hobject *) (h))
DUK_INTERNAL_DECL void duk_push_hobject_bidx(duk_hthread *thr, duk_small_int_t builtin_idx);
-DUK_INTERNAL_DECL duk_hobject *duk_push_object_helper(duk_hthread *thr, duk_uint_t hobject_flags_and_class, duk_small_int_t prototype_bidx);
-DUK_INTERNAL_DECL duk_hobject *duk_push_object_helper_proto(duk_hthread *thr, duk_uint_t hobject_flags_and_class, duk_hobject *proto);
+DUK_INTERNAL_DECL duk_hobject *duk_push_object_helper(duk_hthread *thr,
+ duk_uint_t hobject_flags_and_class,
+ duk_small_int_t prototype_bidx);
+DUK_INTERNAL_DECL duk_hobject *duk_push_object_helper_proto(duk_hthread *thr,
+ duk_uint_t hobject_flags_and_class,
+ duk_hobject *proto);
DUK_INTERNAL_DECL duk_hcompfunc *duk_push_hcompfunc(duk_hthread *thr);
DUK_INTERNAL_DECL duk_hboundfunc *duk_push_hboundfunc(duk_hthread *thr);
DUK_INTERNAL_DECL void duk_push_c_function_builtin(duk_hthread *thr, duk_c_function func, duk_int_t nargs);
@@ -5605,11 +6111,13 @@ DUK_INTERNAL_DECL void duk_push_string_funcptr(duk_hthread *thr, duk_uint8_t *pt
DUK_INTERNAL_DECL void duk_push_lightfunc_name_raw(duk_hthread *thr, duk_c_function func, duk_small_uint_t lf_flags);
DUK_INTERNAL_DECL void duk_push_lightfunc_name(duk_hthread *thr, duk_tval *tv);
DUK_INTERNAL_DECL void duk_push_lightfunc_tostring(duk_hthread *thr, duk_tval *tv);
-#if 0 /* not used yet */
+#if 0 /* not used yet */
DUK_INTERNAL_DECL void duk_push_hnatfunc_name(duk_hthread *thr, duk_hnatfunc *h);
#endif
#if defined(DUK_USE_BUFFEROBJECT_SUPPORT)
-DUK_INTERNAL_DECL duk_hbufobj *duk_push_bufobj_raw(duk_hthread *thr, duk_uint_t hobject_flags_and_class, duk_small_int_t prototype_bidx);
+DUK_INTERNAL_DECL duk_hbufobj *duk_push_bufobj_raw(duk_hthread *thr,
+ duk_uint_t hobject_flags_and_class,
+ duk_small_int_t prototype_bidx);
#endif
DUK_INTERNAL_DECL void *duk_push_fixed_buffer_nozero(duk_hthread *thr, duk_size_t len);
@@ -5626,80 +6134,86 @@ DUK_INTERNAL_DECL const char *duk_push_string_tval_readable_error(duk_hthread *t
* arguments and such call sites are also easiest to verify to be correct.
*/
-DUK_INTERNAL_DECL duk_bool_t duk_get_prop_stridx(duk_hthread *thr, duk_idx_t obj_idx, duk_small_uint_t stridx); /* [] -> [val] */
+DUK_INTERNAL_DECL duk_bool_t duk_get_prop_stridx(duk_hthread *thr, duk_idx_t obj_idx, duk_small_uint_t stridx); /* [] -> [val] */
DUK_INTERNAL_DECL duk_bool_t duk_get_prop_stridx_short_raw(duk_hthread *thr, duk_uint_t packed_args);
-#define duk_get_prop_stridx_short(thr,obj_idx,stridx) \
+#define duk_get_prop_stridx_short(thr, obj_idx, stridx) \
(DUK_ASSERT_EXPR((duk_int_t) (obj_idx) >= -0x8000L && (duk_int_t) (obj_idx) <= 0x7fffL), \
DUK_ASSERT_EXPR((duk_int_t) (stridx) >= 0 && (duk_int_t) (stridx) <= 0xffffL), \
duk_get_prop_stridx_short_raw((thr), (((duk_uint_t) (obj_idx)) << 16) + ((duk_uint_t) (stridx))))
-DUK_INTERNAL_DECL duk_bool_t duk_get_prop_stridx_boolean(duk_hthread *thr, duk_idx_t obj_idx, duk_small_uint_t stridx, duk_bool_t *out_has_prop); /* [] -> [] */
+DUK_INTERNAL_DECL duk_bool_t duk_get_prop_stridx_boolean(duk_hthread *thr,
+ duk_idx_t obj_idx,
+ duk_small_uint_t stridx,
+ duk_bool_t *out_has_prop); /* [] -> [] */
DUK_INTERNAL_DECL duk_bool_t duk_xget_owndataprop(duk_hthread *thr, duk_idx_t obj_idx);
DUK_INTERNAL_DECL duk_bool_t duk_xget_owndataprop_stridx(duk_hthread *thr, duk_idx_t obj_idx, duk_small_uint_t stridx);
DUK_INTERNAL_DECL duk_bool_t duk_xget_owndataprop_stridx_short_raw(duk_hthread *thr, duk_uint_t packed_args);
-#define duk_xget_owndataprop_stridx_short(thr,obj_idx,stridx) \
+#define duk_xget_owndataprop_stridx_short(thr, obj_idx, stridx) \
(DUK_ASSERT_EXPR((duk_int_t) (obj_idx) >= -0x8000L && (duk_int_t) (obj_idx) <= 0x7fffL), \
DUK_ASSERT_EXPR((duk_int_t) (stridx) >= 0 && (duk_int_t) (stridx) <= 0xffffL), \
duk_xget_owndataprop_stridx_short_raw((thr), (((duk_uint_t) (obj_idx)) << 16) + ((duk_uint_t) (stridx))))
-DUK_INTERNAL_DECL duk_bool_t duk_put_prop_stridx(duk_hthread *thr, duk_idx_t obj_idx, duk_small_uint_t stridx); /* [val] -> [] */
+DUK_INTERNAL_DECL duk_bool_t duk_put_prop_stridx(duk_hthread *thr, duk_idx_t obj_idx, duk_small_uint_t stridx); /* [val] -> [] */
DUK_INTERNAL_DECL duk_bool_t duk_put_prop_stridx_short_raw(duk_hthread *thr, duk_uint_t packed_args);
-#define duk_put_prop_stridx_short(thr,obj_idx,stridx) \
+#define duk_put_prop_stridx_short(thr, obj_idx, stridx) \
(DUK_ASSERT_EXPR((duk_int_t) (obj_idx) >= -0x8000L && (duk_int_t) (obj_idx) <= 0x7fffL), \
DUK_ASSERT_EXPR((duk_int_t) (stridx) >= 0 && (duk_int_t) (stridx) <= 0xffffL), \
duk_put_prop_stridx_short_raw((thr), (((duk_uint_t) (obj_idx)) << 16) + ((duk_uint_t) (stridx))))
-DUK_INTERNAL_DECL duk_bool_t duk_del_prop_stridx(duk_hthread *thr, duk_idx_t obj_idx, duk_small_uint_t stridx); /* [] -> [] */
-#if 0 /* Too few call sites to be useful. */
+DUK_INTERNAL_DECL duk_bool_t duk_del_prop_stridx(duk_hthread *thr, duk_idx_t obj_idx, duk_small_uint_t stridx); /* [] -> [] */
+#if 0 /* Too few call sites to be useful. */
DUK_INTERNAL_DECL duk_bool_t duk_del_prop_stridx_short_raw(duk_hthread *thr, duk_uint_t packed_args);
-#define duk_del_prop_stridx_short(thr,obj_idx,stridx) \
+#define duk_del_prop_stridx_short(thr, obj_idx, stridx) \
(DUK_ASSERT_EXPR((obj_idx) >= -0x8000L && (obj_idx) <= 0x7fffL), \
DUK_ASSERT_EXPR((stridx) >= 0 && (stridx) <= 0xffffL), \
duk_del_prop_stridx_short_raw((thr), (((duk_uint_t) (obj_idx)) << 16) + ((duk_uint_t) (stridx))))
#endif
-#define duk_del_prop_stridx_short(thr,obj_idx,stridx) \
- duk_del_prop_stridx((thr), (obj_idx), (stridx))
+#define duk_del_prop_stridx_short(thr, obj_idx, stridx) duk_del_prop_stridx((thr), (obj_idx), (stridx))
-DUK_INTERNAL_DECL duk_bool_t duk_has_prop_stridx(duk_hthread *thr, duk_idx_t obj_idx, duk_small_uint_t stridx); /* [] -> [] */
-#if 0 /* Too few call sites to be useful. */
+DUK_INTERNAL_DECL duk_bool_t duk_has_prop_stridx(duk_hthread *thr, duk_idx_t obj_idx, duk_small_uint_t stridx); /* [] -> [] */
+#if 0 /* Too few call sites to be useful. */
DUK_INTERNAL_DECL duk_bool_t duk_has_prop_stridx_short_raw(duk_hthread *thr, duk_uint_t packed_args);
-#define duk_has_prop_stridx_short(thr,obj_idx,stridx) \
+#define duk_has_prop_stridx_short(thr, obj_idx, stridx) \
(DUK_ASSERT_EXPR((obj_idx) >= -0x8000L && (obj_idx) <= 0x7fffL), \
DUK_ASSERT_EXPR((stridx) >= 0 && (stridx) <= 0xffffL), \
duk_has_prop_stridx_short_raw((thr), (((duk_uint_t) (obj_idx)) << 16) + ((duk_uint_t) (stridx))))
#endif
-#define duk_has_prop_stridx_short(thr,obj_idx,stridx) \
- duk_has_prop_stridx((thr), (obj_idx), (stridx))
+#define duk_has_prop_stridx_short(thr, obj_idx, stridx) duk_has_prop_stridx((thr), (obj_idx), (stridx))
-DUK_INTERNAL_DECL void duk_xdef_prop(duk_hthread *thr, duk_idx_t obj_idx, duk_small_uint_t desc_flags); /* [key val] -> [] */
+DUK_INTERNAL_DECL void duk_xdef_prop(duk_hthread *thr, duk_idx_t obj_idx, duk_small_uint_t desc_flags); /* [key val] -> [] */
-DUK_INTERNAL_DECL void duk_xdef_prop_index(duk_hthread *thr, duk_idx_t obj_idx, duk_uarridx_t arr_idx, duk_small_uint_t desc_flags); /* [val] -> [] */
+DUK_INTERNAL_DECL void duk_xdef_prop_index(duk_hthread *thr,
+ duk_idx_t obj_idx,
+ duk_uarridx_t arr_idx,
+ duk_small_uint_t desc_flags); /* [val] -> [] */
/* XXX: Because stridx and desc_flags have a limited range, this call could
* always pack stridx and desc_flags into a single argument.
*/
-DUK_INTERNAL_DECL void duk_xdef_prop_stridx(duk_hthread *thr, duk_idx_t obj_idx, duk_small_uint_t stridx, duk_small_uint_t desc_flags); /* [val] -> [] */
+DUK_INTERNAL_DECL void duk_xdef_prop_stridx(duk_hthread *thr,
+ duk_idx_t obj_idx,
+ duk_small_uint_t stridx,
+ duk_small_uint_t desc_flags); /* [val] -> [] */
DUK_INTERNAL_DECL void duk_xdef_prop_stridx_short_raw(duk_hthread *thr, duk_uint_t packed_args);
-#define duk_xdef_prop_stridx_short(thr,obj_idx,stridx,desc_flags) \
+#define duk_xdef_prop_stridx_short(thr, obj_idx, stridx, desc_flags) \
(DUK_ASSERT_EXPR((duk_int_t) (obj_idx) >= -0x80L && (duk_int_t) (obj_idx) <= 0x7fL), \
DUK_ASSERT_EXPR((duk_int_t) (stridx) >= 0 && (duk_int_t) (stridx) <= 0xffffL), \
DUK_ASSERT_EXPR((duk_int_t) (desc_flags) >= 0 && (duk_int_t) (desc_flags) <= 0xffL), \
- duk_xdef_prop_stridx_short_raw((thr), (((duk_uint_t) (obj_idx)) << 24) + (((duk_uint_t) (stridx)) << 8) + (duk_uint_t) (desc_flags)))
-
-#define duk_xdef_prop_wec(thr,obj_idx) \
- duk_xdef_prop((thr), (obj_idx), DUK_PROPDESC_FLAGS_WEC)
-#define duk_xdef_prop_index_wec(thr,obj_idx,arr_idx) \
- duk_xdef_prop_index((thr), (obj_idx), (arr_idx), DUK_PROPDESC_FLAGS_WEC)
-#define duk_xdef_prop_stridx_wec(thr,obj_idx,stridx) \
- duk_xdef_prop_stridx((thr), (obj_idx), (stridx), DUK_PROPDESC_FLAGS_WEC)
-#define duk_xdef_prop_stridx_short_wec(thr,obj_idx,stridx) \
+ duk_xdef_prop_stridx_short_raw((thr), \
+ (((duk_uint_t) (obj_idx)) << 24) + (((duk_uint_t) (stridx)) << 8) + \
+ (duk_uint_t) (desc_flags)))
+
+#define duk_xdef_prop_wec(thr, obj_idx) duk_xdef_prop((thr), (obj_idx), DUK_PROPDESC_FLAGS_WEC)
+#define duk_xdef_prop_index_wec(thr, obj_idx, arr_idx) duk_xdef_prop_index((thr), (obj_idx), (arr_idx), DUK_PROPDESC_FLAGS_WEC)
+#define duk_xdef_prop_stridx_wec(thr, obj_idx, stridx) duk_xdef_prop_stridx((thr), (obj_idx), (stridx), DUK_PROPDESC_FLAGS_WEC)
+#define duk_xdef_prop_stridx_short_wec(thr, obj_idx, stridx) \
duk_xdef_prop_stridx_short((thr), (obj_idx), (stridx), DUK_PROPDESC_FLAGS_WEC)
-#if 0 /*unused*/
+#if 0 /*unused*/
DUK_INTERNAL_DECL void duk_xdef_prop_stridx_builtin(duk_hthread *thr, duk_idx_t obj_idx, duk_small_uint_t stridx, duk_small_int_t builtin_idx, duk_small_uint_t desc_flags); /* [] -> [] */
#endif
-DUK_INTERNAL_DECL void duk_xdef_prop_stridx_thrower(duk_hthread *thr, duk_idx_t obj_idx, duk_small_uint_t stridx); /* [] -> [] */
+DUK_INTERNAL_DECL void duk_xdef_prop_stridx_thrower(duk_hthread *thr, duk_idx_t obj_idx, duk_small_uint_t stridx); /* [] -> [] */
DUK_INTERNAL_DECL duk_bool_t duk_get_method_stridx(duk_hthread *thr, duk_idx_t idx, duk_small_uint_t stridx);
@@ -5748,28 +6262,24 @@ DUK_INTERNAL_DECL void duk_clear_prototype(duk_hthread *thr, duk_idx_t idx);
* using these macro results in faster and smaller code than duk_get_tval().
* Both 'ctx' and 'idx' are evaluted multiple times, but only for asserts.
*/
-#define DUK_ASSERT_VALID_NEGIDX(thr,idx) \
+#define DUK_ASSERT_VALID_NEGIDX(thr, idx) \
(DUK_ASSERT_EXPR((duk_int_t) (idx) < 0), DUK_ASSERT_EXPR(duk_is_valid_index((thr), (idx))))
-#define DUK_ASSERT_VALID_POSIDX(thr,idx) \
+#define DUK_ASSERT_VALID_POSIDX(thr, idx) \
(DUK_ASSERT_EXPR((duk_int_t) (idx) >= 0), DUK_ASSERT_EXPR(duk_is_valid_index((thr), (idx))))
-#define DUK_GET_TVAL_NEGIDX(thr,idx) \
- (DUK_ASSERT_VALID_NEGIDX((thr),(idx)), ((duk_hthread *) (thr))->valstack_top + (idx))
-#define DUK_GET_TVAL_POSIDX(thr,idx) \
- (DUK_ASSERT_VALID_POSIDX((thr),(idx)), ((duk_hthread *) (thr))->valstack_bottom + (idx))
-#define DUK_GET_HOBJECT_NEGIDX(thr,idx) \
- (DUK_ASSERT_VALID_NEGIDX((thr),(idx)), DUK_TVAL_GET_OBJECT(((duk_hthread *) (thr))->valstack_top + (idx)))
-#define DUK_GET_HOBJECT_POSIDX(thr,idx) \
- (DUK_ASSERT_VALID_POSIDX((thr),(idx)), DUK_TVAL_GET_OBJECT(((duk_hthread *) (thr))->valstack_bottom + (idx)))
-
-#define DUK_GET_THIS_TVAL_PTR(thr) \
- (DUK_ASSERT_EXPR((thr)->valstack_bottom > (thr)->valstack), \
- (thr)->valstack_bottom - 1)
+#define DUK_GET_TVAL_NEGIDX(thr, idx) (DUK_ASSERT_VALID_NEGIDX((thr), (idx)), ((duk_hthread *) (thr))->valstack_top + (idx))
+#define DUK_GET_TVAL_POSIDX(thr, idx) (DUK_ASSERT_VALID_POSIDX((thr), (idx)), ((duk_hthread *) (thr))->valstack_bottom + (idx))
+#define DUK_GET_HOBJECT_NEGIDX(thr, idx) \
+ (DUK_ASSERT_VALID_NEGIDX((thr), (idx)), DUK_TVAL_GET_OBJECT(((duk_hthread *) (thr))->valstack_top + (idx)))
+#define DUK_GET_HOBJECT_POSIDX(thr, idx) \
+ (DUK_ASSERT_VALID_POSIDX((thr), (idx)), DUK_TVAL_GET_OBJECT(((duk_hthread *) (thr))->valstack_bottom + (idx)))
+
+#define DUK_GET_THIS_TVAL_PTR(thr) (DUK_ASSERT_EXPR((thr)->valstack_bottom > (thr)->valstack), (thr)->valstack_bottom - 1)
DUK_INTERNAL_DECL duk_double_t duk_time_get_ecmascript_time(duk_hthread *thr);
DUK_INTERNAL_DECL duk_double_t duk_time_get_ecmascript_time_nofrac(duk_hthread *thr);
DUK_INTERNAL_DECL duk_double_t duk_time_get_monotonic_time(duk_hthread *thr);
-#endif /* DUK_API_INTERNAL_H_INCLUDED */
+#endif /* DUK_API_INTERNAL_H_INCLUDED */
/* #include duk_hstring.h */
/*
* Heap string representation.
@@ -5800,9 +6310,9 @@ DUK_INTERNAL_DECL duk_double_t duk_time_get_monotonic_time(duk_hthread *thr);
*/
#if defined(DUK_USE_STRLEN16)
-#define DUK_HSTRING_MAX_BYTELEN (0x0000ffffUL)
+#define DUK_HSTRING_MAX_BYTELEN (0x0000ffffUL)
#else
-#define DUK_HSTRING_MAX_BYTELEN (0x7fffffffUL)
+#define DUK_HSTRING_MAX_BYTELEN (0x7fffffffUL)
#endif
/* XXX: could add flags for "is valid CESU-8" (ECMAScript compatible strings),
@@ -5814,139 +6324,148 @@ DUK_INTERNAL_DECL duk_double_t duk_time_get_monotonic_time(duk_hthread *thr);
/* With lowmem builds the high 16 bits of duk_heaphdr are used for other
* purposes, so this leaves 7 duk_heaphdr flags and 9 duk_hstring flags.
*/
-#define DUK_HSTRING_FLAG_ASCII DUK_HEAPHDR_USER_FLAG(0) /* string is ASCII, clen == blen */
-#define DUK_HSTRING_FLAG_ARRIDX DUK_HEAPHDR_USER_FLAG(1) /* string is a valid array index */
-#define DUK_HSTRING_FLAG_SYMBOL DUK_HEAPHDR_USER_FLAG(2) /* string is a symbol (invalid utf-8) */
-#define DUK_HSTRING_FLAG_HIDDEN DUK_HEAPHDR_USER_FLAG(3) /* string is a hidden symbol (implies symbol, Duktape 1.x internal string) */
-#define DUK_HSTRING_FLAG_RESERVED_WORD DUK_HEAPHDR_USER_FLAG(4) /* string is a reserved word (non-strict) */
-#define DUK_HSTRING_FLAG_STRICT_RESERVED_WORD DUK_HEAPHDR_USER_FLAG(5) /* string is a reserved word (strict) */
-#define DUK_HSTRING_FLAG_EVAL_OR_ARGUMENTS DUK_HEAPHDR_USER_FLAG(6) /* string is 'eval' or 'arguments' */
-#define DUK_HSTRING_FLAG_EXTDATA DUK_HEAPHDR_USER_FLAG(7) /* string data is external (duk_hstring_external) */
-#define DUK_HSTRING_FLAG_PINNED_LITERAL DUK_HEAPHDR_USER_FLAG(8) /* string is a literal, and pinned */
-
-#define DUK_HSTRING_HAS_ASCII(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ASCII)
-#define DUK_HSTRING_HAS_ARRIDX(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ARRIDX)
-#define DUK_HSTRING_HAS_SYMBOL(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_SYMBOL)
-#define DUK_HSTRING_HAS_HIDDEN(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_HIDDEN)
-#define DUK_HSTRING_HAS_RESERVED_WORD(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_RESERVED_WORD)
-#define DUK_HSTRING_HAS_STRICT_RESERVED_WORD(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_STRICT_RESERVED_WORD)
-#define DUK_HSTRING_HAS_EVAL_OR_ARGUMENTS(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EVAL_OR_ARGUMENTS)
-#define DUK_HSTRING_HAS_EXTDATA(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EXTDATA)
-#define DUK_HSTRING_HAS_PINNED_LITERAL(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_PINNED_LITERAL)
-
-#define DUK_HSTRING_SET_ASCII(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ASCII)
-#define DUK_HSTRING_SET_ARRIDX(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ARRIDX)
-#define DUK_HSTRING_SET_SYMBOL(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_SYMBOL)
-#define DUK_HSTRING_SET_HIDDEN(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_HIDDEN)
-#define DUK_HSTRING_SET_RESERVED_WORD(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_RESERVED_WORD)
-#define DUK_HSTRING_SET_STRICT_RESERVED_WORD(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_STRICT_RESERVED_WORD)
-#define DUK_HSTRING_SET_EVAL_OR_ARGUMENTS(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EVAL_OR_ARGUMENTS)
-#define DUK_HSTRING_SET_EXTDATA(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EXTDATA)
-#define DUK_HSTRING_SET_PINNED_LITERAL(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_PINNED_LITERAL)
-
-#define DUK_HSTRING_CLEAR_ASCII(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ASCII)
-#define DUK_HSTRING_CLEAR_ARRIDX(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ARRIDX)
-#define DUK_HSTRING_CLEAR_SYMBOL(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_SYMBOL)
-#define DUK_HSTRING_CLEAR_HIDDEN(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_HIDDEN)
-#define DUK_HSTRING_CLEAR_RESERVED_WORD(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_RESERVED_WORD)
-#define DUK_HSTRING_CLEAR_STRICT_RESERVED_WORD(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_STRICT_RESERVED_WORD)
-#define DUK_HSTRING_CLEAR_EVAL_OR_ARGUMENTS(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EVAL_OR_ARGUMENTS)
-#define DUK_HSTRING_CLEAR_EXTDATA(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EXTDATA)
-#define DUK_HSTRING_CLEAR_PINNED_LITERAL(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_PINNED_LITERAL)
-
-#if 0 /* Slightly smaller code without explicit flag, but explicit flag
- * is very useful when 'clen' is dropped.
- */
-#define DUK_HSTRING_IS_ASCII(x) (DUK_HSTRING_GET_BYTELEN((x)) == DUK_HSTRING_GET_CHARLEN((x)))
-#endif
-#define DUK_HSTRING_IS_ASCII(x) DUK_HSTRING_HAS_ASCII((x)) /* lazily set! */
-#define DUK_HSTRING_IS_EMPTY(x) (DUK_HSTRING_GET_BYTELEN((x)) == 0)
+#define DUK_HSTRING_FLAG_ASCII DUK_HEAPHDR_USER_FLAG(0) /* string is ASCII, clen == blen */
+#define DUK_HSTRING_FLAG_ARRIDX DUK_HEAPHDR_USER_FLAG(1) /* string is a valid array index */
+#define DUK_HSTRING_FLAG_SYMBOL DUK_HEAPHDR_USER_FLAG(2) /* string is a symbol (invalid utf-8) */
+#define DUK_HSTRING_FLAG_HIDDEN \
+ DUK_HEAPHDR_USER_FLAG(3) /* string is a hidden symbol (implies symbol, Duktape 1.x internal string) */
+#define DUK_HSTRING_FLAG_RESERVED_WORD DUK_HEAPHDR_USER_FLAG(4) /* string is a reserved word (non-strict) */
+#define DUK_HSTRING_FLAG_STRICT_RESERVED_WORD DUK_HEAPHDR_USER_FLAG(5) /* string is a reserved word (strict) */
+#define DUK_HSTRING_FLAG_EVAL_OR_ARGUMENTS DUK_HEAPHDR_USER_FLAG(6) /* string is 'eval' or 'arguments' */
+#define DUK_HSTRING_FLAG_EXTDATA DUK_HEAPHDR_USER_FLAG(7) /* string data is external (duk_hstring_external) */
+#define DUK_HSTRING_FLAG_PINNED_LITERAL DUK_HEAPHDR_USER_FLAG(8) /* string is a literal, and pinned */
+
+#define DUK_HSTRING_HAS_ASCII(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ASCII)
+#define DUK_HSTRING_HAS_ARRIDX(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ARRIDX)
+#define DUK_HSTRING_HAS_SYMBOL(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_SYMBOL)
+#define DUK_HSTRING_HAS_HIDDEN(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_HIDDEN)
+#define DUK_HSTRING_HAS_RESERVED_WORD(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_RESERVED_WORD)
+#define DUK_HSTRING_HAS_STRICT_RESERVED_WORD(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_STRICT_RESERVED_WORD)
+#define DUK_HSTRING_HAS_EVAL_OR_ARGUMENTS(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EVAL_OR_ARGUMENTS)
+#define DUK_HSTRING_HAS_EXTDATA(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EXTDATA)
+#define DUK_HSTRING_HAS_PINNED_LITERAL(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_PINNED_LITERAL)
+
+#define DUK_HSTRING_SET_ASCII(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ASCII)
+#define DUK_HSTRING_SET_ARRIDX(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ARRIDX)
+#define DUK_HSTRING_SET_SYMBOL(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_SYMBOL)
+#define DUK_HSTRING_SET_HIDDEN(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_HIDDEN)
+#define DUK_HSTRING_SET_RESERVED_WORD(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_RESERVED_WORD)
+#define DUK_HSTRING_SET_STRICT_RESERVED_WORD(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_STRICT_RESERVED_WORD)
+#define DUK_HSTRING_SET_EVAL_OR_ARGUMENTS(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EVAL_OR_ARGUMENTS)
+#define DUK_HSTRING_SET_EXTDATA(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EXTDATA)
+#define DUK_HSTRING_SET_PINNED_LITERAL(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_PINNED_LITERAL)
+
+#define DUK_HSTRING_CLEAR_ASCII(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ASCII)
+#define DUK_HSTRING_CLEAR_ARRIDX(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ARRIDX)
+#define DUK_HSTRING_CLEAR_SYMBOL(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_SYMBOL)
+#define DUK_HSTRING_CLEAR_HIDDEN(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_HIDDEN)
+#define DUK_HSTRING_CLEAR_RESERVED_WORD(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_RESERVED_WORD)
+#define DUK_HSTRING_CLEAR_STRICT_RESERVED_WORD(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_STRICT_RESERVED_WORD)
+#define DUK_HSTRING_CLEAR_EVAL_OR_ARGUMENTS(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EVAL_OR_ARGUMENTS)
+#define DUK_HSTRING_CLEAR_EXTDATA(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EXTDATA)
+#define DUK_HSTRING_CLEAR_PINNED_LITERAL(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_PINNED_LITERAL)
+
+#if 0 /* Slightly smaller code without explicit flag, but explicit flag \
+ * is very useful when 'clen' is dropped. \
+ */
+#define DUK_HSTRING_IS_ASCII(x) (DUK_HSTRING_GET_BYTELEN((x)) == DUK_HSTRING_GET_CHARLEN((x)))
+#endif
+#define DUK_HSTRING_IS_ASCII(x) DUK_HSTRING_HAS_ASCII((x)) /* lazily set! */
+#define DUK_HSTRING_IS_EMPTY(x) (DUK_HSTRING_GET_BYTELEN((x)) == 0)
#if defined(DUK_USE_STRHASH16)
-#define DUK_HSTRING_GET_HASH(x) ((x)->hdr.h_flags >> 16)
-#define DUK_HSTRING_SET_HASH(x,v) do { \
+#define DUK_HSTRING_GET_HASH(x) ((x)->hdr.h_flags >> 16)
+#define DUK_HSTRING_SET_HASH(x, v) \
+ do { \
(x)->hdr.h_flags = ((x)->hdr.h_flags & 0x0000ffffUL) | ((v) << 16); \
} while (0)
#else
-#define DUK_HSTRING_GET_HASH(x) ((x)->hash)
-#define DUK_HSTRING_SET_HASH(x,v) do { \
+#define DUK_HSTRING_GET_HASH(x) ((x)->hash)
+#define DUK_HSTRING_SET_HASH(x, v) \
+ do { \
(x)->hash = (v); \
} while (0)
#endif
#if defined(DUK_USE_STRLEN16)
-#define DUK_HSTRING_GET_BYTELEN(x) ((x)->hdr.h_strextra16)
-#define DUK_HSTRING_SET_BYTELEN(x,v) do { \
+#define DUK_HSTRING_GET_BYTELEN(x) ((x)->hdr.h_strextra16)
+#define DUK_HSTRING_SET_BYTELEN(x, v) \
+ do { \
(x)->hdr.h_strextra16 = (v); \
} while (0)
#if defined(DUK_USE_HSTRING_CLEN)
-#define DUK_HSTRING_GET_CHARLEN(x) duk_hstring_get_charlen((x))
-#define DUK_HSTRING_SET_CHARLEN(x,v) do { \
+#define DUK_HSTRING_GET_CHARLEN(x) duk_hstring_get_charlen((x))
+#define DUK_HSTRING_SET_CHARLEN(x, v) \
+ do { \
(x)->clen16 = (v); \
} while (0)
#else
-#define DUK_HSTRING_GET_CHARLEN(x) duk_hstring_get_charlen((x))
-#define DUK_HSTRING_SET_CHARLEN(x,v) do { \
- DUK_ASSERT(0); /* should never be called */ \
+#define DUK_HSTRING_GET_CHARLEN(x) duk_hstring_get_charlen((x))
+#define DUK_HSTRING_SET_CHARLEN(x, v) \
+ do { \
+ DUK_ASSERT(0); /* should never be called */ \
} while (0)
#endif
#else
-#define DUK_HSTRING_GET_BYTELEN(x) ((x)->blen)
-#define DUK_HSTRING_SET_BYTELEN(x,v) do { \
+#define DUK_HSTRING_GET_BYTELEN(x) ((x)->blen)
+#define DUK_HSTRING_SET_BYTELEN(x, v) \
+ do { \
(x)->blen = (v); \
} while (0)
-#define DUK_HSTRING_GET_CHARLEN(x) duk_hstring_get_charlen((x))
-#define DUK_HSTRING_SET_CHARLEN(x,v) do { \
+#define DUK_HSTRING_GET_CHARLEN(x) duk_hstring_get_charlen((x))
+#define DUK_HSTRING_SET_CHARLEN(x, v) \
+ do { \
(x)->clen = (v); \
} while (0)
#endif
#if defined(DUK_USE_HSTRING_EXTDATA)
-#define DUK_HSTRING_GET_EXTDATA(x) \
- ((x)->extdata)
+#define DUK_HSTRING_GET_EXTDATA(x) ((x)->extdata)
#define DUK_HSTRING_GET_DATA(x) \
- (DUK_HSTRING_HAS_EXTDATA((x)) ? \
- DUK_HSTRING_GET_EXTDATA((const duk_hstring_external *) (x)) : ((const duk_uint8_t *) ((x) + 1)))
+ (DUK_HSTRING_HAS_EXTDATA((x)) ? DUK_HSTRING_GET_EXTDATA((const duk_hstring_external *) (x)) : \
+ ((const duk_uint8_t *) ((x) + 1)))
#else
-#define DUK_HSTRING_GET_DATA(x) \
- ((const duk_uint8_t *) ((x) + 1))
+#define DUK_HSTRING_GET_DATA(x) ((const duk_uint8_t *) ((x) + 1))
#endif
-#define DUK_HSTRING_GET_DATA_END(x) \
- (DUK_HSTRING_GET_DATA((x)) + (x)->blen)
+#define DUK_HSTRING_GET_DATA_END(x) (DUK_HSTRING_GET_DATA((x)) + (x)->blen)
/* Marker value; in E5 2^32-1 is not a valid array index (2^32-2 is highest
* valid).
*/
-#define DUK_HSTRING_NO_ARRAY_INDEX (0xffffffffUL)
+#define DUK_HSTRING_NO_ARRAY_INDEX (0xffffffffUL)
#if defined(DUK_USE_HSTRING_ARRIDX)
-#define DUK_HSTRING_GET_ARRIDX_FAST(h) ((h)->arridx)
-#define DUK_HSTRING_GET_ARRIDX_SLOW(h) ((h)->arridx)
+#define DUK_HSTRING_GET_ARRIDX_FAST(h) ((h)->arridx)
+#define DUK_HSTRING_GET_ARRIDX_SLOW(h) ((h)->arridx)
#else
/* Get array index related to string (or return DUK_HSTRING_NO_ARRAY_INDEX);
* avoids helper call if string has no array index value.
*/
-#define DUK_HSTRING_GET_ARRIDX_FAST(h) \
+#define DUK_HSTRING_GET_ARRIDX_FAST(h) \
(DUK_HSTRING_HAS_ARRIDX((h)) ? duk_js_to_arrayindex_hstring_fast_known((h)) : DUK_HSTRING_NO_ARRAY_INDEX)
/* Slower but more compact variant. */
-#define DUK_HSTRING_GET_ARRIDX_SLOW(h) \
- (duk_js_to_arrayindex_hstring_fast((h)))
+#define DUK_HSTRING_GET_ARRIDX_SLOW(h) (duk_js_to_arrayindex_hstring_fast((h)))
#endif
/* XXX: these actually fit into duk_hstring */
-#define DUK_SYMBOL_TYPE_HIDDEN 0
-#define DUK_SYMBOL_TYPE_GLOBAL 1
-#define DUK_SYMBOL_TYPE_LOCAL 2
+#define DUK_SYMBOL_TYPE_HIDDEN 0
+#define DUK_SYMBOL_TYPE_GLOBAL 1
+#define DUK_SYMBOL_TYPE_LOCAL 2
#define DUK_SYMBOL_TYPE_WELLKNOWN 3
/* Assertion for duk_hstring validity. */
#if defined(DUK_USE_ASSERTIONS)
DUK_INTERNAL_DECL void duk_hstring_assert_valid(duk_hstring *h);
-#define DUK_HSTRING_ASSERT_VALID(h) do { duk_hstring_assert_valid((h)); } while (0)
+#define DUK_HSTRING_ASSERT_VALID(h) \
+ do { \
+ duk_hstring_assert_valid((h)); \
+ } while (0)
#else
-#define DUK_HSTRING_ASSERT_VALID(h) do {} while (0)
+#define DUK_HSTRING_ASSERT_VALID(h) \
+ do { \
+ } while (0)
#endif
/*
@@ -6016,14 +6535,17 @@ struct duk_hstring_external {
* Prototypes
*/
-DUK_INTERNAL_DECL duk_ucodepoint_t duk_hstring_char_code_at_raw(duk_hthread *thr, duk_hstring *h, duk_uint_t pos, duk_bool_t surrogate_aware);
+DUK_INTERNAL_DECL duk_ucodepoint_t duk_hstring_char_code_at_raw(duk_hthread *thr,
+ duk_hstring *h,
+ duk_uint_t pos,
+ duk_bool_t surrogate_aware);
DUK_INTERNAL_DECL duk_bool_t duk_hstring_equals_ascii_cstring(duk_hstring *h, const char *cstr);
DUK_INTERNAL_DECL duk_size_t duk_hstring_get_charlen(duk_hstring *h);
#if !defined(DUK_USE_HSTRING_LAZY_CLEN)
DUK_INTERNAL_DECL void duk_hstring_init_charlen(duk_hstring *h);
#endif
-#endif /* DUK_HSTRING_H_INCLUDED */
+#endif /* DUK_HSTRING_H_INCLUDED */
/* #include duk_hobject.h */
/*
* Heap object representation.
@@ -6066,36 +6588,40 @@ DUK_INTERNAL_DECL void duk_hstring_init_charlen(duk_hstring *h);
/* XXX: some flags are object subtype specific (e.g. common to all function
* subtypes, duk_harray, etc) and could be reused for different subtypes.
*/
-#define DUK_HOBJECT_FLAG_EXTENSIBLE DUK_HEAPHDR_USER_FLAG(0) /* object is extensible */
-#define DUK_HOBJECT_FLAG_CONSTRUCTABLE DUK_HEAPHDR_USER_FLAG(1) /* object is constructable */
-#define DUK_HOBJECT_FLAG_CALLABLE DUK_HEAPHDR_USER_FLAG(2) /* object is callable */
-#define DUK_HOBJECT_FLAG_BOUNDFUNC DUK_HEAPHDR_USER_FLAG(3) /* object established using Function.prototype.bind() */
-#define DUK_HOBJECT_FLAG_COMPFUNC DUK_HEAPHDR_USER_FLAG(4) /* object is a compiled function (duk_hcompfunc) */
-#define DUK_HOBJECT_FLAG_NATFUNC DUK_HEAPHDR_USER_FLAG(5) /* object is a native function (duk_hnatfunc) */
-#define DUK_HOBJECT_FLAG_BUFOBJ DUK_HEAPHDR_USER_FLAG(6) /* object is a buffer object (duk_hbufobj) (always exotic) */
-#define DUK_HOBJECT_FLAG_FASTREFS DUK_HEAPHDR_USER_FLAG(7) /* object has no fields needing DECREF/marking beyond base duk_hobject header */
-#define DUK_HOBJECT_FLAG_ARRAY_PART DUK_HEAPHDR_USER_FLAG(8) /* object has an array part (a_size may still be 0) */
-#define DUK_HOBJECT_FLAG_STRICT DUK_HEAPHDR_USER_FLAG(9) /* function: function object is strict */
-#define DUK_HOBJECT_FLAG_NOTAIL DUK_HEAPHDR_USER_FLAG(10) /* function: function must not be tail called */
-#define DUK_HOBJECT_FLAG_NEWENV DUK_HEAPHDR_USER_FLAG(11) /* function: create new environment when called (see duk_hcompfunc) */
-#define DUK_HOBJECT_FLAG_NAMEBINDING DUK_HEAPHDR_USER_FLAG(12) /* function: create binding for func name (function templates only, used for named function expressions) */
-#define DUK_HOBJECT_FLAG_CREATEARGS DUK_HEAPHDR_USER_FLAG(13) /* function: create an arguments object on function call */
-#define DUK_HOBJECT_FLAG_HAVE_FINALIZER DUK_HEAPHDR_USER_FLAG(14) /* object has a callable (own) finalizer property */
-#define DUK_HOBJECT_FLAG_EXOTIC_ARRAY DUK_HEAPHDR_USER_FLAG(15) /* 'Array' object, array length and index exotic behavior */
-#define DUK_HOBJECT_FLAG_EXOTIC_STRINGOBJ DUK_HEAPHDR_USER_FLAG(16) /* 'String' object, array index exotic behavior */
-#define DUK_HOBJECT_FLAG_EXOTIC_ARGUMENTS DUK_HEAPHDR_USER_FLAG(17) /* 'Arguments' object and has arguments exotic behavior (non-strict callee) */
-#define DUK_HOBJECT_FLAG_EXOTIC_PROXYOBJ DUK_HEAPHDR_USER_FLAG(18) /* 'Proxy' object */
-#define DUK_HOBJECT_FLAG_SPECIAL_CALL DUK_HEAPHDR_USER_FLAG(19) /* special casing in call behavior, for .call(), .apply(), etc. */
-
-#define DUK_HOBJECT_FLAG_CLASS_BASE DUK_HEAPHDR_USER_FLAG_NUMBER(20)
-#define DUK_HOBJECT_FLAG_CLASS_BITS 5
-
-#define DUK_HOBJECT_GET_CLASS_NUMBER(h) \
+#define DUK_HOBJECT_FLAG_EXTENSIBLE DUK_HEAPHDR_USER_FLAG(0) /* object is extensible */
+#define DUK_HOBJECT_FLAG_CONSTRUCTABLE DUK_HEAPHDR_USER_FLAG(1) /* object is constructable */
+#define DUK_HOBJECT_FLAG_CALLABLE DUK_HEAPHDR_USER_FLAG(2) /* object is callable */
+#define DUK_HOBJECT_FLAG_BOUNDFUNC DUK_HEAPHDR_USER_FLAG(3) /* object established using Function.prototype.bind() */
+#define DUK_HOBJECT_FLAG_COMPFUNC DUK_HEAPHDR_USER_FLAG(4) /* object is a compiled function (duk_hcompfunc) */
+#define DUK_HOBJECT_FLAG_NATFUNC DUK_HEAPHDR_USER_FLAG(5) /* object is a native function (duk_hnatfunc) */
+#define DUK_HOBJECT_FLAG_BUFOBJ DUK_HEAPHDR_USER_FLAG(6) /* object is a buffer object (duk_hbufobj) (always exotic) */
+#define DUK_HOBJECT_FLAG_FASTREFS \
+ DUK_HEAPHDR_USER_FLAG(7) /* object has no fields needing DECREF/marking beyond base duk_hobject header */
+#define DUK_HOBJECT_FLAG_ARRAY_PART DUK_HEAPHDR_USER_FLAG(8) /* object has an array part (a_size may still be 0) */
+#define DUK_HOBJECT_FLAG_STRICT DUK_HEAPHDR_USER_FLAG(9) /* function: function object is strict */
+#define DUK_HOBJECT_FLAG_NOTAIL DUK_HEAPHDR_USER_FLAG(10) /* function: function must not be tail called */
+#define DUK_HOBJECT_FLAG_NEWENV DUK_HEAPHDR_USER_FLAG(11) /* function: create new environment when called (see duk_hcompfunc) */
+#define DUK_HOBJECT_FLAG_NAMEBINDING \
+ DUK_HEAPHDR_USER_FLAG( \
+ 12) /* function: create binding for func name (function templates only, used for named function expressions) */
+#define DUK_HOBJECT_FLAG_CREATEARGS DUK_HEAPHDR_USER_FLAG(13) /* function: create an arguments object on function call */
+#define DUK_HOBJECT_FLAG_HAVE_FINALIZER DUK_HEAPHDR_USER_FLAG(14) /* object has a callable (own) finalizer property */
+#define DUK_HOBJECT_FLAG_EXOTIC_ARRAY DUK_HEAPHDR_USER_FLAG(15) /* 'Array' object, array length and index exotic behavior */
+#define DUK_HOBJECT_FLAG_EXOTIC_STRINGOBJ DUK_HEAPHDR_USER_FLAG(16) /* 'String' object, array index exotic behavior */
+#define DUK_HOBJECT_FLAG_EXOTIC_ARGUMENTS \
+ DUK_HEAPHDR_USER_FLAG(17) /* 'Arguments' object and has arguments exotic behavior (non-strict callee) */
+#define DUK_HOBJECT_FLAG_EXOTIC_PROXYOBJ DUK_HEAPHDR_USER_FLAG(18) /* 'Proxy' object */
+#define DUK_HOBJECT_FLAG_SPECIAL_CALL DUK_HEAPHDR_USER_FLAG(19) /* special casing in call behavior, for .call(), .apply(), etc. */
+
+#define DUK_HOBJECT_FLAG_CLASS_BASE DUK_HEAPHDR_USER_FLAG_NUMBER(20)
+#define DUK_HOBJECT_FLAG_CLASS_BITS 5
+
+#define DUK_HOBJECT_GET_CLASS_NUMBER(h) \
DUK_HEAPHDR_GET_FLAG_RANGE(&(h)->hdr, DUK_HOBJECT_FLAG_CLASS_BASE, DUK_HOBJECT_FLAG_CLASS_BITS)
-#define DUK_HOBJECT_SET_CLASS_NUMBER(h,v) \
+#define DUK_HOBJECT_SET_CLASS_NUMBER(h, v) \
DUK_HEAPHDR_SET_FLAG_RANGE(&(h)->hdr, DUK_HOBJECT_FLAG_CLASS_BASE, DUK_HOBJECT_FLAG_CLASS_BITS, (v))
-#define DUK_HOBJECT_GET_CLASS_MASK(h) \
+#define DUK_HOBJECT_GET_CLASS_MASK(h) \
(1UL << DUK_HEAPHDR_GET_FLAG_RANGE(&(h)->hdr, DUK_HOBJECT_FLAG_CLASS_BASE, DUK_HOBJECT_FLAG_CLASS_BITS))
/* Macro for creating flag initializer from a class number.
@@ -6103,256 +6629,239 @@ DUK_INTERNAL_DECL void duk_hstring_init_charlen(duk_hstring *h);
* a signed integer to an unsigned one; the largest class values
* have the highest bit (bit 31) set which causes this.
*/
-#define DUK_HOBJECT_CLASS_AS_FLAGS(v) (((duk_uint_t) (v)) << DUK_HOBJECT_FLAG_CLASS_BASE)
+#define DUK_HOBJECT_CLASS_AS_FLAGS(v) (((duk_uint_t) (v)) << DUK_HOBJECT_FLAG_CLASS_BASE)
/* E5 Section 8.6.2 + custom classes */
-#define DUK_HOBJECT_CLASS_NONE 0
-#define DUK_HOBJECT_CLASS_OBJECT 1
-#define DUK_HOBJECT_CLASS_ARRAY 2
-#define DUK_HOBJECT_CLASS_FUNCTION 3
-#define DUK_HOBJECT_CLASS_ARGUMENTS 4
-#define DUK_HOBJECT_CLASS_BOOLEAN 5
-#define DUK_HOBJECT_CLASS_DATE 6
-#define DUK_HOBJECT_CLASS_ERROR 7
-#define DUK_HOBJECT_CLASS_JSON 8
-#define DUK_HOBJECT_CLASS_MATH 9
-#define DUK_HOBJECT_CLASS_NUMBER 10
-#define DUK_HOBJECT_CLASS_REGEXP 11
-#define DUK_HOBJECT_CLASS_STRING 12
-#define DUK_HOBJECT_CLASS_GLOBAL 13
-#define DUK_HOBJECT_CLASS_SYMBOL 14
-#define DUK_HOBJECT_CLASS_OBJENV 15 /* custom */
-#define DUK_HOBJECT_CLASS_DECENV 16 /* custom */
-#define DUK_HOBJECT_CLASS_POINTER 17 /* custom */
-#define DUK_HOBJECT_CLASS_THREAD 18 /* custom; implies DUK_HOBJECT_IS_THREAD */
-#define DUK_HOBJECT_CLASS_BUFOBJ_MIN 19
-#define DUK_HOBJECT_CLASS_ARRAYBUFFER 19 /* implies DUK_HOBJECT_IS_BUFOBJ */
-#define DUK_HOBJECT_CLASS_DATAVIEW 20
-#define DUK_HOBJECT_CLASS_INT8ARRAY 21
-#define DUK_HOBJECT_CLASS_UINT8ARRAY 22
-#define DUK_HOBJECT_CLASS_UINT8CLAMPEDARRAY 23
-#define DUK_HOBJECT_CLASS_INT16ARRAY 24
-#define DUK_HOBJECT_CLASS_UINT16ARRAY 25
-#define DUK_HOBJECT_CLASS_INT32ARRAY 26
-#define DUK_HOBJECT_CLASS_UINT32ARRAY 27
-#define DUK_HOBJECT_CLASS_FLOAT32ARRAY 28
-#define DUK_HOBJECT_CLASS_FLOAT64ARRAY 29
-#define DUK_HOBJECT_CLASS_BUFOBJ_MAX 29
-#define DUK_HOBJECT_CLASS_MAX 29
+#define DUK_HOBJECT_CLASS_NONE 0
+#define DUK_HOBJECT_CLASS_OBJECT 1
+#define DUK_HOBJECT_CLASS_ARRAY 2
+#define DUK_HOBJECT_CLASS_FUNCTION 3
+#define DUK_HOBJECT_CLASS_ARGUMENTS 4
+#define DUK_HOBJECT_CLASS_BOOLEAN 5
+#define DUK_HOBJECT_CLASS_DATE 6
+#define DUK_HOBJECT_CLASS_ERROR 7
+#define DUK_HOBJECT_CLASS_JSON 8
+#define DUK_HOBJECT_CLASS_MATH 9
+#define DUK_HOBJECT_CLASS_NUMBER 10
+#define DUK_HOBJECT_CLASS_REGEXP 11
+#define DUK_HOBJECT_CLASS_STRING 12
+#define DUK_HOBJECT_CLASS_GLOBAL 13
+#define DUK_HOBJECT_CLASS_SYMBOL 14
+#define DUK_HOBJECT_CLASS_OBJENV 15 /* custom */
+#define DUK_HOBJECT_CLASS_DECENV 16 /* custom */
+#define DUK_HOBJECT_CLASS_POINTER 17 /* custom */
+#define DUK_HOBJECT_CLASS_THREAD 18 /* custom; implies DUK_HOBJECT_IS_THREAD */
+#define DUK_HOBJECT_CLASS_BUFOBJ_MIN 19
+#define DUK_HOBJECT_CLASS_ARRAYBUFFER 19 /* implies DUK_HOBJECT_IS_BUFOBJ */
+#define DUK_HOBJECT_CLASS_DATAVIEW 20
+#define DUK_HOBJECT_CLASS_INT8ARRAY 21
+#define DUK_HOBJECT_CLASS_UINT8ARRAY 22
+#define DUK_HOBJECT_CLASS_UINT8CLAMPEDARRAY 23
+#define DUK_HOBJECT_CLASS_INT16ARRAY 24
+#define DUK_HOBJECT_CLASS_UINT16ARRAY 25
+#define DUK_HOBJECT_CLASS_INT32ARRAY 26
+#define DUK_HOBJECT_CLASS_UINT32ARRAY 27
+#define DUK_HOBJECT_CLASS_FLOAT32ARRAY 28
+#define DUK_HOBJECT_CLASS_FLOAT64ARRAY 29
+#define DUK_HOBJECT_CLASS_BUFOBJ_MAX 29
+#define DUK_HOBJECT_CLASS_MAX 29
/* Class masks. */
-#define DUK_HOBJECT_CMASK_ALL ((1UL << (DUK_HOBJECT_CLASS_MAX + 1)) - 1UL)
-#define DUK_HOBJECT_CMASK_NONE (1UL << DUK_HOBJECT_CLASS_NONE)
-#define DUK_HOBJECT_CMASK_ARGUMENTS (1UL << DUK_HOBJECT_CLASS_ARGUMENTS)
-#define DUK_HOBJECT_CMASK_ARRAY (1UL << DUK_HOBJECT_CLASS_ARRAY)
-#define DUK_HOBJECT_CMASK_BOOLEAN (1UL << DUK_HOBJECT_CLASS_BOOLEAN)
-#define DUK_HOBJECT_CMASK_DATE (1UL << DUK_HOBJECT_CLASS_DATE)
-#define DUK_HOBJECT_CMASK_ERROR (1UL << DUK_HOBJECT_CLASS_ERROR)
-#define DUK_HOBJECT_CMASK_FUNCTION (1UL << DUK_HOBJECT_CLASS_FUNCTION)
-#define DUK_HOBJECT_CMASK_JSON (1UL << DUK_HOBJECT_CLASS_JSON)
-#define DUK_HOBJECT_CMASK_MATH (1UL << DUK_HOBJECT_CLASS_MATH)
-#define DUK_HOBJECT_CMASK_NUMBER (1UL << DUK_HOBJECT_CLASS_NUMBER)
-#define DUK_HOBJECT_CMASK_OBJECT (1UL << DUK_HOBJECT_CLASS_OBJECT)
-#define DUK_HOBJECT_CMASK_REGEXP (1UL << DUK_HOBJECT_CLASS_REGEXP)
-#define DUK_HOBJECT_CMASK_STRING (1UL << DUK_HOBJECT_CLASS_STRING)
-#define DUK_HOBJECT_CMASK_GLOBAL (1UL << DUK_HOBJECT_CLASS_GLOBAL)
-#define DUK_HOBJECT_CMASK_SYMBOL (1UL << DUK_HOBJECT_CLASS_SYMBOL)
-#define DUK_HOBJECT_CMASK_OBJENV (1UL << DUK_HOBJECT_CLASS_OBJENV)
-#define DUK_HOBJECT_CMASK_DECENV (1UL << DUK_HOBJECT_CLASS_DECENV)
-#define DUK_HOBJECT_CMASK_POINTER (1UL << DUK_HOBJECT_CLASS_POINTER)
-#define DUK_HOBJECT_CMASK_ARRAYBUFFER (1UL << DUK_HOBJECT_CLASS_ARRAYBUFFER)
-#define DUK_HOBJECT_CMASK_DATAVIEW (1UL << DUK_HOBJECT_CLASS_DATAVIEW)
-#define DUK_HOBJECT_CMASK_INT8ARRAY (1UL << DUK_HOBJECT_CLASS_INT8ARRAY)
-#define DUK_HOBJECT_CMASK_UINT8ARRAY (1UL << DUK_HOBJECT_CLASS_UINT8ARRAY)
-#define DUK_HOBJECT_CMASK_UINT8CLAMPEDARRAY (1UL << DUK_HOBJECT_CLASS_UINT8CLAMPEDARRAY)
-#define DUK_HOBJECT_CMASK_INT16ARRAY (1UL << DUK_HOBJECT_CLASS_INT16ARRAY)
-#define DUK_HOBJECT_CMASK_UINT16ARRAY (1UL << DUK_HOBJECT_CLASS_UINT16ARRAY)
-#define DUK_HOBJECT_CMASK_INT32ARRAY (1UL << DUK_HOBJECT_CLASS_INT32ARRAY)
-#define DUK_HOBJECT_CMASK_UINT32ARRAY (1UL << DUK_HOBJECT_CLASS_UINT32ARRAY)
-#define DUK_HOBJECT_CMASK_FLOAT32ARRAY (1UL << DUK_HOBJECT_CLASS_FLOAT32ARRAY)
-#define DUK_HOBJECT_CMASK_FLOAT64ARRAY (1UL << DUK_HOBJECT_CLASS_FLOAT64ARRAY)
+#define DUK_HOBJECT_CMASK_ALL ((1UL << (DUK_HOBJECT_CLASS_MAX + 1)) - 1UL)
+#define DUK_HOBJECT_CMASK_NONE (1UL << DUK_HOBJECT_CLASS_NONE)
+#define DUK_HOBJECT_CMASK_ARGUMENTS (1UL << DUK_HOBJECT_CLASS_ARGUMENTS)
+#define DUK_HOBJECT_CMASK_ARRAY (1UL << DUK_HOBJECT_CLASS_ARRAY)
+#define DUK_HOBJECT_CMASK_BOOLEAN (1UL << DUK_HOBJECT_CLASS_BOOLEAN)
+#define DUK_HOBJECT_CMASK_DATE (1UL << DUK_HOBJECT_CLASS_DATE)
+#define DUK_HOBJECT_CMASK_ERROR (1UL << DUK_HOBJECT_CLASS_ERROR)
+#define DUK_HOBJECT_CMASK_FUNCTION (1UL << DUK_HOBJECT_CLASS_FUNCTION)
+#define DUK_HOBJECT_CMASK_JSON (1UL << DUK_HOBJECT_CLASS_JSON)
+#define DUK_HOBJECT_CMASK_MATH (1UL << DUK_HOBJECT_CLASS_MATH)
+#define DUK_HOBJECT_CMASK_NUMBER (1UL << DUK_HOBJECT_CLASS_NUMBER)
+#define DUK_HOBJECT_CMASK_OBJECT (1UL << DUK_HOBJECT_CLASS_OBJECT)
+#define DUK_HOBJECT_CMASK_REGEXP (1UL << DUK_HOBJECT_CLASS_REGEXP)
+#define DUK_HOBJECT_CMASK_STRING (1UL << DUK_HOBJECT_CLASS_STRING)
+#define DUK_HOBJECT_CMASK_GLOBAL (1UL << DUK_HOBJECT_CLASS_GLOBAL)
+#define DUK_HOBJECT_CMASK_SYMBOL (1UL << DUK_HOBJECT_CLASS_SYMBOL)
+#define DUK_HOBJECT_CMASK_OBJENV (1UL << DUK_HOBJECT_CLASS_OBJENV)
+#define DUK_HOBJECT_CMASK_DECENV (1UL << DUK_HOBJECT_CLASS_DECENV)
+#define DUK_HOBJECT_CMASK_POINTER (1UL << DUK_HOBJECT_CLASS_POINTER)
+#define DUK_HOBJECT_CMASK_ARRAYBUFFER (1UL << DUK_HOBJECT_CLASS_ARRAYBUFFER)
+#define DUK_HOBJECT_CMASK_DATAVIEW (1UL << DUK_HOBJECT_CLASS_DATAVIEW)
+#define DUK_HOBJECT_CMASK_INT8ARRAY (1UL << DUK_HOBJECT_CLASS_INT8ARRAY)
+#define DUK_HOBJECT_CMASK_UINT8ARRAY (1UL << DUK_HOBJECT_CLASS_UINT8ARRAY)
+#define DUK_HOBJECT_CMASK_UINT8CLAMPEDARRAY (1UL << DUK_HOBJECT_CLASS_UINT8CLAMPEDARRAY)
+#define DUK_HOBJECT_CMASK_INT16ARRAY (1UL << DUK_HOBJECT_CLASS_INT16ARRAY)
+#define DUK_HOBJECT_CMASK_UINT16ARRAY (1UL << DUK_HOBJECT_CLASS_UINT16ARRAY)
+#define DUK_HOBJECT_CMASK_INT32ARRAY (1UL << DUK_HOBJECT_CLASS_INT32ARRAY)
+#define DUK_HOBJECT_CMASK_UINT32ARRAY (1UL << DUK_HOBJECT_CLASS_UINT32ARRAY)
+#define DUK_HOBJECT_CMASK_FLOAT32ARRAY (1UL << DUK_HOBJECT_CLASS_FLOAT32ARRAY)
+#define DUK_HOBJECT_CMASK_FLOAT64ARRAY (1UL << DUK_HOBJECT_CLASS_FLOAT64ARRAY)
#define DUK_HOBJECT_CMASK_ALL_BUFOBJS \
- (DUK_HOBJECT_CMASK_ARRAYBUFFER | \
- DUK_HOBJECT_CMASK_DATAVIEW | \
- DUK_HOBJECT_CMASK_INT8ARRAY | \
- DUK_HOBJECT_CMASK_UINT8ARRAY | \
- DUK_HOBJECT_CMASK_UINT8CLAMPEDARRAY | \
- DUK_HOBJECT_CMASK_INT16ARRAY | \
- DUK_HOBJECT_CMASK_UINT16ARRAY | \
- DUK_HOBJECT_CMASK_INT32ARRAY | \
- DUK_HOBJECT_CMASK_UINT32ARRAY | \
- DUK_HOBJECT_CMASK_FLOAT32ARRAY | \
+ (DUK_HOBJECT_CMASK_ARRAYBUFFER | DUK_HOBJECT_CMASK_DATAVIEW | DUK_HOBJECT_CMASK_INT8ARRAY | DUK_HOBJECT_CMASK_UINT8ARRAY | \
+ DUK_HOBJECT_CMASK_UINT8CLAMPEDARRAY | DUK_HOBJECT_CMASK_INT16ARRAY | DUK_HOBJECT_CMASK_UINT16ARRAY | \
+ DUK_HOBJECT_CMASK_INT32ARRAY | DUK_HOBJECT_CMASK_UINT32ARRAY | DUK_HOBJECT_CMASK_FLOAT32ARRAY | \
DUK_HOBJECT_CMASK_FLOAT64ARRAY)
-#define DUK_HOBJECT_IS_OBJENV(h) (DUK_HOBJECT_GET_CLASS_NUMBER((h)) == DUK_HOBJECT_CLASS_OBJENV)
-#define DUK_HOBJECT_IS_DECENV(h) (DUK_HOBJECT_GET_CLASS_NUMBER((h)) == DUK_HOBJECT_CLASS_DECENV)
-#define DUK_HOBJECT_IS_ENV(h) (DUK_HOBJECT_IS_OBJENV((h)) || DUK_HOBJECT_IS_DECENV((h)))
-#define DUK_HOBJECT_IS_ARRAY(h) DUK_HOBJECT_HAS_EXOTIC_ARRAY((h)) /* Rely on class Array <=> exotic Array */
-#define DUK_HOBJECT_IS_BOUNDFUNC(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BOUNDFUNC)
-#define DUK_HOBJECT_IS_COMPFUNC(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_COMPFUNC)
-#define DUK_HOBJECT_IS_NATFUNC(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NATFUNC)
+#define DUK_HOBJECT_IS_OBJENV(h) (DUK_HOBJECT_GET_CLASS_NUMBER((h)) == DUK_HOBJECT_CLASS_OBJENV)
+#define DUK_HOBJECT_IS_DECENV(h) (DUK_HOBJECT_GET_CLASS_NUMBER((h)) == DUK_HOBJECT_CLASS_DECENV)
+#define DUK_HOBJECT_IS_ENV(h) (DUK_HOBJECT_IS_OBJENV((h)) || DUK_HOBJECT_IS_DECENV((h)))
+#define DUK_HOBJECT_IS_ARRAY(h) DUK_HOBJECT_HAS_EXOTIC_ARRAY((h)) /* Rely on class Array <=> exotic Array */
+#define DUK_HOBJECT_IS_BOUNDFUNC(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BOUNDFUNC)
+#define DUK_HOBJECT_IS_COMPFUNC(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_COMPFUNC)
+#define DUK_HOBJECT_IS_NATFUNC(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NATFUNC)
#if defined(DUK_USE_BUFFEROBJECT_SUPPORT)
-#define DUK_HOBJECT_IS_BUFOBJ(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BUFOBJ)
+#define DUK_HOBJECT_IS_BUFOBJ(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BUFOBJ)
#else
-#define DUK_HOBJECT_IS_BUFOBJ(h) 0
+#define DUK_HOBJECT_IS_BUFOBJ(h) 0
#endif
-#define DUK_HOBJECT_IS_THREAD(h) (DUK_HOBJECT_GET_CLASS_NUMBER((h)) == DUK_HOBJECT_CLASS_THREAD)
+#define DUK_HOBJECT_IS_THREAD(h) (DUK_HOBJECT_GET_CLASS_NUMBER((h)) == DUK_HOBJECT_CLASS_THREAD)
#if defined(DUK_USE_ES6_PROXY)
-#define DUK_HOBJECT_IS_PROXY(h) DUK_HOBJECT_HAS_EXOTIC_PROXYOBJ((h))
+#define DUK_HOBJECT_IS_PROXY(h) DUK_HOBJECT_HAS_EXOTIC_PROXYOBJ((h))
#else
-#define DUK_HOBJECT_IS_PROXY(h) 0
+#define DUK_HOBJECT_IS_PROXY(h) 0
#endif
-#define DUK_HOBJECT_IS_NONBOUND_FUNCTION(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, \
- DUK_HOBJECT_FLAG_COMPFUNC | \
- DUK_HOBJECT_FLAG_NATFUNC)
+#define DUK_HOBJECT_IS_NONBOUND_FUNCTION(h) \
+ DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_COMPFUNC | DUK_HOBJECT_FLAG_NATFUNC)
-#define DUK_HOBJECT_IS_FUNCTION(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, \
- DUK_HOBJECT_FLAG_BOUNDFUNC | \
- DUK_HOBJECT_FLAG_COMPFUNC | \
- DUK_HOBJECT_FLAG_NATFUNC)
+#define DUK_HOBJECT_IS_FUNCTION(h) \
+ DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BOUNDFUNC | DUK_HOBJECT_FLAG_COMPFUNC | DUK_HOBJECT_FLAG_NATFUNC)
-#define DUK_HOBJECT_IS_CALLABLE(h) DUK_HOBJECT_HAS_CALLABLE((h))
+#define DUK_HOBJECT_IS_CALLABLE(h) DUK_HOBJECT_HAS_CALLABLE((h))
/* Object has any exotic behavior(s). */
-#define DUK_HOBJECT_EXOTIC_BEHAVIOR_FLAGS (DUK_HOBJECT_FLAG_EXOTIC_ARRAY | \
- DUK_HOBJECT_FLAG_EXOTIC_ARGUMENTS | \
- DUK_HOBJECT_FLAG_EXOTIC_STRINGOBJ | \
- DUK_HOBJECT_FLAG_BUFOBJ | \
- DUK_HOBJECT_FLAG_EXOTIC_PROXYOBJ)
-#define DUK_HOBJECT_HAS_EXOTIC_BEHAVIOR(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_EXOTIC_BEHAVIOR_FLAGS)
+#define DUK_HOBJECT_EXOTIC_BEHAVIOR_FLAGS \
+ (DUK_HOBJECT_FLAG_EXOTIC_ARRAY | DUK_HOBJECT_FLAG_EXOTIC_ARGUMENTS | DUK_HOBJECT_FLAG_EXOTIC_STRINGOBJ | \
+ DUK_HOBJECT_FLAG_BUFOBJ | DUK_HOBJECT_FLAG_EXOTIC_PROXYOBJ)
+#define DUK_HOBJECT_HAS_EXOTIC_BEHAVIOR(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_EXOTIC_BEHAVIOR_FLAGS)
/* Object has any virtual properties (not counting Proxy behavior). */
-#define DUK_HOBJECT_VIRTUAL_PROPERTY_FLAGS (DUK_HOBJECT_FLAG_EXOTIC_ARRAY | \
- DUK_HOBJECT_FLAG_EXOTIC_STRINGOBJ | \
- DUK_HOBJECT_FLAG_BUFOBJ)
-#define DUK_HOBJECT_HAS_VIRTUAL_PROPERTIES(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_VIRTUAL_PROPERTY_FLAGS)
-
-#define DUK_HOBJECT_HAS_EXTENSIBLE(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXTENSIBLE)
-#define DUK_HOBJECT_HAS_CONSTRUCTABLE(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CONSTRUCTABLE)
-#define DUK_HOBJECT_HAS_CALLABLE(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CALLABLE)
-#define DUK_HOBJECT_HAS_BOUNDFUNC(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BOUNDFUNC)
-#define DUK_HOBJECT_HAS_COMPFUNC(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_COMPFUNC)
-#define DUK_HOBJECT_HAS_NATFUNC(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NATFUNC)
+#define DUK_HOBJECT_VIRTUAL_PROPERTY_FLAGS \
+ (DUK_HOBJECT_FLAG_EXOTIC_ARRAY | DUK_HOBJECT_FLAG_EXOTIC_STRINGOBJ | DUK_HOBJECT_FLAG_BUFOBJ)
+#define DUK_HOBJECT_HAS_VIRTUAL_PROPERTIES(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_VIRTUAL_PROPERTY_FLAGS)
+
+#define DUK_HOBJECT_HAS_EXTENSIBLE(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXTENSIBLE)
+#define DUK_HOBJECT_HAS_CONSTRUCTABLE(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CONSTRUCTABLE)
+#define DUK_HOBJECT_HAS_CALLABLE(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CALLABLE)
+#define DUK_HOBJECT_HAS_BOUNDFUNC(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BOUNDFUNC)
+#define DUK_HOBJECT_HAS_COMPFUNC(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_COMPFUNC)
+#define DUK_HOBJECT_HAS_NATFUNC(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NATFUNC)
#if defined(DUK_USE_BUFFEROBJECT_SUPPORT)
-#define DUK_HOBJECT_HAS_BUFOBJ(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BUFOBJ)
+#define DUK_HOBJECT_HAS_BUFOBJ(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BUFOBJ)
#else
-#define DUK_HOBJECT_HAS_BUFOBJ(h) 0
-#endif
-#define DUK_HOBJECT_HAS_FASTREFS(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_FASTREFS)
-#define DUK_HOBJECT_HAS_ARRAY_PART(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_ARRAY_PART)
-#define DUK_HOBJECT_HAS_STRICT(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_STRICT)
-#define DUK_HOBJECT_HAS_NOTAIL(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NOTAIL)
-#define DUK_HOBJECT_HAS_NEWENV(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NEWENV)
-#define DUK_HOBJECT_HAS_NAMEBINDING(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NAMEBINDING)
-#define DUK_HOBJECT_HAS_CREATEARGS(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CREATEARGS)
-#define DUK_HOBJECT_HAS_HAVE_FINALIZER(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_HAVE_FINALIZER)
-#define DUK_HOBJECT_HAS_EXOTIC_ARRAY(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_ARRAY)
-#define DUK_HOBJECT_HAS_EXOTIC_STRINGOBJ(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_STRINGOBJ)
-#define DUK_HOBJECT_HAS_EXOTIC_ARGUMENTS(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_ARGUMENTS)
+#define DUK_HOBJECT_HAS_BUFOBJ(h) 0
+#endif
+#define DUK_HOBJECT_HAS_FASTREFS(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_FASTREFS)
+#define DUK_HOBJECT_HAS_ARRAY_PART(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_ARRAY_PART)
+#define DUK_HOBJECT_HAS_STRICT(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_STRICT)
+#define DUK_HOBJECT_HAS_NOTAIL(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NOTAIL)
+#define DUK_HOBJECT_HAS_NEWENV(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NEWENV)
+#define DUK_HOBJECT_HAS_NAMEBINDING(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NAMEBINDING)
+#define DUK_HOBJECT_HAS_CREATEARGS(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CREATEARGS)
+#define DUK_HOBJECT_HAS_HAVE_FINALIZER(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_HAVE_FINALIZER)
+#define DUK_HOBJECT_HAS_EXOTIC_ARRAY(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_ARRAY)
+#define DUK_HOBJECT_HAS_EXOTIC_STRINGOBJ(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_STRINGOBJ)
+#define DUK_HOBJECT_HAS_EXOTIC_ARGUMENTS(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_ARGUMENTS)
#if defined(DUK_USE_ES6_PROXY)
-#define DUK_HOBJECT_HAS_EXOTIC_PROXYOBJ(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_PROXYOBJ)
+#define DUK_HOBJECT_HAS_EXOTIC_PROXYOBJ(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_PROXYOBJ)
#else
-#define DUK_HOBJECT_HAS_EXOTIC_PROXYOBJ(h) 0
+#define DUK_HOBJECT_HAS_EXOTIC_PROXYOBJ(h) 0
#endif
-#define DUK_HOBJECT_HAS_SPECIAL_CALL(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_SPECIAL_CALL)
+#define DUK_HOBJECT_HAS_SPECIAL_CALL(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_SPECIAL_CALL)
-#define DUK_HOBJECT_SET_EXTENSIBLE(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXTENSIBLE)
-#define DUK_HOBJECT_SET_CONSTRUCTABLE(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CONSTRUCTABLE)
-#define DUK_HOBJECT_SET_CALLABLE(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CALLABLE)
-#define DUK_HOBJECT_SET_BOUNDFUNC(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BOUNDFUNC)
-#define DUK_HOBJECT_SET_COMPFUNC(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_COMPFUNC)
-#define DUK_HOBJECT_SET_NATFUNC(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NATFUNC)
+#define DUK_HOBJECT_SET_EXTENSIBLE(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXTENSIBLE)
+#define DUK_HOBJECT_SET_CONSTRUCTABLE(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CONSTRUCTABLE)
+#define DUK_HOBJECT_SET_CALLABLE(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CALLABLE)
+#define DUK_HOBJECT_SET_BOUNDFUNC(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BOUNDFUNC)
+#define DUK_HOBJECT_SET_COMPFUNC(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_COMPFUNC)
+#define DUK_HOBJECT_SET_NATFUNC(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NATFUNC)
#if defined(DUK_USE_BUFFEROBJECT_SUPPORT)
-#define DUK_HOBJECT_SET_BUFOBJ(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BUFOBJ)
-#endif
-#define DUK_HOBJECT_SET_FASTREFS(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_FASTREFS)
-#define DUK_HOBJECT_SET_ARRAY_PART(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_ARRAY_PART)
-#define DUK_HOBJECT_SET_STRICT(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_STRICT)
-#define DUK_HOBJECT_SET_NOTAIL(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NOTAIL)
-#define DUK_HOBJECT_SET_NEWENV(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NEWENV)
-#define DUK_HOBJECT_SET_NAMEBINDING(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NAMEBINDING)
-#define DUK_HOBJECT_SET_CREATEARGS(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CREATEARGS)
-#define DUK_HOBJECT_SET_HAVE_FINALIZER(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_HAVE_FINALIZER)
-#define DUK_HOBJECT_SET_EXOTIC_ARRAY(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_ARRAY)
-#define DUK_HOBJECT_SET_EXOTIC_STRINGOBJ(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_STRINGOBJ)
-#define DUK_HOBJECT_SET_EXOTIC_ARGUMENTS(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_ARGUMENTS)
+#define DUK_HOBJECT_SET_BUFOBJ(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BUFOBJ)
+#endif
+#define DUK_HOBJECT_SET_FASTREFS(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_FASTREFS)
+#define DUK_HOBJECT_SET_ARRAY_PART(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_ARRAY_PART)
+#define DUK_HOBJECT_SET_STRICT(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_STRICT)
+#define DUK_HOBJECT_SET_NOTAIL(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NOTAIL)
+#define DUK_HOBJECT_SET_NEWENV(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NEWENV)
+#define DUK_HOBJECT_SET_NAMEBINDING(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NAMEBINDING)
+#define DUK_HOBJECT_SET_CREATEARGS(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CREATEARGS)
+#define DUK_HOBJECT_SET_HAVE_FINALIZER(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_HAVE_FINALIZER)
+#define DUK_HOBJECT_SET_EXOTIC_ARRAY(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_ARRAY)
+#define DUK_HOBJECT_SET_EXOTIC_STRINGOBJ(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_STRINGOBJ)
+#define DUK_HOBJECT_SET_EXOTIC_ARGUMENTS(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_ARGUMENTS)
#if defined(DUK_USE_ES6_PROXY)
-#define DUK_HOBJECT_SET_EXOTIC_PROXYOBJ(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_PROXYOBJ)
+#define DUK_HOBJECT_SET_EXOTIC_PROXYOBJ(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_PROXYOBJ)
#endif
-#define DUK_HOBJECT_SET_SPECIAL_CALL(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_SPECIAL_CALL)
+#define DUK_HOBJECT_SET_SPECIAL_CALL(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_SPECIAL_CALL)
-#define DUK_HOBJECT_CLEAR_EXTENSIBLE(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXTENSIBLE)
-#define DUK_HOBJECT_CLEAR_CONSTRUCTABLE(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CONSTRUCTABLE)
-#define DUK_HOBJECT_CLEAR_CALLABLE(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CALLABLE)
-#define DUK_HOBJECT_CLEAR_BOUNDFUNC(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BOUNDFUNC)
-#define DUK_HOBJECT_CLEAR_COMPFUNC(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_COMPFUNC)
-#define DUK_HOBJECT_CLEAR_NATFUNC(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NATFUNC)
+#define DUK_HOBJECT_CLEAR_EXTENSIBLE(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXTENSIBLE)
+#define DUK_HOBJECT_CLEAR_CONSTRUCTABLE(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CONSTRUCTABLE)
+#define DUK_HOBJECT_CLEAR_CALLABLE(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CALLABLE)
+#define DUK_HOBJECT_CLEAR_BOUNDFUNC(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BOUNDFUNC)
+#define DUK_HOBJECT_CLEAR_COMPFUNC(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_COMPFUNC)
+#define DUK_HOBJECT_CLEAR_NATFUNC(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NATFUNC)
#if defined(DUK_USE_BUFFEROBJECT_SUPPORT)
-#define DUK_HOBJECT_CLEAR_BUFOBJ(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BUFOBJ)
-#endif
-#define DUK_HOBJECT_CLEAR_FASTREFS(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_FASTREFS)
-#define DUK_HOBJECT_CLEAR_ARRAY_PART(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_ARRAY_PART)
-#define DUK_HOBJECT_CLEAR_STRICT(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_STRICT)
-#define DUK_HOBJECT_CLEAR_NOTAIL(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NOTAIL)
-#define DUK_HOBJECT_CLEAR_NEWENV(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NEWENV)
-#define DUK_HOBJECT_CLEAR_NAMEBINDING(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NAMEBINDING)
-#define DUK_HOBJECT_CLEAR_CREATEARGS(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CREATEARGS)
-#define DUK_HOBJECT_CLEAR_HAVE_FINALIZER(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_HAVE_FINALIZER)
-#define DUK_HOBJECT_CLEAR_EXOTIC_ARRAY(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_ARRAY)
-#define DUK_HOBJECT_CLEAR_EXOTIC_STRINGOBJ(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_STRINGOBJ)
-#define DUK_HOBJECT_CLEAR_EXOTIC_ARGUMENTS(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_ARGUMENTS)
+#define DUK_HOBJECT_CLEAR_BUFOBJ(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BUFOBJ)
+#endif
+#define DUK_HOBJECT_CLEAR_FASTREFS(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_FASTREFS)
+#define DUK_HOBJECT_CLEAR_ARRAY_PART(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_ARRAY_PART)
+#define DUK_HOBJECT_CLEAR_STRICT(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_STRICT)
+#define DUK_HOBJECT_CLEAR_NOTAIL(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NOTAIL)
+#define DUK_HOBJECT_CLEAR_NEWENV(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NEWENV)
+#define DUK_HOBJECT_CLEAR_NAMEBINDING(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NAMEBINDING)
+#define DUK_HOBJECT_CLEAR_CREATEARGS(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_CREATEARGS)
+#define DUK_HOBJECT_CLEAR_HAVE_FINALIZER(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_HAVE_FINALIZER)
+#define DUK_HOBJECT_CLEAR_EXOTIC_ARRAY(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_ARRAY)
+#define DUK_HOBJECT_CLEAR_EXOTIC_STRINGOBJ(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_STRINGOBJ)
+#define DUK_HOBJECT_CLEAR_EXOTIC_ARGUMENTS(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_ARGUMENTS)
#if defined(DUK_USE_ES6_PROXY)
-#define DUK_HOBJECT_CLEAR_EXOTIC_PROXYOBJ(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_PROXYOBJ)
+#define DUK_HOBJECT_CLEAR_EXOTIC_PROXYOBJ(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_PROXYOBJ)
#endif
-#define DUK_HOBJECT_CLEAR_SPECIAL_CALL(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_SPECIAL_CALL)
+#define DUK_HOBJECT_CLEAR_SPECIAL_CALL(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_SPECIAL_CALL)
/* Object can/cannot use FASTREFS, i.e. has no strong reference fields beyond
* duk_hobject base header. This is used just for asserts so doesn't need to
* be optimized.
*/
#define DUK_HOBJECT_PROHIBITS_FASTREFS(h) \
- (DUK_HOBJECT_IS_COMPFUNC((h)) || DUK_HOBJECT_IS_DECENV((h)) || DUK_HOBJECT_IS_OBJENV((h)) || \
- DUK_HOBJECT_IS_BUFOBJ((h)) || DUK_HOBJECT_IS_THREAD((h)) || DUK_HOBJECT_IS_PROXY((h)) || \
- DUK_HOBJECT_IS_BOUNDFUNC((h)))
+ (DUK_HOBJECT_IS_COMPFUNC((h)) || DUK_HOBJECT_IS_DECENV((h)) || DUK_HOBJECT_IS_OBJENV((h)) || DUK_HOBJECT_IS_BUFOBJ((h)) || \
+ DUK_HOBJECT_IS_THREAD((h)) || DUK_HOBJECT_IS_PROXY((h)) || DUK_HOBJECT_IS_BOUNDFUNC((h)))
#define DUK_HOBJECT_ALLOWS_FASTREFS(h) (!DUK_HOBJECT_PROHIBITS_FASTREFS((h)))
/* Flags used for property attributes in duk_propdesc and packed flags.
* Must fit into 8 bits.
*/
-#define DUK_PROPDESC_FLAG_WRITABLE (1U << 0) /* E5 Section 8.6.1 */
-#define DUK_PROPDESC_FLAG_ENUMERABLE (1U << 1) /* E5 Section 8.6.1 */
-#define DUK_PROPDESC_FLAG_CONFIGURABLE (1U << 2) /* E5 Section 8.6.1 */
-#define DUK_PROPDESC_FLAG_ACCESSOR (1U << 3) /* accessor */
-#define DUK_PROPDESC_FLAG_VIRTUAL (1U << 4) /* property is virtual: used in duk_propdesc, never stored
- * (used by e.g. buffer virtual properties)
- */
-#define DUK_PROPDESC_FLAGS_MASK (DUK_PROPDESC_FLAG_WRITABLE | \
- DUK_PROPDESC_FLAG_ENUMERABLE | \
- DUK_PROPDESC_FLAG_CONFIGURABLE | \
- DUK_PROPDESC_FLAG_ACCESSOR)
+#define DUK_PROPDESC_FLAG_WRITABLE (1U << 0) /* E5 Section 8.6.1 */
+#define DUK_PROPDESC_FLAG_ENUMERABLE (1U << 1) /* E5 Section 8.6.1 */
+#define DUK_PROPDESC_FLAG_CONFIGURABLE (1U << 2) /* E5 Section 8.6.1 */
+#define DUK_PROPDESC_FLAG_ACCESSOR (1U << 3) /* accessor */
+#define DUK_PROPDESC_FLAG_VIRTUAL \
+ (1U << 4) /* property is virtual: used in duk_propdesc, never stored \
+ * (used by e.g. buffer virtual properties) \
+ */
+#define DUK_PROPDESC_FLAGS_MASK \
+ (DUK_PROPDESC_FLAG_WRITABLE | DUK_PROPDESC_FLAG_ENUMERABLE | DUK_PROPDESC_FLAG_CONFIGURABLE | DUK_PROPDESC_FLAG_ACCESSOR)
/* Additional flags which are passed in the same flags argument as property
* flags but are not stored in object properties.
*/
-#define DUK_PROPDESC_FLAG_NO_OVERWRITE (1U << 4) /* internal define property: skip write silently if exists */
+#define DUK_PROPDESC_FLAG_NO_OVERWRITE (1U << 4) /* internal define property: skip write silently if exists */
/* Convenience defines for property attributes. */
-#define DUK_PROPDESC_FLAGS_NONE 0
-#define DUK_PROPDESC_FLAGS_W (DUK_PROPDESC_FLAG_WRITABLE)
-#define DUK_PROPDESC_FLAGS_E (DUK_PROPDESC_FLAG_ENUMERABLE)
-#define DUK_PROPDESC_FLAGS_C (DUK_PROPDESC_FLAG_CONFIGURABLE)
-#define DUK_PROPDESC_FLAGS_WE (DUK_PROPDESC_FLAG_WRITABLE | DUK_PROPDESC_FLAG_ENUMERABLE)
-#define DUK_PROPDESC_FLAGS_WC (DUK_PROPDESC_FLAG_WRITABLE | DUK_PROPDESC_FLAG_CONFIGURABLE)
-#define DUK_PROPDESC_FLAGS_EC (DUK_PROPDESC_FLAG_ENUMERABLE | DUK_PROPDESC_FLAG_CONFIGURABLE)
-#define DUK_PROPDESC_FLAGS_WEC (DUK_PROPDESC_FLAG_WRITABLE | \
- DUK_PROPDESC_FLAG_ENUMERABLE | \
- DUK_PROPDESC_FLAG_CONFIGURABLE)
+#define DUK_PROPDESC_FLAGS_NONE 0
+#define DUK_PROPDESC_FLAGS_W (DUK_PROPDESC_FLAG_WRITABLE)
+#define DUK_PROPDESC_FLAGS_E (DUK_PROPDESC_FLAG_ENUMERABLE)
+#define DUK_PROPDESC_FLAGS_C (DUK_PROPDESC_FLAG_CONFIGURABLE)
+#define DUK_PROPDESC_FLAGS_WE (DUK_PROPDESC_FLAG_WRITABLE | DUK_PROPDESC_FLAG_ENUMERABLE)
+#define DUK_PROPDESC_FLAGS_WC (DUK_PROPDESC_FLAG_WRITABLE | DUK_PROPDESC_FLAG_CONFIGURABLE)
+#define DUK_PROPDESC_FLAGS_EC (DUK_PROPDESC_FLAG_ENUMERABLE | DUK_PROPDESC_FLAG_CONFIGURABLE)
+#define DUK_PROPDESC_FLAGS_WEC (DUK_PROPDESC_FLAG_WRITABLE | DUK_PROPDESC_FLAG_ENUMERABLE | DUK_PROPDESC_FLAG_CONFIGURABLE)
/* Flags for duk_hobject_get_own_propdesc() and variants. */
-#define DUK_GETDESC_FLAG_PUSH_VALUE (1U << 0) /* push value to stack */
-#define DUK_GETDESC_FLAG_IGNORE_PROTOLOOP (1U << 1) /* don't throw for prototype loop */
+#define DUK_GETDESC_FLAG_PUSH_VALUE (1U << 0) /* push value to stack */
+#define DUK_GETDESC_FLAG_IGNORE_PROTOLOOP (1U << 1) /* don't throw for prototype loop */
/*
* Macro for object validity check
@@ -6362,9 +6871,14 @@ DUK_INTERNAL_DECL void duk_hstring_init_charlen(duk_hstring *h);
#if defined(DUK_USE_ASSERTIONS)
DUK_INTERNAL_DECL void duk_hobject_assert_valid(duk_hobject *h);
-#define DUK_HOBJECT_ASSERT_VALID(h) do { duk_hobject_assert_valid((h)); } while (0)
+#define DUK_HOBJECT_ASSERT_VALID(h) \
+ do { \
+ duk_hobject_assert_valid((h)); \
+ } while (0)
#else
-#define DUK_HOBJECT_ASSERT_VALID(h) do {} while (0)
+#define DUK_HOBJECT_ASSERT_VALID(h) \
+ do { \
+ } while (0)
#endif
/*
@@ -6372,52 +6886,41 @@ DUK_INTERNAL_DECL void duk_hobject_assert_valid(duk_hobject *h);
*/
#if defined(DUK_USE_HEAPPTR16)
-#define DUK_HOBJECT_GET_PROPS(heap,h) \
- ((duk_uint8_t *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, ((duk_heaphdr *) (h))->h_extra16))
-#define DUK_HOBJECT_SET_PROPS(heap,h,x) do { \
+#define DUK_HOBJECT_GET_PROPS(heap, h) ((duk_uint8_t *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, ((duk_heaphdr *) (h))->h_extra16))
+#define DUK_HOBJECT_SET_PROPS(heap, h, x) \
+ do { \
((duk_heaphdr *) (h))->h_extra16 = DUK_USE_HEAPPTR_ENC16((heap)->heap_udata, (void *) (x)); \
} while (0)
#else
-#define DUK_HOBJECT_GET_PROPS(heap,h) \
- ((h)->props)
-#define DUK_HOBJECT_SET_PROPS(heap,h,x) do { \
+#define DUK_HOBJECT_GET_PROPS(heap, h) ((h)->props)
+#define DUK_HOBJECT_SET_PROPS(heap, h, x) \
+ do { \
(h)->props = (duk_uint8_t *) (x); \
} while (0)
#endif
#if defined(DUK_USE_HOBJECT_LAYOUT_1)
/* LAYOUT 1 */
-#define DUK_HOBJECT_E_GET_KEY_BASE(heap,h) \
- ((duk_hstring **) (void *) ( \
- DUK_HOBJECT_GET_PROPS((heap), (h)) \
- ))
-#define DUK_HOBJECT_E_GET_VALUE_BASE(heap,h) \
- ((duk_propvalue *) (void *) ( \
- DUK_HOBJECT_GET_PROPS((heap), (h)) + \
- DUK_HOBJECT_GET_ESIZE((h)) * sizeof(duk_hstring *) \
- ))
-#define DUK_HOBJECT_E_GET_FLAGS_BASE(heap,h) \
- ((duk_uint8_t *) (void *) ( \
- DUK_HOBJECT_GET_PROPS((heap), (h)) + DUK_HOBJECT_GET_ESIZE((h)) * (sizeof(duk_hstring *) + sizeof(duk_propvalue)) \
- ))
-#define DUK_HOBJECT_A_GET_BASE(heap,h) \
- ((duk_tval *) (void *) ( \
- DUK_HOBJECT_GET_PROPS((heap), (h)) + \
- DUK_HOBJECT_GET_ESIZE((h)) * (sizeof(duk_hstring *) + sizeof(duk_propvalue) + sizeof(duk_uint8_t)) \
- ))
-#define DUK_HOBJECT_H_GET_BASE(heap,h) \
- ((duk_uint32_t *) (void *) ( \
- DUK_HOBJECT_GET_PROPS((heap), (h)) + \
- DUK_HOBJECT_GET_ESIZE((h)) * (sizeof(duk_hstring *) + sizeof(duk_propvalue) + sizeof(duk_uint8_t)) + \
- DUK_HOBJECT_GET_ASIZE((h)) * sizeof(duk_tval) \
- ))
-#define DUK_HOBJECT_P_COMPUTE_SIZE(n_ent,n_arr,n_hash) \
- ( \
- (n_ent) * (sizeof(duk_hstring *) + sizeof(duk_propvalue) + sizeof(duk_uint8_t)) + \
- (n_arr) * sizeof(duk_tval) + \
- (n_hash) * sizeof(duk_uint32_t) \
- )
-#define DUK_HOBJECT_P_SET_REALLOC_PTRS(p_base,set_e_k,set_e_pv,set_e_f,set_a,set_h,n_ent,n_arr,n_hash) do { \
+#define DUK_HOBJECT_E_GET_KEY_BASE(heap, h) ((duk_hstring **) (void *) (DUK_HOBJECT_GET_PROPS((heap), (h))))
+#define DUK_HOBJECT_E_GET_VALUE_BASE(heap, h) \
+ ((duk_propvalue *) (void *) (DUK_HOBJECT_GET_PROPS((heap), (h)) + DUK_HOBJECT_GET_ESIZE((h)) * sizeof(duk_hstring *)))
+#define DUK_HOBJECT_E_GET_FLAGS_BASE(heap, h) \
+ ((duk_uint8_t *) (void *) (DUK_HOBJECT_GET_PROPS((heap), (h)) + \
+ DUK_HOBJECT_GET_ESIZE((h)) * (sizeof(duk_hstring *) + sizeof(duk_propvalue))))
+#define DUK_HOBJECT_A_GET_BASE(heap, h) \
+ ((duk_tval *) (void *) (DUK_HOBJECT_GET_PROPS((heap), (h)) + \
+ DUK_HOBJECT_GET_ESIZE((h)) * \
+ (sizeof(duk_hstring *) + sizeof(duk_propvalue) + sizeof(duk_uint8_t))))
+#define DUK_HOBJECT_H_GET_BASE(heap, h) \
+ ((duk_uint32_t *) (void *) (DUK_HOBJECT_GET_PROPS((heap), (h)) + \
+ DUK_HOBJECT_GET_ESIZE((h)) * \
+ (sizeof(duk_hstring *) + sizeof(duk_propvalue) + sizeof(duk_uint8_t)) + \
+ DUK_HOBJECT_GET_ASIZE((h)) * sizeof(duk_tval)))
+#define DUK_HOBJECT_P_COMPUTE_SIZE(n_ent, n_arr, n_hash) \
+ ((n_ent) * (sizeof(duk_hstring *) + sizeof(duk_propvalue) + sizeof(duk_uint8_t)) + (n_arr) * sizeof(duk_tval) + \
+ (n_hash) * sizeof(duk_uint32_t))
+#define DUK_HOBJECT_P_SET_REALLOC_PTRS(p_base, set_e_k, set_e_pv, set_e_f, set_a, set_h, n_ent, n_arr, n_hash) \
+ do { \
(set_e_k) = (duk_hstring **) (void *) (p_base); \
(set_e_pv) = (duk_propvalue *) (void *) ((set_e_k) + (n_ent)); \
(set_e_f) = (duk_uint8_t *) (void *) ((set_e_pv) + (n_ent)); \
@@ -6435,85 +6938,57 @@ DUK_INTERNAL_DECL void duk_hobject_assert_valid(duk_hobject *h);
#else
#error invalid DUK_USE_ALIGN_BY
#endif
-#define DUK_HOBJECT_E_GET_KEY_BASE(heap,h) \
- ((duk_hstring **) (void *) ( \
- DUK_HOBJECT_GET_PROPS((heap), (h)) + \
- DUK_HOBJECT_GET_ESIZE((h)) * sizeof(duk_propvalue) \
- ))
-#define DUK_HOBJECT_E_GET_VALUE_BASE(heap,h) \
- ((duk_propvalue *) (void *) ( \
- DUK_HOBJECT_GET_PROPS((heap), (h)) \
- ))
-#define DUK_HOBJECT_E_GET_FLAGS_BASE(heap,h) \
- ((duk_uint8_t *) (void *) ( \
- DUK_HOBJECT_GET_PROPS((heap), (h)) + DUK_HOBJECT_GET_ESIZE((h)) * (sizeof(duk_hstring *) + sizeof(duk_propvalue)) \
- ))
-#define DUK_HOBJECT_A_GET_BASE(heap,h) \
- ((duk_tval *) (void *) ( \
- DUK_HOBJECT_GET_PROPS((heap), (h)) + \
- DUK_HOBJECT_GET_ESIZE((h)) * (sizeof(duk_hstring *) + sizeof(duk_propvalue) + sizeof(duk_uint8_t)) + \
- DUK_HOBJECT_E_FLAG_PADDING(DUK_HOBJECT_GET_ESIZE((h))) \
- ))
-#define DUK_HOBJECT_H_GET_BASE(heap,h) \
- ((duk_uint32_t *) (void *) ( \
- DUK_HOBJECT_GET_PROPS((heap), (h)) + \
- DUK_HOBJECT_GET_ESIZE((h)) * (sizeof(duk_hstring *) + sizeof(duk_propvalue) + sizeof(duk_uint8_t)) + \
- DUK_HOBJECT_E_FLAG_PADDING(DUK_HOBJECT_GET_ESIZE((h))) + \
- DUK_HOBJECT_GET_ASIZE((h)) * sizeof(duk_tval) \
- ))
-#define DUK_HOBJECT_P_COMPUTE_SIZE(n_ent,n_arr,n_hash) \
- ( \
- (n_ent) * (sizeof(duk_hstring *) + sizeof(duk_propvalue) + sizeof(duk_uint8_t)) + \
- DUK_HOBJECT_E_FLAG_PADDING((n_ent)) + \
- (n_arr) * sizeof(duk_tval) + \
- (n_hash) * sizeof(duk_uint32_t) \
- )
-#define DUK_HOBJECT_P_SET_REALLOC_PTRS(p_base,set_e_k,set_e_pv,set_e_f,set_a,set_h,n_ent,n_arr,n_hash) do { \
+#define DUK_HOBJECT_E_GET_KEY_BASE(heap, h) \
+ ((duk_hstring **) (void *) (DUK_HOBJECT_GET_PROPS((heap), (h)) + DUK_HOBJECT_GET_ESIZE((h)) * sizeof(duk_propvalue)))
+#define DUK_HOBJECT_E_GET_VALUE_BASE(heap, h) ((duk_propvalue *) (void *) (DUK_HOBJECT_GET_PROPS((heap), (h))))
+#define DUK_HOBJECT_E_GET_FLAGS_BASE(heap, h) \
+ ((duk_uint8_t *) (void *) (DUK_HOBJECT_GET_PROPS((heap), (h)) + \
+ DUK_HOBJECT_GET_ESIZE((h)) * (sizeof(duk_hstring *) + sizeof(duk_propvalue))))
+#define DUK_HOBJECT_A_GET_BASE(heap, h) \
+ ((duk_tval *) (void *) (DUK_HOBJECT_GET_PROPS((heap), (h)) + \
+ DUK_HOBJECT_GET_ESIZE((h)) * \
+ (sizeof(duk_hstring *) + sizeof(duk_propvalue) + sizeof(duk_uint8_t)) + \
+ DUK_HOBJECT_E_FLAG_PADDING(DUK_HOBJECT_GET_ESIZE((h)))))
+#define DUK_HOBJECT_H_GET_BASE(heap, h) \
+ ((duk_uint32_t *) (void *) (DUK_HOBJECT_GET_PROPS((heap), (h)) + \
+ DUK_HOBJECT_GET_ESIZE((h)) * \
+ (sizeof(duk_hstring *) + sizeof(duk_propvalue) + sizeof(duk_uint8_t)) + \
+ DUK_HOBJECT_E_FLAG_PADDING(DUK_HOBJECT_GET_ESIZE((h))) + \
+ DUK_HOBJECT_GET_ASIZE((h)) * sizeof(duk_tval)))
+#define DUK_HOBJECT_P_COMPUTE_SIZE(n_ent, n_arr, n_hash) \
+ ((n_ent) * (sizeof(duk_hstring *) + sizeof(duk_propvalue) + sizeof(duk_uint8_t)) + DUK_HOBJECT_E_FLAG_PADDING((n_ent)) + \
+ (n_arr) * sizeof(duk_tval) + (n_hash) * sizeof(duk_uint32_t))
+#define DUK_HOBJECT_P_SET_REALLOC_PTRS(p_base, set_e_k, set_e_pv, set_e_f, set_a, set_h, n_ent, n_arr, n_hash) \
+ do { \
(set_e_pv) = (duk_propvalue *) (void *) (p_base); \
(set_e_k) = (duk_hstring **) (void *) ((set_e_pv) + (n_ent)); \
(set_e_f) = (duk_uint8_t *) (void *) ((set_e_k) + (n_ent)); \
- (set_a) = (duk_tval *) (void *) (((duk_uint8_t *) (set_e_f)) + \
- sizeof(duk_uint8_t) * (n_ent) + \
+ (set_a) = (duk_tval *) (void *) (((duk_uint8_t *) (set_e_f)) + sizeof(duk_uint8_t) * (n_ent) + \
DUK_HOBJECT_E_FLAG_PADDING((n_ent))); \
(set_h) = (duk_uint32_t *) (void *) ((set_a) + (n_arr)); \
} while (0)
#elif defined(DUK_USE_HOBJECT_LAYOUT_3)
/* LAYOUT 3 */
-#define DUK_HOBJECT_E_GET_KEY_BASE(heap,h) \
- ((duk_hstring **) (void *) ( \
- DUK_HOBJECT_GET_PROPS((heap), (h)) + \
- DUK_HOBJECT_GET_ESIZE((h)) * sizeof(duk_propvalue) + \
- DUK_HOBJECT_GET_ASIZE((h)) * sizeof(duk_tval) \
- ))
-#define DUK_HOBJECT_E_GET_VALUE_BASE(heap,h) \
- ((duk_propvalue *) (void *) ( \
- DUK_HOBJECT_GET_PROPS((heap), (h)) \
- ))
-#define DUK_HOBJECT_E_GET_FLAGS_BASE(heap,h) \
- ((duk_uint8_t *) (void *) ( \
- DUK_HOBJECT_GET_PROPS((heap), (h)) + \
- DUK_HOBJECT_GET_ESIZE((h)) * (sizeof(duk_propvalue) + sizeof(duk_hstring *)) + \
- DUK_HOBJECT_GET_ASIZE((h)) * sizeof(duk_tval) + \
- DUK_HOBJECT_GET_HSIZE((h)) * sizeof(duk_uint32_t) \
- ))
-#define DUK_HOBJECT_A_GET_BASE(heap,h) \
- ((duk_tval *) (void *) ( \
- DUK_HOBJECT_GET_PROPS((heap), (h)) + \
- DUK_HOBJECT_GET_ESIZE((h)) * sizeof(duk_propvalue) \
- ))
-#define DUK_HOBJECT_H_GET_BASE(heap,h) \
- ((duk_uint32_t *) (void *) ( \
- DUK_HOBJECT_GET_PROPS((heap), (h)) + \
- DUK_HOBJECT_GET_ESIZE((h)) * (sizeof(duk_propvalue) + sizeof(duk_hstring *)) + \
- DUK_HOBJECT_GET_ASIZE((h)) * sizeof(duk_tval) \
- ))
-#define DUK_HOBJECT_P_COMPUTE_SIZE(n_ent,n_arr,n_hash) \
- ( \
- (n_ent) * (sizeof(duk_propvalue) + sizeof(duk_hstring *) + sizeof(duk_uint8_t)) + \
- (n_arr) * sizeof(duk_tval) + \
- (n_hash) * sizeof(duk_uint32_t) \
- )
-#define DUK_HOBJECT_P_SET_REALLOC_PTRS(p_base,set_e_k,set_e_pv,set_e_f,set_a,set_h,n_ent,n_arr,n_hash) do { \
+#define DUK_HOBJECT_E_GET_KEY_BASE(heap, h) \
+ ((duk_hstring **) (void *) (DUK_HOBJECT_GET_PROPS((heap), (h)) + DUK_HOBJECT_GET_ESIZE((h)) * sizeof(duk_propvalue) + \
+ DUK_HOBJECT_GET_ASIZE((h)) * sizeof(duk_tval)))
+#define DUK_HOBJECT_E_GET_VALUE_BASE(heap, h) ((duk_propvalue *) (void *) (DUK_HOBJECT_GET_PROPS((heap), (h))))
+#define DUK_HOBJECT_E_GET_FLAGS_BASE(heap, h) \
+ ((duk_uint8_t *) (void *) (DUK_HOBJECT_GET_PROPS((heap), (h)) + \
+ DUK_HOBJECT_GET_ESIZE((h)) * (sizeof(duk_propvalue) + sizeof(duk_hstring *)) + \
+ DUK_HOBJECT_GET_ASIZE((h)) * sizeof(duk_tval) + \
+ DUK_HOBJECT_GET_HSIZE((h)) * sizeof(duk_uint32_t)))
+#define DUK_HOBJECT_A_GET_BASE(heap, h) \
+ ((duk_tval *) (void *) (DUK_HOBJECT_GET_PROPS((heap), (h)) + DUK_HOBJECT_GET_ESIZE((h)) * sizeof(duk_propvalue)))
+#define DUK_HOBJECT_H_GET_BASE(heap, h) \
+ ((duk_uint32_t *) (void *) (DUK_HOBJECT_GET_PROPS((heap), (h)) + \
+ DUK_HOBJECT_GET_ESIZE((h)) * (sizeof(duk_propvalue) + sizeof(duk_hstring *)) + \
+ DUK_HOBJECT_GET_ASIZE((h)) * sizeof(duk_tval)))
+#define DUK_HOBJECT_P_COMPUTE_SIZE(n_ent, n_arr, n_hash) \
+ ((n_ent) * (sizeof(duk_propvalue) + sizeof(duk_hstring *) + sizeof(duk_uint8_t)) + (n_arr) * sizeof(duk_tval) + \
+ (n_hash) * sizeof(duk_uint32_t))
+#define DUK_HOBJECT_P_SET_REALLOC_PTRS(p_base, set_e_k, set_e_pv, set_e_f, set_a, set_h, n_ent, n_arr, n_hash) \
+ do { \
(set_e_pv) = (duk_propvalue *) (void *) (p_base); \
(set_a) = (duk_tval *) (void *) ((set_e_pv) + (n_ent)); \
(set_e_k) = (duk_hstring **) (void *) ((set_a) + (n_arr)); \
@@ -6522,85 +6997,99 @@ DUK_INTERNAL_DECL void duk_hobject_assert_valid(duk_hobject *h);
} while (0)
#else
#error invalid hobject layout defines
-#endif /* hobject property layout */
+#endif /* hobject property layout */
#define DUK_HOBJECT_P_ALLOC_SIZE(h) \
DUK_HOBJECT_P_COMPUTE_SIZE(DUK_HOBJECT_GET_ESIZE((h)), DUK_HOBJECT_GET_ASIZE((h)), DUK_HOBJECT_GET_HSIZE((h)))
-#define DUK_HOBJECT_E_GET_KEY(heap,h,i) (DUK_HOBJECT_E_GET_KEY_BASE((heap), (h))[(i)])
-#define DUK_HOBJECT_E_GET_KEY_PTR(heap,h,i) (&DUK_HOBJECT_E_GET_KEY_BASE((heap), (h))[(i)])
-#define DUK_HOBJECT_E_GET_VALUE(heap,h,i) (DUK_HOBJECT_E_GET_VALUE_BASE((heap), (h))[(i)])
-#define DUK_HOBJECT_E_GET_VALUE_PTR(heap,h,i) (&DUK_HOBJECT_E_GET_VALUE_BASE((heap), (h))[(i)])
-#define DUK_HOBJECT_E_GET_VALUE_TVAL(heap,h,i) (DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).v)
-#define DUK_HOBJECT_E_GET_VALUE_TVAL_PTR(heap,h,i) (&DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).v)
-#define DUK_HOBJECT_E_GET_VALUE_GETTER(heap,h,i) (DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).a.get)
-#define DUK_HOBJECT_E_GET_VALUE_GETTER_PTR(heap,h,i) (&DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).a.get)
-#define DUK_HOBJECT_E_GET_VALUE_SETTER(heap,h,i) (DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).a.set)
-#define DUK_HOBJECT_E_GET_VALUE_SETTER_PTR(heap,h,i) (&DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).a.set)
-#define DUK_HOBJECT_E_GET_FLAGS(heap,h,i) (DUK_HOBJECT_E_GET_FLAGS_BASE((heap), (h))[(i)])
-#define DUK_HOBJECT_E_GET_FLAGS_PTR(heap,h,i) (&DUK_HOBJECT_E_GET_FLAGS_BASE((heap), (h))[(i)])
-#define DUK_HOBJECT_A_GET_VALUE(heap,h,i) (DUK_HOBJECT_A_GET_BASE((heap), (h))[(i)])
-#define DUK_HOBJECT_A_GET_VALUE_PTR(heap,h,i) (&DUK_HOBJECT_A_GET_BASE((heap), (h))[(i)])
-#define DUK_HOBJECT_H_GET_INDEX(heap,h,i) (DUK_HOBJECT_H_GET_BASE((heap), (h))[(i)])
-#define DUK_HOBJECT_H_GET_INDEX_PTR(heap,h,i) (&DUK_HOBJECT_H_GET_BASE((heap), (h))[(i)])
-
-#define DUK_HOBJECT_E_SET_KEY(heap,h,i,k) do { \
+#define DUK_HOBJECT_E_GET_KEY(heap, h, i) (DUK_HOBJECT_E_GET_KEY_BASE((heap), (h))[(i)])
+#define DUK_HOBJECT_E_GET_KEY_PTR(heap, h, i) (&DUK_HOBJECT_E_GET_KEY_BASE((heap), (h))[(i)])
+#define DUK_HOBJECT_E_GET_VALUE(heap, h, i) (DUK_HOBJECT_E_GET_VALUE_BASE((heap), (h))[(i)])
+#define DUK_HOBJECT_E_GET_VALUE_PTR(heap, h, i) (&DUK_HOBJECT_E_GET_VALUE_BASE((heap), (h))[(i)])
+#define DUK_HOBJECT_E_GET_VALUE_TVAL(heap, h, i) (DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).v)
+#define DUK_HOBJECT_E_GET_VALUE_TVAL_PTR(heap, h, i) (&DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).v)
+#define DUK_HOBJECT_E_GET_VALUE_GETTER(heap, h, i) (DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).a.get)
+#define DUK_HOBJECT_E_GET_VALUE_GETTER_PTR(heap, h, i) (&DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).a.get)
+#define DUK_HOBJECT_E_GET_VALUE_SETTER(heap, h, i) (DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).a.set)
+#define DUK_HOBJECT_E_GET_VALUE_SETTER_PTR(heap, h, i) (&DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).a.set)
+#define DUK_HOBJECT_E_GET_FLAGS(heap, h, i) (DUK_HOBJECT_E_GET_FLAGS_BASE((heap), (h))[(i)])
+#define DUK_HOBJECT_E_GET_FLAGS_PTR(heap, h, i) (&DUK_HOBJECT_E_GET_FLAGS_BASE((heap), (h))[(i)])
+#define DUK_HOBJECT_A_GET_VALUE(heap, h, i) (DUK_HOBJECT_A_GET_BASE((heap), (h))[(i)])
+#define DUK_HOBJECT_A_GET_VALUE_PTR(heap, h, i) (&DUK_HOBJECT_A_GET_BASE((heap), (h))[(i)])
+#define DUK_HOBJECT_H_GET_INDEX(heap, h, i) (DUK_HOBJECT_H_GET_BASE((heap), (h))[(i)])
+#define DUK_HOBJECT_H_GET_INDEX_PTR(heap, h, i) (&DUK_HOBJECT_H_GET_BASE((heap), (h))[(i)])
+
+#define DUK_HOBJECT_E_SET_KEY(heap, h, i, k) \
+ do { \
DUK_HOBJECT_E_GET_KEY((heap), (h), (i)) = (k); \
} while (0)
-#define DUK_HOBJECT_E_SET_VALUE(heap,h,i,v) do { \
+#define DUK_HOBJECT_E_SET_VALUE(heap, h, i, v) \
+ do { \
DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)) = (v); \
} while (0)
-#define DUK_HOBJECT_E_SET_VALUE_TVAL(heap,h,i,v) do { \
+#define DUK_HOBJECT_E_SET_VALUE_TVAL(heap, h, i, v) \
+ do { \
DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).v = (v); \
} while (0)
-#define DUK_HOBJECT_E_SET_VALUE_GETTER(heap,h,i,v) do { \
+#define DUK_HOBJECT_E_SET_VALUE_GETTER(heap, h, i, v) \
+ do { \
DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).a.get = (v); \
} while (0)
-#define DUK_HOBJECT_E_SET_VALUE_SETTER(heap,h,i,v) do { \
+#define DUK_HOBJECT_E_SET_VALUE_SETTER(heap, h, i, v) \
+ do { \
DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).a.set = (v); \
} while (0)
-#define DUK_HOBJECT_E_SET_FLAGS(heap,h,i,f) do { \
+#define DUK_HOBJECT_E_SET_FLAGS(heap, h, i, f) \
+ do { \
DUK_HOBJECT_E_GET_FLAGS((heap), (h), (i)) = (duk_uint8_t) (f); \
} while (0)
-#define DUK_HOBJECT_A_SET_VALUE(heap,h,i,v) do { \
+#define DUK_HOBJECT_A_SET_VALUE(heap, h, i, v) \
+ do { \
DUK_HOBJECT_A_GET_VALUE((heap), (h), (i)) = (v); \
} while (0)
-#define DUK_HOBJECT_A_SET_VALUE_TVAL(heap,h,i,v) \
- DUK_HOBJECT_A_SET_VALUE((heap), (h), (i), (v)) /* alias for above */
-#define DUK_HOBJECT_H_SET_INDEX(heap,h,i,v) do { \
+#define DUK_HOBJECT_A_SET_VALUE_TVAL(heap, h, i, v) DUK_HOBJECT_A_SET_VALUE((heap), (h), (i), (v)) /* alias for above */
+#define DUK_HOBJECT_H_SET_INDEX(heap, h, i, v) \
+ do { \
DUK_HOBJECT_H_GET_INDEX((heap), (h), (i)) = (v); \
} while (0)
-#define DUK_HOBJECT_E_SET_FLAG_BITS(heap,h,i,mask) do { \
+#define DUK_HOBJECT_E_SET_FLAG_BITS(heap, h, i, mask) \
+ do { \
DUK_HOBJECT_E_GET_FLAGS_BASE((heap), (h))[(i)] |= (mask); \
} while (0)
-#define DUK_HOBJECT_E_CLEAR_FLAG_BITS(heap,h,i,mask) do { \
+#define DUK_HOBJECT_E_CLEAR_FLAG_BITS(heap, h, i, mask) \
+ do { \
DUK_HOBJECT_E_GET_FLAGS_BASE((heap), (h))[(i)] &= ~(mask); \
} while (0)
-#define DUK_HOBJECT_E_SLOT_IS_WRITABLE(heap,h,i) ((DUK_HOBJECT_E_GET_FLAGS((heap), (h), (i)) & DUK_PROPDESC_FLAG_WRITABLE) != 0)
-#define DUK_HOBJECT_E_SLOT_IS_ENUMERABLE(heap,h,i) ((DUK_HOBJECT_E_GET_FLAGS((heap), (h), (i)) & DUK_PROPDESC_FLAG_ENUMERABLE) != 0)
-#define DUK_HOBJECT_E_SLOT_IS_CONFIGURABLE(heap,h,i) ((DUK_HOBJECT_E_GET_FLAGS((heap), (h), (i)) & DUK_PROPDESC_FLAG_CONFIGURABLE) != 0)
-#define DUK_HOBJECT_E_SLOT_IS_ACCESSOR(heap,h,i) ((DUK_HOBJECT_E_GET_FLAGS((heap), (h), (i)) & DUK_PROPDESC_FLAG_ACCESSOR) != 0)
+#define DUK_HOBJECT_E_SLOT_IS_WRITABLE(heap, h, i) ((DUK_HOBJECT_E_GET_FLAGS((heap), (h), (i)) & DUK_PROPDESC_FLAG_WRITABLE) != 0)
+#define DUK_HOBJECT_E_SLOT_IS_ENUMERABLE(heap, h, i) \
+ ((DUK_HOBJECT_E_GET_FLAGS((heap), (h), (i)) & DUK_PROPDESC_FLAG_ENUMERABLE) != 0)
+#define DUK_HOBJECT_E_SLOT_IS_CONFIGURABLE(heap, h, i) \
+ ((DUK_HOBJECT_E_GET_FLAGS((heap), (h), (i)) & DUK_PROPDESC_FLAG_CONFIGURABLE) != 0)
+#define DUK_HOBJECT_E_SLOT_IS_ACCESSOR(heap, h, i) ((DUK_HOBJECT_E_GET_FLAGS((heap), (h), (i)) & DUK_PROPDESC_FLAG_ACCESSOR) != 0)
-#define DUK_HOBJECT_E_SLOT_SET_WRITABLE(heap,h,i) DUK_HOBJECT_E_SET_FLAG_BITS((heap), (h), (i),DUK_PROPDESC_FLAG_WRITABLE)
-#define DUK_HOBJECT_E_SLOT_SET_ENUMERABLE(heap,h,i) DUK_HOBJECT_E_SET_FLAG_BITS((heap), (h), (i),DUK_PROPDESC_FLAG_ENUMERABLE)
-#define DUK_HOBJECT_E_SLOT_SET_CONFIGURABLE(heap,h,i) DUK_HOBJECT_E_SET_FLAG_BITS((heap), (h), (i),DUK_PROPDESC_FLAG_CONFIGURABLE)
-#define DUK_HOBJECT_E_SLOT_SET_ACCESSOR(heap,h,i) DUK_HOBJECT_E_SET_FLAG_BITS((heap), (h), (i),DUK_PROPDESC_FLAG_ACCESSOR)
+#define DUK_HOBJECT_E_SLOT_SET_WRITABLE(heap, h, i) DUK_HOBJECT_E_SET_FLAG_BITS((heap), (h), (i), DUK_PROPDESC_FLAG_WRITABLE)
+#define DUK_HOBJECT_E_SLOT_SET_ENUMERABLE(heap, h, i) DUK_HOBJECT_E_SET_FLAG_BITS((heap), (h), (i), DUK_PROPDESC_FLAG_ENUMERABLE)
+#define DUK_HOBJECT_E_SLOT_SET_CONFIGURABLE(heap, h, i) \
+ DUK_HOBJECT_E_SET_FLAG_BITS((heap), (h), (i), DUK_PROPDESC_FLAG_CONFIGURABLE)
+#define DUK_HOBJECT_E_SLOT_SET_ACCESSOR(heap, h, i) DUK_HOBJECT_E_SET_FLAG_BITS((heap), (h), (i), DUK_PROPDESC_FLAG_ACCESSOR)
-#define DUK_HOBJECT_E_SLOT_CLEAR_WRITABLE(heap,h,i) DUK_HOBJECT_E_CLEAR_FLAG_BITS((heap), (h), (i),DUK_PROPDESC_FLAG_WRITABLE)
-#define DUK_HOBJECT_E_SLOT_CLEAR_ENUMERABLE(heap,h,i) DUK_HOBJECT_E_CLEAR_FLAG_BITS((heap), (h), (i),DUK_PROPDESC_FLAG_ENUMERABLE)
-#define DUK_HOBJECT_E_SLOT_CLEAR_CONFIGURABLE(heap,h,i) DUK_HOBJECT_E_CLEAR_FLAG_BITS((heap), (h), (i),DUK_PROPDESC_FLAG_CONFIGURABLE)
-#define DUK_HOBJECT_E_SLOT_CLEAR_ACCESSOR(heap,h,i) DUK_HOBJECT_E_CLEAR_FLAG_BITS((heap), (h), (i),DUK_PROPDESC_FLAG_ACCESSOR)
+#define DUK_HOBJECT_E_SLOT_CLEAR_WRITABLE(heap, h, i) DUK_HOBJECT_E_CLEAR_FLAG_BITS((heap), (h), (i), DUK_PROPDESC_FLAG_WRITABLE)
+#define DUK_HOBJECT_E_SLOT_CLEAR_ENUMERABLE(heap, h, i) \
+ DUK_HOBJECT_E_CLEAR_FLAG_BITS((heap), (h), (i), DUK_PROPDESC_FLAG_ENUMERABLE)
+#define DUK_HOBJECT_E_SLOT_CLEAR_CONFIGURABLE(heap, h, i) \
+ DUK_HOBJECT_E_CLEAR_FLAG_BITS((heap), (h), (i), DUK_PROPDESC_FLAG_CONFIGURABLE)
+#define DUK_HOBJECT_E_SLOT_CLEAR_ACCESSOR(heap, h, i) DUK_HOBJECT_E_CLEAR_FLAG_BITS((heap), (h), (i), DUK_PROPDESC_FLAG_ACCESSOR)
-#define DUK_PROPDESC_IS_WRITABLE(p) (((p)->flags & DUK_PROPDESC_FLAG_WRITABLE) != 0)
-#define DUK_PROPDESC_IS_ENUMERABLE(p) (((p)->flags & DUK_PROPDESC_FLAG_ENUMERABLE) != 0)
-#define DUK_PROPDESC_IS_CONFIGURABLE(p) (((p)->flags & DUK_PROPDESC_FLAG_CONFIGURABLE) != 0)
-#define DUK_PROPDESC_IS_ACCESSOR(p) (((p)->flags & DUK_PROPDESC_FLAG_ACCESSOR) != 0)
+#define DUK_PROPDESC_IS_WRITABLE(p) (((p)->flags & DUK_PROPDESC_FLAG_WRITABLE) != 0)
+#define DUK_PROPDESC_IS_ENUMERABLE(p) (((p)->flags & DUK_PROPDESC_FLAG_ENUMERABLE) != 0)
+#define DUK_PROPDESC_IS_CONFIGURABLE(p) (((p)->flags & DUK_PROPDESC_FLAG_CONFIGURABLE) != 0)
+#define DUK_PROPDESC_IS_ACCESSOR(p) (((p)->flags & DUK_PROPDESC_FLAG_ACCESSOR) != 0)
-#define DUK_HOBJECT_HASHIDX_UNUSED 0xffffffffUL
-#define DUK_HOBJECT_HASHIDX_DELETED 0xfffffffeUL
+#define DUK_HOBJECT_HASHIDX_UNUSED 0xffffffffUL
+#define DUK_HOBJECT_HASHIDX_DELETED 0xfffffffeUL
/*
* Macros for accessing size fields
@@ -6608,33 +7097,63 @@ DUK_INTERNAL_DECL void duk_hobject_assert_valid(duk_hobject *h);
#if defined(DUK_USE_OBJSIZES16)
#define DUK_HOBJECT_GET_ESIZE(h) ((h)->e_size16)
-#define DUK_HOBJECT_SET_ESIZE(h,v) do { (h)->e_size16 = (v); } while (0)
+#define DUK_HOBJECT_SET_ESIZE(h, v) \
+ do { \
+ (h)->e_size16 = (v); \
+ } while (0)
#define DUK_HOBJECT_GET_ENEXT(h) ((h)->e_next16)
-#define DUK_HOBJECT_SET_ENEXT(h,v) do { (h)->e_next16 = (v); } while (0)
+#define DUK_HOBJECT_SET_ENEXT(h, v) \
+ do { \
+ (h)->e_next16 = (v); \
+ } while (0)
#define DUK_HOBJECT_POSTINC_ENEXT(h) ((h)->e_next16++)
-#define DUK_HOBJECT_GET_ASIZE(h) ((h)->a_size16)
-#define DUK_HOBJECT_SET_ASIZE(h,v) do { (h)->a_size16 = (v); } while (0)
+#define DUK_HOBJECT_GET_ASIZE(h) ((h)->a_size16)
+#define DUK_HOBJECT_SET_ASIZE(h, v) \
+ do { \
+ (h)->a_size16 = (v); \
+ } while (0)
#if defined(DUK_USE_HOBJECT_HASH_PART)
#define DUK_HOBJECT_GET_HSIZE(h) ((h)->h_size16)
-#define DUK_HOBJECT_SET_HSIZE(h,v) do { (h)->h_size16 = (v); } while (0)
+#define DUK_HOBJECT_SET_HSIZE(h, v) \
+ do { \
+ (h)->h_size16 = (v); \
+ } while (0)
#else
#define DUK_HOBJECT_GET_HSIZE(h) 0
-#define DUK_HOBJECT_SET_HSIZE(h,v) do { DUK_ASSERT((v) == 0); } while (0)
+#define DUK_HOBJECT_SET_HSIZE(h, v) \
+ do { \
+ DUK_ASSERT((v) == 0); \
+ } while (0)
#endif
#else
#define DUK_HOBJECT_GET_ESIZE(h) ((h)->e_size)
-#define DUK_HOBJECT_SET_ESIZE(h,v) do { (h)->e_size = (v); } while (0)
+#define DUK_HOBJECT_SET_ESIZE(h, v) \
+ do { \
+ (h)->e_size = (v); \
+ } while (0)
#define DUK_HOBJECT_GET_ENEXT(h) ((h)->e_next)
-#define DUK_HOBJECT_SET_ENEXT(h,v) do { (h)->e_next = (v); } while (0)
+#define DUK_HOBJECT_SET_ENEXT(h, v) \
+ do { \
+ (h)->e_next = (v); \
+ } while (0)
#define DUK_HOBJECT_POSTINC_ENEXT(h) ((h)->e_next++)
-#define DUK_HOBJECT_GET_ASIZE(h) ((h)->a_size)
-#define DUK_HOBJECT_SET_ASIZE(h,v) do { (h)->a_size = (v); } while (0)
+#define DUK_HOBJECT_GET_ASIZE(h) ((h)->a_size)
+#define DUK_HOBJECT_SET_ASIZE(h, v) \
+ do { \
+ (h)->a_size = (v); \
+ } while (0)
#if defined(DUK_USE_HOBJECT_HASH_PART)
#define DUK_HOBJECT_GET_HSIZE(h) ((h)->h_size)
-#define DUK_HOBJECT_SET_HSIZE(h,v) do { (h)->h_size = (v); } while (0)
+#define DUK_HOBJECT_SET_HSIZE(h, v) \
+ do { \
+ (h)->h_size = (v); \
+ } while (0)
#else
#define DUK_HOBJECT_GET_HSIZE(h) 0
-#define DUK_HOBJECT_SET_HSIZE(h,v) do { DUK_ASSERT((v) == 0); } while (0)
+#define DUK_HOBJECT_SET_HSIZE(h, v) \
+ do { \
+ DUK_ASSERT((v) == 0); \
+ } while (0)
#endif
#endif
@@ -6645,46 +7164,44 @@ DUK_INTERNAL_DECL void duk_hobject_assert_valid(duk_hobject *h);
/* Maximum prototype traversal depth. Sanity limit which handles e.g.
* prototype loops (even complex ones like 1->2->3->4->2->3->4->2->3->4).
*/
-#define DUK_HOBJECT_PROTOTYPE_CHAIN_SANITY 10000L
+#define DUK_HOBJECT_PROTOTYPE_CHAIN_SANITY 10000L
/*
* ECMAScript [[Class]]
*/
/* range check not necessary because all 4-bit values are mapped */
-#define DUK_HOBJECT_CLASS_NUMBER_TO_STRIDX(n) duk_class_number_to_stridx[(n)]
+#define DUK_HOBJECT_CLASS_NUMBER_TO_STRIDX(n) duk_class_number_to_stridx[(n)]
-#define DUK_HOBJECT_GET_CLASS_STRING(heap,h) \
- DUK_HEAP_GET_STRING( \
- (heap), \
- DUK_HOBJECT_CLASS_NUMBER_TO_STRIDX(DUK_HOBJECT_GET_CLASS_NUMBER((h))) \
- )
+#define DUK_HOBJECT_GET_CLASS_STRING(heap, h) \
+ DUK_HEAP_GET_STRING((heap), DUK_HOBJECT_CLASS_NUMBER_TO_STRIDX(DUK_HOBJECT_GET_CLASS_NUMBER((h))))
/*
* Macros for property handling
*/
#if defined(DUK_USE_HEAPPTR16)
-#define DUK_HOBJECT_GET_PROTOTYPE(heap,h) \
- ((duk_hobject *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->prototype16))
-#define DUK_HOBJECT_SET_PROTOTYPE(heap,h,x) do { \
+#define DUK_HOBJECT_GET_PROTOTYPE(heap, h) ((duk_hobject *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->prototype16))
+#define DUK_HOBJECT_SET_PROTOTYPE(heap, h, x) \
+ do { \
(h)->prototype16 = DUK_USE_HEAPPTR_ENC16((heap)->heap_udata, (void *) (x)); \
} while (0)
#else
-#define DUK_HOBJECT_GET_PROTOTYPE(heap,h) \
- ((h)->prototype)
-#define DUK_HOBJECT_SET_PROTOTYPE(heap,h,x) do { \
+#define DUK_HOBJECT_GET_PROTOTYPE(heap, h) ((h)->prototype)
+#define DUK_HOBJECT_SET_PROTOTYPE(heap, h, x) \
+ do { \
(h)->prototype = (x); \
} while (0)
#endif
/* Set prototype, DECREF earlier value, INCREF new value (tolerating NULLs). */
-#define DUK_HOBJECT_SET_PROTOTYPE_UPDREF(thr,h,p) duk_hobject_set_prototype_updref((thr), (h), (p))
+#define DUK_HOBJECT_SET_PROTOTYPE_UPDREF(thr, h, p) duk_hobject_set_prototype_updref((thr), (h), (p))
/* Set initial prototype, assume NULL previous prototype, INCREF new value,
* tolerate NULL.
*/
-#define DUK_HOBJECT_SET_PROTOTYPE_INIT_INCREF(thr,h,proto) do { \
+#define DUK_HOBJECT_SET_PROTOTYPE_INIT_INCREF(thr, h, proto) \
+ do { \
duk_hthread *duk__thr = (thr); \
duk_hobject *duk__obj = (h); \
duk_hobject *duk__proto = (proto); \
@@ -6699,9 +7216,9 @@ DUK_INTERNAL_DECL void duk_hobject_assert_valid(duk_hobject *h);
*/
#if defined(DUK_USE_HEAPPTR16)
-#define DUK_HOBJECT_HAS_FINALIZER_FAST(heap,h) duk_hobject_has_finalizer_fast_raw((heap), (h))
+#define DUK_HOBJECT_HAS_FINALIZER_FAST(heap, h) duk_hobject_has_finalizer_fast_raw((heap), (h))
#else
-#define DUK_HOBJECT_HAS_FINALIZER_FAST(heap,h) duk_hobject_has_finalizer_fast_raw((h))
+#define DUK_HOBJECT_HAS_FINALIZER_FAST(heap, h) duk_hobject_has_finalizer_fast_raw((h))
#endif
/*
@@ -6715,18 +7232,18 @@ DUK_INTERNAL_DECL void duk_hobject_assert_valid(duk_hobject *h);
* so anything above 0x80000000 will cause trouble now.
*/
#if defined(DUK_USE_OBJSIZES16)
-#define DUK_HOBJECT_MAX_PROPERTIES 0x0000ffffUL
+#define DUK_HOBJECT_MAX_PROPERTIES 0x0000ffffUL
#else
-#define DUK_HOBJECT_MAX_PROPERTIES 0x3fffffffUL /* 2**30-1 ~= 1G properties */
+#define DUK_HOBJECT_MAX_PROPERTIES 0x3fffffffUL /* 2**30-1 ~= 1G properties */
#endif
/* internal align target for props allocation, must be 2*n for some n */
#if (DUK_USE_ALIGN_BY == 4)
-#define DUK_HOBJECT_ALIGN_TARGET 4
+#define DUK_HOBJECT_ALIGN_TARGET 4
#elif (DUK_USE_ALIGN_BY == 8)
-#define DUK_HOBJECT_ALIGN_TARGET 8
+#define DUK_HOBJECT_ALIGN_TARGET 8
#elif (DUK_USE_ALIGN_BY == 1)
-#define DUK_HOBJECT_ALIGN_TARGET 1
+#define DUK_HOBJECT_ALIGN_TARGET 1
#else
#error invalid DUK_USE_ALIGN_BY
#endif
@@ -6735,10 +7252,10 @@ DUK_INTERNAL_DECL void duk_hobject_assert_valid(duk_hobject *h);
* PC-to-line constants
*/
-#define DUK_PC2LINE_SKIP 64
+#define DUK_PC2LINE_SKIP 64
/* maximum length for a SKIP-1 diffstream: 35 bits per entry, rounded up to bytes */
-#define DUK_PC2LINE_MAX_DIFF_LENGTH (((DUK_PC2LINE_SKIP - 1) * 35 + 7) / 8)
+#define DUK_PC2LINE_MAX_DIFF_LENGTH (((DUK_PC2LINE_SKIP - 1) * 35 + 7) / 8)
/*
* Struct defs
@@ -6765,9 +7282,9 @@ struct duk_propdesc {
duk_hobject *set;
/* for updating (all are set to < 0 for virtual properties) */
- duk_int_t e_idx; /* prop index in 'entry part', < 0 if not there */
- duk_int_t h_idx; /* prop index in 'hash part', < 0 if not there */
- duk_int_t a_idx; /* prop index in 'array part', < 0 if not there */
+ duk_int_t e_idx; /* prop index in 'entry part', < 0 if not there */
+ duk_int_t h_idx; /* prop index in 'hash part', < 0 if not there */
+ duk_int_t a_idx; /* prop index in 'array part', < 0 if not there */
};
struct duk_hobject {
@@ -6862,11 +7379,11 @@ struct duk_hobject {
duk_uint16_t h_size16;
#endif
#else
- duk_uint32_t e_size; /* entry part size */
- duk_uint32_t e_next; /* index for next new key ([0,e_next[ are gc reachable) */
- duk_uint32_t a_size; /* array part size (entirely gc reachable) */
+ duk_uint32_t e_size; /* entry part size */
+ duk_uint32_t e_next; /* index for next new key ([0,e_next[ are gc reachable) */
+ duk_uint32_t a_size; /* array part size (entirely gc reachable) */
#if defined(DUK_USE_HOBJECT_HASH_PART)
- duk_uint32_t h_size; /* hash part size or 0 if unused */
+ duk_uint32_t h_size; /* hash part size or 0 if unused */
#endif
#endif
};
@@ -6877,7 +7394,7 @@ struct duk_hobject {
#if !defined(DUK_SINGLE_FILE)
DUK_INTERNAL_DECL duk_uint8_t duk_class_number_to_stridx[32];
-#endif /* !DUK_SINGLE_FILE */
+#endif /* !DUK_SINGLE_FILE */
/*
* Prototypes
@@ -6906,36 +7423,46 @@ DUK_INTERNAL_DECL void duk_hobject_realloc_props(duk_hthread *thr,
duk_uint32_t new_a_size,
duk_uint32_t new_h_size,
duk_bool_t abandon_array);
-DUK_INTERNAL_DECL void duk_hobject_resize_entrypart(duk_hthread *thr,
- duk_hobject *obj,
- duk_uint32_t new_e_size);
-#if 0 /*unused*/
+DUK_INTERNAL_DECL void duk_hobject_resize_entrypart(duk_hthread *thr, duk_hobject *obj, duk_uint32_t new_e_size);
+#if 0 /*unused*/
DUK_INTERNAL_DECL void duk_hobject_resize_arraypart(duk_hthread *thr,
duk_hobject *obj,
duk_uint32_t new_a_size);
#endif
/* low-level property functions */
-DUK_INTERNAL_DECL duk_bool_t duk_hobject_find_entry(duk_heap *heap, duk_hobject *obj, duk_hstring *key, duk_int_t *e_idx, duk_int_t *h_idx);
+DUK_INTERNAL_DECL duk_bool_t
+duk_hobject_find_entry(duk_heap *heap, duk_hobject *obj, duk_hstring *key, duk_int_t *e_idx, duk_int_t *h_idx);
DUK_INTERNAL_DECL duk_tval *duk_hobject_find_entry_tval_ptr(duk_heap *heap, duk_hobject *obj, duk_hstring *key);
DUK_INTERNAL_DECL duk_tval *duk_hobject_find_entry_tval_ptr_stridx(duk_heap *heap, duk_hobject *obj, duk_small_uint_t stridx);
-DUK_INTERNAL_DECL duk_tval *duk_hobject_find_entry_tval_ptr_and_attrs(duk_heap *heap, duk_hobject *obj, duk_hstring *key, duk_uint_t *out_attrs);
+DUK_INTERNAL_DECL duk_tval *duk_hobject_find_entry_tval_ptr_and_attrs(duk_heap *heap,
+ duk_hobject *obj,
+ duk_hstring *key,
+ duk_uint_t *out_attrs);
DUK_INTERNAL_DECL duk_tval *duk_hobject_find_array_entry_tval_ptr(duk_heap *heap, duk_hobject *obj, duk_uarridx_t i);
-DUK_INTERNAL_DECL duk_bool_t duk_hobject_get_own_propdesc(duk_hthread *thr, duk_hobject *obj, duk_hstring *key, duk_propdesc *out_desc, duk_small_uint_t flags);
+DUK_INTERNAL_DECL duk_bool_t
+duk_hobject_get_own_propdesc(duk_hthread *thr, duk_hobject *obj, duk_hstring *key, duk_propdesc *out_desc, duk_small_uint_t flags);
/* core property functions */
DUK_INTERNAL_DECL duk_bool_t duk_hobject_getprop(duk_hthread *thr, duk_tval *tv_obj, duk_tval *tv_key);
-DUK_INTERNAL_DECL duk_bool_t duk_hobject_putprop(duk_hthread *thr, duk_tval *tv_obj, duk_tval *tv_key, duk_tval *tv_val, duk_bool_t throw_flag);
+DUK_INTERNAL_DECL duk_bool_t
+duk_hobject_putprop(duk_hthread *thr, duk_tval *tv_obj, duk_tval *tv_key, duk_tval *tv_val, duk_bool_t throw_flag);
DUK_INTERNAL_DECL duk_bool_t duk_hobject_delprop(duk_hthread *thr, duk_tval *tv_obj, duk_tval *tv_key, duk_bool_t throw_flag);
DUK_INTERNAL_DECL duk_bool_t duk_hobject_hasprop(duk_hthread *thr, duk_tval *tv_obj, duk_tval *tv_key);
/* internal property functions */
-#define DUK_DELPROP_FLAG_THROW (1U << 0)
-#define DUK_DELPROP_FLAG_FORCE (1U << 1)
+#define DUK_DELPROP_FLAG_THROW (1U << 0)
+#define DUK_DELPROP_FLAG_FORCE (1U << 1)
DUK_INTERNAL_DECL duk_bool_t duk_hobject_delprop_raw(duk_hthread *thr, duk_hobject *obj, duk_hstring *key, duk_small_uint_t flags);
DUK_INTERNAL_DECL duk_bool_t duk_hobject_hasprop_raw(duk_hthread *thr, duk_hobject *obj, duk_hstring *key);
-DUK_INTERNAL_DECL void duk_hobject_define_property_internal(duk_hthread *thr, duk_hobject *obj, duk_hstring *key, duk_small_uint_t flags);
-DUK_INTERNAL_DECL void duk_hobject_define_property_internal_arridx(duk_hthread *thr, duk_hobject *obj, duk_uarridx_t arr_idx, duk_small_uint_t flags);
+DUK_INTERNAL_DECL void duk_hobject_define_property_internal(duk_hthread *thr,
+ duk_hobject *obj,
+ duk_hstring *key,
+ duk_small_uint_t flags);
+DUK_INTERNAL_DECL void duk_hobject_define_property_internal_arridx(duk_hthread *thr,
+ duk_hobject *obj,
+ duk_uarridx_t arr_idx,
+ duk_small_uint_t flags);
DUK_INTERNAL_DECL duk_size_t duk_hobject_get_length(duk_hthread *thr, duk_hobject *obj);
#if defined(DUK_USE_HEAPPTR16)
DUK_INTERNAL_DECL duk_bool_t duk_hobject_has_finalizer_fast_raw(duk_heap *heap, duk_hobject *obj);
@@ -6995,7 +7522,10 @@ DUK_INTERNAL_DECL duk_uint_fast32_t duk_hobject_pc2line_query(duk_hthread *thr,
#endif
/* misc */
-DUK_INTERNAL_DECL duk_bool_t duk_hobject_prototype_chain_contains(duk_hthread *thr, duk_hobject *h, duk_hobject *p, duk_bool_t ignore_loop);
+DUK_INTERNAL_DECL duk_bool_t duk_hobject_prototype_chain_contains(duk_hthread *thr,
+ duk_hobject *h,
+ duk_hobject *p,
+ duk_bool_t ignore_loop);
#if !defined(DUK_USE_OBJECT_BUILTIN)
/* These declarations are needed when related built-in is disabled and
@@ -7005,7 +7535,7 @@ DUK_INTERNAL_DECL duk_ret_t duk_bi_object_prototype_to_string(duk_hthread *thr);
DUK_INTERNAL_DECL duk_ret_t duk_bi_function_prototype(duk_hthread *thr);
#endif
-#endif /* DUK_HOBJECT_H_INCLUDED */
+#endif /* DUK_HOBJECT_H_INCLUDED */
/* #include duk_hcompfunc.h */
/*
* Heap compiled function (ECMAScript function) representation.
@@ -7024,50 +7554,55 @@ DUK_INTERNAL_DECL duk_ret_t duk_bi_function_prototype(duk_hthread *thr);
/* XXX: casts could be improved, especially for GET/SET DATA */
#if defined(DUK_USE_HEAPPTR16)
-#define DUK_HCOMPFUNC_GET_DATA(heap,h) \
- ((duk_hbuffer_fixed *) (void *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->data16))
-#define DUK_HCOMPFUNC_SET_DATA(heap,h,v) do { \
+#define DUK_HCOMPFUNC_GET_DATA(heap, h) ((duk_hbuffer_fixed *) (void *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->data16))
+#define DUK_HCOMPFUNC_SET_DATA(heap, h, v) \
+ do { \
(h)->data16 = DUK_USE_HEAPPTR_ENC16((heap)->heap_udata, (void *) (v)); \
} while (0)
-#define DUK_HCOMPFUNC_GET_FUNCS(heap,h) \
- ((duk_hobject **) (void *) (DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->funcs16)))
-#define DUK_HCOMPFUNC_SET_FUNCS(heap,h,v) do { \
+#define DUK_HCOMPFUNC_GET_FUNCS(heap, h) ((duk_hobject **) (void *) (DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->funcs16)))
+#define DUK_HCOMPFUNC_SET_FUNCS(heap, h, v) \
+ do { \
(h)->funcs16 = DUK_USE_HEAPPTR_ENC16((heap)->heap_udata, (void *) (v)); \
} while (0)
-#define DUK_HCOMPFUNC_GET_BYTECODE(heap,h) \
- ((duk_instr_t *) (void *) (DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->bytecode16)))
-#define DUK_HCOMPFUNC_SET_BYTECODE(heap,h,v) do { \
+#define DUK_HCOMPFUNC_GET_BYTECODE(heap, h) ((duk_instr_t *) (void *) (DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->bytecode16)))
+#define DUK_HCOMPFUNC_SET_BYTECODE(heap, h, v) \
+ do { \
(h)->bytecode16 = DUK_USE_HEAPPTR_ENC16((heap)->heap_udata, (void *) (v)); \
} while (0)
-#define DUK_HCOMPFUNC_GET_LEXENV(heap,h) \
- ((duk_hobject *) (void *) (DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->lex_env16)))
-#define DUK_HCOMPFUNC_SET_LEXENV(heap,h,v) do { \
+#define DUK_HCOMPFUNC_GET_LEXENV(heap, h) ((duk_hobject *) (void *) (DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->lex_env16)))
+#define DUK_HCOMPFUNC_SET_LEXENV(heap, h, v) \
+ do { \
(h)->lex_env16 = DUK_USE_HEAPPTR_ENC16((heap)->heap_udata, (void *) (v)); \
} while (0)
-#define DUK_HCOMPFUNC_GET_VARENV(heap,h) \
- ((duk_hobject *) (void *) (DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->var_env16)))
-#define DUK_HCOMPFUNC_SET_VARENV(heap,h,v) do { \
+#define DUK_HCOMPFUNC_GET_VARENV(heap, h) ((duk_hobject *) (void *) (DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->var_env16)))
+#define DUK_HCOMPFUNC_SET_VARENV(heap, h, v) \
+ do { \
(h)->var_env16 = DUK_USE_HEAPPTR_ENC16((heap)->heap_udata, (void *) (v)); \
} while (0)
#else
-#define DUK_HCOMPFUNC_GET_DATA(heap,h) ((duk_hbuffer_fixed *) (void *) (h)->data)
-#define DUK_HCOMPFUNC_SET_DATA(heap,h,v) do { \
+#define DUK_HCOMPFUNC_GET_DATA(heap, h) ((duk_hbuffer_fixed *) (void *) (h)->data)
+#define DUK_HCOMPFUNC_SET_DATA(heap, h, v) \
+ do { \
(h)->data = (duk_hbuffer *) (v); \
} while (0)
-#define DUK_HCOMPFUNC_GET_FUNCS(heap,h) ((h)->funcs)
-#define DUK_HCOMPFUNC_SET_FUNCS(heap,h,v) do { \
+#define DUK_HCOMPFUNC_GET_FUNCS(heap, h) ((h)->funcs)
+#define DUK_HCOMPFUNC_SET_FUNCS(heap, h, v) \
+ do { \
(h)->funcs = (v); \
} while (0)
-#define DUK_HCOMPFUNC_GET_BYTECODE(heap,h) ((h)->bytecode)
-#define DUK_HCOMPFUNC_SET_BYTECODE(heap,h,v) do { \
+#define DUK_HCOMPFUNC_GET_BYTECODE(heap, h) ((h)->bytecode)
+#define DUK_HCOMPFUNC_SET_BYTECODE(heap, h, v) \
+ do { \
(h)->bytecode = (v); \
} while (0)
-#define DUK_HCOMPFUNC_GET_LEXENV(heap,h) ((h)->lex_env)
-#define DUK_HCOMPFUNC_SET_LEXENV(heap,h,v) do { \
+#define DUK_HCOMPFUNC_GET_LEXENV(heap, h) ((h)->lex_env)
+#define DUK_HCOMPFUNC_SET_LEXENV(heap, h, v) \
+ do { \
(h)->lex_env = (v); \
} while (0)
-#define DUK_HCOMPFUNC_GET_VARENV(heap,h) ((h)->var_env)
-#define DUK_HCOMPFUNC_SET_VARENV(heap,h,v) do { \
+#define DUK_HCOMPFUNC_GET_VARENV(heap, h) ((h)->var_env)
+#define DUK_HCOMPFUNC_SET_VARENV(heap, h, v) \
+ do { \
(h)->var_env = (v); \
} while (0)
#endif
@@ -7077,64 +7612,40 @@ DUK_INTERNAL_DECL duk_ret_t duk_bi_function_prototype(duk_hthread *thr);
*/
/* Note: assumes 'data' is always a fixed buffer */
-#define DUK_HCOMPFUNC_GET_BUFFER_BASE(heap,h) \
- DUK_HBUFFER_FIXED_GET_DATA_PTR((heap), DUK_HCOMPFUNC_GET_DATA((heap), (h)))
+#define DUK_HCOMPFUNC_GET_BUFFER_BASE(heap, h) DUK_HBUFFER_FIXED_GET_DATA_PTR((heap), DUK_HCOMPFUNC_GET_DATA((heap), (h)))
-#define DUK_HCOMPFUNC_GET_CONSTS_BASE(heap,h) \
- ((duk_tval *) (void *) DUK_HCOMPFUNC_GET_BUFFER_BASE((heap), (h)))
+#define DUK_HCOMPFUNC_GET_CONSTS_BASE(heap, h) ((duk_tval *) (void *) DUK_HCOMPFUNC_GET_BUFFER_BASE((heap), (h)))
-#define DUK_HCOMPFUNC_GET_FUNCS_BASE(heap,h) \
- DUK_HCOMPFUNC_GET_FUNCS((heap), (h))
+#define DUK_HCOMPFUNC_GET_FUNCS_BASE(heap, h) DUK_HCOMPFUNC_GET_FUNCS((heap), (h))
-#define DUK_HCOMPFUNC_GET_CODE_BASE(heap,h) \
- DUK_HCOMPFUNC_GET_BYTECODE((heap), (h))
+#define DUK_HCOMPFUNC_GET_CODE_BASE(heap, h) DUK_HCOMPFUNC_GET_BYTECODE((heap), (h))
-#define DUK_HCOMPFUNC_GET_CONSTS_END(heap,h) \
- ((duk_tval *) (void *) DUK_HCOMPFUNC_GET_FUNCS((heap), (h)))
+#define DUK_HCOMPFUNC_GET_CONSTS_END(heap, h) ((duk_tval *) (void *) DUK_HCOMPFUNC_GET_FUNCS((heap), (h)))
-#define DUK_HCOMPFUNC_GET_FUNCS_END(heap,h) \
- ((duk_hobject **) (void *) DUK_HCOMPFUNC_GET_BYTECODE((heap), (h)))
+#define DUK_HCOMPFUNC_GET_FUNCS_END(heap, h) ((duk_hobject **) (void *) DUK_HCOMPFUNC_GET_BYTECODE((heap), (h)))
/* XXX: double evaluation of DUK_HCOMPFUNC_GET_DATA() */
-#define DUK_HCOMPFUNC_GET_CODE_END(heap,h) \
+#define DUK_HCOMPFUNC_GET_CODE_END(heap, h) \
((duk_instr_t *) (void *) (DUK_HBUFFER_FIXED_GET_DATA_PTR((heap), DUK_HCOMPFUNC_GET_DATA((heap), (h))) + \
- DUK_HBUFFER_GET_SIZE((duk_hbuffer *) DUK_HCOMPFUNC_GET_DATA((heap), h))))
-
-#define DUK_HCOMPFUNC_GET_CONSTS_SIZE(heap,h) \
- ( \
- (duk_size_t) \
- ( \
- ((const duk_uint8_t *) DUK_HCOMPFUNC_GET_CONSTS_END((heap), (h))) - \
- ((const duk_uint8_t *) DUK_HCOMPFUNC_GET_CONSTS_BASE((heap), (h))) \
- ) \
- )
-
-#define DUK_HCOMPFUNC_GET_FUNCS_SIZE(heap,h) \
- ( \
- (duk_size_t) \
- ( \
- ((const duk_uint8_t *) DUK_HCOMPFUNC_GET_FUNCS_END((heap), (h))) - \
- ((const duk_uint8_t *) DUK_HCOMPFUNC_GET_FUNCS_BASE((heap), (h))) \
- ) \
- )
-
-#define DUK_HCOMPFUNC_GET_CODE_SIZE(heap,h) \
- ( \
- (duk_size_t) \
- ( \
- ((const duk_uint8_t *) DUK_HCOMPFUNC_GET_CODE_END((heap),(h))) - \
- ((const duk_uint8_t *) DUK_HCOMPFUNC_GET_CODE_BASE((heap),(h))) \
- ) \
- )
-
-#define DUK_HCOMPFUNC_GET_CONSTS_COUNT(heap,h) \
- ((duk_size_t) (DUK_HCOMPFUNC_GET_CONSTS_SIZE((heap), (h)) / sizeof(duk_tval)))
-
-#define DUK_HCOMPFUNC_GET_FUNCS_COUNT(heap,h) \
- ((duk_size_t) (DUK_HCOMPFUNC_GET_FUNCS_SIZE((heap), (h)) / sizeof(duk_hobject *)))
-
-#define DUK_HCOMPFUNC_GET_CODE_COUNT(heap,h) \
- ((duk_size_t) (DUK_HCOMPFUNC_GET_CODE_SIZE((heap), (h)) / sizeof(duk_instr_t)))
+ DUK_HBUFFER_GET_SIZE((duk_hbuffer *) DUK_HCOMPFUNC_GET_DATA((heap), h))))
+
+#define DUK_HCOMPFUNC_GET_CONSTS_SIZE(heap, h) \
+ ((duk_size_t) (((const duk_uint8_t *) DUK_HCOMPFUNC_GET_CONSTS_END((heap), (h))) - \
+ ((const duk_uint8_t *) DUK_HCOMPFUNC_GET_CONSTS_BASE((heap), (h)))))
+
+#define DUK_HCOMPFUNC_GET_FUNCS_SIZE(heap, h) \
+ ((duk_size_t) (((const duk_uint8_t *) DUK_HCOMPFUNC_GET_FUNCS_END((heap), (h))) - \
+ ((const duk_uint8_t *) DUK_HCOMPFUNC_GET_FUNCS_BASE((heap), (h)))))
+
+#define DUK_HCOMPFUNC_GET_CODE_SIZE(heap, h) \
+ ((duk_size_t) (((const duk_uint8_t *) DUK_HCOMPFUNC_GET_CODE_END((heap), (h))) - \
+ ((const duk_uint8_t *) DUK_HCOMPFUNC_GET_CODE_BASE((heap), (h)))))
+
+#define DUK_HCOMPFUNC_GET_CONSTS_COUNT(heap, h) ((duk_size_t) (DUK_HCOMPFUNC_GET_CONSTS_SIZE((heap), (h)) / sizeof(duk_tval)))
+
+#define DUK_HCOMPFUNC_GET_FUNCS_COUNT(heap, h) ((duk_size_t) (DUK_HCOMPFUNC_GET_FUNCS_SIZE((heap), (h)) / sizeof(duk_hobject *)))
+
+#define DUK_HCOMPFUNC_GET_CODE_COUNT(heap, h) ((duk_size_t) (DUK_HCOMPFUNC_GET_CODE_SIZE((heap), (h)) / sizeof(duk_instr_t)))
/*
* Validity assert
@@ -7142,9 +7653,14 @@ DUK_INTERNAL_DECL duk_ret_t duk_bi_function_prototype(duk_hthread *thr);
#if defined(DUK_USE_ASSERTIONS)
DUK_INTERNAL_DECL void duk_hcompfunc_assert_valid(duk_hcompfunc *h);
-#define DUK_HCOMPFUNC_ASSERT_VALID(h) do { duk_hcompfunc_assert_valid((h)); } while (0)
+#define DUK_HCOMPFUNC_ASSERT_VALID(h) \
+ do { \
+ duk_hcompfunc_assert_valid((h)); \
+ } while (0)
#else
-#define DUK_HCOMPFUNC_ASSERT_VALID(h) do {} while (0)
+#define DUK_HCOMPFUNC_ASSERT_VALID(h) \
+ do { \
+ } while (0)
#endif
/*
@@ -7231,8 +7747,8 @@ struct duk_hcompfunc {
* at run time, except for debugging, so it is not maintained.
*/
- duk_uint16_t nregs; /* regs to allocate */
- duk_uint16_t nargs; /* number of arguments allocated to regs */
+ duk_uint16_t nregs; /* regs to allocate */
+ duk_uint16_t nargs; /* number of arguments allocated to regs */
/*
* Additional control information is placed into the object itself
@@ -7279,7 +7795,7 @@ struct duk_hcompfunc {
#endif
};
-#endif /* DUK_HCOMPFUNC_H_INCLUDED */
+#endif /* DUK_HCOMPFUNC_H_INCLUDED */
/* #include duk_hnatfunc.h */
/*
* Heap native function representation.
@@ -7290,13 +7806,18 @@ struct duk_hcompfunc {
#if defined(DUK_USE_ASSERTIONS)
DUK_INTERNAL_DECL void duk_hnatfunc_assert_valid(duk_hnatfunc *h);
-#define DUK_HNATFUNC_ASSERT_VALID(h) do { duk_hnatfunc_assert_valid((h)); } while (0)
+#define DUK_HNATFUNC_ASSERT_VALID(h) \
+ do { \
+ duk_hnatfunc_assert_valid((h)); \
+ } while (0)
#else
-#define DUK_HNATFUNC_ASSERT_VALID(h) do {} while (0)
+#define DUK_HNATFUNC_ASSERT_VALID(h) \
+ do { \
+ } while (0)
#endif
-#define DUK_HNATFUNC_NARGS_VARARGS ((duk_int16_t) -1)
-#define DUK_HNATFUNC_NARGS_MAX ((duk_int16_t) 0x7fff)
+#define DUK_HNATFUNC_NARGS_VARARGS ((duk_int16_t) -1)
+#define DUK_HNATFUNC_NARGS_MAX ((duk_int16_t) 0x7fff)
struct duk_hnatfunc {
/* shared object part */
@@ -7319,7 +7840,7 @@ struct duk_hnatfunc {
*/
};
-#endif /* DUK_HNATFUNC_H_INCLUDED */
+#endif /* DUK_HNATFUNC_H_INCLUDED */
/* #include duk_hboundfunc.h */
/*
* Bound function representation.
@@ -7335,9 +7856,14 @@ struct duk_hnatfunc {
#if defined(DUK_USE_ASSERTIONS)
DUK_INTERNAL_DECL void duk_hboundfunc_assert_valid(duk_hboundfunc *h);
-#define DUK_HBOUNDFUNC_ASSERT_VALID(h) do { duk_hboundfunc_assert_valid((h)); } while (0)
+#define DUK_HBOUNDFUNC_ASSERT_VALID(h) \
+ do { \
+ duk_hboundfunc_assert_valid((h)); \
+ } while (0)
#else
-#define DUK_HBOUNDFUNC_ASSERT_VALID(h) do {} while (0)
+#define DUK_HBOUNDFUNC_ASSERT_VALID(h) \
+ do { \
+ } while (0)
#endif
struct duk_hboundfunc {
@@ -7353,11 +7879,11 @@ struct duk_hboundfunc {
duk_tval this_binding;
/* Arguments to prepend. */
- duk_tval *args; /* Separate allocation. */
+ duk_tval *args; /* Separate allocation. */
duk_idx_t nargs;
};
-#endif /* DUK_HBOUNDFUNC_H_INCLUDED */
+#endif /* DUK_HBOUNDFUNC_H_INCLUDED */
/* #include duk_hbufobj.h */
/*
* Heap Buffer object representation. Used for all Buffer variants.
@@ -7369,31 +7895,37 @@ struct duk_hboundfunc {
#if defined(DUK_USE_BUFFEROBJECT_SUPPORT)
/* All element accessors are host endian now (driven by TypedArray spec). */
-#define DUK_HBUFOBJ_ELEM_UINT8 0
-#define DUK_HBUFOBJ_ELEM_UINT8CLAMPED 1
-#define DUK_HBUFOBJ_ELEM_INT8 2
-#define DUK_HBUFOBJ_ELEM_UINT16 3
-#define DUK_HBUFOBJ_ELEM_INT16 4
-#define DUK_HBUFOBJ_ELEM_UINT32 5
-#define DUK_HBUFOBJ_ELEM_INT32 6
-#define DUK_HBUFOBJ_ELEM_FLOAT32 7
-#define DUK_HBUFOBJ_ELEM_FLOAT64 8
-#define DUK_HBUFOBJ_ELEM_MAX 8
+#define DUK_HBUFOBJ_ELEM_UINT8 0
+#define DUK_HBUFOBJ_ELEM_UINT8CLAMPED 1
+#define DUK_HBUFOBJ_ELEM_INT8 2
+#define DUK_HBUFOBJ_ELEM_UINT16 3
+#define DUK_HBUFOBJ_ELEM_INT16 4
+#define DUK_HBUFOBJ_ELEM_UINT32 5
+#define DUK_HBUFOBJ_ELEM_INT32 6
+#define DUK_HBUFOBJ_ELEM_FLOAT32 7
+#define DUK_HBUFOBJ_ELEM_FLOAT64 8
+#define DUK_HBUFOBJ_ELEM_MAX 8
#if defined(DUK_USE_ASSERTIONS)
DUK_INTERNAL_DECL void duk_hbufobj_assert_valid(duk_hbufobj *h);
-#define DUK_HBUFOBJ_ASSERT_VALID(h) do { duk_hbufobj_assert_valid((h)); } while (0)
+#define DUK_HBUFOBJ_ASSERT_VALID(h) \
+ do { \
+ duk_hbufobj_assert_valid((h)); \
+ } while (0)
#else
-#define DUK_HBUFOBJ_ASSERT_VALID(h) do {} while (0)
+#define DUK_HBUFOBJ_ASSERT_VALID(h) \
+ do { \
+ } while (0)
#endif
/* Get the current data pointer (caller must ensure buf != NULL) as a
* duk_uint8_t ptr. Note that the result may be NULL if the underlying
* buffer has zero size and is not a fixed buffer.
*/
-#define DUK_HBUFOBJ_GET_SLICE_BASE(heap,h) \
- (DUK_ASSERT_EXPR((h) != NULL), DUK_ASSERT_EXPR((h)->buf != NULL), \
- (((duk_uint8_t *) DUK_HBUFFER_GET_DATA_PTR((heap), (h)->buf)) + (h)->offset))
+#define DUK_HBUFOBJ_GET_SLICE_BASE(heap, h) \
+ (DUK_ASSERT_EXPR((h) != NULL), \
+ DUK_ASSERT_EXPR((h)->buf != NULL), \
+ (((duk_uint8_t *) DUK_HBUFFER_GET_DATA_PTR((heap), (h)->buf)) + (h)->offset))
/* True if slice is full, i.e. offset is zero and length covers the entire
* buffer. This status may change independently of the duk_hbufobj if
@@ -7401,15 +7933,17 @@ DUK_INTERNAL_DECL void duk_hbufobj_assert_valid(duk_hbufobj *h);
* being changed.
*/
#define DUK_HBUFOBJ_FULL_SLICE(h) \
- (DUK_ASSERT_EXPR((h) != NULL), DUK_ASSERT_EXPR((h)->buf != NULL), \
- ((h)->offset == 0 && (h)->length == DUK_HBUFFER_GET_SIZE((h)->buf)))
+ (DUK_ASSERT_EXPR((h) != NULL), \
+ DUK_ASSERT_EXPR((h)->buf != NULL), \
+ ((h)->offset == 0 && (h)->length == DUK_HBUFFER_GET_SIZE((h)->buf)))
/* Validate that the whole slice [0,length[ is contained in the underlying
* buffer. Caller must ensure 'buf' != NULL.
*/
#define DUK_HBUFOBJ_VALID_SLICE(h) \
- (DUK_ASSERT_EXPR((h) != NULL), DUK_ASSERT_EXPR((h)->buf != NULL), \
- ((h)->offset + (h)->length <= DUK_HBUFFER_GET_SIZE((h)->buf)))
+ (DUK_ASSERT_EXPR((h) != NULL), \
+ DUK_ASSERT_EXPR((h)->buf != NULL), \
+ ((h)->offset + (h)->length <= DUK_HBUFFER_GET_SIZE((h)->buf)))
/* Validate byte read/write for virtual 'offset', i.e. check that the
* offset, taking into account h->offset, is within the underlying
@@ -7418,13 +7952,11 @@ DUK_INTERNAL_DECL void duk_hbufobj_assert_valid(duk_hbufobj *h);
* behavior (e.g. if an underlying dynamic buffer changes after being
* setup). Caller must ensure 'buf' != NULL.
*/
-#define DUK_HBUFOBJ_VALID_BYTEOFFSET_INCL(h,off) \
- (DUK_ASSERT_EXPR((h) != NULL), DUK_ASSERT_EXPR((h)->buf != NULL), \
- ((h)->offset + (off) < DUK_HBUFFER_GET_SIZE((h)->buf)))
+#define DUK_HBUFOBJ_VALID_BYTEOFFSET_INCL(h, off) \
+ (DUK_ASSERT_EXPR((h) != NULL), DUK_ASSERT_EXPR((h)->buf != NULL), ((h)->offset + (off) < DUK_HBUFFER_GET_SIZE((h)->buf)))
-#define DUK_HBUFOBJ_VALID_BYTEOFFSET_EXCL(h,off) \
- (DUK_ASSERT_EXPR((h) != NULL), DUK_ASSERT_EXPR((h)->buf != NULL), \
- ((h)->offset + (off) <= DUK_HBUFFER_GET_SIZE((h)->buf)))
+#define DUK_HBUFOBJ_VALID_BYTEOFFSET_EXCL(h, off) \
+ (DUK_ASSERT_EXPR((h) != NULL), DUK_ASSERT_EXPR((h)->buf != NULL), ((h)->offset + (off) <= DUK_HBUFFER_GET_SIZE((h)->buf)))
/* Clamp an input byte length (already assumed to be within the nominal
* duk_hbufobj 'length') to the current dynamic buffer limits to yield
@@ -7432,12 +7964,10 @@ DUK_INTERNAL_DECL void duk_hbufobj_assert_valid(duk_hbufobj *h);
* be invalidated by any side effect because it may trigger a user
* callback that resizes the underlying buffer.
*/
-#define DUK_HBUFOBJ_CLAMP_BYTELENGTH(h,len) \
- (DUK_ASSERT_EXPR((h) != NULL), \
- duk_hbufobj_clamp_bytelength((h), (len)))
+#define DUK_HBUFOBJ_CLAMP_BYTELENGTH(h, len) (DUK_ASSERT_EXPR((h) != NULL), duk_hbufobj_clamp_bytelength((h), (len)))
/* Typed arrays have virtual indices, ArrayBuffer and DataView do not. */
-#define DUK_HBUFOBJ_HAS_VIRTUAL_INDICES(h) ((h)->is_typedarray)
+#define DUK_HBUFOBJ_HAS_VIRTUAL_INDICES(h) ((h)->is_typedarray)
struct duk_hbufobj {
/* Shared object part. */
@@ -7462,30 +7992,36 @@ struct duk_hbufobj {
* be dynamic and its pointer unstable.
*/
- duk_uint_t offset; /* byte offset to buf */
- duk_uint_t length; /* byte index limit for element access, exclusive */
- duk_uint8_t shift; /* element size shift:
- * 0 = u8/i8
- * 1 = u16/i16
- * 2 = u32/i32/float
- * 3 = double
- */
- duk_uint8_t elem_type; /* element type */
+ duk_uint_t offset; /* byte offset to buf */
+ duk_uint_t length; /* byte index limit for element access, exclusive */
+ duk_uint8_t shift; /* element size shift:
+ * 0 = u8/i8
+ * 1 = u16/i16
+ * 2 = u32/i32/float
+ * 3 = double
+ */
+ duk_uint8_t elem_type; /* element type */
duk_uint8_t is_typedarray;
};
DUK_INTERNAL_DECL duk_uint_t duk_hbufobj_clamp_bytelength(duk_hbufobj *h_bufobj, duk_uint_t len);
DUK_INTERNAL_DECL void duk_hbufobj_push_uint8array_from_plain(duk_hthread *thr, duk_hbuffer *h_buf);
-DUK_INTERNAL_DECL void duk_hbufobj_push_validated_read(duk_hthread *thr, duk_hbufobj *h_bufobj, duk_uint8_t *p, duk_small_uint_t elem_size);
-DUK_INTERNAL_DECL void duk_hbufobj_validated_write(duk_hthread *thr, duk_hbufobj *h_bufobj, duk_uint8_t *p, duk_small_uint_t elem_size);
+DUK_INTERNAL_DECL void duk_hbufobj_push_validated_read(duk_hthread *thr,
+ duk_hbufobj *h_bufobj,
+ duk_uint8_t *p,
+ duk_small_uint_t elem_size);
+DUK_INTERNAL_DECL void duk_hbufobj_validated_write(duk_hthread *thr,
+ duk_hbufobj *h_bufobj,
+ duk_uint8_t *p,
+ duk_small_uint_t elem_size);
DUK_INTERNAL_DECL void duk_hbufobj_promote_plain(duk_hthread *thr, duk_idx_t idx);
-#else /* DUK_USE_BUFFEROBJECT_SUPPORT */
+#else /* DUK_USE_BUFFEROBJECT_SUPPORT */
/* nothing */
-#endif /* DUK_USE_BUFFEROBJECT_SUPPORT */
-#endif /* DUK_HBUFOBJ_H_INCLUDED */
+#endif /* DUK_USE_BUFFEROBJECT_SUPPORT */
+#endif /* DUK_HBUFOBJ_H_INCLUDED */
/* #include duk_hthread.h */
/*
* Heap thread object representation.
@@ -7503,38 +8039,38 @@ DUK_INTERNAL_DECL void duk_hbufobj_promote_plain(duk_hthread *thr, duk_idx_t idx
*/
/* Initial valstack size, roughly 0.7kiB. */
-#define DUK_VALSTACK_INITIAL_SIZE 96U
+#define DUK_VALSTACK_INITIAL_SIZE 96U
/* Internal extra elements assumed on function entry, always added to
* user-defined 'extra' for e.g. the duk_check_stack() call.
*/
-#define DUK_VALSTACK_INTERNAL_EXTRA 32U
+#define DUK_VALSTACK_INTERNAL_EXTRA 32U
/* Number of elements guaranteed to be user accessible (in addition to call
* arguments) on Duktape/C function entry. This is the major public API
* commitment.
*/
-#define DUK_VALSTACK_API_ENTRY_MINIMUM DUK_API_ENTRY_STACK
+#define DUK_VALSTACK_API_ENTRY_MINIMUM DUK_API_ENTRY_STACK
/*
* Activation defines
*/
-#define DUK_ACT_FLAG_STRICT (1U << 0) /* function executes in strict mode */
-#define DUK_ACT_FLAG_TAILCALLED (1U << 1) /* activation has tail called one or more times */
-#define DUK_ACT_FLAG_CONSTRUCT (1U << 2) /* function executes as a constructor (called via "new") */
-#define DUK_ACT_FLAG_PREVENT_YIELD (1U << 3) /* activation prevents yield (native call or "new") */
-#define DUK_ACT_FLAG_DIRECT_EVAL (1U << 4) /* activation is a direct eval call */
-#define DUK_ACT_FLAG_CONSTRUCT_PROXY (1U << 5) /* activation is for Proxy 'construct' call, special return value handling */
-#define DUK_ACT_FLAG_BREAKPOINT_ACTIVE (1U << 6) /* activation has active breakpoint(s) */
+#define DUK_ACT_FLAG_STRICT (1U << 0) /* function executes in strict mode */
+#define DUK_ACT_FLAG_TAILCALLED (1U << 1) /* activation has tail called one or more times */
+#define DUK_ACT_FLAG_CONSTRUCT (1U << 2) /* function executes as a constructor (called via "new") */
+#define DUK_ACT_FLAG_PREVENT_YIELD (1U << 3) /* activation prevents yield (native call or "new") */
+#define DUK_ACT_FLAG_DIRECT_EVAL (1U << 4) /* activation is a direct eval call */
+#define DUK_ACT_FLAG_CONSTRUCT_PROXY (1U << 5) /* activation is for Proxy 'construct' call, special return value handling */
+#define DUK_ACT_FLAG_BREAKPOINT_ACTIVE (1U << 6) /* activation has active breakpoint(s) */
-#define DUK_ACT_GET_FUNC(act) ((act)->func)
+#define DUK_ACT_GET_FUNC(act) ((act)->func)
/*
* Flags for __FILE__ / __LINE__ registered into tracedata
*/
-#define DUK_TB_FLAG_NOBLAME_FILELINE (1U << 0) /* don't report __FILE__ / __LINE__ as fileName/lineNumber */
+#define DUK_TB_FLAG_NOBLAME_FILELINE (1U << 0) /* don't report __FILE__ / __LINE__ as fileName/lineNumber */
/*
* Catcher defines
@@ -7543,52 +8079,60 @@ DUK_INTERNAL_DECL void duk_hbufobj_promote_plain(duk_hthread *thr, duk_idx_t idx
/* XXX: remove catcher type entirely */
/* flags field: LLLLLLFT, L = label (24 bits), F = flags (4 bits), T = type (4 bits) */
-#define DUK_CAT_TYPE_MASK 0x0000000fUL
-#define DUK_CAT_TYPE_BITS 4
-#define DUK_CAT_LABEL_MASK 0xffffff00UL
-#define DUK_CAT_LABEL_BITS 24
-#define DUK_CAT_LABEL_SHIFT 8
-
-#define DUK_CAT_FLAG_CATCH_ENABLED (1U << 4) /* catch part will catch */
-#define DUK_CAT_FLAG_FINALLY_ENABLED (1U << 5) /* finally part will catch */
-#define DUK_CAT_FLAG_CATCH_BINDING_ENABLED (1U << 6) /* request to create catch binding */
-#define DUK_CAT_FLAG_LEXENV_ACTIVE (1U << 7) /* catch or with binding is currently active */
-
-#define DUK_CAT_TYPE_UNKNOWN 0
-#define DUK_CAT_TYPE_TCF 1
-#define DUK_CAT_TYPE_LABEL 2
-
-#define DUK_CAT_GET_TYPE(c) ((c)->flags & DUK_CAT_TYPE_MASK)
-#define DUK_CAT_GET_LABEL(c) (((c)->flags & DUK_CAT_LABEL_MASK) >> DUK_CAT_LABEL_SHIFT)
-
-#define DUK_CAT_HAS_CATCH_ENABLED(c) ((c)->flags & DUK_CAT_FLAG_CATCH_ENABLED)
-#define DUK_CAT_HAS_FINALLY_ENABLED(c) ((c)->flags & DUK_CAT_FLAG_FINALLY_ENABLED)
-#define DUK_CAT_HAS_CATCH_BINDING_ENABLED(c) ((c)->flags & DUK_CAT_FLAG_CATCH_BINDING_ENABLED)
-#define DUK_CAT_HAS_LEXENV_ACTIVE(c) ((c)->flags & DUK_CAT_FLAG_LEXENV_ACTIVE)
-
-#define DUK_CAT_SET_CATCH_ENABLED(c) do { \
+#define DUK_CAT_TYPE_MASK 0x0000000fUL
+#define DUK_CAT_TYPE_BITS 4
+#define DUK_CAT_LABEL_MASK 0xffffff00UL
+#define DUK_CAT_LABEL_BITS 24
+#define DUK_CAT_LABEL_SHIFT 8
+
+#define DUK_CAT_FLAG_CATCH_ENABLED (1U << 4) /* catch part will catch */
+#define DUK_CAT_FLAG_FINALLY_ENABLED (1U << 5) /* finally part will catch */
+#define DUK_CAT_FLAG_CATCH_BINDING_ENABLED (1U << 6) /* request to create catch binding */
+#define DUK_CAT_FLAG_LEXENV_ACTIVE (1U << 7) /* catch or with binding is currently active */
+
+#define DUK_CAT_TYPE_UNKNOWN 0
+#define DUK_CAT_TYPE_TCF 1
+#define DUK_CAT_TYPE_LABEL 2
+
+#define DUK_CAT_GET_TYPE(c) ((c)->flags & DUK_CAT_TYPE_MASK)
+#define DUK_CAT_GET_LABEL(c) (((c)->flags & DUK_CAT_LABEL_MASK) >> DUK_CAT_LABEL_SHIFT)
+
+#define DUK_CAT_HAS_CATCH_ENABLED(c) ((c)->flags & DUK_CAT_FLAG_CATCH_ENABLED)
+#define DUK_CAT_HAS_FINALLY_ENABLED(c) ((c)->flags & DUK_CAT_FLAG_FINALLY_ENABLED)
+#define DUK_CAT_HAS_CATCH_BINDING_ENABLED(c) ((c)->flags & DUK_CAT_FLAG_CATCH_BINDING_ENABLED)
+#define DUK_CAT_HAS_LEXENV_ACTIVE(c) ((c)->flags & DUK_CAT_FLAG_LEXENV_ACTIVE)
+
+#define DUK_CAT_SET_CATCH_ENABLED(c) \
+ do { \
(c)->flags |= DUK_CAT_FLAG_CATCH_ENABLED; \
} while (0)
-#define DUK_CAT_SET_FINALLY_ENABLED(c) do { \
+#define DUK_CAT_SET_FINALLY_ENABLED(c) \
+ do { \
(c)->flags |= DUK_CAT_FLAG_FINALLY_ENABLED; \
} while (0)
-#define DUK_CAT_SET_CATCH_BINDING_ENABLED(c) do { \
+#define DUK_CAT_SET_CATCH_BINDING_ENABLED(c) \
+ do { \
(c)->flags |= DUK_CAT_FLAG_CATCH_BINDING_ENABLED; \
} while (0)
-#define DUK_CAT_SET_LEXENV_ACTIVE(c) do { \
+#define DUK_CAT_SET_LEXENV_ACTIVE(c) \
+ do { \
(c)->flags |= DUK_CAT_FLAG_LEXENV_ACTIVE; \
} while (0)
-#define DUK_CAT_CLEAR_CATCH_ENABLED(c) do { \
+#define DUK_CAT_CLEAR_CATCH_ENABLED(c) \
+ do { \
(c)->flags &= ~DUK_CAT_FLAG_CATCH_ENABLED; \
} while (0)
-#define DUK_CAT_CLEAR_FINALLY_ENABLED(c) do { \
+#define DUK_CAT_CLEAR_FINALLY_ENABLED(c) \
+ do { \
(c)->flags &= ~DUK_CAT_FLAG_FINALLY_ENABLED; \
} while (0)
-#define DUK_CAT_CLEAR_CATCH_BINDING_ENABLED(c) do { \
+#define DUK_CAT_CLEAR_CATCH_BINDING_ENABLED(c) \
+ do { \
(c)->flags &= ~DUK_CAT_FLAG_CATCH_BINDING_ENABLED; \
} while (0)
-#define DUK_CAT_CLEAR_LEXENV_ACTIVE(c) do { \
+#define DUK_CAT_CLEAR_LEXENV_ACTIVE(c) \
+ do { \
(c)->flags &= ~DUK_CAT_FLAG_LEXENV_ACTIVE; \
} while (0)
@@ -7597,24 +8141,21 @@ DUK_INTERNAL_DECL void duk_hbufobj_promote_plain(duk_hthread *thr, duk_idx_t idx
*/
#if defined(DUK_USE_ROM_STRINGS)
-#define DUK_HTHREAD_GET_STRING(thr,idx) \
- ((duk_hstring *) DUK_LOSE_CONST(duk_rom_strings_stridx[(idx)]))
-#else /* DUK_USE_ROM_STRINGS */
+#define DUK_HTHREAD_GET_STRING(thr, idx) ((duk_hstring *) DUK_LOSE_CONST(duk_rom_strings_stridx[(idx)]))
+#else /* DUK_USE_ROM_STRINGS */
#if defined(DUK_USE_HEAPPTR16)
-#define DUK_HTHREAD_GET_STRING(thr,idx) \
- ((duk_hstring *) DUK_USE_HEAPPTR_DEC16((thr)->heap->heap_udata, (thr)->strs16[(idx)]))
+#define DUK_HTHREAD_GET_STRING(thr, idx) ((duk_hstring *) DUK_USE_HEAPPTR_DEC16((thr)->heap->heap_udata, (thr)->strs16[(idx)]))
#else
-#define DUK_HTHREAD_GET_STRING(thr,idx) \
- ((thr)->strs[(idx)])
+#define DUK_HTHREAD_GET_STRING(thr, idx) ((thr)->strs[(idx)])
#endif
-#endif /* DUK_USE_ROM_STRINGS */
+#endif /* DUK_USE_ROM_STRINGS */
/* values for the state field */
-#define DUK_HTHREAD_STATE_INACTIVE 1 /* thread not currently running */
-#define DUK_HTHREAD_STATE_RUNNING 2 /* thread currently running (only one at a time) */
-#define DUK_HTHREAD_STATE_RESUMED 3 /* thread resumed another thread (active but not running) */
-#define DUK_HTHREAD_STATE_YIELDED 4 /* thread has yielded */
-#define DUK_HTHREAD_STATE_TERMINATED 5 /* thread has terminated */
+#define DUK_HTHREAD_STATE_INACTIVE 1 /* thread not currently running */
+#define DUK_HTHREAD_STATE_RUNNING 2 /* thread currently running (only one at a time) */
+#define DUK_HTHREAD_STATE_RESUMED 3 /* thread resumed another thread (active but not running) */
+#define DUK_HTHREAD_STATE_YIELDED 4 /* thread has yielded */
+#define DUK_HTHREAD_STATE_TERMINATED 5 /* thread has terminated */
/* Executor interrupt default interval when nothing else requires a
* smaller value. The default interval must be small enough to allow
@@ -7622,7 +8163,7 @@ DUK_INTERNAL_DECL void duk_hbufobj_promote_plain(duk_hthread *thr, duk_idx_t idx
* impact on execution performance low.
*/
#if defined(DUK_USE_INTERRUPT_COUNTER)
-#define DUK_HTHREAD_INTCTR_DEFAULT (256L * 1024L)
+#define DUK_HTHREAD_INTCTR_DEFAULT (256L * 1024L)
#endif
/*
@@ -7636,20 +8177,31 @@ DUK_INTERNAL_DECL void duk_hbufobj_promote_plain(duk_hthread *thr, duk_idx_t idx
#if defined(DUK_USE_ASSERTIONS)
/* Assertions for internals. */
DUK_INTERNAL_DECL void duk_hthread_assert_valid(duk_hthread *thr);
-#define DUK_HTHREAD_ASSERT_VALID(thr) do { duk_hthread_assert_valid((thr)); } while (0)
+#define DUK_HTHREAD_ASSERT_VALID(thr) \
+ do { \
+ duk_hthread_assert_valid((thr)); \
+ } while (0)
/* Assertions for public API calls; a bit stronger. */
DUK_INTERNAL_DECL void duk_ctx_assert_valid(duk_hthread *thr);
-#define DUK_CTX_ASSERT_VALID(thr) do { duk_ctx_assert_valid((thr)); } while (0)
+#define DUK_CTX_ASSERT_VALID(thr) \
+ do { \
+ duk_ctx_assert_valid((thr)); \
+ } while (0)
#else
-#define DUK_HTHREAD_ASSERT_VALID(thr) do {} while (0)
-#define DUK_CTX_ASSERT_VALID(thr) do {} while (0)
+#define DUK_HTHREAD_ASSERT_VALID(thr) \
+ do { \
+ } while (0)
+#define DUK_CTX_ASSERT_VALID(thr) \
+ do { \
+ } while (0)
#endif
/* Assertions for API call entry specifically. Checks 'ctx' but also may
* check internal state (e.g. not in a debugger transport callback).
*/
-#define DUK_ASSERT_API_ENTRY(thr) do { \
+#define DUK_ASSERT_API_ENTRY(thr) \
+ do { \
DUK_CTX_ASSERT_VALID((thr)); \
DUK_ASSERT((thr)->heap != NULL); \
DUK_ASSERT((thr)->heap->dbg_calling_transport == 0); \
@@ -7659,11 +8211,9 @@ DUK_INTERNAL_DECL void duk_ctx_assert_valid(duk_hthread *thr);
* Assertion helpers.
*/
-#define DUK_ASSERT_STRIDX_VALID(val) \
- DUK_ASSERT((duk_uint_t) (val) < DUK_HEAP_NUM_STRINGS)
+#define DUK_ASSERT_STRIDX_VALID(val) DUK_ASSERT((duk_uint_t) (val) < DUK_HEAP_NUM_STRINGS)
-#define DUK_ASSERT_BIDX_VALID(val) \
- DUK_ASSERT((duk_uint_t) (val) < DUK_NUM_BUILTINS)
+#define DUK_ASSERT_BIDX_VALID(val) DUK_ASSERT((duk_uint_t) (val) < DUK_NUM_BUILTINS)
/*
* Misc
@@ -7671,9 +8221,7 @@ DUK_INTERNAL_DECL void duk_ctx_assert_valid(duk_hthread *thr);
/* Fast access to 'this' binding. Assumes there's a call in progress. */
#define DUK_HTHREAD_THIS_PTR(thr) \
- (DUK_ASSERT_EXPR((thr) != NULL), \
- DUK_ASSERT_EXPR((thr)->valstack_bottom > (thr)->valstack), \
- (thr)->valstack_bottom - 1)
+ (DUK_ASSERT_EXPR((thr) != NULL), DUK_ASSERT_EXPR((thr)->valstack_bottom > (thr)->valstack), (thr)->valstack_bottom - 1)
/*
* Struct defines
@@ -7681,12 +8229,13 @@ DUK_INTERNAL_DECL void duk_ctx_assert_valid(duk_hthread *thr);
/* Fields are ordered for alignment/packing. */
struct duk_activation {
- duk_tval tv_func; /* borrowed: full duk_tval for function being executed; for lightfuncs */
- duk_hobject *func; /* borrowed: function being executed; for bound function calls, this is the final, real function, NULL for lightfuncs */
+ duk_tval tv_func; /* borrowed: full duk_tval for function being executed; for lightfuncs */
+ duk_hobject *func; /* borrowed: function being executed; for bound function calls, this is the final, real function, NULL
+ for lightfuncs */
duk_activation *parent; /* previous (parent) activation (or NULL if none) */
- duk_hobject *var_env; /* current variable environment (may be NULL if delayed) */
- duk_hobject *lex_env; /* current lexical environment (may be NULL if delayed) */
- duk_catcher *cat; /* current catcher (or NULL) */
+ duk_hobject *var_env; /* current variable environment (may be NULL if delayed) */
+ duk_hobject *lex_env; /* current lexical environment (may be NULL if delayed) */
+ duk_catcher *cat; /* current catcher (or NULL) */
#if defined(DUK_USE_NONSTD_FUNC_CALLER_PROPERTY)
/* Previous value of 'func' caller, restored when unwound. Only in use
@@ -7695,7 +8244,7 @@ struct duk_activation {
duk_hobject *prev_caller;
#endif
- duk_instr_t *curr_pc; /* next instruction to execute (points to 'func' bytecode, stable pointer), NULL for native calls */
+ duk_instr_t *curr_pc; /* next instruction to execute (points to 'func' bytecode, stable pointer), NULL for native calls */
/* bottom_byteoff and retval_byteoff are only used for book-keeping
* of ECMAScript-initiated calls, to allow returning to an ECMAScript
@@ -7742,12 +8291,12 @@ struct duk_activation {
};
struct duk_catcher {
- duk_catcher *parent; /* previous (parent) catcher (or NULL if none) */
- duk_hstring *h_varname; /* borrowed reference to catch variable name (or NULL if none) */
- /* (reference is valid as long activation exists) */
- duk_instr_t *pc_base; /* resume execution from pc_base or pc_base+1 (points to 'func' bytecode, stable pointer) */
- duk_size_t idx_base; /* idx_base and idx_base+1 get completion value and type */
- duk_uint32_t flags; /* type and control flags, label number */
+ duk_catcher *parent; /* previous (parent) catcher (or NULL if none) */
+ duk_hstring *h_varname; /* borrowed reference to catch variable name (or NULL if none) */
+ /* (reference is valid as long activation exists) */
+ duk_instr_t *pc_base; /* resume execution from pc_base or pc_base+1 (points to 'func' bytecode, stable pointer) */
+ duk_size_t idx_base; /* idx_base and idx_base+1 get completion value and type */
+ duk_uint32_t flags; /* type and control flags, label number */
/* XXX: could pack 'flags' and 'idx_base' to same value in practice,
* on 32-bit targets this would make duk_catcher 16 bytes.
*/
@@ -7805,21 +8354,21 @@ struct duk_hthread {
* yyy = arbitrary values, inside current frame
* uuu = outside active value stack, initialized to 'undefined'
*/
- duk_tval *valstack; /* start of valstack allocation */
- duk_tval *valstack_end; /* end of valstack reservation/guarantee (exclusive) */
- duk_tval *valstack_alloc_end; /* end of valstack allocation */
- duk_tval *valstack_bottom; /* bottom of current frame */
- duk_tval *valstack_top; /* top of current frame (exclusive) */
+ duk_tval *valstack; /* start of valstack allocation */
+ duk_tval *valstack_end; /* end of valstack reservation/guarantee (exclusive) */
+ duk_tval *valstack_alloc_end; /* end of valstack allocation */
+ duk_tval *valstack_bottom; /* bottom of current frame */
+ duk_tval *valstack_top; /* top of current frame (exclusive) */
/* Call stack, represented as a linked list starting from the current
* activation (or NULL if nothing is active).
*/
- duk_activation *callstack_curr; /* current activation (or NULL if none) */
- duk_size_t callstack_top; /* number of activation records in callstack (0 if none) */
- duk_size_t callstack_preventcount; /* number of activation records in callstack preventing a yield */
+ duk_activation *callstack_curr; /* current activation (or NULL if none) */
+ duk_size_t callstack_top; /* number of activation records in callstack (0 if none) */
+ duk_size_t callstack_preventcount; /* number of activation records in callstack preventing a yield */
/* Yield/resume book-keeping. */
- duk_hthread *resumer; /* who resumed us (if any) */
+ duk_hthread *resumer; /* who resumed us (if any) */
/* Current compiler state (if any), used for augmenting SyntaxErrors. */
duk_compiler_ctx *compile_ctx;
@@ -7832,8 +8381,8 @@ struct duk_hthread {
* important for the counter to be conveniently accessible for the
* bytecode executor inner loop for performance reasons.
*/
- duk_int_t interrupt_counter; /* countdown state */
- duk_int_t interrupt_init; /* start value for current countdown */
+ duk_int_t interrupt_counter; /* countdown state */
+ duk_int_t interrupt_init; /* start value for current countdown */
#endif
/* Builtin-objects; may or may not be shared with other threads,
@@ -7870,13 +8419,13 @@ DUK_INTERNAL_DECL void duk_hthread_create_builtin_objects(duk_hthread *thr);
DUK_INTERNAL_DECL duk_bool_t duk_hthread_init_stacks(duk_heap *heap, duk_hthread *thr);
DUK_INTERNAL_DECL void duk_hthread_terminate(duk_hthread *thr);
-DUK_INTERNAL_DECL DUK_INLINE duk_activation *duk_hthread_activation_alloc(duk_hthread *thr);
+DUK_INTERNAL_DECL duk_activation *duk_hthread_activation_alloc(duk_hthread *thr);
DUK_INTERNAL_DECL void duk_hthread_activation_free(duk_hthread *thr, duk_activation *act);
DUK_INTERNAL_DECL void duk_hthread_activation_unwind_norz(duk_hthread *thr);
DUK_INTERNAL_DECL void duk_hthread_activation_unwind_reuse_norz(duk_hthread *thr);
DUK_INTERNAL_DECL duk_activation *duk_hthread_get_activation_for_level(duk_hthread *thr, duk_int_t level);
-DUK_INTERNAL_DECL DUK_INLINE duk_catcher *duk_hthread_catcher_alloc(duk_hthread *thr);
+DUK_INTERNAL_DECL duk_catcher *duk_hthread_catcher_alloc(duk_hthread *thr);
DUK_INTERNAL_DECL void duk_hthread_catcher_free(duk_hthread *thr, duk_catcher *cat);
DUK_INTERNAL_DECL void duk_hthread_catcher_unwind_norz(duk_hthread *thr, duk_activation *act);
DUK_INTERNAL_DECL void duk_hthread_catcher_unwind_nolexenv_norz(duk_hthread *thr, duk_activation *act);
@@ -7885,7 +8434,7 @@ DUK_INTERNAL_DECL void duk_hthread_catcher_unwind_nolexenv_norz(duk_hthread *thr
DUK_INTERNAL_DECL void duk_hthread_valstack_torture_realloc(duk_hthread *thr);
#endif
-DUK_INTERNAL_DECL void *duk_hthread_get_valstack_ptr(duk_heap *heap, void *ud); /* indirect allocs */
+DUK_INTERNAL_DECL void *duk_hthread_get_valstack_ptr(duk_heap *heap, void *ud); /* indirect allocs */
#if defined(DUK_USE_DEBUGGER_SUPPORT)
DUK_INTERNAL_DECL duk_uint_fast32_t duk_hthread_get_act_curr_pc(duk_hthread *thr, duk_activation *act);
@@ -7894,7 +8443,7 @@ DUK_INTERNAL_DECL duk_uint_fast32_t duk_hthread_get_act_prev_pc(duk_hthread *thr
DUK_INTERNAL_DECL void duk_hthread_sync_currpc(duk_hthread *thr);
DUK_INTERNAL_DECL void duk_hthread_sync_and_null_currpc(duk_hthread *thr);
-#endif /* DUK_HTHREAD_H_INCLUDED */
+#endif /* DUK_HTHREAD_H_INCLUDED */
/* #include duk_harray.h */
/*
* Array object representation, used for actual Array instances.
@@ -7909,15 +8458,26 @@ DUK_INTERNAL_DECL void duk_hthread_sync_and_null_currpc(duk_hthread *thr);
#if defined(DUK_USE_ASSERTIONS)
DUK_INTERNAL_DECL void duk_harray_assert_valid(duk_harray *h);
-#define DUK_HARRAY_ASSERT_VALID(h) do { duk_harray_assert_valid((h)); } while (0)
+#define DUK_HARRAY_ASSERT_VALID(h) \
+ do { \
+ duk_harray_assert_valid((h)); \
+ } while (0)
#else
-#define DUK_HARRAY_ASSERT_VALID(h) do {} while (0)
+#define DUK_HARRAY_ASSERT_VALID(h) \
+ do { \
+ } while (0)
#endif
-#define DUK_HARRAY_LENGTH_WRITABLE(h) (!(h)->length_nonwritable)
-#define DUK_HARRAY_LENGTH_NONWRITABLE(h) ((h)->length_nonwritable)
-#define DUK_HARRAY_SET_LENGTH_WRITABLE(h) do { (h)->length_nonwritable = 0; } while (0)
-#define DUK_HARRAY_SET_LENGTH_NONWRITABLE(h) do { (h)->length_nonwritable = 1; } while (0)
+#define DUK_HARRAY_LENGTH_WRITABLE(h) (!(h)->length_nonwritable)
+#define DUK_HARRAY_LENGTH_NONWRITABLE(h) ((h)->length_nonwritable)
+#define DUK_HARRAY_SET_LENGTH_WRITABLE(h) \
+ do { \
+ (h)->length_nonwritable = 0; \
+ } while (0)
+#define DUK_HARRAY_SET_LENGTH_NONWRITABLE(h) \
+ do { \
+ (h)->length_nonwritable = 1; \
+ } while (0)
struct duk_harray {
/* Shared object part. */
@@ -7943,7 +8503,7 @@ struct duk_harray {
duk_bool_t length_nonwritable;
};
-#endif /* DUK_HARRAY_H_INCLUDED */
+#endif /* DUK_HARRAY_H_INCLUDED */
/* #include duk_henv.h */
/*
* Environment object representation.
@@ -7955,11 +8515,21 @@ struct duk_harray {
#if defined(DUK_USE_ASSERTIONS)
DUK_INTERNAL_DECL void duk_hdecenv_assert_valid(duk_hdecenv *h);
DUK_INTERNAL_DECL void duk_hobjenv_assert_valid(duk_hobjenv *h);
-#define DUK_HDECENV_ASSERT_VALID(h) do { duk_hdecenv_assert_valid((h)); } while (0)
-#define DUK_HOBJENV_ASSERT_VALID(h) do { duk_hobjenv_assert_valid((h)); } while (0)
+#define DUK_HDECENV_ASSERT_VALID(h) \
+ do { \
+ duk_hdecenv_assert_valid((h)); \
+ } while (0)
+#define DUK_HOBJENV_ASSERT_VALID(h) \
+ do { \
+ duk_hobjenv_assert_valid((h)); \
+ } while (0)
#else
-#define DUK_HDECENV_ASSERT_VALID(h) do {} while (0)
-#define DUK_HOBJENV_ASSERT_VALID(h) do {} while (0)
+#define DUK_HDECENV_ASSERT_VALID(h) \
+ do { \
+ } while (0)
+#define DUK_HOBJENV_ASSERT_VALID(h) \
+ do { \
+ } while (0)
#endif
struct duk_hdecenv {
@@ -7989,7 +8559,7 @@ struct duk_hobjenv {
duk_bool_t has_this;
};
-#endif /* DUK_HENV_H_INCLUDED */
+#endif /* DUK_HENV_H_INCLUDED */
/* #include duk_hbuffer.h */
/*
* Heap buffer representation.
@@ -8013,17 +8583,17 @@ struct duk_hobjenv {
* External buffer: DUK_HBUFFER_FLAG_DYNAMIC | DUK_HBUFFER_FLAG_EXTERNAL
*/
-#define DUK_HBUFFER_FLAG_DYNAMIC DUK_HEAPHDR_USER_FLAG(0) /* buffer is behind a pointer, dynamic or external */
-#define DUK_HBUFFER_FLAG_EXTERNAL DUK_HEAPHDR_USER_FLAG(1) /* buffer pointer is to an externally allocated buffer */
+#define DUK_HBUFFER_FLAG_DYNAMIC DUK_HEAPHDR_USER_FLAG(0) /* buffer is behind a pointer, dynamic or external */
+#define DUK_HBUFFER_FLAG_EXTERNAL DUK_HEAPHDR_USER_FLAG(1) /* buffer pointer is to an externally allocated buffer */
-#define DUK_HBUFFER_HAS_DYNAMIC(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_DYNAMIC)
-#define DUK_HBUFFER_HAS_EXTERNAL(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_EXTERNAL)
+#define DUK_HBUFFER_HAS_DYNAMIC(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_DYNAMIC)
+#define DUK_HBUFFER_HAS_EXTERNAL(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_EXTERNAL)
-#define DUK_HBUFFER_SET_DYNAMIC(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_DYNAMIC)
-#define DUK_HBUFFER_SET_EXTERNAL(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_EXTERNAL)
+#define DUK_HBUFFER_SET_DYNAMIC(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_DYNAMIC)
+#define DUK_HBUFFER_SET_EXTERNAL(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_EXTERNAL)
-#define DUK_HBUFFER_CLEAR_DYNAMIC(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_DYNAMIC)
-#define DUK_HBUFFER_CLEAR_EXTERNAL(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_EXTERNAL)
+#define DUK_HBUFFER_CLEAR_DYNAMIC(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_DYNAMIC)
+#define DUK_HBUFFER_CLEAR_EXTERNAL(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_EXTERNAL)
/*
* Misc defines
@@ -8036,12 +8606,12 @@ struct duk_hobjenv {
*/
#if defined(DUK_USE_BUFLEN16)
-#define DUK_HBUFFER_MAX_BYTELEN (0x0000ffffUL)
+#define DUK_HBUFFER_MAX_BYTELEN (0x0000ffffUL)
#else
/* Intentionally not 0x7fffffffUL; at least JSON code expects that
* 2*len + 2 fits in 32 bits.
*/
-#define DUK_HBUFFER_MAX_BYTELEN (0x7ffffffeUL)
+#define DUK_HBUFFER_MAX_BYTELEN (0x7ffffffeUL)
#endif
/*
@@ -8050,60 +8620,70 @@ struct duk_hobjenv {
#if defined(DUK_USE_BUFLEN16)
/* size stored in duk_heaphdr unused flag bits */
-#define DUK_HBUFFER_GET_SIZE(x) ((x)->hdr.h_flags >> 16)
-#define DUK_HBUFFER_SET_SIZE(x,v) do { \
+#define DUK_HBUFFER_GET_SIZE(x) ((x)->hdr.h_flags >> 16)
+#define DUK_HBUFFER_SET_SIZE(x, v) \
+ do { \
duk_size_t duk__v; \
duk__v = (v); \
DUK_ASSERT(duk__v <= 0xffffUL); \
(x)->hdr.h_flags = ((x)->hdr.h_flags & 0x0000ffffUL) | (((duk_uint32_t) duk__v) << 16); \
} while (0)
-#define DUK_HBUFFER_ADD_SIZE(x,dv) do { \
+#define DUK_HBUFFER_ADD_SIZE(x, dv) \
+ do { \
(x)->hdr.h_flags += ((dv) << 16); \
} while (0)
-#define DUK_HBUFFER_SUB_SIZE(x,dv) do { \
+#define DUK_HBUFFER_SUB_SIZE(x, dv) \
+ do { \
(x)->hdr.h_flags -= ((dv) << 16); \
} while (0)
#else
-#define DUK_HBUFFER_GET_SIZE(x) (((duk_hbuffer *) (x))->size)
-#define DUK_HBUFFER_SET_SIZE(x,v) do { \
+#define DUK_HBUFFER_GET_SIZE(x) (((duk_hbuffer *) (x))->size)
+#define DUK_HBUFFER_SET_SIZE(x, v) \
+ do { \
((duk_hbuffer *) (x))->size = (v); \
} while (0)
-#define DUK_HBUFFER_ADD_SIZE(x,dv) do { \
+#define DUK_HBUFFER_ADD_SIZE(x, dv) \
+ do { \
(x)->size += (dv); \
} while (0)
-#define DUK_HBUFFER_SUB_SIZE(x,dv) do { \
+#define DUK_HBUFFER_SUB_SIZE(x, dv) \
+ do { \
(x)->size -= (dv); \
} while (0)
#endif
-#define DUK_HBUFFER_FIXED_GET_SIZE(x) DUK_HBUFFER_GET_SIZE((duk_hbuffer *) (x))
-#define DUK_HBUFFER_FIXED_SET_SIZE(x,v) DUK_HBUFFER_SET_SIZE((duk_hbuffer *) (x))
+#define DUK_HBUFFER_FIXED_GET_SIZE(x) DUK_HBUFFER_GET_SIZE((duk_hbuffer *) (x))
+#define DUK_HBUFFER_FIXED_SET_SIZE(x, v) DUK_HBUFFER_SET_SIZE((duk_hbuffer *) (x))
#define DUK_HBUFFER_DYNAMIC_GET_SIZE(x) DUK_HBUFFER_GET_SIZE((duk_hbuffer *) (x))
-#define DUK_HBUFFER_DYNAMIC_SET_SIZE(x,v) DUK_HBUFFER_SET_SIZE((duk_hbuffer *) (x), (v))
-#define DUK_HBUFFER_DYNAMIC_ADD_SIZE(x,dv) DUK_HBUFFER_ADD_SIZE((duk_hbuffer *) (x), (dv))
-#define DUK_HBUFFER_DYNAMIC_SUB_SIZE(x,dv) DUK_HBUFFER_SUB_SIZE((duk_hbuffer *) (x), (dv))
+#define DUK_HBUFFER_DYNAMIC_SET_SIZE(x, v) DUK_HBUFFER_SET_SIZE((duk_hbuffer *) (x), (v))
+#define DUK_HBUFFER_DYNAMIC_ADD_SIZE(x, dv) DUK_HBUFFER_ADD_SIZE((duk_hbuffer *) (x), (dv))
+#define DUK_HBUFFER_DYNAMIC_SUB_SIZE(x, dv) DUK_HBUFFER_SUB_SIZE((duk_hbuffer *) (x), (dv))
#define DUK_HBUFFER_EXTERNAL_GET_SIZE(x) DUK_HBUFFER_GET_SIZE((duk_hbuffer *) (x))
-#define DUK_HBUFFER_EXTERNAL_SET_SIZE(x,v) DUK_HBUFFER_SET_SIZE((duk_hbuffer *) (x), (v))
+#define DUK_HBUFFER_EXTERNAL_SET_SIZE(x, v) DUK_HBUFFER_SET_SIZE((duk_hbuffer *) (x), (v))
-#define DUK_HBUFFER_FIXED_GET_DATA_PTR(heap,x) ((duk_uint8_t *) (((duk_hbuffer_fixed *) (void *) (x)) + 1))
+#define DUK_HBUFFER_FIXED_GET_DATA_PTR(heap, x) ((duk_uint8_t *) (((duk_hbuffer_fixed *) (void *) (x)) + 1))
#if defined(DUK_USE_HEAPPTR16)
-#define DUK_HBUFFER_DYNAMIC_GET_DATA_PTR(heap,x) \
+#define DUK_HBUFFER_DYNAMIC_GET_DATA_PTR(heap, x) \
((void *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, ((duk_heaphdr *) (x))->h_extra16))
-#define DUK_HBUFFER_DYNAMIC_SET_DATA_PTR(heap,x,v) do { \
+#define DUK_HBUFFER_DYNAMIC_SET_DATA_PTR(heap, x, v) \
+ do { \
((duk_heaphdr *) (x))->h_extra16 = DUK_USE_HEAPPTR_ENC16((heap)->heap_udata, (void *) (v)); \
} while (0)
-#define DUK_HBUFFER_DYNAMIC_SET_DATA_PTR_NULL(heap,x) do { \
- ((duk_heaphdr *) (x))->h_extra16 = 0; /* assume 0 <=> NULL */ \
+#define DUK_HBUFFER_DYNAMIC_SET_DATA_PTR_NULL(heap, x) \
+ do { \
+ ((duk_heaphdr *) (x))->h_extra16 = 0; /* assume 0 <=> NULL */ \
} while (0)
#else
-#define DUK_HBUFFER_DYNAMIC_GET_DATA_PTR(heap,x) ((x)->curr_alloc)
-#define DUK_HBUFFER_DYNAMIC_SET_DATA_PTR(heap,x,v) do { \
+#define DUK_HBUFFER_DYNAMIC_GET_DATA_PTR(heap, x) ((x)->curr_alloc)
+#define DUK_HBUFFER_DYNAMIC_SET_DATA_PTR(heap, x, v) \
+ do { \
(x)->curr_alloc = (void *) (v); \
} while (0)
-#define DUK_HBUFFER_DYNAMIC_SET_DATA_PTR_NULL(heap,x) do { \
+#define DUK_HBUFFER_DYNAMIC_SET_DATA_PTR_NULL(heap, x) \
+ do { \
(x)->curr_alloc = (void *) NULL; \
} while (0)
#endif
@@ -8112,21 +8692,23 @@ struct duk_hobjenv {
* Duktape heap.
*/
#if defined(DUK_USE_HEAPPTR16)
-#define DUK_HBUFFER_EXTERNAL_GET_DATA_PTR(heap,x) \
- ((void *) (x)->curr_alloc)
-#define DUK_HBUFFER_EXTERNAL_SET_DATA_PTR(heap,x,v) do { \
+#define DUK_HBUFFER_EXTERNAL_GET_DATA_PTR(heap, x) ((void *) (x)->curr_alloc)
+#define DUK_HBUFFER_EXTERNAL_SET_DATA_PTR(heap, x, v) \
+ do { \
(x)->curr_alloc = (void *) (v); \
} while (0)
-#define DUK_HBUFFER_EXTERNAL_SET_DATA_PTR_NULL(heap,x) do { \
+#define DUK_HBUFFER_EXTERNAL_SET_DATA_PTR_NULL(heap, x) \
+ do { \
(x)->curr_alloc = (void *) NULL; \
} while (0)
#else
-#define DUK_HBUFFER_EXTERNAL_GET_DATA_PTR(heap,x) \
- ((void *) (x)->curr_alloc)
-#define DUK_HBUFFER_EXTERNAL_SET_DATA_PTR(heap,x,v) do { \
+#define DUK_HBUFFER_EXTERNAL_GET_DATA_PTR(heap, x) ((void *) (x)->curr_alloc)
+#define DUK_HBUFFER_EXTERNAL_SET_DATA_PTR(heap, x, v) \
+ do { \
(x)->curr_alloc = (void *) (v); \
} while (0)
-#define DUK_HBUFFER_EXTERNAL_SET_DATA_PTR_NULL(heap,x) do { \
+#define DUK_HBUFFER_EXTERNAL_SET_DATA_PTR_NULL(heap, x) \
+ do { \
(x)->curr_alloc = (void *) NULL; \
} while (0)
#endif
@@ -8135,32 +8717,31 @@ struct duk_hobjenv {
* size). May be NULL for zero size dynamic/external buffer.
*/
#if defined(DUK_USE_HEAPPTR16)
-#define DUK_HBUFFER_GET_DATA_PTR(heap,x) ( \
- DUK_HBUFFER_HAS_DYNAMIC((x)) ? \
- ( \
- DUK_HBUFFER_HAS_EXTERNAL((x)) ? \
- DUK_HBUFFER_EXTERNAL_GET_DATA_PTR((heap), (duk_hbuffer_external *) (x)) : \
- DUK_HBUFFER_DYNAMIC_GET_DATA_PTR((heap), (duk_hbuffer_dynamic *) (x)) \
- ) : \
- DUK_HBUFFER_FIXED_GET_DATA_PTR((heap), (duk_hbuffer_fixed *) (void *) (x)) \
- )
+#define DUK_HBUFFER_GET_DATA_PTR(heap, x) \
+ (DUK_HBUFFER_HAS_DYNAMIC((x)) ? \
+ (DUK_HBUFFER_HAS_EXTERNAL((x)) ? DUK_HBUFFER_EXTERNAL_GET_DATA_PTR((heap), (duk_hbuffer_external *) (x)) : \
+ DUK_HBUFFER_DYNAMIC_GET_DATA_PTR((heap), (duk_hbuffer_dynamic *) (x))) : \
+ DUK_HBUFFER_FIXED_GET_DATA_PTR((heap), (duk_hbuffer_fixed *) (void *) (x)))
#else
/* Without heap pointer compression duk_hbuffer_dynamic and duk_hbuffer_external
* have the same layout so checking for fixed vs. dynamic (or external) is enough.
*/
-#define DUK_HBUFFER_GET_DATA_PTR(heap,x) ( \
- DUK_HBUFFER_HAS_DYNAMIC((x)) ? \
- DUK_HBUFFER_DYNAMIC_GET_DATA_PTR((heap), (duk_hbuffer_dynamic *) (x)) : \
- DUK_HBUFFER_FIXED_GET_DATA_PTR((heap), (duk_hbuffer_fixed *) (void *) (x)) \
- )
+#define DUK_HBUFFER_GET_DATA_PTR(heap, x) \
+ (DUK_HBUFFER_HAS_DYNAMIC((x)) ? DUK_HBUFFER_DYNAMIC_GET_DATA_PTR((heap), (duk_hbuffer_dynamic *) (x)) : \
+ DUK_HBUFFER_FIXED_GET_DATA_PTR((heap), (duk_hbuffer_fixed *) (void *) (x)))
#endif
/* Validity assert. */
#if defined(DUK_USE_ASSERTIONS)
DUK_INTERNAL_DECL void duk_hbuffer_assert_valid(duk_hbuffer *h);
-#define DUK_HBUFFER_ASSERT_VALID(h) do { duk_hbuffer_assert_valid((h)); } while (0)
+#define DUK_HBUFFER_ASSERT_VALID(h) \
+ do { \
+ duk_hbuffer_assert_valid((h)); \
+ } while (0)
#else
-#define DUK_HBUFFER_ASSERT_VALID(h) do {} while (0)
+#define DUK_HBUFFER_ASSERT_VALID(h) \
+ do { \
+ } while (0)
#endif
/*
@@ -8258,9 +8839,9 @@ struct duk_hbuffer_fixed {
*/
}
#if (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_GCC_ATTR)
-__attribute__ ((aligned (8)))
+__attribute__((aligned(8)))
#elif (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_CLANG_ATTR)
-__attribute__ ((aligned (8)))
+__attribute__((aligned(8)))
#endif
;
#if (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_MSVC_PRAGMA)
@@ -8283,7 +8864,7 @@ struct duk_hbuffer_dynamic {
#if defined(DUK_USE_HEAPPTR16)
/* Stored in duk_heaphdr h_extra16. */
#else
- void *curr_alloc; /* may be NULL if alloc_size == 0 */
+ void *curr_alloc; /* may be NULL if alloc_size == 0 */
#endif
/*
@@ -8312,7 +8893,7 @@ struct duk_hbuffer_external {
/* Cannot be compressed as a heap pointer because may point to
* an arbitrary address.
*/
- void *curr_alloc; /* may be NULL if alloc_size == 0 */
+ void *curr_alloc; /* may be NULL if alloc_size == 0 */
};
/*
@@ -8320,13 +8901,13 @@ struct duk_hbuffer_external {
*/
DUK_INTERNAL_DECL duk_hbuffer *duk_hbuffer_alloc(duk_heap *heap, duk_size_t size, duk_small_uint_t flags, void **out_bufdata);
-DUK_INTERNAL_DECL void *duk_hbuffer_get_dynalloc_ptr(duk_heap *heap, void *ud); /* indirect allocs */
+DUK_INTERNAL_DECL void *duk_hbuffer_get_dynalloc_ptr(duk_heap *heap, void *ud); /* indirect allocs */
/* dynamic buffer ops */
DUK_INTERNAL_DECL void duk_hbuffer_resize(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t new_size);
DUK_INTERNAL_DECL void duk_hbuffer_reset(duk_hthread *thr, duk_hbuffer_dynamic *buf);
-#endif /* DUK_HBUFFER_H_INCLUDED */
+#endif /* DUK_HBUFFER_H_INCLUDED */
/* #include duk_hproxy.h */
/*
* Proxy object representation.
@@ -8337,9 +8918,14 @@ DUK_INTERNAL_DECL void duk_hbuffer_reset(duk_hthread *thr, duk_hbuffer_dynamic *
#if defined(DUK_USE_ASSERTIONS)
DUK_INTERNAL_DECL void duk_hproxy_assert_valid(duk_hproxy *h);
-#define DUK_HPROXY_ASSERT_VALID(h) do { duk_hproxy_assert_valid((h)); } while (0)
+#define DUK_HPROXY_ASSERT_VALID(h) \
+ do { \
+ duk_hproxy_assert_valid((h)); \
+ } while (0)
#else
-#define DUK_HPROXY_ASSERT_VALID(h) do {} while (0)
+#define DUK_HPROXY_ASSERT_VALID(h) \
+ do { \
+ } while (0)
#endif
struct duk_hproxy {
@@ -8353,7 +8939,7 @@ struct duk_hproxy {
duk_hobject *handler;
};
-#endif /* DUK_HPROXY_H_INCLUDED */
+#endif /* DUK_HPROXY_H_INCLUDED */
/* #include duk_heap.h */
/*
* Heap structure.
@@ -8371,46 +8957,50 @@ struct duk_hproxy {
* Heap flags
*/
-#define DUK_HEAP_FLAG_MARKANDSWEEP_RECLIMIT_REACHED (1U << 0) /* mark-and-sweep marking reached a recursion limit and must use multi-pass marking */
-#define DUK_HEAP_FLAG_INTERRUPT_RUNNING (1U << 1) /* executor interrupt running (used to avoid nested interrupts) */
-#define DUK_HEAP_FLAG_FINALIZER_NORESCUE (1U << 2) /* heap destruction ongoing, finalizer rescue no longer possible */
-#define DUK_HEAP_FLAG_DEBUGGER_PAUSED (1U << 3) /* debugger is paused: talk with debug client until step/resume */
+#define DUK_HEAP_FLAG_MARKANDSWEEP_RECLIMIT_REACHED \
+ (1U << 0) /* mark-and-sweep marking reached a recursion limit and must use multi-pass marking */
+#define DUK_HEAP_FLAG_INTERRUPT_RUNNING (1U << 1) /* executor interrupt running (used to avoid nested interrupts) */
+#define DUK_HEAP_FLAG_FINALIZER_NORESCUE (1U << 2) /* heap destruction ongoing, finalizer rescue no longer possible */
+#define DUK_HEAP_FLAG_DEBUGGER_PAUSED (1U << 3) /* debugger is paused: talk with debug client until step/resume */
-#define DUK__HEAP_HAS_FLAGS(heap,bits) ((heap)->flags & (bits))
-#define DUK__HEAP_SET_FLAGS(heap,bits) do { \
+#define DUK__HEAP_HAS_FLAGS(heap, bits) ((heap)->flags & (bits))
+#define DUK__HEAP_SET_FLAGS(heap, bits) \
+ do { \
(heap)->flags |= (bits); \
} while (0)
-#define DUK__HEAP_CLEAR_FLAGS(heap,bits) do { \
+#define DUK__HEAP_CLEAR_FLAGS(heap, bits) \
+ do { \
(heap)->flags &= ~(bits); \
} while (0)
-#define DUK_HEAP_HAS_MARKANDSWEEP_RECLIMIT_REACHED(heap) DUK__HEAP_HAS_FLAGS((heap), DUK_HEAP_FLAG_MARKANDSWEEP_RECLIMIT_REACHED)
-#define DUK_HEAP_HAS_INTERRUPT_RUNNING(heap) DUK__HEAP_HAS_FLAGS((heap), DUK_HEAP_FLAG_INTERRUPT_RUNNING)
-#define DUK_HEAP_HAS_FINALIZER_NORESCUE(heap) DUK__HEAP_HAS_FLAGS((heap), DUK_HEAP_FLAG_FINALIZER_NORESCUE)
-#define DUK_HEAP_HAS_DEBUGGER_PAUSED(heap) DUK__HEAP_HAS_FLAGS((heap), DUK_HEAP_FLAG_DEBUGGER_PAUSED)
+#define DUK_HEAP_HAS_MARKANDSWEEP_RECLIMIT_REACHED(heap) DUK__HEAP_HAS_FLAGS((heap), DUK_HEAP_FLAG_MARKANDSWEEP_RECLIMIT_REACHED)
+#define DUK_HEAP_HAS_INTERRUPT_RUNNING(heap) DUK__HEAP_HAS_FLAGS((heap), DUK_HEAP_FLAG_INTERRUPT_RUNNING)
+#define DUK_HEAP_HAS_FINALIZER_NORESCUE(heap) DUK__HEAP_HAS_FLAGS((heap), DUK_HEAP_FLAG_FINALIZER_NORESCUE)
+#define DUK_HEAP_HAS_DEBUGGER_PAUSED(heap) DUK__HEAP_HAS_FLAGS((heap), DUK_HEAP_FLAG_DEBUGGER_PAUSED)
-#define DUK_HEAP_SET_MARKANDSWEEP_RECLIMIT_REACHED(heap) DUK__HEAP_SET_FLAGS((heap), DUK_HEAP_FLAG_MARKANDSWEEP_RECLIMIT_REACHED)
-#define DUK_HEAP_SET_INTERRUPT_RUNNING(heap) DUK__HEAP_SET_FLAGS((heap), DUK_HEAP_FLAG_INTERRUPT_RUNNING)
-#define DUK_HEAP_SET_FINALIZER_NORESCUE(heap) DUK__HEAP_SET_FLAGS((heap), DUK_HEAP_FLAG_FINALIZER_NORESCUE)
-#define DUK_HEAP_SET_DEBUGGER_PAUSED(heap) DUK__HEAP_SET_FLAGS((heap), DUK_HEAP_FLAG_DEBUGGER_PAUSED)
+#define DUK_HEAP_SET_MARKANDSWEEP_RECLIMIT_REACHED(heap) DUK__HEAP_SET_FLAGS((heap), DUK_HEAP_FLAG_MARKANDSWEEP_RECLIMIT_REACHED)
+#define DUK_HEAP_SET_INTERRUPT_RUNNING(heap) DUK__HEAP_SET_FLAGS((heap), DUK_HEAP_FLAG_INTERRUPT_RUNNING)
+#define DUK_HEAP_SET_FINALIZER_NORESCUE(heap) DUK__HEAP_SET_FLAGS((heap), DUK_HEAP_FLAG_FINALIZER_NORESCUE)
+#define DUK_HEAP_SET_DEBUGGER_PAUSED(heap) DUK__HEAP_SET_FLAGS((heap), DUK_HEAP_FLAG_DEBUGGER_PAUSED)
-#define DUK_HEAP_CLEAR_MARKANDSWEEP_RECLIMIT_REACHED(heap) DUK__HEAP_CLEAR_FLAGS((heap), DUK_HEAP_FLAG_MARKANDSWEEP_RECLIMIT_REACHED)
-#define DUK_HEAP_CLEAR_INTERRUPT_RUNNING(heap) DUK__HEAP_CLEAR_FLAGS((heap), DUK_HEAP_FLAG_INTERRUPT_RUNNING)
-#define DUK_HEAP_CLEAR_FINALIZER_NORESCUE(heap) DUK__HEAP_CLEAR_FLAGS((heap), DUK_HEAP_FLAG_FINALIZER_NORESCUE)
-#define DUK_HEAP_CLEAR_DEBUGGER_PAUSED(heap) DUK__HEAP_CLEAR_FLAGS((heap), DUK_HEAP_FLAG_DEBUGGER_PAUSED)
+#define DUK_HEAP_CLEAR_MARKANDSWEEP_RECLIMIT_REACHED(heap) \
+ DUK__HEAP_CLEAR_FLAGS((heap), DUK_HEAP_FLAG_MARKANDSWEEP_RECLIMIT_REACHED)
+#define DUK_HEAP_CLEAR_INTERRUPT_RUNNING(heap) DUK__HEAP_CLEAR_FLAGS((heap), DUK_HEAP_FLAG_INTERRUPT_RUNNING)
+#define DUK_HEAP_CLEAR_FINALIZER_NORESCUE(heap) DUK__HEAP_CLEAR_FLAGS((heap), DUK_HEAP_FLAG_FINALIZER_NORESCUE)
+#define DUK_HEAP_CLEAR_DEBUGGER_PAUSED(heap) DUK__HEAP_CLEAR_FLAGS((heap), DUK_HEAP_FLAG_DEBUGGER_PAUSED)
/*
* Longjmp types, also double as identifying continuation type for a rethrow (in 'finally')
*/
-#define DUK_LJ_TYPE_UNKNOWN 0 /* unused */
-#define DUK_LJ_TYPE_THROW 1 /* value1 -> error object */
-#define DUK_LJ_TYPE_YIELD 2 /* value1 -> yield value, iserror -> error / normal */
-#define DUK_LJ_TYPE_RESUME 3 /* value1 -> resume value, value2 -> resumee thread, iserror -> error/normal */
-#define DUK_LJ_TYPE_BREAK 4 /* value1 -> label number, pseudo-type to indicate a break continuation (for ENDFIN) */
-#define DUK_LJ_TYPE_CONTINUE 5 /* value1 -> label number, pseudo-type to indicate a continue continuation (for ENDFIN) */
-#define DUK_LJ_TYPE_RETURN 6 /* value1 -> return value, pseudo-type to indicate a return continuation (for ENDFIN) */
-#define DUK_LJ_TYPE_NORMAL 7 /* no value, pseudo-type to indicate a normal continuation (for ENDFIN) */
+#define DUK_LJ_TYPE_UNKNOWN 0 /* unused */
+#define DUK_LJ_TYPE_THROW 1 /* value1 -> error object */
+#define DUK_LJ_TYPE_YIELD 2 /* value1 -> yield value, iserror -> error / normal */
+#define DUK_LJ_TYPE_RESUME 3 /* value1 -> resume value, value2 -> resumee thread, iserror -> error/normal */
+#define DUK_LJ_TYPE_BREAK 4 /* value1 -> label number, pseudo-type to indicate a break continuation (for ENDFIN) */
+#define DUK_LJ_TYPE_CONTINUE 5 /* value1 -> label number, pseudo-type to indicate a continue continuation (for ENDFIN) */
+#define DUK_LJ_TYPE_RETURN 6 /* value1 -> return value, pseudo-type to indicate a return continuation (for ENDFIN) */
+#define DUK_LJ_TYPE_NORMAL 7 /* no value, pseudo-type to indicate a normal continuation (for ENDFIN) */
/*
* Mark-and-sweep flags
@@ -8423,22 +9013,19 @@ struct duk_hproxy {
/* Emergency mark-and-sweep: try extra hard, even at the cost of
* performance.
*/
-#define DUK_MS_FLAG_EMERGENCY (1U << 0)
-
-/* Voluntary mark-and-sweep: triggered periodically. */
-#define DUK_MS_FLAG_VOLUNTARY (1U << 1)
+#define DUK_MS_FLAG_EMERGENCY (1U << 0)
/* Postpone rescue decisions for reachable objects with FINALIZED set.
* Used during finalize_list processing to avoid incorrect rescue
* decisions due to finalize_list being a reachability root.
*/
-#define DUK_MS_FLAG_POSTPONE_RESCUE (1U << 2)
+#define DUK_MS_FLAG_POSTPONE_RESCUE (1U << 1)
/* Don't compact objects; needed during object property table resize
* to prevent a recursive resize. It would suffice to protect only the
* current object being resized, but this is not yet implemented.
*/
-#define DUK_MS_FLAG_NO_OBJECT_COMPACTION (1U << 3)
+#define DUK_MS_FLAG_NO_OBJECT_COMPACTION (1U << 2)
/*
* Thread switching
@@ -8449,9 +9036,10 @@ struct duk_hproxy {
*/
#if defined(DUK_USE_INTERRUPT_COUNTER)
-#define DUK_HEAP_SWITCH_THREAD(heap,newthr) duk_heap_switch_thread((heap), (newthr))
+#define DUK_HEAP_SWITCH_THREAD(heap, newthr) duk_heap_switch_thread((heap), (newthr))
#else
-#define DUK_HEAP_SWITCH_THREAD(heap,newthr) do { \
+#define DUK_HEAP_SWITCH_THREAD(heap, newthr) \
+ do { \
(heap)->curr_thread = (newthr); \
} while (0)
#endif
@@ -8461,11 +9049,14 @@ struct duk_hproxy {
*/
#if defined(DUK_USE_DEBUG)
-#define DUK_STATS_INC(heap,fieldname) do { \
+#define DUK_STATS_INC(heap, fieldname) \
+ do { \
(heap)->fieldname += 1; \
} while (0)
#else
-#define DUK_STATS_INC(heap,fieldname) do {} while (0)
+#define DUK_STATS_INC(heap, fieldname) \
+ do { \
+ } while (0)
#endif
/*
@@ -8483,36 +9074,41 @@ struct duk_hproxy {
* only during init phases).
*/
#if defined(DUK_USE_REFERENCE_COUNTING)
-#define DUK_HEAP_MARK_AND_SWEEP_TRIGGER_MULT 12800L /* 50x heap size */
-#define DUK_HEAP_MARK_AND_SWEEP_TRIGGER_ADD 1024L
-#define DUK_HEAP_MARK_AND_SWEEP_TRIGGER_SKIP 256L
+#define DUK_HEAP_MARK_AND_SWEEP_TRIGGER_MULT 12800L /* 50x heap size */
+#define DUK_HEAP_MARK_AND_SWEEP_TRIGGER_ADD 1024L
+#define DUK_HEAP_MARK_AND_SWEEP_TRIGGER_SKIP 256L
#else
-#define DUK_HEAP_MARK_AND_SWEEP_TRIGGER_MULT 256L /* 1x heap size */
-#define DUK_HEAP_MARK_AND_SWEEP_TRIGGER_ADD 1024L
-#define DUK_HEAP_MARK_AND_SWEEP_TRIGGER_SKIP 256L
+#define DUK_HEAP_MARK_AND_SWEEP_TRIGGER_MULT 256L /* 1x heap size */
+#define DUK_HEAP_MARK_AND_SWEEP_TRIGGER_ADD 1024L
+#define DUK_HEAP_MARK_AND_SWEEP_TRIGGER_SKIP 256L
#endif
/* GC torture. */
#if defined(DUK_USE_GC_TORTURE)
-#define DUK_GC_TORTURE(heap) do { duk_heap_mark_and_sweep((heap), 0); } while (0)
+#define DUK_GC_TORTURE(heap) \
+ do { \
+ duk_heap_mark_and_sweep((heap), 0); \
+ } while (0)
#else
-#define DUK_GC_TORTURE(heap) do { } while (0)
+#define DUK_GC_TORTURE(heap) \
+ do { \
+ } while (0)
#endif
/* Stringcache is used for speeding up char-offset-to-byte-offset
* translations for non-ASCII strings.
*/
-#define DUK_HEAP_STRCACHE_SIZE 4
-#define DUK_HEAP_STRINGCACHE_NOCACHE_LIMIT 16 /* strings up to the this length are not cached */
+#define DUK_HEAP_STRCACHE_SIZE 4
+#define DUK_HEAP_STRINGCACHE_NOCACHE_LIMIT 16 /* strings up to the this length are not cached */
/* Some list management macros. */
-#define DUK_HEAP_INSERT_INTO_HEAP_ALLOCATED(heap,hdr) duk_heap_insert_into_heap_allocated((heap), (hdr))
+#define DUK_HEAP_INSERT_INTO_HEAP_ALLOCATED(heap, hdr) duk_heap_insert_into_heap_allocated((heap), (hdr))
#if defined(DUK_USE_REFERENCE_COUNTING)
-#define DUK_HEAP_REMOVE_FROM_HEAP_ALLOCATED(heap,hdr) duk_heap_remove_from_heap_allocated((heap), (hdr))
+#define DUK_HEAP_REMOVE_FROM_HEAP_ALLOCATED(heap, hdr) duk_heap_remove_from_heap_allocated((heap), (hdr))
#endif
#if defined(DUK_USE_FINALIZER_SUPPORT)
-#define DUK_HEAP_INSERT_INTO_FINALIZE_LIST(heap,hdr) duk_heap_insert_into_finalize_list((heap), (hdr))
-#define DUK_HEAP_REMOVE_FROM_FINALIZE_LIST(heap,hdr) duk_heap_remove_from_finalize_list((heap), (hdr))
+#define DUK_HEAP_INSERT_INTO_FINALIZE_LIST(heap, hdr) duk_heap_insert_into_finalize_list((heap), (hdr))
+#define DUK_HEAP_REMOVE_FROM_FINALIZE_LIST(heap, hdr) duk_heap_remove_from_finalize_list((heap), (hdr))
#endif
/*
@@ -8521,30 +9117,24 @@ struct duk_hproxy {
/* heap string indices are autogenerated in duk_strings.h */
#if defined(DUK_USE_ROM_STRINGS)
-#define DUK_HEAP_GET_STRING(heap,idx) \
- ((duk_hstring *) DUK_LOSE_CONST(duk_rom_strings_stridx[(idx)]))
-#else /* DUK_USE_ROM_STRINGS */
+#define DUK_HEAP_GET_STRING(heap, idx) ((duk_hstring *) DUK_LOSE_CONST(duk_rom_strings_stridx[(idx)]))
+#else /* DUK_USE_ROM_STRINGS */
#if defined(DUK_USE_HEAPPTR16)
-#define DUK_HEAP_GET_STRING(heap,idx) \
- ((duk_hstring *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (heap)->strs16[(idx)]))
+#define DUK_HEAP_GET_STRING(heap, idx) ((duk_hstring *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (heap)->strs16[(idx)]))
#else
-#define DUK_HEAP_GET_STRING(heap,idx) \
- ((heap)->strs[(idx)])
+#define DUK_HEAP_GET_STRING(heap, idx) ((heap)->strs[(idx)])
#endif
-#endif /* DUK_USE_ROM_STRINGS */
+#endif /* DUK_USE_ROM_STRINGS */
/*
* Raw memory calls: relative to heap, but no GC interaction
*/
-#define DUK_ALLOC_RAW(heap,size) \
- ((heap)->alloc_func((heap)->heap_udata, (size)))
+#define DUK_ALLOC_RAW(heap, size) ((heap)->alloc_func((heap)->heap_udata, (size)))
-#define DUK_REALLOC_RAW(heap,ptr,newsize) \
- ((heap)->realloc_func((heap)->heap_udata, (void *) (ptr), (newsize)))
+#define DUK_REALLOC_RAW(heap, ptr, newsize) ((heap)->realloc_func((heap)->heap_udata, (void *) (ptr), (newsize)))
-#define DUK_FREE_RAW(heap,ptr) \
- ((heap)->free_func((heap)->heap_udata, (void *) (ptr)))
+#define DUK_FREE_RAW(heap, ptr) ((heap)->free_func((heap)->heap_udata, (void *) (ptr)))
/*
* Memory calls: relative to heap, GC interaction, but no error throwing.
@@ -8577,11 +9167,11 @@ struct duk_hproxy {
/* callback for indirect reallocs, request for current pointer */
typedef void *(*duk_mem_getptr)(duk_heap *heap, void *ud);
-#define DUK_ALLOC(heap,size) duk_heap_mem_alloc((heap), (size))
-#define DUK_ALLOC_ZEROED(heap,size) duk_heap_mem_alloc_zeroed((heap), (size))
-#define DUK_REALLOC(heap,ptr,newsize) duk_heap_mem_realloc((heap), (ptr), (newsize))
-#define DUK_REALLOC_INDIRECT(heap,cb,ud,newsize) duk_heap_mem_realloc_indirect((heap), (cb), (ud), (newsize))
-#define DUK_FREE(heap,ptr) duk_heap_mem_free((heap), (ptr))
+#define DUK_ALLOC(heap, size) duk_heap_mem_alloc((heap), (size))
+#define DUK_ALLOC_ZEROED(heap, size) duk_heap_mem_alloc_zeroed((heap), (size))
+#define DUK_REALLOC(heap, ptr, newsize) duk_heap_mem_realloc((heap), (ptr), (newsize))
+#define DUK_REALLOC_INDIRECT(heap, cb, ud, newsize) duk_heap_mem_realloc_indirect((heap), (cb), (ud), (newsize))
+#define DUK_FREE(heap, ptr) duk_heap_mem_free((heap), (ptr))
/*
* Checked allocation, relative to a thread
@@ -8590,24 +9180,26 @@ typedef void *(*duk_mem_getptr)(duk_heap *heap, void *ud);
* for convenience.
*/
-#define DUK_ALLOC_CHECKED(thr,size) duk_heap_mem_alloc_checked((thr), (size))
-#define DUK_ALLOC_CHECKED_ZEROED(thr,size) duk_heap_mem_alloc_checked_zeroed((thr), (size))
-#define DUK_FREE_CHECKED(thr,ptr) duk_heap_mem_free((thr)->heap, (ptr))
+#define DUK_ALLOC_CHECKED(thr, size) duk_heap_mem_alloc_checked((thr), (size))
+#define DUK_ALLOC_CHECKED_ZEROED(thr, size) duk_heap_mem_alloc_checked_zeroed((thr), (size))
+#define DUK_FREE_CHECKED(thr, ptr) duk_heap_mem_free((thr)->heap, (ptr))
/*
* Memory constants
*/
-#define DUK_HEAP_ALLOC_FAIL_MARKANDSWEEP_LIMIT 10 /* Retry allocation after mark-and-sweep for this
- * many times. A single mark-and-sweep round is
- * not guaranteed to free all unreferenced memory
- * because of finalization (in fact, ANY number of
- * rounds is strictly not enough).
- */
+#define DUK_HEAP_ALLOC_FAIL_MARKANDSWEEP_LIMIT \
+ 10 /* Retry allocation after mark-and-sweep for this \
+ * many times. A single mark-and-sweep round is \
+ * not guaranteed to free all unreferenced memory \
+ * because of finalization (in fact, ANY number of \
+ * rounds is strictly not enough). \
+ */
-#define DUK_HEAP_ALLOC_FAIL_MARKANDSWEEP_EMERGENCY_LIMIT 3 /* Starting from this round, use emergency mode
- * for mark-and-sweep.
- */
+#define DUK_HEAP_ALLOC_FAIL_MARKANDSWEEP_EMERGENCY_LIMIT \
+ 3 /* Starting from this round, use emergency mode \
+ * for mark-and-sweep. \
+ */
/*
* Debugger support
@@ -8616,26 +9208,26 @@ typedef void *(*duk_mem_getptr)(duk_heap *heap, void *ud);
/* Maximum number of breakpoints. Only breakpoints that are set are
* consulted so increasing this has no performance impact.
*/
-#define DUK_HEAP_MAX_BREAKPOINTS 16
+#define DUK_HEAP_MAX_BREAKPOINTS 16
/* Opcode interval for a Date-based status/peek rate limit check. Only
* relevant when debugger is attached. Requesting a timestamp may be a
* slow operation on some platforms so this shouldn't be too low. On the
* other hand a high value makes Duktape react to a pause request slowly.
*/
-#define DUK_HEAP_DBG_RATELIMIT_OPCODES 4000
+#define DUK_HEAP_DBG_RATELIMIT_OPCODES 4000
/* Milliseconds between status notify and transport peeks. */
-#define DUK_HEAP_DBG_RATELIMIT_MILLISECS 200
+#define DUK_HEAP_DBG_RATELIMIT_MILLISECS 200
/* Debugger pause flags. */
-#define DUK_PAUSE_FLAG_ONE_OPCODE (1U << 0) /* pause when a single opcode has been executed */
-#define DUK_PAUSE_FLAG_ONE_OPCODE_ACTIVE (1U << 1) /* one opcode pause actually active; artifact of current implementation */
-#define DUK_PAUSE_FLAG_LINE_CHANGE (1U << 2) /* pause when current line number changes */
-#define DUK_PAUSE_FLAG_FUNC_ENTRY (1U << 3) /* pause when entering a function */
-#define DUK_PAUSE_FLAG_FUNC_EXIT (1U << 4) /* pause when exiting current function */
-#define DUK_PAUSE_FLAG_CAUGHT_ERROR (1U << 5) /* pause when about to throw an error that is caught */
-#define DUK_PAUSE_FLAG_UNCAUGHT_ERROR (1U << 6) /* pause when about to throw an error that won't be caught */
+#define DUK_PAUSE_FLAG_ONE_OPCODE (1U << 0) /* pause when a single opcode has been executed */
+#define DUK_PAUSE_FLAG_ONE_OPCODE_ACTIVE (1U << 1) /* one opcode pause actually active; artifact of current implementation */
+#define DUK_PAUSE_FLAG_LINE_CHANGE (1U << 2) /* pause when current line number changes */
+#define DUK_PAUSE_FLAG_FUNC_ENTRY (1U << 3) /* pause when entering a function */
+#define DUK_PAUSE_FLAG_FUNC_EXIT (1U << 4) /* pause when exiting current function */
+#define DUK_PAUSE_FLAG_CAUGHT_ERROR (1U << 5) /* pause when about to throw an error that is caught */
+#define DUK_PAUSE_FLAG_UNCAUGHT_ERROR (1U << 6) /* pause when about to throw an error that won't be caught */
struct duk_breakpoint {
duk_hstring *filename;
@@ -8663,21 +9255,23 @@ struct duk_strcache_entry {
*/
struct duk_ljstate {
- duk_jmpbuf *jmpbuf_ptr; /* current setjmp() catchpoint */
- duk_small_uint_t type; /* longjmp type */
- duk_bool_t iserror; /* isError flag for yield */
- duk_tval value1; /* 1st related value (type specific) */
- duk_tval value2; /* 2nd related value (type specific) */
+ duk_jmpbuf *jmpbuf_ptr; /* current setjmp() catchpoint */
+ duk_small_uint_t type; /* longjmp type */
+ duk_bool_t iserror; /* isError flag for yield */
+ duk_tval value1; /* 1st related value (type specific) */
+ duk_tval value2; /* 2nd related value (type specific) */
};
-#define DUK_ASSERT_LJSTATE_UNSET(heap) do { \
+#define DUK_ASSERT_LJSTATE_UNSET(heap) \
+ do { \
DUK_ASSERT(heap != NULL); \
DUK_ASSERT(heap->lj.type == DUK_LJ_TYPE_UNKNOWN); \
DUK_ASSERT(heap->lj.iserror == 0); \
DUK_ASSERT(DUK_TVAL_IS_UNDEFINED(&heap->lj.value1)); \
DUK_ASSERT(DUK_TVAL_IS_UNDEFINED(&heap->lj.value2)); \
} while (0)
-#define DUK_ASSERT_LJSTATE_SET(heap) do { \
+#define DUK_ASSERT_LJSTATE_SET(heap) \
+ do { \
DUK_ASSERT(heap != NULL); \
DUK_ASSERT(heap->lj.type != DUK_LJ_TYPE_UNKNOWN); \
} while (0)
@@ -8697,9 +9291,14 @@ struct duk_litcache_entry {
#if defined(DUK_USE_ASSERTIONS)
DUK_INTERNAL_DECL void duk_heap_assert_valid(duk_heap *heap);
-#define DUK_HEAP_ASSERT_VALID(heap) do { duk_heap_assert_valid((heap)); } while (0)
+#define DUK_HEAP_ASSERT_VALID(heap) \
+ do { \
+ duk_heap_assert_valid((heap)); \
+ } while (0)
#else
-#define DUK_HEAP_ASSERT_VALID(heap) do {} while (0)
+#define DUK_HEAP_ASSERT_VALID(heap) \
+ do { \
+ } while (0)
#endif
struct duk_heap {
@@ -8853,9 +9452,9 @@ struct duk_heap {
/* Random number state for duk_util_tinyrandom.c. */
#if !defined(DUK_USE_GET_RANDOM_DOUBLE)
#if defined(DUK_USE_PREFER_SIZE) || !defined(DUK_USE_64BIT_OPS)
- duk_uint32_t rnd_state; /* State for Shamir's three-op algorithm */
+ duk_uint32_t rnd_state; /* State for Shamir's three-op algorithm */
#else
- duk_uint64_t rnd_state[2]; /* State for xoroshiro128+ */
+ duk_uint64_t rnd_state[2]; /* State for xoroshiro128+ */
#endif
#endif
@@ -8878,8 +9477,8 @@ struct duk_heap {
/* Debugger state. */
#if defined(DUK_USE_DEBUGGER_SUPPORT)
/* Callbacks and udata; dbg_read_cb != NULL is used to indicate attached state. */
- duk_debug_read_function dbg_read_cb; /* required, NULL implies detached */
- duk_debug_write_function dbg_write_cb; /* required */
+ duk_debug_read_function dbg_read_cb; /* required, NULL implies detached */
+ duk_debug_write_function dbg_write_cb; /* required */
duk_debug_peek_function dbg_peek_cb;
duk_debug_read_flush_function dbg_read_flush_cb;
duk_debug_write_flush_function dbg_write_flush_cb;
@@ -8888,29 +9487,32 @@ struct duk_heap {
void *dbg_udata;
/* The following are only relevant when debugger is attached. */
- duk_bool_t dbg_processing; /* currently processing messages or breakpoints: don't enter message processing recursively (e.g. no breakpoints when processing debugger eval) */
- duk_bool_t dbg_state_dirty; /* resend state next time executor is about to run */
- duk_bool_t dbg_force_restart; /* force executor restart to recheck breakpoints; used to handle function returns (see GH-303) */
- duk_bool_t dbg_detaching; /* debugger detaching; used to avoid calling detach handler recursively */
- duk_small_uint_t dbg_pause_flags; /* flags for automatic pause behavior */
- duk_activation *dbg_pause_act; /* activation related to pause behavior (pause on line change, function entry/exit) */
- duk_uint32_t dbg_pause_startline; /* starting line number for line change related pause behavior */
- duk_breakpoint dbg_breakpoints[DUK_HEAP_MAX_BREAKPOINTS]; /* breakpoints: [0,breakpoint_count[ gc reachable */
+ duk_bool_t dbg_processing; /* currently processing messages or breakpoints: don't enter message processing recursively (e.g.
+ no breakpoints when processing debugger eval) */
+ duk_bool_t dbg_state_dirty; /* resend state next time executor is about to run */
+ duk_bool_t
+ dbg_force_restart; /* force executor restart to recheck breakpoints; used to handle function returns (see GH-303) */
+ duk_bool_t dbg_detaching; /* debugger detaching; used to avoid calling detach handler recursively */
+ duk_small_uint_t dbg_pause_flags; /* flags for automatic pause behavior */
+ duk_activation *dbg_pause_act; /* activation related to pause behavior (pause on line change, function entry/exit) */
+ duk_uint32_t dbg_pause_startline; /* starting line number for line change related pause behavior */
+ duk_breakpoint dbg_breakpoints[DUK_HEAP_MAX_BREAKPOINTS]; /* breakpoints: [0,breakpoint_count[ gc reachable */
duk_small_uint_t dbg_breakpoint_count;
- duk_breakpoint *dbg_breakpoints_active[DUK_HEAP_MAX_BREAKPOINTS + 1]; /* currently active breakpoints: NULL term, borrowed pointers */
+ duk_breakpoint
+ *dbg_breakpoints_active[DUK_HEAP_MAX_BREAKPOINTS + 1]; /* currently active breakpoints: NULL term, borrowed pointers */
/* XXX: make active breakpoints actual copies instead of pointers? */
/* These are for rate limiting Status notifications and transport peeking. */
- duk_uint_t dbg_exec_counter; /* cumulative opcode execution count (overflows are OK) */
- duk_uint_t dbg_last_counter; /* value of dbg_exec_counter when we last did a Date-based check */
- duk_double_t dbg_last_time; /* time when status/peek was last done (Date-based rate limit) */
+ duk_uint_t dbg_exec_counter; /* cumulative opcode execution count (overflows are OK) */
+ duk_uint_t dbg_last_counter; /* value of dbg_exec_counter when we last did a Date-based check */
+ duk_double_t dbg_last_time; /* time when status/peek was last done (Date-based rate limit) */
/* Used to support single-byte stream lookahead. */
duk_bool_t dbg_have_next_byte;
duk_uint8_t dbg_next_byte;
-#endif /* DUK_USE_DEBUGGER_SUPPORT */
+#endif /* DUK_USE_DEBUGGER_SUPPORT */
#if defined(DUK_USE_ASSERTIONS)
- duk_bool_t dbg_calling_transport; /* transport call in progress, calling into Duktape forbidden */
+ duk_bool_t dbg_calling_transport; /* transport call in progress, calling into Duktape forbidden */
#endif
/* String intern table (weak refs). */
@@ -8919,12 +9521,12 @@ struct duk_heap {
#else
duk_hstring **strtable;
#endif
- duk_uint32_t st_mask; /* mask for lookup, st_size - 1 */
- duk_uint32_t st_size; /* stringtable size */
+ duk_uint32_t st_mask; /* mask for lookup, st_size - 1 */
+ duk_uint32_t st_size; /* stringtable size */
#if (DUK_USE_STRTAB_MINSIZE != DUK_USE_STRTAB_MAXSIZE)
- duk_uint32_t st_count; /* string count for resize load factor checks */
+ duk_uint32_t st_count; /* string count for resize load factor checks */
#endif
- duk_bool_t st_resizing; /* string table is being resized; avoid recursive resize */
+ duk_bool_t st_resizing; /* string table is being resized; avoid recursive resize */
/* String access cache (codepoint offset -> byte offset) for fast string
* character looping; 'weak' reference which needs special handling in GC.
@@ -9038,7 +9640,9 @@ DUK_INTERNAL_DECL void duk_heap_switch_thread(duk_heap *heap, duk_hthread *new_t
DUK_INTERNAL_DECL duk_hstring *duk_heap_strtable_intern(duk_heap *heap, const duk_uint8_t *str, duk_uint32_t blen);
DUK_INTERNAL_DECL duk_hstring *duk_heap_strtable_intern_checked(duk_hthread *thr, const duk_uint8_t *str, duk_uint32_t len);
#if defined(DUK_USE_LITCACHE_SIZE)
-DUK_INTERNAL_DECL duk_hstring *duk_heap_strtable_intern_literal_checked(duk_hthread *thr, const duk_uint8_t *str, duk_uint32_t blen);
+DUK_INTERNAL_DECL duk_hstring *duk_heap_strtable_intern_literal_checked(duk_hthread *thr,
+ const duk_uint8_t *str,
+ duk_uint32_t blen);
#endif
DUK_INTERNAL_DECL duk_hstring *duk_heap_strtable_intern_u32(duk_heap *heap, duk_uint32_t val);
DUK_INTERNAL_DECL duk_hstring *duk_heap_strtable_intern_u32_checked(duk_hthread *thr, duk_uint32_t val);
@@ -9053,7 +9657,9 @@ DUK_INTERNAL void duk_heap_strtable_dump(duk_heap *heap);
#endif
DUK_INTERNAL_DECL void duk_heap_strcache_string_remove(duk_heap *heap, duk_hstring *h);
-DUK_INTERNAL_DECL duk_uint_fast32_t duk_heap_strcache_offset_char2byte(duk_hthread *thr, duk_hstring *h, duk_uint_fast32_t char_offset);
+DUK_INTERNAL_DECL duk_uint_fast32_t duk_heap_strcache_offset_char2byte(duk_hthread *thr,
+ duk_hstring *h,
+ duk_uint_fast32_t char_offset);
#if defined(DUK_USE_PROVIDE_DEFAULT_ALLOC_FUNCTIONS)
DUK_INTERNAL_DECL void *duk_default_alloc_function(void *udata, duk_size_t size);
@@ -9074,13 +9680,13 @@ DUK_INTERNAL_DECL void duk_heap_free_freelists(duk_heap *heap);
#if defined(DUK_USE_FINALIZER_SUPPORT)
DUK_INTERNAL_DECL void duk_heap_run_finalizer(duk_heap *heap, duk_hobject *obj);
DUK_INTERNAL_DECL void duk_heap_process_finalize_list(duk_heap *heap);
-#endif /* DUK_USE_FINALIZER_SUPPORT */
+#endif /* DUK_USE_FINALIZER_SUPPORT */
DUK_INTERNAL_DECL void duk_heap_mark_and_sweep(duk_heap *heap, duk_small_uint_t flags);
DUK_INTERNAL_DECL duk_uint32_t duk_heap_hashstring(duk_heap *heap, const duk_uint8_t *str, duk_size_t len);
-#endif /* DUK_HEAP_H_INCLUDED */
+#endif /* DUK_HEAP_H_INCLUDED */
/* #include duk_debugger.h */
#if !defined(DUK_DEBUGGER_H_INCLUDED)
#define DUK_DEBUGGER_H_INCLUDED
@@ -9088,77 +9694,77 @@ DUK_INTERNAL_DECL duk_uint32_t duk_heap_hashstring(duk_heap *heap, const duk_uin
/* Debugger protocol version is defined in the public API header. */
/* Initial bytes for markers. */
-#define DUK_DBG_IB_EOM 0x00
-#define DUK_DBG_IB_REQUEST 0x01
-#define DUK_DBG_IB_REPLY 0x02
-#define DUK_DBG_IB_ERROR 0x03
-#define DUK_DBG_IB_NOTIFY 0x04
+#define DUK_DBG_IB_EOM 0x00
+#define DUK_DBG_IB_REQUEST 0x01
+#define DUK_DBG_IB_REPLY 0x02
+#define DUK_DBG_IB_ERROR 0x03
+#define DUK_DBG_IB_NOTIFY 0x04
/* Other initial bytes. */
-#define DUK_DBG_IB_INT4 0x10
-#define DUK_DBG_IB_STR4 0x11
-#define DUK_DBG_IB_STR2 0x12
-#define DUK_DBG_IB_BUF4 0x13
-#define DUK_DBG_IB_BUF2 0x14
-#define DUK_DBG_IB_UNUSED 0x15
-#define DUK_DBG_IB_UNDEFINED 0x16
-#define DUK_DBG_IB_NULL 0x17
-#define DUK_DBG_IB_TRUE 0x18
-#define DUK_DBG_IB_FALSE 0x19
-#define DUK_DBG_IB_NUMBER 0x1a
-#define DUK_DBG_IB_OBJECT 0x1b
-#define DUK_DBG_IB_POINTER 0x1c
-#define DUK_DBG_IB_LIGHTFUNC 0x1d
-#define DUK_DBG_IB_HEAPPTR 0x1e
+#define DUK_DBG_IB_INT4 0x10
+#define DUK_DBG_IB_STR4 0x11
+#define DUK_DBG_IB_STR2 0x12
+#define DUK_DBG_IB_BUF4 0x13
+#define DUK_DBG_IB_BUF2 0x14
+#define DUK_DBG_IB_UNUSED 0x15
+#define DUK_DBG_IB_UNDEFINED 0x16
+#define DUK_DBG_IB_NULL 0x17
+#define DUK_DBG_IB_TRUE 0x18
+#define DUK_DBG_IB_FALSE 0x19
+#define DUK_DBG_IB_NUMBER 0x1a
+#define DUK_DBG_IB_OBJECT 0x1b
+#define DUK_DBG_IB_POINTER 0x1c
+#define DUK_DBG_IB_LIGHTFUNC 0x1d
+#define DUK_DBG_IB_HEAPPTR 0x1e
/* The short string/integer initial bytes starting from 0x60 don't have
* defines now.
*/
/* Error codes. */
-#define DUK_DBG_ERR_UNKNOWN 0x00
-#define DUK_DBG_ERR_UNSUPPORTED 0x01
-#define DUK_DBG_ERR_TOOMANY 0x02
-#define DUK_DBG_ERR_NOTFOUND 0x03
-#define DUK_DBG_ERR_APPLICATION 0x04
+#define DUK_DBG_ERR_UNKNOWN 0x00
+#define DUK_DBG_ERR_UNSUPPORTED 0x01
+#define DUK_DBG_ERR_TOOMANY 0x02
+#define DUK_DBG_ERR_NOTFOUND 0x03
+#define DUK_DBG_ERR_APPLICATION 0x04
/* Commands and notifys initiated by Duktape. */
-#define DUK_DBG_CMD_STATUS 0x01
-#define DUK_DBG_CMD_UNUSED_2 0x02 /* Duktape 1.x: print notify */
-#define DUK_DBG_CMD_UNUSED_3 0x03 /* Duktape 1.x: alert notify */
-#define DUK_DBG_CMD_UNUSED_4 0x04 /* Duktape 1.x: log notify */
-#define DUK_DBG_CMD_THROW 0x05
-#define DUK_DBG_CMD_DETACHING 0x06
-#define DUK_DBG_CMD_APPNOTIFY 0x07
+#define DUK_DBG_CMD_STATUS 0x01
+#define DUK_DBG_CMD_UNUSED_2 0x02 /* Duktape 1.x: print notify */
+#define DUK_DBG_CMD_UNUSED_3 0x03 /* Duktape 1.x: alert notify */
+#define DUK_DBG_CMD_UNUSED_4 0x04 /* Duktape 1.x: log notify */
+#define DUK_DBG_CMD_THROW 0x05
+#define DUK_DBG_CMD_DETACHING 0x06
+#define DUK_DBG_CMD_APPNOTIFY 0x07
/* Commands initiated by debug client. */
-#define DUK_DBG_CMD_BASICINFO 0x10
-#define DUK_DBG_CMD_TRIGGERSTATUS 0x11
-#define DUK_DBG_CMD_PAUSE 0x12
-#define DUK_DBG_CMD_RESUME 0x13
-#define DUK_DBG_CMD_STEPINTO 0x14
-#define DUK_DBG_CMD_STEPOVER 0x15
-#define DUK_DBG_CMD_STEPOUT 0x16
-#define DUK_DBG_CMD_LISTBREAK 0x17
-#define DUK_DBG_CMD_ADDBREAK 0x18
-#define DUK_DBG_CMD_DELBREAK 0x19
-#define DUK_DBG_CMD_GETVAR 0x1a
-#define DUK_DBG_CMD_PUTVAR 0x1b
-#define DUK_DBG_CMD_GETCALLSTACK 0x1c
-#define DUK_DBG_CMD_GETLOCALS 0x1d
-#define DUK_DBG_CMD_EVAL 0x1e
-#define DUK_DBG_CMD_DETACH 0x1f
-#define DUK_DBG_CMD_DUMPHEAP 0x20
-#define DUK_DBG_CMD_GETBYTECODE 0x21
-#define DUK_DBG_CMD_APPREQUEST 0x22
-#define DUK_DBG_CMD_GETHEAPOBJINFO 0x23
-#define DUK_DBG_CMD_GETOBJPROPDESC 0x24
-#define DUK_DBG_CMD_GETOBJPROPDESCRANGE 0x25
+#define DUK_DBG_CMD_BASICINFO 0x10
+#define DUK_DBG_CMD_TRIGGERSTATUS 0x11
+#define DUK_DBG_CMD_PAUSE 0x12
+#define DUK_DBG_CMD_RESUME 0x13
+#define DUK_DBG_CMD_STEPINTO 0x14
+#define DUK_DBG_CMD_STEPOVER 0x15
+#define DUK_DBG_CMD_STEPOUT 0x16
+#define DUK_DBG_CMD_LISTBREAK 0x17
+#define DUK_DBG_CMD_ADDBREAK 0x18
+#define DUK_DBG_CMD_DELBREAK 0x19
+#define DUK_DBG_CMD_GETVAR 0x1a
+#define DUK_DBG_CMD_PUTVAR 0x1b
+#define DUK_DBG_CMD_GETCALLSTACK 0x1c
+#define DUK_DBG_CMD_GETLOCALS 0x1d
+#define DUK_DBG_CMD_EVAL 0x1e
+#define DUK_DBG_CMD_DETACH 0x1f
+#define DUK_DBG_CMD_DUMPHEAP 0x20
+#define DUK_DBG_CMD_GETBYTECODE 0x21
+#define DUK_DBG_CMD_APPREQUEST 0x22
+#define DUK_DBG_CMD_GETHEAPOBJINFO 0x23
+#define DUK_DBG_CMD_GETOBJPROPDESC 0x24
+#define DUK_DBG_CMD_GETOBJPROPDESCRANGE 0x25
/* The low 8 bits map directly to duk_hobject.h DUK_PROPDESC_FLAG_xxx.
* The remaining flags are specific to the debugger.
*/
-#define DUK_DBG_PROPFLAG_SYMBOL (1U << 8)
-#define DUK_DBG_PROPFLAG_HIDDEN (1U << 9)
+#define DUK_DBG_PROPFLAG_SYMBOL (1U << 8)
+#define DUK_DBG_PROPFLAG_HIDDEN (1U << 9)
#if defined(DUK_USE_DEBUGGER_SUPPORT)
DUK_INTERNAL_DECL void duk_debug_do_detach(duk_heap *heap);
@@ -9205,7 +9811,7 @@ DUK_INTERNAL_DECL void duk_debug_write_heapptr(duk_hthread *thr, duk_heaphdr *h)
#endif
DUK_INTERNAL_DECL void duk_debug_write_hobject(duk_hthread *thr, duk_hobject *obj);
DUK_INTERNAL_DECL void duk_debug_write_tval(duk_hthread *thr, duk_tval *tv);
-#if 0 /* unused */
+#if 0 /* unused */
DUK_INTERNAL_DECL void duk_debug_write_request(duk_hthread *thr, duk_small_uint_t command);
#endif
DUK_INTERNAL_DECL void duk_debug_write_reply(duk_hthread *thr);
@@ -9230,9 +9836,9 @@ DUK_INTERNAL_DECL duk_bool_t duk_debug_is_paused(duk_heap *heap);
DUK_INTERNAL_DECL void duk_debug_set_paused(duk_heap *heap);
DUK_INTERNAL_DECL void duk_debug_clear_paused(duk_heap *heap);
DUK_INTERNAL_DECL void duk_debug_clear_pause_state(duk_heap *heap);
-#endif /* DUK_USE_DEBUGGER_SUPPORT */
+#endif /* DUK_USE_DEBUGGER_SUPPORT */
-#endif /* DUK_DEBUGGER_H_INCLUDED */
+#endif /* DUK_DEBUGGER_H_INCLUDED */
/* #include duk_debug.h */
/*
* Debugging macros, DUK_DPRINT() and its variants in particular.
@@ -9264,19 +9870,25 @@ DUK_INTERNAL_DECL void duk_debug_clear_pause_state(duk_heap *heap);
#if defined(DUK_USE_DEBUG_LEVEL) && (DUK_USE_DEBUG_LEVEL >= 0)
#define DUK_D(x) x
#else
-#define DUK_D(x) do { } while (0) /* omit */
+#define DUK_D(x) \
+ do { \
+ } while (0) /* omit */
#endif
#if defined(DUK_USE_DEBUG_LEVEL) && (DUK_USE_DEBUG_LEVEL >= 1)
#define DUK_DD(x) x
#else
-#define DUK_DD(x) do { } while (0) /* omit */
+#define DUK_DD(x) \
+ do { \
+ } while (0) /* omit */
#endif
#if defined(DUK_USE_DEBUG_LEVEL) && (DUK_USE_DEBUG_LEVEL >= 2)
#define DUK_DDD(x) x
#else
-#define DUK_DDD(x) do { } while (0) /* omit */
+#define DUK_DDD(x) \
+ do { \
+ } while (0) /* omit */
#endif
/*
@@ -9288,35 +9900,35 @@ DUK_INTERNAL_DECL void duk_debug_clear_pause_state(duk_heap *heap);
/* Note: combining __FILE__, __LINE__, and __func__ into fmt would be
* possible compile time, but waste some space with shared function names.
*/
-#define DUK__DEBUG_LOG(lev,...) duk_debug_log((duk_int_t) (lev), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO, DUK_FUNC_MACRO, __VA_ARGS__);
+#define DUK__DEBUG_LOG(lev, ...) \
+ duk_debug_log((duk_int_t) (lev), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO, DUK_FUNC_MACRO, __VA_ARGS__);
#if defined(DUK_USE_DEBUG_LEVEL) && (DUK_USE_DEBUG_LEVEL >= 0)
-#define DUK_DPRINT(...) DUK__DEBUG_LOG(DUK_LEVEL_DEBUG, __VA_ARGS__)
+#define DUK_DPRINT(...) DUK__DEBUG_LOG(DUK_LEVEL_DEBUG, __VA_ARGS__)
#else
#define DUK_DPRINT(...)
#endif
#if defined(DUK_USE_DEBUG_LEVEL) && (DUK_USE_DEBUG_LEVEL >= 1)
-#define DUK_DDPRINT(...) DUK__DEBUG_LOG(DUK_LEVEL_DDEBUG, __VA_ARGS__)
+#define DUK_DDPRINT(...) DUK__DEBUG_LOG(DUK_LEVEL_DDEBUG, __VA_ARGS__)
#else
#define DUK_DDPRINT(...)
#endif
#if defined(DUK_USE_DEBUG_LEVEL) && (DUK_USE_DEBUG_LEVEL >= 2)
-#define DUK_DDDPRINT(...) DUK__DEBUG_LOG(DUK_LEVEL_DDDEBUG, __VA_ARGS__)
+#define DUK_DDDPRINT(...) DUK__DEBUG_LOG(DUK_LEVEL_DDDEBUG, __VA_ARGS__)
#else
#define DUK_DDDPRINT(...)
#endif
-#else /* DUK_USE_VARIADIC_MACROS */
+#else /* DUK_USE_VARIADIC_MACROS */
-#define DUK__DEBUG_STASH(lev) \
+#define DUK__DEBUG_STASH(lev) \
(void) DUK_SNPRINTF(duk_debug_file_stash, DUK_DEBUG_STASH_SIZE, "%s", (const char *) DUK_FILE_MACRO), \
- (void) (duk_debug_file_stash[DUK_DEBUG_STASH_SIZE - 1] = (char) 0), \
- (void) (duk_debug_line_stash = (duk_int_t) DUK_LINE_MACRO), \
- (void) DUK_SNPRINTF(duk_debug_func_stash, DUK_DEBUG_STASH_SIZE, "%s", (const char *) DUK_FUNC_MACRO), \
- (void) (duk_debug_func_stash[DUK_DEBUG_STASH_SIZE - 1] = (char) 0), \
- (void) (duk_debug_level_stash = (lev))
+ (void) (duk_debug_file_stash[DUK_DEBUG_STASH_SIZE - 1] = (char) 0), \
+ (void) (duk_debug_line_stash = (duk_int_t) DUK_LINE_MACRO), \
+ (void) DUK_SNPRINTF(duk_debug_func_stash, DUK_DEBUG_STASH_SIZE, "%s", (const char *) DUK_FUNC_MACRO), \
+ (void) (duk_debug_func_stash[DUK_DEBUG_STASH_SIZE - 1] = (char) 0), (void) (duk_debug_level_stash = (lev))
/* Without variadic macros resort to comma expression trickery to handle debug
* prints. This generates a lot of harmless warnings. These hacks are not
@@ -9325,34 +9937,40 @@ DUK_INTERNAL_DECL void duk_debug_clear_pause_state(duk_heap *heap);
*/
#if defined(DUK_USE_DEBUG_LEVEL) && (DUK_USE_DEBUG_LEVEL >= 0)
-#define DUK_DPRINT DUK__DEBUG_STASH(DUK_LEVEL_DEBUG), (void) duk_debug_log /* args go here in parens */
+#define DUK_DPRINT DUK__DEBUG_STASH(DUK_LEVEL_DEBUG), (void) duk_debug_log /* args go here in parens */
#else
-#define DUK_DPRINT 0 && /* args go here as a comma expression in parens */
+#define DUK_DPRINT 0 && /* args go here as a comma expression in parens */
#endif
#if defined(DUK_USE_DEBUG_LEVEL) && (DUK_USE_DEBUG_LEVEL >= 1)
-#define DUK_DDPRINT DUK__DEBUG_STASH(DUK_LEVEL_DDEBUG), (void) duk_debug_log /* args go here in parens */
+#define DUK_DDPRINT DUK__DEBUG_STASH(DUK_LEVEL_DDEBUG), (void) duk_debug_log /* args go here in parens */
#else
-#define DUK_DDPRINT 0 && /* args */
+#define DUK_DDPRINT 0 && /* args */
#endif
#if defined(DUK_USE_DEBUG_LEVEL) && (DUK_USE_DEBUG_LEVEL >= 2)
-#define DUK_DDDPRINT DUK__DEBUG_STASH(DUK_LEVEL_DDDEBUG), (void) duk_debug_log /* args go here in parens */
+#define DUK_DDDPRINT DUK__DEBUG_STASH(DUK_LEVEL_DDDEBUG), (void) duk_debug_log /* args go here in parens */
#else
-#define DUK_DDDPRINT 0 && /* args */
+#define DUK_DDDPRINT 0 && /* args */
#endif
-#endif /* DUK_USE_VARIADIC_MACROS */
+#endif /* DUK_USE_VARIADIC_MACROS */
-#else /* DUK_USE_DEBUG */
+#else /* DUK_USE_DEBUG */
/*
* Exposed debug macros: debugging disabled
*/
-#define DUK_D(x) do { } while (0) /* omit */
-#define DUK_DD(x) do { } while (0) /* omit */
-#define DUK_DDD(x) do { } while (0) /* omit */
+#define DUK_D(x) \
+ do { \
+ } while (0) /* omit */
+#define DUK_DD(x) \
+ do { \
+ } while (0) /* omit */
+#define DUK_DDD(x) \
+ do { \
+ } while (0) /* omit */
#if defined(DUK_USE_VARIADIC_MACROS)
@@ -9360,15 +9978,15 @@ DUK_INTERNAL_DECL void duk_debug_clear_pause_state(duk_heap *heap);
#define DUK_DDPRINT(...)
#define DUK_DDDPRINT(...)
-#else /* DUK_USE_VARIADIC_MACROS */
+#else /* DUK_USE_VARIADIC_MACROS */
-#define DUK_DPRINT 0 && /* args go here as a comma expression in parens */
-#define DUK_DDPRINT 0 && /* args */
-#define DUK_DDDPRINT 0 && /* args */
+#define DUK_DPRINT 0 && /* args go here as a comma expression in parens */
+#define DUK_DDPRINT 0 && /* args */
+#define DUK_DDDPRINT 0 && /* args */
-#endif /* DUK_USE_VARIADIC_MACROS */
+#endif /* DUK_USE_VARIADIC_MACROS */
-#endif /* DUK_USE_DEBUG */
+#endif /* DUK_USE_DEBUG */
/*
* Structs
@@ -9389,16 +10007,16 @@ struct duk_fixedbuffer {
#if defined(DUK_USE_DEBUG)
DUK_INTERNAL_DECL duk_int_t duk_debug_vsnprintf(char *str, duk_size_t size, const char *format, va_list ap);
-#if 0 /*unused*/
+#if 0 /*unused*/
DUK_INTERNAL_DECL duk_int_t duk_debug_snprintf(char *str, duk_size_t size, const char *format, ...);
#endif
DUK_INTERNAL_DECL void duk_debug_format_funcptr(char *buf, duk_size_t buf_size, duk_uint8_t *fptr, duk_size_t fptr_size);
#if defined(DUK_USE_VARIADIC_MACROS)
DUK_INTERNAL_DECL void duk_debug_log(duk_int_t level, const char *file, duk_int_t line, const char *func, const char *fmt, ...);
-#else /* DUK_USE_VARIADIC_MACROS */
+#else /* DUK_USE_VARIADIC_MACROS */
/* parameter passing, not thread safe */
-#define DUK_DEBUG_STASH_SIZE 128
+#define DUK_DEBUG_STASH_SIZE 128
#if !defined(DUK_SINGLE_FILE)
DUK_INTERNAL_DECL char duk_debug_file_stash[DUK_DEBUG_STASH_SIZE];
DUK_INTERNAL_DECL duk_int_t duk_debug_line_stash;
@@ -9406,7 +10024,7 @@ DUK_INTERNAL_DECL char duk_debug_func_stash[DUK_DEBUG_STASH_SIZE];
DUK_INTERNAL_DECL duk_int_t duk_debug_level_stash;
#endif
DUK_INTERNAL_DECL void duk_debug_log(const char *fmt, ...);
-#endif /* DUK_USE_VARIADIC_MACROS */
+#endif /* DUK_USE_VARIADIC_MACROS */
DUK_INTERNAL_DECL void duk_fb_put_bytes(duk_fixedbuffer *fb, const duk_uint8_t *buffer, duk_size_t length);
DUK_INTERNAL_DECL void duk_fb_put_byte(duk_fixedbuffer *fb, duk_uint8_t x);
@@ -9415,9 +10033,9 @@ DUK_INTERNAL_DECL void duk_fb_sprintf(duk_fixedbuffer *fb, const char *fmt, ...)
DUK_INTERNAL_DECL void duk_fb_put_funcptr(duk_fixedbuffer *fb, duk_uint8_t *fptr, duk_size_t fptr_size);
DUK_INTERNAL_DECL duk_bool_t duk_fb_is_full(duk_fixedbuffer *fb);
-#endif /* DUK_USE_DEBUG */
+#endif /* DUK_USE_DEBUG */
-#endif /* DUK_DEBUG_H_INCLUDED */
+#endif /* DUK_DEBUG_H_INCLUDED */
/* #include duk_error.h */
/*
* Error handling macros, assertion macro, error codes.
@@ -9474,79 +10092,153 @@ DUK_INTERNAL_DECL duk_bool_t duk_fb_is_full(duk_fixedbuffer *fb);
/* Because there are quite many call sites, pack error code (require at most
* 8-bit) into a single argument.
*/
-#define DUK_ERROR(thr,err,msg) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) DUK_LINE_MACRO; \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
+#define DUK_ERROR(thr, err, msg) \
+ do { \
+ duk_errcode_t duk__err = (err); \
+ duk_int_t duk__line = (duk_int_t) DUK_LINE_MACRO; \
+ DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); \
+ DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
duk_err_handle_error((thr), DUK_FILE_MACRO, (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (msg)); \
} while (0)
-#define DUK_ERROR_RAW(thr,file,line,err,msg) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) (line); \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
+#define DUK_ERROR_RAW(thr, file, line, err, msg) \
+ do { \
+ duk_errcode_t duk__err = (err); \
+ duk_int_t duk__line = (duk_int_t) (line); \
+ DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); \
+ DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
duk_err_handle_error((thr), (file), (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (msg)); \
} while (0)
-#define DUK_ERROR_FMT1(thr,err,fmt,arg1) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) DUK_LINE_MACRO; \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error_fmt((thr), DUK_FILE_MACRO, (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (fmt), (arg1)); \
+#define DUK_ERROR_FMT1(thr, err, fmt, arg1) \
+ do { \
+ duk_errcode_t duk__err = (err); \
+ duk_int_t duk__line = (duk_int_t) DUK_LINE_MACRO; \
+ DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); \
+ DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
+ duk_err_handle_error_fmt((thr), \
+ DUK_FILE_MACRO, \
+ (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), \
+ (fmt), \
+ (arg1)); \
} while (0)
-#define DUK_ERROR_RAW_FMT1(thr,file,line,err,fmt,arg1) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) (line); \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error_fmt((thr), (file), (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (fmt), (arg1)); \
+#define DUK_ERROR_RAW_FMT1(thr, file, line, err, fmt, arg1) \
+ do { \
+ duk_errcode_t duk__err = (err); \
+ duk_int_t duk__line = (duk_int_t) (line); \
+ DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); \
+ DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
+ duk_err_handle_error_fmt((thr), \
+ (file), \
+ (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), \
+ (fmt), \
+ (arg1)); \
} while (0)
-#define DUK_ERROR_FMT2(thr,err,fmt,arg1,arg2) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) DUK_LINE_MACRO; \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error_fmt((thr), DUK_FILE_MACRO, (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (fmt), (arg1), (arg2)); \
+#define DUK_ERROR_FMT2(thr, err, fmt, arg1, arg2) \
+ do { \
+ duk_errcode_t duk__err = (err); \
+ duk_int_t duk__line = (duk_int_t) DUK_LINE_MACRO; \
+ DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); \
+ DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
+ duk_err_handle_error_fmt((thr), \
+ DUK_FILE_MACRO, \
+ (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), \
+ (fmt), \
+ (arg1), \
+ (arg2)); \
} while (0)
-#define DUK_ERROR_RAW_FMT2(thr,file,line,err,fmt,arg1,arg2) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) (line); \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error_fmt((thr), (file), (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (fmt), (arg1), (arg2)); \
+#define DUK_ERROR_RAW_FMT2(thr, file, line, err, fmt, arg1, arg2) \
+ do { \
+ duk_errcode_t duk__err = (err); \
+ duk_int_t duk__line = (duk_int_t) (line); \
+ DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); \
+ DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
+ duk_err_handle_error_fmt((thr), \
+ (file), \
+ (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), \
+ (fmt), \
+ (arg1), \
+ (arg2)); \
} while (0)
-#define DUK_ERROR_FMT3(thr,err,fmt,arg1,arg2,arg3) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) DUK_LINE_MACRO; \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error_fmt((thr), DUK_FILE_MACRO, (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (fmt), (arg1), (arg2), (arg3)); \
+#define DUK_ERROR_FMT3(thr, err, fmt, arg1, arg2, arg3) \
+ do { \
+ duk_errcode_t duk__err = (err); \
+ duk_int_t duk__line = (duk_int_t) DUK_LINE_MACRO; \
+ DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); \
+ DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
+ duk_err_handle_error_fmt((thr), \
+ DUK_FILE_MACRO, \
+ (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), \
+ (fmt), \
+ (arg1), \
+ (arg2), \
+ (arg3)); \
} while (0)
-#define DUK_ERROR_RAW_FMT3(thr,file,line,err,fmt,arg1,arg2,arg3) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) (line); \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error_fmt((thr), (file), (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (fmt), (arg1), (arg2), (arg3)); \
+#define DUK_ERROR_RAW_FMT3(thr, file, line, err, fmt, arg1, arg2, arg3) \
+ do { \
+ duk_errcode_t duk__err = (err); \
+ duk_int_t duk__line = (duk_int_t) (line); \
+ DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); \
+ DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
+ duk_err_handle_error_fmt((thr), \
+ (file), \
+ (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), \
+ (fmt), \
+ (arg1), \
+ (arg2), \
+ (arg3)); \
} while (0)
-#define DUK_ERROR_FMT4(thr,err,fmt,arg1,arg2,arg3,arg4) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) DUK_LINE_MACRO; \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error_fmt((thr), DUK_FILE_MACRO, (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (fmt), (arg1), (arg2), (arg3), (arg4)); \
+#define DUK_ERROR_FMT4(thr, err, fmt, arg1, arg2, arg3, arg4) \
+ do { \
+ duk_errcode_t duk__err = (err); \
+ duk_int_t duk__line = (duk_int_t) DUK_LINE_MACRO; \
+ DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); \
+ DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
+ duk_err_handle_error_fmt((thr), \
+ DUK_FILE_MACRO, \
+ (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), \
+ (fmt), \
+ (arg1), \
+ (arg2), \
+ (arg3), \
+ (arg4)); \
} while (0)
-#define DUK_ERROR_RAW_FMT4(thr,file,line,err,fmt,arg1,arg2,arg3,arg4) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) (line); \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error_fmt((thr), (file), (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (fmt), (arg1), (arg2), (arg3), (arg4)); \
+#define DUK_ERROR_RAW_FMT4(thr, file, line, err, fmt, arg1, arg2, arg3, arg4) \
+ do { \
+ duk_errcode_t duk__err = (err); \
+ duk_int_t duk__line = (duk_int_t) (line); \
+ DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); \
+ DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
+ duk_err_handle_error_fmt((thr), \
+ (file), \
+ (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), \
+ (fmt), \
+ (arg1), \
+ (arg2), \
+ (arg3), \
+ (arg4)); \
} while (0)
-#else /* DUK_USE_VERBOSE_ERRORS */
+#else /* DUK_USE_VERBOSE_ERRORS */
-#define DUK_ERROR(thr,err,msg) duk_err_handle_error((thr), (err))
-#define DUK_ERROR_RAW(thr,file,line,err,msg) duk_err_handle_error((thr), (err))
+#define DUK_ERROR(thr, err, msg) duk_err_handle_error((thr), (err))
+#define DUK_ERROR_RAW(thr, file, line, err, msg) duk_err_handle_error((thr), (err))
-#define DUK_ERROR_FMT1(thr,err,fmt,arg1) DUK_ERROR((thr),(err),(fmt))
-#define DUK_ERROR_RAW_FMT1(thr,file,line,err,fmt,arg1) DUK_ERROR_RAW((thr),(file),(line),(err),(fmt))
+#define DUK_ERROR_FMT1(thr, err, fmt, arg1) DUK_ERROR((thr), (err), (fmt))
+#define DUK_ERROR_RAW_FMT1(thr, file, line, err, fmt, arg1) DUK_ERROR_RAW((thr), (file), (line), (err), (fmt))
-#define DUK_ERROR_FMT2(thr,err,fmt,arg1,arg2) DUK_ERROR((thr),(err),(fmt))
-#define DUK_ERROR_RAW_FMT2(thr,file,line,err,fmt,arg1,arg2) DUK_ERROR_RAW((thr),(file),(line),(err),(fmt))
+#define DUK_ERROR_FMT2(thr, err, fmt, arg1, arg2) DUK_ERROR((thr), (err), (fmt))
+#define DUK_ERROR_RAW_FMT2(thr, file, line, err, fmt, arg1, arg2) DUK_ERROR_RAW((thr), (file), (line), (err), (fmt))
-#define DUK_ERROR_FMT3(thr,err,fmt,arg1,arg2,arg3) DUK_ERROR((thr),(err),(fmt))
-#define DUK_ERROR_RAW_FMT3(thr,file,line,err,fmt,arg1,arg2,arg3) DUK_ERROR_RAW((thr),(file),(line),(err),(fmt))
+#define DUK_ERROR_FMT3(thr, err, fmt, arg1, arg2, arg3) DUK_ERROR((thr), (err), (fmt))
+#define DUK_ERROR_RAW_FMT3(thr, file, line, err, fmt, arg1, arg2, arg3) DUK_ERROR_RAW((thr), (file), (line), (err), (fmt))
-#define DUK_ERROR_FMT4(thr,err,fmt,arg1,arg2,arg3,arg4) DUK_ERROR((thr),(err),(fmt))
-#define DUK_ERROR_RAW_FMT4(thr,file,line,err,fmt,arg1,arg2,arg3,arg4) DUK_ERROR_RAW((thr),(file),(line),(err),(fmt))
+#define DUK_ERROR_FMT4(thr, err, fmt, arg1, arg2, arg3, arg4) DUK_ERROR((thr), (err), (fmt))
+#define DUK_ERROR_RAW_FMT4(thr, file, line, err, fmt, arg1, arg2, arg3, arg4) DUK_ERROR_RAW((thr), (file), (line), (err), (fmt))
-#endif /* DUK_USE_VERBOSE_ERRORS */
+#endif /* DUK_USE_VERBOSE_ERRORS */
/*
* Fatal error without context
@@ -9554,8 +10246,7 @@ DUK_INTERNAL_DECL duk_bool_t duk_fb_is_full(duk_fixedbuffer *fb);
* The macro is an expression to make it compatible with DUK_ASSERT_EXPR().
*/
-#define DUK_FATAL_WITHOUT_CONTEXT(msg) \
- duk_default_fatal_handler(NULL, (msg))
+#define DUK_FATAL_WITHOUT_CONTEXT(msg) duk_default_fatal_handler(NULL, (msg))
/*
* Error throwing helpers
@@ -9580,196 +10271,252 @@ DUK_INTERNAL_DECL duk_bool_t duk_fb_is_full(duk_fixedbuffer *fb);
* vs. non-paranoid distinction affects only a few specific errors.
*/
#if defined(DUK_USE_PARANOID_ERRORS)
-#define DUK_ERROR_REQUIRE_TYPE_INDEX(thr,idx,expectname,lowmemstr) do { \
+#define DUK_ERROR_REQUIRE_TYPE_INDEX(thr, idx, expectname, lowmemstr) \
+ do { \
duk_err_require_type_index((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO, (idx), (expectname)); \
} while (0)
-#else /* DUK_USE_PARANOID_ERRORS */
-#define DUK_ERROR_REQUIRE_TYPE_INDEX(thr,idx,expectname,lowmemstr) do { \
+#else /* DUK_USE_PARANOID_ERRORS */
+#define DUK_ERROR_REQUIRE_TYPE_INDEX(thr, idx, expectname, lowmemstr) \
+ do { \
duk_err_require_type_index((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO, (idx), (expectname)); \
} while (0)
-#endif /* DUK_USE_PARANOID_ERRORS */
+#endif /* DUK_USE_PARANOID_ERRORS */
-#define DUK_ERROR_INTERNAL(thr) do { \
+#define DUK_ERROR_INTERNAL(thr) \
+ do { \
duk_err_error_internal((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO); \
} while (0)
-#define DUK_DCERROR_INTERNAL(thr) do { \
+#define DUK_DCERROR_INTERNAL(thr) \
+ do { \
DUK_ERROR_INTERNAL((thr)); \
return 0; \
} while (0)
-#define DUK_ERROR_ALLOC_FAILED(thr) do { \
+#define DUK_ERROR_ALLOC_FAILED(thr) \
+ do { \
duk_err_error_alloc_failed((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO); \
} while (0)
-#define DUK_ERROR_UNSUPPORTED(thr) do { \
+#define DUK_ERROR_UNSUPPORTED(thr) \
+ do { \
DUK_ERROR((thr), DUK_ERR_ERROR, DUK_STR_UNSUPPORTED); \
} while (0)
-#define DUK_DCERROR_UNSUPPORTED(thr) do { \
+#define DUK_DCERROR_UNSUPPORTED(thr) \
+ do { \
DUK_ERROR_UNSUPPORTED((thr)); \
return 0; \
} while (0)
-#define DUK_ERROR_ERROR(thr,msg) do { \
+#define DUK_ERROR_ERROR(thr, msg) \
+ do { \
duk_err_error((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO, (msg)); \
} while (0)
-#define DUK_ERROR_RANGE_INDEX(thr,idx) do { \
+#define DUK_ERROR_RANGE_INDEX(thr, idx) \
+ do { \
duk_err_range_index((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO, (idx)); \
} while (0)
-#define DUK_ERROR_RANGE_PUSH_BEYOND(thr) do { \
+#define DUK_ERROR_RANGE_PUSH_BEYOND(thr) \
+ do { \
duk_err_range_push_beyond((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO); \
} while (0)
-#define DUK_ERROR_RANGE_INVALID_ARGS(thr) do { \
+#define DUK_ERROR_RANGE_INVALID_ARGS(thr) \
+ do { \
DUK_ERROR_RANGE((thr), DUK_STR_INVALID_ARGS); \
} while (0)
-#define DUK_DCERROR_RANGE_INVALID_ARGS(thr) do { \
+#define DUK_DCERROR_RANGE_INVALID_ARGS(thr) \
+ do { \
DUK_ERROR_RANGE_INVALID_ARGS((thr)); \
return 0; \
} while (0)
-#define DUK_ERROR_RANGE_INVALID_COUNT(thr) do { \
+#define DUK_ERROR_RANGE_INVALID_COUNT(thr) \
+ do { \
DUK_ERROR_RANGE((thr), DUK_STR_INVALID_COUNT); \
} while (0)
-#define DUK_DCERROR_RANGE_INVALID_COUNT(thr) do { \
+#define DUK_DCERROR_RANGE_INVALID_COUNT(thr) \
+ do { \
DUK_ERROR_RANGE_INVALID_COUNT((thr)); \
return 0; \
} while (0)
-#define DUK_ERROR_RANGE_INVALID_LENGTH(thr) do { \
+#define DUK_ERROR_RANGE_INVALID_LENGTH(thr) \
+ do { \
DUK_ERROR_RANGE((thr), DUK_STR_INVALID_LENGTH); \
} while (0)
-#define DUK_DCERROR_RANGE_INVALID_LENGTH(thr) do { \
+#define DUK_DCERROR_RANGE_INVALID_LENGTH(thr) \
+ do { \
DUK_ERROR_RANGE_INVALID_LENGTH((thr)); \
return 0; \
} while (0)
-#define DUK_ERROR_RANGE(thr,msg) do { \
+#define DUK_ERROR_RANGE(thr, msg) \
+ do { \
duk_err_range((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO, (msg)); \
} while (0)
-#define DUK_ERROR_EVAL(thr,msg) do { \
+#define DUK_ERROR_EVAL(thr, msg) \
+ do { \
DUK_ERROR((thr), DUK_ERR_EVAL_ERROR, (msg)); \
} while (0)
-#define DUK_ERROR_REFERENCE(thr,msg) do { \
+#define DUK_ERROR_REFERENCE(thr, msg) \
+ do { \
DUK_ERROR((thr), DUK_ERR_REFERENCE_ERROR, (msg)); \
} while (0)
-#define DUK_ERROR_SYNTAX(thr,msg) do { \
+#define DUK_ERROR_SYNTAX(thr, msg) \
+ do { \
DUK_ERROR((thr), DUK_ERR_SYNTAX_ERROR, (msg)); \
} while (0)
-#define DUK_ERROR_TYPE_INVALID_ARGS(thr) do { \
+#define DUK_ERROR_TYPE_INVALID_ARGS(thr) \
+ do { \
duk_err_type_invalid_args((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO); \
} while (0)
-#define DUK_DCERROR_TYPE_INVALID_ARGS(thr) do { \
+#define DUK_DCERROR_TYPE_INVALID_ARGS(thr) \
+ do { \
DUK_ERROR_TYPE_INVALID_ARGS((thr)); \
return 0; \
} while (0)
-#define DUK_ERROR_TYPE_INVALID_STATE(thr) do { \
+#define DUK_ERROR_TYPE_INVALID_STATE(thr) \
+ do { \
duk_err_type_invalid_state((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO); \
} while (0)
-#define DUK_DCERROR_TYPE_INVALID_STATE(thr) do { \
+#define DUK_DCERROR_TYPE_INVALID_STATE(thr) \
+ do { \
DUK_ERROR_TYPE_INVALID_STATE((thr)); \
return 0; \
} while (0)
-#define DUK_ERROR_TYPE_INVALID_TRAP_RESULT(thr) do { \
+#define DUK_ERROR_TYPE_INVALID_TRAP_RESULT(thr) \
+ do { \
duk_err_type_invalid_trap_result((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO); \
} while (0)
-#define DUK_DCERROR_TYPE_INVALID_TRAP_RESULT(thr) do { \
+#define DUK_DCERROR_TYPE_INVALID_TRAP_RESULT(thr) \
+ do { \
DUK_ERROR_TYPE((thr), DUK_STR_INVALID_TRAP_RESULT); \
} while (0)
-#define DUK_ERROR_TYPE(thr,msg) do { \
+#define DUK_ERROR_TYPE(thr, msg) \
+ do { \
DUK_ERROR((thr), DUK_ERR_TYPE_ERROR, (msg)); \
} while (0)
-#define DUK_ERROR_URI(thr,msg) do { \
+#define DUK_ERROR_URI(thr, msg) \
+ do { \
DUK_ERROR((thr), DUK_ERR_URI_ERROR, (msg)); \
} while (0)
-#else /* DUK_USE_VERBOSE_ERRORS */
+#else /* DUK_USE_VERBOSE_ERRORS */
/* Non-verbose errors for low memory targets: no file, line, or message. */
-#define DUK_ERROR_REQUIRE_TYPE_INDEX(thr,idx,expectname,lowmemstr) do { \
+#define DUK_ERROR_REQUIRE_TYPE_INDEX(thr, idx, expectname, lowmemstr) \
+ do { \
duk_err_type((thr)); \
} while (0)
-#define DUK_ERROR_INTERNAL(thr) do { \
+#define DUK_ERROR_INTERNAL(thr) \
+ do { \
duk_err_error((thr)); \
} while (0)
-#define DUK_DCERROR_INTERNAL(thr) do { \
+#define DUK_DCERROR_INTERNAL(thr) \
+ do { \
DUK_UNREF((thr)); \
return DUK_RET_ERROR; \
} while (0)
-#define DUK_ERROR_ALLOC_FAILED(thr) do { \
+#define DUK_ERROR_ALLOC_FAILED(thr) \
+ do { \
duk_err_error((thr)); \
} while (0)
-#define DUK_ERROR_UNSUPPORTED(thr) do { \
+#define DUK_ERROR_UNSUPPORTED(thr) \
+ do { \
duk_err_error((thr)); \
} while (0)
-#define DUK_DCERROR_UNSUPPORTED(thr) do { \
+#define DUK_DCERROR_UNSUPPORTED(thr) \
+ do { \
DUK_UNREF((thr)); \
return DUK_RET_ERROR; \
} while (0)
-#define DUK_ERROR_ERROR(thr,msg) do { \
+#define DUK_ERROR_ERROR(thr, msg) \
+ do { \
duk_err_error((thr)); \
} while (0)
-#define DUK_ERROR_RANGE_INDEX(thr,idx) do { \
+#define DUK_ERROR_RANGE_INDEX(thr, idx) \
+ do { \
duk_err_range((thr)); \
} while (0)
-#define DUK_ERROR_RANGE_PUSH_BEYOND(thr) do { \
+#define DUK_ERROR_RANGE_PUSH_BEYOND(thr) \
+ do { \
duk_err_range((thr)); \
} while (0)
-#define DUK_ERROR_RANGE_INVALID_ARGS(thr) do { \
+#define DUK_ERROR_RANGE_INVALID_ARGS(thr) \
+ do { \
duk_err_range((thr)); \
} while (0)
-#define DUK_DCERROR_RANGE_INVALID_ARGS(thr) do { \
+#define DUK_DCERROR_RANGE_INVALID_ARGS(thr) \
+ do { \
DUK_UNREF((thr)); \
return DUK_RET_RANGE_ERROR; \
} while (0)
-#define DUK_ERROR_RANGE_INVALID_COUNT(thr) do { \
+#define DUK_ERROR_RANGE_INVALID_COUNT(thr) \
+ do { \
duk_err_range((thr)); \
} while (0)
-#define DUK_DCERROR_RANGE_INVALID_COUNT(thr) do { \
+#define DUK_DCERROR_RANGE_INVALID_COUNT(thr) \
+ do { \
DUK_UNREF((thr)); \
return DUK_RET_RANGE_ERROR; \
} while (0)
-#define DUK_ERROR_RANGE_INVALID_LENGTH(thr) do { \
+#define DUK_ERROR_RANGE_INVALID_LENGTH(thr) \
+ do { \
duk_err_range((thr)); \
} while (0)
-#define DUK_DCERROR_RANGE_INVALID_LENGTH(thr) do { \
+#define DUK_DCERROR_RANGE_INVALID_LENGTH(thr) \
+ do { \
DUK_UNREF((thr)); \
return DUK_RET_RANGE_ERROR; \
} while (0)
-#define DUK_ERROR_RANGE(thr,msg) do { \
+#define DUK_ERROR_RANGE(thr, msg) \
+ do { \
duk_err_range((thr)); \
} while (0)
-#define DUK_ERROR_EVAL(thr,msg) do { \
+#define DUK_ERROR_EVAL(thr, msg) \
+ do { \
duk_err_eval((thr)); \
} while (0)
-#define DUK_ERROR_REFERENCE(thr,msg) do { \
+#define DUK_ERROR_REFERENCE(thr, msg) \
+ do { \
duk_err_reference((thr)); \
} while (0)
-#define DUK_ERROR_SYNTAX(thr,msg) do { \
+#define DUK_ERROR_SYNTAX(thr, msg) \
+ do { \
duk_err_syntax((thr)); \
} while (0)
-#define DUK_ERROR_TYPE_INVALID_ARGS(thr) do { \
+#define DUK_ERROR_TYPE_INVALID_ARGS(thr) \
+ do { \
duk_err_type((thr)); \
} while (0)
-#define DUK_DCERROR_TYPE_INVALID_ARGS(thr) do { \
+#define DUK_DCERROR_TYPE_INVALID_ARGS(thr) \
+ do { \
DUK_UNREF((thr)); \
return DUK_RET_TYPE_ERROR; \
} while (0)
-#define DUK_ERROR_TYPE_INVALID_STATE(thr) do { \
+#define DUK_ERROR_TYPE_INVALID_STATE(thr) \
+ do { \
duk_err_type((thr)); \
} while (0)
-#define DUK_DCERROR_TYPE_INVALID_STATE(thr) do { \
+#define DUK_DCERROR_TYPE_INVALID_STATE(thr) \
+ do { \
duk_err_type((thr)); \
} while (0)
-#define DUK_ERROR_TYPE_INVALID_TRAP_RESULT(thr) do { \
+#define DUK_ERROR_TYPE_INVALID_TRAP_RESULT(thr) \
+ do { \
duk_err_type((thr)); \
} while (0)
-#define DUK_DCERROR_TYPE_INVALID_TRAP_RESULT(thr) do { \
+#define DUK_DCERROR_TYPE_INVALID_TRAP_RESULT(thr) \
+ do { \
DUK_UNREF((thr)); \
return DUK_RET_TYPE_ERROR; \
} while (0)
-#define DUK_ERROR_TYPE_INVALID_TRAP_RESULT(thr) do { \
+#define DUK_ERROR_TYPE_INVALID_TRAP_RESULT(thr) \
+ do { \
duk_err_type((thr)); \
} while (0)
-#define DUK_ERROR_TYPE(thr,msg) do { \
+#define DUK_ERROR_TYPE(thr, msg) \
+ do { \
duk_err_type((thr)); \
} while (0)
-#define DUK_ERROR_URI(thr,msg) do { \
+#define DUK_ERROR_URI(thr, msg) \
+ do { \
duk_err_uri((thr)); \
} while (0)
-#endif /* DUK_USE_VERBOSE_ERRORS */
+#endif /* DUK_USE_VERBOSE_ERRORS */
/*
* Assert macro: failure causes a fatal error.
@@ -9787,63 +10534,72 @@ DUK_INTERNAL_DECL duk_bool_t duk_fb_is_full(duk_fixedbuffer *fb);
* we don't care about assertion text size because they're not used in production
* builds.
*/
-#define DUK_ASSERT(x) do { \
- if (!(x)) { \
- DUK_FATAL_WITHOUT_CONTEXT("assertion failed: " #x \
- " (" DUK_FILE_MACRO ":" DUK_MACRO_STRINGIFY(DUK_LINE_MACRO) ")"); \
- } \
+#define DUK_ASSERT(x) \
+ do { \
+ if (!(x)) { \
+ DUK_FATAL_WITHOUT_CONTEXT("assertion failed: " #x " (" DUK_FILE_MACRO \
+ ":" DUK_MACRO_STRINGIFY(DUK_LINE_MACRO) ")"); \
+ } \
} while (0)
/* Assertion compatible inside a comma expression, evaluates to void. */
#define DUK_ASSERT_EXPR(x) \
- ((void) ((x) ? 0 : (DUK_FATAL_WITHOUT_CONTEXT("assertion failed: " #x \
- " (" DUK_FILE_MACRO ":" DUK_MACRO_STRINGIFY(DUK_LINE_MACRO) ")"), 0)))
+ ((void) ((x) ? 0 : \
+ (DUK_FATAL_WITHOUT_CONTEXT("assertion failed: " #x " (" DUK_FILE_MACRO \
+ ":" DUK_MACRO_STRINGIFY(DUK_LINE_MACRO) ")"), \
+ 0)))
-#else /* DUK_USE_ASSERTIONS */
+#else /* DUK_USE_ASSERTIONS */
-#define DUK_ASSERT(x) do { /* assertion omitted */ } while (0)
+#define DUK_ASSERT(x) \
+ do { /* assertion omitted */ \
+ } while (0)
-#define DUK_ASSERT_EXPR(x) ((void) 0)
+#define DUK_ASSERT_EXPR(x) ((void) 0)
-#endif /* DUK_USE_ASSERTIONS */
+#endif /* DUK_USE_ASSERTIONS */
/* this variant is used when an assert would generate a compile warning by
* being always true (e.g. >= 0 comparison for an unsigned value
*/
-#define DUK_ASSERT_DISABLE(x) do { /* assertion disabled */ } while (0)
+#define DUK_ASSERT_DISABLE(x) \
+ do { /* assertion disabled */ \
+ } while (0)
/*
* Assertion helpers
*/
#if defined(DUK_USE_ASSERTIONS) && defined(DUK_USE_REFERENCE_COUNTING)
-#define DUK_ASSERT_REFCOUNT_NONZERO_HEAPHDR(h) do { \
+#define DUK_ASSERT_REFCOUNT_NONZERO_HEAPHDR(h) \
+ do { \
DUK_ASSERT((h) == NULL || DUK_HEAPHDR_GET_REFCOUNT((duk_heaphdr *) (h)) > 0); \
} while (0)
-#define DUK_ASSERT_REFCOUNT_NONZERO_TVAL(tv) do { \
+#define DUK_ASSERT_REFCOUNT_NONZERO_TVAL(tv) \
+ do { \
if ((tv) != NULL && DUK_TVAL_IS_HEAP_ALLOCATED((tv))) { \
DUK_ASSERT(DUK_HEAPHDR_GET_REFCOUNT(DUK_TVAL_GET_HEAPHDR((tv))) > 0); \
} \
} while (0)
#else
-#define DUK_ASSERT_REFCOUNT_NONZERO_HEAPHDR(h) /* no refcount check */
-#define DUK_ASSERT_REFCOUNT_NONZERO_TVAL(tv) /* no refcount check */
+#define DUK_ASSERT_REFCOUNT_NONZERO_HEAPHDR(h) /* no refcount check */
+#define DUK_ASSERT_REFCOUNT_NONZERO_TVAL(tv) /* no refcount check */
#endif
-#define DUK_ASSERT_TOP(ctx,n) DUK_ASSERT((duk_idx_t) duk_get_top((ctx)) == (duk_idx_t) (n))
+#define DUK_ASSERT_TOP(ctx, n) DUK_ASSERT((duk_idx_t) duk_get_top((ctx)) == (duk_idx_t) (n))
#if defined(DUK_USE_ASSERTIONS) && defined(DUK_USE_PACKED_TVAL)
-#define DUK_ASSERT_DOUBLE_IS_NORMALIZED(dval) do { \
+#define DUK_ASSERT_DOUBLE_IS_NORMALIZED(dval) \
+ do { \
duk_double_union duk__assert_tmp_du; \
duk__assert_tmp_du.d = (dval); \
DUK_ASSERT(DUK_DBLUNION_IS_NORMALIZED(&duk__assert_tmp_du)); \
} while (0)
#else
-#define DUK_ASSERT_DOUBLE_IS_NORMALIZED(dval) /* nop */
+#define DUK_ASSERT_DOUBLE_IS_NORMALIZED(dval) /* nop */
#endif
-#define DUK_ASSERT_VS_SPACE(thr) \
- DUK_ASSERT(thr->valstack_top < thr->valstack_end)
+#define DUK_ASSERT_VS_SPACE(thr) DUK_ASSERT(thr->valstack_top < thr->valstack_end)
/*
* Helper to initialize a memory area (e.g. struct) with garbage when
@@ -9851,11 +10607,14 @@ DUK_INTERNAL_DECL duk_bool_t duk_fb_is_full(duk_fixedbuffer *fb);
*/
#if defined(DUK_USE_ASSERTIONS)
-#define DUK_ASSERT_SET_GARBAGE(ptr,size) do { \
+#define DUK_ASSERT_SET_GARBAGE(ptr, size) \
+ do { \
duk_memset_unsafe((void *) (ptr), 0x5a, size); \
} while (0)
#else
-#define DUK_ASSERT_SET_GARBAGE(ptr,size) do {} while (0)
+#define DUK_ASSERT_SET_GARBAGE(ptr, size) \
+ do { \
+ } while (0)
#endif
/*
@@ -9866,16 +10625,18 @@ DUK_INTERNAL_DECL duk_bool_t duk_fb_is_full(duk_fixedbuffer *fb);
* or (b) Duktape calls which involve extending the valstack (e.g. getter call).
*/
-#define DUK_VALSTACK_ASSERT_EXTRA 5 /* this is added to checks to allow for Duktape
- * API calls in addition to function's own use
- */
+#define DUK_VALSTACK_ASSERT_EXTRA \
+ 5 /* this is added to checks to allow for Duktape \
+ * API calls in addition to function's own use \
+ */
#if defined(DUK_USE_ASSERTIONS)
-#define DUK_ASSERT_VALSTACK_SPACE(thr,n) do { \
+#define DUK_ASSERT_VALSTACK_SPACE(thr, n) \
+ do { \
DUK_ASSERT((thr) != NULL); \
DUK_ASSERT((thr)->valstack_end - (thr)->valstack_top >= (n) + DUK_VALSTACK_ASSERT_EXTRA); \
} while (0)
#else
-#define DUK_ASSERT_VALSTACK_SPACE(thr,n) /* no valstack space check */
+#define DUK_ASSERT_VALSTACK_SPACE(thr, n) /* no valstack space check */
#endif
/*
@@ -9883,25 +10644,35 @@ DUK_INTERNAL_DECL duk_bool_t duk_fb_is_full(duk_fixedbuffer *fb);
*/
#if defined(DUK_USE_VERBOSE_ERRORS)
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_handle_error(duk_hthread *thr, const char *filename, duk_uint_t line_and_code, const char *msg));
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_handle_error_fmt(duk_hthread *thr, const char *filename, duk_uint_t line_and_code, const char *fmt, ...));
-#else /* DUK_USE_VERBOSE_ERRORS */
+DUK_NORETURN(
+ DUK_INTERNAL_DECL void duk_err_handle_error(duk_hthread *thr, const char *filename, duk_uint_t line_and_code, const char *msg));
+DUK_NORETURN(DUK_INTERNAL_DECL void
+ duk_err_handle_error_fmt(duk_hthread *thr, const char *filename, duk_uint_t line_and_code, const char *fmt, ...));
+#else /* DUK_USE_VERBOSE_ERRORS */
DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_handle_error(duk_hthread *thr, duk_errcode_t code));
-#endif /* DUK_USE_VERBOSE_ERRORS */
+#endif /* DUK_USE_VERBOSE_ERRORS */
#if defined(DUK_USE_VERBOSE_ERRORS)
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_create_and_throw(duk_hthread *thr, duk_errcode_t code, const char *msg, const char *filename, duk_int_t line));
+DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_create_and_throw(duk_hthread *thr,
+ duk_errcode_t code,
+ const char *msg,
+ const char *filename,
+ duk_int_t line));
#else
DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_create_and_throw(duk_hthread *thr, duk_errcode_t code));
#endif
DUK_NORETURN(DUK_INTERNAL_DECL void duk_error_throw_from_negative_rc(duk_hthread *thr, duk_ret_t rc));
-#define DUK_AUGMENT_FLAG_NOBLAME_FILELINE (1U << 0) /* if set, don't blame C file/line for .fileName and .lineNumber */
-#define DUK_AUGMENT_FLAG_SKIP_ONE (1U << 1) /* if set, skip topmost activation in traceback construction */
+#define DUK_AUGMENT_FLAG_NOBLAME_FILELINE (1U << 0) /* if set, don't blame C file/line for .fileName and .lineNumber */
+#define DUK_AUGMENT_FLAG_SKIP_ONE (1U << 1) /* if set, skip topmost activation in traceback construction */
#if defined(DUK_USE_AUGMENT_ERROR_CREATE)
-DUK_INTERNAL_DECL void duk_err_augment_error_create(duk_hthread *thr, duk_hthread *thr_callstack, const char *filename, duk_int_t line, duk_small_uint_t flags);
+DUK_INTERNAL_DECL void duk_err_augment_error_create(duk_hthread *thr,
+ duk_hthread *thr_callstack,
+ const char *filename,
+ duk_int_t line,
+ duk_small_uint_t flags);
#endif
#if defined(DUK_USE_AUGMENT_ERROR_THROW)
DUK_INTERNAL_DECL void duk_err_augment_error_throw(duk_hthread *thr);
@@ -9909,20 +10680,31 @@ DUK_INTERNAL_DECL void duk_err_augment_error_throw(duk_hthread *thr);
#if defined(DUK_USE_VERBOSE_ERRORS)
#if defined(DUK_USE_PARANOID_ERRORS)
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_require_type_index(duk_hthread *thr, const char *filename, duk_int_t linenumber, duk_idx_t idx, const char *expect_name));
+DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_require_type_index(duk_hthread *thr,
+ const char *filename,
+ duk_int_t linenumber,
+ duk_idx_t idx,
+ const char *expect_name));
#else
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_require_type_index(duk_hthread *thr, const char *filename, duk_int_t linenumber, duk_idx_t idx, const char *expect_name));
+DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_require_type_index(duk_hthread *thr,
+ const char *filename,
+ duk_int_t linenumber,
+ duk_idx_t idx,
+ const char *expect_name));
#endif
DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_error_internal(duk_hthread *thr, const char *filename, duk_int_t linenumber));
DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_error_alloc_failed(duk_hthread *thr, const char *filename, duk_int_t linenumber));
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_error(duk_hthread *thr, const char *filename, duk_int_t linenumber, const char *message));
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_range_index(duk_hthread *thr, const char *filename, duk_int_t linenumber, duk_idx_t idx));
+DUK_NORETURN(
+ DUK_INTERNAL_DECL void duk_err_error(duk_hthread *thr, const char *filename, duk_int_t linenumber, const char *message));
+DUK_NORETURN(
+ DUK_INTERNAL_DECL void duk_err_range_index(duk_hthread *thr, const char *filename, duk_int_t linenumber, duk_idx_t idx));
DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_range_push_beyond(duk_hthread *thr, const char *filename, duk_int_t linenumber));
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_range(duk_hthread *thr, const char *filename, duk_int_t linenumber, const char *message));
+DUK_NORETURN(
+ DUK_INTERNAL_DECL void duk_err_range(duk_hthread *thr, const char *filename, duk_int_t linenumber, const char *message));
DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_type_invalid_args(duk_hthread *thr, const char *filename, duk_int_t linenumber));
DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_type_invalid_state(duk_hthread *thr, const char *filename, duk_int_t linenumber));
DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_type_invalid_trap_result(duk_hthread *thr, const char *filename, duk_int_t linenumber));
-#else /* DUK_VERBOSE_ERRORS */
+#else /* DUK_VERBOSE_ERRORS */
DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_error(duk_hthread *thr));
DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_range(duk_hthread *thr));
DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_eval(duk_hthread *thr));
@@ -9943,7 +10725,7 @@ DUK_INTERNAL_DECL void duk_err_check_debugger_integration(duk_hthread *thr);
DUK_INTERNAL_DECL duk_hobject *duk_error_prototype_from_code(duk_hthread *thr, duk_errcode_t err_code);
-#endif /* DUK_ERROR_H_INCLUDED */
+#endif /* DUK_ERROR_H_INCLUDED */
/* #include duk_unicode.h */
/*
* Unicode helpers
@@ -9956,10 +10738,10 @@ DUK_INTERNAL_DECL duk_hobject *duk_error_prototype_from_code(duk_hthread *thr, d
* UTF-8 / XUTF-8 / CESU-8 constants
*/
-#define DUK_UNICODE_MAX_XUTF8_LENGTH 7 /* up to 36 bit codepoints */
-#define DUK_UNICODE_MAX_XUTF8_BMP_LENGTH 3 /* all codepoints up to U+FFFF */
-#define DUK_UNICODE_MAX_CESU8_LENGTH 6 /* all codepoints up to U+10FFFF */
-#define DUK_UNICODE_MAX_CESU8_BMP_LENGTH 3 /* all codepoints up to U+FFFF */
+#define DUK_UNICODE_MAX_XUTF8_LENGTH 7 /* up to 36 bit codepoints */
+#define DUK_UNICODE_MAX_XUTF8_BMP_LENGTH 3 /* all codepoints up to U+FFFF */
+#define DUK_UNICODE_MAX_CESU8_LENGTH 6 /* all codepoints up to U+10FFFF */
+#define DUK_UNICODE_MAX_CESU8_BMP_LENGTH 3 /* all codepoints up to U+FFFF */
/*
* Useful Unicode codepoints
@@ -9968,9 +10750,11 @@ DUK_INTERNAL_DECL duk_hobject *duk_error_prototype_from_code(duk_hthread *thr, d
* in comparisons.
*/
-#define DUK_UNICODE_CP_ZWNJ 0x200cL /* zero-width non-joiner */
-#define DUK_UNICODE_CP_ZWJ 0x200dL /* zero-width joiner */
-#define DUK_UNICODE_CP_REPLACEMENT_CHARACTER 0xfffdL /* http://en.wikipedia.org/wiki/Replacement_character#Replacement_character */
+#define DUK_UNICODE_CP_ZWNJ 0x200cL /* zero-width non-joiner */
+#define DUK_UNICODE_CP_ZWJ 0x200dL /* zero-width joiner */
+#define DUK_UNICODE_CP_REPLACEMENT_CHARACTER \
+ 0xfffdL /* http://en.wikipedia.org/wiki/Replacement_character#Replacement_character \
+ */
/*
* ASCII character constants
@@ -9983,134 +10767,134 @@ DUK_INTERNAL_DECL duk_hobject *duk_error_prototype_from_code(duk_hthread *thr, d
* http://en.wikipedia.org/wiki/ASCII
*/
-#define DUK_ASC_NUL 0x00
-#define DUK_ASC_SOH 0x01
-#define DUK_ASC_STX 0x02
-#define DUK_ASC_ETX 0x03
-#define DUK_ASC_EOT 0x04
-#define DUK_ASC_ENQ 0x05
-#define DUK_ASC_ACK 0x06
-#define DUK_ASC_BEL 0x07
-#define DUK_ASC_BS 0x08
-#define DUK_ASC_HT 0x09
-#define DUK_ASC_LF 0x0a
-#define DUK_ASC_VT 0x0b
-#define DUK_ASC_FF 0x0c
-#define DUK_ASC_CR 0x0d
-#define DUK_ASC_SO 0x0e
-#define DUK_ASC_SI 0x0f
-#define DUK_ASC_DLE 0x10
-#define DUK_ASC_DC1 0x11
-#define DUK_ASC_DC2 0x12
-#define DUK_ASC_DC3 0x13
-#define DUK_ASC_DC4 0x14
-#define DUK_ASC_NAK 0x15
-#define DUK_ASC_SYN 0x16
-#define DUK_ASC_ETB 0x17
-#define DUK_ASC_CAN 0x18
-#define DUK_ASC_EM 0x19
-#define DUK_ASC_SUB 0x1a
-#define DUK_ASC_ESC 0x1b
-#define DUK_ASC_FS 0x1c
-#define DUK_ASC_GS 0x1d
-#define DUK_ASC_RS 0x1e
-#define DUK_ASC_US 0x1f
-#define DUK_ASC_SPACE 0x20
-#define DUK_ASC_EXCLAMATION 0x21
-#define DUK_ASC_DOUBLEQUOTE 0x22
-#define DUK_ASC_HASH 0x23
-#define DUK_ASC_DOLLAR 0x24
-#define DUK_ASC_PERCENT 0x25
-#define DUK_ASC_AMP 0x26
-#define DUK_ASC_SINGLEQUOTE 0x27
-#define DUK_ASC_LPAREN 0x28
-#define DUK_ASC_RPAREN 0x29
-#define DUK_ASC_STAR 0x2a
-#define DUK_ASC_PLUS 0x2b
-#define DUK_ASC_COMMA 0x2c
-#define DUK_ASC_MINUS 0x2d
-#define DUK_ASC_PERIOD 0x2e
-#define DUK_ASC_SLASH 0x2f
-#define DUK_ASC_0 0x30
-#define DUK_ASC_1 0x31
-#define DUK_ASC_2 0x32
-#define DUK_ASC_3 0x33
-#define DUK_ASC_4 0x34
-#define DUK_ASC_5 0x35
-#define DUK_ASC_6 0x36
-#define DUK_ASC_7 0x37
-#define DUK_ASC_8 0x38
-#define DUK_ASC_9 0x39
-#define DUK_ASC_COLON 0x3a
-#define DUK_ASC_SEMICOLON 0x3b
-#define DUK_ASC_LANGLE 0x3c
-#define DUK_ASC_EQUALS 0x3d
-#define DUK_ASC_RANGLE 0x3e
-#define DUK_ASC_QUESTION 0x3f
-#define DUK_ASC_ATSIGN 0x40
-#define DUK_ASC_UC_A 0x41
-#define DUK_ASC_UC_B 0x42
-#define DUK_ASC_UC_C 0x43
-#define DUK_ASC_UC_D 0x44
-#define DUK_ASC_UC_E 0x45
-#define DUK_ASC_UC_F 0x46
-#define DUK_ASC_UC_G 0x47
-#define DUK_ASC_UC_H 0x48
-#define DUK_ASC_UC_I 0x49
-#define DUK_ASC_UC_J 0x4a
-#define DUK_ASC_UC_K 0x4b
-#define DUK_ASC_UC_L 0x4c
-#define DUK_ASC_UC_M 0x4d
-#define DUK_ASC_UC_N 0x4e
-#define DUK_ASC_UC_O 0x4f
-#define DUK_ASC_UC_P 0x50
-#define DUK_ASC_UC_Q 0x51
-#define DUK_ASC_UC_R 0x52
-#define DUK_ASC_UC_S 0x53
-#define DUK_ASC_UC_T 0x54
-#define DUK_ASC_UC_U 0x55
-#define DUK_ASC_UC_V 0x56
-#define DUK_ASC_UC_W 0x57
-#define DUK_ASC_UC_X 0x58
-#define DUK_ASC_UC_Y 0x59
-#define DUK_ASC_UC_Z 0x5a
-#define DUK_ASC_LBRACKET 0x5b
-#define DUK_ASC_BACKSLASH 0x5c
-#define DUK_ASC_RBRACKET 0x5d
-#define DUK_ASC_CARET 0x5e
-#define DUK_ASC_UNDERSCORE 0x5f
-#define DUK_ASC_GRAVE 0x60
-#define DUK_ASC_LC_A 0x61
-#define DUK_ASC_LC_B 0x62
-#define DUK_ASC_LC_C 0x63
-#define DUK_ASC_LC_D 0x64
-#define DUK_ASC_LC_E 0x65
-#define DUK_ASC_LC_F 0x66
-#define DUK_ASC_LC_G 0x67
-#define DUK_ASC_LC_H 0x68
-#define DUK_ASC_LC_I 0x69
-#define DUK_ASC_LC_J 0x6a
-#define DUK_ASC_LC_K 0x6b
-#define DUK_ASC_LC_L 0x6c
-#define DUK_ASC_LC_M 0x6d
-#define DUK_ASC_LC_N 0x6e
-#define DUK_ASC_LC_O 0x6f
-#define DUK_ASC_LC_P 0x70
-#define DUK_ASC_LC_Q 0x71
-#define DUK_ASC_LC_R 0x72
-#define DUK_ASC_LC_S 0x73
-#define DUK_ASC_LC_T 0x74
-#define DUK_ASC_LC_U 0x75
-#define DUK_ASC_LC_V 0x76
-#define DUK_ASC_LC_W 0x77
-#define DUK_ASC_LC_X 0x78
-#define DUK_ASC_LC_Y 0x79
-#define DUK_ASC_LC_Z 0x7a
-#define DUK_ASC_LCURLY 0x7b
-#define DUK_ASC_PIPE 0x7c
-#define DUK_ASC_RCURLY 0x7d
-#define DUK_ASC_TILDE 0x7e
-#define DUK_ASC_DEL 0x7f
+#define DUK_ASC_NUL 0x00
+#define DUK_ASC_SOH 0x01
+#define DUK_ASC_STX 0x02
+#define DUK_ASC_ETX 0x03
+#define DUK_ASC_EOT 0x04
+#define DUK_ASC_ENQ 0x05
+#define DUK_ASC_ACK 0x06
+#define DUK_ASC_BEL 0x07
+#define DUK_ASC_BS 0x08
+#define DUK_ASC_HT 0x09
+#define DUK_ASC_LF 0x0a
+#define DUK_ASC_VT 0x0b
+#define DUK_ASC_FF 0x0c
+#define DUK_ASC_CR 0x0d
+#define DUK_ASC_SO 0x0e
+#define DUK_ASC_SI 0x0f
+#define DUK_ASC_DLE 0x10
+#define DUK_ASC_DC1 0x11
+#define DUK_ASC_DC2 0x12
+#define DUK_ASC_DC3 0x13
+#define DUK_ASC_DC4 0x14
+#define DUK_ASC_NAK 0x15
+#define DUK_ASC_SYN 0x16
+#define DUK_ASC_ETB 0x17
+#define DUK_ASC_CAN 0x18
+#define DUK_ASC_EM 0x19
+#define DUK_ASC_SUB 0x1a
+#define DUK_ASC_ESC 0x1b
+#define DUK_ASC_FS 0x1c
+#define DUK_ASC_GS 0x1d
+#define DUK_ASC_RS 0x1e
+#define DUK_ASC_US 0x1f
+#define DUK_ASC_SPACE 0x20
+#define DUK_ASC_EXCLAMATION 0x21
+#define DUK_ASC_DOUBLEQUOTE 0x22
+#define DUK_ASC_HASH 0x23
+#define DUK_ASC_DOLLAR 0x24
+#define DUK_ASC_PERCENT 0x25
+#define DUK_ASC_AMP 0x26
+#define DUK_ASC_SINGLEQUOTE 0x27
+#define DUK_ASC_LPAREN 0x28
+#define DUK_ASC_RPAREN 0x29
+#define DUK_ASC_STAR 0x2a
+#define DUK_ASC_PLUS 0x2b
+#define DUK_ASC_COMMA 0x2c
+#define DUK_ASC_MINUS 0x2d
+#define DUK_ASC_PERIOD 0x2e
+#define DUK_ASC_SLASH 0x2f
+#define DUK_ASC_0 0x30
+#define DUK_ASC_1 0x31
+#define DUK_ASC_2 0x32
+#define DUK_ASC_3 0x33
+#define DUK_ASC_4 0x34
+#define DUK_ASC_5 0x35
+#define DUK_ASC_6 0x36
+#define DUK_ASC_7 0x37
+#define DUK_ASC_8 0x38
+#define DUK_ASC_9 0x39
+#define DUK_ASC_COLON 0x3a
+#define DUK_ASC_SEMICOLON 0x3b
+#define DUK_ASC_LANGLE 0x3c
+#define DUK_ASC_EQUALS 0x3d
+#define DUK_ASC_RANGLE 0x3e
+#define DUK_ASC_QUESTION 0x3f
+#define DUK_ASC_ATSIGN 0x40
+#define DUK_ASC_UC_A 0x41
+#define DUK_ASC_UC_B 0x42
+#define DUK_ASC_UC_C 0x43
+#define DUK_ASC_UC_D 0x44
+#define DUK_ASC_UC_E 0x45
+#define DUK_ASC_UC_F 0x46
+#define DUK_ASC_UC_G 0x47
+#define DUK_ASC_UC_H 0x48
+#define DUK_ASC_UC_I 0x49
+#define DUK_ASC_UC_J 0x4a
+#define DUK_ASC_UC_K 0x4b
+#define DUK_ASC_UC_L 0x4c
+#define DUK_ASC_UC_M 0x4d
+#define DUK_ASC_UC_N 0x4e
+#define DUK_ASC_UC_O 0x4f
+#define DUK_ASC_UC_P 0x50
+#define DUK_ASC_UC_Q 0x51
+#define DUK_ASC_UC_R 0x52
+#define DUK_ASC_UC_S 0x53
+#define DUK_ASC_UC_T 0x54
+#define DUK_ASC_UC_U 0x55
+#define DUK_ASC_UC_V 0x56
+#define DUK_ASC_UC_W 0x57
+#define DUK_ASC_UC_X 0x58
+#define DUK_ASC_UC_Y 0x59
+#define DUK_ASC_UC_Z 0x5a
+#define DUK_ASC_LBRACKET 0x5b
+#define DUK_ASC_BACKSLASH 0x5c
+#define DUK_ASC_RBRACKET 0x5d
+#define DUK_ASC_CARET 0x5e
+#define DUK_ASC_UNDERSCORE 0x5f
+#define DUK_ASC_GRAVE 0x60
+#define DUK_ASC_LC_A 0x61
+#define DUK_ASC_LC_B 0x62
+#define DUK_ASC_LC_C 0x63
+#define DUK_ASC_LC_D 0x64
+#define DUK_ASC_LC_E 0x65
+#define DUK_ASC_LC_F 0x66
+#define DUK_ASC_LC_G 0x67
+#define DUK_ASC_LC_H 0x68
+#define DUK_ASC_LC_I 0x69
+#define DUK_ASC_LC_J 0x6a
+#define DUK_ASC_LC_K 0x6b
+#define DUK_ASC_LC_L 0x6c
+#define DUK_ASC_LC_M 0x6d
+#define DUK_ASC_LC_N 0x6e
+#define DUK_ASC_LC_O 0x6f
+#define DUK_ASC_LC_P 0x70
+#define DUK_ASC_LC_Q 0x71
+#define DUK_ASC_LC_R 0x72
+#define DUK_ASC_LC_S 0x73
+#define DUK_ASC_LC_T 0x74
+#define DUK_ASC_LC_U 0x75
+#define DUK_ASC_LC_V 0x76
+#define DUK_ASC_LC_W 0x77
+#define DUK_ASC_LC_X 0x78
+#define DUK_ASC_LC_Y 0x79
+#define DUK_ASC_LC_Z 0x7a
+#define DUK_ASC_LCURLY 0x7b
+#define DUK_ASC_PIPE 0x7c
+#define DUK_ASC_RCURLY 0x7d
+#define DUK_ASC_TILDE 0x7e
+#define DUK_ASC_DEL 0x7f
/*
* Miscellaneous
@@ -10119,7 +10903,7 @@ DUK_INTERNAL_DECL duk_hobject *duk_error_prototype_from_code(duk_hthread *thr, d
/* Uppercase A is 0x41, lowercase a is 0x61; OR 0x20 to convert uppercase
* to lowercase.
*/
-#define DUK_LOWERCASE_CHAR_ASCII(x) ((x) | 0x20)
+#define DUK_LOWERCASE_CHAR_ASCII(x) ((x) | 0x20)
/*
* Unicode tables
@@ -10207,7 +10991,7 @@ DUK_INTERNAL_DECL const duk_uint16_t duk_unicode_re_ranges_not_digit[4];
DUK_INTERNAL_DECL const duk_uint16_t duk_unicode_re_ranges_not_white[24];
DUK_INTERNAL_DECL const duk_uint16_t duk_unicode_re_ranges_not_wordchar[10];
DUK_INTERNAL_DECL const duk_int8_t duk_is_idchar_tab[128];
-#endif /* !DUK_SINGLE_FILE */
+#endif /* !DUK_SINGLE_FILE */
/*
* Prototypes
@@ -10219,9 +11003,17 @@ DUK_INTERNAL_DECL duk_small_int_t duk_unicode_get_cesu8_length(duk_ucodepoint_t
#endif
DUK_INTERNAL_DECL duk_small_int_t duk_unicode_encode_xutf8(duk_ucodepoint_t cp, duk_uint8_t *out);
DUK_INTERNAL_DECL duk_small_int_t duk_unicode_encode_cesu8(duk_ucodepoint_t cp, duk_uint8_t *out);
-DUK_INTERNAL_DECL duk_small_int_t duk_unicode_decode_xutf8(duk_hthread *thr, const duk_uint8_t **ptr, const duk_uint8_t *ptr_start, const duk_uint8_t *ptr_end, duk_ucodepoint_t *out_cp);
-DUK_INTERNAL_DECL duk_ucodepoint_t duk_unicode_decode_xutf8_checked(duk_hthread *thr, const duk_uint8_t **ptr, const duk_uint8_t *ptr_start, const duk_uint8_t *ptr_end);
+DUK_INTERNAL_DECL duk_small_int_t duk_unicode_decode_xutf8(duk_hthread *thr,
+ const duk_uint8_t **ptr,
+ const duk_uint8_t *ptr_start,
+ const duk_uint8_t *ptr_end,
+ duk_ucodepoint_t *out_cp);
+DUK_INTERNAL_DECL duk_ucodepoint_t duk_unicode_decode_xutf8_checked(duk_hthread *thr,
+ const duk_uint8_t **ptr,
+ const duk_uint8_t *ptr_start,
+ const duk_uint8_t *ptr_end);
DUK_INTERNAL_DECL duk_size_t duk_unicode_unvalidated_utf8_length(const duk_uint8_t *data, duk_size_t blen);
+DUK_INTERNAL_DECL duk_bool_t duk_unicode_is_utf8_compatible(const duk_uint8_t *buf, duk_size_t len);
DUK_INTERNAL_DECL duk_small_int_t duk_unicode_is_whitespace(duk_codepoint_t cp);
DUK_INTERNAL_DECL duk_small_int_t duk_unicode_is_line_terminator(duk_codepoint_t cp);
DUK_INTERNAL_DECL duk_small_int_t duk_unicode_is_identifier_start(duk_codepoint_t cp);
@@ -10233,7 +11025,7 @@ DUK_INTERNAL_DECL duk_codepoint_t duk_unicode_re_canonicalize_char(duk_hthread *
DUK_INTERNAL_DECL duk_small_int_t duk_unicode_re_is_wordchar(duk_codepoint_t cp);
#endif
-#endif /* DUK_UNICODE_H_INCLUDED */
+#endif /* DUK_UNICODE_H_INCLUDED */
/* #include duk_json.h */
/*
* Defines for JSON, especially duk_bi_json.c.
@@ -10243,28 +11035,28 @@ DUK_INTERNAL_DECL duk_small_int_t duk_unicode_re_is_wordchar(duk_codepoint_t cp)
#define DUK_JSON_H_INCLUDED
/* Encoding/decoding flags */
-#define DUK_JSON_FLAG_ASCII_ONLY (1U << 0) /* escape any non-ASCII characters */
-#define DUK_JSON_FLAG_AVOID_KEY_QUOTES (1U << 1) /* avoid key quotes when key is an ASCII Identifier */
-#define DUK_JSON_FLAG_EXT_CUSTOM (1U << 2) /* extended types: custom encoding */
-#define DUK_JSON_FLAG_EXT_COMPATIBLE (1U << 3) /* extended types: compatible encoding */
+#define DUK_JSON_FLAG_ASCII_ONLY (1U << 0) /* escape any non-ASCII characters */
+#define DUK_JSON_FLAG_AVOID_KEY_QUOTES (1U << 1) /* avoid key quotes when key is an ASCII Identifier */
+#define DUK_JSON_FLAG_EXT_CUSTOM (1U << 2) /* extended types: custom encoding */
+#define DUK_JSON_FLAG_EXT_COMPATIBLE (1U << 3) /* extended types: compatible encoding */
/* How much stack to require on entry to object/array encode */
-#define DUK_JSON_ENC_REQSTACK 32
+#define DUK_JSON_ENC_REQSTACK 32
/* How much stack to require on entry to object/array decode */
-#define DUK_JSON_DEC_REQSTACK 32
+#define DUK_JSON_DEC_REQSTACK 32
/* How large a loop detection stack to use */
-#define DUK_JSON_ENC_LOOPARRAY 64
+#define DUK_JSON_ENC_LOOPARRAY 64
/* Encoding state. Heap object references are all borrowed. */
typedef struct {
duk_hthread *thr;
- duk_bufwriter_ctx bw; /* output bufwriter */
- duk_hobject *h_replacer; /* replacer function */
- duk_hstring *h_gap; /* gap (if empty string, NULL) */
- duk_idx_t idx_proplist; /* explicit PropertyList */
- duk_idx_t idx_loop; /* valstack index of loop detection object */
+ duk_bufwriter_ctx bw; /* output bufwriter */
+ duk_hobject *h_replacer; /* replacer function */
+ duk_hstring *h_gap; /* gap (if empty string, NULL) */
+ duk_idx_t idx_proplist; /* explicit PropertyList */
+ duk_idx_t idx_loop; /* valstack index of loop detection object */
duk_small_uint_t flags;
duk_small_uint_t flag_ascii_only;
duk_small_uint_t flag_avoid_key_quotes;
@@ -10275,7 +11067,7 @@ typedef struct {
#endif
duk_uint_t recursion_depth;
duk_uint_t recursion_limit;
- duk_uint_t mask_for_undefined; /* type bit mask: types which certainly produce 'undefined' */
+ duk_uint_t mask_for_undefined; /* type bit mask: types which certainly produce 'undefined' */
#if defined(DUK_USE_JX) || defined(DUK_USE_JC)
duk_small_uint_t stridx_custom_undefined;
duk_small_uint_t stridx_custom_nan;
@@ -10283,7 +11075,7 @@ typedef struct {
duk_small_uint_t stridx_custom_posinf;
duk_small_uint_t stridx_custom_function;
#endif
- duk_hobject *visiting[DUK_JSON_ENC_LOOPARRAY]; /* indexed by recursion_depth */
+ duk_hobject *visiting[DUK_JSON_ENC_LOOPARRAY]; /* indexed by recursion_depth */
} duk_json_enc_ctx;
typedef struct {
@@ -10302,7 +11094,7 @@ typedef struct {
duk_int_t recursion_limit;
} duk_json_dec_ctx;
-#endif /* DUK_JSON_H_INCLUDED */
+#endif /* DUK_JSON_H_INCLUDED */
/* #include duk_js.h */
/*
* ECMAScript execution, support primitives.
@@ -10312,21 +11104,22 @@ typedef struct {
#define DUK_JS_H_INCLUDED
/* Flags for call handling. Lowest flags must match bytecode DUK_BC_CALL_FLAG_xxx 1:1. */
-#define DUK_CALL_FLAG_TAILCALL (1U << 0) /* setup for a tail call */
-#define DUK_CALL_FLAG_CONSTRUCT (1U << 1) /* constructor call (i.e. called as 'new Foo()') */
-#define DUK_CALL_FLAG_CALLED_AS_EVAL (1U << 2) /* call was made using the identifier 'eval' */
-#define DUK_CALL_FLAG_ALLOW_ECMATOECMA (1U << 3) /* ecma-to-ecma call with executor reuse is possible */
-#define DUK_CALL_FLAG_DIRECT_EVAL (1U << 4) /* call is a direct eval call */
-#define DUK_CALL_FLAG_CONSTRUCT_PROXY (1U << 5) /* handled via 'construct' proxy trap, check return value invariant(s) */
-#define DUK_CALL_FLAG_DEFAULT_INSTANCE_UPDATED (1U << 6) /* prototype of 'default instance' updated, temporary flag in call handling */
+#define DUK_CALL_FLAG_TAILCALL (1U << 0) /* setup for a tail call */
+#define DUK_CALL_FLAG_CONSTRUCT (1U << 1) /* constructor call (i.e. called as 'new Foo()') */
+#define DUK_CALL_FLAG_CALLED_AS_EVAL (1U << 2) /* call was made using the identifier 'eval' */
+#define DUK_CALL_FLAG_ALLOW_ECMATOECMA (1U << 3) /* ecma-to-ecma call with executor reuse is possible */
+#define DUK_CALL_FLAG_DIRECT_EVAL (1U << 4) /* call is a direct eval call */
+#define DUK_CALL_FLAG_CONSTRUCT_PROXY (1U << 5) /* handled via 'construct' proxy trap, check return value invariant(s) */
+#define DUK_CALL_FLAG_DEFAULT_INSTANCE_UPDATED \
+ (1U << 6) /* prototype of 'default instance' updated, temporary flag in call handling */
/* Flags for duk_js_equals_helper(). */
-#define DUK_EQUALS_FLAG_SAMEVALUE (1U << 0) /* use SameValue instead of non-strict equality */
-#define DUK_EQUALS_FLAG_STRICT (1U << 1) /* use strict equality instead of non-strict equality */
+#define DUK_EQUALS_FLAG_SAMEVALUE (1U << 0) /* use SameValue instead of non-strict equality */
+#define DUK_EQUALS_FLAG_STRICT (1U << 1) /* use strict equality instead of non-strict equality */
/* Flags for duk_js_compare_helper(). */
-#define DUK_COMPARE_FLAG_NEGATE (1U << 0) /* negate result */
-#define DUK_COMPARE_FLAG_EVAL_LEFT_FIRST (1U << 1) /* eval left argument first */
+#define DUK_COMPARE_FLAG_NEGATE (1U << 0) /* negate result */
+#define DUK_COMPARE_FLAG_EVAL_LEFT_FIRST (1U << 1) /* eval left argument first */
/* conversions, coercions, comparison, etc */
DUK_INTERNAL_DECL duk_bool_t duk_js_toboolean(duk_tval *tv);
@@ -10342,9 +11135,12 @@ DUK_INTERNAL_DECL duk_uarridx_t duk_js_to_arrayindex_hstring_fast_known(duk_hstr
DUK_INTERNAL_DECL duk_uarridx_t duk_js_to_arrayindex_hstring_fast(duk_hstring *h);
#endif
DUK_INTERNAL_DECL duk_bool_t duk_js_equals_helper(duk_hthread *thr, duk_tval *tv_x, duk_tval *tv_y, duk_small_uint_t flags);
-DUK_INTERNAL_DECL duk_small_int_t duk_js_data_compare(const duk_uint8_t *buf1, const duk_uint8_t *buf2, duk_size_t len1, duk_size_t len2);
+DUK_INTERNAL_DECL duk_small_int_t duk_js_data_compare(const duk_uint8_t *buf1,
+ const duk_uint8_t *buf2,
+ duk_size_t len1,
+ duk_size_t len2);
DUK_INTERNAL_DECL duk_small_int_t duk_js_string_compare(duk_hstring *h1, duk_hstring *h2);
-#if 0 /* unused */
+#if 0 /* unused */
DUK_INTERNAL_DECL duk_small_int_t duk_js_buffer_compare(duk_heap *heap, duk_hbuffer *h1, duk_hbuffer *h2);
#endif
DUK_INTERNAL_DECL duk_bool_t duk_js_compare_helper(duk_hthread *thr, duk_tval *tv_x, duk_tval *tv_y, duk_small_uint_t flags);
@@ -10354,50 +11150,64 @@ DUK_INTERNAL_DECL duk_bool_t duk_js_instanceof_ordinary(duk_hthread *thr, duk_tv
#endif
DUK_INTERNAL_DECL duk_bool_t duk_js_in(duk_hthread *thr, duk_tval *tv_x, duk_tval *tv_y);
DUK_INTERNAL_DECL duk_small_uint_t duk_js_typeof_stridx(duk_tval *tv_x);
+DUK_INTERNAL_DECL duk_bool_t duk_js_isarray_hobject(duk_hobject *h);
+DUK_INTERNAL_DECL duk_bool_t duk_js_isarray(duk_tval *tv);
/* arithmetic */
DUK_INTERNAL_DECL double duk_js_arith_pow(double x, double y);
DUK_INTERNAL_DECL double duk_js_arith_mod(double x, double y);
-#define duk_js_equals(thr,tv_x,tv_y) \
- duk_js_equals_helper((thr), (tv_x), (tv_y), 0)
-#define duk_js_strict_equals(tv_x,tv_y) \
- duk_js_equals_helper(NULL, (tv_x), (tv_y), DUK_EQUALS_FLAG_STRICT)
-#define duk_js_samevalue(tv_x,tv_y) \
- duk_js_equals_helper(NULL, (tv_x), (tv_y), DUK_EQUALS_FLAG_SAMEVALUE)
+#define duk_js_equals(thr, tv_x, tv_y) duk_js_equals_helper((thr), (tv_x), (tv_y), 0)
+#define duk_js_strict_equals(tv_x, tv_y) duk_js_equals_helper(NULL, (tv_x), (tv_y), DUK_EQUALS_FLAG_STRICT)
+#define duk_js_samevalue(tv_x, tv_y) duk_js_equals_helper(NULL, (tv_x), (tv_y), DUK_EQUALS_FLAG_SAMEVALUE)
/* E5 Sections 11.8.1, 11.8.5; x < y */
-#define duk_js_lessthan(thr,tv_x,tv_y) \
- duk_js_compare_helper((thr), (tv_x), (tv_Y), DUK_COMPARE_FLAG_EVAL_LEFT_FIRST)
+#define duk_js_lessthan(thr, tv_x, tv_y) duk_js_compare_helper((thr), (tv_x), (tv_Y), DUK_COMPARE_FLAG_EVAL_LEFT_FIRST)
/* E5 Sections 11.8.2, 11.8.5; x > y --> y < x */
-#define duk_js_greaterthan(thr,tv_x,tv_y) \
- duk_js_compare_helper((thr), (tv_y), (tv_x), 0)
+#define duk_js_greaterthan(thr, tv_x, tv_y) duk_js_compare_helper((thr), (tv_y), (tv_x), 0)
/* E5 Sections 11.8.3, 11.8.5; x <= y --> not (x > y) --> not (y < x) */
-#define duk_js_lessthanorequal(thr,tv_x,tv_y) \
- duk_js_compare_helper((thr), (tv_y), (tv_x), DUK_COMPARE_FLAG_NEGATE)
+#define duk_js_lessthanorequal(thr, tv_x, tv_y) duk_js_compare_helper((thr), (tv_y), (tv_x), DUK_COMPARE_FLAG_NEGATE)
/* E5 Sections 11.8.4, 11.8.5; x >= y --> not (x < y) */
-#define duk_js_greaterthanorequal(thr,tv_x,tv_y) \
+#define duk_js_greaterthanorequal(thr, tv_x, tv_y) \
duk_js_compare_helper((thr), (tv_x), (tv_y), DUK_COMPARE_FLAG_EVAL_LEFT_FIRST | DUK_COMPARE_FLAG_NEGATE)
/* identifiers and environment handling */
-#if 0 /*unused*/
+#if 0 /*unused*/
DUK_INTERNAL duk_bool_t duk_js_hasvar_envrec(duk_hthread *thr, duk_hobject *env, duk_hstring *name);
#endif
DUK_INTERNAL_DECL duk_bool_t duk_js_getvar_envrec(duk_hthread *thr, duk_hobject *env, duk_hstring *name, duk_bool_t throw_flag);
-DUK_INTERNAL_DECL duk_bool_t duk_js_getvar_activation(duk_hthread *thr, duk_activation *act, duk_hstring *name, duk_bool_t throw_flag);
-DUK_INTERNAL_DECL void duk_js_putvar_envrec(duk_hthread *thr, duk_hobject *env, duk_hstring *name, duk_tval *val, duk_bool_t strict);
-DUK_INTERNAL_DECL void duk_js_putvar_activation(duk_hthread *thr, duk_activation *act, duk_hstring *name, duk_tval *val, duk_bool_t strict);
-#if 0 /*unused*/
+DUK_INTERNAL_DECL duk_bool_t duk_js_getvar_activation(duk_hthread *thr,
+ duk_activation *act,
+ duk_hstring *name,
+ duk_bool_t throw_flag);
+DUK_INTERNAL_DECL void duk_js_putvar_envrec(duk_hthread *thr,
+ duk_hobject *env,
+ duk_hstring *name,
+ duk_tval *val,
+ duk_bool_t strict);
+DUK_INTERNAL_DECL void duk_js_putvar_activation(duk_hthread *thr,
+ duk_activation *act,
+ duk_hstring *name,
+ duk_tval *val,
+ duk_bool_t strict);
+#if 0 /*unused*/
DUK_INTERNAL_DECL duk_bool_t duk_js_delvar_envrec(duk_hthread *thr, duk_hobject *env, duk_hstring *name);
#endif
DUK_INTERNAL_DECL duk_bool_t duk_js_delvar_activation(duk_hthread *thr, duk_activation *act, duk_hstring *name);
-DUK_INTERNAL_DECL duk_bool_t duk_js_declvar_activation(duk_hthread *thr, duk_activation *act, duk_hstring *name, duk_tval *val, duk_small_uint_t prop_flags, duk_bool_t is_func_decl);
+DUK_INTERNAL_DECL duk_bool_t duk_js_declvar_activation(duk_hthread *thr,
+ duk_activation *act,
+ duk_hstring *name,
+ duk_tval *val,
+ duk_small_uint_t prop_flags,
+ duk_bool_t is_func_decl);
DUK_INTERNAL_DECL void duk_js_init_activation_environment_records_delayed(duk_hthread *thr, duk_activation *act);
DUK_INTERNAL_DECL void duk_js_close_environment_record(duk_hthread *thr, duk_hobject *env);
-DUK_INTERNAL_DECL duk_hobject *duk_create_activation_environment_record(duk_hthread *thr, duk_hobject *func, duk_size_t bottom_byteoff);
+DUK_INTERNAL_DECL duk_hobject *duk_create_activation_environment_record(duk_hthread *thr,
+ duk_hobject *func,
+ duk_size_t bottom_byteoff);
DUK_INTERNAL_DECL void duk_js_push_closure(duk_hthread *thr,
duk_hcompfunc *fun_temp,
duk_hobject *outer_var_env,
@@ -10408,7 +11218,8 @@ DUK_INTERNAL_DECL void duk_js_push_closure(duk_hthread *thr,
DUK_INTERNAL_DECL void duk_native_stack_check(duk_hthread *thr);
DUK_INTERNAL_DECL duk_int_t duk_handle_call_unprotected(duk_hthread *thr, duk_idx_t idx_func, duk_small_uint_t call_flags);
DUK_INTERNAL_DECL duk_int_t duk_handle_call_unprotected_nargs(duk_hthread *thr, duk_idx_t nargs, duk_small_uint_t call_flags);
-DUK_INTERNAL_DECL duk_int_t duk_handle_safe_call(duk_hthread *thr, duk_safe_call_function func, void *udata, duk_idx_t num_stack_args, duk_idx_t num_stack_res);
+DUK_INTERNAL_DECL duk_int_t
+duk_handle_safe_call(duk_hthread *thr, duk_safe_call_function func, void *udata, duk_idx_t num_stack_args, duk_idx_t num_stack_res);
DUK_INTERNAL_DECL void duk_call_construct_postprocess(duk_hthread *thr, duk_small_uint_t proxy_invariant);
#if defined(DUK_USE_VERBOSE_ERRORS)
DUK_INTERNAL_DECL void duk_call_setup_propcall_error(duk_hthread *thr, duk_tval *tv_base, duk_tval *tv_key);
@@ -10417,7 +11228,7 @@ DUK_INTERNAL_DECL void duk_call_setup_propcall_error(duk_hthread *thr, duk_tval
/* bytecode execution */
DUK_INTERNAL_DECL void duk_js_execute_bytecode(duk_hthread *exec_thr);
-#endif /* DUK_JS_H_INCLUDED */
+#endif /* DUK_JS_H_INCLUDED */
/* #include duk_numconv.h */
/*
* Number-to-string conversion. The semantics of these is very tightly
@@ -10430,23 +11241,23 @@ DUK_INTERNAL_DECL void duk_js_execute_bytecode(duk_hthread *exec_thr);
/* Output a specified number of digits instead of using the shortest
* form. Used for toPrecision() and toFixed().
*/
-#define DUK_N2S_FLAG_FIXED_FORMAT (1U << 0)
+#define DUK_N2S_FLAG_FIXED_FORMAT (1U << 0)
/* Force exponential format. Used for toExponential(). */
-#define DUK_N2S_FLAG_FORCE_EXP (1U << 1)
+#define DUK_N2S_FLAG_FORCE_EXP (1U << 1)
/* If number would need zero padding (for whole number part), use
* exponential format instead. E.g. if input number is 12300, 3
* digits are generated ("123"), output "1.23e+4" instead of "12300".
* Used for toPrecision().
*/
-#define DUK_N2S_FLAG_NO_ZERO_PAD (1U << 2)
+#define DUK_N2S_FLAG_NO_ZERO_PAD (1U << 2)
/* Digit count indicates number of fractions (i.e. an absolute
* digit index instead of a relative one). Used together with
* DUK_N2S_FLAG_FIXED_FORMAT for toFixed().
*/
-#define DUK_N2S_FLAG_FRACTION_DIGITS (1U << 3)
+#define DUK_N2S_FLAG_FRACTION_DIGITS (1U << 3)
/*
* String-to-number conversion
@@ -10460,69 +11271,72 @@ DUK_INTERNAL_DECL void duk_js_execute_bytecode(duk_hthread *exec_thr);
* radix 10, but with maximum radix (36) a safe limit is:
* (10000000*36).toString(16) -> '15752a00'
*/
-#define DUK_S2N_MAX_EXPONENT 10000000L
+#define DUK_S2N_MAX_EXPONENT 10000000L
/* Trim white space (= allow leading and trailing whitespace) */
-#define DUK_S2N_FLAG_TRIM_WHITE (1U << 0)
+#define DUK_S2N_FLAG_TRIM_WHITE (1U << 0)
/* Allow exponent */
-#define DUK_S2N_FLAG_ALLOW_EXP (1U << 1)
+#define DUK_S2N_FLAG_ALLOW_EXP (1U << 1)
/* Allow trailing garbage (e.g. treat "123foo" as "123) */
-#define DUK_S2N_FLAG_ALLOW_GARBAGE (1U << 2)
+#define DUK_S2N_FLAG_ALLOW_GARBAGE (1U << 2)
/* Allow leading plus sign */
-#define DUK_S2N_FLAG_ALLOW_PLUS (1U << 3)
+#define DUK_S2N_FLAG_ALLOW_PLUS (1U << 3)
/* Allow leading minus sign */
-#define DUK_S2N_FLAG_ALLOW_MINUS (1U << 4)
+#define DUK_S2N_FLAG_ALLOW_MINUS (1U << 4)
/* Allow 'Infinity' */
-#define DUK_S2N_FLAG_ALLOW_INF (1U << 5)
+#define DUK_S2N_FLAG_ALLOW_INF (1U << 5)
/* Allow fraction part */
-#define DUK_S2N_FLAG_ALLOW_FRAC (1U << 6)
+#define DUK_S2N_FLAG_ALLOW_FRAC (1U << 6)
/* Allow naked fraction (e.g. ".123") */
-#define DUK_S2N_FLAG_ALLOW_NAKED_FRAC (1U << 7)
+#define DUK_S2N_FLAG_ALLOW_NAKED_FRAC (1U << 7)
/* Allow empty fraction (e.g. "123.") */
-#define DUK_S2N_FLAG_ALLOW_EMPTY_FRAC (1U << 8)
+#define DUK_S2N_FLAG_ALLOW_EMPTY_FRAC (1U << 8)
/* Allow empty string to be interpreted as 0 */
-#define DUK_S2N_FLAG_ALLOW_EMPTY_AS_ZERO (1U << 9)
+#define DUK_S2N_FLAG_ALLOW_EMPTY_AS_ZERO (1U << 9)
/* Allow leading zeroes (e.g. "0123" -> "123") */
-#define DUK_S2N_FLAG_ALLOW_LEADING_ZERO (1U << 10)
+#define DUK_S2N_FLAG_ALLOW_LEADING_ZERO (1U << 10)
/* Allow automatic detection of hex base ("0x" or "0X" prefix),
* overrides radix argument and forces integer mode.
*/
-#define DUK_S2N_FLAG_ALLOW_AUTO_HEX_INT (1U << 11)
+#define DUK_S2N_FLAG_ALLOW_AUTO_HEX_INT (1U << 11)
/* Allow automatic detection of legacy octal base ("0n"),
* overrides radix argument and forces integer mode.
*/
-#define DUK_S2N_FLAG_ALLOW_AUTO_LEGACY_OCT_INT (1U << 12)
+#define DUK_S2N_FLAG_ALLOW_AUTO_LEGACY_OCT_INT (1U << 12)
/* Allow automatic detection of ES2015 octal base ("0o123"),
* overrides radix argument and forces integer mode.
*/
-#define DUK_S2N_FLAG_ALLOW_AUTO_OCT_INT (1U << 13)
+#define DUK_S2N_FLAG_ALLOW_AUTO_OCT_INT (1U << 13)
/* Allow automatic detection of ES2015 binary base ("0b10001"),
* overrides radix argument and forces integer mode.
*/
-#define DUK_S2N_FLAG_ALLOW_AUTO_BIN_INT (1U << 14)
+#define DUK_S2N_FLAG_ALLOW_AUTO_BIN_INT (1U << 14)
/*
* Prototypes
*/
-DUK_INTERNAL_DECL void duk_numconv_stringify(duk_hthread *thr, duk_small_int_t radix, duk_small_int_t digits, duk_small_uint_t flags);
+DUK_INTERNAL_DECL void duk_numconv_stringify(duk_hthread *thr,
+ duk_small_int_t radix,
+ duk_small_int_t digits,
+ duk_small_uint_t flags);
DUK_INTERNAL_DECL void duk_numconv_parse(duk_hthread *thr, duk_small_int_t radix, duk_small_uint_t flags);
-#endif /* DUK_NUMCONV_H_INCLUDED */
+#endif /* DUK_NUMCONV_H_INCLUDED */
/* #include duk_bi_protos.h */
/*
* Prototypes for built-in functions not automatically covered by the
@@ -10538,7 +11352,7 @@ DUK_INTERNAL_DECL void duk_numconv_parse(duk_hthread *thr, duk_small_int_t radix
* 32
* Include additional space to be safe.
*/
-#define DUK_BI_DATE_ISO8601_BUFSIZE 40
+#define DUK_BI_DATE_ISO8601_BUFSIZE 40
/* Helpers exposed for internal use */
DUK_INTERNAL_DECL void duk_bi_date_timeval_to_parts(duk_double_t d, duk_int_t *parts, duk_double_t *dparts, duk_small_uint_t flags);
@@ -10576,7 +11390,10 @@ DUK_INTERNAL_DECL duk_bool_t duk_bi_date_parse_string_strptime(duk_hthread *thr,
DUK_INTERNAL_DECL duk_bool_t duk_bi_date_parse_string_getdate(duk_hthread *thr, const char *str);
#endif
#if defined(DUK_USE_DATE_FMT_STRFTIME)
-DUK_INTERNAL_DECL duk_bool_t duk_bi_date_format_parts_strftime(duk_hthread *thr, duk_int_t *parts, duk_int_t tzoffset, duk_small_uint_t flags);
+DUK_INTERNAL_DECL duk_bool_t duk_bi_date_format_parts_strftime(duk_hthread *thr,
+ duk_int_t *parts,
+ duk_int_t tzoffset,
+ duk_small_uint_t flags);
#endif
#if defined(DUK_USE_GET_MONOTONIC_TIME_CLOCK_GETTIME)
@@ -10587,10 +11404,7 @@ DUK_INTERNAL_DECL duk_double_t duk_bi_date_get_monotonic_time_windows_qpc(void);
#endif
DUK_INTERNAL_DECL
-void duk_bi_json_parse_helper(duk_hthread *thr,
- duk_idx_t idx_value,
- duk_idx_t idx_reviver,
- duk_small_uint_t flags);
+void duk_bi_json_parse_helper(duk_hthread *thr, duk_idx_t idx_value, duk_idx_t idx_reviver, duk_small_uint_t flags);
DUK_INTERNAL_DECL
void duk_bi_json_stringify_helper(duk_hthread *thr,
duk_idx_t idx_value,
@@ -10604,7 +11418,7 @@ DUK_INTERNAL_DECL duk_ret_t duk_textdecoder_decode_utf8_nodejs(duk_hthread *thr)
DUK_INTERNAL_DECL void duk_proxy_ownkeys_postprocess(duk_hthread *thr, duk_hobject *h_proxy_target, duk_uint_t flags);
#endif
-#endif /* DUK_BUILTIN_PROTOS_H_INCLUDED */
+#endif /* DUK_BUILTIN_PROTOS_H_INCLUDED */
/* #include duk_selftest.h */
/*
* Selftest code
@@ -10620,9 +11434,9 @@ DUK_INTERNAL_DECL duk_uint_t duk_selftest_run_tests(duk_alloc_function alloc_fun
void *udata);
#endif
-#endif /* DUK_SELFTEST_H_INCLUDED */
+#endif /* DUK_SELFTEST_H_INCLUDED */
-#endif /* DUK_INTERNAL_H_INCLUDED */
+#endif /* DUK_INTERNAL_H_INCLUDED */
#if defined(DUK_USE_COMPUTED_NAN)
DUK_INTERNAL double duk_computed_nan;
@@ -10716,7 +11530,7 @@ DUK_INTERNAL int duk_repl_isinf(double x) {
#error debugging enabled (DUK_USE_DEBUG) but DUK_USE_DEBUG_WRITE not defined
#endif
-#define DUK__DEBUG_BUFSIZE DUK_USE_DEBUG_BUFSIZE
+#define DUK__DEBUG_BUFSIZE DUK_USE_DEBUG_BUFSIZE
#if defined(DUK_USE_VARIADIC_MACROS)
@@ -10744,7 +11558,7 @@ DUK_INTERNAL void duk_debug_log(duk_int_t level, const char *file, duk_int_t lin
va_end(ap);
}
-#else /* DUK_USE_VARIADIC_MACROS */
+#else /* DUK_USE_VARIADIC_MACROS */
DUK_INTERNAL char duk_debug_file_stash[DUK_DEBUG_STASH_SIZE];
DUK_INTERNAL duk_int_t duk_debug_line_stash;
@@ -10775,15 +11589,15 @@ DUK_INTERNAL void duk_debug_log(const char *fmt, ...) {
va_end(ap);
}
-#endif /* DUK_USE_VARIADIC_MACROS */
+#endif /* DUK_USE_VARIADIC_MACROS */
-#else /* DUK_USE_DEBUG */
+#else /* DUK_USE_DEBUG */
/*
* Debugging disabled
*/
-#endif /* DUK_USE_DEBUG */
+#endif /* DUK_USE_DEBUG */
/* automatic undefs */
#undef DUK__DEBUG_BUFSIZE
@@ -10802,7 +11616,7 @@ DUK_INTERNAL void duk_debug_log(const char *fmt, ...) {
#if defined(DUK_USE_ROM_STRINGS)
#error ROM support not enabled, rerun configure.py with --rom-support
#else /* DUK_USE_ROM_STRINGS */
-DUK_INTERNAL const duk_uint8_t duk_strings_data[967] = {
+DUK_INTERNAL const duk_uint8_t duk_strings_data[972] = {
79,40,209,144,168,105,6,78,54,139,89,185,44,48,46,90,120,8,154,140,35,103,
35,113,193,73,5,52,112,180,104,166,135,52,188,4,98,12,27,146,156,80,211,31,
129,115,150,64,52,220,109,24,18,68,156,24,38,67,114,36,55,9,119,151,132,
@@ -10830,34 +11644,34 @@ DUK_INTERNAL const duk_uint8_t duk_strings_data[967] = {
113,67,77,201,128,223,255,223,224,121,44,48,46,95,203,145,46,9,205,16,39,
201,62,36,0,192,21,147,255,238,145,39,199,197,211,116,240,242,113,197,78,
214,211,226,233,187,107,105,19,119,37,56,161,166,52,221,212,201,205,36,240,
-242,16,96,152,12,178,52,211,56,228,73,150,83,0,148,39,137,75,67,73,198,209,
-129,36,85,185,201,196,2,32,193,48,17,160,97,16,84,44,156,104,24,67,189,200,
-108,201,19,238,114,96,137,137,50,238,113,164,188,211,185,192,226,100,19,
-134,68,110,112,174,139,0,185,31,115,149,4,88,7,159,115,146,117,34,34,35,
-115,143,22,146,208,210,19,115,140,3,207,185,202,130,36,109,85,185,194,161,
-160,90,50,72,155,115,149,2,232,67,137,204,122,22,66,161,175,164,210,72,199,
-130,137,1,50,32,145,143,38,120,186,195,35,106,51,146,230,8,36,77,109,65,38,
-226,72,159,191,189,181,70,140,133,222,249,212,227,66,125,245,187,251,219,
-77,3,119,190,117,56,208,159,125,110,254,246,210,26,93,239,157,78,52,39,223,
-93,191,189,180,212,52,187,223,58,156,104,79,190,187,127,123,104,180,104,
-183,190,117,56,208,159,125,102,254,209,104,209,124,234,113,161,62,250,80,
-196,128,81,4,9,16,162,4,196,116,9,205,154,27,66,32,100,13,12,98,68,227,33,
-65,69,204,195,34,201,50,8,110,33,23,34,28,168,104,22,188,12,174,138,11,70,
-138,104,115,68,130,137,13,82,27,41,129,162,35,138,54,146,198,137,39,72,180,
-210,178,38,35,146,103,68,139,51,197,214,28,227,131,79,15,35,138,58,130,37,
-19,155,41,146,174,64,203,99,161,100,37,145,51,148,75,4,164,66,54,140,49,46,
-247,70,103,37,230,70,142,70,67,30,232,204,178,163,201,18,54,139,89,39,26,
-16,165,2,228,69,33,143,89,24,70,206,73,67,102,72,148,2,32,214,73,157,224,
-18,128,98,29,241,69,65,50,37,241,116,200,41,144,102,125,2,180,8,210,152,38,
-129,23,8,34,198,
+242,16,96,152,12,26,20,164,137,150,70,154,103,28,137,50,202,96,18,132,241,
+41,104,105,56,218,48,36,138,183,57,56,128,68,24,38,2,52,12,34,10,133,147,
+141,3,8,119,185,13,153,34,125,206,76,17,49,38,93,206,52,151,154,119,56,28,
+76,130,112,200,141,206,21,209,96,23,35,238,114,160,139,0,243,238,114,78,
+164,68,68,110,113,226,210,90,26,66,110,113,128,121,247,57,80,68,141,170,
+183,56,84,52,11,70,73,19,110,114,160,93,8,113,57,143,66,200,84,53,244,154,
+73,24,240,81,32,38,68,18,49,228,207,23,88,100,109,70,114,92,193,4,137,173,
+168,36,220,73,19,247,247,182,168,209,144,187,223,58,156,104,79,190,183,127,
+123,105,160,110,247,206,167,26,19,239,173,223,222,218,67,75,189,243,169,
+198,132,251,235,183,247,182,154,134,151,123,231,83,141,9,247,215,111,239,
+109,22,141,22,247,206,167,26,19,239,172,223,218,45,26,47,157,78,52,39,223,
+74,24,144,10,32,129,34,20,64,152,142,129,57,179,67,104,68,12,129,161,140,
+72,156,100,40,40,185,152,100,89,38,65,13,196,34,228,67,149,13,2,215,129,
+149,209,65,104,209,77,14,104,144,81,33,170,67,101,48,52,68,113,70,210,88,
+209,36,233,22,154,86,68,196,114,76,232,145,102,120,186,195,156,112,105,225,
+228,113,71,80,68,162,115,101,50,85,200,25,108,116,44,132,178,38,114,137,96,
+148,136,70,209,134,37,222,232,204,228,188,200,209,200,200,99,221,25,150,84,
+121,34,70,209,107,36,227,66,20,160,92,136,164,49,235,35,8,217,201,40,108,
+201,18,128,68,26,201,51,188,2,80,12,67,190,40,168,38,68,190,46,153,5,50,12,
+207,160,86,129,26,83,4,208,34,225,4,88,192,
};
#endif /* DUK_USE_ROM_STRINGS */
#if defined(DUK_USE_ROM_OBJECTS)
#error ROM support not enabled, rerun configure.py with --rom-support
#else /* DUK_USE_ROM_OBJECTS */
-/* native functions: 183 */
-DUK_INTERNAL const duk_c_function duk_bi_native_functions[183] = {
+/* native functions: 185 */
+DUK_INTERNAL const duk_c_function duk_bi_native_functions[185] = {
NULL,
duk_bi_array_constructor,
duk_bi_array_constructor_is_array,
@@ -10883,6 +11697,8 @@ DUK_INTERNAL const duk_c_function duk_bi_native_functions[183] = {
duk_bi_buffer_readfield,
duk_bi_buffer_slice_shared,
duk_bi_buffer_writefield,
+ duk_bi_cbor_decode,
+ duk_bi_cbor_encode,
duk_bi_dataview_constructor,
duk_bi_date_constructor,
duk_bi_date_constructor_now,
@@ -11043,598 +11859,604 @@ DUK_INTERNAL const duk_c_function duk_bi_native_functions[183] = {
duk_bi_uint8array_plainof,
};
#if defined(DUK_USE_DOUBLE_LE)
-DUK_INTERNAL const duk_uint8_t duk_builtins_data[4251] = {
-144,148,105,225,32,68,52,228,126,12,104,201,37,132,52,167,194,138,105,244,
-124,57,28,211,57,18,64,52,238,254,44,138,111,171,241,164,19,87,137,30,33,
-167,18,145,159,8,211,137,9,225,42,5,240,145,139,163,163,8,211,137,10,228,
-64,211,19,132,140,93,29,56,70,156,72,119,34,66,146,36,104,137,194,70,46,
-142,172,35,78,36,47,146,195,102,11,240,145,139,163,175,8,211,137,9,228,240,
-242,112,145,139,163,179,8,211,137,8,237,34,130,118,49,116,118,225,26,48,0,
-1,94,29,201,158,46,183,39,135,147,132,140,93,16,132,76,66,33,8,66,16,132,
-33,8,66,26,180,41,97,167,64,150,34,33,154,112,0,1,87,247,35,79,103,237,198,
-174,216,47,31,23,95,17,13,31,217,96,211,49,50,53,212,77,141,24,0,0,179,10,
-228,240,242,15,128,140,65,128,134,188,0,0,89,167,97,181,224,0,2,205,62,53,
-224,0,2,205,66,237,120,0,0,179,81,204,107,192,0,5,154,150,67,94,0,0,44,212,
-245,90,240,0,1,102,169,162,215,128,0,11,53,93,150,188,0,0,89,171,111,53,
-108,150,163,70,0,0,42,2,249,50,94,124,35,68,225,146,49,13,24,0,0,165,161,
-124,153,47,62,12,130,112,201,24,132,56,97,115,16,0,0,0,0,0,0,62,31,243,48,
-0,0,0,0,0,0,60,31,242,241,32,26,193,55,132,112,161,156,72,135,26,41,200,
-140,114,163,156,201,7,56,79,9,80,47,132,140,93,19,160,43,145,3,76,78,18,49,
-116,78,144,238,68,133,36,72,209,19,132,140,93,19,168,47,146,195,102,11,240,
-145,139,162,117,132,242,120,121,56,72,197,209,59,2,59,72,160,157,140,93,19,
-181,36,242,50,143,36,31,131,162,166,7,144,238,133,227,226,235,224,242,161,
-249,18,21,100,20,207,44,199,151,180,122,89,135,152,154,121,153,199,156,158,
-121,218,7,158,162,121,250,71,160,166,122,26,135,162,170,122,58,199,164,16,
-240,70,68,226,27,51,199,138,120,35,34,112,171,112,38,121,1,124,153,47,62,
-17,162,112,201,19,211,11,228,201,121,240,100,19,134,72,158,160,91,201,18,
-186,44,3,68,79,122,168,151,115,165,40,21,18,227,65,198,231,200,8,68,184,84,
-53,19,38,120,128,145,144,78,25,59,72,163,48,64,144,200,39,12,157,164,80,46,
-185,143,115,72,217,230,72,9,35,68,225,147,180,138,51,68,9,17,162,112,201,
-218,69,2,235,152,247,52,141,158,108,128,98,72,64,121,51,132,4,81,164,144,
-128,242,104,136,0,16,92,38,14,49,39,199,197,211,116,240,242,113,197,231,18,
-53,189,116,65,131,18,124,117,155,199,197,207,36,103,142,12,146,20,80,249,
-186,60,116,4,204,73,241,214,111,31,23,60,145,158,56,208,48,146,229,146,3,2,
-82,65,155,195,94,3,10,36,4,201,196,64,56,100,42,26,78,62,46,121,35,60,113,
-152,16,25,10,134,147,143,139,158,72,205,4,151,21,0,73,16,11,230,144,12,88,
-144,153,39,52,144,69,241,37,72,217,240,151,153,27,36,57,178,230,16,16,137,
-114,68,2,200,62,81,1,8,151,11,23,100,141,229,18,6,34,92,37,230,70,201,1,89,
-57,36,2,40,152,151,44,129,83,18,124,117,155,199,197,207,36,103,142,75,12,
-11,151,46,89,40,18,37,200,64,12,154,236,252,238,185,23,95,213,1,132,234,0,
-194,245,128,14,56,37,199,89,188,124,92,242,70,120,232,16,26,137,113,241,
-116,221,60,60,156,113,122,36,10,62,46,121,35,60,113,18,225,27,70,18,32,10,
-201,211,32,67,107,104,100,42,26,78,24,147,153,35,181,181,207,64,67,107,104,
-100,42,26,78,72,147,153,35,181,181,207,68,16,218,218,91,156,170,63,134,36,
-230,72,237,109,116,136,16,218,218,91,156,170,63,146,36,230,72,237,109,116,
-137,16,96,128,228,2,6,191,46,3,71,147,68,4,16,22,188,169,240,16,40,104,242,
-135,198,171,44,68,65,5,217,231,215,6,231,62,188,8,49,1,3,162,92,4,98,12,41,
-7,33,148,53,242,128,97,32,130,3,9,205,16,38,199,198,14,9,0,111,115,225,0,8,
-250,72,240,207,128,241,37,73,25,18,40,0,178,58,11,56,192,2,201,104,17,35,
-160,9,39,70,114,8,6,147,214,129,18,74,240,30,141,145,208,89,203,62,3,161,
-163,37,248,226,185,244,11,88,37,62,33,163,37,248,226,185,252,0,127,255,130,
-146,164,142,32,26,1,36,230,18,1,164,7,43,163,194,0,71,128,105,64,216,7,192,
-52,192,197,66,230,72,192,52,224,209,32,232,34,68,62,129,113,32,232,34,114,
-40,49,231,16,254,0,63,255,208,99,2,140,44,92,206,8,224,143,4,225,147,210,
-124,13,44,92,206,9,195,39,30,228,54,126,163,225,200,169,198,133,42,166,191,
-246,3,11,251,0,24,71,4,120,9,251,8,10,17,193,30,9,195,39,1,63,105,1,98,112,
-201,199,185,13,159,1,63,105,32,48,156,209,2,126,227,224,58,26,50,95,142,47,
-192,208,22,176,74,124,67,70,75,241,197,248,26,64,213,184,64,89,56,39,49,
-224,137,62,36,2,176,19,17,254,68,3,196,143,88,4,79,162,0,210,32,34,35,253,
-72,5,146,208,34,125,144,5,147,214,137,253,208,9,149,3,41,197,13,55,233,0,
-185,187,139,117,137,30,8,18,39,172,1,25,187,139,112,128,178,113,110,177,35,
-193,2,68,245,128,23,55,114,143,121,35,193,2,68,245,130,8,205,220,91,132,5,
-147,148,123,201,30,8,18,39,172,16,18,113,67,63,128,3,68,143,32,39,243,32,
-42,83,4,103,46,89,19,63,224,208,16,70,142,92,178,38,127,193,164,8,67,68,
-186,12,146,247,154,1,165,64,202,113,252,160,131,32,7,35,167,26,50,235,231,
-130,48,179,192,65,148,69,19,214,2,251,85,2,232,72,31,255,255,255,255,255,
-253,239,226,122,196,55,106,160,93,9,0,4,0,0,0,0,0,0,3,49,0,0,0,0,0,0,3,225,
-252,143,94,233,34,104,169,54,144,210,161,168,158,32,0,0,0,0,0,0,120,63,145,
-235,72,96,77,21,38,210,26,84,53,19,196,0,0,0,0,0,0,15,15,240,253,35,228,
-133,185,176,0,0,0,0,0,0,44,15,8,117,128,190,212,128,82,109,33,179,33,137,
-24,31,255,255,255,255,255,231,232,100,58,196,55,106,64,41,54,144,217,144,
-196,140,15,255,255,255,255,255,243,252,49,15,4,100,78,33,179,60,120,167,
-130,50,39,10,183,2,103,144,113,8,151,10,134,162,100,221,16,18,137,113,13,
-153,12,72,238,137,1,81,46,52,28,110,232,148,53,18,228,128,82,113,13,153,12,
-72,238,137,142,73,78,52,0,0,0,0,0,0,0,0,8,58,254,1,12,38,248,134,23,130,0,
-60,221,194,162,228,30,244,128,217,187,132,187,220,210,54,104,2,247,132,5,
-205,220,124,72,36,73,14,110,252,132,25,128,193,94,8,200,149,200,3,237,38,
-43,31,192,54,186,213,128,57,45,56,210,0,0,0,0,0,0,62,31,241,90,251,224,6,
-77,220,24,38,78,74,113,67,77,124,16,50,110,228,208,194,114,83,138,26,107,
-224,172,37,240,97,41,187,139,112,128,178,112,96,153,57,41,197,13,53,240,
-113,41,187,139,112,128,178,114,104,97,57,41,197,13,53,240,128,195,95,8,44,
-61,240,132,216,93,33,133,192,128,14,98,79,147,67,9,129,0,44,196,159,11,69,
-175,152,32,35,100,33,135,24,147,237,38,34,246,139,95,48,64,70,200,68,8,49,
-39,198,57,179,61,144,138,22,98,79,180,152,153,215,54,103,178,17,129,204,73,
-240,96,153,44,132,112,163,18,125,164,196,62,130,100,178,18,1,140,73,240,96,
-197,144,146,18,98,79,180,152,135,208,98,200,74,8,49,39,195,186,145,149,144,
-150,22,98,79,180,152,143,215,82,50,178,19,2,140,73,241,136,109,38,73,89,9,
-161,166,36,251,73,137,157,67,105,50,74,200,78,10,49,39,201,16,78,104,229,
-100,39,134,152,147,237,38,41,116,130,115,71,43,33,64,60,196,159,24,133,173,
-18,32,156,209,202,200,81,18,49,39,218,76,76,234,22,180,72,130,115,71,43,33,
-72,68,196,159,38,134,19,46,105,56,226,150,68,157,160,1,228,73,242,104,97,
-46,16,31,34,79,140,66,214,137,16,78,104,229,108,169,137,72,147,237,38,38,
-117,11,90,36,65,57,163,149,178,168,21,34,79,146,32,156,209,202,218,250,161,
-178,36,251,73,138,93,32,156,209,202,218,250,193,82,36,248,196,54,147,36,
-173,191,174,27,34,79,180,152,153,212,54,147,36,173,191,176,17,34,79,135,
-117,35,43,115,236,133,200,147,237,38,35,245,212,140,173,207,180,15,34,79,
-131,4,201,108,173,133,72,147,237,38,33,244,19,37,178,184,17,34,79,140,115,
-102,123,107,238,133,200,147,237,38,38,117,205,153,237,175,188,23,34,79,133,
-162,215,204,16,17,182,254,248,116,137,62,210,98,47,104,181,243,4,4,109,191,
-192,131,152,147,230,8,8,217,12,16,60,137,62,96,128,141,178,193,181,55,136,
-200,51,128,114,108,28,100,128,0,0,0,0,0,0,0,12,110,127,32,98,115,249,73,
-117,243,249,67,21,159,202,38,47,63,148,86,8,75,144,94,50,1,38,73,79,204,67,
-95,231,1,6,128,14,79,129,185,40,249,18,149,181,207,142,199,155,172,248,172,
-89,183,207,140,198,137,175,200,0,159,72,10,5,21,220,138,120,74,129,124,36,
-98,232,228,74,81,62,160,20,10,107,185,21,114,32,105,137,194,70,46,142,68,
-165,19,235,1,64,170,187,145,119,34,66,146,36,104,137,194,70,46,142,68,165,
-19,236,1,64,174,187,145,95,37,134,204,23,225,35,23,71,34,82,137,246,128,
-160,89,93,200,167,147,195,201,194,70,46,142,68,165,19,238,1,64,182,187,145,
-71,105,20,19,177,139,163,145,41,68,16,7,6,15,82,70,72,115,96,0,0,0,0,0,118,
-105,160,91,60,165,195,201,194,8,134,149,216,130,0,192,41,224,136,2,48,176,
-228,1,149,13,195,15,0,200,209,97,71,128,99,32,176,131,192,113,57,143,0,167,
-131,32,230,80,28,202,139,175,237,2,48,189,160,20,1,119,48,87,193,186,129,
-89,56,72,197,209,200,193,185,35,23,71,109,13,219,36,98,232,237,156,13,26,
-208,211,14,102,19,87,137,91,95,128,0,10,64,24,92,0,0,82,2,53,63,240,49,204,
-202,10,14,38,78,44,141,52,207,31,0,0,22,32,129,100,180,8,148,145,78,102,
-152,80,113,50,113,100,105,166,120,248,0,0,177,1,65,196,201,199,20,178,36,
-227,224,0,2,200,3,6,133,41,35,31,0,0,22,1,44,57,137,62,33,179,216,162,152,
-192,131,18,124,162,27,61,138,41,108,32,196,159,16,217,232,235,81,76,104,73,
-137,62,81,13,158,142,181,20,184,16,98,79,136,108,244,244,168,166,56,36,196,
-159,40,134,207,79,74,138,93,10,49,39,194,173,192,158,158,149,20,188,20,98,
-79,133,91,129,61,109,74,41,124,30,68,159,16,217,236,83,108,96,68,137,62,81,
-13,158,197,54,182,17,34,79,136,108,244,117,169,182,52,38,68,159,40,134,207,
-71,90,155,92,8,145,39,196,54,122,122,84,219,28,19,34,79,148,67,103,167,165,
-77,174,133,72,147,225,86,224,79,79,74,155,94,10,145,39,194,173,192,158,182,
-165,54,190,206,25,212,35,208,226,100,150,211,201,29,162,44,140,35,103,0,0,
-0,0,0,0,3,192,252,206,25,228,35,208,226,100,150,211,201,29,162,44,140,35,
-103,0,0,0,0,0,0,3,192,252,206,25,244,35,208,226,100,150,211,201,29,162,44,
-140,35,103,0,0,0,0,0,0,3,192,252,206,26,4,35,208,226,100,150,211,201,29,
-162,44,140,35,103,0,0,0,0,0,0,0,1,0,206,26,20,35,208,226,100,150,211,201,
-29,162,44,140,35,103,0,0,0,0,0,0,0,1,0,206,26,36,35,208,226,100,150,211,
-201,29,162,44,140,35,103,0,0,0,0,0,0,0,65,0,206,26,52,35,208,226,100,150,
-211,201,29,162,44,140,35,103,0,0,0,0,0,0,0,65,0,206,26,68,35,208,226,100,
-150,211,201,29,162,44,140,35,103,0,0,0,0,0,0,0,65,0,206,26,84,35,208,226,
-100,150,211,201,29,162,44,140,35,103,0,0,0,0,0,0,0,129,0,195,154,99,16,38,
-36,0,251,68,117,179,216,162,128,68,72,1,241,13,158,197,20,150,25,18,0,125,
-162,58,217,232,235,117,100,162,136,25,18,0,125,162,58,217,232,235,116,36,
-162,145,2,226,64,15,136,108,244,117,186,178,81,73,129,113,32,7,196,54,122,
-58,221,9,40,165,64,200,144,3,237,17,214,207,79,75,171,37,20,80,200,144,3,
-237,17,214,207,79,75,161,37,20,138,23,18,0,124,67,103,167,165,213,146,138,
-77,11,137,0,62,33,179,211,210,232,73,69,42,133,196,128,31,10,183,2,125,89,
-40,163,5,196,128,31,10,183,2,125,9,40,164,96,200,144,3,224,221,64,172,157,
-89,40,163,134,68,128,31,6,234,5,100,232,73,69,35,133,68,128,31,104,142,182,
-125,89,40,180,0,168,144,3,237,17,214,207,161,37,22,144,19,18,0,124,67,103,
-213,146,139,80,9,137,0,62,33,179,232,73,69,172,5,90,40,153,59,68,117,179,
-216,166,192,77,162,137,147,136,108,246,41,180,176,219,69,19,39,104,142,182,
-122,58,221,89,41,178,6,218,40,153,59,68,117,179,209,214,232,73,77,162,6,90,
-40,153,56,134,207,71,91,171,37,54,152,25,104,162,100,226,27,61,29,110,132,
-148,218,160,109,162,137,147,180,71,91,61,61,46,172,148,217,67,109,20,76,
-157,162,58,217,233,233,116,36,166,209,67,45,20,76,156,67,103,167,165,213,
-146,155,77,12,180,81,50,113,13,158,158,151,66,74,109,84,50,209,68,201,194,
-173,192,159,86,74,108,193,150,138,38,78,21,110,4,250,18,83,104,193,182,138,
-38,78,13,212,10,201,213,146,155,56,109,162,137,147,131,117,2,178,116,36,
-166,209,194,237,20,76,157,162,58,217,245,100,167,16,2,237,20,76,157,162,58,
-217,244,36,167,18,2,173,20,76,156,67,103,213,146,156,80,10,180,81,50,113,
-13,159,66,74,113,97,175,220,48,216,109,192,4,42,22,189,163,0,196,133,0,185,
-80,32,28,78,99,193,18,80,36,4,19,159,141,156,0,178,90,4,74,73,0,22,209,68,
-201,185,129,4,2,8,3,132,64,60,36,6,149,113,72,176,171,240,84,0,157,91,116,
-116,32,11,42,218,221,216,181,129,32,3,234,219,165,3,188,231,235,249,8,187,
-152,252,47,86,227,105,18,7,244,17,91,42,56,175,185,248,110,173,198,209,208,
-36,0,238,82,97,87,188,189,179,240,93,122,32,12,22,162,42,125,144,132,160,7,
-236,161,25,232,237,105,64,205,59,127,102,158,160,230,63,11,217,66,51,210,
-129,154,118,254,205,61,65,236,127,171,197,34,168,48,6,90,162,1,0,39,75,84,
-72,8,9,33,186,162,80,64,76,13,213,19,2,130,96,110,150,181,0,65,6,51,213,20,
-128,65,17,11,213,19,130,137,121,211,210,210,144,6,39,75,84,80,0,201,119,
-234,138,8,41,86,231,71,84,80,129,79,135,186,122,101,224,34,25,69,233,208,3,
-91,141,170,40,96,139,113,180,181,69,36,21,110,54,142,134,168,165,1,176,23,
-212,47,0,216,134,234,87,128,111,117,181,168,128,209,3,70,230,106,192,5,139,
-168,209,234,138,32,36,144,102,235,8,3,146,27,170,40,160,146,132,103,170,40,
-192,115,3,117,69,28,22,113,163,69,170,41,103,1,66,188,17,145,52,104,4,202,
-113,67,76,130,227,72,194,13,240,108,0,0,83,96,0,2,185,0,104,146,84,97,48,0,
-1,90,192,56,169,24,145,179,192,0,5,96,8,56,16,32,128,56,18,52,125,198,86,
-147,186,140,28,50,21,13,39,31,23,60,145,158,56,204,141,47,121,6,155,190,
-188,24,49,39,199,89,188,124,92,242,70,120,224,201,33,69,15,155,163,199,68,
-14,49,39,199,197,211,116,240,242,113,197,231,18,180,254,4,3,17,46,18,243,
-35,100,128,172,156,146,70,163,150,76,34,248,146,164,108,248,75,204,141,146,
-28,217,115,9,27,79,11,241,173,235,162,160,224,200,2,206,9,113,13,148,192,
-209,18,22,164,146,37,193,57,162,4,249,39,196,128,24,2,178,66,213,136,68,
-201,16,77,209,131,31,192,242,88,96,92,191,151,34,100,136,38,232,255,252,92,
-221,199,197,12,68,209,82,66,212,11,155,185,41,197,13,55,38,3,66,213,47,131,
-250,72,12,162,99,133,116,127,196,32,225,1,3,34,92,170,9,105,164,32,225,64,
-131,156,1,193,133,7,19,39,22,70,154,103,143,128,0,11,16,20,28,76,156,113,
-75,34,78,62,0,0,44,128,48,104,82,146,49,240,0,1,96,11,180,192,0,5,162,1,18,
-160,65,24,131,20,145,25,188,48,132,122,28,76,146,218,121,35,180,69,145,132,
-108,224,0,0,0,0,0,0,120,31,153,188,56,132,122,28,76,146,218,121,35,180,69,
-145,132,108,224,0,0,0,0,0,0,120,31,168,160,45,110,23,30,176,33,184,0,0,181,
-32,29,235,2,27,199,23,0,0,22,196,51,120,129,8,244,56,153,37,180,242,71,104,
-139,35,8,217,192,0,0,0,0,0,0,240,63,51,120,145,8,244,56,153,37,180,242,71,
-104,139,35,8,217,192,0,0,0,0,0,0,0,64,51,120,161,8,244,56,153,37,180,242,
-71,104,139,35,8,217,192,0,0,0,0,0,0,0,64,51,120,177,8,244,56,153,37,180,
-242,71,104,139,35,8,217,192,0,0,0,0,0,0,16,64,51,120,193,8,244,56,153,37,
-180,242,71,104,139,35,8,217,192,0,0,0,0,0,0,16,64,51,120,209,8,244,56,153,
-37,180,242,71,104,139,35,8,217,192,0,0,0,0,0,0,16,64,51,120,225,8,244,56,
-153,37,180,242,71,104,139,35,8,217,192,0,0,0,0,0,0,32,64,32,227,194,0,97,
-57,162,4,246,40,5,34,92,35,68,225,161,166,219,16,16,137,112,52,41,73,29,
-169,1,65,196,201,197,145,166,153,246,8,3,137,204,120,34,74,8,200,58,128,28,
-211,160,130,52,78,26,26,110,248,0,0,170,4,12,70,137,195,38,0,0,42,68,159,7,
-84,3,154,150,16,70,137,195,67,77,223,0,0,20,224,20,160,152,23,223,0,0,20,
-226,9,65,154,232,147,161,115,59,224,0,2,156,84,12,50,9,195,38,0,0,41,133,
-30,224,32,54,186,221,128,60,
+DUK_INTERNAL const duk_uint8_t duk_builtins_data[4281] = {
+144,148,105,226,32,68,52,228,254,12,104,202,37,132,52,167,194,138,105,245,
+124,57,28,211,57,18,64,52,239,126,44,138,111,175,241,164,19,87,145,30,33,
+167,22,145,159,8,211,139,9,225,42,5,240,145,139,163,163,8,211,139,10,228,
+64,211,19,132,140,93,29,56,70,156,88,119,34,66,146,36,104,137,194,70,46,
+142,172,35,78,44,47,146,195,102,11,240,145,139,163,175,8,211,139,9,228,240,
+242,112,145,139,163,179,8,211,139,8,237,34,130,118,49,116,118,225,26,48,0,
+1,98,29,201,158,46,183,39,135,147,132,140,93,16,132,76,66,33,8,66,16,132,
+33,8,66,26,180,105,97,167,68,150,34,33,154,112,0,1,91,247,35,79,111,237,
+198,174,232,47,31,23,95,17,13,31,249,96,211,49,50,53,214,77,141,24,0,0,181,
+10,228,240,242,15,128,140,65,128,134,188,0,0,90,167,97,181,224,0,2,213,62,
+53,224,0,2,213,66,237,120,0,0,181,81,204,107,192,0,5,170,150,67,94,0,0,45,
+84,245,90,240,0,1,106,169,162,215,128,0,11,85,93,150,188,0,0,90,171,111,53,
+109,22,162,26,48,0,1,84,23,201,146,243,225,26,39,12,145,136,104,192,0,5,61,
+11,228,201,121,240,100,19,134,72,196,33,195,14,40,203,112,64,190,76,232,
+145,153,136,0,0,0,0,0,0,31,15,249,152,0,0,0,0,0,0,30,15,249,120,144,13,96,
+155,194,56,80,206,36,67,141,20,228,70,57,81,206,100,131,156,39,132,168,23,
+194,70,46,137,208,21,200,129,166,39,9,24,186,39,72,119,34,66,146,36,104,
+137,194,70,46,137,212,23,201,97,179,5,248,72,197,209,58,194,121,60,60,156,
+36,98,232,157,129,29,164,80,78,198,46,137,218,146,121,25,71,146,9,209,5,
+209,61,48,126,14,138,152,30,67,186,23,143,139,175,131,202,135,228,72,85,
+144,83,60,179,30,94,209,233,102,30,98,105,230,103,30,114,121,231,104,30,
+122,137,231,233,30,130,153,232,106,30,138,169,232,235,30,144,67,193,25,19,
+136,108,207,30,41,224,140,137,194,173,192,153,228,5,242,100,188,248,70,137,
+195,36,79,78,47,147,37,231,193,144,78,25,34,122,145,111,36,74,232,176,13,
+17,61,234,226,93,207,148,160,84,75,141,7,27,161,32,33,18,225,80,212,76,154,
+2,2,70,65,56,100,237,34,140,209,2,67,32,156,50,118,145,64,186,230,61,205,
+35,103,155,32,36,141,19,134,78,210,40,206,16,36,70,137,195,39,105,20,11,
+174,99,220,210,54,121,210,1,137,33,1,228,207,16,17,70,146,66,3,201,164,32,
+0,65,112,152,56,196,159,31,23,77,211,195,201,199,23,160,72,214,246,81,6,12,
+73,241,214,111,31,23,60,145,158,56,50,72,81,67,230,232,242,80,19,49,39,199,
+89,188,124,92,242,70,120,227,64,194,75,154,72,12,9,73,6,111,21,120,12,40,
+144,19,39,25,0,225,144,168,105,56,248,185,228,140,241,200,96,64,100,42,26,
+78,62,46,121,35,52,18,92,116,1,36,64,47,158,64,49,98,66,100,156,242,65,23,
+196,149,35,103,194,94,100,108,144,230,203,156,64,66,37,201,16,11,32,249,
+132,4,34,92,44,93,146,55,152,72,24,137,112,151,153,27,36,5,100,229,144,8,
+162,98,92,210,5,76,73,241,214,111,31,23,60,145,158,57,44,48,46,92,185,164,
+160,72,151,41,0,50,107,179,244,59,36,93,127,92,6,19,172,3,11,216,0,56,224,
+151,29,102,241,241,115,201,25,227,164,64,106,37,199,197,211,116,240,242,
+113,197,233,144,40,248,185,228,140,241,196,75,132,109,24,72,128,43,39,84,
+129,13,173,161,144,168,105,56,98,78,100,142,214,215,69,1,13,173,161,144,
+168,105,57,34,78,100,142,214,215,69,16,67,107,105,110,114,168,254,24,147,
+153,35,181,181,212,32,67,107,105,110,114,168,254,72,147,153,35,181,181,212,
+36,65,130,3,144,8,26,252,200,13,30,85,16,16,64,90,242,231,192,64,161,163,
+203,31,26,172,193,17,4,23,105,159,96,27,172,251,16,32,196,4,14,137,112,17,
+136,48,164,28,134,80,215,202,1,132,130,8,12,39,52,64,155,31,24,56,36,1,189,
+207,132,0,35,233,35,195,62,3,196,149,36,100,72,160,2,200,232,44,227,0,11,
+37,160,68,142,128,36,157,25,200,32,26,79,90,4,73,43,192,122,54,71,65,103,
+44,248,14,134,140,151,227,138,231,208,45,96,148,248,134,140,151,227,138,
+231,240,1,255,254,10,74,146,56,128,104,4,147,152,72,6,144,28,174,143,8,1,
+30,1,165,3,96,31,0,211,3,21,11,153,35,0,211,131,68,131,160,137,16,250,5,
+196,131,160,137,200,160,199,156,67,248,0,255,255,65,140,10,48,177,115,56,
+35,130,60,19,134,79,89,240,52,177,115,56,39,12,156,123,144,217,251,15,135,
+34,167,30,20,170,154,255,232,12,47,244,0,97,28,17,224,39,238,32,40,71,4,
+120,39,12,156,4,253,228,5,137,195,39,30,228,54,124,4,253,228,128,194,115,
+68,9,252,15,128,232,104,201,126,56,191,35,64,90,193,41,241,13,25,47,199,23,
+228,105,3,86,225,1,100,224,156,199,130,36,249,144,10,192,76,71,250,16,15,
+18,61,96,17,62,200,3,72,128,136,143,247,32,22,75,64,137,248,64,22,79,90,39,
+249,64,38,84,12,167,20,52,223,196,2,230,238,45,214,36,120,32,72,158,208,4,
+102,238,45,194,2,201,197,186,196,143,4,9,19,218,0,92,221,202,61,228,143,4,
+9,19,218,8,35,55,113,110,16,22,78,81,239,36,120,32,72,158,208,64,73,197,12,
+255,0,13,18,60,128,159,212,128,169,76,17,156,185,100,76,255,163,64,65,26,
+57,114,200,153,255,70,144,33,13,18,232,50,75,226,104,6,149,3,41,199,246,
+130,12,128,28,142,156,120,203,175,158,8,194,207,1,6,81,20,79,88,11,237,84,
+11,161,32,127,255,255,255,255,255,247,191,137,235,16,221,170,129,116,36,0,
+16,0,0,0,0,0,0,12,196,0,0,0,0,0,0,15,135,242,61,123,164,137,162,164,218,67,
+74,134,162,120,128,0,0,0,0,0,1,224,254,71,173,33,129,52,84,155,72,105,80,
+212,79,16,0,0,0,0,0,0,60,63,195,244,143,146,22,230,192,0,0,0,0,0,0,176,60,
+33,214,2,251,82,1,73,180,134,204,134,36,96,127,255,255,255,255,255,159,161,
+144,235,16,221,169,0,164,218,67,102,67,18,48,63,255,255,255,255,255,207,
+240,196,60,17,145,56,134,204,241,226,158,8,200,156,42,220,9,158,65,196,34,
+92,42,26,137,147,120,64,74,37,196,54,100,49,35,188,36,5,68,184,208,113,187,
+194,80,212,75,146,1,73,196,54,100,49,35,188,38,57,37,56,240,0,0,0,0,0,0,0,
+0,32,235,248,68,48,156,2,24,94,24,0,243,119,10,139,144,123,242,3,102,238,
+18,239,115,72,217,160,11,223,16,23,55,113,241,32,145,36,57,188,18,16,102,3,
+5,120,35,34,89,32,15,180,152,173,127,0,218,235,88,0,228,180,227,200,0,0,0,
+0,0,0,248,127,197,107,240,64,6,77,220,24,38,78,74,113,67,77,130,4,12,155,
+185,52,48,156,148,226,134,155,4,10,194,96,129,132,166,238,45,194,2,201,193,
+130,100,228,167,20,52,216,32,113,41,187,139,112,128,178,114,104,97,57,41,
+197,13,54,8,32,48,216,32,130,195,224,130,19,97,124,134,23,6,0,57,137,62,77,
+12,38,12,0,179,18,124,45,22,190,96,128,141,176,134,28,98,79,180,152,139,
+218,45,124,193,1,27,97,16,32,196,159,24,230,204,246,194,40,89,137,62,210,
+98,103,92,217,158,216,70,7,49,39,193,130,100,182,17,194,140,73,246,147,16,
+250,9,146,216,72,6,49,39,193,131,22,194,72,73,137,62,210,98,31,65,139,97,
+40,32,196,159,14,234,70,86,194,88,89,137,62,210,98,63,93,72,202,216,76,10,
+49,39,198,33,180,153,37,108,38,134,152,147,237,38,38,117,13,164,201,43,97,
+56,40,196,159,36,65,57,163,149,176,158,26,98,79,180,152,165,210,9,205,28,
+173,133,0,243,18,124,98,22,180,72,130,115,71,43,97,68,72,196,159,105,49,51,
+168,90,209,34,9,205,28,173,133,33,19,18,124,154,24,76,185,164,227,138,89,
+18,119,0,7,145,39,201,161,132,188,64,124,137,62,49,11,90,36,65,57,163,149,
+210,166,37,34,79,180,152,153,212,45,104,145,4,230,142,87,74,160,84,137,62,
+72,130,115,71,43,171,234,134,200,147,237,38,41,116,130,115,71,43,171,235,5,
+72,147,227,16,218,76,146,186,254,184,108,137,62,210,98,103,80,218,76,146,
+186,254,192,68,137,62,29,212,140,174,207,178,23,34,79,180,152,143,215,82,
+50,187,62,208,60,137,62,12,19,37,210,182,21,34,79,180,152,135,208,76,151,
+74,224,68,137,62,49,205,153,238,175,186,23,34,79,180,152,153,215,54,103,
+186,190,240,92,137,62,22,139,95,48,64,70,235,251,225,210,36,251,73,136,189,
+162,215,204,16,17,186,255,2,14,98,79,152,32,35,108,48,64,242,36,249,130,2,