netsurf: branch dsilvers/dukky created. release/3.3-227-g4e125c6
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/4e125c6e82444e5e4a08d...
...commit http://git.netsurf-browser.org/netsurf.git/commit/4e125c6e82444e5e4a08dbb...
...tree http://git.netsurf-browser.org/netsurf.git/tree/4e125c6e82444e5e4a08dbbe1...
The branch, dsilvers/dukky has been created
at 4e125c6e82444e5e4a08dbbe1a910551eb5b6f41 (commit)
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=4e125c6e82444e5e4a0...
commit 4e125c6e82444e5e4a08dbbe1a910551eb5b6f41
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
REWORK: DODGY CRAP FOR VINCE
diff --git a/Makefile b/Makefile
index ff36456..8399024 100644
--- a/Makefile
+++ b/Makefile
@@ -498,6 +498,7 @@ include Makefile.defaults
$(eval $(call feature_switch,JPEG,JPEG (libjpeg),-DWITH_JPEG,-ljpeg,-UWITH_JPEG,))
$(eval $(call feature_switch,HARU_PDF,PDF export (haru),-DWITH_PDF_EXPORT,-lhpdf -lpng,-UWITH_PDF_EXPORT,))
$(eval $(call feature_switch,LIBICONV_PLUG,glibc internal iconv,-DLIBICONV_PLUG,,-ULIBICONV_PLUG,-liconv))
+$(eval $(call feature_switch,DUKTAPE,Javascript (Duktape),,,,,))
# Common libraries with pkgconfig
$(eval $(call pkg_config_find_and_add,libcss,CSS))
diff --git a/Makefile.defaults b/Makefile.defaults
index e2d7999..8fe2690 100644
--- a/Makefile.defaults
+++ b/Makefile.defaults
@@ -56,6 +56,8 @@ NETSURF_USE_VIDEO := NO
NETSURF_USE_JS := AUTO
# Javascript support in older debian/ubuntu versions
NETSURF_USE_MOZJS := AUTO
+# Or use duktape
+NETSURF_USE_DUKTAPE := YES
# Enable NetSurf's use of libharu for PDF export and GTK printing support.
# There is no auto-detection available for this, as it does not have a
diff --git a/desktop/browser.c b/desktop/browser.c
index 2d7257b..4a892aa 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1523,6 +1523,7 @@ static nserror browser_window_callback(hlcache_handle *c,
if (js_newcompartment(bw->jsctx,
bw,
hlcache_handle_get_content(c)) != NULL) {
+ LOG("Yay, a compartment happened");
*(event->data.jscontext) = bw->jsctx;
}
break;
diff --git a/javascript/Makefile b/javascript/Makefile
index 04eed66..3baa845 100644
--- a/javascript/Makefile
+++ b/javascript/Makefile
@@ -59,7 +59,15 @@ S_JAVASCRIPT += content.c jsapi.c fetcher.c $(addprefix jsapi/,$(S_JSAPI))
$(eval $(foreach V,$(filter JSAPI_BINDING_%,$(.VARIABLES)),$(call convert_jsapi_binding,$($(V)),$(OBJROOT)/$(patsubst JSAPI_BINDING_%,%,$(V)).c,$(OBJROOT)/$(patsubst JSAPI_BINDING_%,%,$(V)).h,$(patsubst JSAPI_BINDING_%,%,$(V))_jsapi)))
else
+ifeq ($(NETSURF_USE_DUKTAPE),YES)
+
+S_DUKKY := event_target.c window.c node.c document.c element.c html_element.c html_unknown_element.c
+
+S_JAVASCRIPT += dukky.c duktape.c content.c fetcher.c $(addprefix duktape/,$(S_DUKKY))
+
+else
S_JAVASCRIPT += none.c fetcher.c
endif
+endif
-S_JAVASCRIPT := $(addprefix javascript/,$(S_JAVASCRIPT)) $(S_JSAPI_BINDING)
\ No newline at end of file
+S_JAVASCRIPT := $(addprefix javascript/,$(S_JAVASCRIPT)) $(S_JSAPI_BINDING)
diff --git a/javascript/dukky.c b/javascript/dukky.c
new file mode 100644
index 0000000..2d744ce
--- /dev/null
+++ b/javascript/dukky.c
@@ -0,0 +1,204 @@
+/*
+ * Copyright 2012 Vincent Sanders <vince(a)netsurf-browser.org>
+ * Copyright 2015 All of us.
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** \file
+ * Duktapeish implementation of javascript engine functions.
+ */
+
+#include "content/content.h"
+#include "utils/nsoption.h"
+
+#include "javascript/js.h"
+#include "javascript/content.h"
+#include "utils/log.h"
+
+#include "duktape.h"
+#include "dukky.h"
+
+static duk_ret_t dukky_populate_object(duk_context *ctx)
+{
+ /* ... obj args protoname nargs */
+ int nargs = duk_get_int(ctx, -1);
+ duk_pop(ctx);
+ /* ... obj args protoname */
+ duk_get_global_string(ctx, PROTO_MAGIC);
+ /* .. obj args protoname prototab */
+ duk_insert(ctx, -2);
+ /* ... obj args prototab protoname */
+ duk_get_prop(ctx, -2);
+ /* ... obj args prototab {proto/undefined} */
+ if (duk_is_undefined(ctx, -1)) {
+ LOG("RuhRoh, couldn't find a prototype, getting htmlelement");
+ duk_pop(ctx);
+ duk_push_string(ctx, PROTO_NAME(html_unknown_element));
+ duk_get_prop(ctx, -2);
+ }
+ /* ... obj args prototab proto */
+ duk_dup(ctx, -1);
+ /* ... obj args prototab proto proto */
+ duk_set_prototype(ctx, -(nargs+4));
+ /* ... obj[proto] args prototab proto */
+ duk_get_prop_string(ctx, -1, INIT_MAGIC);
+ /* ... obj[proto] args prototab proto initfn */
+ duk_insert(ctx, -(nargs+4));
+ /* ... initfn obj[proto] args prototab proto */
+ duk_pop_2(ctx);
+ /* ... initfn obj[proto] args */
+ LOG("Call the init function");
+ duk_call(ctx, nargs + 1);
+ return 1; /* The object */
+}
+
+duk_ret_t dukky_create_object(duk_context *ctx, const char *name, int args)
+{
+ duk_ret_t ret;
+ LOG("name=%s nargs=%d", name+2, args);
+ /* ... args */
+ duk_push_object(ctx);
+ /* ... args obj */
+ duk_insert(ctx, -(args+1));
+ /* ... obj args */
+ duk_push_string(ctx, name);
+ /* ... obj args name */
+ duk_push_int(ctx, args);
+ if ((ret = duk_safe_call(ctx, dukky_populate_object, args + 3, 1))
+ != DUK_EXEC_SUCCESS)
+ return ret;
+ LOG("created");
+ return DUK_EXEC_SUCCESS;
+}
+
+static duk_ret_t dukky_create_prototype(duk_context *ctx,
+ duk_safe_call_function genproto,
+ const char *proto_name)
+{
+ duk_int_t ret;
+ duk_push_object(ctx);
+ if ((ret = duk_safe_call(ctx, genproto, 1, 1)) != DUK_EXEC_SUCCESS) {
+ duk_pop(ctx);
+ return ret;
+ }
+ /* top of stack is the ready prototype, inject it */
+ duk_put_global_string(ctx, proto_name);
+ return 0;
+}
+
+/**************************************** js.h ******************************/
+struct jscontext {
+ duk_context *ctx;
+ duk_context *thread;
+};
+
+#define CTX (ctx->thread)
+
+void js_initialise(void)
+{
+ /* NADA for now */
+ nsoption_set_bool(enable_javascript, true);
+ javascript_init();
+}
+
+void js_finalise(void)
+{
+ /* NADA for now */
+}
+
+#define DUKKY_NEW_PROTOTYPE(klass) \
+ dukky_create_prototype(ctx, dukky_##klass##___proto, PROTO_NAME(klass))
+
+jscontext *js_newcontext(int timeout, jscallback *cb, void *cbctx)
+{
+ duk_context *ctx;
+ jscontext *ret = calloc(1, sizeof(*ret));
+ LOG("Creating new JS context");
+ if (ret == NULL) return NULL;
+ ctx = ret->ctx = duk_create_heap_default();
+ if (ret->ctx == NULL) { free(ret); return NULL; }
+ /* Create the prototype stuffs */
+ duk_push_global_object(ctx);
+ duk_put_global_string(ctx, PROTO_MAGIC);
+ /* Create prototypes here? */
+ DUKKY_NEW_PROTOTYPE(event_target);
+ DUKKY_NEW_PROTOTYPE(window);
+ DUKKY_NEW_PROTOTYPE(node);
+ DUKKY_NEW_PROTOTYPE(document);
+ DUKKY_NEW_PROTOTYPE(element);
+ DUKKY_NEW_PROTOTYPE(html_element);
+ DUKKY_NEW_PROTOTYPE(html_unknown_element);
+ return ret;
+}
+
+void js_destroycontext(jscontext *ctx)
+{
+ LOG("Destroying context");
+ duk_destroy_heap(ctx->ctx);
+ free(ctx);
+}
+
+jsobject *js_newcompartment(jscontext *ctx, void *win_priv, void *doc_priv)
+{
+ /* Pop any active thread off */
+ LOG("Yay, new compartment, win_priv=%p, doc_priv=%p", win_priv, doc_priv);
+ duk_set_top(ctx->ctx, 0);
+ duk_push_thread(ctx->ctx);
+ ctx->thread = duk_require_context(ctx->ctx, -1);
+ duk_push_int(CTX, 0);
+ duk_push_int(CTX, 1);
+ duk_push_int(CTX, 2);
+ /* Manufacture a Window object */
+ /* win_priv is a browser_window, doc_priv is an html content struct */
+ duk_push_pointer(CTX, win_priv);
+ duk_push_pointer(CTX, doc_priv);
+ dukky_create_object(CTX, PROTO_NAME(window), 2);
+ duk_push_global_object(CTX);
+ duk_put_prop_string(CTX, -2, PROTO_MAGIC);
+ duk_set_global_object(CTX);
+
+ return (jsobject *)ctx;
+}
+
+static duk_ret_t eval_top_string(duk_context *ctx)
+{
+ duk_eval(ctx);
+ return 0;
+}
+
+bool js_exec(jscontext *ctx, const char *txt, size_t txtlen)
+{
+ assert(ctx);
+ if (txt == NULL || txtlen == 0) return false;
+ duk_set_top(CTX, 0);
+ duk_push_lstring(CTX, txt, txtlen);
+ LOG("Dumpy");
+ DUKKY_DUMP_STACK(CTX);
+ if (duk_safe_call(CTX, eval_top_string, 1, 1) == DUK_EXEC_ERROR) {
+ LOG("JAVASCRIPT SPLOOF: %s", duk_safe_to_string(CTX, 0));
+ return false;
+ }
+ if (duk_get_top(CTX) == 0) duk_push_boolean(CTX, false);
+ LOG("Returning %s", duk_get_boolean(CTX, 0) ? "true" : "false");
+ return duk_get_boolean(CTX, 0);
+}
+
+bool js_fire_event(jscontext *ctx, const char *type, struct dom_document *doc, struct dom_node *target)
+{
+ /* La La La */
+ LOG("Oh arse, an event: %s", type);
+ return true;
+}
diff --git a/javascript/dukky.h b/javascript/dukky.h
new file mode 100644
index 0000000..cd6286c
--- /dev/null
+++ b/javascript/dukky.h
@@ -0,0 +1,119 @@
+/* DO NOT USE, DODGY BIT FOR VINCE */
+
+#ifndef DUKKY_H
+#define DUKKY_H
+
+#include "duktape.h"
+
+#define _MAGIC(S) ("\xFF\xFF" "NETSURF_DUKTAPE_" S)
+#define MAGIC(S) _MAGIC(#S)
+#define PROTO_MAGIC MAGIC(PROTOTYPES)
+#define PRIVATE_MAGIC MAGIC(PRIVATE)
+#define INIT_MAGIC MAGIC(INIT)
+#define _PROTO_NAME(K) _MAGIC("PROTOTYPE_" K)
+#define PROTO_NAME(K) _PROTO_NAME(#K)
+#define _PROP_NAME(K,V) _MAGIC(K "_PROPERTY_" V)
+#define PROP_NAME(K,V) _PROP_NAME(#K,#V)
+
+#define DUKKY_FUNC_T(t,e) dukky_##t##_##e
+#define DUKKY_FUNC(t,e) duk_ret_t DUKKY_FUNC_T(t,e) (duk_context *ctx)
+
+static inline void *dukky_get_private(duk_context *ctx, int idx)
+{
+ void *ret;
+ duk_get_prop_string(ctx, idx, PRIVATE_MAGIC);
+ ret = duk_get_pointer(ctx, -1);
+ duk_pop(ctx);
+ return ret;
+}
+
+#define DUKKY_CREATE_PRIVATE(klass) \
+ klass##_private_t *priv = calloc(1, sizeof(*priv)); \
+ if (priv == NULL) return 0; \
+ duk_push_pointer(ctx, priv); \
+ duk_put_prop_string(ctx, 0, PRIVATE_MAGIC)
+
+#define DUKKY_SET_DESTRUCTOR(idx,n) \
+ duk_dup(ctx, idx); \
+ duk_push_c_function(ctx, DUKKY_FUNC_T(n,__destructor), 1); \
+ duk_set_finalizer(ctx, -2); \
+ duk_pop(ctx);
+
+#define DUKKY_SET_CONSTRUCTOR(idx,n,a) \
+ duk_dup(ctx, idx); \
+ duk_push_c_function(ctx, DUKKY_FUNC_T(n,__constructor), 1 + a); \
+ duk_put_prop_string(ctx, -2, INIT_MAGIC); \
+ duk_pop(ctx);
+
+#define DUKKY_SAFE_GET_PRIVATE(t,idx) \
+ t##_private_t *priv = dukky_get_private(ctx, idx); \
+ if (priv == NULL) return 0; /* No can do */
+
+#define DUKKY_GET_METHOD_PRIVATE(t) \
+ t##_private_t *priv = NULL; \
+ duk_push_this(ctx); \
+ duk_get_prop_string(ctx, -1, PRIVATE_MAGIC); \
+ priv = duk_get_pointer(ctx, -1); \
+ duk_pop_2(ctx); \
+ if (priv == NULL) return 0; /* No can do */
+
+#define DUKKY_GET_PROTOTYPE(klass) \
+ duk_get_global_string(ctx, PROTO_MAGIC); \
+ duk_get_prop_string(ctx, -1, PROTO_NAME(klass)); \
+ duk_replace(ctx, -2); \
+ duk_pop(ctx);
+
+#define DUKKY_DECLARE_PROTOTYPE(klass) \
+ DUKKY_FUNC(klass,__proto)
+
+#define DUKKY_GETTER(klass,prop) \
+ duk_ret_t DUKKY_FUNC_T(klass,prop##_getter)(duk_context *ctx)
+
+#define DUKKY_SETTER(klass,prop) \
+ duk_ret_t DUKKY_FUNC_T(klass,prop##_setter)(duk_context *ctx)
+
+#define DUKKY_POPULATE_FULL_PROPERTY(klass,prop) \
+ duk_dup(ctx, 0); \
+ duk_push_string(ctx, #prop); \
+ duk_push_c_function(ctx, DUKKY_FUNC_T(klass,prop##_getter), 0); \
+ duk_push_c_function(ctx, DUKKY_FUNC_T(klass,prop##_setter), 1); \
+ duk_def_prop(ctx, -4, DUK_DEFPROP_HAVE_GETTER | \
+ DUK_DEFPROP_HAVE_SETTER | \
+ DUK_DEFPROP_HAVE_CONFIGURABLE); \
+ duk_pop(ctx)
+
+#define DUKKY_DUMP_STACK(ctx) \
+ do { \
+ duk_push_context_dump(ctx); \
+ LOG("Stack: %s", duk_to_string(ctx, -1)); \
+ duk_pop(ctx); \
+ } while(0)
+
+#define DUKKY_ADD_METHOD(klass,meth,nargs) \
+ duk_dup(ctx, 0); \
+ duk_push_string(ctx, #meth); \
+ duk_push_c_function(ctx, DUKKY_FUNC_T(klass,meth), nargs); \
+ DUKKY_DUMP_STACK(ctx);\
+ duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE | \
+ DUK_DEFPROP_HAVE_WRITABLE | \
+ DUK_DEFPROP_HAVE_ENUMERABLE | DUK_DEFPROP_ENUMERABLE | \
+ DUK_DEFPROP_HAVE_CONFIGURABLE); \
+ duk_pop(ctx)
+
+#define DUKKY_FUNC_INIT(klass,args...) \
+ void DUKKY_FUNC_T(klass, __init)(duk_context *ctx, klass##_private_t *priv, ##args)
+
+#define DUKKY_FUNC_FINI(klass) \
+ void DUKKY_FUNC_T(klass, __fini)(duk_context *ctx, klass##_private_t *priv)
+
+#define DUKKY_DECLARE_INTERFACE(klass,init...) \
+ DUKKY_FUNC(klass, __proto); \
+ DUKKY_FUNC_INIT(klass, ##init); \
+ DUKKY_FUNC_FINI(klass)
+
+#include "duktape/private.h"
+#include "duktape/prototypes.h"
+
+duk_ret_t dukky_create_object(duk_context *ctx, const char *name, int args);
+
+#endif
diff --git a/javascript/duktape.c b/javascript/duktape.c
new file mode 100644
index 0000000..4432440
--- /dev/null
+++ b/javascript/duktape.c
@@ -0,0 +1,72672 @@
+/*
+ * Single file autogenerated distributable for Duktape 1.2.2.
+ * Git commit 5f4302c732d21b3b721db3d3473db32e4eb92470 (v1.2.2).
+ *
+ * See Duktape AUTHORS.rst and LICENSE.txt for copyright and
+ * licensing information.
+ */
+
+/* LICENSE.txt */
+/*
+* ===============
+* Duktape license
+* ===============
+*
+* (http://opensource.org/licenses/MIT)
+*
+* Copyright (c) 2013-2015 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
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*
+*/
+/* AUTHORS.rst */
+/*
+* ===============
+* Duktape authors
+* ===============
+*
+* Copyright
+* =========
+*
+* Duktape copyrights are held by its authors. Each author has a copyright
+* to their contribution, and agrees to irrevocably license the contribution
+* under the Duktape ``LICENSE.txt``.
+*
+* Authors
+* =======
+*
+* Please include an e-mail address, a link to your GitHub profile, or something
+* similar to allow your contribution to be identified accurately.
+*
+* The following people have contributed code and agreed to irrevocably license
+* their contributions under the Duktape ``LICENSE.txt`` (in order of appearance):
+*
+* * Sami Vaarala <sami.vaarala(a)iki.fi>
+* * Niki Dobrev
+* * Andreas \u00d6man <andreas(a)lonelycoder.com>
+* * L\u00e1szl\u00f3 Lang\u00f3 <llango.u-szeged(a)partner.samsung.com>
+* * Legimet <legimet.calc(a)gmail.com>
+*
+* Other contributions
+* ===================
+*
+* The following people have contributed something other than code (e.g. reported
+* bugs, provided ideas, etc; roughly in order of appearance):
+*
+* * Greg Burns
+* * Anthony Rabine
+* * Carlos Costa
+* * Aur\u00e9lien Bouilland
+* * Preet Desai (Pris Matic)
+* * judofyr (http://www.reddit.com/user/judofyr)
+* * Jason Woofenden
+* * Micha\u0142 Przyby\u015b
+* * Anthony Howe
+* * Conrad Pankoff
+* * Jim Schimpf
+* * Rajaran Gaunker (https://github.com/zimbabao)
+* * Andreas \u00d6man
+* * Doug Sanden
+* * Josh Engebretson (https://github.com/JoshEngebretson)
+* * Remo Eichenberger (https://github.com/remoe)
+* * Mamod Mehyar (https://github.com/mamod)
+* * David Demelier (https://github.com/hftmarkand)
+* * Tim Caswell (https://github.com/creationix)
+* * Mitchell Blank Jr (https://github.com/mitchblank)
+* * https://github.com/yushli
+* * Seo Sanghyeon (https://github.com/sanxiyn)
+* * Han ChoongWoo (https://github.com/tunz)
+* * Joshua Peek (https://github.com/josh)
+* * Bruce E. Pascoe (https://github.com/fatcerberus)
+* * https://github.com/Kelledin
+*
+* If you are accidentally missing from this list, send me an e-mail
+* (``sami.vaarala(a)iki.fi``) and I'll fix the omission.
+*/
+#line 1 "duk_internal.h"
+/*
+ * Top-level include file to be used for all (internal) source files.
+ *
+ * Source files should not include individual header files, as they
+ * have not been designed to be individually included.
+ */
+
+#ifndef DUK_INTERNAL_H_INCLUDED
+#define DUK_INTERNAL_H_INCLUDED
+
+/*
+ * The 'duktape.h' header provides the public API, but also handles all
+ * compiler and platform specific feature detection, Duktape feature
+ * resolution, inclusion of system headers, etc. These have been merged
+ * because the public API is also dependent on e.g. detecting appropriate
+ * C types which is quite platform/compiler specific especially for a non-C99
+ * build. The public API is also dependent on the resolved feature set.
+ *
+ * Some actions taken by the merged header (such as including system headers)
+ * are not appropriate for building a user application. The define
+ * DUK_COMPILING_DUKTAPE allows the merged header to skip/include some
+ * sections depending on what is being built.
+ */
+
+#define DUK_COMPILING_DUKTAPE
+#include "duktape.h"
+
+/*
+ * User declarations, e.g. prototypes for user functions used by Duktape
+ * macros. Concretely, if DUK_OPT_PANIC_HANDLER is used and the macro
+ * value calls a user function, it needs to be declared for Duktape
+ * compilation to avoid warnings.
+ */
+
+DUK_USE_USER_DECLARE()
+
+/*
+ * Duktape includes (other than duk_features.h)
+ *
+ * The header files expect to be included in an order which satisfies header
+ * dependencies correctly (the headers themselves don't include any other
+ * includes). Forward declarations are used to break circular struct/typedef
+ * dependencies.
+ */
+
+#line 1 "duk_replacements.h"
+#ifndef DUK_REPLACEMENTS_H_INCLUDED
+#define DUK_REPLACEMENTS_H_INCLUDED
+
+#ifdef DUK_USE_REPL_FPCLASSIFY
+DUK_INTERNAL_DECL int duk_repl_fpclassify(double x);
+#endif
+
+#ifdef DUK_USE_REPL_SIGNBIT
+DUK_INTERNAL_DECL int duk_repl_signbit(double x);
+#endif
+
+#ifdef DUK_USE_REPL_ISFINITE
+DUK_INTERNAL_DECL int duk_repl_isfinite(double x);
+#endif
+
+#ifdef DUK_USE_REPL_ISNAN
+DUK_INTERNAL_DECL int duk_repl_isnan(double x);
+#endif
+
+#ifdef DUK_USE_REPL_ISINF
+DUK_INTERNAL_DECL int duk_repl_isinf(double x);
+#endif
+
+#endif /* DUK_REPLACEMENTS_H_INCLUDED */
+#line 1 "duk_jmpbuf.h"
+/*
+ * Wrapper for jmp_buf.
+ *
+ * This is used because jmp_buf is an array type for backward compatibility.
+ * Wrapping jmp_buf in a struct makes pointer references, sizeof, etc,
+ * behave more intuitively.
+ *
+ * http://en.wikipedia.org/wiki/Setjmp.h#Member_types
+ */
+
+#ifndef DUK_JMPBUF_H_INCLUDED
+#define DUK_JMPBUF_H_INCLUDED
+
+struct duk_jmpbuf {
+#if defined(DUK_USE_SETJMP) || defined(DUK_USE_UNDERSCORE_SETJMP)
+ jmp_buf jb;
+#elif defined(DUK_USE_SIGSETJMP)
+ sigjmp_buf jb;
+#else
+#error internal error, no long control transfer provider
+#endif
+};
+
+#endif /* DUK_JMPBUF_H_INCLUDED */
+#line 1 "duk_forwdecl.h"
+/*
+ * Forward declarations for all Duktape structures.
+ */
+
+#ifndef DUK_FORWDECL_H_INCLUDED
+#define DUK_FORWDECL_H_INCLUDED
+
+/*
+ * Forward declarations
+ */
+
+struct duk_jmpbuf;
+
+/* duk_tval intentionally skipped */
+struct duk_heaphdr;
+struct duk_heaphdr_string;
+struct duk_hstring;
+struct duk_hstring_external;
+struct duk_hobject;
+struct duk_hcompiledfunction;
+struct duk_hnativefunction;
+struct duk_hthread;
+struct duk_hbuffer;
+struct duk_hbuffer_fixed;
+struct duk_hbuffer_dynamic;
+
+struct duk_propaccessor;
+union duk_propvalue;
+struct duk_propdesc;
+
+struct duk_heap;
+struct duk_breakpoint;
+
+struct duk_activation;
+struct duk_catcher;
+struct duk_strcache;
+struct duk_ljstate;
+struct duk_strtab_entry;
+
+#ifdef DUK_USE_DEBUG
+struct duk_fixedbuffer;
+#endif
+
+struct duk_bitdecoder_ctx;
+struct duk_bitencoder_ctx;
+
+struct duk_token;
+struct duk_re_token;
+struct duk_lexer_point;
+struct duk_lexer_ctx;
+
+struct duk_compiler_instr;
+struct duk_compiler_func;
+struct duk_compiler_ctx;
+
+struct duk_re_matcher_ctx;
+struct duk_re_compiler_ctx;
+
+typedef struct duk_jmpbuf duk_jmpbuf;
+
+/* duk_tval intentionally skipped */
+typedef struct duk_heaphdr duk_heaphdr;
+typedef struct duk_heaphdr_string duk_heaphdr_string;
+typedef struct duk_hstring duk_hstring;
+typedef struct duk_hstring_external duk_hstring_external;
+typedef struct duk_hobject duk_hobject;
+typedef struct duk_hcompiledfunction duk_hcompiledfunction;
+typedef struct duk_hnativefunction duk_hnativefunction;
+typedef struct duk_hthread duk_hthread;
+typedef struct duk_hbuffer duk_hbuffer;
+typedef struct duk_hbuffer_fixed duk_hbuffer_fixed;
+typedef struct duk_hbuffer_dynamic duk_hbuffer_dynamic;
+
+typedef struct duk_propaccessor duk_propaccessor;
+typedef union duk_propvalue duk_propvalue;
+typedef struct duk_propdesc duk_propdesc;
+
+typedef struct duk_heap duk_heap;
+typedef struct duk_breakpoint duk_breakpoint;
+
+typedef struct duk_activation duk_activation;
+typedef struct duk_catcher duk_catcher;
+typedef struct duk_strcache duk_strcache;
+typedef struct duk_ljstate duk_ljstate;
+typedef struct duk_strtab_entry duk_strtab_entry;
+
+#ifdef DUK_USE_DEBUG
+typedef struct duk_fixedbuffer duk_fixedbuffer;
+#endif
+
+typedef struct duk_bitdecoder_ctx duk_bitdecoder_ctx;
+typedef struct duk_bitencoder_ctx duk_bitencoder_ctx;
+
+typedef struct duk_token duk_token;
+typedef struct duk_re_token duk_re_token;
+typedef struct duk_lexer_point duk_lexer_point;
+typedef struct duk_lexer_ctx duk_lexer_ctx;
+
+typedef struct duk_compiler_instr duk_compiler_instr;
+typedef struct duk_compiler_func duk_compiler_func;
+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 */
+#line 1 "duk_builtins.h"
+/*
+ * Automatically generated by genbuiltins.py, do not edit!
+ */
+
+#ifndef DUK_BUILTINS_H_INCLUDED
+#define DUK_BUILTINS_H_INCLUDED
+
+#if defined(DUK_USE_DOUBLE_LE)
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL const duk_uint8_t duk_strings_data[1943];
+#endif /* !DUK_SINGLE_FILE */
+
+#define DUK_STRDATA_DATA_LENGTH 1943
+#define DUK_STRDATA_MAX_STRLEN 24
+
+#define DUK_STRIDX_UC_LOGGER 0 /* 'Logger' */
+#define DUK_STRIDX_UC_THREAD 1 /* 'Thread' */
+#define DUK_STRIDX_UC_POINTER 2 /* 'Pointer' */
+#define DUK_STRIDX_UC_BUFFER 3 /* 'Buffer' */
+#define DUK_STRIDX_DEC_ENV 4 /* 'DecEnv' */
+#define DUK_STRIDX_OBJ_ENV 5 /* 'ObjEnv' */
+#define DUK_STRIDX_EMPTY_STRING 6 /* '' */
+#define DUK_STRIDX_GLOBAL 7 /* 'global' */
+#define DUK_STRIDX_UC_ARGUMENTS 8 /* 'Arguments' */
+#define DUK_STRIDX_JSON 9 /* 'JSON' */
+#define DUK_STRIDX_MATH 10 /* 'Math' */
+#define DUK_STRIDX_UC_ERROR 11 /* 'Error' */
+#define DUK_STRIDX_REG_EXP 12 /* 'RegExp' */
+#define DUK_STRIDX_DATE 13 /* 'Date' */
+#define DUK_STRIDX_UC_NUMBER 14 /* 'Number' */
+#define DUK_STRIDX_UC_BOOLEAN 15 /* 'Boolean' */
+#define DUK_STRIDX_UC_STRING 16 /* 'String' */
+#define DUK_STRIDX_ARRAY 17 /* 'Array' */
+#define DUK_STRIDX_UC_FUNCTION 18 /* 'Function' */
+#define DUK_STRIDX_UC_OBJECT 19 /* 'Object' */
+#define DUK_STRIDX_UC_NULL 20 /* 'Null' */
+#define DUK_STRIDX_UC_UNDEFINED 21 /* 'Undefined' */
+#define DUK_STRIDX_JSON_EXT_FUNCTION2 22 /* '{_func:true}' */
+#define DUK_STRIDX_JSON_EXT_FUNCTION1 23 /* '{"_func":true}' */
+#define DUK_STRIDX_JSON_EXT_NEGINF 24 /* '{"_ninf":true}' */
+#define DUK_STRIDX_JSON_EXT_POSINF 25 /* '{"_inf":true}' */
+#define DUK_STRIDX_JSON_EXT_NAN 26 /* '{"_nan":true}' */
+#define DUK_STRIDX_JSON_EXT_UNDEFINED 27 /* '{"_undef":true}' */
+#define DUK_STRIDX_TO_LOG_STRING 28 /* 'toLogString' */
+#define DUK_STRIDX_CLOG 29 /* 'clog' */
+#define DUK_STRIDX_LC_L 30 /* 'l' */
+#define DUK_STRIDX_LC_N 31 /* 'n' */
+#define DUK_STRIDX_LC_FATAL 32 /* 'fatal' */
+#define DUK_STRIDX_LC_ERROR 33 /* 'error' */
+#define DUK_STRIDX_LC_WARN 34 /* 'warn' */
+#define DUK_STRIDX_LC_DEBUG 35 /* 'debug' */
+#define DUK_STRIDX_LC_TRACE 36 /* 'trace' */
+#define DUK_STRIDX_RAW 37 /* 'raw' */
+#define DUK_STRIDX_FMT 38 /* 'fmt' */
+#define DUK_STRIDX_CURRENT 39 /* 'current' */
+#define DUK_STRIDX_RESUME 40 /* 'resume' */
+#define DUK_STRIDX_COMPACT 41 /* 'compact' */
+#define DUK_STRIDX_JC 42 /* 'jc' */
+#define DUK_STRIDX_JX 43 /* 'jx' */
+#define DUK_STRIDX_BASE64 44 /* 'base64' */
+#define DUK_STRIDX_HEX 45 /* 'hex' */
+#define DUK_STRIDX_DEC 46 /* 'dec' */
+#define DUK_STRIDX_ENC 47 /* 'enc' */
+#define DUK_STRIDX_FIN 48 /* 'fin' */
+#define DUK_STRIDX_GC 49 /* 'gc' */
+#define DUK_STRIDX_ACT 50 /* 'act' */
+#define DUK_STRIDX_LC_INFO 51 /* 'info' */
+#define DUK_STRIDX_VERSION 52 /* 'version' */
+#define DUK_STRIDX_ENV 53 /* 'env' */
+#define DUK_STRIDX_MOD_LOADED 54 /* 'modLoaded' */
+#define DUK_STRIDX_MOD_SEARCH 55 /* 'modSearch' */
+#define DUK_STRIDX_ERR_THROW 56 /* 'errThrow' */
+#define DUK_STRIDX_ERR_CREATE 57 /* 'errCreate' */
+#define DUK_STRIDX_COMPILE 58 /* 'compile' */
+#define DUK_STRIDX_INT_REGBASE 59 /* '\x00Regbase' */
+#define DUK_STRIDX_INT_THREAD 60 /* '\x00Thread' */
+#define DUK_STRIDX_INT_HANDLER 61 /* '\x00Handler' */
+#define DUK_STRIDX_INT_FINALIZER 62 /* '\x00Finalizer' */
+#define DUK_STRIDX_INT_CALLEE 63 /* '\x00Callee' */
+#define DUK_STRIDX_INT_MAP 64 /* '\x00Map' */
+#define DUK_STRIDX_INT_ARGS 65 /* '\x00Args' */
+#define DUK_STRIDX_INT_THIS 66 /* '\x00This' */
+#define DUK_STRIDX_INT_PC2LINE 67 /* '\x00Pc2line' */
+#define DUK_STRIDX_INT_SOURCE 68 /* '\x00Source' */
+#define DUK_STRIDX_INT_VARENV 69 /* '\x00Varenv' */
+#define DUK_STRIDX_INT_LEXENV 70 /* '\x00Lexenv' */
+#define DUK_STRIDX_INT_VARMAP 71 /* '\x00Varmap' */
+#define DUK_STRIDX_INT_FORMALS 72 /* '\x00Formals' */
+#define DUK_STRIDX_INT_BYTECODE 73 /* '\x00Bytecode' */
+#define DUK_STRIDX_INT_NEXT 74 /* '\x00Next' */
+#define DUK_STRIDX_INT_TARGET 75 /* '\x00Target' */
+#define DUK_STRIDX_INT_VALUE 76 /* '\x00Value' */
+#define DUK_STRIDX_LC_POINTER 77 /* 'pointer' */
+#define DUK_STRIDX_LC_BUFFER 78 /* 'buffer' */
+#define DUK_STRIDX_INT_TRACEDATA 79 /* '\x00Tracedata' */
+#define DUK_STRIDX_LINE_NUMBER 80 /* 'lineNumber' */
+#define DUK_STRIDX_FILE_NAME 81 /* 'fileName' */
+#define DUK_STRIDX_PC 82 /* 'pc' */
+#define DUK_STRIDX_STACK 83 /* 'stack' */
+#define DUK_STRIDX_THROW_TYPE_ERROR 84 /* 'ThrowTypeError' */
+#define DUK_STRIDX_DUKTAPE 85 /* 'Duktape' */
+#define DUK_STRIDX_ID 86 /* 'id' */
+#define DUK_STRIDX_REQUIRE 87 /* 'require' */
+#define DUK_STRIDX___PROTO__ 88 /* '__proto__' */
+#define DUK_STRIDX_SET_PROTOTYPE_OF 89 /* 'setPrototypeOf' */
+#define DUK_STRIDX_OWN_KEYS 90 /* 'ownKeys' */
+#define DUK_STRIDX_ENUMERATE 91 /* 'enumerate' */
+#define DUK_STRIDX_DELETE_PROPERTY 92 /* 'deleteProperty' */
+#define DUK_STRIDX_HAS 93 /* 'has' */
+#define DUK_STRIDX_PROXY 94 /* 'Proxy' */
+#define DUK_STRIDX_CALLEE 95 /* 'callee' */
+#define DUK_STRIDX_INVALID_DATE 96 /* 'Invalid Date' */
+#define DUK_STRIDX_BRACKETED_ELLIPSIS 97 /* '[...]' */
+#define DUK_STRIDX_NEWLINE_TAB 98 /* '\n\t' */
+#define DUK_STRIDX_SPACE 99 /* ' ' */
+#define DUK_STRIDX_COMMA 100 /* ',' */
+#define DUK_STRIDX_MINUS_ZERO 101 /* '-0' */
+#define DUK_STRIDX_PLUS_ZERO 102 /* '+0' */
+#define DUK_STRIDX_ZERO 103 /* '0' */
+#define DUK_STRIDX_MINUS_INFINITY 104 /* '-Infinity' */
+#define DUK_STRIDX_PLUS_INFINITY 105 /* '+Infinity' */
+#define DUK_STRIDX_INFINITY 106 /* 'Infinity' */
+#define DUK_STRIDX_LC_OBJECT 107 /* 'object' */
+#define DUK_STRIDX_LC_STRING 108 /* 'string' */
+#define DUK_STRIDX_LC_NUMBER 109 /* 'number' */
+#define DUK_STRIDX_LC_BOOLEAN 110 /* 'boolean' */
+#define DUK_STRIDX_LC_UNDEFINED 111 /* 'undefined' */
+#define DUK_STRIDX_STRINGIFY 112 /* 'stringify' */
+#define DUK_STRIDX_TAN 113 /* 'tan' */
+#define DUK_STRIDX_SQRT 114 /* 'sqrt' */
+#define DUK_STRIDX_SIN 115 /* 'sin' */
+#define DUK_STRIDX_ROUND 116 /* 'round' */
+#define DUK_STRIDX_RANDOM 117 /* 'random' */
+#define DUK_STRIDX_POW 118 /* 'pow' */
+#define DUK_STRIDX_MIN 119 /* 'min' */
+#define DUK_STRIDX_MAX 120 /* 'max' */
+#define DUK_STRIDX_LOG 121 /* 'log' */
+#define DUK_STRIDX_FLOOR 122 /* 'floor' */
+#define DUK_STRIDX_EXP 123 /* 'exp' */
+#define DUK_STRIDX_COS 124 /* 'cos' */
+#define DUK_STRIDX_CEIL 125 /* 'ceil' */
+#define DUK_STRIDX_ATAN2 126 /* 'atan2' */
+#define DUK_STRIDX_ATAN 127 /* 'atan' */
+#define DUK_STRIDX_ASIN 128 /* 'asin' */
+#define DUK_STRIDX_ACOS 129 /* 'acos' */
+#define DUK_STRIDX_ABS 130 /* 'abs' */
+#define DUK_STRIDX_SQRT2 131 /* 'SQRT2' */
+#define DUK_STRIDX_SQRT1_2 132 /* 'SQRT1_2' */
+#define DUK_STRIDX_PI 133 /* 'PI' */
+#define DUK_STRIDX_LOG10E 134 /* 'LOG10E' */
+#define DUK_STRIDX_LOG2E 135 /* 'LOG2E' */
+#define DUK_STRIDX_LN2 136 /* 'LN2' */
+#define DUK_STRIDX_LN10 137 /* 'LN10' */
+#define DUK_STRIDX_E 138 /* 'E' */
+#define DUK_STRIDX_MESSAGE 139 /* 'message' */
+#define DUK_STRIDX_NAME 140 /* 'name' */
+#define DUK_STRIDX_INPUT 141 /* 'input' */
+#define DUK_STRIDX_INDEX 142 /* 'index' */
+#define DUK_STRIDX_ESCAPED_EMPTY_REGEXP 143 /* '(?:)' */
+#define DUK_STRIDX_LAST_INDEX 144 /* 'lastIndex' */
+#define DUK_STRIDX_MULTILINE 145 /* 'multiline' */
+#define DUK_STRIDX_IGNORE_CASE 146 /* 'ignoreCase' */
+#define DUK_STRIDX_SOURCE 147 /* 'source' */
+#define DUK_STRIDX_TEST 148 /* 'test' */
+#define DUK_STRIDX_EXEC 149 /* 'exec' */
+#define DUK_STRIDX_TO_GMT_STRING 150 /* 'toGMTString' */
+#define DUK_STRIDX_SET_YEAR 151 /* 'setYear' */
+#define DUK_STRIDX_GET_YEAR 152 /* 'getYear' */
+#define DUK_STRIDX_TO_JSON 153 /* 'toJSON' */
+#define DUK_STRIDX_TO_ISO_STRING 154 /* 'toISOString' */
+#define DUK_STRIDX_TO_UTC_STRING 155 /* 'toUTCString' */
+#define DUK_STRIDX_SET_UTC_FULL_YEAR 156 /* 'setUTCFullYear' */
+#define DUK_STRIDX_SET_FULL_YEAR 157 /* 'setFullYear' */
+#define DUK_STRIDX_SET_UTC_MONTH 158 /* 'setUTCMonth' */
+#define DUK_STRIDX_SET_MONTH 159 /* 'setMonth' */
+#define DUK_STRIDX_SET_UTC_DATE 160 /* 'setUTCDate' */
+#define DUK_STRIDX_SET_DATE 161 /* 'setDate' */
+#define DUK_STRIDX_SET_UTC_HOURS 162 /* 'setUTCHours' */
+#define DUK_STRIDX_SET_HOURS 163 /* 'setHours' */
+#define DUK_STRIDX_SET_UTC_MINUTES 164 /* 'setUTCMinutes' */
+#define DUK_STRIDX_SET_MINUTES 165 /* 'setMinutes' */
+#define DUK_STRIDX_SET_UTC_SECONDS 166 /* 'setUTCSeconds' */
+#define DUK_STRIDX_SET_SECONDS 167 /* 'setSeconds' */
+#define DUK_STRIDX_SET_UTC_MILLISECONDS 168 /* 'setUTCMilliseconds' */
+#define DUK_STRIDX_SET_MILLISECONDS 169 /* 'setMilliseconds' */
+#define DUK_STRIDX_SET_TIME 170 /* 'setTime' */
+#define DUK_STRIDX_GET_TIMEZONE_OFFSET 171 /* 'getTimezoneOffset' */
+#define DUK_STRIDX_GET_UTC_MILLISECONDS 172 /* 'getUTCMilliseconds' */
+#define DUK_STRIDX_GET_MILLISECONDS 173 /* 'getMilliseconds' */
+#define DUK_STRIDX_GET_UTC_SECONDS 174 /* 'getUTCSeconds' */
+#define DUK_STRIDX_GET_SECONDS 175 /* 'getSeconds' */
+#define DUK_STRIDX_GET_UTC_MINUTES 176 /* 'getUTCMinutes' */
+#define DUK_STRIDX_GET_MINUTES 177 /* 'getMinutes' */
+#define DUK_STRIDX_GET_UTC_HOURS 178 /* 'getUTCHours' */
+#define DUK_STRIDX_GET_HOURS 179 /* 'getHours' */
+#define DUK_STRIDX_GET_UTC_DAY 180 /* 'getUTCDay' */
+#define DUK_STRIDX_GET_DAY 181 /* 'getDay' */
+#define DUK_STRIDX_GET_UTC_DATE 182 /* 'getUTCDate' */
+#define DUK_STRIDX_GET_DATE 183 /* 'getDate' */
+#define DUK_STRIDX_GET_UTC_MONTH 184 /* 'getUTCMonth' */
+#define DUK_STRIDX_GET_MONTH 185 /* 'getMonth' */
+#define DUK_STRIDX_GET_UTC_FULL_YEAR 186 /* 'getUTCFullYear' */
+#define DUK_STRIDX_GET_FULL_YEAR 187 /* 'getFullYear' */
+#define DUK_STRIDX_GET_TIME 188 /* 'getTime' */
+#define DUK_STRIDX_TO_LOCALE_TIME_STRING 189 /* 'toLocaleTimeString' */
+#define DUK_STRIDX_TO_LOCALE_DATE_STRING 190 /* 'toLocaleDateString' */
+#define DUK_STRIDX_TO_TIME_STRING 191 /* 'toTimeString' */
+#define DUK_STRIDX_TO_DATE_STRING 192 /* 'toDateString' */
+#define DUK_STRIDX_NOW 193 /* 'now' */
+#define DUK_STRIDX_UTC 194 /* 'UTC' */
+#define DUK_STRIDX_PARSE 195 /* 'parse' */
+#define DUK_STRIDX_TO_PRECISION 196 /* 'toPrecision' */
+#define DUK_STRIDX_TO_EXPONENTIAL 197 /* 'toExponential' */
+#define DUK_STRIDX_TO_FIXED 198 /* 'toFixed' */
+#define DUK_STRIDX_POSITIVE_INFINITY 199 /* 'POSITIVE_INFINITY' */
+#define DUK_STRIDX_NEGATIVE_INFINITY 200 /* 'NEGATIVE_INFINITY' */
+#define DUK_STRIDX_NAN 201 /* 'NaN' */
+#define DUK_STRIDX_MIN_VALUE 202 /* 'MIN_VALUE' */
+#define DUK_STRIDX_MAX_VALUE 203 /* 'MAX_VALUE' */
+#define DUK_STRIDX_SUBSTR 204 /* 'substr' */
+#define DUK_STRIDX_TRIM 205 /* 'trim' */
+#define DUK_STRIDX_TO_LOCALE_UPPER_CASE 206 /* 'toLocaleUpperCase' */
+#define DUK_STRIDX_TO_UPPER_CASE 207 /* 'toUpperCase' */
+#define DUK_STRIDX_TO_LOCALE_LOWER_CASE 208 /* 'toLocaleLowerCase' */
+#define DUK_STRIDX_TO_LOWER_CASE 209 /* 'toLowerCase' */
+#define DUK_STRIDX_SUBSTRING 210 /* 'substring' */
+#define DUK_STRIDX_SPLIT 211 /* 'split' */
+#define DUK_STRIDX_SEARCH 212 /* 'search' */
+#define DUK_STRIDX_REPLACE 213 /* 'replace' */
+#define DUK_STRIDX_MATCH 214 /* 'match' */
+#define DUK_STRIDX_LOCALE_COMPARE 215 /* 'localeCompare' */
+#define DUK_STRIDX_CHAR_CODE_AT 216 /* 'charCodeAt' */
+#define DUK_STRIDX_CHAR_AT 217 /* 'charAt' */
+#define DUK_STRIDX_FROM_CHAR_CODE 218 /* 'fromCharCode' */
+#define DUK_STRIDX_REDUCE_RIGHT 219 /* 'reduceRight' */
+#define DUK_STRIDX_REDUCE 220 /* 'reduce' */
+#define DUK_STRIDX_FILTER 221 /* 'filter' */
+#define DUK_STRIDX_MAP 222 /* 'map' */
+#define DUK_STRIDX_FOR_EACH 223 /* 'forEach' */
+#define DUK_STRIDX_SOME 224 /* 'some' */
+#define DUK_STRIDX_EVERY 225 /* 'every' */
+#define DUK_STRIDX_LAST_INDEX_OF 226 /* 'lastIndexOf' */
+#define DUK_STRIDX_INDEX_OF 227 /* 'indexOf' */
+#define DUK_STRIDX_UNSHIFT 228 /* 'unshift' */
+#define DUK_STRIDX_SPLICE 229 /* 'splice' */
+#define DUK_STRIDX_SORT 230 /* 'sort' */
+#define DUK_STRIDX_SLICE 231 /* 'slice' */
+#define DUK_STRIDX_SHIFT 232 /* 'shift' */
+#define DUK_STRIDX_REVERSE 233 /* 'reverse' */
+#define DUK_STRIDX_PUSH 234 /* 'push' */
+#define DUK_STRIDX_POP 235 /* 'pop' */
+#define DUK_STRIDX_JOIN 236 /* 'join' */
+#define DUK_STRIDX_CONCAT 237 /* 'concat' */
+#define DUK_STRIDX_IS_ARRAY 238 /* 'isArray' */
+#define DUK_STRIDX_LC_ARGUMENTS 239 /* 'arguments' */
+#define DUK_STRIDX_CALLER 240 /* 'caller' */
+#define DUK_STRIDX_BIND 241 /* 'bind' */
+#define DUK_STRIDX_CALL 242 /* 'call' */
+#define DUK_STRIDX_APPLY 243 /* 'apply' */
+#define DUK_STRIDX_PROPERTY_IS_ENUMERABLE 244 /* 'propertyIsEnumerable' */
+#define DUK_STRIDX_IS_PROTOTYPE_OF 245 /* 'isPrototypeOf' */
+#define DUK_STRIDX_HAS_OWN_PROPERTY 246 /* 'hasOwnProperty' */
+#define DUK_STRIDX_VALUE_OF 247 /* 'valueOf' */
+#define DUK_STRIDX_TO_LOCALE_STRING 248 /* 'toLocaleString' */
+#define DUK_STRIDX_TO_STRING 249 /* 'toString' */
+#define DUK_STRIDX_CONSTRUCTOR 250 /* 'constructor' */
+#define DUK_STRIDX_SET 251 /* 'set' */
+#define DUK_STRIDX_GET 252 /* 'get' */
+#define DUK_STRIDX_ENUMERABLE 253 /* 'enumerable' */
+#define DUK_STRIDX_CONFIGURABLE 254 /* 'configurable' */
+#define DUK_STRIDX_WRITABLE 255 /* 'writable' */
+#define DUK_STRIDX_VALUE 256 /* 'value' */
+#define DUK_STRIDX_KEYS 257 /* 'keys' */
+#define DUK_STRIDX_IS_EXTENSIBLE 258 /* 'isExtensible' */
+#define DUK_STRIDX_IS_FROZEN 259 /* 'isFrozen' */
+#define DUK_STRIDX_IS_SEALED 260 /* 'isSealed' */
+#define DUK_STRIDX_PREVENT_EXTENSIONS 261 /* 'preventExtensions' */
+#define DUK_STRIDX_FREEZE 262 /* 'freeze' */
+#define DUK_STRIDX_SEAL 263 /* 'seal' */
+#define DUK_STRIDX_DEFINE_PROPERTIES 264 /* 'defineProperties' */
+#define DUK_STRIDX_DEFINE_PROPERTY 265 /* 'defineProperty' */
+#define DUK_STRIDX_CREATE 266 /* 'create' */
+#define DUK_STRIDX_GET_OWN_PROPERTY_NAMES 267 /* 'getOwnPropertyNames' */
+#define DUK_STRIDX_GET_OWN_PROPERTY_DESCRIPTOR 268 /* 'getOwnPropertyDescriptor' */
+#define DUK_STRIDX_GET_PROTOTYPE_OF 269 /* 'getPrototypeOf' */
+#define DUK_STRIDX_PROTOTYPE 270 /* 'prototype' */
+#define DUK_STRIDX_LENGTH 271 /* 'length' */
+#define DUK_STRIDX_ALERT 272 /* 'alert' */
+#define DUK_STRIDX_PRINT 273 /* 'print' */
+#define DUK_STRIDX_UNESCAPE 274 /* 'unescape' */
+#define DUK_STRIDX_ESCAPE 275 /* 'escape' */
+#define DUK_STRIDX_ENCODE_URI_COMPONENT 276 /* 'encodeURIComponent' */
+#define DUK_STRIDX_ENCODE_URI 277 /* 'encodeURI' */
+#define DUK_STRIDX_DECODE_URI_COMPONENT 278 /* 'decodeURIComponent' */
+#define DUK_STRIDX_DECODE_URI 279 /* 'decodeURI' */
+#define DUK_STRIDX_IS_FINITE 280 /* 'isFinite' */
+#define DUK_STRIDX_IS_NAN 281 /* 'isNaN' */
+#define DUK_STRIDX_PARSE_FLOAT 282 /* 'parseFloat' */
+#define DUK_STRIDX_PARSE_INT 283 /* 'parseInt' */
+#define DUK_STRIDX_EVAL 284 /* 'eval' */
+#define DUK_STRIDX_URI_ERROR 285 /* 'URIError' */
+#define DUK_STRIDX_TYPE_ERROR 286 /* 'TypeError' */
+#define DUK_STRIDX_SYNTAX_ERROR 287 /* 'SyntaxError' */
+#define DUK_STRIDX_REFERENCE_ERROR 288 /* 'ReferenceError' */
+#define DUK_STRIDX_RANGE_ERROR 289 /* 'RangeError' */
+#define DUK_STRIDX_EVAL_ERROR 290 /* 'EvalError' */
+#define DUK_STRIDX_BREAK 291 /* 'break' */
+#define DUK_STRIDX_CASE 292 /* 'case' */
+#define DUK_STRIDX_CATCH 293 /* 'catch' */
+#define DUK_STRIDX_CONTINUE 294 /* 'continue' */
+#define DUK_STRIDX_DEBUGGER 295 /* 'debugger' */
+#define DUK_STRIDX_DEFAULT 296 /* 'default' */
+#define DUK_STRIDX_DELETE 297 /* 'delete' */
+#define DUK_STRIDX_DO 298 /* 'do' */
+#define DUK_STRIDX_ELSE 299 /* 'else' */
+#define DUK_STRIDX_FINALLY 300 /* 'finally' */
+#define DUK_STRIDX_FOR 301 /* 'for' */
+#define DUK_STRIDX_LC_FUNCTION 302 /* 'function' */
+#define DUK_STRIDX_IF 303 /* 'if' */
+#define DUK_STRIDX_IN 304 /* 'in' */
+#define DUK_STRIDX_INSTANCEOF 305 /* 'instanceof' */
+#define DUK_STRIDX_NEW 306 /* 'new' */
+#define DUK_STRIDX_RETURN 307 /* 'return' */
+#define DUK_STRIDX_SWITCH 308 /* 'switch' */
+#define DUK_STRIDX_THIS 309 /* 'this' */
+#define DUK_STRIDX_THROW 310 /* 'throw' */
+#define DUK_STRIDX_TRY 311 /* 'try' */
+#define DUK_STRIDX_TYPEOF 312 /* 'typeof' */
+#define DUK_STRIDX_VAR 313 /* 'var' */
+#define DUK_STRIDX_VOID 314 /* 'void' */
+#define DUK_STRIDX_WHILE 315 /* 'while' */
+#define DUK_STRIDX_WITH 316 /* 'with' */
+#define DUK_STRIDX_CLASS 317 /* 'class' */
+#define DUK_STRIDX_CONST 318 /* 'const' */
+#define DUK_STRIDX_ENUM 319 /* 'enum' */
+#define DUK_STRIDX_EXPORT 320 /* 'export' */
+#define DUK_STRIDX_EXTENDS 321 /* 'extends' */
+#define DUK_STRIDX_IMPORT 322 /* 'import' */
+#define DUK_STRIDX_SUPER 323 /* 'super' */
+#define DUK_STRIDX_LC_NULL 324 /* 'null' */
+#define DUK_STRIDX_TRUE 325 /* 'true' */
+#define DUK_STRIDX_FALSE 326 /* 'false' */
+#define DUK_STRIDX_IMPLEMENTS 327 /* 'implements' */
+#define DUK_STRIDX_INTERFACE 328 /* 'interface' */
+#define DUK_STRIDX_LET 329 /* 'let' */
+#define DUK_STRIDX_PACKAGE 330 /* 'package' */
+#define DUK_STRIDX_PRIVATE 331 /* 'private' */
+#define DUK_STRIDX_PROTECTED 332 /* 'protected' */
+#define DUK_STRIDX_PUBLIC 333 /* 'public' */
+#define DUK_STRIDX_STATIC 334 /* 'static' */
+#define DUK_STRIDX_YIELD 335 /* 'yield' */
+
+#define DUK_HEAP_STRING_UC_LOGGER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_LOGGER)
+#define DUK_HTHREAD_STRING_UC_LOGGER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_LOGGER)
+#define DUK_HEAP_STRING_UC_THREAD(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_THREAD)
+#define DUK_HTHREAD_STRING_UC_THREAD(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_THREAD)
+#define DUK_HEAP_STRING_UC_POINTER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_POINTER)
+#define DUK_HTHREAD_STRING_UC_POINTER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_POINTER)
+#define DUK_HEAP_STRING_UC_BUFFER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_BUFFER)
+#define DUK_HTHREAD_STRING_UC_BUFFER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_BUFFER)
+#define DUK_HEAP_STRING_DEC_ENV(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEC_ENV)
+#define DUK_HTHREAD_STRING_DEC_ENV(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEC_ENV)
+#define DUK_HEAP_STRING_OBJ_ENV(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_OBJ_ENV)
+#define DUK_HTHREAD_STRING_OBJ_ENV(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_OBJ_ENV)
+#define DUK_HEAP_STRING_EMPTY_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EMPTY_STRING)
+#define DUK_HTHREAD_STRING_EMPTY_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EMPTY_STRING)
+#define DUK_HEAP_STRING_GLOBAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GLOBAL)
+#define DUK_HTHREAD_STRING_GLOBAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GLOBAL)
+#define DUK_HEAP_STRING_UC_ARGUMENTS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_ARGUMENTS)
+#define DUK_HTHREAD_STRING_UC_ARGUMENTS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_ARGUMENTS)
+#define DUK_HEAP_STRING_JSON(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JSON)
+#define DUK_HTHREAD_STRING_JSON(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JSON)
+#define DUK_HEAP_STRING_MATH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MATH)
+#define DUK_HTHREAD_STRING_MATH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MATH)
+#define DUK_HEAP_STRING_UC_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_ERROR)
+#define DUK_HTHREAD_STRING_UC_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_ERROR)
+#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)
+#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_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_HEAP_STRING_UC_BOOLEAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_BOOLEAN)
+#define DUK_HTHREAD_STRING_UC_BOOLEAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_BOOLEAN)
+#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)
+#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_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_HEAP_STRING_UC_OBJECT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_OBJECT)
+#define DUK_HTHREAD_STRING_UC_OBJECT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_OBJECT)
+#define DUK_HEAP_STRING_UC_NULL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_NULL)
+#define DUK_HTHREAD_STRING_UC_NULL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_NULL)
+#define DUK_HEAP_STRING_UC_UNDEFINED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_UNDEFINED)
+#define DUK_HTHREAD_STRING_UC_UNDEFINED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_UNDEFINED)
+#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_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_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_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_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_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_HEAP_STRING_TO_LOG_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOG_STRING)
+#define DUK_HTHREAD_STRING_TO_LOG_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOG_STRING)
+#define DUK_HEAP_STRING_CLOG(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CLOG)
+#define DUK_HTHREAD_STRING_CLOG(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CLOG)
+#define DUK_HEAP_STRING_LC_L(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_L)
+#define DUK_HTHREAD_STRING_LC_L(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_L)
+#define DUK_HEAP_STRING_LC_N(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_N)
+#define DUK_HTHREAD_STRING_LC_N(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_N)
+#define DUK_HEAP_STRING_LC_FATAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_FATAL)
+#define DUK_HTHREAD_STRING_LC_FATAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_FATAL)
+#define DUK_HEAP_STRING_LC_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_ERROR)
+#define DUK_HTHREAD_STRING_LC_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_ERROR)
+#define DUK_HEAP_STRING_LC_WARN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_WARN)
+#define DUK_HTHREAD_STRING_LC_WARN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_WARN)
+#define DUK_HEAP_STRING_LC_DEBUG(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_DEBUG)
+#define DUK_HTHREAD_STRING_LC_DEBUG(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_DEBUG)
+#define DUK_HEAP_STRING_LC_TRACE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_TRACE)
+#define DUK_HTHREAD_STRING_LC_TRACE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_TRACE)
+#define DUK_HEAP_STRING_RAW(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_RAW)
+#define DUK_HTHREAD_STRING_RAW(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_RAW)
+#define DUK_HEAP_STRING_FMT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FMT)
+#define DUK_HTHREAD_STRING_FMT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FMT)
+#define DUK_HEAP_STRING_CURRENT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CURRENT)
+#define DUK_HTHREAD_STRING_CURRENT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CURRENT)
+#define DUK_HEAP_STRING_RESUME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_RESUME)
+#define DUK_HTHREAD_STRING_RESUME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_RESUME)
+#define DUK_HEAP_STRING_COMPACT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_COMPACT)
+#define DUK_HTHREAD_STRING_COMPACT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_COMPACT)
+#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_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_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_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_HEAP_STRING_DEC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEC)
+#define DUK_HTHREAD_STRING_DEC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEC)
+#define DUK_HEAP_STRING_ENC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENC)
+#define DUK_HTHREAD_STRING_ENC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENC)
+#define DUK_HEAP_STRING_FIN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FIN)
+#define DUK_HTHREAD_STRING_FIN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FIN)
+#define DUK_HEAP_STRING_GC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GC)
+#define DUK_HTHREAD_STRING_GC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GC)
+#define DUK_HEAP_STRING_ACT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ACT)
+#define DUK_HTHREAD_STRING_ACT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ACT)
+#define DUK_HEAP_STRING_LC_INFO(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_INFO)
+#define DUK_HTHREAD_STRING_LC_INFO(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_INFO)
+#define DUK_HEAP_STRING_VERSION(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_VERSION)
+#define DUK_HTHREAD_STRING_VERSION(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_VERSION)
+#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_HEAP_STRING_MOD_LOADED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MOD_LOADED)
+#define DUK_HTHREAD_STRING_MOD_LOADED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MOD_LOADED)
+#define DUK_HEAP_STRING_MOD_SEARCH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MOD_SEARCH)
+#define DUK_HTHREAD_STRING_MOD_SEARCH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MOD_SEARCH)
+#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_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_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_HEAP_STRING_INT_REGBASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_REGBASE)
+#define DUK_HTHREAD_STRING_INT_REGBASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_REGBASE)
+#define DUK_HEAP_STRING_INT_THREAD(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_THREAD)
+#define DUK_HTHREAD_STRING_INT_THREAD(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_THREAD)
+#define DUK_HEAP_STRING_INT_HANDLER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_HANDLER)
+#define DUK_HTHREAD_STRING_INT_HANDLER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_HANDLER)
+#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_HEAP_STRING_INT_CALLEE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_CALLEE)
+#define DUK_HTHREAD_STRING_INT_CALLEE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_CALLEE)
+#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_HEAP_STRING_INT_ARGS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_ARGS)
+#define DUK_HTHREAD_STRING_INT_ARGS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_ARGS)
+#define DUK_HEAP_STRING_INT_THIS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_THIS)
+#define DUK_HTHREAD_STRING_INT_THIS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_THIS)
+#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_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_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_HEAP_STRING_INT_LEXENV(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_LEXENV)
+#define DUK_HTHREAD_STRING_INT_LEXENV(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_LEXENV)
+#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_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_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_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_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_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_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_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_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_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_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_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_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_HEAP_STRING_THROW_TYPE_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_THROW_TYPE_ERROR)
+#define DUK_HTHREAD_STRING_THROW_TYPE_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_THROW_TYPE_ERROR)
+#define DUK_HEAP_STRING_DUKTAPE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DUKTAPE)
+#define DUK_HTHREAD_STRING_DUKTAPE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DUKTAPE)
+#define DUK_HEAP_STRING_ID(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ID)
+#define DUK_HTHREAD_STRING_ID(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ID)
+#define DUK_HEAP_STRING_REQUIRE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REQUIRE)
+#define DUK_HTHREAD_STRING_REQUIRE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REQUIRE)
+#define DUK_HEAP_STRING___PROTO__(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX___PROTO__)
+#define DUK_HTHREAD_STRING___PROTO__(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX___PROTO__)
+#define DUK_HEAP_STRING_SET_PROTOTYPE_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_PROTOTYPE_OF)
+#define DUK_HTHREAD_STRING_SET_PROTOTYPE_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_PROTOTYPE_OF)
+#define DUK_HEAP_STRING_OWN_KEYS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_OWN_KEYS)
+#define DUK_HTHREAD_STRING_OWN_KEYS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_OWN_KEYS)
+#define DUK_HEAP_STRING_ENUMERATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENUMERATE)
+#define DUK_HTHREAD_STRING_ENUMERATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENUMERATE)
+#define DUK_HEAP_STRING_DELETE_PROPERTY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DELETE_PROPERTY)
+#define DUK_HTHREAD_STRING_DELETE_PROPERTY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DELETE_PROPERTY)
+#define DUK_HEAP_STRING_HAS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_HAS)
+#define DUK_HTHREAD_STRING_HAS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_HAS)
+#define DUK_HEAP_STRING_PROXY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PROXY)
+#define DUK_HTHREAD_STRING_PROXY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PROXY)
+#define DUK_HEAP_STRING_CALLEE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CALLEE)
+#define DUK_HTHREAD_STRING_CALLEE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CALLEE)
+#define DUK_HEAP_STRING_INVALID_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INVALID_DATE)
+#define DUK_HTHREAD_STRING_INVALID_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INVALID_DATE)
+#define DUK_HEAP_STRING_BRACKETED_ELLIPSIS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_BRACKETED_ELLIPSIS)
+#define DUK_HTHREAD_STRING_BRACKETED_ELLIPSIS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_BRACKETED_ELLIPSIS)
+#define DUK_HEAP_STRING_NEWLINE_TAB(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NEWLINE_TAB)
+#define DUK_HTHREAD_STRING_NEWLINE_TAB(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NEWLINE_TAB)
+#define DUK_HEAP_STRING_SPACE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SPACE)
+#define DUK_HTHREAD_STRING_SPACE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SPACE)
+#define DUK_HEAP_STRING_COMMA(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_COMMA)
+#define DUK_HTHREAD_STRING_COMMA(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_COMMA)
+#define DUK_HEAP_STRING_MINUS_ZERO(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MINUS_ZERO)
+#define DUK_HTHREAD_STRING_MINUS_ZERO(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MINUS_ZERO)
+#define DUK_HEAP_STRING_PLUS_ZERO(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PLUS_ZERO)
+#define DUK_HTHREAD_STRING_PLUS_ZERO(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PLUS_ZERO)
+#define DUK_HEAP_STRING_ZERO(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ZERO)
+#define DUK_HTHREAD_STRING_ZERO(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ZERO)
+#define DUK_HEAP_STRING_MINUS_INFINITY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MINUS_INFINITY)
+#define DUK_HTHREAD_STRING_MINUS_INFINITY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MINUS_INFINITY)
+#define DUK_HEAP_STRING_PLUS_INFINITY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PLUS_INFINITY)
+#define DUK_HTHREAD_STRING_PLUS_INFINITY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PLUS_INFINITY)
+#define DUK_HEAP_STRING_INFINITY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INFINITY)
+#define DUK_HTHREAD_STRING_INFINITY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INFINITY)
+#define DUK_HEAP_STRING_LC_OBJECT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_OBJECT)
+#define DUK_HTHREAD_STRING_LC_OBJECT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_OBJECT)
+#define DUK_HEAP_STRING_LC_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_STRING)
+#define DUK_HTHREAD_STRING_LC_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_STRING)
+#define DUK_HEAP_STRING_LC_NUMBER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_NUMBER)
+#define DUK_HTHREAD_STRING_LC_NUMBER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_NUMBER)
+#define DUK_HEAP_STRING_LC_BOOLEAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_BOOLEAN)
+#define DUK_HTHREAD_STRING_LC_BOOLEAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_BOOLEAN)
+#define DUK_HEAP_STRING_LC_UNDEFINED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_UNDEFINED)
+#define DUK_HTHREAD_STRING_LC_UNDEFINED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_UNDEFINED)
+#define DUK_HEAP_STRING_STRINGIFY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_STRINGIFY)
+#define DUK_HTHREAD_STRING_STRINGIFY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_STRINGIFY)
+#define DUK_HEAP_STRING_TAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TAN)
+#define DUK_HTHREAD_STRING_TAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TAN)
+#define DUK_HEAP_STRING_SQRT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SQRT)
+#define DUK_HTHREAD_STRING_SQRT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SQRT)
+#define DUK_HEAP_STRING_SIN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SIN)
+#define DUK_HTHREAD_STRING_SIN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SIN)
+#define DUK_HEAP_STRING_ROUND(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ROUND)
+#define DUK_HTHREAD_STRING_ROUND(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ROUND)
+#define DUK_HEAP_STRING_RANDOM(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_RANDOM)
+#define DUK_HTHREAD_STRING_RANDOM(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_RANDOM)
+#define DUK_HEAP_STRING_POW(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_POW)
+#define DUK_HTHREAD_STRING_POW(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_POW)
+#define DUK_HEAP_STRING_MIN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MIN)
+#define DUK_HTHREAD_STRING_MIN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MIN)
+#define DUK_HEAP_STRING_MAX(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MAX)
+#define DUK_HTHREAD_STRING_MAX(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MAX)
+#define DUK_HEAP_STRING_LOG(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LOG)
+#define DUK_HTHREAD_STRING_LOG(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LOG)
+#define DUK_HEAP_STRING_FLOOR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FLOOR)
+#define DUK_HTHREAD_STRING_FLOOR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FLOOR)
+#define DUK_HEAP_STRING_EXP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EXP)
+#define DUK_HTHREAD_STRING_EXP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EXP)
+#define DUK_HEAP_STRING_COS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_COS)
+#define DUK_HTHREAD_STRING_COS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_COS)
+#define DUK_HEAP_STRING_CEIL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CEIL)
+#define DUK_HTHREAD_STRING_CEIL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CEIL)
+#define DUK_HEAP_STRING_ATAN2(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ATAN2)
+#define DUK_HTHREAD_STRING_ATAN2(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ATAN2)
+#define DUK_HEAP_STRING_ATAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ATAN)
+#define DUK_HTHREAD_STRING_ATAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ATAN)
+#define DUK_HEAP_STRING_ASIN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ASIN)
+#define DUK_HTHREAD_STRING_ASIN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ASIN)
+#define DUK_HEAP_STRING_ACOS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ACOS)
+#define DUK_HTHREAD_STRING_ACOS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ACOS)
+#define DUK_HEAP_STRING_ABS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ABS)
+#define DUK_HTHREAD_STRING_ABS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ABS)
+#define DUK_HEAP_STRING_SQRT2(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SQRT2)
+#define DUK_HTHREAD_STRING_SQRT2(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SQRT2)
+#define DUK_HEAP_STRING_SQRT1_2(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SQRT1_2)
+#define DUK_HTHREAD_STRING_SQRT1_2(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SQRT1_2)
+#define DUK_HEAP_STRING_PI(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PI)
+#define DUK_HTHREAD_STRING_PI(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PI)
+#define DUK_HEAP_STRING_LOG10E(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LOG10E)
+#define DUK_HTHREAD_STRING_LOG10E(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LOG10E)
+#define DUK_HEAP_STRING_LOG2E(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LOG2E)
+#define DUK_HTHREAD_STRING_LOG2E(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LOG2E)
+#define DUK_HEAP_STRING_LN2(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LN2)
+#define DUK_HTHREAD_STRING_LN2(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LN2)
+#define DUK_HEAP_STRING_LN10(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LN10)
+#define DUK_HTHREAD_STRING_LN10(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LN10)
+#define DUK_HEAP_STRING_E(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_E)
+#define DUK_HTHREAD_STRING_E(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_E)
+#define DUK_HEAP_STRING_MESSAGE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MESSAGE)
+#define DUK_HTHREAD_STRING_MESSAGE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MESSAGE)
+#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_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_HEAP_STRING_INDEX(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INDEX)
+#define DUK_HTHREAD_STRING_INDEX(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INDEX)
+#define DUK_HEAP_STRING_ESCAPED_EMPTY_REGEXP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ESCAPED_EMPTY_REGEXP)
+#define DUK_HTHREAD_STRING_ESCAPED_EMPTY_REGEXP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ESCAPED_EMPTY_REGEXP)
+#define DUK_HEAP_STRING_LAST_INDEX(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LAST_INDEX)
+#define DUK_HTHREAD_STRING_LAST_INDEX(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LAST_INDEX)
+#define DUK_HEAP_STRING_MULTILINE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MULTILINE)
+#define DUK_HTHREAD_STRING_MULTILINE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MULTILINE)
+#define DUK_HEAP_STRING_IGNORE_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IGNORE_CASE)
+#define DUK_HTHREAD_STRING_IGNORE_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IGNORE_CASE)
+#define DUK_HEAP_STRING_SOURCE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SOURCE)
+#define DUK_HTHREAD_STRING_SOURCE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SOURCE)
+#define DUK_HEAP_STRING_TEST(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TEST)
+#define DUK_HTHREAD_STRING_TEST(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TEST)
+#define DUK_HEAP_STRING_EXEC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EXEC)
+#define DUK_HTHREAD_STRING_EXEC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EXEC)
+#define DUK_HEAP_STRING_TO_GMT_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_GMT_STRING)
+#define DUK_HTHREAD_STRING_TO_GMT_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_GMT_STRING)
+#define DUK_HEAP_STRING_SET_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_YEAR)
+#define DUK_HTHREAD_STRING_SET_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_YEAR)
+#define DUK_HEAP_STRING_GET_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_YEAR)
+#define DUK_HTHREAD_STRING_GET_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_YEAR)
+#define DUK_HEAP_STRING_TO_JSON(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_JSON)
+#define DUK_HTHREAD_STRING_TO_JSON(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_JSON)
+#define DUK_HEAP_STRING_TO_ISO_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_ISO_STRING)
+#define DUK_HTHREAD_STRING_TO_ISO_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_ISO_STRING)
+#define DUK_HEAP_STRING_TO_UTC_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_UTC_STRING)
+#define DUK_HTHREAD_STRING_TO_UTC_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_UTC_STRING)
+#define DUK_HEAP_STRING_SET_UTC_FULL_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_FULL_YEAR)
+#define DUK_HTHREAD_STRING_SET_UTC_FULL_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_FULL_YEAR)
+#define DUK_HEAP_STRING_SET_FULL_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_FULL_YEAR)
+#define DUK_HTHREAD_STRING_SET_FULL_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_FULL_YEAR)
+#define DUK_HEAP_STRING_SET_UTC_MONTH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_MONTH)
+#define DUK_HTHREAD_STRING_SET_UTC_MONTH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_MONTH)
+#define DUK_HEAP_STRING_SET_MONTH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_MONTH)
+#define DUK_HTHREAD_STRING_SET_MONTH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_MONTH)
+#define DUK_HEAP_STRING_SET_UTC_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_DATE)
+#define DUK_HTHREAD_STRING_SET_UTC_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_DATE)
+#define DUK_HEAP_STRING_SET_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_DATE)
+#define DUK_HTHREAD_STRING_SET_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_DATE)
+#define DUK_HEAP_STRING_SET_UTC_HOURS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_HOURS)
+#define DUK_HTHREAD_STRING_SET_UTC_HOURS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_HOURS)
+#define DUK_HEAP_STRING_SET_HOURS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_HOURS)
+#define DUK_HTHREAD_STRING_SET_HOURS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_HOURS)
+#define DUK_HEAP_STRING_SET_UTC_MINUTES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_MINUTES)
+#define DUK_HTHREAD_STRING_SET_UTC_MINUTES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_MINUTES)
+#define DUK_HEAP_STRING_SET_MINUTES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_MINUTES)
+#define DUK_HTHREAD_STRING_SET_MINUTES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_MINUTES)
+#define DUK_HEAP_STRING_SET_UTC_SECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_SECONDS)
+#define DUK_HTHREAD_STRING_SET_UTC_SECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_SECONDS)
+#define DUK_HEAP_STRING_SET_SECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_SECONDS)
+#define DUK_HTHREAD_STRING_SET_SECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_SECONDS)
+#define DUK_HEAP_STRING_SET_UTC_MILLISECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_MILLISECONDS)
+#define DUK_HTHREAD_STRING_SET_UTC_MILLISECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_MILLISECONDS)
+#define DUK_HEAP_STRING_SET_MILLISECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_MILLISECONDS)
+#define DUK_HTHREAD_STRING_SET_MILLISECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_MILLISECONDS)
+#define DUK_HEAP_STRING_SET_TIME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_TIME)
+#define DUK_HTHREAD_STRING_SET_TIME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_TIME)
+#define DUK_HEAP_STRING_GET_TIMEZONE_OFFSET(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_TIMEZONE_OFFSET)
+#define DUK_HTHREAD_STRING_GET_TIMEZONE_OFFSET(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_TIMEZONE_OFFSET)
+#define DUK_HEAP_STRING_GET_UTC_MILLISECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_MILLISECONDS)
+#define DUK_HTHREAD_STRING_GET_UTC_MILLISECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_MILLISECONDS)
+#define DUK_HEAP_STRING_GET_MILLISECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_MILLISECONDS)
+#define DUK_HTHREAD_STRING_GET_MILLISECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_MILLISECONDS)
+#define DUK_HEAP_STRING_GET_UTC_SECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_SECONDS)
+#define DUK_HTHREAD_STRING_GET_UTC_SECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_SECONDS)
+#define DUK_HEAP_STRING_GET_SECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_SECONDS)
+#define DUK_HTHREAD_STRING_GET_SECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_SECONDS)
+#define DUK_HEAP_STRING_GET_UTC_MINUTES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_MINUTES)
+#define DUK_HTHREAD_STRING_GET_UTC_MINUTES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_MINUTES)
+#define DUK_HEAP_STRING_GET_MINUTES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_MINUTES)
+#define DUK_HTHREAD_STRING_GET_MINUTES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_MINUTES)
+#define DUK_HEAP_STRING_GET_UTC_HOURS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_HOURS)
+#define DUK_HTHREAD_STRING_GET_UTC_HOURS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_HOURS)
+#define DUK_HEAP_STRING_GET_HOURS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_HOURS)
+#define DUK_HTHREAD_STRING_GET_HOURS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_HOURS)
+#define DUK_HEAP_STRING_GET_UTC_DAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_DAY)
+#define DUK_HTHREAD_STRING_GET_UTC_DAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_DAY)
+#define DUK_HEAP_STRING_GET_DAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_DAY)
+#define DUK_HTHREAD_STRING_GET_DAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_DAY)
+#define DUK_HEAP_STRING_GET_UTC_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_DATE)
+#define DUK_HTHREAD_STRING_GET_UTC_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_DATE)
+#define DUK_HEAP_STRING_GET_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_DATE)
+#define DUK_HTHREAD_STRING_GET_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_DATE)
+#define DUK_HEAP_STRING_GET_UTC_MONTH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_MONTH)
+#define DUK_HTHREAD_STRING_GET_UTC_MONTH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_MONTH)
+#define DUK_HEAP_STRING_GET_MONTH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_MONTH)
+#define DUK_HTHREAD_STRING_GET_MONTH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_MONTH)
+#define DUK_HEAP_STRING_GET_UTC_FULL_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_FULL_YEAR)
+#define DUK_HTHREAD_STRING_GET_UTC_FULL_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_FULL_YEAR)
+#define DUK_HEAP_STRING_GET_FULL_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_FULL_YEAR)
+#define DUK_HTHREAD_STRING_GET_FULL_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_FULL_YEAR)
+#define DUK_HEAP_STRING_GET_TIME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_TIME)
+#define DUK_HTHREAD_STRING_GET_TIME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_TIME)
+#define DUK_HEAP_STRING_TO_LOCALE_TIME_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOCALE_TIME_STRING)
+#define DUK_HTHREAD_STRING_TO_LOCALE_TIME_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOCALE_TIME_STRING)
+#define DUK_HEAP_STRING_TO_LOCALE_DATE_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOCALE_DATE_STRING)
+#define DUK_HTHREAD_STRING_TO_LOCALE_DATE_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOCALE_DATE_STRING)
+#define DUK_HEAP_STRING_TO_TIME_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_TIME_STRING)
+#define DUK_HTHREAD_STRING_TO_TIME_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_TIME_STRING)
+#define DUK_HEAP_STRING_TO_DATE_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_DATE_STRING)
+#define DUK_HTHREAD_STRING_TO_DATE_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_DATE_STRING)
+#define DUK_HEAP_STRING_NOW(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NOW)
+#define DUK_HTHREAD_STRING_NOW(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NOW)
+#define DUK_HEAP_STRING_UTC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UTC)
+#define DUK_HTHREAD_STRING_UTC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UTC)
+#define DUK_HEAP_STRING_PARSE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PARSE)
+#define DUK_HTHREAD_STRING_PARSE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PARSE)
+#define DUK_HEAP_STRING_TO_PRECISION(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_PRECISION)
+#define DUK_HTHREAD_STRING_TO_PRECISION(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_PRECISION)
+#define DUK_HEAP_STRING_TO_EXPONENTIAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_EXPONENTIAL)
+#define DUK_HTHREAD_STRING_TO_EXPONENTIAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_EXPONENTIAL)
+#define DUK_HEAP_STRING_TO_FIXED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_FIXED)
+#define DUK_HTHREAD_STRING_TO_FIXED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_FIXED)
+#define DUK_HEAP_STRING_POSITIVE_INFINITY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_POSITIVE_INFINITY)
+#define DUK_HTHREAD_STRING_POSITIVE_INFINITY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_POSITIVE_INFINITY)
+#define DUK_HEAP_STRING_NEGATIVE_INFINITY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NEGATIVE_INFINITY)
+#define DUK_HTHREAD_STRING_NEGATIVE_INFINITY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NEGATIVE_INFINITY)
+#define DUK_HEAP_STRING_NAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NAN)
+#define DUK_HTHREAD_STRING_NAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NAN)
+#define DUK_HEAP_STRING_MIN_VALUE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MIN_VALUE)
+#define DUK_HTHREAD_STRING_MIN_VALUE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MIN_VALUE)
+#define DUK_HEAP_STRING_MAX_VALUE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MAX_VALUE)
+#define DUK_HTHREAD_STRING_MAX_VALUE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MAX_VALUE)
+#define DUK_HEAP_STRING_SUBSTR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SUBSTR)
+#define DUK_HTHREAD_STRING_SUBSTR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SUBSTR)
+#define DUK_HEAP_STRING_TRIM(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TRIM)
+#define DUK_HTHREAD_STRING_TRIM(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TRIM)
+#define DUK_HEAP_STRING_TO_LOCALE_UPPER_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOCALE_UPPER_CASE)
+#define DUK_HTHREAD_STRING_TO_LOCALE_UPPER_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOCALE_UPPER_CASE)
+#define DUK_HEAP_STRING_TO_UPPER_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_UPPER_CASE)
+#define DUK_HTHREAD_STRING_TO_UPPER_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_UPPER_CASE)
+#define DUK_HEAP_STRING_TO_LOCALE_LOWER_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOCALE_LOWER_CASE)
+#define DUK_HTHREAD_STRING_TO_LOCALE_LOWER_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOCALE_LOWER_CASE)
+#define DUK_HEAP_STRING_TO_LOWER_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOWER_CASE)
+#define DUK_HTHREAD_STRING_TO_LOWER_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOWER_CASE)
+#define DUK_HEAP_STRING_SUBSTRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SUBSTRING)
+#define DUK_HTHREAD_STRING_SUBSTRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SUBSTRING)
+#define DUK_HEAP_STRING_SPLIT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SPLIT)
+#define DUK_HTHREAD_STRING_SPLIT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SPLIT)
+#define DUK_HEAP_STRING_SEARCH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SEARCH)
+#define DUK_HTHREAD_STRING_SEARCH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SEARCH)
+#define DUK_HEAP_STRING_REPLACE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REPLACE)
+#define DUK_HTHREAD_STRING_REPLACE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REPLACE)
+#define DUK_HEAP_STRING_MATCH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MATCH)
+#define DUK_HTHREAD_STRING_MATCH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MATCH)
+#define DUK_HEAP_STRING_LOCALE_COMPARE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LOCALE_COMPARE)
+#define DUK_HTHREAD_STRING_LOCALE_COMPARE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LOCALE_COMPARE)
+#define DUK_HEAP_STRING_CHAR_CODE_AT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CHAR_CODE_AT)
+#define DUK_HTHREAD_STRING_CHAR_CODE_AT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CHAR_CODE_AT)
+#define DUK_HEAP_STRING_CHAR_AT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CHAR_AT)
+#define DUK_HTHREAD_STRING_CHAR_AT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CHAR_AT)
+#define DUK_HEAP_STRING_FROM_CHAR_CODE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FROM_CHAR_CODE)
+#define DUK_HTHREAD_STRING_FROM_CHAR_CODE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FROM_CHAR_CODE)
+#define DUK_HEAP_STRING_REDUCE_RIGHT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REDUCE_RIGHT)
+#define DUK_HTHREAD_STRING_REDUCE_RIGHT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REDUCE_RIGHT)
+#define DUK_HEAP_STRING_REDUCE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REDUCE)
+#define DUK_HTHREAD_STRING_REDUCE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REDUCE)
+#define DUK_HEAP_STRING_FILTER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FILTER)
+#define DUK_HTHREAD_STRING_FILTER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FILTER)
+#define DUK_HEAP_STRING_MAP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MAP)
+#define DUK_HTHREAD_STRING_MAP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MAP)
+#define DUK_HEAP_STRING_FOR_EACH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FOR_EACH)
+#define DUK_HTHREAD_STRING_FOR_EACH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FOR_EACH)
+#define DUK_HEAP_STRING_SOME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SOME)
+#define DUK_HTHREAD_STRING_SOME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SOME)
+#define DUK_HEAP_STRING_EVERY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EVERY)
+#define DUK_HTHREAD_STRING_EVERY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EVERY)
+#define DUK_HEAP_STRING_LAST_INDEX_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LAST_INDEX_OF)
+#define DUK_HTHREAD_STRING_LAST_INDEX_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LAST_INDEX_OF)
+#define DUK_HEAP_STRING_INDEX_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INDEX_OF)
+#define DUK_HTHREAD_STRING_INDEX_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INDEX_OF)
+#define DUK_HEAP_STRING_UNSHIFT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UNSHIFT)
+#define DUK_HTHREAD_STRING_UNSHIFT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UNSHIFT)
+#define DUK_HEAP_STRING_SPLICE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SPLICE)
+#define DUK_HTHREAD_STRING_SPLICE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SPLICE)
+#define DUK_HEAP_STRING_SORT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SORT)
+#define DUK_HTHREAD_STRING_SORT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SORT)
+#define DUK_HEAP_STRING_SLICE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SLICE)
+#define DUK_HTHREAD_STRING_SLICE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SLICE)
+#define DUK_HEAP_STRING_SHIFT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SHIFT)
+#define DUK_HTHREAD_STRING_SHIFT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SHIFT)
+#define DUK_HEAP_STRING_REVERSE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REVERSE)
+#define DUK_HTHREAD_STRING_REVERSE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REVERSE)
+#define DUK_HEAP_STRING_PUSH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PUSH)
+#define DUK_HTHREAD_STRING_PUSH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PUSH)
+#define DUK_HEAP_STRING_POP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_POP)
+#define DUK_HTHREAD_STRING_POP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_POP)
+#define DUK_HEAP_STRING_JOIN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JOIN)
+#define DUK_HTHREAD_STRING_JOIN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JOIN)
+#define DUK_HEAP_STRING_CONCAT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CONCAT)
+#define DUK_HTHREAD_STRING_CONCAT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CONCAT)
+#define DUK_HEAP_STRING_IS_ARRAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_ARRAY)
+#define DUK_HTHREAD_STRING_IS_ARRAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_ARRAY)
+#define DUK_HEAP_STRING_LC_ARGUMENTS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_ARGUMENTS)
+#define DUK_HTHREAD_STRING_LC_ARGUMENTS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_ARGUMENTS)
+#define DUK_HEAP_STRING_CALLER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CALLER)
+#define DUK_HTHREAD_STRING_CALLER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CALLER)
+#define DUK_HEAP_STRING_BIND(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_BIND)
+#define DUK_HTHREAD_STRING_BIND(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_BIND)
+#define DUK_HEAP_STRING_CALL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CALL)
+#define DUK_HTHREAD_STRING_CALL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CALL)
+#define DUK_HEAP_STRING_APPLY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_APPLY)
+#define DUK_HTHREAD_STRING_APPLY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_APPLY)
+#define DUK_HEAP_STRING_PROPERTY_IS_ENUMERABLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PROPERTY_IS_ENUMERABLE)
+#define DUK_HTHREAD_STRING_PROPERTY_IS_ENUMERABLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PROPERTY_IS_ENUMERABLE)
+#define DUK_HEAP_STRING_IS_PROTOTYPE_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_PROTOTYPE_OF)
+#define DUK_HTHREAD_STRING_IS_PROTOTYPE_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_PROTOTYPE_OF)
+#define DUK_HEAP_STRING_HAS_OWN_PROPERTY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_HAS_OWN_PROPERTY)
+#define DUK_HTHREAD_STRING_HAS_OWN_PROPERTY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_HAS_OWN_PROPERTY)
+#define DUK_HEAP_STRING_VALUE_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_VALUE_OF)
+#define DUK_HTHREAD_STRING_VALUE_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_VALUE_OF)
+#define DUK_HEAP_STRING_TO_LOCALE_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOCALE_STRING)
+#define DUK_HTHREAD_STRING_TO_LOCALE_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOCALE_STRING)
+#define DUK_HEAP_STRING_TO_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_STRING)
+#define DUK_HTHREAD_STRING_TO_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_STRING)
+#define DUK_HEAP_STRING_CONSTRUCTOR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CONSTRUCTOR)
+#define DUK_HTHREAD_STRING_CONSTRUCTOR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CONSTRUCTOR)
+#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_HEAP_STRING_GET(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET)
+#define DUK_HTHREAD_STRING_GET(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET)
+#define DUK_HEAP_STRING_ENUMERABLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENUMERABLE)
+#define DUK_HTHREAD_STRING_ENUMERABLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENUMERABLE)
+#define DUK_HEAP_STRING_CONFIGURABLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CONFIGURABLE)
+#define DUK_HTHREAD_STRING_CONFIGURABLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CONFIGURABLE)
+#define DUK_HEAP_STRING_WRITABLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_WRITABLE)
+#define DUK_HTHREAD_STRING_WRITABLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_WRITABLE)
+#define DUK_HEAP_STRING_VALUE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_VALUE)
+#define DUK_HTHREAD_STRING_VALUE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_VALUE)
+#define DUK_HEAP_STRING_KEYS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_KEYS)
+#define DUK_HTHREAD_STRING_KEYS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_KEYS)
+#define DUK_HEAP_STRING_IS_EXTENSIBLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_EXTENSIBLE)
+#define DUK_HTHREAD_STRING_IS_EXTENSIBLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_EXTENSIBLE)
+#define DUK_HEAP_STRING_IS_FROZEN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_FROZEN)
+#define DUK_HTHREAD_STRING_IS_FROZEN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_FROZEN)
+#define DUK_HEAP_STRING_IS_SEALED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_SEALED)
+#define DUK_HTHREAD_STRING_IS_SEALED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_SEALED)
+#define DUK_HEAP_STRING_PREVENT_EXTENSIONS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PREVENT_EXTENSIONS)
+#define DUK_HTHREAD_STRING_PREVENT_EXTENSIONS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PREVENT_EXTENSIONS)
+#define DUK_HEAP_STRING_FREEZE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FREEZE)
+#define DUK_HTHREAD_STRING_FREEZE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FREEZE)
+#define DUK_HEAP_STRING_SEAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SEAL)
+#define DUK_HTHREAD_STRING_SEAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SEAL)
+#define DUK_HEAP_STRING_DEFINE_PROPERTIES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEFINE_PROPERTIES)
+#define DUK_HTHREAD_STRING_DEFINE_PROPERTIES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEFINE_PROPERTIES)
+#define DUK_HEAP_STRING_DEFINE_PROPERTY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEFINE_PROPERTY)
+#define DUK_HTHREAD_STRING_DEFINE_PROPERTY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEFINE_PROPERTY)
+#define DUK_HEAP_STRING_CREATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CREATE)
+#define DUK_HTHREAD_STRING_CREATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CREATE)
+#define DUK_HEAP_STRING_GET_OWN_PROPERTY_NAMES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_OWN_PROPERTY_NAMES)
+#define DUK_HTHREAD_STRING_GET_OWN_PROPERTY_NAMES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_OWN_PROPERTY_NAMES)
+#define DUK_HEAP_STRING_GET_OWN_PROPERTY_DESCRIPTOR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_OWN_PROPERTY_DESCRIPTOR)
+#define DUK_HTHREAD_STRING_GET_OWN_PROPERTY_DESCRIPTOR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_OWN_PROPERTY_DESCRIPTOR)
+#define DUK_HEAP_STRING_GET_PROTOTYPE_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_PROTOTYPE_OF)
+#define DUK_HTHREAD_STRING_GET_PROTOTYPE_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_PROTOTYPE_OF)
+#define DUK_HEAP_STRING_PROTOTYPE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PROTOTYPE)
+#define DUK_HTHREAD_STRING_PROTOTYPE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PROTOTYPE)
+#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_HEAP_STRING_ALERT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ALERT)
+#define DUK_HTHREAD_STRING_ALERT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ALERT)
+#define DUK_HEAP_STRING_PRINT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PRINT)
+#define DUK_HTHREAD_STRING_PRINT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PRINT)
+#define DUK_HEAP_STRING_UNESCAPE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UNESCAPE)
+#define DUK_HTHREAD_STRING_UNESCAPE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UNESCAPE)
+#define DUK_HEAP_STRING_ESCAPE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ESCAPE)
+#define DUK_HTHREAD_STRING_ESCAPE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ESCAPE)
+#define DUK_HEAP_STRING_ENCODE_URI_COMPONENT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENCODE_URI_COMPONENT)
+#define DUK_HTHREAD_STRING_ENCODE_URI_COMPONENT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENCODE_URI_COMPONENT)
+#define DUK_HEAP_STRING_ENCODE_URI(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENCODE_URI)
+#define DUK_HTHREAD_STRING_ENCODE_URI(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENCODE_URI)
+#define DUK_HEAP_STRING_DECODE_URI_COMPONENT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DECODE_URI_COMPONENT)
+#define DUK_HTHREAD_STRING_DECODE_URI_COMPONENT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DECODE_URI_COMPONENT)
+#define DUK_HEAP_STRING_DECODE_URI(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DECODE_URI)
+#define DUK_HTHREAD_STRING_DECODE_URI(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DECODE_URI)
+#define DUK_HEAP_STRING_IS_FINITE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_FINITE)
+#define DUK_HTHREAD_STRING_IS_FINITE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_FINITE)
+#define DUK_HEAP_STRING_IS_NAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_NAN)
+#define DUK_HTHREAD_STRING_IS_NAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_NAN)
+#define DUK_HEAP_STRING_PARSE_FLOAT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PARSE_FLOAT)
+#define DUK_HTHREAD_STRING_PARSE_FLOAT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PARSE_FLOAT)
+#define DUK_HEAP_STRING_PARSE_INT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PARSE_INT)
+#define DUK_HTHREAD_STRING_PARSE_INT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PARSE_INT)
+#define DUK_HEAP_STRING_EVAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EVAL)
+#define DUK_HTHREAD_STRING_EVAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EVAL)
+#define DUK_HEAP_STRING_URI_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_URI_ERROR)
+#define DUK_HTHREAD_STRING_URI_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_URI_ERROR)
+#define DUK_HEAP_STRING_TYPE_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TYPE_ERROR)
+#define DUK_HTHREAD_STRING_TYPE_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TYPE_ERROR)
+#define DUK_HEAP_STRING_SYNTAX_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SYNTAX_ERROR)
+#define DUK_HTHREAD_STRING_SYNTAX_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SYNTAX_ERROR)
+#define DUK_HEAP_STRING_REFERENCE_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REFERENCE_ERROR)
+#define DUK_HTHREAD_STRING_REFERENCE_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REFERENCE_ERROR)
+#define DUK_HEAP_STRING_RANGE_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_RANGE_ERROR)
+#define DUK_HTHREAD_STRING_RANGE_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_RANGE_ERROR)
+#define DUK_HEAP_STRING_EVAL_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EVAL_ERROR)
+#define DUK_HTHREAD_STRING_EVAL_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EVAL_ERROR)
+#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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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 336
+
+#define DUK_STRIDX_START_RESERVED 291
+#define DUK_STRIDX_START_STRICT_RESERVED 327
+#define DUK_STRIDX_END_RESERVED 336 /* exclusive endpoint */
+
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL const duk_c_function duk_bi_native_functions[128];
+DUK_INTERNAL_DECL const duk_uint8_t duk_builtins_data[1341];
+#ifdef DUK_USE_BUILTIN_INITJS
+DUK_INTERNAL_DECL const duk_uint8_t duk_initjs_data[187];
+#endif /* DUK_USE_BUILTIN_INITJS */
+#endif /* !DUK_SINGLE_FILE */
+
+#define DUK_BUILTINS_DATA_LENGTH 1341
+#ifdef DUK_USE_BUILTIN_INITJS
+#define DUK_BUILTIN_INITJS_DATA_LENGTH 187
+#endif /* DUK_USE_BUILTIN_INITJS */
+
+#define DUK_BIDX_GLOBAL 0
+#define DUK_BIDX_GLOBAL_ENV 1
+#define DUK_BIDX_OBJECT_CONSTRUCTOR 2
+#define DUK_BIDX_OBJECT_PROTOTYPE 3
+#define DUK_BIDX_FUNCTION_CONSTRUCTOR 4
+#define DUK_BIDX_FUNCTION_PROTOTYPE 5
+#define DUK_BIDX_ARRAY_CONSTRUCTOR 6
+#define DUK_BIDX_ARRAY_PROTOTYPE 7
+#define DUK_BIDX_STRING_CONSTRUCTOR 8
+#define DUK_BIDX_STRING_PROTOTYPE 9
+#define DUK_BIDX_BOOLEAN_CONSTRUCTOR 10
+#define DUK_BIDX_BOOLEAN_PROTOTYPE 11
+#define DUK_BIDX_NUMBER_CONSTRUCTOR 12
+#define DUK_BIDX_NUMBER_PROTOTYPE 13
+#define DUK_BIDX_DATE_CONSTRUCTOR 14
+#define DUK_BIDX_DATE_PROTOTYPE 15
+#define DUK_BIDX_REGEXP_CONSTRUCTOR 16
+#define DUK_BIDX_REGEXP_PROTOTYPE 17
+#define DUK_BIDX_ERROR_CONSTRUCTOR 18
+#define DUK_BIDX_ERROR_PROTOTYPE 19
+#define DUK_BIDX_EVAL_ERROR_CONSTRUCTOR 20
+#define DUK_BIDX_EVAL_ERROR_PROTOTYPE 21
+#define DUK_BIDX_RANGE_ERROR_CONSTRUCTOR 22
+#define DUK_BIDX_RANGE_ERROR_PROTOTYPE 23
+#define DUK_BIDX_REFERENCE_ERROR_CONSTRUCTOR 24
+#define DUK_BIDX_REFERENCE_ERROR_PROTOTYPE 25
+#define DUK_BIDX_SYNTAX_ERROR_CONSTRUCTOR 26
+#define DUK_BIDX_SYNTAX_ERROR_PROTOTYPE 27
+#define DUK_BIDX_TYPE_ERROR_CONSTRUCTOR 28
+#define DUK_BIDX_TYPE_ERROR_PROTOTYPE 29
+#define DUK_BIDX_URI_ERROR_CONSTRUCTOR 30
+#define DUK_BIDX_URI_ERROR_PROTOTYPE 31
+#define DUK_BIDX_MATH 32
+#define DUK_BIDX_JSON 33
+#define DUK_BIDX_TYPE_ERROR_THROWER 34
+#define DUK_BIDX_PROXY_CONSTRUCTOR 35
+#define DUK_BIDX_DUKTAPE 36
+#define DUK_BIDX_THREAD_CONSTRUCTOR 37
+#define DUK_BIDX_THREAD_PROTOTYPE 38
+#define DUK_BIDX_BUFFER_CONSTRUCTOR 39
+#define DUK_BIDX_BUFFER_PROTOTYPE 40
+#define DUK_BIDX_POINTER_CONSTRUCTOR 41
+#define DUK_BIDX_POINTER_PROTOTYPE 42
+#define DUK_BIDX_LOGGER_CONSTRUCTOR 43
+#define DUK_BIDX_LOGGER_PROTOTYPE 44
+#define DUK_BIDX_DOUBLE_ERROR 45
+
+#define DUK_NUM_BUILTINS 46
+
+#elif defined(DUK_USE_DOUBLE_BE)
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL const duk_uint8_t duk_strings_data[1943];
+#endif /* !DUK_SINGLE_FILE */
+
+#define DUK_STRDATA_DATA_LENGTH 1943
+#define DUK_STRDATA_MAX_STRLEN 24
+
+#define DUK_STRIDX_UC_LOGGER 0 /* 'Logger' */
+#define DUK_STRIDX_UC_THREAD 1 /* 'Thread' */
+#define DUK_STRIDX_UC_POINTER 2 /* 'Pointer' */
+#define DUK_STRIDX_UC_BUFFER 3 /* 'Buffer' */
+#define DUK_STRIDX_DEC_ENV 4 /* 'DecEnv' */
+#define DUK_STRIDX_OBJ_ENV 5 /* 'ObjEnv' */
+#define DUK_STRIDX_EMPTY_STRING 6 /* '' */
+#define DUK_STRIDX_GLOBAL 7 /* 'global' */
+#define DUK_STRIDX_UC_ARGUMENTS 8 /* 'Arguments' */
+#define DUK_STRIDX_JSON 9 /* 'JSON' */
+#define DUK_STRIDX_MATH 10 /* 'Math' */
+#define DUK_STRIDX_UC_ERROR 11 /* 'Error' */
+#define DUK_STRIDX_REG_EXP 12 /* 'RegExp' */
+#define DUK_STRIDX_DATE 13 /* 'Date' */
+#define DUK_STRIDX_UC_NUMBER 14 /* 'Number' */
+#define DUK_STRIDX_UC_BOOLEAN 15 /* 'Boolean' */
+#define DUK_STRIDX_UC_STRING 16 /* 'String' */
+#define DUK_STRIDX_ARRAY 17 /* 'Array' */
+#define DUK_STRIDX_UC_FUNCTION 18 /* 'Function' */
+#define DUK_STRIDX_UC_OBJECT 19 /* 'Object' */
+#define DUK_STRIDX_UC_NULL 20 /* 'Null' */
+#define DUK_STRIDX_UC_UNDEFINED 21 /* 'Undefined' */
+#define DUK_STRIDX_JSON_EXT_FUNCTION2 22 /* '{_func:true}' */
+#define DUK_STRIDX_JSON_EXT_FUNCTION1 23 /* '{"_func":true}' */
+#define DUK_STRIDX_JSON_EXT_NEGINF 24 /* '{"_ninf":true}' */
+#define DUK_STRIDX_JSON_EXT_POSINF 25 /* '{"_inf":true}' */
+#define DUK_STRIDX_JSON_EXT_NAN 26 /* '{"_nan":true}' */
+#define DUK_STRIDX_JSON_EXT_UNDEFINED 27 /* '{"_undef":true}' */
+#define DUK_STRIDX_TO_LOG_STRING 28 /* 'toLogString' */
+#define DUK_STRIDX_CLOG 29 /* 'clog' */
+#define DUK_STRIDX_LC_L 30 /* 'l' */
+#define DUK_STRIDX_LC_N 31 /* 'n' */
+#define DUK_STRIDX_LC_FATAL 32 /* 'fatal' */
+#define DUK_STRIDX_LC_ERROR 33 /* 'error' */
+#define DUK_STRIDX_LC_WARN 34 /* 'warn' */
+#define DUK_STRIDX_LC_DEBUG 35 /* 'debug' */
+#define DUK_STRIDX_LC_TRACE 36 /* 'trace' */
+#define DUK_STRIDX_RAW 37 /* 'raw' */
+#define DUK_STRIDX_FMT 38 /* 'fmt' */
+#define DUK_STRIDX_CURRENT 39 /* 'current' */
+#define DUK_STRIDX_RESUME 40 /* 'resume' */
+#define DUK_STRIDX_COMPACT 41 /* 'compact' */
+#define DUK_STRIDX_JC 42 /* 'jc' */
+#define DUK_STRIDX_JX 43 /* 'jx' */
+#define DUK_STRIDX_BASE64 44 /* 'base64' */
+#define DUK_STRIDX_HEX 45 /* 'hex' */
+#define DUK_STRIDX_DEC 46 /* 'dec' */
+#define DUK_STRIDX_ENC 47 /* 'enc' */
+#define DUK_STRIDX_FIN 48 /* 'fin' */
+#define DUK_STRIDX_GC 49 /* 'gc' */
+#define DUK_STRIDX_ACT 50 /* 'act' */
+#define DUK_STRIDX_LC_INFO 51 /* 'info' */
+#define DUK_STRIDX_VERSION 52 /* 'version' */
+#define DUK_STRIDX_ENV 53 /* 'env' */
+#define DUK_STRIDX_MOD_LOADED 54 /* 'modLoaded' */
+#define DUK_STRIDX_MOD_SEARCH 55 /* 'modSearch' */
+#define DUK_STRIDX_ERR_THROW 56 /* 'errThrow' */
+#define DUK_STRIDX_ERR_CREATE 57 /* 'errCreate' */
+#define DUK_STRIDX_COMPILE 58 /* 'compile' */
+#define DUK_STRIDX_INT_REGBASE 59 /* '\x00Regbase' */
+#define DUK_STRIDX_INT_THREAD 60 /* '\x00Thread' */
+#define DUK_STRIDX_INT_HANDLER 61 /* '\x00Handler' */
+#define DUK_STRIDX_INT_FINALIZER 62 /* '\x00Finalizer' */
+#define DUK_STRIDX_INT_CALLEE 63 /* '\x00Callee' */
+#define DUK_STRIDX_INT_MAP 64 /* '\x00Map' */
+#define DUK_STRIDX_INT_ARGS 65 /* '\x00Args' */
+#define DUK_STRIDX_INT_THIS 66 /* '\x00This' */
+#define DUK_STRIDX_INT_PC2LINE 67 /* '\x00Pc2line' */
+#define DUK_STRIDX_INT_SOURCE 68 /* '\x00Source' */
+#define DUK_STRIDX_INT_VARENV 69 /* '\x00Varenv' */
+#define DUK_STRIDX_INT_LEXENV 70 /* '\x00Lexenv' */
+#define DUK_STRIDX_INT_VARMAP 71 /* '\x00Varmap' */
+#define DUK_STRIDX_INT_FORMALS 72 /* '\x00Formals' */
+#define DUK_STRIDX_INT_BYTECODE 73 /* '\x00Bytecode' */
+#define DUK_STRIDX_INT_NEXT 74 /* '\x00Next' */
+#define DUK_STRIDX_INT_TARGET 75 /* '\x00Target' */
+#define DUK_STRIDX_INT_VALUE 76 /* '\x00Value' */
+#define DUK_STRIDX_LC_POINTER 77 /* 'pointer' */
+#define DUK_STRIDX_LC_BUFFER 78 /* 'buffer' */
+#define DUK_STRIDX_INT_TRACEDATA 79 /* '\x00Tracedata' */
+#define DUK_STRIDX_LINE_NUMBER 80 /* 'lineNumber' */
+#define DUK_STRIDX_FILE_NAME 81 /* 'fileName' */
+#define DUK_STRIDX_PC 82 /* 'pc' */
+#define DUK_STRIDX_STACK 83 /* 'stack' */
+#define DUK_STRIDX_THROW_TYPE_ERROR 84 /* 'ThrowTypeError' */
+#define DUK_STRIDX_DUKTAPE 85 /* 'Duktape' */
+#define DUK_STRIDX_ID 86 /* 'id' */
+#define DUK_STRIDX_REQUIRE 87 /* 'require' */
+#define DUK_STRIDX___PROTO__ 88 /* '__proto__' */
+#define DUK_STRIDX_SET_PROTOTYPE_OF 89 /* 'setPrototypeOf' */
+#define DUK_STRIDX_OWN_KEYS 90 /* 'ownKeys' */
+#define DUK_STRIDX_ENUMERATE 91 /* 'enumerate' */
+#define DUK_STRIDX_DELETE_PROPERTY 92 /* 'deleteProperty' */
+#define DUK_STRIDX_HAS 93 /* 'has' */
+#define DUK_STRIDX_PROXY 94 /* 'Proxy' */
+#define DUK_STRIDX_CALLEE 95 /* 'callee' */
+#define DUK_STRIDX_INVALID_DATE 96 /* 'Invalid Date' */
+#define DUK_STRIDX_BRACKETED_ELLIPSIS 97 /* '[...]' */
+#define DUK_STRIDX_NEWLINE_TAB 98 /* '\n\t' */
+#define DUK_STRIDX_SPACE 99 /* ' ' */
+#define DUK_STRIDX_COMMA 100 /* ',' */
+#define DUK_STRIDX_MINUS_ZERO 101 /* '-0' */
+#define DUK_STRIDX_PLUS_ZERO 102 /* '+0' */
+#define DUK_STRIDX_ZERO 103 /* '0' */
+#define DUK_STRIDX_MINUS_INFINITY 104 /* '-Infinity' */
+#define DUK_STRIDX_PLUS_INFINITY 105 /* '+Infinity' */
+#define DUK_STRIDX_INFINITY 106 /* 'Infinity' */
+#define DUK_STRIDX_LC_OBJECT 107 /* 'object' */
+#define DUK_STRIDX_LC_STRING 108 /* 'string' */
+#define DUK_STRIDX_LC_NUMBER 109 /* 'number' */
+#define DUK_STRIDX_LC_BOOLEAN 110 /* 'boolean' */
+#define DUK_STRIDX_LC_UNDEFINED 111 /* 'undefined' */
+#define DUK_STRIDX_STRINGIFY 112 /* 'stringify' */
+#define DUK_STRIDX_TAN 113 /* 'tan' */
+#define DUK_STRIDX_SQRT 114 /* 'sqrt' */
+#define DUK_STRIDX_SIN 115 /* 'sin' */
+#define DUK_STRIDX_ROUND 116 /* 'round' */
+#define DUK_STRIDX_RANDOM 117 /* 'random' */
+#define DUK_STRIDX_POW 118 /* 'pow' */
+#define DUK_STRIDX_MIN 119 /* 'min' */
+#define DUK_STRIDX_MAX 120 /* 'max' */
+#define DUK_STRIDX_LOG 121 /* 'log' */
+#define DUK_STRIDX_FLOOR 122 /* 'floor' */
+#define DUK_STRIDX_EXP 123 /* 'exp' */
+#define DUK_STRIDX_COS 124 /* 'cos' */
+#define DUK_STRIDX_CEIL 125 /* 'ceil' */
+#define DUK_STRIDX_ATAN2 126 /* 'atan2' */
+#define DUK_STRIDX_ATAN 127 /* 'atan' */
+#define DUK_STRIDX_ASIN 128 /* 'asin' */
+#define DUK_STRIDX_ACOS 129 /* 'acos' */
+#define DUK_STRIDX_ABS 130 /* 'abs' */
+#define DUK_STRIDX_SQRT2 131 /* 'SQRT2' */
+#define DUK_STRIDX_SQRT1_2 132 /* 'SQRT1_2' */
+#define DUK_STRIDX_PI 133 /* 'PI' */
+#define DUK_STRIDX_LOG10E 134 /* 'LOG10E' */
+#define DUK_STRIDX_LOG2E 135 /* 'LOG2E' */
+#define DUK_STRIDX_LN2 136 /* 'LN2' */
+#define DUK_STRIDX_LN10 137 /* 'LN10' */
+#define DUK_STRIDX_E 138 /* 'E' */
+#define DUK_STRIDX_MESSAGE 139 /* 'message' */
+#define DUK_STRIDX_NAME 140 /* 'name' */
+#define DUK_STRIDX_INPUT 141 /* 'input' */
+#define DUK_STRIDX_INDEX 142 /* 'index' */
+#define DUK_STRIDX_ESCAPED_EMPTY_REGEXP 143 /* '(?:)' */
+#define DUK_STRIDX_LAST_INDEX 144 /* 'lastIndex' */
+#define DUK_STRIDX_MULTILINE 145 /* 'multiline' */
+#define DUK_STRIDX_IGNORE_CASE 146 /* 'ignoreCase' */
+#define DUK_STRIDX_SOURCE 147 /* 'source' */
+#define DUK_STRIDX_TEST 148 /* 'test' */
+#define DUK_STRIDX_EXEC 149 /* 'exec' */
+#define DUK_STRIDX_TO_GMT_STRING 150 /* 'toGMTString' */
+#define DUK_STRIDX_SET_YEAR 151 /* 'setYear' */
+#define DUK_STRIDX_GET_YEAR 152 /* 'getYear' */
+#define DUK_STRIDX_TO_JSON 153 /* 'toJSON' */
+#define DUK_STRIDX_TO_ISO_STRING 154 /* 'toISOString' */
+#define DUK_STRIDX_TO_UTC_STRING 155 /* 'toUTCString' */
+#define DUK_STRIDX_SET_UTC_FULL_YEAR 156 /* 'setUTCFullYear' */
+#define DUK_STRIDX_SET_FULL_YEAR 157 /* 'setFullYear' */
+#define DUK_STRIDX_SET_UTC_MONTH 158 /* 'setUTCMonth' */
+#define DUK_STRIDX_SET_MONTH 159 /* 'setMonth' */
+#define DUK_STRIDX_SET_UTC_DATE 160 /* 'setUTCDate' */
+#define DUK_STRIDX_SET_DATE 161 /* 'setDate' */
+#define DUK_STRIDX_SET_UTC_HOURS 162 /* 'setUTCHours' */
+#define DUK_STRIDX_SET_HOURS 163 /* 'setHours' */
+#define DUK_STRIDX_SET_UTC_MINUTES 164 /* 'setUTCMinutes' */
+#define DUK_STRIDX_SET_MINUTES 165 /* 'setMinutes' */
+#define DUK_STRIDX_SET_UTC_SECONDS 166 /* 'setUTCSeconds' */
+#define DUK_STRIDX_SET_SECONDS 167 /* 'setSeconds' */
+#define DUK_STRIDX_SET_UTC_MILLISECONDS 168 /* 'setUTCMilliseconds' */
+#define DUK_STRIDX_SET_MILLISECONDS 169 /* 'setMilliseconds' */
+#define DUK_STRIDX_SET_TIME 170 /* 'setTime' */
+#define DUK_STRIDX_GET_TIMEZONE_OFFSET 171 /* 'getTimezoneOffset' */
+#define DUK_STRIDX_GET_UTC_MILLISECONDS 172 /* 'getUTCMilliseconds' */
+#define DUK_STRIDX_GET_MILLISECONDS 173 /* 'getMilliseconds' */
+#define DUK_STRIDX_GET_UTC_SECONDS 174 /* 'getUTCSeconds' */
+#define DUK_STRIDX_GET_SECONDS 175 /* 'getSeconds' */
+#define DUK_STRIDX_GET_UTC_MINUTES 176 /* 'getUTCMinutes' */
+#define DUK_STRIDX_GET_MINUTES 177 /* 'getMinutes' */
+#define DUK_STRIDX_GET_UTC_HOURS 178 /* 'getUTCHours' */
+#define DUK_STRIDX_GET_HOURS 179 /* 'getHours' */
+#define DUK_STRIDX_GET_UTC_DAY 180 /* 'getUTCDay' */
+#define DUK_STRIDX_GET_DAY 181 /* 'getDay' */
+#define DUK_STRIDX_GET_UTC_DATE 182 /* 'getUTCDate' */
+#define DUK_STRIDX_GET_DATE 183 /* 'getDate' */
+#define DUK_STRIDX_GET_UTC_MONTH 184 /* 'getUTCMonth' */
+#define DUK_STRIDX_GET_MONTH 185 /* 'getMonth' */
+#define DUK_STRIDX_GET_UTC_FULL_YEAR 186 /* 'getUTCFullYear' */
+#define DUK_STRIDX_GET_FULL_YEAR 187 /* 'getFullYear' */
+#define DUK_STRIDX_GET_TIME 188 /* 'getTime' */
+#define DUK_STRIDX_TO_LOCALE_TIME_STRING 189 /* 'toLocaleTimeString' */
+#define DUK_STRIDX_TO_LOCALE_DATE_STRING 190 /* 'toLocaleDateString' */
+#define DUK_STRIDX_TO_TIME_STRING 191 /* 'toTimeString' */
+#define DUK_STRIDX_TO_DATE_STRING 192 /* 'toDateString' */
+#define DUK_STRIDX_NOW 193 /* 'now' */
+#define DUK_STRIDX_UTC 194 /* 'UTC' */
+#define DUK_STRIDX_PARSE 195 /* 'parse' */
+#define DUK_STRIDX_TO_PRECISION 196 /* 'toPrecision' */
+#define DUK_STRIDX_TO_EXPONENTIAL 197 /* 'toExponential' */
+#define DUK_STRIDX_TO_FIXED 198 /* 'toFixed' */
+#define DUK_STRIDX_POSITIVE_INFINITY 199 /* 'POSITIVE_INFINITY' */
+#define DUK_STRIDX_NEGATIVE_INFINITY 200 /* 'NEGATIVE_INFINITY' */
+#define DUK_STRIDX_NAN 201 /* 'NaN' */
+#define DUK_STRIDX_MIN_VALUE 202 /* 'MIN_VALUE' */
+#define DUK_STRIDX_MAX_VALUE 203 /* 'MAX_VALUE' */
+#define DUK_STRIDX_SUBSTR 204 /* 'substr' */
+#define DUK_STRIDX_TRIM 205 /* 'trim' */
+#define DUK_STRIDX_TO_LOCALE_UPPER_CASE 206 /* 'toLocaleUpperCase' */
+#define DUK_STRIDX_TO_UPPER_CASE 207 /* 'toUpperCase' */
+#define DUK_STRIDX_TO_LOCALE_LOWER_CASE 208 /* 'toLocaleLowerCase' */
+#define DUK_STRIDX_TO_LOWER_CASE 209 /* 'toLowerCase' */
+#define DUK_STRIDX_SUBSTRING 210 /* 'substring' */
+#define DUK_STRIDX_SPLIT 211 /* 'split' */
+#define DUK_STRIDX_SEARCH 212 /* 'search' */
+#define DUK_STRIDX_REPLACE 213 /* 'replace' */
+#define DUK_STRIDX_MATCH 214 /* 'match' */
+#define DUK_STRIDX_LOCALE_COMPARE 215 /* 'localeCompare' */
+#define DUK_STRIDX_CHAR_CODE_AT 216 /* 'charCodeAt' */
+#define DUK_STRIDX_CHAR_AT 217 /* 'charAt' */
+#define DUK_STRIDX_FROM_CHAR_CODE 218 /* 'fromCharCode' */
+#define DUK_STRIDX_REDUCE_RIGHT 219 /* 'reduceRight' */
+#define DUK_STRIDX_REDUCE 220 /* 'reduce' */
+#define DUK_STRIDX_FILTER 221 /* 'filter' */
+#define DUK_STRIDX_MAP 222 /* 'map' */
+#define DUK_STRIDX_FOR_EACH 223 /* 'forEach' */
+#define DUK_STRIDX_SOME 224 /* 'some' */
+#define DUK_STRIDX_EVERY 225 /* 'every' */
+#define DUK_STRIDX_LAST_INDEX_OF 226 /* 'lastIndexOf' */
+#define DUK_STRIDX_INDEX_OF 227 /* 'indexOf' */
+#define DUK_STRIDX_UNSHIFT 228 /* 'unshift' */
+#define DUK_STRIDX_SPLICE 229 /* 'splice' */
+#define DUK_STRIDX_SORT 230 /* 'sort' */
+#define DUK_STRIDX_SLICE 231 /* 'slice' */
+#define DUK_STRIDX_SHIFT 232 /* 'shift' */
+#define DUK_STRIDX_REVERSE 233 /* 'reverse' */
+#define DUK_STRIDX_PUSH 234 /* 'push' */
+#define DUK_STRIDX_POP 235 /* 'pop' */
+#define DUK_STRIDX_JOIN 236 /* 'join' */
+#define DUK_STRIDX_CONCAT 237 /* 'concat' */
+#define DUK_STRIDX_IS_ARRAY 238 /* 'isArray' */
+#define DUK_STRIDX_LC_ARGUMENTS 239 /* 'arguments' */
+#define DUK_STRIDX_CALLER 240 /* 'caller' */
+#define DUK_STRIDX_BIND 241 /* 'bind' */
+#define DUK_STRIDX_CALL 242 /* 'call' */
+#define DUK_STRIDX_APPLY 243 /* 'apply' */
+#define DUK_STRIDX_PROPERTY_IS_ENUMERABLE 244 /* 'propertyIsEnumerable' */
+#define DUK_STRIDX_IS_PROTOTYPE_OF 245 /* 'isPrototypeOf' */
+#define DUK_STRIDX_HAS_OWN_PROPERTY 246 /* 'hasOwnProperty' */
+#define DUK_STRIDX_VALUE_OF 247 /* 'valueOf' */
+#define DUK_STRIDX_TO_LOCALE_STRING 248 /* 'toLocaleString' */
+#define DUK_STRIDX_TO_STRING 249 /* 'toString' */
+#define DUK_STRIDX_CONSTRUCTOR 250 /* 'constructor' */
+#define DUK_STRIDX_SET 251 /* 'set' */
+#define DUK_STRIDX_GET 252 /* 'get' */
+#define DUK_STRIDX_ENUMERABLE 253 /* 'enumerable' */
+#define DUK_STRIDX_CONFIGURABLE 254 /* 'configurable' */
+#define DUK_STRIDX_WRITABLE 255 /* 'writable' */
+#define DUK_STRIDX_VALUE 256 /* 'value' */
+#define DUK_STRIDX_KEYS 257 /* 'keys' */
+#define DUK_STRIDX_IS_EXTENSIBLE 258 /* 'isExtensible' */
+#define DUK_STRIDX_IS_FROZEN 259 /* 'isFrozen' */
+#define DUK_STRIDX_IS_SEALED 260 /* 'isSealed' */
+#define DUK_STRIDX_PREVENT_EXTENSIONS 261 /* 'preventExtensions' */
+#define DUK_STRIDX_FREEZE 262 /* 'freeze' */
+#define DUK_STRIDX_SEAL 263 /* 'seal' */
+#define DUK_STRIDX_DEFINE_PROPERTIES 264 /* 'defineProperties' */
+#define DUK_STRIDX_DEFINE_PROPERTY 265 /* 'defineProperty' */
+#define DUK_STRIDX_CREATE 266 /* 'create' */
+#define DUK_STRIDX_GET_OWN_PROPERTY_NAMES 267 /* 'getOwnPropertyNames' */
+#define DUK_STRIDX_GET_OWN_PROPERTY_DESCRIPTOR 268 /* 'getOwnPropertyDescriptor' */
+#define DUK_STRIDX_GET_PROTOTYPE_OF 269 /* 'getPrototypeOf' */
+#define DUK_STRIDX_PROTOTYPE 270 /* 'prototype' */
+#define DUK_STRIDX_LENGTH 271 /* 'length' */
+#define DUK_STRIDX_ALERT 272 /* 'alert' */
+#define DUK_STRIDX_PRINT 273 /* 'print' */
+#define DUK_STRIDX_UNESCAPE 274 /* 'unescape' */
+#define DUK_STRIDX_ESCAPE 275 /* 'escape' */
+#define DUK_STRIDX_ENCODE_URI_COMPONENT 276 /* 'encodeURIComponent' */
+#define DUK_STRIDX_ENCODE_URI 277 /* 'encodeURI' */
+#define DUK_STRIDX_DECODE_URI_COMPONENT 278 /* 'decodeURIComponent' */
+#define DUK_STRIDX_DECODE_URI 279 /* 'decodeURI' */
+#define DUK_STRIDX_IS_FINITE 280 /* 'isFinite' */
+#define DUK_STRIDX_IS_NAN 281 /* 'isNaN' */
+#define DUK_STRIDX_PARSE_FLOAT 282 /* 'parseFloat' */
+#define DUK_STRIDX_PARSE_INT 283 /* 'parseInt' */
+#define DUK_STRIDX_EVAL 284 /* 'eval' */
+#define DUK_STRIDX_URI_ERROR 285 /* 'URIError' */
+#define DUK_STRIDX_TYPE_ERROR 286 /* 'TypeError' */
+#define DUK_STRIDX_SYNTAX_ERROR 287 /* 'SyntaxError' */
+#define DUK_STRIDX_REFERENCE_ERROR 288 /* 'ReferenceError' */
+#define DUK_STRIDX_RANGE_ERROR 289 /* 'RangeError' */
+#define DUK_STRIDX_EVAL_ERROR 290 /* 'EvalError' */
+#define DUK_STRIDX_BREAK 291 /* 'break' */
+#define DUK_STRIDX_CASE 292 /* 'case' */
+#define DUK_STRIDX_CATCH 293 /* 'catch' */
+#define DUK_STRIDX_CONTINUE 294 /* 'continue' */
+#define DUK_STRIDX_DEBUGGER 295 /* 'debugger' */
+#define DUK_STRIDX_DEFAULT 296 /* 'default' */
+#define DUK_STRIDX_DELETE 297 /* 'delete' */
+#define DUK_STRIDX_DO 298 /* 'do' */
+#define DUK_STRIDX_ELSE 299 /* 'else' */
+#define DUK_STRIDX_FINALLY 300 /* 'finally' */
+#define DUK_STRIDX_FOR 301 /* 'for' */
+#define DUK_STRIDX_LC_FUNCTION 302 /* 'function' */
+#define DUK_STRIDX_IF 303 /* 'if' */
+#define DUK_STRIDX_IN 304 /* 'in' */
+#define DUK_STRIDX_INSTANCEOF 305 /* 'instanceof' */
+#define DUK_STRIDX_NEW 306 /* 'new' */
+#define DUK_STRIDX_RETURN 307 /* 'return' */
+#define DUK_STRIDX_SWITCH 308 /* 'switch' */
+#define DUK_STRIDX_THIS 309 /* 'this' */
+#define DUK_STRIDX_THROW 310 /* 'throw' */
+#define DUK_STRIDX_TRY 311 /* 'try' */
+#define DUK_STRIDX_TYPEOF 312 /* 'typeof' */
+#define DUK_STRIDX_VAR 313 /* 'var' */
+#define DUK_STRIDX_VOID 314 /* 'void' */
+#define DUK_STRIDX_WHILE 315 /* 'while' */
+#define DUK_STRIDX_WITH 316 /* 'with' */
+#define DUK_STRIDX_CLASS 317 /* 'class' */
+#define DUK_STRIDX_CONST 318 /* 'const' */
+#define DUK_STRIDX_ENUM 319 /* 'enum' */
+#define DUK_STRIDX_EXPORT 320 /* 'export' */
+#define DUK_STRIDX_EXTENDS 321 /* 'extends' */
+#define DUK_STRIDX_IMPORT 322 /* 'import' */
+#define DUK_STRIDX_SUPER 323 /* 'super' */
+#define DUK_STRIDX_LC_NULL 324 /* 'null' */
+#define DUK_STRIDX_TRUE 325 /* 'true' */
+#define DUK_STRIDX_FALSE 326 /* 'false' */
+#define DUK_STRIDX_IMPLEMENTS 327 /* 'implements' */
+#define DUK_STRIDX_INTERFACE 328 /* 'interface' */
+#define DUK_STRIDX_LET 329 /* 'let' */
+#define DUK_STRIDX_PACKAGE 330 /* 'package' */
+#define DUK_STRIDX_PRIVATE 331 /* 'private' */
+#define DUK_STRIDX_PROTECTED 332 /* 'protected' */
+#define DUK_STRIDX_PUBLIC 333 /* 'public' */
+#define DUK_STRIDX_STATIC 334 /* 'static' */
+#define DUK_STRIDX_YIELD 335 /* 'yield' */
+
+#define DUK_HEAP_STRING_UC_LOGGER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_LOGGER)
+#define DUK_HTHREAD_STRING_UC_LOGGER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_LOGGER)
+#define DUK_HEAP_STRING_UC_THREAD(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_THREAD)
+#define DUK_HTHREAD_STRING_UC_THREAD(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_THREAD)
+#define DUK_HEAP_STRING_UC_POINTER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_POINTER)
+#define DUK_HTHREAD_STRING_UC_POINTER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_POINTER)
+#define DUK_HEAP_STRING_UC_BUFFER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_BUFFER)
+#define DUK_HTHREAD_STRING_UC_BUFFER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_BUFFER)
+#define DUK_HEAP_STRING_DEC_ENV(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEC_ENV)
+#define DUK_HTHREAD_STRING_DEC_ENV(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEC_ENV)
+#define DUK_HEAP_STRING_OBJ_ENV(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_OBJ_ENV)
+#define DUK_HTHREAD_STRING_OBJ_ENV(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_OBJ_ENV)
+#define DUK_HEAP_STRING_EMPTY_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EMPTY_STRING)
+#define DUK_HTHREAD_STRING_EMPTY_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EMPTY_STRING)
+#define DUK_HEAP_STRING_GLOBAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GLOBAL)
+#define DUK_HTHREAD_STRING_GLOBAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GLOBAL)
+#define DUK_HEAP_STRING_UC_ARGUMENTS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_ARGUMENTS)
+#define DUK_HTHREAD_STRING_UC_ARGUMENTS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_ARGUMENTS)
+#define DUK_HEAP_STRING_JSON(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JSON)
+#define DUK_HTHREAD_STRING_JSON(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JSON)
+#define DUK_HEAP_STRING_MATH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MATH)
+#define DUK_HTHREAD_STRING_MATH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MATH)
+#define DUK_HEAP_STRING_UC_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_ERROR)
+#define DUK_HTHREAD_STRING_UC_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_ERROR)
+#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)
+#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_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_HEAP_STRING_UC_BOOLEAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_BOOLEAN)
+#define DUK_HTHREAD_STRING_UC_BOOLEAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_BOOLEAN)
+#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)
+#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_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_HEAP_STRING_UC_OBJECT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_OBJECT)
+#define DUK_HTHREAD_STRING_UC_OBJECT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_OBJECT)
+#define DUK_HEAP_STRING_UC_NULL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_NULL)
+#define DUK_HTHREAD_STRING_UC_NULL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_NULL)
+#define DUK_HEAP_STRING_UC_UNDEFINED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_UNDEFINED)
+#define DUK_HTHREAD_STRING_UC_UNDEFINED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_UNDEFINED)
+#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_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_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_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_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_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_HEAP_STRING_TO_LOG_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOG_STRING)
+#define DUK_HTHREAD_STRING_TO_LOG_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOG_STRING)
+#define DUK_HEAP_STRING_CLOG(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CLOG)
+#define DUK_HTHREAD_STRING_CLOG(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CLOG)
+#define DUK_HEAP_STRING_LC_L(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_L)
+#define DUK_HTHREAD_STRING_LC_L(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_L)
+#define DUK_HEAP_STRING_LC_N(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_N)
+#define DUK_HTHREAD_STRING_LC_N(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_N)
+#define DUK_HEAP_STRING_LC_FATAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_FATAL)
+#define DUK_HTHREAD_STRING_LC_FATAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_FATAL)
+#define DUK_HEAP_STRING_LC_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_ERROR)
+#define DUK_HTHREAD_STRING_LC_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_ERROR)
+#define DUK_HEAP_STRING_LC_WARN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_WARN)
+#define DUK_HTHREAD_STRING_LC_WARN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_WARN)
+#define DUK_HEAP_STRING_LC_DEBUG(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_DEBUG)
+#define DUK_HTHREAD_STRING_LC_DEBUG(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_DEBUG)
+#define DUK_HEAP_STRING_LC_TRACE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_TRACE)
+#define DUK_HTHREAD_STRING_LC_TRACE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_TRACE)
+#define DUK_HEAP_STRING_RAW(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_RAW)
+#define DUK_HTHREAD_STRING_RAW(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_RAW)
+#define DUK_HEAP_STRING_FMT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FMT)
+#define DUK_HTHREAD_STRING_FMT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FMT)
+#define DUK_HEAP_STRING_CURRENT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CURRENT)
+#define DUK_HTHREAD_STRING_CURRENT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CURRENT)
+#define DUK_HEAP_STRING_RESUME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_RESUME)
+#define DUK_HTHREAD_STRING_RESUME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_RESUME)
+#define DUK_HEAP_STRING_COMPACT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_COMPACT)
+#define DUK_HTHREAD_STRING_COMPACT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_COMPACT)
+#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_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_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_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_HEAP_STRING_DEC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEC)
+#define DUK_HTHREAD_STRING_DEC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEC)
+#define DUK_HEAP_STRING_ENC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENC)
+#define DUK_HTHREAD_STRING_ENC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENC)
+#define DUK_HEAP_STRING_FIN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FIN)
+#define DUK_HTHREAD_STRING_FIN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FIN)
+#define DUK_HEAP_STRING_GC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GC)
+#define DUK_HTHREAD_STRING_GC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GC)
+#define DUK_HEAP_STRING_ACT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ACT)
+#define DUK_HTHREAD_STRING_ACT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ACT)
+#define DUK_HEAP_STRING_LC_INFO(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_INFO)
+#define DUK_HTHREAD_STRING_LC_INFO(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_INFO)
+#define DUK_HEAP_STRING_VERSION(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_VERSION)
+#define DUK_HTHREAD_STRING_VERSION(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_VERSION)
+#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_HEAP_STRING_MOD_LOADED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MOD_LOADED)
+#define DUK_HTHREAD_STRING_MOD_LOADED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MOD_LOADED)
+#define DUK_HEAP_STRING_MOD_SEARCH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MOD_SEARCH)
+#define DUK_HTHREAD_STRING_MOD_SEARCH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MOD_SEARCH)
+#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_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_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_HEAP_STRING_INT_REGBASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_REGBASE)
+#define DUK_HTHREAD_STRING_INT_REGBASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_REGBASE)
+#define DUK_HEAP_STRING_INT_THREAD(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_THREAD)
+#define DUK_HTHREAD_STRING_INT_THREAD(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_THREAD)
+#define DUK_HEAP_STRING_INT_HANDLER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_HANDLER)
+#define DUK_HTHREAD_STRING_INT_HANDLER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_HANDLER)
+#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_HEAP_STRING_INT_CALLEE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_CALLEE)
+#define DUK_HTHREAD_STRING_INT_CALLEE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_CALLEE)
+#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_HEAP_STRING_INT_ARGS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_ARGS)
+#define DUK_HTHREAD_STRING_INT_ARGS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_ARGS)
+#define DUK_HEAP_STRING_INT_THIS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_THIS)
+#define DUK_HTHREAD_STRING_INT_THIS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_THIS)
+#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_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_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_HEAP_STRING_INT_LEXENV(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_LEXENV)
+#define DUK_HTHREAD_STRING_INT_LEXENV(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_LEXENV)
+#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_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_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_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_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_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_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_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_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_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_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_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_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_HEAP_STRING_THROW_TYPE_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_THROW_TYPE_ERROR)
+#define DUK_HTHREAD_STRING_THROW_TYPE_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_THROW_TYPE_ERROR)
+#define DUK_HEAP_STRING_DUKTAPE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DUKTAPE)
+#define DUK_HTHREAD_STRING_DUKTAPE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DUKTAPE)
+#define DUK_HEAP_STRING_ID(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ID)
+#define DUK_HTHREAD_STRING_ID(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ID)
+#define DUK_HEAP_STRING_REQUIRE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REQUIRE)
+#define DUK_HTHREAD_STRING_REQUIRE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REQUIRE)
+#define DUK_HEAP_STRING___PROTO__(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX___PROTO__)
+#define DUK_HTHREAD_STRING___PROTO__(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX___PROTO__)
+#define DUK_HEAP_STRING_SET_PROTOTYPE_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_PROTOTYPE_OF)
+#define DUK_HTHREAD_STRING_SET_PROTOTYPE_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_PROTOTYPE_OF)
+#define DUK_HEAP_STRING_OWN_KEYS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_OWN_KEYS)
+#define DUK_HTHREAD_STRING_OWN_KEYS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_OWN_KEYS)
+#define DUK_HEAP_STRING_ENUMERATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENUMERATE)
+#define DUK_HTHREAD_STRING_ENUMERATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENUMERATE)
+#define DUK_HEAP_STRING_DELETE_PROPERTY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DELETE_PROPERTY)
+#define DUK_HTHREAD_STRING_DELETE_PROPERTY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DELETE_PROPERTY)
+#define DUK_HEAP_STRING_HAS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_HAS)
+#define DUK_HTHREAD_STRING_HAS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_HAS)
+#define DUK_HEAP_STRING_PROXY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PROXY)
+#define DUK_HTHREAD_STRING_PROXY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PROXY)
+#define DUK_HEAP_STRING_CALLEE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CALLEE)
+#define DUK_HTHREAD_STRING_CALLEE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CALLEE)
+#define DUK_HEAP_STRING_INVALID_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INVALID_DATE)
+#define DUK_HTHREAD_STRING_INVALID_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INVALID_DATE)
+#define DUK_HEAP_STRING_BRACKETED_ELLIPSIS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_BRACKETED_ELLIPSIS)
+#define DUK_HTHREAD_STRING_BRACKETED_ELLIPSIS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_BRACKETED_ELLIPSIS)
+#define DUK_HEAP_STRING_NEWLINE_TAB(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NEWLINE_TAB)
+#define DUK_HTHREAD_STRING_NEWLINE_TAB(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NEWLINE_TAB)
+#define DUK_HEAP_STRING_SPACE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SPACE)
+#define DUK_HTHREAD_STRING_SPACE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SPACE)
+#define DUK_HEAP_STRING_COMMA(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_COMMA)
+#define DUK_HTHREAD_STRING_COMMA(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_COMMA)
+#define DUK_HEAP_STRING_MINUS_ZERO(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MINUS_ZERO)
+#define DUK_HTHREAD_STRING_MINUS_ZERO(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MINUS_ZERO)
+#define DUK_HEAP_STRING_PLUS_ZERO(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PLUS_ZERO)
+#define DUK_HTHREAD_STRING_PLUS_ZERO(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PLUS_ZERO)
+#define DUK_HEAP_STRING_ZERO(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ZERO)
+#define DUK_HTHREAD_STRING_ZERO(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ZERO)
+#define DUK_HEAP_STRING_MINUS_INFINITY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MINUS_INFINITY)
+#define DUK_HTHREAD_STRING_MINUS_INFINITY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MINUS_INFINITY)
+#define DUK_HEAP_STRING_PLUS_INFINITY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PLUS_INFINITY)
+#define DUK_HTHREAD_STRING_PLUS_INFINITY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PLUS_INFINITY)
+#define DUK_HEAP_STRING_INFINITY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INFINITY)
+#define DUK_HTHREAD_STRING_INFINITY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INFINITY)
+#define DUK_HEAP_STRING_LC_OBJECT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_OBJECT)
+#define DUK_HTHREAD_STRING_LC_OBJECT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_OBJECT)
+#define DUK_HEAP_STRING_LC_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_STRING)
+#define DUK_HTHREAD_STRING_LC_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_STRING)
+#define DUK_HEAP_STRING_LC_NUMBER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_NUMBER)
+#define DUK_HTHREAD_STRING_LC_NUMBER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_NUMBER)
+#define DUK_HEAP_STRING_LC_BOOLEAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_BOOLEAN)
+#define DUK_HTHREAD_STRING_LC_BOOLEAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_BOOLEAN)
+#define DUK_HEAP_STRING_LC_UNDEFINED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_UNDEFINED)
+#define DUK_HTHREAD_STRING_LC_UNDEFINED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_UNDEFINED)
+#define DUK_HEAP_STRING_STRINGIFY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_STRINGIFY)
+#define DUK_HTHREAD_STRING_STRINGIFY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_STRINGIFY)
+#define DUK_HEAP_STRING_TAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TAN)
+#define DUK_HTHREAD_STRING_TAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TAN)
+#define DUK_HEAP_STRING_SQRT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SQRT)
+#define DUK_HTHREAD_STRING_SQRT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SQRT)
+#define DUK_HEAP_STRING_SIN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SIN)
+#define DUK_HTHREAD_STRING_SIN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SIN)
+#define DUK_HEAP_STRING_ROUND(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ROUND)
+#define DUK_HTHREAD_STRING_ROUND(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ROUND)
+#define DUK_HEAP_STRING_RANDOM(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_RANDOM)
+#define DUK_HTHREAD_STRING_RANDOM(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_RANDOM)
+#define DUK_HEAP_STRING_POW(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_POW)
+#define DUK_HTHREAD_STRING_POW(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_POW)
+#define DUK_HEAP_STRING_MIN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MIN)
+#define DUK_HTHREAD_STRING_MIN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MIN)
+#define DUK_HEAP_STRING_MAX(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MAX)
+#define DUK_HTHREAD_STRING_MAX(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MAX)
+#define DUK_HEAP_STRING_LOG(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LOG)
+#define DUK_HTHREAD_STRING_LOG(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LOG)
+#define DUK_HEAP_STRING_FLOOR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FLOOR)
+#define DUK_HTHREAD_STRING_FLOOR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FLOOR)
+#define DUK_HEAP_STRING_EXP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EXP)
+#define DUK_HTHREAD_STRING_EXP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EXP)
+#define DUK_HEAP_STRING_COS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_COS)
+#define DUK_HTHREAD_STRING_COS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_COS)
+#define DUK_HEAP_STRING_CEIL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CEIL)
+#define DUK_HTHREAD_STRING_CEIL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CEIL)
+#define DUK_HEAP_STRING_ATAN2(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ATAN2)
+#define DUK_HTHREAD_STRING_ATAN2(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ATAN2)
+#define DUK_HEAP_STRING_ATAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ATAN)
+#define DUK_HTHREAD_STRING_ATAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ATAN)
+#define DUK_HEAP_STRING_ASIN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ASIN)
+#define DUK_HTHREAD_STRING_ASIN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ASIN)
+#define DUK_HEAP_STRING_ACOS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ACOS)
+#define DUK_HTHREAD_STRING_ACOS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ACOS)
+#define DUK_HEAP_STRING_ABS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ABS)
+#define DUK_HTHREAD_STRING_ABS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ABS)
+#define DUK_HEAP_STRING_SQRT2(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SQRT2)
+#define DUK_HTHREAD_STRING_SQRT2(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SQRT2)
+#define DUK_HEAP_STRING_SQRT1_2(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SQRT1_2)
+#define DUK_HTHREAD_STRING_SQRT1_2(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SQRT1_2)
+#define DUK_HEAP_STRING_PI(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PI)
+#define DUK_HTHREAD_STRING_PI(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PI)
+#define DUK_HEAP_STRING_LOG10E(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LOG10E)
+#define DUK_HTHREAD_STRING_LOG10E(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LOG10E)
+#define DUK_HEAP_STRING_LOG2E(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LOG2E)
+#define DUK_HTHREAD_STRING_LOG2E(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LOG2E)
+#define DUK_HEAP_STRING_LN2(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LN2)
+#define DUK_HTHREAD_STRING_LN2(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LN2)
+#define DUK_HEAP_STRING_LN10(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LN10)
+#define DUK_HTHREAD_STRING_LN10(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LN10)
+#define DUK_HEAP_STRING_E(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_E)
+#define DUK_HTHREAD_STRING_E(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_E)
+#define DUK_HEAP_STRING_MESSAGE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MESSAGE)
+#define DUK_HTHREAD_STRING_MESSAGE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MESSAGE)
+#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_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_HEAP_STRING_INDEX(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INDEX)
+#define DUK_HTHREAD_STRING_INDEX(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INDEX)
+#define DUK_HEAP_STRING_ESCAPED_EMPTY_REGEXP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ESCAPED_EMPTY_REGEXP)
+#define DUK_HTHREAD_STRING_ESCAPED_EMPTY_REGEXP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ESCAPED_EMPTY_REGEXP)
+#define DUK_HEAP_STRING_LAST_INDEX(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LAST_INDEX)
+#define DUK_HTHREAD_STRING_LAST_INDEX(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LAST_INDEX)
+#define DUK_HEAP_STRING_MULTILINE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MULTILINE)
+#define DUK_HTHREAD_STRING_MULTILINE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MULTILINE)
+#define DUK_HEAP_STRING_IGNORE_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IGNORE_CASE)
+#define DUK_HTHREAD_STRING_IGNORE_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IGNORE_CASE)
+#define DUK_HEAP_STRING_SOURCE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SOURCE)
+#define DUK_HTHREAD_STRING_SOURCE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SOURCE)
+#define DUK_HEAP_STRING_TEST(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TEST)
+#define DUK_HTHREAD_STRING_TEST(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TEST)
+#define DUK_HEAP_STRING_EXEC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EXEC)
+#define DUK_HTHREAD_STRING_EXEC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EXEC)
+#define DUK_HEAP_STRING_TO_GMT_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_GMT_STRING)
+#define DUK_HTHREAD_STRING_TO_GMT_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_GMT_STRING)
+#define DUK_HEAP_STRING_SET_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_YEAR)
+#define DUK_HTHREAD_STRING_SET_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_YEAR)
+#define DUK_HEAP_STRING_GET_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_YEAR)
+#define DUK_HTHREAD_STRING_GET_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_YEAR)
+#define DUK_HEAP_STRING_TO_JSON(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_JSON)
+#define DUK_HTHREAD_STRING_TO_JSON(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_JSON)
+#define DUK_HEAP_STRING_TO_ISO_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_ISO_STRING)
+#define DUK_HTHREAD_STRING_TO_ISO_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_ISO_STRING)
+#define DUK_HEAP_STRING_TO_UTC_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_UTC_STRING)
+#define DUK_HTHREAD_STRING_TO_UTC_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_UTC_STRING)
+#define DUK_HEAP_STRING_SET_UTC_FULL_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_FULL_YEAR)
+#define DUK_HTHREAD_STRING_SET_UTC_FULL_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_FULL_YEAR)
+#define DUK_HEAP_STRING_SET_FULL_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_FULL_YEAR)
+#define DUK_HTHREAD_STRING_SET_FULL_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_FULL_YEAR)
+#define DUK_HEAP_STRING_SET_UTC_MONTH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_MONTH)
+#define DUK_HTHREAD_STRING_SET_UTC_MONTH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_MONTH)
+#define DUK_HEAP_STRING_SET_MONTH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_MONTH)
+#define DUK_HTHREAD_STRING_SET_MONTH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_MONTH)
+#define DUK_HEAP_STRING_SET_UTC_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_DATE)
+#define DUK_HTHREAD_STRING_SET_UTC_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_DATE)
+#define DUK_HEAP_STRING_SET_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_DATE)
+#define DUK_HTHREAD_STRING_SET_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_DATE)
+#define DUK_HEAP_STRING_SET_UTC_HOURS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_HOURS)
+#define DUK_HTHREAD_STRING_SET_UTC_HOURS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_HOURS)
+#define DUK_HEAP_STRING_SET_HOURS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_HOURS)
+#define DUK_HTHREAD_STRING_SET_HOURS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_HOURS)
+#define DUK_HEAP_STRING_SET_UTC_MINUTES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_MINUTES)
+#define DUK_HTHREAD_STRING_SET_UTC_MINUTES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_MINUTES)
+#define DUK_HEAP_STRING_SET_MINUTES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_MINUTES)
+#define DUK_HTHREAD_STRING_SET_MINUTES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_MINUTES)
+#define DUK_HEAP_STRING_SET_UTC_SECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_SECONDS)
+#define DUK_HTHREAD_STRING_SET_UTC_SECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_SECONDS)
+#define DUK_HEAP_STRING_SET_SECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_SECONDS)
+#define DUK_HTHREAD_STRING_SET_SECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_SECONDS)
+#define DUK_HEAP_STRING_SET_UTC_MILLISECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_MILLISECONDS)
+#define DUK_HTHREAD_STRING_SET_UTC_MILLISECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_MILLISECONDS)
+#define DUK_HEAP_STRING_SET_MILLISECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_MILLISECONDS)
+#define DUK_HTHREAD_STRING_SET_MILLISECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_MILLISECONDS)
+#define DUK_HEAP_STRING_SET_TIME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_TIME)
+#define DUK_HTHREAD_STRING_SET_TIME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_TIME)
+#define DUK_HEAP_STRING_GET_TIMEZONE_OFFSET(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_TIMEZONE_OFFSET)
+#define DUK_HTHREAD_STRING_GET_TIMEZONE_OFFSET(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_TIMEZONE_OFFSET)
+#define DUK_HEAP_STRING_GET_UTC_MILLISECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_MILLISECONDS)
+#define DUK_HTHREAD_STRING_GET_UTC_MILLISECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_MILLISECONDS)
+#define DUK_HEAP_STRING_GET_MILLISECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_MILLISECONDS)
+#define DUK_HTHREAD_STRING_GET_MILLISECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_MILLISECONDS)
+#define DUK_HEAP_STRING_GET_UTC_SECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_SECONDS)
+#define DUK_HTHREAD_STRING_GET_UTC_SECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_SECONDS)
+#define DUK_HEAP_STRING_GET_SECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_SECONDS)
+#define DUK_HTHREAD_STRING_GET_SECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_SECONDS)
+#define DUK_HEAP_STRING_GET_UTC_MINUTES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_MINUTES)
+#define DUK_HTHREAD_STRING_GET_UTC_MINUTES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_MINUTES)
+#define DUK_HEAP_STRING_GET_MINUTES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_MINUTES)
+#define DUK_HTHREAD_STRING_GET_MINUTES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_MINUTES)
+#define DUK_HEAP_STRING_GET_UTC_HOURS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_HOURS)
+#define DUK_HTHREAD_STRING_GET_UTC_HOURS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_HOURS)
+#define DUK_HEAP_STRING_GET_HOURS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_HOURS)
+#define DUK_HTHREAD_STRING_GET_HOURS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_HOURS)
+#define DUK_HEAP_STRING_GET_UTC_DAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_DAY)
+#define DUK_HTHREAD_STRING_GET_UTC_DAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_DAY)
+#define DUK_HEAP_STRING_GET_DAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_DAY)
+#define DUK_HTHREAD_STRING_GET_DAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_DAY)
+#define DUK_HEAP_STRING_GET_UTC_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_DATE)
+#define DUK_HTHREAD_STRING_GET_UTC_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_DATE)
+#define DUK_HEAP_STRING_GET_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_DATE)
+#define DUK_HTHREAD_STRING_GET_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_DATE)
+#define DUK_HEAP_STRING_GET_UTC_MONTH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_MONTH)
+#define DUK_HTHREAD_STRING_GET_UTC_MONTH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_MONTH)
+#define DUK_HEAP_STRING_GET_MONTH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_MONTH)
+#define DUK_HTHREAD_STRING_GET_MONTH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_MONTH)
+#define DUK_HEAP_STRING_GET_UTC_FULL_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_FULL_YEAR)
+#define DUK_HTHREAD_STRING_GET_UTC_FULL_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_FULL_YEAR)
+#define DUK_HEAP_STRING_GET_FULL_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_FULL_YEAR)
+#define DUK_HTHREAD_STRING_GET_FULL_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_FULL_YEAR)
+#define DUK_HEAP_STRING_GET_TIME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_TIME)
+#define DUK_HTHREAD_STRING_GET_TIME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_TIME)
+#define DUK_HEAP_STRING_TO_LOCALE_TIME_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOCALE_TIME_STRING)
+#define DUK_HTHREAD_STRING_TO_LOCALE_TIME_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOCALE_TIME_STRING)
+#define DUK_HEAP_STRING_TO_LOCALE_DATE_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOCALE_DATE_STRING)
+#define DUK_HTHREAD_STRING_TO_LOCALE_DATE_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOCALE_DATE_STRING)
+#define DUK_HEAP_STRING_TO_TIME_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_TIME_STRING)
+#define DUK_HTHREAD_STRING_TO_TIME_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_TIME_STRING)
+#define DUK_HEAP_STRING_TO_DATE_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_DATE_STRING)
+#define DUK_HTHREAD_STRING_TO_DATE_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_DATE_STRING)
+#define DUK_HEAP_STRING_NOW(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NOW)
+#define DUK_HTHREAD_STRING_NOW(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NOW)
+#define DUK_HEAP_STRING_UTC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UTC)
+#define DUK_HTHREAD_STRING_UTC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UTC)
+#define DUK_HEAP_STRING_PARSE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PARSE)
+#define DUK_HTHREAD_STRING_PARSE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PARSE)
+#define DUK_HEAP_STRING_TO_PRECISION(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_PRECISION)
+#define DUK_HTHREAD_STRING_TO_PRECISION(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_PRECISION)
+#define DUK_HEAP_STRING_TO_EXPONENTIAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_EXPONENTIAL)
+#define DUK_HTHREAD_STRING_TO_EXPONENTIAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_EXPONENTIAL)
+#define DUK_HEAP_STRING_TO_FIXED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_FIXED)
+#define DUK_HTHREAD_STRING_TO_FIXED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_FIXED)
+#define DUK_HEAP_STRING_POSITIVE_INFINITY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_POSITIVE_INFINITY)
+#define DUK_HTHREAD_STRING_POSITIVE_INFINITY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_POSITIVE_INFINITY)
+#define DUK_HEAP_STRING_NEGATIVE_INFINITY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NEGATIVE_INFINITY)
+#define DUK_HTHREAD_STRING_NEGATIVE_INFINITY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NEGATIVE_INFINITY)
+#define DUK_HEAP_STRING_NAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NAN)
+#define DUK_HTHREAD_STRING_NAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NAN)
+#define DUK_HEAP_STRING_MIN_VALUE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MIN_VALUE)
+#define DUK_HTHREAD_STRING_MIN_VALUE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MIN_VALUE)
+#define DUK_HEAP_STRING_MAX_VALUE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MAX_VALUE)
+#define DUK_HTHREAD_STRING_MAX_VALUE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MAX_VALUE)
+#define DUK_HEAP_STRING_SUBSTR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SUBSTR)
+#define DUK_HTHREAD_STRING_SUBSTR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SUBSTR)
+#define DUK_HEAP_STRING_TRIM(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TRIM)
+#define DUK_HTHREAD_STRING_TRIM(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TRIM)
+#define DUK_HEAP_STRING_TO_LOCALE_UPPER_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOCALE_UPPER_CASE)
+#define DUK_HTHREAD_STRING_TO_LOCALE_UPPER_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOCALE_UPPER_CASE)
+#define DUK_HEAP_STRING_TO_UPPER_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_UPPER_CASE)
+#define DUK_HTHREAD_STRING_TO_UPPER_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_UPPER_CASE)
+#define DUK_HEAP_STRING_TO_LOCALE_LOWER_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOCALE_LOWER_CASE)
+#define DUK_HTHREAD_STRING_TO_LOCALE_LOWER_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOCALE_LOWER_CASE)
+#define DUK_HEAP_STRING_TO_LOWER_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOWER_CASE)
+#define DUK_HTHREAD_STRING_TO_LOWER_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOWER_CASE)
+#define DUK_HEAP_STRING_SUBSTRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SUBSTRING)
+#define DUK_HTHREAD_STRING_SUBSTRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SUBSTRING)
+#define DUK_HEAP_STRING_SPLIT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SPLIT)
+#define DUK_HTHREAD_STRING_SPLIT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SPLIT)
+#define DUK_HEAP_STRING_SEARCH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SEARCH)
+#define DUK_HTHREAD_STRING_SEARCH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SEARCH)
+#define DUK_HEAP_STRING_REPLACE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REPLACE)
+#define DUK_HTHREAD_STRING_REPLACE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REPLACE)
+#define DUK_HEAP_STRING_MATCH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MATCH)
+#define DUK_HTHREAD_STRING_MATCH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MATCH)
+#define DUK_HEAP_STRING_LOCALE_COMPARE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LOCALE_COMPARE)
+#define DUK_HTHREAD_STRING_LOCALE_COMPARE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LOCALE_COMPARE)
+#define DUK_HEAP_STRING_CHAR_CODE_AT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CHAR_CODE_AT)
+#define DUK_HTHREAD_STRING_CHAR_CODE_AT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CHAR_CODE_AT)
+#define DUK_HEAP_STRING_CHAR_AT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CHAR_AT)
+#define DUK_HTHREAD_STRING_CHAR_AT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CHAR_AT)
+#define DUK_HEAP_STRING_FROM_CHAR_CODE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FROM_CHAR_CODE)
+#define DUK_HTHREAD_STRING_FROM_CHAR_CODE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FROM_CHAR_CODE)
+#define DUK_HEAP_STRING_REDUCE_RIGHT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REDUCE_RIGHT)
+#define DUK_HTHREAD_STRING_REDUCE_RIGHT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REDUCE_RIGHT)
+#define DUK_HEAP_STRING_REDUCE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REDUCE)
+#define DUK_HTHREAD_STRING_REDUCE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REDUCE)
+#define DUK_HEAP_STRING_FILTER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FILTER)
+#define DUK_HTHREAD_STRING_FILTER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FILTER)
+#define DUK_HEAP_STRING_MAP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MAP)
+#define DUK_HTHREAD_STRING_MAP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MAP)
+#define DUK_HEAP_STRING_FOR_EACH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FOR_EACH)
+#define DUK_HTHREAD_STRING_FOR_EACH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FOR_EACH)
+#define DUK_HEAP_STRING_SOME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SOME)
+#define DUK_HTHREAD_STRING_SOME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SOME)
+#define DUK_HEAP_STRING_EVERY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EVERY)
+#define DUK_HTHREAD_STRING_EVERY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EVERY)
+#define DUK_HEAP_STRING_LAST_INDEX_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LAST_INDEX_OF)
+#define DUK_HTHREAD_STRING_LAST_INDEX_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LAST_INDEX_OF)
+#define DUK_HEAP_STRING_INDEX_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INDEX_OF)
+#define DUK_HTHREAD_STRING_INDEX_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INDEX_OF)
+#define DUK_HEAP_STRING_UNSHIFT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UNSHIFT)
+#define DUK_HTHREAD_STRING_UNSHIFT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UNSHIFT)
+#define DUK_HEAP_STRING_SPLICE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SPLICE)
+#define DUK_HTHREAD_STRING_SPLICE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SPLICE)
+#define DUK_HEAP_STRING_SORT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SORT)
+#define DUK_HTHREAD_STRING_SORT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SORT)
+#define DUK_HEAP_STRING_SLICE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SLICE)
+#define DUK_HTHREAD_STRING_SLICE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SLICE)
+#define DUK_HEAP_STRING_SHIFT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SHIFT)
+#define DUK_HTHREAD_STRING_SHIFT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SHIFT)
+#define DUK_HEAP_STRING_REVERSE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REVERSE)
+#define DUK_HTHREAD_STRING_REVERSE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REVERSE)
+#define DUK_HEAP_STRING_PUSH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PUSH)
+#define DUK_HTHREAD_STRING_PUSH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PUSH)
+#define DUK_HEAP_STRING_POP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_POP)
+#define DUK_HTHREAD_STRING_POP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_POP)
+#define DUK_HEAP_STRING_JOIN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JOIN)
+#define DUK_HTHREAD_STRING_JOIN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JOIN)
+#define DUK_HEAP_STRING_CONCAT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CONCAT)
+#define DUK_HTHREAD_STRING_CONCAT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CONCAT)
+#define DUK_HEAP_STRING_IS_ARRAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_ARRAY)
+#define DUK_HTHREAD_STRING_IS_ARRAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_ARRAY)
+#define DUK_HEAP_STRING_LC_ARGUMENTS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_ARGUMENTS)
+#define DUK_HTHREAD_STRING_LC_ARGUMENTS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_ARGUMENTS)
+#define DUK_HEAP_STRING_CALLER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CALLER)
+#define DUK_HTHREAD_STRING_CALLER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CALLER)
+#define DUK_HEAP_STRING_BIND(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_BIND)
+#define DUK_HTHREAD_STRING_BIND(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_BIND)
+#define DUK_HEAP_STRING_CALL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CALL)
+#define DUK_HTHREAD_STRING_CALL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CALL)
+#define DUK_HEAP_STRING_APPLY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_APPLY)
+#define DUK_HTHREAD_STRING_APPLY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_APPLY)
+#define DUK_HEAP_STRING_PROPERTY_IS_ENUMERABLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PROPERTY_IS_ENUMERABLE)
+#define DUK_HTHREAD_STRING_PROPERTY_IS_ENUMERABLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PROPERTY_IS_ENUMERABLE)
+#define DUK_HEAP_STRING_IS_PROTOTYPE_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_PROTOTYPE_OF)
+#define DUK_HTHREAD_STRING_IS_PROTOTYPE_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_PROTOTYPE_OF)
+#define DUK_HEAP_STRING_HAS_OWN_PROPERTY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_HAS_OWN_PROPERTY)
+#define DUK_HTHREAD_STRING_HAS_OWN_PROPERTY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_HAS_OWN_PROPERTY)
+#define DUK_HEAP_STRING_VALUE_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_VALUE_OF)
+#define DUK_HTHREAD_STRING_VALUE_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_VALUE_OF)
+#define DUK_HEAP_STRING_TO_LOCALE_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOCALE_STRING)
+#define DUK_HTHREAD_STRING_TO_LOCALE_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOCALE_STRING)
+#define DUK_HEAP_STRING_TO_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_STRING)
+#define DUK_HTHREAD_STRING_TO_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_STRING)
+#define DUK_HEAP_STRING_CONSTRUCTOR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CONSTRUCTOR)
+#define DUK_HTHREAD_STRING_CONSTRUCTOR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CONSTRUCTOR)
+#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_HEAP_STRING_GET(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET)
+#define DUK_HTHREAD_STRING_GET(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET)
+#define DUK_HEAP_STRING_ENUMERABLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENUMERABLE)
+#define DUK_HTHREAD_STRING_ENUMERABLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENUMERABLE)
+#define DUK_HEAP_STRING_CONFIGURABLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CONFIGURABLE)
+#define DUK_HTHREAD_STRING_CONFIGURABLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CONFIGURABLE)
+#define DUK_HEAP_STRING_WRITABLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_WRITABLE)
+#define DUK_HTHREAD_STRING_WRITABLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_WRITABLE)
+#define DUK_HEAP_STRING_VALUE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_VALUE)
+#define DUK_HTHREAD_STRING_VALUE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_VALUE)
+#define DUK_HEAP_STRING_KEYS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_KEYS)
+#define DUK_HTHREAD_STRING_KEYS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_KEYS)
+#define DUK_HEAP_STRING_IS_EXTENSIBLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_EXTENSIBLE)
+#define DUK_HTHREAD_STRING_IS_EXTENSIBLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_EXTENSIBLE)
+#define DUK_HEAP_STRING_IS_FROZEN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_FROZEN)
+#define DUK_HTHREAD_STRING_IS_FROZEN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_FROZEN)
+#define DUK_HEAP_STRING_IS_SEALED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_SEALED)
+#define DUK_HTHREAD_STRING_IS_SEALED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_SEALED)
+#define DUK_HEAP_STRING_PREVENT_EXTENSIONS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PREVENT_EXTENSIONS)
+#define DUK_HTHREAD_STRING_PREVENT_EXTENSIONS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PREVENT_EXTENSIONS)
+#define DUK_HEAP_STRING_FREEZE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FREEZE)
+#define DUK_HTHREAD_STRING_FREEZE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FREEZE)
+#define DUK_HEAP_STRING_SEAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SEAL)
+#define DUK_HTHREAD_STRING_SEAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SEAL)
+#define DUK_HEAP_STRING_DEFINE_PROPERTIES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEFINE_PROPERTIES)
+#define DUK_HTHREAD_STRING_DEFINE_PROPERTIES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEFINE_PROPERTIES)
+#define DUK_HEAP_STRING_DEFINE_PROPERTY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEFINE_PROPERTY)
+#define DUK_HTHREAD_STRING_DEFINE_PROPERTY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEFINE_PROPERTY)
+#define DUK_HEAP_STRING_CREATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CREATE)
+#define DUK_HTHREAD_STRING_CREATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CREATE)
+#define DUK_HEAP_STRING_GET_OWN_PROPERTY_NAMES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_OWN_PROPERTY_NAMES)
+#define DUK_HTHREAD_STRING_GET_OWN_PROPERTY_NAMES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_OWN_PROPERTY_NAMES)
+#define DUK_HEAP_STRING_GET_OWN_PROPERTY_DESCRIPTOR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_OWN_PROPERTY_DESCRIPTOR)
+#define DUK_HTHREAD_STRING_GET_OWN_PROPERTY_DESCRIPTOR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_OWN_PROPERTY_DESCRIPTOR)
+#define DUK_HEAP_STRING_GET_PROTOTYPE_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_PROTOTYPE_OF)
+#define DUK_HTHREAD_STRING_GET_PROTOTYPE_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_PROTOTYPE_OF)
+#define DUK_HEAP_STRING_PROTOTYPE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PROTOTYPE)
+#define DUK_HTHREAD_STRING_PROTOTYPE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PROTOTYPE)
+#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_HEAP_STRING_ALERT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ALERT)
+#define DUK_HTHREAD_STRING_ALERT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ALERT)
+#define DUK_HEAP_STRING_PRINT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PRINT)
+#define DUK_HTHREAD_STRING_PRINT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PRINT)
+#define DUK_HEAP_STRING_UNESCAPE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UNESCAPE)
+#define DUK_HTHREAD_STRING_UNESCAPE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UNESCAPE)
+#define DUK_HEAP_STRING_ESCAPE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ESCAPE)
+#define DUK_HTHREAD_STRING_ESCAPE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ESCAPE)
+#define DUK_HEAP_STRING_ENCODE_URI_COMPONENT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENCODE_URI_COMPONENT)
+#define DUK_HTHREAD_STRING_ENCODE_URI_COMPONENT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENCODE_URI_COMPONENT)
+#define DUK_HEAP_STRING_ENCODE_URI(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENCODE_URI)
+#define DUK_HTHREAD_STRING_ENCODE_URI(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENCODE_URI)
+#define DUK_HEAP_STRING_DECODE_URI_COMPONENT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DECODE_URI_COMPONENT)
+#define DUK_HTHREAD_STRING_DECODE_URI_COMPONENT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DECODE_URI_COMPONENT)
+#define DUK_HEAP_STRING_DECODE_URI(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DECODE_URI)
+#define DUK_HTHREAD_STRING_DECODE_URI(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DECODE_URI)
+#define DUK_HEAP_STRING_IS_FINITE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_FINITE)
+#define DUK_HTHREAD_STRING_IS_FINITE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_FINITE)
+#define DUK_HEAP_STRING_IS_NAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_NAN)
+#define DUK_HTHREAD_STRING_IS_NAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_NAN)
+#define DUK_HEAP_STRING_PARSE_FLOAT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PARSE_FLOAT)
+#define DUK_HTHREAD_STRING_PARSE_FLOAT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PARSE_FLOAT)
+#define DUK_HEAP_STRING_PARSE_INT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PARSE_INT)
+#define DUK_HTHREAD_STRING_PARSE_INT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PARSE_INT)
+#define DUK_HEAP_STRING_EVAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EVAL)
+#define DUK_HTHREAD_STRING_EVAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EVAL)
+#define DUK_HEAP_STRING_URI_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_URI_ERROR)
+#define DUK_HTHREAD_STRING_URI_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_URI_ERROR)
+#define DUK_HEAP_STRING_TYPE_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TYPE_ERROR)
+#define DUK_HTHREAD_STRING_TYPE_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TYPE_ERROR)
+#define DUK_HEAP_STRING_SYNTAX_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SYNTAX_ERROR)
+#define DUK_HTHREAD_STRING_SYNTAX_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SYNTAX_ERROR)
+#define DUK_HEAP_STRING_REFERENCE_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REFERENCE_ERROR)
+#define DUK_HTHREAD_STRING_REFERENCE_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REFERENCE_ERROR)
+#define DUK_HEAP_STRING_RANGE_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_RANGE_ERROR)
+#define DUK_HTHREAD_STRING_RANGE_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_RANGE_ERROR)
+#define DUK_HEAP_STRING_EVAL_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EVAL_ERROR)
+#define DUK_HTHREAD_STRING_EVAL_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EVAL_ERROR)
+#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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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 336
+
+#define DUK_STRIDX_START_RESERVED 291
+#define DUK_STRIDX_START_STRICT_RESERVED 327
+#define DUK_STRIDX_END_RESERVED 336 /* exclusive endpoint */
+
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL const duk_c_function duk_bi_native_functions[128];
+DUK_INTERNAL_DECL const duk_uint8_t duk_builtins_data[1341];
+#ifdef DUK_USE_BUILTIN_INITJS
+DUK_INTERNAL_DECL const duk_uint8_t duk_initjs_data[187];
+#endif /* DUK_USE_BUILTIN_INITJS */
+#endif /* !DUK_SINGLE_FILE */
+
+#define DUK_BUILTINS_DATA_LENGTH 1341
+#ifdef DUK_USE_BUILTIN_INITJS
+#define DUK_BUILTIN_INITJS_DATA_LENGTH 187
+#endif /* DUK_USE_BUILTIN_INITJS */
+
+#define DUK_BIDX_GLOBAL 0
+#define DUK_BIDX_GLOBAL_ENV 1
+#define DUK_BIDX_OBJECT_CONSTRUCTOR 2
+#define DUK_BIDX_OBJECT_PROTOTYPE 3
+#define DUK_BIDX_FUNCTION_CONSTRUCTOR 4
+#define DUK_BIDX_FUNCTION_PROTOTYPE 5
+#define DUK_BIDX_ARRAY_CONSTRUCTOR 6
+#define DUK_BIDX_ARRAY_PROTOTYPE 7
+#define DUK_BIDX_STRING_CONSTRUCTOR 8
+#define DUK_BIDX_STRING_PROTOTYPE 9
+#define DUK_BIDX_BOOLEAN_CONSTRUCTOR 10
+#define DUK_BIDX_BOOLEAN_PROTOTYPE 11
+#define DUK_BIDX_NUMBER_CONSTRUCTOR 12
+#define DUK_BIDX_NUMBER_PROTOTYPE 13
+#define DUK_BIDX_DATE_CONSTRUCTOR 14
+#define DUK_BIDX_DATE_PROTOTYPE 15
+#define DUK_BIDX_REGEXP_CONSTRUCTOR 16
+#define DUK_BIDX_REGEXP_PROTOTYPE 17
+#define DUK_BIDX_ERROR_CONSTRUCTOR 18
+#define DUK_BIDX_ERROR_PROTOTYPE 19
+#define DUK_BIDX_EVAL_ERROR_CONSTRUCTOR 20
+#define DUK_BIDX_EVAL_ERROR_PROTOTYPE 21
+#define DUK_BIDX_RANGE_ERROR_CONSTRUCTOR 22
+#define DUK_BIDX_RANGE_ERROR_PROTOTYPE 23
+#define DUK_BIDX_REFERENCE_ERROR_CONSTRUCTOR 24
+#define DUK_BIDX_REFERENCE_ERROR_PROTOTYPE 25
+#define DUK_BIDX_SYNTAX_ERROR_CONSTRUCTOR 26
+#define DUK_BIDX_SYNTAX_ERROR_PROTOTYPE 27
+#define DUK_BIDX_TYPE_ERROR_CONSTRUCTOR 28
+#define DUK_BIDX_TYPE_ERROR_PROTOTYPE 29
+#define DUK_BIDX_URI_ERROR_CONSTRUCTOR 30
+#define DUK_BIDX_URI_ERROR_PROTOTYPE 31
+#define DUK_BIDX_MATH 32
+#define DUK_BIDX_JSON 33
+#define DUK_BIDX_TYPE_ERROR_THROWER 34
+#define DUK_BIDX_PROXY_CONSTRUCTOR 35
+#define DUK_BIDX_DUKTAPE 36
+#define DUK_BIDX_THREAD_CONSTRUCTOR 37
+#define DUK_BIDX_THREAD_PROTOTYPE 38
+#define DUK_BIDX_BUFFER_CONSTRUCTOR 39
+#define DUK_BIDX_BUFFER_PROTOTYPE 40
+#define DUK_BIDX_POINTER_CONSTRUCTOR 41
+#define DUK_BIDX_POINTER_PROTOTYPE 42
+#define DUK_BIDX_LOGGER_CONSTRUCTOR 43
+#define DUK_BIDX_LOGGER_PROTOTYPE 44
+#define DUK_BIDX_DOUBLE_ERROR 45
+
+#define DUK_NUM_BUILTINS 46
+
+#elif defined(DUK_USE_DOUBLE_ME)
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL const duk_uint8_t duk_strings_data[1943];
+#endif /* !DUK_SINGLE_FILE */
+
+#define DUK_STRDATA_DATA_LENGTH 1943
+#define DUK_STRDATA_MAX_STRLEN 24
+
+#define DUK_STRIDX_UC_LOGGER 0 /* 'Logger' */
+#define DUK_STRIDX_UC_THREAD 1 /* 'Thread' */
+#define DUK_STRIDX_UC_POINTER 2 /* 'Pointer' */
+#define DUK_STRIDX_UC_BUFFER 3 /* 'Buffer' */
+#define DUK_STRIDX_DEC_ENV 4 /* 'DecEnv' */
+#define DUK_STRIDX_OBJ_ENV 5 /* 'ObjEnv' */
+#define DUK_STRIDX_EMPTY_STRING 6 /* '' */
+#define DUK_STRIDX_GLOBAL 7 /* 'global' */
+#define DUK_STRIDX_UC_ARGUMENTS 8 /* 'Arguments' */
+#define DUK_STRIDX_JSON 9 /* 'JSON' */
+#define DUK_STRIDX_MATH 10 /* 'Math' */
+#define DUK_STRIDX_UC_ERROR 11 /* 'Error' */
+#define DUK_STRIDX_REG_EXP 12 /* 'RegExp' */
+#define DUK_STRIDX_DATE 13 /* 'Date' */
+#define DUK_STRIDX_UC_NUMBER 14 /* 'Number' */
+#define DUK_STRIDX_UC_BOOLEAN 15 /* 'Boolean' */
+#define DUK_STRIDX_UC_STRING 16 /* 'String' */
+#define DUK_STRIDX_ARRAY 17 /* 'Array' */
+#define DUK_STRIDX_UC_FUNCTION 18 /* 'Function' */
+#define DUK_STRIDX_UC_OBJECT 19 /* 'Object' */
+#define DUK_STRIDX_UC_NULL 20 /* 'Null' */
+#define DUK_STRIDX_UC_UNDEFINED 21 /* 'Undefined' */
+#define DUK_STRIDX_JSON_EXT_FUNCTION2 22 /* '{_func:true}' */
+#define DUK_STRIDX_JSON_EXT_FUNCTION1 23 /* '{"_func":true}' */
+#define DUK_STRIDX_JSON_EXT_NEGINF 24 /* '{"_ninf":true}' */
+#define DUK_STRIDX_JSON_EXT_POSINF 25 /* '{"_inf":true}' */
+#define DUK_STRIDX_JSON_EXT_NAN 26 /* '{"_nan":true}' */
+#define DUK_STRIDX_JSON_EXT_UNDEFINED 27 /* '{"_undef":true}' */
+#define DUK_STRIDX_TO_LOG_STRING 28 /* 'toLogString' */
+#define DUK_STRIDX_CLOG 29 /* 'clog' */
+#define DUK_STRIDX_LC_L 30 /* 'l' */
+#define DUK_STRIDX_LC_N 31 /* 'n' */
+#define DUK_STRIDX_LC_FATAL 32 /* 'fatal' */
+#define DUK_STRIDX_LC_ERROR 33 /* 'error' */
+#define DUK_STRIDX_LC_WARN 34 /* 'warn' */
+#define DUK_STRIDX_LC_DEBUG 35 /* 'debug' */
+#define DUK_STRIDX_LC_TRACE 36 /* 'trace' */
+#define DUK_STRIDX_RAW 37 /* 'raw' */
+#define DUK_STRIDX_FMT 38 /* 'fmt' */
+#define DUK_STRIDX_CURRENT 39 /* 'current' */
+#define DUK_STRIDX_RESUME 40 /* 'resume' */
+#define DUK_STRIDX_COMPACT 41 /* 'compact' */
+#define DUK_STRIDX_JC 42 /* 'jc' */
+#define DUK_STRIDX_JX 43 /* 'jx' */
+#define DUK_STRIDX_BASE64 44 /* 'base64' */
+#define DUK_STRIDX_HEX 45 /* 'hex' */
+#define DUK_STRIDX_DEC 46 /* 'dec' */
+#define DUK_STRIDX_ENC 47 /* 'enc' */
+#define DUK_STRIDX_FIN 48 /* 'fin' */
+#define DUK_STRIDX_GC 49 /* 'gc' */
+#define DUK_STRIDX_ACT 50 /* 'act' */
+#define DUK_STRIDX_LC_INFO 51 /* 'info' */
+#define DUK_STRIDX_VERSION 52 /* 'version' */
+#define DUK_STRIDX_ENV 53 /* 'env' */
+#define DUK_STRIDX_MOD_LOADED 54 /* 'modLoaded' */
+#define DUK_STRIDX_MOD_SEARCH 55 /* 'modSearch' */
+#define DUK_STRIDX_ERR_THROW 56 /* 'errThrow' */
+#define DUK_STRIDX_ERR_CREATE 57 /* 'errCreate' */
+#define DUK_STRIDX_COMPILE 58 /* 'compile' */
+#define DUK_STRIDX_INT_REGBASE 59 /* '\x00Regbase' */
+#define DUK_STRIDX_INT_THREAD 60 /* '\x00Thread' */
+#define DUK_STRIDX_INT_HANDLER 61 /* '\x00Handler' */
+#define DUK_STRIDX_INT_FINALIZER 62 /* '\x00Finalizer' */
+#define DUK_STRIDX_INT_CALLEE 63 /* '\x00Callee' */
+#define DUK_STRIDX_INT_MAP 64 /* '\x00Map' */
+#define DUK_STRIDX_INT_ARGS 65 /* '\x00Args' */
+#define DUK_STRIDX_INT_THIS 66 /* '\x00This' */
+#define DUK_STRIDX_INT_PC2LINE 67 /* '\x00Pc2line' */
+#define DUK_STRIDX_INT_SOURCE 68 /* '\x00Source' */
+#define DUK_STRIDX_INT_VARENV 69 /* '\x00Varenv' */
+#define DUK_STRIDX_INT_LEXENV 70 /* '\x00Lexenv' */
+#define DUK_STRIDX_INT_VARMAP 71 /* '\x00Varmap' */
+#define DUK_STRIDX_INT_FORMALS 72 /* '\x00Formals' */
+#define DUK_STRIDX_INT_BYTECODE 73 /* '\x00Bytecode' */
+#define DUK_STRIDX_INT_NEXT 74 /* '\x00Next' */
+#define DUK_STRIDX_INT_TARGET 75 /* '\x00Target' */
+#define DUK_STRIDX_INT_VALUE 76 /* '\x00Value' */
+#define DUK_STRIDX_LC_POINTER 77 /* 'pointer' */
+#define DUK_STRIDX_LC_BUFFER 78 /* 'buffer' */
+#define DUK_STRIDX_INT_TRACEDATA 79 /* '\x00Tracedata' */
+#define DUK_STRIDX_LINE_NUMBER 80 /* 'lineNumber' */
+#define DUK_STRIDX_FILE_NAME 81 /* 'fileName' */
+#define DUK_STRIDX_PC 82 /* 'pc' */
+#define DUK_STRIDX_STACK 83 /* 'stack' */
+#define DUK_STRIDX_THROW_TYPE_ERROR 84 /* 'ThrowTypeError' */
+#define DUK_STRIDX_DUKTAPE 85 /* 'Duktape' */
+#define DUK_STRIDX_ID 86 /* 'id' */
+#define DUK_STRIDX_REQUIRE 87 /* 'require' */
+#define DUK_STRIDX___PROTO__ 88 /* '__proto__' */
+#define DUK_STRIDX_SET_PROTOTYPE_OF 89 /* 'setPrototypeOf' */
+#define DUK_STRIDX_OWN_KEYS 90 /* 'ownKeys' */
+#define DUK_STRIDX_ENUMERATE 91 /* 'enumerate' */
+#define DUK_STRIDX_DELETE_PROPERTY 92 /* 'deleteProperty' */
+#define DUK_STRIDX_HAS 93 /* 'has' */
+#define DUK_STRIDX_PROXY 94 /* 'Proxy' */
+#define DUK_STRIDX_CALLEE 95 /* 'callee' */
+#define DUK_STRIDX_INVALID_DATE 96 /* 'Invalid Date' */
+#define DUK_STRIDX_BRACKETED_ELLIPSIS 97 /* '[...]' */
+#define DUK_STRIDX_NEWLINE_TAB 98 /* '\n\t' */
+#define DUK_STRIDX_SPACE 99 /* ' ' */
+#define DUK_STRIDX_COMMA 100 /* ',' */
+#define DUK_STRIDX_MINUS_ZERO 101 /* '-0' */
+#define DUK_STRIDX_PLUS_ZERO 102 /* '+0' */
+#define DUK_STRIDX_ZERO 103 /* '0' */
+#define DUK_STRIDX_MINUS_INFINITY 104 /* '-Infinity' */
+#define DUK_STRIDX_PLUS_INFINITY 105 /* '+Infinity' */
+#define DUK_STRIDX_INFINITY 106 /* 'Infinity' */
+#define DUK_STRIDX_LC_OBJECT 107 /* 'object' */
+#define DUK_STRIDX_LC_STRING 108 /* 'string' */
+#define DUK_STRIDX_LC_NUMBER 109 /* 'number' */
+#define DUK_STRIDX_LC_BOOLEAN 110 /* 'boolean' */
+#define DUK_STRIDX_LC_UNDEFINED 111 /* 'undefined' */
+#define DUK_STRIDX_STRINGIFY 112 /* 'stringify' */
+#define DUK_STRIDX_TAN 113 /* 'tan' */
+#define DUK_STRIDX_SQRT 114 /* 'sqrt' */
+#define DUK_STRIDX_SIN 115 /* 'sin' */
+#define DUK_STRIDX_ROUND 116 /* 'round' */
+#define DUK_STRIDX_RANDOM 117 /* 'random' */
+#define DUK_STRIDX_POW 118 /* 'pow' */
+#define DUK_STRIDX_MIN 119 /* 'min' */
+#define DUK_STRIDX_MAX 120 /* 'max' */
+#define DUK_STRIDX_LOG 121 /* 'log' */
+#define DUK_STRIDX_FLOOR 122 /* 'floor' */
+#define DUK_STRIDX_EXP 123 /* 'exp' */
+#define DUK_STRIDX_COS 124 /* 'cos' */
+#define DUK_STRIDX_CEIL 125 /* 'ceil' */
+#define DUK_STRIDX_ATAN2 126 /* 'atan2' */
+#define DUK_STRIDX_ATAN 127 /* 'atan' */
+#define DUK_STRIDX_ASIN 128 /* 'asin' */
+#define DUK_STRIDX_ACOS 129 /* 'acos' */
+#define DUK_STRIDX_ABS 130 /* 'abs' */
+#define DUK_STRIDX_SQRT2 131 /* 'SQRT2' */
+#define DUK_STRIDX_SQRT1_2 132 /* 'SQRT1_2' */
+#define DUK_STRIDX_PI 133 /* 'PI' */
+#define DUK_STRIDX_LOG10E 134 /* 'LOG10E' */
+#define DUK_STRIDX_LOG2E 135 /* 'LOG2E' */
+#define DUK_STRIDX_LN2 136 /* 'LN2' */
+#define DUK_STRIDX_LN10 137 /* 'LN10' */
+#define DUK_STRIDX_E 138 /* 'E' */
+#define DUK_STRIDX_MESSAGE 139 /* 'message' */
+#define DUK_STRIDX_NAME 140 /* 'name' */
+#define DUK_STRIDX_INPUT 141 /* 'input' */
+#define DUK_STRIDX_INDEX 142 /* 'index' */
+#define DUK_STRIDX_ESCAPED_EMPTY_REGEXP 143 /* '(?:)' */
+#define DUK_STRIDX_LAST_INDEX 144 /* 'lastIndex' */
+#define DUK_STRIDX_MULTILINE 145 /* 'multiline' */
+#define DUK_STRIDX_IGNORE_CASE 146 /* 'ignoreCase' */
+#define DUK_STRIDX_SOURCE 147 /* 'source' */
+#define DUK_STRIDX_TEST 148 /* 'test' */
+#define DUK_STRIDX_EXEC 149 /* 'exec' */
+#define DUK_STRIDX_TO_GMT_STRING 150 /* 'toGMTString' */
+#define DUK_STRIDX_SET_YEAR 151 /* 'setYear' */
+#define DUK_STRIDX_GET_YEAR 152 /* 'getYear' */
+#define DUK_STRIDX_TO_JSON 153 /* 'toJSON' */
+#define DUK_STRIDX_TO_ISO_STRING 154 /* 'toISOString' */
+#define DUK_STRIDX_TO_UTC_STRING 155 /* 'toUTCString' */
+#define DUK_STRIDX_SET_UTC_FULL_YEAR 156 /* 'setUTCFullYear' */
+#define DUK_STRIDX_SET_FULL_YEAR 157 /* 'setFullYear' */
+#define DUK_STRIDX_SET_UTC_MONTH 158 /* 'setUTCMonth' */
+#define DUK_STRIDX_SET_MONTH 159 /* 'setMonth' */
+#define DUK_STRIDX_SET_UTC_DATE 160 /* 'setUTCDate' */
+#define DUK_STRIDX_SET_DATE 161 /* 'setDate' */
+#define DUK_STRIDX_SET_UTC_HOURS 162 /* 'setUTCHours' */
+#define DUK_STRIDX_SET_HOURS 163 /* 'setHours' */
+#define DUK_STRIDX_SET_UTC_MINUTES 164 /* 'setUTCMinutes' */
+#define DUK_STRIDX_SET_MINUTES 165 /* 'setMinutes' */
+#define DUK_STRIDX_SET_UTC_SECONDS 166 /* 'setUTCSeconds' */
+#define DUK_STRIDX_SET_SECONDS 167 /* 'setSeconds' */
+#define DUK_STRIDX_SET_UTC_MILLISECONDS 168 /* 'setUTCMilliseconds' */
+#define DUK_STRIDX_SET_MILLISECONDS 169 /* 'setMilliseconds' */
+#define DUK_STRIDX_SET_TIME 170 /* 'setTime' */
+#define DUK_STRIDX_GET_TIMEZONE_OFFSET 171 /* 'getTimezoneOffset' */
+#define DUK_STRIDX_GET_UTC_MILLISECONDS 172 /* 'getUTCMilliseconds' */
+#define DUK_STRIDX_GET_MILLISECONDS 173 /* 'getMilliseconds' */
+#define DUK_STRIDX_GET_UTC_SECONDS 174 /* 'getUTCSeconds' */
+#define DUK_STRIDX_GET_SECONDS 175 /* 'getSeconds' */
+#define DUK_STRIDX_GET_UTC_MINUTES 176 /* 'getUTCMinutes' */
+#define DUK_STRIDX_GET_MINUTES 177 /* 'getMinutes' */
+#define DUK_STRIDX_GET_UTC_HOURS 178 /* 'getUTCHours' */
+#define DUK_STRIDX_GET_HOURS 179 /* 'getHours' */
+#define DUK_STRIDX_GET_UTC_DAY 180 /* 'getUTCDay' */
+#define DUK_STRIDX_GET_DAY 181 /* 'getDay' */
+#define DUK_STRIDX_GET_UTC_DATE 182 /* 'getUTCDate' */
+#define DUK_STRIDX_GET_DATE 183 /* 'getDate' */
+#define DUK_STRIDX_GET_UTC_MONTH 184 /* 'getUTCMonth' */
+#define DUK_STRIDX_GET_MONTH 185 /* 'getMonth' */
+#define DUK_STRIDX_GET_UTC_FULL_YEAR 186 /* 'getUTCFullYear' */
+#define DUK_STRIDX_GET_FULL_YEAR 187 /* 'getFullYear' */
+#define DUK_STRIDX_GET_TIME 188 /* 'getTime' */
+#define DUK_STRIDX_TO_LOCALE_TIME_STRING 189 /* 'toLocaleTimeString' */
+#define DUK_STRIDX_TO_LOCALE_DATE_STRING 190 /* 'toLocaleDateString' */
+#define DUK_STRIDX_TO_TIME_STRING 191 /* 'toTimeString' */
+#define DUK_STRIDX_TO_DATE_STRING 192 /* 'toDateString' */
+#define DUK_STRIDX_NOW 193 /* 'now' */
+#define DUK_STRIDX_UTC 194 /* 'UTC' */
+#define DUK_STRIDX_PARSE 195 /* 'parse' */
+#define DUK_STRIDX_TO_PRECISION 196 /* 'toPrecision' */
+#define DUK_STRIDX_TO_EXPONENTIAL 197 /* 'toExponential' */
+#define DUK_STRIDX_TO_FIXED 198 /* 'toFixed' */
+#define DUK_STRIDX_POSITIVE_INFINITY 199 /* 'POSITIVE_INFINITY' */
+#define DUK_STRIDX_NEGATIVE_INFINITY 200 /* 'NEGATIVE_INFINITY' */
+#define DUK_STRIDX_NAN 201 /* 'NaN' */
+#define DUK_STRIDX_MIN_VALUE 202 /* 'MIN_VALUE' */
+#define DUK_STRIDX_MAX_VALUE 203 /* 'MAX_VALUE' */
+#define DUK_STRIDX_SUBSTR 204 /* 'substr' */
+#define DUK_STRIDX_TRIM 205 /* 'trim' */
+#define DUK_STRIDX_TO_LOCALE_UPPER_CASE 206 /* 'toLocaleUpperCase' */
+#define DUK_STRIDX_TO_UPPER_CASE 207 /* 'toUpperCase' */
+#define DUK_STRIDX_TO_LOCALE_LOWER_CASE 208 /* 'toLocaleLowerCase' */
+#define DUK_STRIDX_TO_LOWER_CASE 209 /* 'toLowerCase' */
+#define DUK_STRIDX_SUBSTRING 210 /* 'substring' */
+#define DUK_STRIDX_SPLIT 211 /* 'split' */
+#define DUK_STRIDX_SEARCH 212 /* 'search' */
+#define DUK_STRIDX_REPLACE 213 /* 'replace' */
+#define DUK_STRIDX_MATCH 214 /* 'match' */
+#define DUK_STRIDX_LOCALE_COMPARE 215 /* 'localeCompare' */
+#define DUK_STRIDX_CHAR_CODE_AT 216 /* 'charCodeAt' */
+#define DUK_STRIDX_CHAR_AT 217 /* 'charAt' */
+#define DUK_STRIDX_FROM_CHAR_CODE 218 /* 'fromCharCode' */
+#define DUK_STRIDX_REDUCE_RIGHT 219 /* 'reduceRight' */
+#define DUK_STRIDX_REDUCE 220 /* 'reduce' */
+#define DUK_STRIDX_FILTER 221 /* 'filter' */
+#define DUK_STRIDX_MAP 222 /* 'map' */
+#define DUK_STRIDX_FOR_EACH 223 /* 'forEach' */
+#define DUK_STRIDX_SOME 224 /* 'some' */
+#define DUK_STRIDX_EVERY 225 /* 'every' */
+#define DUK_STRIDX_LAST_INDEX_OF 226 /* 'lastIndexOf' */
+#define DUK_STRIDX_INDEX_OF 227 /* 'indexOf' */
+#define DUK_STRIDX_UNSHIFT 228 /* 'unshift' */
+#define DUK_STRIDX_SPLICE 229 /* 'splice' */
+#define DUK_STRIDX_SORT 230 /* 'sort' */
+#define DUK_STRIDX_SLICE 231 /* 'slice' */
+#define DUK_STRIDX_SHIFT 232 /* 'shift' */
+#define DUK_STRIDX_REVERSE 233 /* 'reverse' */
+#define DUK_STRIDX_PUSH 234 /* 'push' */
+#define DUK_STRIDX_POP 235 /* 'pop' */
+#define DUK_STRIDX_JOIN 236 /* 'join' */
+#define DUK_STRIDX_CONCAT 237 /* 'concat' */
+#define DUK_STRIDX_IS_ARRAY 238 /* 'isArray' */
+#define DUK_STRIDX_LC_ARGUMENTS 239 /* 'arguments' */
+#define DUK_STRIDX_CALLER 240 /* 'caller' */
+#define DUK_STRIDX_BIND 241 /* 'bind' */
+#define DUK_STRIDX_CALL 242 /* 'call' */
+#define DUK_STRIDX_APPLY 243 /* 'apply' */
+#define DUK_STRIDX_PROPERTY_IS_ENUMERABLE 244 /* 'propertyIsEnumerable' */
+#define DUK_STRIDX_IS_PROTOTYPE_OF 245 /* 'isPrototypeOf' */
+#define DUK_STRIDX_HAS_OWN_PROPERTY 246 /* 'hasOwnProperty' */
+#define DUK_STRIDX_VALUE_OF 247 /* 'valueOf' */
+#define DUK_STRIDX_TO_LOCALE_STRING 248 /* 'toLocaleString' */
+#define DUK_STRIDX_TO_STRING 249 /* 'toString' */
+#define DUK_STRIDX_CONSTRUCTOR 250 /* 'constructor' */
+#define DUK_STRIDX_SET 251 /* 'set' */
+#define DUK_STRIDX_GET 252 /* 'get' */
+#define DUK_STRIDX_ENUMERABLE 253 /* 'enumerable' */
+#define DUK_STRIDX_CONFIGURABLE 254 /* 'configurable' */
+#define DUK_STRIDX_WRITABLE 255 /* 'writable' */
+#define DUK_STRIDX_VALUE 256 /* 'value' */
+#define DUK_STRIDX_KEYS 257 /* 'keys' */
+#define DUK_STRIDX_IS_EXTENSIBLE 258 /* 'isExtensible' */
+#define DUK_STRIDX_IS_FROZEN 259 /* 'isFrozen' */
+#define DUK_STRIDX_IS_SEALED 260 /* 'isSealed' */
+#define DUK_STRIDX_PREVENT_EXTENSIONS 261 /* 'preventExtensions' */
+#define DUK_STRIDX_FREEZE 262 /* 'freeze' */
+#define DUK_STRIDX_SEAL 263 /* 'seal' */
+#define DUK_STRIDX_DEFINE_PROPERTIES 264 /* 'defineProperties' */
+#define DUK_STRIDX_DEFINE_PROPERTY 265 /* 'defineProperty' */
+#define DUK_STRIDX_CREATE 266 /* 'create' */
+#define DUK_STRIDX_GET_OWN_PROPERTY_NAMES 267 /* 'getOwnPropertyNames' */
+#define DUK_STRIDX_GET_OWN_PROPERTY_DESCRIPTOR 268 /* 'getOwnPropertyDescriptor' */
+#define DUK_STRIDX_GET_PROTOTYPE_OF 269 /* 'getPrototypeOf' */
+#define DUK_STRIDX_PROTOTYPE 270 /* 'prototype' */
+#define DUK_STRIDX_LENGTH 271 /* 'length' */
+#define DUK_STRIDX_ALERT 272 /* 'alert' */
+#define DUK_STRIDX_PRINT 273 /* 'print' */
+#define DUK_STRIDX_UNESCAPE 274 /* 'unescape' */
+#define DUK_STRIDX_ESCAPE 275 /* 'escape' */
+#define DUK_STRIDX_ENCODE_URI_COMPONENT 276 /* 'encodeURIComponent' */
+#define DUK_STRIDX_ENCODE_URI 277 /* 'encodeURI' */
+#define DUK_STRIDX_DECODE_URI_COMPONENT 278 /* 'decodeURIComponent' */
+#define DUK_STRIDX_DECODE_URI 279 /* 'decodeURI' */
+#define DUK_STRIDX_IS_FINITE 280 /* 'isFinite' */
+#define DUK_STRIDX_IS_NAN 281 /* 'isNaN' */
+#define DUK_STRIDX_PARSE_FLOAT 282 /* 'parseFloat' */
+#define DUK_STRIDX_PARSE_INT 283 /* 'parseInt' */
+#define DUK_STRIDX_EVAL 284 /* 'eval' */
+#define DUK_STRIDX_URI_ERROR 285 /* 'URIError' */
+#define DUK_STRIDX_TYPE_ERROR 286 /* 'TypeError' */
+#define DUK_STRIDX_SYNTAX_ERROR 287 /* 'SyntaxError' */
+#define DUK_STRIDX_REFERENCE_ERROR 288 /* 'ReferenceError' */
+#define DUK_STRIDX_RANGE_ERROR 289 /* 'RangeError' */
+#define DUK_STRIDX_EVAL_ERROR 290 /* 'EvalError' */
+#define DUK_STRIDX_BREAK 291 /* 'break' */
+#define DUK_STRIDX_CASE 292 /* 'case' */
+#define DUK_STRIDX_CATCH 293 /* 'catch' */
+#define DUK_STRIDX_CONTINUE 294 /* 'continue' */
+#define DUK_STRIDX_DEBUGGER 295 /* 'debugger' */
+#define DUK_STRIDX_DEFAULT 296 /* 'default' */
+#define DUK_STRIDX_DELETE 297 /* 'delete' */
+#define DUK_STRIDX_DO 298 /* 'do' */
+#define DUK_STRIDX_ELSE 299 /* 'else' */
+#define DUK_STRIDX_FINALLY 300 /* 'finally' */
+#define DUK_STRIDX_FOR 301 /* 'for' */
+#define DUK_STRIDX_LC_FUNCTION 302 /* 'function' */
+#define DUK_STRIDX_IF 303 /* 'if' */
+#define DUK_STRIDX_IN 304 /* 'in' */
+#define DUK_STRIDX_INSTANCEOF 305 /* 'instanceof' */
+#define DUK_STRIDX_NEW 306 /* 'new' */
+#define DUK_STRIDX_RETURN 307 /* 'return' */
+#define DUK_STRIDX_SWITCH 308 /* 'switch' */
+#define DUK_STRIDX_THIS 309 /* 'this' */
+#define DUK_STRIDX_THROW 310 /* 'throw' */
+#define DUK_STRIDX_TRY 311 /* 'try' */
+#define DUK_STRIDX_TYPEOF 312 /* 'typeof' */
+#define DUK_STRIDX_VAR 313 /* 'var' */
+#define DUK_STRIDX_VOID 314 /* 'void' */
+#define DUK_STRIDX_WHILE 315 /* 'while' */
+#define DUK_STRIDX_WITH 316 /* 'with' */
+#define DUK_STRIDX_CLASS 317 /* 'class' */
+#define DUK_STRIDX_CONST 318 /* 'const' */
+#define DUK_STRIDX_ENUM 319 /* 'enum' */
+#define DUK_STRIDX_EXPORT 320 /* 'export' */
+#define DUK_STRIDX_EXTENDS 321 /* 'extends' */
+#define DUK_STRIDX_IMPORT 322 /* 'import' */
+#define DUK_STRIDX_SUPER 323 /* 'super' */
+#define DUK_STRIDX_LC_NULL 324 /* 'null' */
+#define DUK_STRIDX_TRUE 325 /* 'true' */
+#define DUK_STRIDX_FALSE 326 /* 'false' */
+#define DUK_STRIDX_IMPLEMENTS 327 /* 'implements' */
+#define DUK_STRIDX_INTERFACE 328 /* 'interface' */
+#define DUK_STRIDX_LET 329 /* 'let' */
+#define DUK_STRIDX_PACKAGE 330 /* 'package' */
+#define DUK_STRIDX_PRIVATE 331 /* 'private' */
+#define DUK_STRIDX_PROTECTED 332 /* 'protected' */
+#define DUK_STRIDX_PUBLIC 333 /* 'public' */
+#define DUK_STRIDX_STATIC 334 /* 'static' */
+#define DUK_STRIDX_YIELD 335 /* 'yield' */
+
+#define DUK_HEAP_STRING_UC_LOGGER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_LOGGER)
+#define DUK_HTHREAD_STRING_UC_LOGGER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_LOGGER)
+#define DUK_HEAP_STRING_UC_THREAD(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_THREAD)
+#define DUK_HTHREAD_STRING_UC_THREAD(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_THREAD)
+#define DUK_HEAP_STRING_UC_POINTER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_POINTER)
+#define DUK_HTHREAD_STRING_UC_POINTER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_POINTER)
+#define DUK_HEAP_STRING_UC_BUFFER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_BUFFER)
+#define DUK_HTHREAD_STRING_UC_BUFFER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_BUFFER)
+#define DUK_HEAP_STRING_DEC_ENV(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEC_ENV)
+#define DUK_HTHREAD_STRING_DEC_ENV(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEC_ENV)
+#define DUK_HEAP_STRING_OBJ_ENV(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_OBJ_ENV)
+#define DUK_HTHREAD_STRING_OBJ_ENV(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_OBJ_ENV)
+#define DUK_HEAP_STRING_EMPTY_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EMPTY_STRING)
+#define DUK_HTHREAD_STRING_EMPTY_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EMPTY_STRING)
+#define DUK_HEAP_STRING_GLOBAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GLOBAL)
+#define DUK_HTHREAD_STRING_GLOBAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GLOBAL)
+#define DUK_HEAP_STRING_UC_ARGUMENTS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_ARGUMENTS)
+#define DUK_HTHREAD_STRING_UC_ARGUMENTS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_ARGUMENTS)
+#define DUK_HEAP_STRING_JSON(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JSON)
+#define DUK_HTHREAD_STRING_JSON(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JSON)
+#define DUK_HEAP_STRING_MATH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MATH)
+#define DUK_HTHREAD_STRING_MATH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MATH)
+#define DUK_HEAP_STRING_UC_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_ERROR)
+#define DUK_HTHREAD_STRING_UC_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_ERROR)
+#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)
+#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_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_HEAP_STRING_UC_BOOLEAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_BOOLEAN)
+#define DUK_HTHREAD_STRING_UC_BOOLEAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_BOOLEAN)
+#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)
+#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_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_HEAP_STRING_UC_OBJECT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_OBJECT)
+#define DUK_HTHREAD_STRING_UC_OBJECT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_OBJECT)
+#define DUK_HEAP_STRING_UC_NULL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_NULL)
+#define DUK_HTHREAD_STRING_UC_NULL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_NULL)
+#define DUK_HEAP_STRING_UC_UNDEFINED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_UNDEFINED)
+#define DUK_HTHREAD_STRING_UC_UNDEFINED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_UNDEFINED)
+#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_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_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_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_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_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_HEAP_STRING_TO_LOG_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOG_STRING)
+#define DUK_HTHREAD_STRING_TO_LOG_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOG_STRING)
+#define DUK_HEAP_STRING_CLOG(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CLOG)
+#define DUK_HTHREAD_STRING_CLOG(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CLOG)
+#define DUK_HEAP_STRING_LC_L(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_L)
+#define DUK_HTHREAD_STRING_LC_L(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_L)
+#define DUK_HEAP_STRING_LC_N(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_N)
+#define DUK_HTHREAD_STRING_LC_N(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_N)
+#define DUK_HEAP_STRING_LC_FATAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_FATAL)
+#define DUK_HTHREAD_STRING_LC_FATAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_FATAL)
+#define DUK_HEAP_STRING_LC_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_ERROR)
+#define DUK_HTHREAD_STRING_LC_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_ERROR)
+#define DUK_HEAP_STRING_LC_WARN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_WARN)
+#define DUK_HTHREAD_STRING_LC_WARN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_WARN)
+#define DUK_HEAP_STRING_LC_DEBUG(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_DEBUG)
+#define DUK_HTHREAD_STRING_LC_DEBUG(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_DEBUG)
+#define DUK_HEAP_STRING_LC_TRACE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_TRACE)
+#define DUK_HTHREAD_STRING_LC_TRACE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_TRACE)
+#define DUK_HEAP_STRING_RAW(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_RAW)
+#define DUK_HTHREAD_STRING_RAW(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_RAW)
+#define DUK_HEAP_STRING_FMT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FMT)
+#define DUK_HTHREAD_STRING_FMT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FMT)
+#define DUK_HEAP_STRING_CURRENT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CURRENT)
+#define DUK_HTHREAD_STRING_CURRENT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CURRENT)
+#define DUK_HEAP_STRING_RESUME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_RESUME)
+#define DUK_HTHREAD_STRING_RESUME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_RESUME)
+#define DUK_HEAP_STRING_COMPACT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_COMPACT)
+#define DUK_HTHREAD_STRING_COMPACT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_COMPACT)
+#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_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_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_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_HEAP_STRING_DEC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEC)
+#define DUK_HTHREAD_STRING_DEC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEC)
+#define DUK_HEAP_STRING_ENC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENC)
+#define DUK_HTHREAD_STRING_ENC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENC)
+#define DUK_HEAP_STRING_FIN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FIN)
+#define DUK_HTHREAD_STRING_FIN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FIN)
+#define DUK_HEAP_STRING_GC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GC)
+#define DUK_HTHREAD_STRING_GC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GC)
+#define DUK_HEAP_STRING_ACT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ACT)
+#define DUK_HTHREAD_STRING_ACT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ACT)
+#define DUK_HEAP_STRING_LC_INFO(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_INFO)
+#define DUK_HTHREAD_STRING_LC_INFO(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_INFO)
+#define DUK_HEAP_STRING_VERSION(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_VERSION)
+#define DUK_HTHREAD_STRING_VERSION(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_VERSION)
+#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_HEAP_STRING_MOD_LOADED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MOD_LOADED)
+#define DUK_HTHREAD_STRING_MOD_LOADED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MOD_LOADED)
+#define DUK_HEAP_STRING_MOD_SEARCH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MOD_SEARCH)
+#define DUK_HTHREAD_STRING_MOD_SEARCH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MOD_SEARCH)
+#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_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_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_HEAP_STRING_INT_REGBASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_REGBASE)
+#define DUK_HTHREAD_STRING_INT_REGBASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_REGBASE)
+#define DUK_HEAP_STRING_INT_THREAD(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_THREAD)
+#define DUK_HTHREAD_STRING_INT_THREAD(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_THREAD)
+#define DUK_HEAP_STRING_INT_HANDLER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_HANDLER)
+#define DUK_HTHREAD_STRING_INT_HANDLER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_HANDLER)
+#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_HEAP_STRING_INT_CALLEE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_CALLEE)
+#define DUK_HTHREAD_STRING_INT_CALLEE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_CALLEE)
+#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_HEAP_STRING_INT_ARGS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_ARGS)
+#define DUK_HTHREAD_STRING_INT_ARGS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_ARGS)
+#define DUK_HEAP_STRING_INT_THIS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_THIS)
+#define DUK_HTHREAD_STRING_INT_THIS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_THIS)
+#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_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_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_HEAP_STRING_INT_LEXENV(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_LEXENV)
+#define DUK_HTHREAD_STRING_INT_LEXENV(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_LEXENV)
+#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_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_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_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_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_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_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_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_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_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_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_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_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_HEAP_STRING_THROW_TYPE_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_THROW_TYPE_ERROR)
+#define DUK_HTHREAD_STRING_THROW_TYPE_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_THROW_TYPE_ERROR)
+#define DUK_HEAP_STRING_DUKTAPE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DUKTAPE)
+#define DUK_HTHREAD_STRING_DUKTAPE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DUKTAPE)
+#define DUK_HEAP_STRING_ID(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ID)
+#define DUK_HTHREAD_STRING_ID(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ID)
+#define DUK_HEAP_STRING_REQUIRE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REQUIRE)
+#define DUK_HTHREAD_STRING_REQUIRE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REQUIRE)
+#define DUK_HEAP_STRING___PROTO__(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX___PROTO__)
+#define DUK_HTHREAD_STRING___PROTO__(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX___PROTO__)
+#define DUK_HEAP_STRING_SET_PROTOTYPE_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_PROTOTYPE_OF)
+#define DUK_HTHREAD_STRING_SET_PROTOTYPE_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_PROTOTYPE_OF)
+#define DUK_HEAP_STRING_OWN_KEYS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_OWN_KEYS)
+#define DUK_HTHREAD_STRING_OWN_KEYS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_OWN_KEYS)
+#define DUK_HEAP_STRING_ENUMERATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENUMERATE)
+#define DUK_HTHREAD_STRING_ENUMERATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENUMERATE)
+#define DUK_HEAP_STRING_DELETE_PROPERTY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DELETE_PROPERTY)
+#define DUK_HTHREAD_STRING_DELETE_PROPERTY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DELETE_PROPERTY)
+#define DUK_HEAP_STRING_HAS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_HAS)
+#define DUK_HTHREAD_STRING_HAS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_HAS)
+#define DUK_HEAP_STRING_PROXY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PROXY)
+#define DUK_HTHREAD_STRING_PROXY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PROXY)
+#define DUK_HEAP_STRING_CALLEE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CALLEE)
+#define DUK_HTHREAD_STRING_CALLEE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CALLEE)
+#define DUK_HEAP_STRING_INVALID_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INVALID_DATE)
+#define DUK_HTHREAD_STRING_INVALID_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INVALID_DATE)
+#define DUK_HEAP_STRING_BRACKETED_ELLIPSIS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_BRACKETED_ELLIPSIS)
+#define DUK_HTHREAD_STRING_BRACKETED_ELLIPSIS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_BRACKETED_ELLIPSIS)
+#define DUK_HEAP_STRING_NEWLINE_TAB(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NEWLINE_TAB)
+#define DUK_HTHREAD_STRING_NEWLINE_TAB(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NEWLINE_TAB)
+#define DUK_HEAP_STRING_SPACE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SPACE)
+#define DUK_HTHREAD_STRING_SPACE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SPACE)
+#define DUK_HEAP_STRING_COMMA(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_COMMA)
+#define DUK_HTHREAD_STRING_COMMA(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_COMMA)
+#define DUK_HEAP_STRING_MINUS_ZERO(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MINUS_ZERO)
+#define DUK_HTHREAD_STRING_MINUS_ZERO(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MINUS_ZERO)
+#define DUK_HEAP_STRING_PLUS_ZERO(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PLUS_ZERO)
+#define DUK_HTHREAD_STRING_PLUS_ZERO(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PLUS_ZERO)
+#define DUK_HEAP_STRING_ZERO(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ZERO)
+#define DUK_HTHREAD_STRING_ZERO(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ZERO)
+#define DUK_HEAP_STRING_MINUS_INFINITY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MINUS_INFINITY)
+#define DUK_HTHREAD_STRING_MINUS_INFINITY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MINUS_INFINITY)
+#define DUK_HEAP_STRING_PLUS_INFINITY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PLUS_INFINITY)
+#define DUK_HTHREAD_STRING_PLUS_INFINITY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PLUS_INFINITY)
+#define DUK_HEAP_STRING_INFINITY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INFINITY)
+#define DUK_HTHREAD_STRING_INFINITY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INFINITY)
+#define DUK_HEAP_STRING_LC_OBJECT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_OBJECT)
+#define DUK_HTHREAD_STRING_LC_OBJECT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_OBJECT)
+#define DUK_HEAP_STRING_LC_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_STRING)
+#define DUK_HTHREAD_STRING_LC_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_STRING)
+#define DUK_HEAP_STRING_LC_NUMBER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_NUMBER)
+#define DUK_HTHREAD_STRING_LC_NUMBER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_NUMBER)
+#define DUK_HEAP_STRING_LC_BOOLEAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_BOOLEAN)
+#define DUK_HTHREAD_STRING_LC_BOOLEAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_BOOLEAN)
+#define DUK_HEAP_STRING_LC_UNDEFINED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_UNDEFINED)
+#define DUK_HTHREAD_STRING_LC_UNDEFINED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_UNDEFINED)
+#define DUK_HEAP_STRING_STRINGIFY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_STRINGIFY)
+#define DUK_HTHREAD_STRING_STRINGIFY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_STRINGIFY)
+#define DUK_HEAP_STRING_TAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TAN)
+#define DUK_HTHREAD_STRING_TAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TAN)
+#define DUK_HEAP_STRING_SQRT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SQRT)
+#define DUK_HTHREAD_STRING_SQRT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SQRT)
+#define DUK_HEAP_STRING_SIN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SIN)
+#define DUK_HTHREAD_STRING_SIN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SIN)
+#define DUK_HEAP_STRING_ROUND(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ROUND)
+#define DUK_HTHREAD_STRING_ROUND(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ROUND)
+#define DUK_HEAP_STRING_RANDOM(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_RANDOM)
+#define DUK_HTHREAD_STRING_RANDOM(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_RANDOM)
+#define DUK_HEAP_STRING_POW(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_POW)
+#define DUK_HTHREAD_STRING_POW(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_POW)
+#define DUK_HEAP_STRING_MIN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MIN)
+#define DUK_HTHREAD_STRING_MIN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MIN)
+#define DUK_HEAP_STRING_MAX(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MAX)
+#define DUK_HTHREAD_STRING_MAX(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MAX)
+#define DUK_HEAP_STRING_LOG(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LOG)
+#define DUK_HTHREAD_STRING_LOG(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LOG)
+#define DUK_HEAP_STRING_FLOOR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FLOOR)
+#define DUK_HTHREAD_STRING_FLOOR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FLOOR)
+#define DUK_HEAP_STRING_EXP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EXP)
+#define DUK_HTHREAD_STRING_EXP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EXP)
+#define DUK_HEAP_STRING_COS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_COS)
+#define DUK_HTHREAD_STRING_COS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_COS)
+#define DUK_HEAP_STRING_CEIL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CEIL)
+#define DUK_HTHREAD_STRING_CEIL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CEIL)
+#define DUK_HEAP_STRING_ATAN2(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ATAN2)
+#define DUK_HTHREAD_STRING_ATAN2(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ATAN2)
+#define DUK_HEAP_STRING_ATAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ATAN)
+#define DUK_HTHREAD_STRING_ATAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ATAN)
+#define DUK_HEAP_STRING_ASIN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ASIN)
+#define DUK_HTHREAD_STRING_ASIN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ASIN)
+#define DUK_HEAP_STRING_ACOS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ACOS)
+#define DUK_HTHREAD_STRING_ACOS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ACOS)
+#define DUK_HEAP_STRING_ABS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ABS)
+#define DUK_HTHREAD_STRING_ABS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ABS)
+#define DUK_HEAP_STRING_SQRT2(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SQRT2)
+#define DUK_HTHREAD_STRING_SQRT2(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SQRT2)
+#define DUK_HEAP_STRING_SQRT1_2(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SQRT1_2)
+#define DUK_HTHREAD_STRING_SQRT1_2(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SQRT1_2)
+#define DUK_HEAP_STRING_PI(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PI)
+#define DUK_HTHREAD_STRING_PI(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PI)
+#define DUK_HEAP_STRING_LOG10E(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LOG10E)
+#define DUK_HTHREAD_STRING_LOG10E(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LOG10E)
+#define DUK_HEAP_STRING_LOG2E(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LOG2E)
+#define DUK_HTHREAD_STRING_LOG2E(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LOG2E)
+#define DUK_HEAP_STRING_LN2(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LN2)
+#define DUK_HTHREAD_STRING_LN2(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LN2)
+#define DUK_HEAP_STRING_LN10(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LN10)
+#define DUK_HTHREAD_STRING_LN10(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LN10)
+#define DUK_HEAP_STRING_E(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_E)
+#define DUK_HTHREAD_STRING_E(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_E)
+#define DUK_HEAP_STRING_MESSAGE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MESSAGE)
+#define DUK_HTHREAD_STRING_MESSAGE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MESSAGE)
+#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_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_HEAP_STRING_INDEX(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INDEX)
+#define DUK_HTHREAD_STRING_INDEX(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INDEX)
+#define DUK_HEAP_STRING_ESCAPED_EMPTY_REGEXP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ESCAPED_EMPTY_REGEXP)
+#define DUK_HTHREAD_STRING_ESCAPED_EMPTY_REGEXP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ESCAPED_EMPTY_REGEXP)
+#define DUK_HEAP_STRING_LAST_INDEX(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LAST_INDEX)
+#define DUK_HTHREAD_STRING_LAST_INDEX(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LAST_INDEX)
+#define DUK_HEAP_STRING_MULTILINE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MULTILINE)
+#define DUK_HTHREAD_STRING_MULTILINE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MULTILINE)
+#define DUK_HEAP_STRING_IGNORE_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IGNORE_CASE)
+#define DUK_HTHREAD_STRING_IGNORE_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IGNORE_CASE)
+#define DUK_HEAP_STRING_SOURCE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SOURCE)
+#define DUK_HTHREAD_STRING_SOURCE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SOURCE)
+#define DUK_HEAP_STRING_TEST(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TEST)
+#define DUK_HTHREAD_STRING_TEST(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TEST)
+#define DUK_HEAP_STRING_EXEC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EXEC)
+#define DUK_HTHREAD_STRING_EXEC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EXEC)
+#define DUK_HEAP_STRING_TO_GMT_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_GMT_STRING)
+#define DUK_HTHREAD_STRING_TO_GMT_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_GMT_STRING)
+#define DUK_HEAP_STRING_SET_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_YEAR)
+#define DUK_HTHREAD_STRING_SET_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_YEAR)
+#define DUK_HEAP_STRING_GET_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_YEAR)
+#define DUK_HTHREAD_STRING_GET_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_YEAR)
+#define DUK_HEAP_STRING_TO_JSON(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_JSON)
+#define DUK_HTHREAD_STRING_TO_JSON(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_JSON)
+#define DUK_HEAP_STRING_TO_ISO_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_ISO_STRING)
+#define DUK_HTHREAD_STRING_TO_ISO_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_ISO_STRING)
+#define DUK_HEAP_STRING_TO_UTC_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_UTC_STRING)
+#define DUK_HTHREAD_STRING_TO_UTC_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_UTC_STRING)
+#define DUK_HEAP_STRING_SET_UTC_FULL_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_FULL_YEAR)
+#define DUK_HTHREAD_STRING_SET_UTC_FULL_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_FULL_YEAR)
+#define DUK_HEAP_STRING_SET_FULL_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_FULL_YEAR)
+#define DUK_HTHREAD_STRING_SET_FULL_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_FULL_YEAR)
+#define DUK_HEAP_STRING_SET_UTC_MONTH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_MONTH)
+#define DUK_HTHREAD_STRING_SET_UTC_MONTH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_MONTH)
+#define DUK_HEAP_STRING_SET_MONTH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_MONTH)
+#define DUK_HTHREAD_STRING_SET_MONTH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_MONTH)
+#define DUK_HEAP_STRING_SET_UTC_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_DATE)
+#define DUK_HTHREAD_STRING_SET_UTC_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_DATE)
+#define DUK_HEAP_STRING_SET_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_DATE)
+#define DUK_HTHREAD_STRING_SET_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_DATE)
+#define DUK_HEAP_STRING_SET_UTC_HOURS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_HOURS)
+#define DUK_HTHREAD_STRING_SET_UTC_HOURS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_HOURS)
+#define DUK_HEAP_STRING_SET_HOURS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_HOURS)
+#define DUK_HTHREAD_STRING_SET_HOURS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_HOURS)
+#define DUK_HEAP_STRING_SET_UTC_MINUTES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_MINUTES)
+#define DUK_HTHREAD_STRING_SET_UTC_MINUTES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_MINUTES)
+#define DUK_HEAP_STRING_SET_MINUTES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_MINUTES)
+#define DUK_HTHREAD_STRING_SET_MINUTES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_MINUTES)
+#define DUK_HEAP_STRING_SET_UTC_SECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_SECONDS)
+#define DUK_HTHREAD_STRING_SET_UTC_SECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_SECONDS)
+#define DUK_HEAP_STRING_SET_SECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_SECONDS)
+#define DUK_HTHREAD_STRING_SET_SECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_SECONDS)
+#define DUK_HEAP_STRING_SET_UTC_MILLISECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_UTC_MILLISECONDS)
+#define DUK_HTHREAD_STRING_SET_UTC_MILLISECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_UTC_MILLISECONDS)
+#define DUK_HEAP_STRING_SET_MILLISECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_MILLISECONDS)
+#define DUK_HTHREAD_STRING_SET_MILLISECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_MILLISECONDS)
+#define DUK_HEAP_STRING_SET_TIME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_TIME)
+#define DUK_HTHREAD_STRING_SET_TIME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_TIME)
+#define DUK_HEAP_STRING_GET_TIMEZONE_OFFSET(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_TIMEZONE_OFFSET)
+#define DUK_HTHREAD_STRING_GET_TIMEZONE_OFFSET(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_TIMEZONE_OFFSET)
+#define DUK_HEAP_STRING_GET_UTC_MILLISECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_MILLISECONDS)
+#define DUK_HTHREAD_STRING_GET_UTC_MILLISECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_MILLISECONDS)
+#define DUK_HEAP_STRING_GET_MILLISECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_MILLISECONDS)
+#define DUK_HTHREAD_STRING_GET_MILLISECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_MILLISECONDS)
+#define DUK_HEAP_STRING_GET_UTC_SECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_SECONDS)
+#define DUK_HTHREAD_STRING_GET_UTC_SECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_SECONDS)
+#define DUK_HEAP_STRING_GET_SECONDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_SECONDS)
+#define DUK_HTHREAD_STRING_GET_SECONDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_SECONDS)
+#define DUK_HEAP_STRING_GET_UTC_MINUTES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_MINUTES)
+#define DUK_HTHREAD_STRING_GET_UTC_MINUTES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_MINUTES)
+#define DUK_HEAP_STRING_GET_MINUTES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_MINUTES)
+#define DUK_HTHREAD_STRING_GET_MINUTES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_MINUTES)
+#define DUK_HEAP_STRING_GET_UTC_HOURS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_HOURS)
+#define DUK_HTHREAD_STRING_GET_UTC_HOURS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_HOURS)
+#define DUK_HEAP_STRING_GET_HOURS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_HOURS)
+#define DUK_HTHREAD_STRING_GET_HOURS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_HOURS)
+#define DUK_HEAP_STRING_GET_UTC_DAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_DAY)
+#define DUK_HTHREAD_STRING_GET_UTC_DAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_DAY)
+#define DUK_HEAP_STRING_GET_DAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_DAY)
+#define DUK_HTHREAD_STRING_GET_DAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_DAY)
+#define DUK_HEAP_STRING_GET_UTC_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_DATE)
+#define DUK_HTHREAD_STRING_GET_UTC_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_DATE)
+#define DUK_HEAP_STRING_GET_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_DATE)
+#define DUK_HTHREAD_STRING_GET_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_DATE)
+#define DUK_HEAP_STRING_GET_UTC_MONTH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_MONTH)
+#define DUK_HTHREAD_STRING_GET_UTC_MONTH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_MONTH)
+#define DUK_HEAP_STRING_GET_MONTH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_MONTH)
+#define DUK_HTHREAD_STRING_GET_MONTH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_MONTH)
+#define DUK_HEAP_STRING_GET_UTC_FULL_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_UTC_FULL_YEAR)
+#define DUK_HTHREAD_STRING_GET_UTC_FULL_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_UTC_FULL_YEAR)
+#define DUK_HEAP_STRING_GET_FULL_YEAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_FULL_YEAR)
+#define DUK_HTHREAD_STRING_GET_FULL_YEAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_FULL_YEAR)
+#define DUK_HEAP_STRING_GET_TIME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_TIME)
+#define DUK_HTHREAD_STRING_GET_TIME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_TIME)
+#define DUK_HEAP_STRING_TO_LOCALE_TIME_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOCALE_TIME_STRING)
+#define DUK_HTHREAD_STRING_TO_LOCALE_TIME_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOCALE_TIME_STRING)
+#define DUK_HEAP_STRING_TO_LOCALE_DATE_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOCALE_DATE_STRING)
+#define DUK_HTHREAD_STRING_TO_LOCALE_DATE_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOCALE_DATE_STRING)
+#define DUK_HEAP_STRING_TO_TIME_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_TIME_STRING)
+#define DUK_HTHREAD_STRING_TO_TIME_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_TIME_STRING)
+#define DUK_HEAP_STRING_TO_DATE_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_DATE_STRING)
+#define DUK_HTHREAD_STRING_TO_DATE_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_DATE_STRING)
+#define DUK_HEAP_STRING_NOW(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NOW)
+#define DUK_HTHREAD_STRING_NOW(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NOW)
+#define DUK_HEAP_STRING_UTC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UTC)
+#define DUK_HTHREAD_STRING_UTC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UTC)
+#define DUK_HEAP_STRING_PARSE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PARSE)
+#define DUK_HTHREAD_STRING_PARSE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PARSE)
+#define DUK_HEAP_STRING_TO_PRECISION(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_PRECISION)
+#define DUK_HTHREAD_STRING_TO_PRECISION(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_PRECISION)
+#define DUK_HEAP_STRING_TO_EXPONENTIAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_EXPONENTIAL)
+#define DUK_HTHREAD_STRING_TO_EXPONENTIAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_EXPONENTIAL)
+#define DUK_HEAP_STRING_TO_FIXED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_FIXED)
+#define DUK_HTHREAD_STRING_TO_FIXED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_FIXED)
+#define DUK_HEAP_STRING_POSITIVE_INFINITY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_POSITIVE_INFINITY)
+#define DUK_HTHREAD_STRING_POSITIVE_INFINITY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_POSITIVE_INFINITY)
+#define DUK_HEAP_STRING_NEGATIVE_INFINITY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NEGATIVE_INFINITY)
+#define DUK_HTHREAD_STRING_NEGATIVE_INFINITY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NEGATIVE_INFINITY)
+#define DUK_HEAP_STRING_NAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NAN)
+#define DUK_HTHREAD_STRING_NAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NAN)
+#define DUK_HEAP_STRING_MIN_VALUE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MIN_VALUE)
+#define DUK_HTHREAD_STRING_MIN_VALUE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MIN_VALUE)
+#define DUK_HEAP_STRING_MAX_VALUE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MAX_VALUE)
+#define DUK_HTHREAD_STRING_MAX_VALUE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MAX_VALUE)
+#define DUK_HEAP_STRING_SUBSTR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SUBSTR)
+#define DUK_HTHREAD_STRING_SUBSTR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SUBSTR)
+#define DUK_HEAP_STRING_TRIM(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TRIM)
+#define DUK_HTHREAD_STRING_TRIM(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TRIM)
+#define DUK_HEAP_STRING_TO_LOCALE_UPPER_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOCALE_UPPER_CASE)
+#define DUK_HTHREAD_STRING_TO_LOCALE_UPPER_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOCALE_UPPER_CASE)
+#define DUK_HEAP_STRING_TO_UPPER_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_UPPER_CASE)
+#define DUK_HTHREAD_STRING_TO_UPPER_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_UPPER_CASE)
+#define DUK_HEAP_STRING_TO_LOCALE_LOWER_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOCALE_LOWER_CASE)
+#define DUK_HTHREAD_STRING_TO_LOCALE_LOWER_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOCALE_LOWER_CASE)
+#define DUK_HEAP_STRING_TO_LOWER_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOWER_CASE)
+#define DUK_HTHREAD_STRING_TO_LOWER_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOWER_CASE)
+#define DUK_HEAP_STRING_SUBSTRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SUBSTRING)
+#define DUK_HTHREAD_STRING_SUBSTRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SUBSTRING)
+#define DUK_HEAP_STRING_SPLIT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SPLIT)
+#define DUK_HTHREAD_STRING_SPLIT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SPLIT)
+#define DUK_HEAP_STRING_SEARCH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SEARCH)
+#define DUK_HTHREAD_STRING_SEARCH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SEARCH)
+#define DUK_HEAP_STRING_REPLACE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REPLACE)
+#define DUK_HTHREAD_STRING_REPLACE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REPLACE)
+#define DUK_HEAP_STRING_MATCH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MATCH)
+#define DUK_HTHREAD_STRING_MATCH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MATCH)
+#define DUK_HEAP_STRING_LOCALE_COMPARE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LOCALE_COMPARE)
+#define DUK_HTHREAD_STRING_LOCALE_COMPARE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LOCALE_COMPARE)
+#define DUK_HEAP_STRING_CHAR_CODE_AT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CHAR_CODE_AT)
+#define DUK_HTHREAD_STRING_CHAR_CODE_AT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CHAR_CODE_AT)
+#define DUK_HEAP_STRING_CHAR_AT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CHAR_AT)
+#define DUK_HTHREAD_STRING_CHAR_AT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CHAR_AT)
+#define DUK_HEAP_STRING_FROM_CHAR_CODE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FROM_CHAR_CODE)
+#define DUK_HTHREAD_STRING_FROM_CHAR_CODE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FROM_CHAR_CODE)
+#define DUK_HEAP_STRING_REDUCE_RIGHT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REDUCE_RIGHT)
+#define DUK_HTHREAD_STRING_REDUCE_RIGHT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REDUCE_RIGHT)
+#define DUK_HEAP_STRING_REDUCE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REDUCE)
+#define DUK_HTHREAD_STRING_REDUCE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REDUCE)
+#define DUK_HEAP_STRING_FILTER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FILTER)
+#define DUK_HTHREAD_STRING_FILTER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FILTER)
+#define DUK_HEAP_STRING_MAP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MAP)
+#define DUK_HTHREAD_STRING_MAP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MAP)
+#define DUK_HEAP_STRING_FOR_EACH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FOR_EACH)
+#define DUK_HTHREAD_STRING_FOR_EACH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FOR_EACH)
+#define DUK_HEAP_STRING_SOME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SOME)
+#define DUK_HTHREAD_STRING_SOME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SOME)
+#define DUK_HEAP_STRING_EVERY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EVERY)
+#define DUK_HTHREAD_STRING_EVERY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EVERY)
+#define DUK_HEAP_STRING_LAST_INDEX_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LAST_INDEX_OF)
+#define DUK_HTHREAD_STRING_LAST_INDEX_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LAST_INDEX_OF)
+#define DUK_HEAP_STRING_INDEX_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INDEX_OF)
+#define DUK_HTHREAD_STRING_INDEX_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INDEX_OF)
+#define DUK_HEAP_STRING_UNSHIFT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UNSHIFT)
+#define DUK_HTHREAD_STRING_UNSHIFT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UNSHIFT)
+#define DUK_HEAP_STRING_SPLICE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SPLICE)
+#define DUK_HTHREAD_STRING_SPLICE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SPLICE)
+#define DUK_HEAP_STRING_SORT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SORT)
+#define DUK_HTHREAD_STRING_SORT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SORT)
+#define DUK_HEAP_STRING_SLICE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SLICE)
+#define DUK_HTHREAD_STRING_SLICE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SLICE)
+#define DUK_HEAP_STRING_SHIFT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SHIFT)
+#define DUK_HTHREAD_STRING_SHIFT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SHIFT)
+#define DUK_HEAP_STRING_REVERSE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REVERSE)
+#define DUK_HTHREAD_STRING_REVERSE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REVERSE)
+#define DUK_HEAP_STRING_PUSH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PUSH)
+#define DUK_HTHREAD_STRING_PUSH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PUSH)
+#define DUK_HEAP_STRING_POP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_POP)
+#define DUK_HTHREAD_STRING_POP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_POP)
+#define DUK_HEAP_STRING_JOIN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JOIN)
+#define DUK_HTHREAD_STRING_JOIN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JOIN)
+#define DUK_HEAP_STRING_CONCAT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CONCAT)
+#define DUK_HTHREAD_STRING_CONCAT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CONCAT)
+#define DUK_HEAP_STRING_IS_ARRAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_ARRAY)
+#define DUK_HTHREAD_STRING_IS_ARRAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_ARRAY)
+#define DUK_HEAP_STRING_LC_ARGUMENTS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_ARGUMENTS)
+#define DUK_HTHREAD_STRING_LC_ARGUMENTS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_ARGUMENTS)
+#define DUK_HEAP_STRING_CALLER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CALLER)
+#define DUK_HTHREAD_STRING_CALLER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CALLER)
+#define DUK_HEAP_STRING_BIND(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_BIND)
+#define DUK_HTHREAD_STRING_BIND(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_BIND)
+#define DUK_HEAP_STRING_CALL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CALL)
+#define DUK_HTHREAD_STRING_CALL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CALL)
+#define DUK_HEAP_STRING_APPLY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_APPLY)
+#define DUK_HTHREAD_STRING_APPLY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_APPLY)
+#define DUK_HEAP_STRING_PROPERTY_IS_ENUMERABLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PROPERTY_IS_ENUMERABLE)
+#define DUK_HTHREAD_STRING_PROPERTY_IS_ENUMERABLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PROPERTY_IS_ENUMERABLE)
+#define DUK_HEAP_STRING_IS_PROTOTYPE_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_PROTOTYPE_OF)
+#define DUK_HTHREAD_STRING_IS_PROTOTYPE_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_PROTOTYPE_OF)
+#define DUK_HEAP_STRING_HAS_OWN_PROPERTY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_HAS_OWN_PROPERTY)
+#define DUK_HTHREAD_STRING_HAS_OWN_PROPERTY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_HAS_OWN_PROPERTY)
+#define DUK_HEAP_STRING_VALUE_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_VALUE_OF)
+#define DUK_HTHREAD_STRING_VALUE_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_VALUE_OF)
+#define DUK_HEAP_STRING_TO_LOCALE_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOCALE_STRING)
+#define DUK_HTHREAD_STRING_TO_LOCALE_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOCALE_STRING)
+#define DUK_HEAP_STRING_TO_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_STRING)
+#define DUK_HTHREAD_STRING_TO_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_STRING)
+#define DUK_HEAP_STRING_CONSTRUCTOR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CONSTRUCTOR)
+#define DUK_HTHREAD_STRING_CONSTRUCTOR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CONSTRUCTOR)
+#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_HEAP_STRING_GET(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET)
+#define DUK_HTHREAD_STRING_GET(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET)
+#define DUK_HEAP_STRING_ENUMERABLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENUMERABLE)
+#define DUK_HTHREAD_STRING_ENUMERABLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENUMERABLE)
+#define DUK_HEAP_STRING_CONFIGURABLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CONFIGURABLE)
+#define DUK_HTHREAD_STRING_CONFIGURABLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CONFIGURABLE)
+#define DUK_HEAP_STRING_WRITABLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_WRITABLE)
+#define DUK_HTHREAD_STRING_WRITABLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_WRITABLE)
+#define DUK_HEAP_STRING_VALUE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_VALUE)
+#define DUK_HTHREAD_STRING_VALUE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_VALUE)
+#define DUK_HEAP_STRING_KEYS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_KEYS)
+#define DUK_HTHREAD_STRING_KEYS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_KEYS)
+#define DUK_HEAP_STRING_IS_EXTENSIBLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_EXTENSIBLE)
+#define DUK_HTHREAD_STRING_IS_EXTENSIBLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_EXTENSIBLE)
+#define DUK_HEAP_STRING_IS_FROZEN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_FROZEN)
+#define DUK_HTHREAD_STRING_IS_FROZEN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_FROZEN)
+#define DUK_HEAP_STRING_IS_SEALED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_SEALED)
+#define DUK_HTHREAD_STRING_IS_SEALED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_SEALED)
+#define DUK_HEAP_STRING_PREVENT_EXTENSIONS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PREVENT_EXTENSIONS)
+#define DUK_HTHREAD_STRING_PREVENT_EXTENSIONS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PREVENT_EXTENSIONS)
+#define DUK_HEAP_STRING_FREEZE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FREEZE)
+#define DUK_HTHREAD_STRING_FREEZE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FREEZE)
+#define DUK_HEAP_STRING_SEAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SEAL)
+#define DUK_HTHREAD_STRING_SEAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SEAL)
+#define DUK_HEAP_STRING_DEFINE_PROPERTIES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEFINE_PROPERTIES)
+#define DUK_HTHREAD_STRING_DEFINE_PROPERTIES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEFINE_PROPERTIES)
+#define DUK_HEAP_STRING_DEFINE_PROPERTY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEFINE_PROPERTY)
+#define DUK_HTHREAD_STRING_DEFINE_PROPERTY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEFINE_PROPERTY)
+#define DUK_HEAP_STRING_CREATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CREATE)
+#define DUK_HTHREAD_STRING_CREATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CREATE)
+#define DUK_HEAP_STRING_GET_OWN_PROPERTY_NAMES(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_OWN_PROPERTY_NAMES)
+#define DUK_HTHREAD_STRING_GET_OWN_PROPERTY_NAMES(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_OWN_PROPERTY_NAMES)
+#define DUK_HEAP_STRING_GET_OWN_PROPERTY_DESCRIPTOR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_OWN_PROPERTY_DESCRIPTOR)
+#define DUK_HTHREAD_STRING_GET_OWN_PROPERTY_DESCRIPTOR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_OWN_PROPERTY_DESCRIPTOR)
+#define DUK_HEAP_STRING_GET_PROTOTYPE_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET_PROTOTYPE_OF)
+#define DUK_HTHREAD_STRING_GET_PROTOTYPE_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET_PROTOTYPE_OF)
+#define DUK_HEAP_STRING_PROTOTYPE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PROTOTYPE)
+#define DUK_HTHREAD_STRING_PROTOTYPE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PROTOTYPE)
+#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_HEAP_STRING_ALERT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ALERT)
+#define DUK_HTHREAD_STRING_ALERT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ALERT)
+#define DUK_HEAP_STRING_PRINT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PRINT)
+#define DUK_HTHREAD_STRING_PRINT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PRINT)
+#define DUK_HEAP_STRING_UNESCAPE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UNESCAPE)
+#define DUK_HTHREAD_STRING_UNESCAPE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UNESCAPE)
+#define DUK_HEAP_STRING_ESCAPE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ESCAPE)
+#define DUK_HTHREAD_STRING_ESCAPE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ESCAPE)
+#define DUK_HEAP_STRING_ENCODE_URI_COMPONENT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENCODE_URI_COMPONENT)
+#define DUK_HTHREAD_STRING_ENCODE_URI_COMPONENT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENCODE_URI_COMPONENT)
+#define DUK_HEAP_STRING_ENCODE_URI(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENCODE_URI)
+#define DUK_HTHREAD_STRING_ENCODE_URI(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENCODE_URI)
+#define DUK_HEAP_STRING_DECODE_URI_COMPONENT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DECODE_URI_COMPONENT)
+#define DUK_HTHREAD_STRING_DECODE_URI_COMPONENT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DECODE_URI_COMPONENT)
+#define DUK_HEAP_STRING_DECODE_URI(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DECODE_URI)
+#define DUK_HTHREAD_STRING_DECODE_URI(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DECODE_URI)
+#define DUK_HEAP_STRING_IS_FINITE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_FINITE)
+#define DUK_HTHREAD_STRING_IS_FINITE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_FINITE)
+#define DUK_HEAP_STRING_IS_NAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IS_NAN)
+#define DUK_HTHREAD_STRING_IS_NAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IS_NAN)
+#define DUK_HEAP_STRING_PARSE_FLOAT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PARSE_FLOAT)
+#define DUK_HTHREAD_STRING_PARSE_FLOAT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PARSE_FLOAT)
+#define DUK_HEAP_STRING_PARSE_INT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PARSE_INT)
+#define DUK_HTHREAD_STRING_PARSE_INT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PARSE_INT)
+#define DUK_HEAP_STRING_EVAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EVAL)
+#define DUK_HTHREAD_STRING_EVAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EVAL)
+#define DUK_HEAP_STRING_URI_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_URI_ERROR)
+#define DUK_HTHREAD_STRING_URI_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_URI_ERROR)
+#define DUK_HEAP_STRING_TYPE_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TYPE_ERROR)
+#define DUK_HTHREAD_STRING_TYPE_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TYPE_ERROR)
+#define DUK_HEAP_STRING_SYNTAX_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SYNTAX_ERROR)
+#define DUK_HTHREAD_STRING_SYNTAX_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SYNTAX_ERROR)
+#define DUK_HEAP_STRING_REFERENCE_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REFERENCE_ERROR)
+#define DUK_HTHREAD_STRING_REFERENCE_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REFERENCE_ERROR)
+#define DUK_HEAP_STRING_RANGE_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_RANGE_ERROR)
+#define DUK_HTHREAD_STRING_RANGE_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_RANGE_ERROR)
+#define DUK_HEAP_STRING_EVAL_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EVAL_ERROR)
+#define DUK_HTHREAD_STRING_EVAL_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EVAL_ERROR)
+#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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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 336
+
+#define DUK_STRIDX_START_RESERVED 291
+#define DUK_STRIDX_START_STRICT_RESERVED 327
+#define DUK_STRIDX_END_RESERVED 336 /* exclusive endpoint */
+
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL const duk_c_function duk_bi_native_functions[128];
+DUK_INTERNAL_DECL const duk_uint8_t duk_builtins_data[1341];
+#ifdef DUK_USE_BUILTIN_INITJS
+DUK_INTERNAL_DECL const duk_uint8_t duk_initjs_data[187];
+#endif /* DUK_USE_BUILTIN_INITJS */
+#endif /* !DUK_SINGLE_FILE */
+
+#define DUK_BUILTINS_DATA_LENGTH 1341
+#ifdef DUK_USE_BUILTIN_INITJS
+#define DUK_BUILTIN_INITJS_DATA_LENGTH 187
+#endif /* DUK_USE_BUILTIN_INITJS */
+
+#define DUK_BIDX_GLOBAL 0
+#define DUK_BIDX_GLOBAL_ENV 1
+#define DUK_BIDX_OBJECT_CONSTRUCTOR 2
+#define DUK_BIDX_OBJECT_PROTOTYPE 3
+#define DUK_BIDX_FUNCTION_CONSTRUCTOR 4
+#define DUK_BIDX_FUNCTION_PROTOTYPE 5
+#define DUK_BIDX_ARRAY_CONSTRUCTOR 6
+#define DUK_BIDX_ARRAY_PROTOTYPE 7
+#define DUK_BIDX_STRING_CONSTRUCTOR 8
+#define DUK_BIDX_STRING_PROTOTYPE 9
+#define DUK_BIDX_BOOLEAN_CONSTRUCTOR 10
+#define DUK_BIDX_BOOLEAN_PROTOTYPE 11
+#define DUK_BIDX_NUMBER_CONSTRUCTOR 12
+#define DUK_BIDX_NUMBER_PROTOTYPE 13
+#define DUK_BIDX_DATE_CONSTRUCTOR 14
+#define DUK_BIDX_DATE_PROTOTYPE 15
+#define DUK_BIDX_REGEXP_CONSTRUCTOR 16
+#define DUK_BIDX_REGEXP_PROTOTYPE 17
+#define DUK_BIDX_ERROR_CONSTRUCTOR 18
+#define DUK_BIDX_ERROR_PROTOTYPE 19
+#define DUK_BIDX_EVAL_ERROR_CONSTRUCTOR 20
+#define DUK_BIDX_EVAL_ERROR_PROTOTYPE 21
+#define DUK_BIDX_RANGE_ERROR_CONSTRUCTOR 22
+#define DUK_BIDX_RANGE_ERROR_PROTOTYPE 23
+#define DUK_BIDX_REFERENCE_ERROR_CONSTRUCTOR 24
+#define DUK_BIDX_REFERENCE_ERROR_PROTOTYPE 25
+#define DUK_BIDX_SYNTAX_ERROR_CONSTRUCTOR 26
+#define DUK_BIDX_SYNTAX_ERROR_PROTOTYPE 27
+#define DUK_BIDX_TYPE_ERROR_CONSTRUCTOR 28
+#define DUK_BIDX_TYPE_ERROR_PROTOTYPE 29
+#define DUK_BIDX_URI_ERROR_CONSTRUCTOR 30
+#define DUK_BIDX_URI_ERROR_PROTOTYPE 31
+#define DUK_BIDX_MATH 32
+#define DUK_BIDX_JSON 33
+#define DUK_BIDX_TYPE_ERROR_THROWER 34
+#define DUK_BIDX_PROXY_CONSTRUCTOR 35
+#define DUK_BIDX_DUKTAPE 36
+#define DUK_BIDX_THREAD_CONSTRUCTOR 37
+#define DUK_BIDX_THREAD_PROTOTYPE 38
+#define DUK_BIDX_BUFFER_CONSTRUCTOR 39
+#define DUK_BIDX_BUFFER_PROTOTYPE 40
+#define DUK_BIDX_POINTER_CONSTRUCTOR 41
+#define DUK_BIDX_POINTER_PROTOTYPE 42
+#define DUK_BIDX_LOGGER_CONSTRUCTOR 43
+#define DUK_BIDX_LOGGER_PROTOTYPE 44
+#define DUK_BIDX_DOUBLE_ERROR 45
+
+#define DUK_NUM_BUILTINS 46
+
+#else
+#error invalid endianness defines
+#endif
+#endif /* DUK_BUILTINS_H_INCLUDED */
+#line 50 "duk_internal.h"
+
+#line 1 "duk_strings.h"
+/*
+ * Shared error messages: declarations and macros
+ *
+ * Error messages are accessed through macros with fine-grained, explicit
+ * error message distinctions. Concrete error messages are selected by the
+ * macros and multiple macros can map to the same concrete string to save
+ * on code footprint. This allows flexible footprint/verbosity tuning with
+ * minimal code impact. There are a few limitations to this approach:
+ * (1) switching between plain messages and format strings doesn't work
+ * conveniently, and (2) conditional strings are a bit awkward to handle.
+ *
+ * Because format strings behave differently in the call site (they need to
+ * be followed by format arguments), they have a special prefix (DUK_STR_FMT_
+ * and duk_str_fmt_).
+ *
+ * On some compilers using explicit shared strings is preferable; on others
+ * it may be better to use straight literals because the compiler will combine
+ * them anyway, and such strings won't end up unnecessarily in a symbol table.
+ */
+
+#ifndef DUK_ERRMSG_H_INCLUDED
+#define DUK_ERRMSG_H_INCLUDED
+
+#define DUK_STR_INTERNAL_ERROR duk_str_internal_error
+#define DUK_STR_INVALID_COUNT duk_str_invalid_count
+#define DUK_STR_INVALID_CALL_ARGS duk_str_invalid_call_args
+#define DUK_STR_NOT_CONSTRUCTABLE duk_str_not_constructable
+#define DUK_STR_NOT_CALLABLE duk_str_not_callable
+#define DUK_STR_NOT_EXTENSIBLE duk_str_not_extensible
+#define DUK_STR_NOT_WRITABLE duk_str_not_writable
+#define DUK_STR_NOT_CONFIGURABLE duk_str_not_configurable
+
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL const char *duk_str_internal_error;
+DUK_INTERNAL_DECL const char *duk_str_invalid_count;
+DUK_INTERNAL_DECL const char *duk_str_invalid_call_args;
+DUK_INTERNAL_DECL const char *duk_str_not_constructable;
+DUK_INTERNAL_DECL const char *duk_str_not_callable;
+DUK_INTERNAL_DECL const char *duk_str_not_extensible;
+DUK_INTERNAL_DECL const char *duk_str_not_writable;
+DUK_INTERNAL_DECL const char *duk_str_not_configurable;
+#endif /* !DUK_SINGLE_FILE */
+
+#define DUK_STR_INVALID_CONTEXT duk_str_invalid_context
+#define DUK_STR_INVALID_INDEX duk_str_invalid_index
+#define DUK_STR_PUSH_BEYOND_ALLOC_STACK duk_str_push_beyond_alloc_stack
+#define DUK_STR_NOT_UNDEFINED duk_str_not_undefined
+#define DUK_STR_NOT_NULL duk_str_not_null
+#define DUK_STR_NOT_BOOLEAN duk_str_not_boolean
+#define DUK_STR_NOT_NUMBER duk_str_not_number
+#define DUK_STR_NOT_STRING duk_str_not_string
+#define DUK_STR_NOT_POINTER duk_str_not_pointer
+#define DUK_STR_NOT_BUFFER duk_str_not_buffer
+#define DUK_STR_UNEXPECTED_TYPE duk_str_unexpected_type
+#define DUK_STR_NOT_THREAD duk_str_not_thread
+#if 0 /*unused*/
+#define DUK_STR_NOT_COMPILEDFUNCTION duk_str_not_compiledfunction
+#endif
+#define DUK_STR_NOT_NATIVEFUNCTION duk_str_not_nativefunction
+#define DUK_STR_NOT_C_FUNCTION duk_str_not_c_function
+#define DUK_STR_DEFAULTVALUE_COERCE_FAILED duk_str_defaultvalue_coerce_failed
+#define DUK_STR_NUMBER_OUTSIDE_RANGE duk_str_number_outside_range
+#define DUK_STR_NOT_OBJECT_COERCIBLE duk_str_not_object_coercible
+#define DUK_STR_STRING_TOO_LONG duk_str_string_too_long
+#define DUK_STR_BUFFER_TOO_LONG duk_str_buffer_too_long
+#define DUK_STR_SPRINTF_TOO_LONG duk_str_sprintf_too_long
+#define DUK_STR_OBJECT_ALLOC_FAILED duk_str_object_alloc_failed
+#define DUK_STR_THREAD_ALLOC_FAILED duk_str_thread_alloc_failed
+#define DUK_STR_FUNC_ALLOC_FAILED duk_str_func_alloc_failed
+#define DUK_STR_BUFFER_ALLOC_FAILED duk_str_buffer_alloc_failed
+#define DUK_STR_POP_TOO_MANY duk_str_pop_too_many
+#define DUK_STR_BUFFER_NOT_DYNAMIC duk_str_buffer_not_dynamic
+#define DUK_STR_FAILED_TO_EXTEND_VALSTACK duk_str_failed_to_extend_valstack
+#define DUK_STR_BASE64_ENCODE_FAILED duk_str_base64_encode_failed
+#define DUK_STR_BASE64_DECODE_FAILED duk_str_base64_decode_failed
+#define DUK_STR_HEX_DECODE_FAILED duk_str_hex_decode_failed
+#define DUK_STR_NO_SOURCECODE duk_str_no_sourcecode
+#define DUK_STR_CONCAT_RESULT_TOO_LONG duk_str_concat_result_too_long
+#define DUK_STR_UNIMPLEMENTED duk_str_unimplemented
+#define DUK_STR_ARRAY_LENGTH_OVER_2G duk_str_array_length_over_2g
+
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL const char *duk_str_invalid_context;
+DUK_INTERNAL_DECL const char *duk_str_invalid_index;
+DUK_INTERNAL_DECL const char *duk_str_push_beyond_alloc_stack;
+DUK_INTERNAL_DECL const char *duk_str_not_undefined;
+DUK_INTERNAL_DECL const char *duk_str_not_null;
+DUK_INTERNAL_DECL const char *duk_str_not_boolean;
+DUK_INTERNAL_DECL const char *duk_str_not_number;
+DUK_INTERNAL_DECL const char *duk_str_not_string;
+DUK_INTERNAL_DECL const char *duk_str_not_pointer;
+DUK_INTERNAL_DECL const char *duk_str_not_buffer;
+DUK_INTERNAL_DECL const char *duk_str_unexpected_type;
+DUK_INTERNAL_DECL const char *duk_str_not_thread;
+#if 0 /*unused*/
+DUK_INTERNAL_DECL const char *duk_str_not_compiledfunction;
+#endif
+DUK_INTERNAL_DECL const char *duk_str_not_nativefunction;
+DUK_INTERNAL_DECL const char *duk_str_not_c_function;
+DUK_INTERNAL_DECL const char *duk_str_defaultvalue_coerce_failed;
+DUK_INTERNAL_DECL const char *duk_str_number_outside_range;
+DUK_INTERNAL_DECL const char *duk_str_not_object_coercible;
+DUK_INTERNAL_DECL const char *duk_str_string_too_long;
+DUK_INTERNAL_DECL const char *duk_str_buffer_too_long;
+DUK_INTERNAL_DECL const char *duk_str_sprintf_too_long;
+DUK_INTERNAL_DECL const char *duk_str_object_alloc_failed;
+DUK_INTERNAL_DECL const char *duk_str_thread_alloc_failed;
+DUK_INTERNAL_DECL const char *duk_str_func_alloc_failed;
+DUK_INTERNAL_DECL const char *duk_str_buffer_alloc_failed;
+DUK_INTERNAL_DECL const char *duk_str_pop_too_many;
+DUK_INTERNAL_DECL const char *duk_str_buffer_not_dynamic;
+DUK_INTERNAL_DECL const char *duk_str_failed_to_extend_valstack;
+DUK_INTERNAL_DECL const char *duk_str_base64_encode_failed;
+DUK_INTERNAL_DECL const char *duk_str_base64_decode_failed;
+DUK_INTERNAL_DECL const char *duk_str_hex_decode_failed;
+DUK_INTERNAL_DECL const char *duk_str_no_sourcecode;
+DUK_INTERNAL_DECL const char *duk_str_concat_result_too_long;
+DUK_INTERNAL_DECL const char *duk_str_unimplemented;
+DUK_INTERNAL_DECL const char *duk_str_array_length_over_2g;
+#endif /* !DUK_SINGLE_FILE */
+
+#define DUK_STR_FMT_PTR duk_str_fmt_ptr
+#define DUK_STR_FMT_INVALID_JSON duk_str_fmt_invalid_json
+#define DUK_STR_JSONDEC_RECLIMIT duk_str_jsondec_reclimit
+#define DUK_STR_JSONENC_RECLIMIT duk_str_jsonenc_reclimit
+#define DUK_STR_CYCLIC_INPUT duk_str_cyclic_input
+
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL const char *duk_str_fmt_ptr;
+DUK_INTERNAL_DECL const char *duk_str_fmt_invalid_json;
+DUK_INTERNAL_DECL const char *duk_str_jsondec_reclimit;
+DUK_INTERNAL_DECL const char *duk_str_jsonenc_reclimit;
+DUK_INTERNAL_DECL const char *duk_str_cyclic_input;
+#endif /* !DUK_SINGLE_FILE */
+
+#define DUK_STR_PROXY_REVOKED duk_str_proxy_revoked
+#define DUK_STR_OBJECT_RESIZE_FAILED duk_str_object_resize_failed
+#define DUK_STR_INVALID_BASE duk_str_invalid_base
+#define DUK_STR_STRICT_CALLER_READ duk_str_strict_caller_read
+#define DUK_STR_PROXY_REJECTED duk_str_proxy_rejected
+#define DUK_STR_INVALID_ARRAY_LENGTH duk_str_invalid_array_length
+#define DUK_STR_ARRAY_LENGTH_WRITE_FAILED duk_str_array_length_write_failed
+#define DUK_STR_ARRAY_LENGTH_NOT_WRITABLE duk_str_array_length_not_writable
+#define DUK_STR_SETTER_UNDEFINED duk_str_setter_undefined
+#define DUK_STR_REDEFINE_VIRT_PROP duk_str_redefine_virt_prop
+#define DUK_STR_INVALID_DESCRIPTOR duk_str_invalid_descriptor
+#define DUK_STR_PROPERTY_IS_VIRTUAL duk_str_property_is_virtual
+
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL const char *duk_str_proxy_revoked;
+DUK_INTERNAL_DECL const char *duk_str_object_resize_failed;
+DUK_INTERNAL_DECL const char *duk_str_invalid_base;
+DUK_INTERNAL_DECL const char *duk_str_strict_caller_read;
+DUK_INTERNAL_DECL const char *duk_str_proxy_rejected;
+DUK_INTERNAL_DECL const char *duk_str_invalid_array_length;
+DUK_INTERNAL_DECL const char *duk_str_array_length_write_failed;
+DUK_INTERNAL_DECL const char *duk_str_array_length_not_writable;
+DUK_INTERNAL_DECL const char *duk_str_setter_undefined;
+DUK_INTERNAL_DECL const char *duk_str_redefine_virt_prop;
+DUK_INTERNAL_DECL const char *duk_str_invalid_descriptor;
+DUK_INTERNAL_DECL const char *duk_str_property_is_virtual;
+#endif /* !DUK_SINGLE_FILE */
+
+#define DUK_STR_PARSE_ERROR duk_str_parse_error
+#define DUK_STR_DUPLICATE_LABEL duk_str_duplicate_label
+#define DUK_STR_INVALID_LABEL duk_str_invalid_label
+#define DUK_STR_INVALID_ARRAY_LITERAL duk_str_invalid_array_literal
+#define DUK_STR_INVALID_OBJECT_LITERAL duk_str_invalid_object_literal
+#define DUK_STR_INVALID_VAR_DECLARATION duk_str_invalid_var_declaration
+#define DUK_STR_CANNOT_DELETE_IDENTIFIER duk_str_cannot_delete_identifier
+#define DUK_STR_INVALID_EXPRESSION duk_str_invalid_expression
+#define DUK_STR_INVALID_LVALUE duk_str_invalid_lvalue
+#define DUK_STR_EXPECTED_IDENTIFIER duk_str_expected_identifier
+#define DUK_STR_EMPTY_EXPR_NOT_ALLOWED duk_str_empty_expr_not_allowed
+#define DUK_STR_INVALID_FOR duk_str_invalid_for
+#define DUK_STR_INVALID_SWITCH duk_str_invalid_switch
+#define DUK_STR_INVALID_BREAK_CONT_LABEL duk_str_invalid_break_cont_label
+#define DUK_STR_INVALID_RETURN duk_str_invalid_return
+#define DUK_STR_INVALID_TRY duk_str_invalid_try
+#define DUK_STR_INVALID_THROW duk_str_invalid_throw
+#define DUK_STR_WITH_IN_STRICT_MODE duk_str_with_in_strict_mode
+#define DUK_STR_FUNC_STMT_NOT_ALLOWED duk_str_func_stmt_not_allowed
+#define DUK_STR_UNTERMINATED_STMT duk_str_unterminated_stmt
+#define DUK_STR_INVALID_ARG_NAME duk_str_invalid_arg_name
+#define DUK_STR_INVALID_FUNC_NAME duk_str_invalid_func_name
+#define DUK_STR_INVALID_GETSET_NAME duk_str_invalid_getset_name
+#define DUK_STR_FUNC_NAME_REQUIRED duk_str_func_name_required
+
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL const char *duk_str_parse_error;
+DUK_INTERNAL_DECL const char *duk_str_duplicate_label;
+DUK_INTERNAL_DECL const char *duk_str_invalid_label;
+DUK_INTERNAL_DECL const char *duk_str_invalid_array_literal;
+DUK_INTERNAL_DECL const char *duk_str_invalid_object_literal;
+DUK_INTERNAL_DECL const char *duk_str_invalid_var_declaration;
+DUK_INTERNAL_DECL const char *duk_str_cannot_delete_identifier;
+DUK_INTERNAL_DECL const char *duk_str_invalid_expression;
+DUK_INTERNAL_DECL const char *duk_str_invalid_lvalue;
+DUK_INTERNAL_DECL const char *duk_str_expected_identifier;
+DUK_INTERNAL_DECL const char *duk_str_empty_expr_not_allowed;
+DUK_INTERNAL_DECL const char *duk_str_invalid_for;
+DUK_INTERNAL_DECL const char *duk_str_invalid_switch;
+DUK_INTERNAL_DECL const char *duk_str_invalid_break_cont_label;
+DUK_INTERNAL_DECL const char *duk_str_invalid_return;
+DUK_INTERNAL_DECL const char *duk_str_invalid_try;
+DUK_INTERNAL_DECL const char *duk_str_invalid_throw;
+DUK_INTERNAL_DECL const char *duk_str_with_in_strict_mode;
+DUK_INTERNAL_DECL const char *duk_str_func_stmt_not_allowed;
+DUK_INTERNAL_DECL const char *duk_str_unterminated_stmt;
+DUK_INTERNAL_DECL const char *duk_str_invalid_arg_name;
+DUK_INTERNAL_DECL const char *duk_str_invalid_func_name;
+DUK_INTERNAL_DECL const char *duk_str_invalid_getset_name;
+DUK_INTERNAL_DECL const char *duk_str_func_name_required;
+#endif /* !DUK_SINGLE_FILE */
+
+#define DUK_STR_INTERNAL_ERROR_EXEC_LONGJMP duk_str_internal_error_exec_longjmp
+
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL const char *duk_str_internal_error_exec_longjmp;
+#endif /* !DUK_SINGLE_FILE */
+
+#define DUK_STR_INVALID_QUANTIFIER_NO_ATOM duk_str_invalid_quantifier_no_atom
+#define DUK_STR_INVALID_QUANTIFIER_VALUES duk_str_invalid_quantifier_values
+#define DUK_STR_QUANTIFIER_TOO_MANY_COPIES duk_str_quantifier_too_many_copies
+#define DUK_STR_UNEXPECTED_CLOSING_PAREN duk_str_unexpected_closing_paren
+#define DUK_STR_UNEXPECTED_END_OF_PATTERN duk_str_unexpected_end_of_pattern
+#define DUK_STR_UNEXPECTED_REGEXP_TOKEN duk_str_unexpected_regexp_token
+#define DUK_STR_INVALID_REGEXP_FLAGS duk_str_invalid_regexp_flags
+#define DUK_STR_INVALID_BACKREFS duk_str_invalid_backrefs
+#define DUK_STR_REGEXP_BACKTRACK_FAILED duk_str_regexp_backtrack_failed
+#define DUK_STR_REGEXP_ADVANCE_FAILED duk_str_regexp_advance_failed
+#define DUK_STR_REGEXP_INTERNAL_ERROR duk_str_regexp_internal_error
+
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL const char *duk_str_invalid_quantifier_no_atom;
+DUK_INTERNAL_DECL const char *duk_str_invalid_quantifier_values;
+DUK_INTERNAL_DECL const char *duk_str_quantifier_too_many_copies;
+DUK_INTERNAL_DECL const char *duk_str_unexpected_closing_paren;
+DUK_INTERNAL_DECL const char *duk_str_unexpected_end_of_pattern;
+DUK_INTERNAL_DECL const char *duk_str_unexpected_regexp_token;
+DUK_INTERNAL_DECL const char *duk_str_invalid_regexp_flags;
+DUK_INTERNAL_DECL const char *duk_str_invalid_backrefs;
+DUK_INTERNAL_DECL const char *duk_str_regexp_backtrack_failed;
+DUK_INTERNAL_DECL const char *duk_str_regexp_advance_failed;
+DUK_INTERNAL_DECL const char *duk_str_regexp_internal_error;
+#endif /* !DUK_SINGLE_FILE */
+
+#define DUK_STR_VALSTACK_LIMIT duk_str_valstack_limit
+#define DUK_STR_CALLSTACK_LIMIT duk_str_callstack_limit
+#define DUK_STR_CATCHSTACK_LIMIT duk_str_catchstack_limit
+#define DUK_STR_OBJECT_PROPERTY_LIMIT duk_str_object_property_limit
+#define DUK_STR_PROTOTYPE_CHAIN_LIMIT duk_str_prototype_chain_limit
+#define DUK_STR_BOUND_CHAIN_LIMIT duk_str_bound_chain_limit
+#define DUK_STR_C_CALLSTACK_LIMIT duk_str_c_callstack_limit
+#define DUK_STR_COMPILER_RECURSION_LIMIT duk_str_compiler_recursion_limit
+#define DUK_STR_BYTECODE_LIMIT duk_str_bytecode_limit
+#define DUK_STR_REG_LIMIT duk_str_reg_limit
+#define DUK_STR_TEMP_LIMIT duk_str_temp_limit
+#define DUK_STR_CONST_LIMIT duk_str_const_limit
+#define DUK_STR_FUNC_LIMIT duk_str_func_limit
+#define DUK_STR_REGEXP_COMPILER_RECURSION_LIMIT duk_str_regexp_compiler_recursion_limit
+#define DUK_STR_REGEXP_EXECUTOR_RECURSION_LIMIT duk_str_regexp_executor_recursion_limit
+#define DUK_STR_REGEXP_EXECUTOR_STEP_LIMIT duk_str_regexp_executor_step_limit
+
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL const char *duk_str_valstack_limit;
+DUK_INTERNAL_DECL const char *duk_str_callstack_limit;
+DUK_INTERNAL_DECL const char *duk_str_catchstack_limit;
+DUK_INTERNAL_DECL const char *duk_str_object_property_limit;
+DUK_INTERNAL_DECL const char *duk_str_prototype_chain_limit;
+DUK_INTERNAL_DECL const char *duk_str_bound_chain_limit;
+DUK_INTERNAL_DECL const char *duk_str_c_callstack_limit;
+DUK_INTERNAL_DECL const char *duk_str_compiler_recursion_limit;
+DUK_INTERNAL_DECL const char *duk_str_bytecode_limit;
+DUK_INTERNAL_DECL const char *duk_str_reg_limit;
+DUK_INTERNAL_DECL const char *duk_str_temp_limit;
+DUK_INTERNAL_DECL const char *duk_str_const_limit;
+DUK_INTERNAL_DECL const char *duk_str_func_limit;
+DUK_INTERNAL_DECL const char *duk_str_regexp_compiler_recursion_limit;
+DUK_INTERNAL_DECL const char *duk_str_regexp_executor_recursion_limit;
+DUK_INTERNAL_DECL const char *duk_str_regexp_executor_step_limit;
+#endif /* !DUK_SINGLE_FILE */
+
+#define DUK_STR_ANON duk_str_anon
+#define DUK_STR_REALLOC_FAILED duk_str_realloc_failed
+
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL const char *duk_str_anon;
+DUK_INTERNAL_DECL const char *duk_str_realloc_failed;
+#endif /* !DUK_SINGLE_FILE */
+
+#endif /* DUK_ERRMSG_H_INCLUDED */
+#line 1 "duk_js_bytecode.h"
+/*
+ * Ecmascript bytecode
+ */
+
+#ifndef DUK_JS_BYTECODE_H_INCLUDED
+#define DUK_JS_BYTECODE_H_INCLUDED
+
+/*
+ * Logical instruction layout
+ * ==========================
+ *
+ * !3!3!2!2!2!2!2!2!2!2!2!2!1!1!1!1!1!1!1!1!1!1! ! ! ! ! ! ! ! ! ! !
+ * !1!0!9!8!7!6!5!4!3!2!1!0!9!8!7!6!5!4!3!2!1!0!9!8!7!6!5!4!3!2!1!0!
+ * +---------------------------------------------------+-----------+
+ * ! C ! B ! A ! OP !
+ * +---------------------------------------------------+-----------+
+ *
+ * OP (6 bits): opcode (DUK_OP_*), access should be fastest
+ * A (8 bits): typically a target register number
+ * B (9 bits): typically first source register/constant number
+ * C (9 bits): typically second source register/constant number
+ *
+ * Some instructions combine BC or ABC together for larger parameter values.
+ * Signed integers (e.g. jump offsets) are encoded as unsigned, with an opcode
+ * specific bias. B and C may denote a register or a constant, see
+ * DUK_BC_ISREG() and DUK_BC_ISCONST().
+ *
+ * Note: macro naming is a bit misleading, e.g. "ABC" in macro name but
+ * the field layout is logically "CBA".
+ */
+
+typedef duk_uint32_t duk_instr_t;
+
+#define DUK_DEC_OP(x) ((x) & 0x3fUL)
+#define DUK_DEC_A(x) (((x) >> 6) & 0xffUL)
+#define DUK_DEC_B(x) (((x) >> 14) & 0x1ffUL)
+#define DUK_DEC_C(x) (((x) >> 23) & 0x1ffUL)
+#define DUK_DEC_BC(x) (((x) >> 14) & 0x3ffffUL)
+#define DUK_DEC_ABC(x) (((x) >> 6) & 0x3ffffffUL)
+
+#define DUK_ENC_OP(op) ((duk_instr_t) (op))
+#define DUK_ENC_OP_ABC(op,abc) ((duk_instr_t) ( \
+ (((duk_instr_t) (abc)) << 6) | \
+ ((duk_instr_t) (op)) \
+ ))
+#define DUK_ENC_OP_A_BC(op,a,bc) ((duk_instr_t) ( \
+ (((duk_instr_t) (bc)) << 14) | \
+ (((duk_instr_t) (a)) << 6) | \
+ ((duk_instr_t) (op)) \
+ ))
+#define DUK_ENC_OP_A_B_C(op,a,b,c) ((duk_instr_t) ( \
+ (((duk_instr_t) (c)) << 23) | \
+ (((duk_instr_t) (b)) << 14) | \
+ (((duk_instr_t) (a)) << 6) | \
+ ((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)
+
+/* 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 0x3fL
+#define DUK_BC_A_MIN 0
+#define DUK_BC_A_MAX 0xffL
+#define DUK_BC_B_MIN 0
+#define DUK_BC_B_MAX 0x1ffL
+#define DUK_BC_C_MIN 0
+#define DUK_BC_C_MAX 0x1ffL
+#define DUK_BC_BC_MIN 0
+#define DUK_BC_BC_MAX 0x3ffffL
+#define DUK_BC_ABC_MIN 0
+#define DUK_BC_ABC_MAX 0x3ffffffL
+#define DUK_BC_EXTRAOP_MIN DUK_BC_A_MIN
+#define DUK_BC_EXTRAOP_MAX DUK_BC_A_MAX
+
+#define DUK_OP_LDREG 0
+#define DUK_OP_STREG 1
+#define DUK_OP_LDCONST 2
+#define DUK_OP_LDINT 3
+#define DUK_OP_LDINTX 4
+#define DUK_OP_MPUTOBJ 5
+#define DUK_OP_MPUTOBJI 6
+#define DUK_OP_MPUTARR 7
+#define DUK_OP_MPUTARRI 8
+#define DUK_OP_NEW 9
+#define DUK_OP_NEWI 10
+#define DUK_OP_REGEXP 11
+#define DUK_OP_CSREG 12
+#define DUK_OP_CSREGI 13
+#define DUK_OP_GETVAR 14
+#define DUK_OP_PUTVAR 15
+#define DUK_OP_DECLVAR 16
+#define DUK_OP_DELVAR 17
+#define DUK_OP_CSVAR 18
+#define DUK_OP_CSVARI 19
+#define DUK_OP_CLOSURE 20
+#define DUK_OP_GETPROP 21
+#define DUK_OP_PUTPROP 22
+#define DUK_OP_DELPROP 23
+#define DUK_OP_CSPROP 24
+#define DUK_OP_CSPROPI 25
+#define DUK_OP_ADD 26
+#define DUK_OP_SUB 27
+#define DUK_OP_MUL 28
+#define DUK_OP_DIV 29
+#define DUK_OP_MOD 30
+#define DUK_OP_BAND 31
+#define DUK_OP_BOR 32
+#define DUK_OP_BXOR 33
+#define DUK_OP_BASL 34
+#define DUK_OP_BLSR 35
+#define DUK_OP_BASR 36
+#define DUK_OP_EQ 37
+#define DUK_OP_NEQ 38
+#define DUK_OP_SEQ 39
+#define DUK_OP_SNEQ 40
+#define DUK_OP_GT 41
+#define DUK_OP_GE 42
+#define DUK_OP_LT 43
+#define DUK_OP_LE 44
+#define DUK_OP_IF 45
+#define DUK_OP_JUMP 46
+#define DUK_OP_RETURN 47
+#define DUK_OP_CALL 48
+#define DUK_OP_CALLI 49
+#define DUK_OP_TRYCATCH 50
+#define DUK_OP_EXTRA 51
+#define DUK_OP_PREINCR 52 /* pre/post opcode values have constraints, */
+#define DUK_OP_PREDECR 53 /* see duk_js_executor.c */
+#define DUK_OP_POSTINCR 54
+#define DUK_OP_POSTDECR 55
+#define DUK_OP_PREINCV 56
+#define DUK_OP_PREDECV 57
+#define DUK_OP_POSTINCV 58
+#define DUK_OP_POSTDECV 59
+#define DUK_OP_PREINCP 60
+#define DUK_OP_PREDECP 61
+#define DUK_OP_POSTINCP 62
+#define DUK_OP_POSTDECP 63
+#define DUK_OP_NONE 64 /* dummy value used as marker */
+
+/* DUK_OP_EXTRA, sub-operation in A */
+#define DUK_EXTRAOP_NOP 0
+#define DUK_EXTRAOP_INVALID 1
+#define DUK_EXTRAOP_LDTHIS 2
+#define DUK_EXTRAOP_LDUNDEF 3
+#define DUK_EXTRAOP_LDNULL 4
+#define DUK_EXTRAOP_LDTRUE 5
+#define DUK_EXTRAOP_LDFALSE 6
+#define DUK_EXTRAOP_NEWOBJ 7
+#define DUK_EXTRAOP_NEWARR 8
+#define DUK_EXTRAOP_SETALEN 9
+#define DUK_EXTRAOP_TYPEOF 10
+#define DUK_EXTRAOP_TYPEOFID 11
+#define DUK_EXTRAOP_INITENUM 12
+#define DUK_EXTRAOP_NEXTENUM 13
+#define DUK_EXTRAOP_INITSET 14
+#define DUK_EXTRAOP_INITSETI 15
+#define DUK_EXTRAOP_INITGET 16
+#define DUK_EXTRAOP_INITGETI 17
+#define DUK_EXTRAOP_ENDTRY 18
+#define DUK_EXTRAOP_ENDCATCH 19
+#define DUK_EXTRAOP_ENDFIN 20
+#define DUK_EXTRAOP_THROW 21
+#define DUK_EXTRAOP_INVLHS 22
+#define DUK_EXTRAOP_UNM 23
+#define DUK_EXTRAOP_UNP 24
+#define DUK_EXTRAOP_DEBUGGER 25
+#define DUK_EXTRAOP_BREAK 26
+#define DUK_EXTRAOP_CONTINUE 27
+#define DUK_EXTRAOP_BNOT 28
+#define DUK_EXTRAOP_LNOT 29
+#define DUK_EXTRAOP_INSTOF 30
+#define DUK_EXTRAOP_IN 31
+#define DUK_EXTRAOP_LABEL 32
+#define DUK_EXTRAOP_ENDLABEL 33
+
+/* DUK_OP_EXTRA for debugging */
+#define DUK_EXTRAOP_DUMPREG 128
+#define DUK_EXTRAOP_DUMPREGS 129
+#define DUK_EXTRAOP_LOGMARK 130
+
+/* DUK_OP_CALL flags in A */
+#define DUK_BC_CALL_FLAG_TAILCALL (1 << 0)
+#define DUK_BC_CALL_FLAG_EVALCALL (1 << 1)
+
+/* DUK_OP_TRYCATCH flags in A */
+#define DUK_BC_TRYCATCH_FLAG_HAVE_CATCH (1 << 0)
+#define DUK_BC_TRYCATCH_FLAG_HAVE_FINALLY (1 << 1)
+#define DUK_BC_TRYCATCH_FLAG_CATCH_BINDING (1 << 2)
+#define DUK_BC_TRYCATCH_FLAG_WITH_BINDING (1 << 3)
+
+/* DUK_OP_RETURN flags in A */
+#define DUK_BC_RETURN_FLAG_FAST (1 << 0)
+#define DUK_BC_RETURN_FLAG_HAVE_RETVAL (1 << 1)
+
+/* DUK_OP_DECLVAR flags in A; bottom bits are reserved for propdesc flags (DUK_PROPDESC_FLAG_XXX) */
+#define DUK_BC_DECLVAR_FLAG_UNDEF_VALUE (1 << 4) /* use 'undefined' for value automatically */
+#define DUK_BC_DECLVAR_FLAG_FUNC_DECL (1 << 5) /* function declaration */
+
+/* misc constants and helper macros */
+#define DUK_BC_REGLIMIT 256 /* if B/C is >= this value, refers to a const */
+#define DUK_BC_ISREG(x) ((x) < DUK_BC_REGLIMIT)
+#define DUK_BC_ISCONST(x) ((x) >= DUK_BC_REGLIMIT)
+#define DUK_BC_LDINT_BIAS (1L << 17)
+#define DUK_BC_LDINTX_SHIFT 18
+#define DUK_BC_JUMP_BIAS (1L << 25)
+
+#endif /* DUK_JS_BYTECODE_H_INCLUDED */
+#line 1 "duk_lexer.h"
+/*
+ * Lexer defines.
+ */
+
+#ifndef DUK_LEXER_H_INCLUDED
+#define DUK_LEXER_H_INCLUDED
+
+typedef void (*duk_re_range_callback)(void *user, duk_codepoint_t r1, duk_codepoint_t r2, duk_bool_t direct);
+
+/*
+ * A token is interpreted as any possible production of InputElementDiv
+ * and InputElementRegExp, see E5 Section 7 in its entirety. Note that
+ * the E5 "Token" production does not cover all actual tokens of the
+ * language (which is explicitly stated in the specification, Section 7.5).
+ * Null and boolean literals are defined as part of both ReservedWord
+ * (E5 Section 7.6.1) and Literal (E5 Section 7.8) productions. Here,
+ * null and boolean values have literal tokens, and are not reserved
+ * words.
+ *
+ * Decimal literal negative/positive sign is -not- part of DUK_TOK_NUMBER.
+ * The number tokens always have a non-negative value. The unary minus
+ * operator in "-1.0" is optimized during compilation to yield a single
+ * negative constant.
+ *
+ * Token numbering is free except that reserved words are required to be
+ * in a continuous range and in a particular order. See genstrings.py.
+ */
+
+#define DUK_LEXER_INITCTX(ctx) duk_lexer_initctx((ctx))
+
+#define DUK_LEXER_SETPOINT(ctx,pt) duk_lexer_setpoint((ctx), (pt))
+
+#define DUK_LEXER_GETPOINT(ctx,pt) do { (pt)->offset = (ctx)->offsets[0]; \
+ (pt)->line = (ctx)->lines[0]; } while (0)
+
+/* currently 6 characters of lookup are actually needed (duk_lexer.c) */
+#define DUK_LEXER_WINDOW_SIZE 8
+
+#define DUK_TOK_MINVAL 0
+
+/* returned after EOF (infinite amount) */
+#define DUK_TOK_EOF 0
+
+/* line terminator or multi-line comment with internal lineterm (E5 Sections 7.3, 7.4) */
+#define DUK_TOK_LINETERM 1
+
+/* single-line comment or multi-line comment without internal lineterm (E5 Section 7.4) */
+#define DUK_TOK_COMMENT 2
+
+/* identifier names (E5 Section 7.6) */
+#define DUK_TOK_IDENTIFIER 3
+
+/* reserved words: keywords */
+#define DUK_TOK_START_RESERVED 4
+#define DUK_TOK_BREAK 4
+#define DUK_TOK_CASE 5
+#define DUK_TOK_CATCH 6
+#define DUK_TOK_CONTINUE 7
+#define DUK_TOK_DEBUGGER 8
+#define DUK_TOK_DEFAULT 9
+#define DUK_TOK_DELETE 10
+#define DUK_TOK_DO 11
+#define DUK_TOK_ELSE 12
+#define DUK_TOK_FINALLY 13
+#define DUK_TOK_FOR 14
+#define DUK_TOK_FUNCTION 15
+#define DUK_TOK_IF 16
+#define DUK_TOK_IN 17
+#define DUK_TOK_INSTANCEOF 18
+#define DUK_TOK_NEW 19
+#define DUK_TOK_RETURN 20
+#define DUK_TOK_SWITCH 21
+#define DUK_TOK_THIS 22
+#define DUK_TOK_THROW 23
+#define DUK_TOK_TRY 24
+#define DUK_TOK_TYPEOF 25
+#define DUK_TOK_VAR 26
+#define DUK_TOK_VOID 27
+#define DUK_TOK_WHILE 28
+#define DUK_TOK_WITH 29
+
+/* reserved words: future reserved words */
+#define DUK_TOK_CLASS 30
+#define DUK_TOK_CONST 31
+#define DUK_TOK_ENUM 32
+#define DUK_TOK_EXPORT 33
+#define DUK_TOK_EXTENDS 34
+#define DUK_TOK_IMPORT 35
+#define DUK_TOK_SUPER 36
+
+/* "null", "true", and "false" are always reserved words.
+ * Note that "get" and "set" are not!
+ */
+#define DUK_TOK_NULL 37
+#define DUK_TOK_TRUE 38
+#define DUK_TOK_FALSE 39
+
+/* reserved words: additional future reserved words in strict mode */
+#define DUK_TOK_START_STRICT_RESERVED 40 /* inclusive */
+#define DUK_TOK_IMPLEMENTS 40
+#define DUK_TOK_INTERFACE 41
+#define DUK_TOK_LET 42
+#define DUK_TOK_PACKAGE 43
+#define DUK_TOK_PRIVATE 44
+#define DUK_TOK_PROTECTED 45
+#define DUK_TOK_PUBLIC 46
+#define DUK_TOK_STATIC 47
+#define DUK_TOK_YIELD 48
+
+#define DUK_TOK_END_RESERVED 49 /* 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 49
+#define DUK_TOK_SET 50
+
+/* punctuators (unlike the spec, also includes "/" and "/=") */
+#define DUK_TOK_LCURLY 51
+#define DUK_TOK_RCURLY 52
+#define DUK_TOK_LBRACKET 53
+#define DUK_TOK_RBRACKET 54
+#define DUK_TOK_LPAREN 55
+#define DUK_TOK_RPAREN 56
+#define DUK_TOK_PERIOD 57
+#define DUK_TOK_SEMICOLON 58
+#define DUK_TOK_COMMA 59
+#define DUK_TOK_LT 60
+#define DUK_TOK_GT 61
+#define DUK_TOK_LE 62
+#define DUK_TOK_GE 63
+#define DUK_TOK_EQ 64
+#define DUK_TOK_NEQ 65
+#define DUK_TOK_SEQ 66
+#define DUK_TOK_SNEQ 67
+#define DUK_TOK_ADD 68
+#define DUK_TOK_SUB 69
+#define DUK_TOK_MUL 70
+#define DUK_TOK_DIV 71
+#define DUK_TOK_MOD 72
+#define DUK_TOK_INCREMENT 73
+#define DUK_TOK_DECREMENT 74
+#define DUK_TOK_ALSHIFT 75 /* named "arithmetic" because result is signed */
+#define DUK_TOK_ARSHIFT 76
+#define DUK_TOK_RSHIFT 77
+#define DUK_TOK_BAND 78
+#define DUK_TOK_BOR 79
+#define DUK_TOK_BXOR 80
+#define DUK_TOK_LNOT 81
+#define DUK_TOK_BNOT 82
+#define DUK_TOK_LAND 83
+#define DUK_TOK_LOR 84
+#define DUK_TOK_QUESTION 85
+#define DUK_TOK_COLON 86
+#define DUK_TOK_EQUALSIGN 87
+#define DUK_TOK_ADD_EQ 88
+#define DUK_TOK_SUB_EQ 89
+#define DUK_TOK_MUL_EQ 90
+#define DUK_TOK_DIV_EQ 91
+#define DUK_TOK_MOD_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_MAXVAL 101 /* inclusive */
+
+/* Convert heap string index to a token (reserved words) */
+#define DUK_STRIDX_TO_TOK(x) ((x) - DUK_STRIDX_START_RESERVED + DUK_TOK_START_RESERVED)
+
+/* Sanity check */
+#if (DUK_TOK_MAXVAL > 255)
+#error DUK_TOK_MAXVAL too large, code assumes it fits into 8 bits
+#endif
+
+/* Sanity checks for string and token defines */
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_BREAK) != DUK_TOK_BREAK)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_CASE) != DUK_TOK_CASE)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_CATCH) != DUK_TOK_CATCH)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_CONTINUE) != DUK_TOK_CONTINUE)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_DEBUGGER) != DUK_TOK_DEBUGGER)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_DEFAULT) != DUK_TOK_DEFAULT)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_DELETE) != DUK_TOK_DELETE)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_DO) != DUK_TOK_DO)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_ELSE) != DUK_TOK_ELSE)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_FINALLY) != DUK_TOK_FINALLY)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_FOR) != DUK_TOK_FOR)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_LC_FUNCTION) != DUK_TOK_FUNCTION)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_IF) != DUK_TOK_IF)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_IN) != DUK_TOK_IN)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_INSTANCEOF) != DUK_TOK_INSTANCEOF)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_NEW) != DUK_TOK_NEW)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_RETURN) != DUK_TOK_RETURN)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_SWITCH) != DUK_TOK_SWITCH)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_THIS) != DUK_TOK_THIS)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_THROW) != DUK_TOK_THROW)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_TRY) != DUK_TOK_TRY)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_TYPEOF) != DUK_TOK_TYPEOF)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_VAR) != DUK_TOK_VAR)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_VOID) != DUK_TOK_VOID)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_WHILE) != DUK_TOK_WHILE)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_WITH) != DUK_TOK_WITH)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_CLASS) != DUK_TOK_CLASS)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_CONST) != DUK_TOK_CONST)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_ENUM) != DUK_TOK_ENUM)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_EXPORT) != DUK_TOK_EXPORT)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_EXTENDS) != DUK_TOK_EXTENDS)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_IMPORT) != DUK_TOK_IMPORT)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_SUPER) != DUK_TOK_SUPER)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_LC_NULL) != DUK_TOK_NULL)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_TRUE) != DUK_TOK_TRUE)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_FALSE) != DUK_TOK_FALSE)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_IMPLEMENTS) != DUK_TOK_IMPLEMENTS)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_INTERFACE) != DUK_TOK_INTERFACE)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_LET) != DUK_TOK_LET)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_PACKAGE) != DUK_TOK_PACKAGE)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_PRIVATE) != DUK_TOK_PRIVATE)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_PROTECTED) != DUK_TOK_PROTECTED)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_PUBLIC) != DUK_TOK_PUBLIC)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_STATIC) != DUK_TOK_STATIC)
+#error mismatch in token defines
+#endif
+#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_YIELD) != DUK_TOK_YIELD)
+#error mismatch in token defines
+#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
+#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_INITIAL 64
+#define DUK_LEXER_TEMP_BUF_LIMIT 256
+
+/* A token value. Can be memcpy()'d, but note that slot1/slot2 values are on the valstack. */
+struct duk_token {
+ duk_small_int_t t; /* token type (with reserved word identification) */
+ duk_small_int_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->slot1_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)
+
+/* A regexp token value. */
+struct duk_re_token {
+ duk_small_int_t t; /* token type */
+ duk_small_int_t greedy;
+ duk_uint_fast32_t num; /* numeric value (character, count) */
+ duk_uint_fast32_t qmin;
+ duk_uint_fast32_t qmax;
+};
+
+/* A structure for 'snapshotting' a point for rewinding */
+struct duk_lexer_point {
+ duk_size_t offset;
+ duk_int_t line;
+};
+
+/* Lexer context. Same context is used for Ecmascript and Regexp parsing. */
+struct duk_lexer_ctx {
+ 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_codepoint_t window[DUK_LEXER_WINDOW_SIZE]; /* window of unicode code points */
+ duk_size_t offsets[DUK_LEXER_WINDOW_SIZE]; /* input byte offset for each char */
+ duk_int_t lines[DUK_LEXER_WINDOW_SIZE]; /* input lines for each char */
+ 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 (on valstack) */
+
+ duk_int_t token_count; /* number of tokens parsed */
+ duk_int_t token_limit; /* maximum token count before error (sanity backstop) */
+};
+
+/*
+ * Prototypes
+ */
+
+DUK_INTERNAL_DECL void duk_lexer_initctx(duk_lexer_ctx *lex_ctx);
+
+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);
+#ifdef 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_LEXER_H_INCLUDED */
+#line 1 "duk_js_compiler.h"
+/*
+ * Ecmascript compiler.
+ */
+
+#ifndef DUK_JS_COMPILER_H_INCLUDED
+#define DUK_JS_COMPILER_H_INCLUDED
+
+/* ecmascript compiler limits */
+#if defined(DUK_USE_DEEP_C_STACK)
+#define DUK_COMPILER_RECURSION_LIMIT 2500L
+#else
+#define DUK_COMPILER_RECURSION_LIMIT 50L
+#endif
+#define DUK_COMPILER_TOKEN_LIMIT 100000000L /* 1e8: protects against deeply nested inner functions */
+
+/* maximum loopcount for peephole optimization */
+#define DUK_COMPILER_PEEPHOLE_MAXITER 3
+
+/* maximum bytecode length in instructions */
+#define DUK_COMPILER_MAX_BYTECODE_LENGTH (256L * 1024L * 1024L) /* 1 GB */
+
+/*
+ * Compiler intermediate values
+ *
+ * Intermediate values describe either plain values (e.g. strings or
+ * numbers) or binary operations which have not yet been coerced into
+ * 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_ARITH_EXTRAOP 3 /* binary arithmetic using extraops; DUK_EXTRAOP_INSTOF etc */
+#define DUK_IVAL_PROP 4 /* property access */
+#define DUK_IVAL_VAR 5 /* 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 */
+
+/* bit mask which indicates that a regconst is a constant instead of a register */
+#define DUK_JS_CONST_MARKER 0x80000000UL
+
+/* type to represent a reg/const reference during compilation */
+typedef duk_uint32_t duk_regconst_t;
+
+/* type to represent a straight register reference, with <0 indicating none */
+typedef duk_int32_t duk_reg_t;
+
+typedef struct {
+ 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_ispec;
+
+typedef struct {
+ /*
+ * PLAIN: x1
+ * ARITH: x1 <op> x2
+ * PROP: x1.x2
+ * VAR: x1 (name)
+ */
+
+ /* 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 (or extraop) for binary ops */
+ duk_ispec x1;
+ duk_ispec x2;
+} duk_ivalue;
+
+/*
+ * Bytecode instruction representation during compilation
+ *
+ * Contains the actual instruction and (optionally) debug info.
+ */
+
+struct duk_compiler_instr {
+ duk_instr_t ins;
+#if defined(DUK_USE_PC2LINE)
+ duk_uint32_t line;
+#endif
+};
+
+/*
+ * Compiler state
+ */
+
+#define DUK_LABEL_FLAG_ALLOW_BREAK (1 << 0)
+#define DUK_LABEL_FLAG_ALLOW_CONTINUE (1 << 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
+ */
+
+ /* Fast jumps (which avoid longjmp) jump directly to the jump sites
+ * which are always known even while the iteration/switch statement
+ * is still being parsed. A final peephole pass "straightens out"
+ * the jumps.
+ */
+} duk_labelinfo;
+
+/* Compiling state of one function, eventually converted to duk_hcompiledfunction */
+struct duk_compiler_func {
+ /* These pointers are at the start of the struct so that they pack
+ * nicely. Mixing pointers and integer values is bad on some
+ * platforms (e.g. if int is 32 bits and pointers are 64 bits).
+ */
+
+ duk_hstring *h_name; /* function name (borrowed reference), ends up in _name */
+ duk_hbuffer_dynamic *h_code; /* C array of duk_compiler_instr */
+ 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 */
+ duk_idx_t code_idx;
+ duk_idx_t consts_idx;
+ duk_idx_t funcs_idx;
+ duk_idx_t decls_idx;
+ duk_idx_t labelnames_idx;
+ duk_idx_t labelinfos_idx;
+ duk_idx_t argnames_idx;
+ duk_idx_t varmap_idx;
+
+ /* temp reg handling */
+ duk_reg_t temp_first; /* first register that is a temporary (below: variables) */
+ duk_reg_t temp_next; /* next temporary register to allocate */
+ duk_reg_t temp_max; /* highest value of temp_reg (temp_max - 1 is highest used reg) */
+
+ /* shuffle registers if large number of regs/consts */
+ duk_reg_t shuffle1;
+ duk_reg_t shuffle2;
+ duk_reg_t shuffle3;
+
+ /* 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 */
+
+ /* 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_reg_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_hcompiledfunction has duk_uint32_t) */
+ duk_int_t max_line;
+#endif
+
+ /* status booleans */
+ duk_bool_t is_function; /* is an actual function (not global/eval code) */
+ duk_bool_t is_eval; /* is eval code */
+ duk_bool_t is_global; /* is global code */
+ duk_bool_t is_setget; /* is a setter/getter */
+ duk_bool_t is_decl; /* is a function declaration (as opposed to function expression) */
+ duk_bool_t is_strict; /* function is strict */
+ duk_bool_t is_notail; /* function must not be tailcalled */
+ duk_bool_t in_directive_prologue; /* parsing in "directive prologue", recognize directives */
+ duk_bool_t in_scanning; /* parsing in "scanning" phase (first pass) */
+ duk_bool_t may_direct_eval; /* function may call direct eval */
+ duk_bool_t id_access_arguments; /* function refers to 'arguments' identifier */
+ duk_bool_t id_access_slow; /* function makes one or more slow path accesses */
+ duk_bool_t is_arguments_shadowed; /* argument/function declaration shadows 'arguments' */
+ duk_bool_t needs_shuffle; /* function needs shuffle registers */
+ duk_bool_t reject_regexp_in_adv; /* reject RegExp literal on next advance() call; needed for handling IdentifierName productions */
+};
+
+struct duk_compiler_ctx {
+ duk_hthread *thr;
+
+ /* filename being compiled (ends up in functions' '_filename' property) */
+ duk_hstring *h_filename; /* borrowed reference */
+
+ /* lexing (tokenization) state (contains two valstack slot indices) */
+ duk_lexer_ctx lex;
+
+ /* 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 */
+
+ /* recursion limit */
+ duk_int_t recursion_depth;
+ duk_int_t recursion_limit;
+
+ /* code emission temporary */
+ duk_int_t emit_jumpslot_pc;
+
+ /* current function being compiled (embedded instead of pointer for more compact access) */
+ duk_compiler_func curr_func;
+};
+
+/*
+ * Prototypes
+ */
+
+#define DUK_JS_COMPILE_FLAG_EVAL (1 << 0) /* source is eval code (not program) */
+#define DUK_JS_COMPILE_FLAG_STRICT (1 << 1) /* strict outer context */
+#define DUK_JS_COMPILE_FLAG_FUNCEXPR (1 << 2) /* source is a function expression (used for Function constructor) */
+
+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 */
+#line 1 "duk_regexp.h"
+/*
+ * Regular expression structs, constants, and bytecode defines.
+ */
+
+#ifndef DUK_REGEXP_H_INCLUDED
+#define DUK_REGEXP_H_INCLUDED
+
+/* maximum bytecode copies for {n,m} quantifiers */
+#define DUK_RE_MAX_ATOM_COPIES 1000
+
+/* regexp compilation limits */
+#if defined(DUK_USE_DEEP_C_STACK)
+#define DUK_RE_COMPILE_RECURSION_LIMIT 10000
+#else
+#define DUK_RE_COMPILE_RECURSION_LIMIT 100
+#endif
+#define DUK_RE_COMPILE_TOKEN_LIMIT 100000000L /* 1e8 */
+
+/* regexp execution limits */
+#if defined(DUK_USE_DEEP_C_STACK)
+#define DUK_RE_EXECUTE_RECURSION_LIMIT 10000
+#else
+#define DUK_RE_EXECUTE_RECURSION_LIMIT 100
+#endif
+#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
+
+/* flags */
+#define DUK_RE_FLAG_GLOBAL (1 << 0)
+#define DUK_RE_FLAG_IGNORE_CASE (1 << 1)
+#define DUK_RE_FLAG_MULTILINE (1 << 2)
+
+struct duk_re_matcher_ctx {
+ duk_hthread *thr;
+
+ duk_uint32_t re_flags;
+ const duk_uint8_t *input;
+ 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) */
+ duk_uint32_t nsaved;
+ duk_uint32_t recursion_depth;
+ duk_uint32_t recursion_limit;
+ duk_uint32_t steps_count;
+ duk_uint32_t steps_limit;
+};
+
+struct duk_re_compiler_ctx {
+ duk_hthread *thr;
+
+ duk_uint32_t re_flags;
+ duk_lexer_ctx lex;
+ duk_re_token curr_token;
+ duk_hbuffer_dynamic *buf;
+ 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 */
+};
+
+/*
+ * Prototypes
+ */
+
+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() */
+
+#endif /* DUK_REGEXP_H_INCLUDED */
+#line 1 "duk_tval.h"
+/*
+ * Tagged type definition (duk_tval) and accessor macros.
+ *
+ * Access all fields through the accessor macros, as the representation
+ * is quite tricky.
+ *
+ * There are two packed type alternatives: an 8-byte representation
+ * based on an IEEE double (preferred for compactness), and a 12-byte
+ * representation (portability). The latter is needed also in e.g.
+ * 64-bit environments (it usually pads to 16 bytes per value).
+ *
+ * Selecting the tagged type format involves many trade-offs (memory
+ * use, size and performance of generated code, portability, etc),
+ * see doc/types.txt for a detailed discussion (especially of how the
+ * IEEE double format is used to pack tagged values).
+ *
+ * NB: because macro arguments are often expressions, macros should
+ * avoid evaluating their argument more than once.
+ */
+
+#ifndef DUK_TVAL_H_INCLUDED
+#define DUK_TVAL_H_INCLUDED
+
+/* sanity */
+#if !defined(DUK_USE_DOUBLE_LE) && !defined(DUK_USE_DOUBLE_ME) && !defined(DUK_USE_DOUBLE_BE)
+#error unsupported: cannot determine byte order variant
+#endif
+
+#ifdef DUK_USE_PACKED_TVAL
+/* ======================================================================== */
+
+/*
+ * Packed 8-byte representation
+ */
+
+/* sanity */
+#if !defined(DUK_USE_PACKED_TVAL_POSSIBLE)
+#error packed representation not supported
+#endif
+
+/* use duk_double_union as duk_tval directly */
+typedef union duk_double_union duk_tval;
+
+/* tags */
+#define DUK_TAG_NORMALIZED_NAN 0x7ff8UL /* the NaN variant we use */
+/* avoid tag 0xfff0, no risk of confusion with negative infinity */
+#if defined(DUK_USE_FASTINT)
+#define DUK_TAG_FASTINT 0xfff1UL /* embed: integer value */
+#endif
+#define DUK_TAG_UNDEFINED 0xfff2UL /* embed: 0 or 1 (normal or unused) */
+#define DUK_TAG_NULL 0xfff3UL /* embed: nothing */
+#define DUK_TAG_BOOLEAN 0xfff4UL /* embed: 0 or 1 (false or true) */
+/* DUK_TAG_NUMBER would logically go here, but it has multiple 'tags' */
+#define DUK_TAG_POINTER 0xfff5UL /* embed: void ptr */
+#define DUK_TAG_LIGHTFUNC 0xfff6UL /* embed: func ptr */
+#define DUK_TAG_STRING 0xfff7UL /* embed: duk_hstring ptr */
+#define DUK_TAG_OBJECT 0xfff8UL /* embed: duk_hobject ptr */
+#define DUK_TAG_BUFFER 0xfff9UL /* embed: duk_hbuffer ptr */
+
+/* for convenience */
+#define DUK_XTAG_UNDEFINED_ACTUAL 0xfff20000UL
+#define DUK_XTAG_UNDEFINED_UNUSED 0xfff20001UL
+#define DUK_XTAG_NULL 0xfff30000UL
+#define DUK_XTAG_BOOLEAN_FALSE 0xfff40000UL
+#define DUK_XTAG_BOOLEAN_TRUE 0xfff40001UL
+
+/* two casts to avoid gcc warning: "warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]" */
+#ifdef DUK_USE_64BIT_OPS
+#ifdef DUK_USE_DOUBLE_ME
+#define DUK__TVAL_SET_TAGGEDPOINTER(v,h,tag) do { \
+ (v)->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(v,h,tag) do { \
+ (v)->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(v,h,tag) do { \
+ (v)->ui[DUK_DBL_IDX_UI0] = ((duk_uint32_t) (tag)) << 16; \
+ (v)->ui[DUK_DBL_IDX_UI1] = (duk_uint32_t) (h); \
+ } while (0)
+#endif /* DUK_USE_64BIT_OPS */
+
+#ifdef DUK_USE_64BIT_OPS
+/* Double casting for pointer to avoid gcc warning (cast from pointer to integer of different size) */
+#ifdef DUK_USE_DOUBLE_ME
+#define DUK__TVAL_SET_LIGHTFUNC(v,fp,flags) do { \
+ (v)->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(v,fp,flags) do { \
+ (v)->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(v,fp,flags) do { \
+ (v)->ui[DUK_DBL_IDX_UI0] = (((duk_uint32_t) DUK_TAG_LIGHTFUNC) << 16) | ((duk_uint32_t) (flags)); \
+ (v)->ui[DUK_DBL_IDX_UI1] = (duk_uint32_t) (fp); \
+ } while (0)
+#endif /* DUK_USE_64BIT_OPS */
+
+#if defined(DUK_USE_FASTINT)
+/* Note: masking is done for 'i' to deal with negative numbers correctly */
+#ifdef DUK_USE_DOUBLE_ME
+#define DUK__TVAL_SET_FASTINT(v,i) do { \
+ (v)->ui[DUK_DBL_IDX_UI0] = ((duk_uint32_t) DUK_TAG_FASTINT) << 16 | (((duk_uint32_t) ((i) >> 32)) & 0x0000ffffUL); \
+ (v)->ui[DUK_DBL_IDX_UI1] = (duk_uint32_t) (i); \
+ } while (0)
+#define DUK__TVAL_SET_FASTINT_U32(v,i) do { \
+ (v)->ui[DUK_DBL_IDX_UI0] = ((duk_uint32_t) DUK_TAG_FASTINT) << 16; \
+ (v)->ui[DUK_DBL_IDX_UI1] = (duk_uint32_t) (i); \
+ } while (0)
+#else
+#define DUK__TVAL_SET_FASTINT(v,i) do { \
+ (v)->ull[DUK_DBL_IDX_ULL0] = (((duk_uint64_t) DUK_TAG_FASTINT) << 48) | (((duk_uint64_t) (i)) & 0x0000ffffffffffffULL); \
+ } while (0)
+#define DUK__TVAL_SET_FASTINT_U32(v,i) do { \
+ (v)->ull[DUK_DBL_IDX_ULL0] = (((duk_uint64_t) DUK_TAG_FASTINT) << 48) | (duk_uint64_t) (i); \
+ } while (0)
+#endif
+
+#define DUK__TVAL_SET_FASTINT_I32(v,i) do { \
+ duk_int64_t duk__tmp = (duk_int64_t) (i); \
+ DUK_TVAL_SET_FASTINT((v), duk__tmp); \
+ } while (0)
+
+/* XXX: clumsy sign extend and masking of 16 topmost bits */
+#ifdef DUK_USE_DOUBLE_ME
+#define DUK__TVAL_GET_FASTINT(v) (((duk_int64_t) ((((duk_uint64_t) (v)->ui[DUK_DBL_IDX_UI0]) << 32) | ((duk_uint64_t) (v)->ui[DUK_DBL_IDX_UI1]))) << 16 >> 16)
+#else
+#define DUK__TVAL_GET_FASTINT(v) ((((duk_int64_t) (v)->ull[DUK_DBL_IDX_ULL0]) << 16) >> 16)
+#endif
+#define DUK__TVAL_GET_FASTINT_U32(v) ((v)->ui[DUK_DBL_IDX_UI1])
+#define DUK__TVAL_GET_FASTINT_I32(v) ((duk_int32_t) (v)->ui[DUK_DBL_IDX_UI1])
+#endif /* DUK_USE_FASTINT */
+
+#define DUK_TVAL_SET_UNDEFINED_ACTUAL(v) DUK_DBLUNION_SET_HIGH32((v), DUK_XTAG_UNDEFINED_ACTUAL)
+#define DUK_TVAL_SET_UNDEFINED_UNUSED(v) DUK_DBLUNION_SET_HIGH32((v), DUK_XTAG_UNDEFINED_UNUSED)
+
+/* Note: 16-bit initializer suffices (unlike for undefined/boolean) */
+#define DUK_TVAL_SET_NULL(v) do { \
+ (v)->us[DUK_DBL_IDX_US0] = (duk_uint16_t) DUK_TAG_NULL; \
+ } while (0)
+
+#define DUK_TVAL_SET_BOOLEAN(v,val) DUK_DBLUNION_SET_HIGH32((v), (((duk_uint32_t) DUK_TAG_BOOLEAN) << 16) | ((duk_uint32_t) (val)))
+
+#define DUK_TVAL_SET_NAN(v) DUK_DBLUNION_SET_NAN_FULL((v))
+
+/* Assumes that caller has normalized NaNs, otherwise trouble ahead. */
+#if defined(DUK_USE_FASTINT)
+#define DUK_TVAL_SET_DOUBLE(v,d) DUK_DBLUNION_SET_DOUBLE((v), (d))
+#define DUK_TVAL_SET_FASTINT(v,i) DUK__TVAL_SET_FASTINT((v), (i))
+#define DUK_TVAL_SET_FASTINT_I32(v,i) DUK__TVAL_SET_FASTINT_I32((v), (i))
+#define DUK_TVAL_SET_FASTINT_U32(v,i) DUK__TVAL_SET_FASTINT_U32((v), (i))
+#define DUK_TVAL_SET_NUMBER_CHKFAST(v,d) duk_tval_set_number_chkfast((v), (d))
+#define DUK_TVAL_SET_NUMBER(v,d) DUK_DBLUNION_SET_DOUBLE((v), (d))
+#define DUK_TVAL_CHKFAST_INPLACE(v) do { \
+ duk_tval *duk__tv; \
+ duk_double_t duk__d; \
+ duk__tv = (v); \
+ if (DUK_TVAL_IS_DOUBLE(duk__tv)) { \
+ duk__d = DUK_TVAL_GET_DOUBLE(duk__tv); \
+ DUK_TVAL_SET_NUMBER_CHKFAST(duk__tv, duk__d); \
+ } \
+ } while (0)
+#else
+#define DUK_TVAL_SET_NUMBER(v,d) DUK_DBLUNION_SET_DOUBLE((v), (d))
+#define DUK_TVAL_SET_NUMBER_CHKFAST(v,d) DUK_TVAL_SET_NUMBER((v), (d))
+#define DUK_TVAL_SET_DOUBLE(v,d) DUK_TVAL_SET_NUMBER((v), (d))
+#define DUK_TVAL_CHKFAST_INPLACE(v) do { } while (0)
+#endif
+
+#define DUK_TVAL_SET_LIGHTFUNC(v,fp,flags) DUK__TVAL_SET_LIGHTFUNC((v), (fp), (flags))
+#define DUK_TVAL_SET_STRING(v,h) DUK__TVAL_SET_TAGGEDPOINTER((v), (h), DUK_TAG_STRING)
+#define DUK_TVAL_SET_OBJECT(v,h) DUK__TVAL_SET_TAGGEDPOINTER((v), (h), DUK_TAG_OBJECT)
+#define DUK_TVAL_SET_BUFFER(v,h) DUK__TVAL_SET_TAGGEDPOINTER((v), (h), DUK_TAG_BUFFER)
+#define DUK_TVAL_SET_POINTER(v,p) DUK__TVAL_SET_TAGGEDPOINTER((v), (p), DUK_TAG_POINTER)
+
+#define DUK_TVAL_SET_TVAL(v,x) do { *(v) = *(x); } while (0)
+
+/* getters */
+#define DUK_TVAL_GET_BOOLEAN(v) ((int) (v)->us[DUK_DBL_IDX_US1])
+#if defined(DUK_USE_FASTINT)
+#define DUK_TVAL_GET_DOUBLE(v) ((v)->d)
+#define DUK_TVAL_GET_FASTINT(v) DUK__TVAL_GET_FASTINT((v))
+#define DUK_TVAL_GET_FASTINT_U32(v) DUK__TVAL_GET_FASTINT_U32((v))
+#define DUK_TVAL_GET_FASTINT_I32(v) DUK__TVAL_GET_FASTINT_I32((v))
+#define DUK_TVAL_GET_NUMBER(v) duk_tval_get_number_packed((v))
+#else
+#define DUK_TVAL_GET_NUMBER(v) ((v)->d)
+#define DUK_TVAL_GET_DOUBLE(v) ((v)->d)
+#endif
+#define DUK_TVAL_GET_LIGHTFUNC(v,out_fp,out_flags) do { \
+ (out_flags) = (v)->ui[DUK_DBL_IDX_UI0] & 0xffffUL; \
+ (out_fp) = (duk_c_function) (v)->ui[DUK_DBL_IDX_UI1]; \
+ } while (0)
+#define DUK_TVAL_GET_LIGHTFUNC_FUNCPTR(v) ((duk_c_function) ((v)->ui[DUK_DBL_IDX_UI1]))
+#define DUK_TVAL_GET_LIGHTFUNC_FLAGS(v) (((int) (v)->ui[DUK_DBL_IDX_UI0]) & 0xffffUL)
+#define DUK_TVAL_GET_STRING(v) ((duk_hstring *) (v)->vp[DUK_DBL_IDX_VP1])
+#define DUK_TVAL_GET_OBJECT(v) ((duk_hobject *) (v)->vp[DUK_DBL_IDX_VP1])
+#define DUK_TVAL_GET_BUFFER(v) ((duk_hbuffer *) (v)->vp[DUK_DBL_IDX_VP1])
+#define DUK_TVAL_GET_POINTER(v) ((void *) (v)->vp[DUK_DBL_IDX_VP1])
+#define DUK_TVAL_GET_HEAPHDR(v) ((duk_heaphdr *) (v)->vp[DUK_DBL_IDX_VP1])
+
+/* decoding */
+#define DUK_TVAL_GET_TAG(v) ((duk_small_uint_t) (v)->us[DUK_DBL_IDX_US0])
+
+#define DUK_TVAL_IS_UNDEFINED(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_UNDEFINED)
+#define DUK_TVAL_IS_UNDEFINED_ACTUAL(v) ((v)->ui[DUK_DBL_IDX_UI0] == DUK_XTAG_UNDEFINED_ACTUAL)
+#define DUK_TVAL_IS_UNDEFINED_UNUSED(v) ((v)->ui[DUK_DBL_IDX_UI0] == DUK_XTAG_UNDEFINED_UNUSED)
+#define DUK_TVAL_IS_NULL(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_NULL)
+#define DUK_TVAL_IS_BOOLEAN(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_BOOLEAN)
+#define DUK_TVAL_IS_BOOLEAN_TRUE(v) ((v)->ui[DUK_DBL_IDX_UI0] == DUK_XTAG_BOOLEAN_TRUE)
+#define DUK_TVAL_IS_BOOLEAN_FALSE(v) ((v)->ui[DUK_DBL_IDX_UI0] == DUK_XTAG_BOOLEAN_FALSE)
+#define DUK_TVAL_IS_LIGHTFUNC(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_LIGHTFUNC)
+#define DUK_TVAL_IS_STRING(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_STRING)
+#define DUK_TVAL_IS_OBJECT(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_OBJECT)
+#define DUK_TVAL_IS_BUFFER(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_BUFFER)
+#define DUK_TVAL_IS_POINTER(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_POINTER)
+#if defined(DUK_USE_FASTINT)
+/* 0xfff0 is -Infinity */
+#define DUK_TVAL_IS_DOUBLE(v) (DUK_TVAL_GET_TAG((v)) <= 0xfff0UL)
+#define DUK_TVAL_IS_FASTINT(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_FASTINT)
+#define DUK_TVAL_IS_NUMBER(v) (DUK_TVAL_GET_TAG((v)) <= 0xfff1UL)
+#else
+#define DUK_TVAL_IS_NUMBER(v) (DUK_TVAL_GET_TAG((v)) <= 0xfff0UL)
+#define DUK_TVAL_IS_DOUBLE(v) DUK_TVAL_IS_NUMBER((v))
+#endif
+
+#define DUK_TVAL_IS_HEAP_ALLOCATED(v) (DUK_TVAL_GET_TAG((v)) >= DUK_TAG_STRING)
+
+#if defined(DUK_USE_FASTINT)
+/* Inlining is only effective in a single file build. */
+DUK_INTERNAL_DECL DUK_ALWAYS_INLINE duk_double_t duk_tval_get_number_packed(duk_tval *tv);
+#endif
+
+#else /* DUK_USE_PACKED_TVAL */
+/* ======================================================================== */
+
+/*
+ * Portable 12-byte representation
+ */
+
+/* Note: not initializing all bytes is normally not an issue: Duktape won't
+ * read or use the uninitialized bytes so valgrind won't issue warnings.
+ * In some special cases a harmless valgrind warning may be issued though.
+ * For example, the DumpHeap debugger command writes out a compiled function's
+ * 'data' area as is, including any uninitialized bytes, which causes a
+ * valgrind warning.
+ */
+
+typedef struct duk_tval_struct duk_tval;
+
+struct duk_tval_struct {
+ duk_small_uint_t t;
+ duk_small_uint_t v_extra;
+ union {
+ 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 */
+#endif
+ void *voidptr;
+ duk_hstring *hstring;
+ duk_hobject *hobject;
+ duk_hcompiledfunction *hcompiledfunction;
+ duk_hnativefunction *hnativefunction;
+ duk_hthread *hthread;
+ duk_hbuffer *hbuffer;
+ duk_heaphdr *heaphdr;
+ duk_c_function lightfunc;
+ } v;
+};
+
+#define DUK__TAG_NUMBER 0 /* not exposed */
+#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_STRING 7
+#define DUK_TAG_OBJECT 8
+#define DUK_TAG_BUFFER 9
+
+/* 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
+ * type so it should come before DUK_TAG_STRING. Finally, it should not break
+ * the tag value ranges covered by case-clauses in a switch-case.
+ */
+
+/* setters */
+#define DUK_TVAL_SET_UNDEFINED_ACTUAL(tv) do { \
+ (tv)->t = DUK_TAG_UNDEFINED; \
+ (tv)->v.i = 0; \
+ } while (0)
+
+#define DUK_TVAL_SET_UNDEFINED_UNUSED(tv) do { \
+ (tv)->t = DUK_TAG_UNDEFINED; \
+ (tv)->v.i = 1; \
+ } while (0)
+
+#define DUK_TVAL_SET_NULL(tv) do { \
+ (tv)->t = DUK_TAG_NULL; \
+ } while (0)
+
+#define DUK_TVAL_SET_BOOLEAN(tv,val) do { \
+ (tv)->t = DUK_TAG_BOOLEAN; \
+ (tv)->v.i = (val); \
+ } while (0)
+
+#if defined(DUK_USE_FASTINT)
+#define DUK_TVAL_SET_DOUBLE(tv,val) do { \
+ (tv)->t = DUK__TAG_NUMBER; \
+ (tv)->v.d = (val); \
+ } while (0)
+#define DUK_TVAL_SET_FASTINT(tv,val) do { \
+ (tv)->t = DUK_TAG_FASTINT; \
+ (tv)->v.fi = (val); \
+ } while (0)
+#define DUK_TVAL_SET_FASTINT_U32(tv,val) do { \
+ (tv)->t = DUK_TAG_FASTINT; \
+ (tv)->v.fi = (duk_int64_t) (val); \
+ } while (0)
+#define DUK_TVAL_SET_FASTINT_I32(tv,val) do { \
+ (tv)->t = DUK_TAG_FASTINT; \
+ (tv)->v.fi = (duk_int64_t) (val); \
+ } while (0)
+#define DUK_TVAL_SET_NUMBER_CHKFAST(tv,d) \
+ duk_tval_set_number_chkfast((tv), (d))
+#define DUK_TVAL_SET_NUMBER(tv,val) \
+ DUK_TVAL_SET_DOUBLE((tv), (val))
+#define DUK_TVAL_CHKFAST_INPLACE(v) do { \
+ duk_tval *duk__tv; \
+ duk_double_t duk__d; \
+ duk__tv = (v); \
+ if (DUK_TVAL_IS_DOUBLE(duk__tv)) { \
+ duk__d = DUK_TVAL_GET_DOUBLE(duk__tv); \
+ DUK_TVAL_SET_NUMBER_CHKFAST(duk__tv, duk__d); \
+ } \
+ } while (0)
+#else
+#define DUK_TVAL_SET_NUMBER(tv,val) do { \
+ (tv)->t = DUK__TAG_NUMBER; \
+ (tv)->v.d = (val); \
+ } while (0)
+#define DUK_TVAL_SET_NUMBER_CHKFAST(v,d) \
+ DUK_TVAL_SET_NUMBER((tv), (d))
+#define DUK_TVAL_SET_DOUBLE(v,d) \
+ DUK_TVAL_SET_NUMBER((tv), (d))
+#define DUK_TVAL_CHKFAST_INPLACE(v) do { } while (0)
+#endif /* DUK_USE_FASTINT */
+
+#define DUK_TVAL_SET_POINTER(tv,hptr) do { \
+ (tv)->t = DUK_TAG_POINTER; \
+ (tv)->v.voidptr = (hptr); \
+ } while (0)
+
+#define DUK_TVAL_SET_LIGHTFUNC(tv,fp,flags) do { \
+ (tv)->t = DUK_TAG_LIGHTFUNC; \
+ (tv)->v_extra = (flags); \
+ (tv)->v.lightfunc = (duk_c_function) (fp); \
+ } while (0)
+
+#define DUK_TVAL_SET_STRING(tv,hptr) do { \
+ (tv)->t = DUK_TAG_STRING; \
+ (tv)->v.hstring = (hptr); \
+ } while (0)
+
+#define DUK_TVAL_SET_OBJECT(tv,hptr) do { \
+ (tv)->t = DUK_TAG_OBJECT; \
+ (tv)->v.hobject = (hptr); \
+ } while (0)
+
+#define DUK_TVAL_SET_BUFFER(tv,hptr) do { \
+ (tv)->t = DUK_TAG_BUFFER; \
+ (tv)->v.hbuffer = (hptr); \
+ } while (0)
+
+#define DUK_TVAL_SET_NAN(tv) do { \
+ /* in non-packed representation we don't care about which NaN is used */ \
+ (tv)->t = DUK__TAG_NUMBER; \
+ (tv)->v.d = DUK_DOUBLE_NAN; \
+ } while (0)
+
+#define DUK_TVAL_SET_TVAL(v,x) do { *(v) = *(x); } while (0)
+
+/* getters */
+#define DUK_TVAL_GET_BOOLEAN(tv) ((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))
+#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))
+#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)))
+#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 { \
+ (out_flags) = (duk_uint32_t) (tv)->v_extra; \
+ (out_fp) = (tv)->v.lightfunc; \
+ } while (0)
+#define DUK_TVAL_GET_LIGHTFUNC_FUNCPTR(tv) ((tv)->v.lightfunc)
+#define DUK_TVAL_GET_LIGHTFUNC_FLAGS(tv) ((duk_uint32_t) ((tv)->v_extra))
+#define DUK_TVAL_GET_STRING(tv) ((tv)->v.hstring)
+#define DUK_TVAL_GET_OBJECT(tv) ((tv)->v.hobject)
+#define DUK_TVAL_GET_BUFFER(tv) ((tv)->v.hbuffer)
+#define DUK_TVAL_GET_HEAPHDR(tv) ((tv)->v.heaphdr)
+
+/* decoding */
+#define DUK_TVAL_GET_TAG(tv) ((tv)->t)
+#define DUK_TVAL_IS_UNDEFINED(tv) ((tv)->t == DUK_TAG_UNDEFINED)
+#define DUK_TVAL_IS_UNDEFINED_ACTUAL(tv) (((tv)->t == DUK_TAG_UNDEFINED) && ((tv)->v.i == 0))
+#define DUK_TVAL_IS_UNDEFINED_UNUSED(tv) (((tv)->t == DUK_TAG_UNDEFINED) && ((tv)->v.i != 0))
+#define DUK_TVAL_IS_NULL(tv) ((tv)->t == DUK_TAG_NULL)
+#define DUK_TVAL_IS_BOOLEAN(tv) ((tv)->t == DUK_TAG_BOOLEAN)
+#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)
+#else
+#define DUK_TVAL_IS_NUMBER(tv) ((tv)->t == DUK__TAG_NUMBER)
+#define DUK_TVAL_IS_DOUBLE(v) DUK_TVAL_IS_NUMBER((v))
+#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_HEAP_ALLOCATED(tv) ((tv)->t >= DUK_TAG_STRING)
+
+#if defined(DUK_USE_FASTINT)
+/* Inlining is only effective in a single file build. */
+#if 0
+DUK_INTERNAL_DECL DUK_ALWAYS_INLINE duk_double_t duk_tval_get_number_unpacked(duk_tval *tv);
+#endif
+DUK_INTERNAL_DECL DUK_ALWAYS_INLINE duk_double_t duk_tval_get_number_unpacked_fastint(duk_tval *tv);
+#endif
+
+#endif /* DUK_USE_PACKED_TVAL */
+
+/*
+ * Convenience (independent of representation)
+ */
+
+#define DUK_TVAL_SET_BOOLEAN_TRUE(v) DUK_TVAL_SET_BOOLEAN(v, 1)
+#define DUK_TVAL_SET_BOOLEAN_FALSE(v) DUK_TVAL_SET_BOOLEAN(v, 0)
+
+/* Lightfunc flags packing and unpacking. */
+/* Sign extend: 0x0000##00 -> 0x##000000 -> sign extend to 0xssssss## */
+#define DUK_LFUNC_FLAGS_GET_MAGIC(lf_flags) \
+ ((((duk_int32_t) (lf_flags)) << 16) >> 24)
+#define DUK_LFUNC_FLAGS_GET_LENGTH(lf_flags) \
+ (((lf_flags) >> 4) & 0x0f)
+#define DUK_LFUNC_FLAGS_GET_NARGS(lf_flags) \
+ ((lf_flags) & 0x0f)
+#define DUK_LFUNC_FLAGS_PACK(magic,length,nargs) \
+ (((magic) & 0xff) << 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 (-0x800000000000LL)
+#define DUK_FASTINT_MAX 0x7fffffffffffLL
+#define DUK_FASTINT_BITS 48
+
+DUK_INTERNAL_DECL void duk_tval_set_number_chkfast(duk_tval *tv, duk_double_t x);
+#endif
+
+#endif /* DUK_TVAL_H_INCLUDED */
+#line 1 "duk_heaphdr.h"
+/*
+ * Heap header definition and assorted macros, including ref counting.
+ * Access all fields through the accessor macros.
+ */
+
+#ifndef DUK_HEAPHDR_H_INCLUDED
+#define DUK_HEAPHDR_H_INCLUDED
+
+/*
+ * Common heap header
+ *
+ * All heap objects share the same flags and refcount fields. Objects other
+ * than strings also need to have a single or double linked list pointers
+ * for insertion into the "heap allocated" list. Strings are held in the
+ * heap-wide string table so they don't need link pointers.
+ *
+ * Technically, 'h_refcount' must be wide enough to guarantee that it cannot
+ * wrap (otherwise objects might be freed incorrectly after wrapping). This
+ * means essentially that the refcount field must be as wide as data pointers.
+ * On 64-bit platforms this means that the refcount needs to be 64 bits even
+ * if an 'int' is 32 bits. This is a bit unfortunate, and compromising on
+ * this might be reasonable in the future.
+ *
+ * Heap header size on 32-bit platforms: 8 bytes without reference counting,
+ * 16 bytes with reference counting.
+ */
+
+struct duk_heaphdr {
+ duk_uint32_t h_flags;
+
+#if defined(DUK_USE_REFERENCE_COUNTING)
+#if defined(DUK_USE_REFCOUNT16)
+ duk_uint16_t h_refcount16;
+#else
+ duk_size_t h_refcount;
+#endif
+#endif
+
+#if defined(DUK_USE_HEAPPTR16)
+ duk_uint16_t h_next16;
+#else
+ duk_heaphdr *h_next;
+#endif
+
+#if defined(DUK_USE_DOUBLE_LINKED_HEAP)
+ /* refcounting requires direct heap frees, which in turn requires a dual linked heap */
+#if defined(DUK_USE_HEAPPTR16)
+ duk_uint16_t h_prev16;
+#else
+ duk_heaphdr *h_prev;
+#endif
+#endif
+
+ /* When DUK_USE_HEAPPTR16 (and DUK_USE_REFCOUNT16) is in use, the
+ * struct won't align nicely to 4 bytes. This 16-bit extra field
+ * is added to make the alignment clean; the field can be used by
+ * heap objects when 16-bit packing is used. This field is now
+ * conditional to DUK_USE_HEAPPTR16 only, but it is intended to be
+ * used with DUK_USE_REFCOUNT16 and DUK_USE_DOUBLE_LINKED_HEAP;
+ * this only matter to low memory environments anyway.
+ */
+#if defined(DUK_USE_HEAPPTR16)
+ duk_uint16_t h_extra16;
+#endif
+};
+
+struct duk_heaphdr_string {
+ /* 16 bits would be enough for shared heaphdr flags and duk_hstring
+ * flags. The initial parts of duk_heaphdr_string and duk_heaphdr
+ * must match so changing the flags field size here would be quite
+ * awkward. However, to minimize struct size, we can pack at least
+ * 16 bits of duk_hstring data into the flags field.
+ */
+ duk_uint32_t h_flags;
+
+#if defined(DUK_USE_REFERENCE_COUNTING)
+#if defined(DUK_USE_REFCOUNT16)
+ duk_uint16_t h_refcount16;
+#else
+ duk_size_t h_refcount;
+#endif
+#endif
+};
+
+#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 /* 4 heap flags */
+#define DUK_HEAPHDR_FLAGS_USER_START 6 /* 26 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_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_HTYPE_MIN 1
+#define DUK_HTYPE_STRING 1
+#define DUK_HTYPE_OBJECT 2
+#define DUK_HTYPE_BUFFER 3
+#define DUK_HTYPE_MAX 3
+
+#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 { \
+ (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 { \
+ (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 { \
+ (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 { \
+ (h)->h_prev = (val); \
+ } while (0)
+#endif
+#endif
+
+#if defined(DUK_USE_REFERENCE_COUNTING)
+#if defined(DUK_USE_REFCOUNT16)
+#define DUK_HEAPHDR_GET_REFCOUNT(h) ((h)->h_refcount16)
+#define DUK_HEAPHDR_SET_REFCOUNT(h,val) do { \
+ (h)->h_refcount16 = (val); \
+ } while (0)
+#define DUK_HEAPHDR_PREINC_REFCOUNT(h) (++(h)->h_refcount16) /* result: updated refcount */
+#define DUK_HEAPHDR_PREDEC_REFCOUNT(h) (--(h)->h_refcount16) /* result: updated refcount */
+#else
+#define DUK_HEAPHDR_GET_REFCOUNT(h) ((h)->h_refcount)
+#define DUK_HEAPHDR_SET_REFCOUNT(h,val) do { \
+ (h)->h_refcount = (val); \
+ } 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 */
+#endif
+#else
+/* refcount macros not defined without refcounting, caller must #ifdef now */
+#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_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 { \
+ (h)->h_flags = ((h)->h_flags & ~(DUK_HEAPHDR_FLAGS_TYPE_MASK)) | (val); \
+ } while (0)
+
+#define DUK_HEAPHDR_HTYPE_VALID(h) ( \
+ DUK_HEAPHDR_GET_TYPE((h)) >= DUK_HTYPE_MIN && \
+ 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); \
+ } while (0)
+
+#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 { \
+ 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_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_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)
+
+/* 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_SET_FLAG_RANGE(h,m,n,v) do { \
+ (h)->h_flags = \
+ ((h)->h_flags & (~(((1 << (n)) - 1) << (m)))) \
+ | ((v) << (m)); \
+ } while (0)
+
+/* init pointer fields to null */
+#if defined(DUK_USE_DOUBLE_LINKED_HEAP)
+#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 { \
+ DUK_HEAPHDR_SET_NEXT((h), (void *) NULL); \
+ } while (0)
+#endif
+
+#define DUK_HEAPHDR_STRING_INIT_NULLS(h) /* currently nop */
+
+/*
+ * Reference counting helper macros. The macros take a thread argument
+ * and must thus always be executed in a specific thread context. The
+ * thread argument is needed for features like finalization. Currently
+ * it is not required for INCREF, but it is included just in case.
+ *
+ * Note that 'raw' macros such as DUK_HEAPHDR_GET_REFCOUNT() are not
+ * defined without DUK_USE_REFERENCE_COUNTING, so caller must #ifdef
+ * around them.
+ */
+
+#if defined(DUK_USE_REFERENCE_COUNTING)
+
+/* 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 { \
+ duk_tval *duk__tv = (tv); \
+ DUK_ASSERT(duk__tv != NULL); \
+ if (DUK_TVAL_IS_HEAP_ALLOCATED(duk__tv)) { \
+ duk_heaphdr *duk__h = DUK_TVAL_GET_HEAPHDR(duk__tv); \
+ DUK_ASSERT(duk__h != NULL); \
+ DUK_ASSERT(DUK_HEAPHDR_HTYPE_VALID(duk__h)); \
+ DUK_HEAPHDR_PREINC_REFCOUNT(duk__h); \
+ } \
+ } while (0)
+#define DUK_TVAL_DECREF_FAST(thr,tv) do { \
+ duk_tval *duk__tv = (tv); \
+ DUK_ASSERT(duk__tv != NULL); \
+ if (DUK_TVAL_IS_HEAP_ALLOCATED(duk__tv)) { \
+ duk_heaphdr *duk__h = DUK_TVAL_GET_HEAPHDR(duk__tv); \
+ DUK_ASSERT(duk__h != NULL); \
+ DUK_ASSERT(DUK_HEAPHDR_HTYPE_VALID(duk__h)); \
+ DUK_ASSERT(DUK_HEAPHDR_GET_REFCOUNT(duk__h) > 0); \
+ if (DUK_HEAPHDR_PREDEC_REFCOUNT(duk__h) == 0) { \
+ duk_heaphdr_refzero((thr), duk__h); \
+ } \
+ } \
+ } while (0)
+#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)); \
+ DUK_HEAPHDR_PREINC_REFCOUNT(duk__h); \
+ } while (0)
+#define DUK_HEAPHDR_DECREF_FAST(thr,h) do { \
+ duk_heaphdr *duk__h = (duk_heaphdr *) (h); \
+ DUK_ASSERT(duk__h != NULL); \
+ DUK_ASSERT(DUK_HEAPHDR_HTYPE_VALID(duk__h)); \
+ DUK_ASSERT(DUK_HEAPHDR_GET_REFCOUNT(duk__h) > 0); \
+ if (DUK_HEAPHDR_PREDEC_REFCOUNT(duk__h) == 0) { \
+ duk_heaphdr_refzero((thr), duk__h); \
+ } \
+ } while (0)
+
+/* 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_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)
+
+/* Default variants. Selection depends on speed/size preference.
+ * Concretely: with gcc 4.8.1 -Os x64 the difference in final binary
+ * is about +1kB for _FAST variants.
+ */
+#if defined(DUK_USE_FAST_REFCOUNT_DEFAULT)
+#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_HEAPHDR_INCREF(thr,h) DUK_HEAPHDR_INCREF_FAST((thr),(h))
+#define DUK_HEAPHDR_DECREF(thr,h) DUK_HEAPHDR_DECREF_FAST((thr),(h))
+#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_HEAPHDR_INCREF(thr,h) DUK_HEAPHDR_INCREF_SLOW((thr),(h))
+#define DUK_HEAPHDR_DECREF(thr,h) DUK_HEAPHDR_DECREF_SLOW((thr),(h))
+#endif
+
+/* Casting convenience. */
+#define DUK_HSTRING_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) (h))
+#define DUK_HSTRING_DECREF(thr,h) DUK_HEAPHDR_DECREF((thr),(duk_heaphdr *) (h))
+#define DUK_HOBJECT_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) (h))
+#define DUK_HOBJECT_DECREF(thr,h) DUK_HEAPHDR_DECREF((thr),(duk_heaphdr *) (h))
+#define DUK_HBUFFER_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) (h))
+#define DUK_HBUFFER_DECREF(thr,h) DUK_HEAPHDR_DECREF((thr),(duk_heaphdr *) (h))
+#define DUK_HCOMPILEDFUNCTION_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) &(h)->obj)
+#define DUK_HCOMPILEDFUNCTION_DECREF(thr,h) DUK_HEAPHDR_DECREF((thr),(duk_heaphdr *) &(h)->obj)
+#define DUK_HNATIVEFUNCTION_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) &(h)->obj)
+#define DUK_HNATIVEFUNCTION_DECREF(thr,h) DUK_HEAPHDR_DECREF((thr),(duk_heaphdr *) &(h)->obj)
+#define DUK_HTHREAD_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) &(h)->obj)
+#define DUK_HTHREAD_DECREF(thr,h) DUK_HEAPHDR_DECREF((thr),(duk_heaphdr *) &(h)->obj)
+
+/* Convenience for some situations; the above macros don't allow NULLs
+ * for performance reasons.
+ */
+#define DUK_HOBJECT_INCREF_ALLOWNULL(thr,h) do { \
+ if ((h) != NULL) { \
+ DUK_HEAPHDR_INCREF((thr), (duk_heaphdr *) (h)); \
+ } \
+ } while (0)
+#define DUK_HOBJECT_DECREF_ALLOWNULL(thr,h) do { \
+ if ((h) != NULL) { \
+ DUK_HEAPHDR_DECREF((thr), (duk_heaphdr *) (h)); \
+ } \
+ } while (0)
+
+#else /* DUK_USE_REFERENCE_COUNTING */
+
+#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_INCREF_SLOW(thr,v) do {} while (0) /* nop */
+#define DUK_TVAL_DECREF_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_HEAPHDR_INCREF_FAST(thr,h) do {} while (0) /* nop */
+#define DUK_HEAPHDR_DECREF_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_INCREF(thr,h) do {} while (0) /* nop */
+#define DUK_HEAPHDR_DECREF(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_HOBJECT_INCREF(thr,h) do {} while (0) /* nop */
+#define DUK_HOBJECT_DECREF(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_HCOMPILEDFUNCTION_INCREF(thr,h) do {} while (0) /* nop */
+#define DUK_HCOMPILEDFUNCTION_DECREF(thr,h) do {} while (0) /* nop */
+#define DUK_HNATIVEFUNCTION_INCREF(thr,h) do {} while (0) /* nop */
+#define DUK_HNATIVEFUNCTION_DECREF(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_HOBJECT_INCREF_ALLOWNULL(thr,h) do {} while (0) /* nop */
+#define DUK_HOBJECT_DECREF_ALLOWNULL(thr,h) do {} while (0) /* nop */
+
+#endif /* DUK_USE_REFERENCE_COUNTING */
+
+#endif /* DUK_HEAPHDR_H_INCLUDED */
+#line 1 "duk_api_internal.h"
+/*
+ * Internal API calls which have (stack and other) semantics similar
+ * to the public API.
+ */
+
+#ifndef DUK_API_INTERNAL_H_INCLUDED
+#define DUK_API_INTERNAL_H_INCLUDED
+
+/* duk_push_sprintf constants */
+#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)
+
+/* Valstack resize flags */
+#define DUK_VSRESIZE_FLAG_SHRINK (1 << 0)
+#define DUK_VSRESIZE_FLAG_COMPACT (1 << 1)
+#define DUK_VSRESIZE_FLAG_THROW (1 << 2)
+
+/* 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_bool_t duk_valstack_resize_raw(duk_context *ctx,
+ duk_size_t min_new_size,
+ duk_small_uint_t flags);
+
+DUK_INTERNAL_DECL duk_tval *duk_get_tval(duk_context *ctx, duk_idx_t index);
+DUK_INTERNAL_DECL duk_tval *duk_require_tval(duk_context *ctx, duk_idx_t index);
+DUK_INTERNAL_DECL void duk_push_tval(duk_context *ctx, duk_tval *tv);
+
+/* Push the current 'this' binding; throw TypeError if binding is not object
+ * coercible (CheckObjectCoercible).
+ */
+DUK_INTERNAL_DECL void duk_push_this_check_object_coercible(duk_context *ctx);
+
+/* duk_push_this() + CheckObjectCoercible() + duk_to_object() */
+DUK_INTERNAL_DECL duk_hobject *duk_push_this_coercible_to_object(duk_context *ctx);
+
+/* duk_push_this() + CheckObjectCoercible() + duk_to_string() */
+DUK_INTERNAL_DECL duk_hstring *duk_push_this_coercible_to_string(duk_context *ctx);
+
+/* duk_push_(u)int() is guaranteed to support at least (un)signed 32-bit range */
+#define duk_push_u32(ctx,val) \
+ duk_push_uint((ctx), (duk_uint_t) (val))
+#define duk_push_i32(ctx,val) \
+ duk_push_int((ctx), (duk_int_t) (val))
+
+/* sometimes stack and array indices need to go on the stack */
+#define duk_push_idx(ctx,val) \
+ duk_push_int((ctx), (duk_int_t) (val))
+#define duk_push_uarridx(ctx,val) \
+ duk_push_uint((ctx), (duk_uint_t) (val))
+#define duk_push_size_t(ctx,val) \
+ duk_push_uint((ctx), (duk_uint_t) (val)) /* XXX: assumed to fit for now */
+
+/* internal helper for looking up a tagged type */
+#define DUK_GETTAGGED_FLAG_ALLOW_NULL (1L << 24)
+#define DUK_GETTAGGED_FLAG_CHECK_CLASS (1L << 25)
+#define DUK_GETTAGGED_CLASS_SHIFT 16
+
+DUK_INTERNAL_DECL duk_heaphdr *duk_get_tagged_heaphdr_raw(duk_context *ctx, duk_idx_t index, duk_uint_t flags_and_tag);
+
+DUK_INTERNAL_DECL duk_hstring *duk_get_hstring(duk_context *ctx, duk_idx_t index);
+DUK_INTERNAL_DECL duk_hobject *duk_get_hobject(duk_context *ctx, duk_idx_t index);
+DUK_INTERNAL_DECL duk_hbuffer *duk_get_hbuffer(duk_context *ctx, duk_idx_t index);
+DUK_INTERNAL_DECL duk_hthread *duk_get_hthread(duk_context *ctx, duk_idx_t index);
+DUK_INTERNAL_DECL duk_hcompiledfunction *duk_get_hcompiledfunction(duk_context *ctx, duk_idx_t index);
+DUK_INTERNAL_DECL duk_hnativefunction *duk_get_hnativefunction(duk_context *ctx, duk_idx_t index);
+
+#define duk_get_hobject_with_class(ctx,index,classnum) \
+ ((duk_hobject *) duk_get_tagged_heaphdr_raw((ctx), (index), \
+ DUK_TAG_OBJECT | DUK_GETTAGGED_FLAG_ALLOW_NULL | \
+ DUK_GETTAGGED_FLAG_CHECK_CLASS | ((classnum) << DUK_GETTAGGED_CLASS_SHIFT)))
+
+#if 0 /* This would be pointless: unexpected type and lightfunc would both return NULL */
+DUK_INTERNAL_DECL duk_hobject *duk_get_hobject_or_lfunc(duk_context *ctx, duk_idx_t index);
+#endif
+DUK_INTERNAL_DECL duk_hobject *duk_get_hobject_or_lfunc_coerce(duk_context *ctx, duk_idx_t index);
+
+#if 0 /*unused*/
+DUK_INTERNAL_DECL void *duk_get_voidptr(duk_context *ctx, duk_idx_t index);
+#endif
+
+DUK_INTERNAL_DECL duk_hstring *duk_to_hstring(duk_context *ctx, duk_idx_t index);
+DUK_INTERNAL_DECL duk_int_t duk_to_int_clamped_raw(duk_context *ctx, duk_idx_t index, 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_context *ctx, duk_idx_t index, duk_int_t minval, duk_int_t maxval);
+DUK_INTERNAL_DECL duk_int_t duk_to_int_check_range(duk_context *ctx, duk_idx_t index, duk_int_t minval, duk_int_t maxval);
+
+DUK_INTERNAL_DECL duk_hstring *duk_require_hstring(duk_context *ctx, duk_idx_t index);
+DUK_INTERNAL_DECL duk_hobject *duk_require_hobject(duk_context *ctx, duk_idx_t index);
+DUK_INTERNAL_DECL duk_hbuffer *duk_require_hbuffer(duk_context *ctx, duk_idx_t index);
+DUK_INTERNAL_DECL duk_hthread *duk_require_hthread(duk_context *ctx, duk_idx_t index);
+#if 0 /*unused */
+DUK_INTERNAL_DECL duk_hcompiledfunction *duk_require_hcompiledfunction(duk_context *ctx, duk_idx_t index);
+#endif
+DUK_INTERNAL_DECL duk_hnativefunction *duk_require_hnativefunction(duk_context *ctx, duk_idx_t index);
+
+#define duk_require_hobject_with_class(ctx,index,classnum) \
+ ((duk_hobject *) duk_get_tagged_heaphdr_raw((ctx), (index), \
+ DUK_TAG_OBJECT | \
+ DUK_GETTAGGED_FLAG_CHECK_CLASS | ((classnum) << DUK_GETTAGGED_CLASS_SHIFT)))
+
+DUK_INTERNAL_DECL duk_hobject *duk_require_hobject_or_lfunc(duk_context *ctx, duk_idx_t index);
+DUK_INTERNAL_DECL duk_hobject *duk_require_hobject_or_lfunc_coerce(duk_context *ctx, duk_idx_t index);
+
+#if defined(DUK_USE_DEBUGGER_SUPPORT)
+DUK_INTERNAL_DECL void duk_push_unused(duk_context *ctx);
+#endif
+DUK_INTERNAL_DECL void duk_push_hstring(duk_context *ctx, duk_hstring *h);
+DUK_INTERNAL_DECL void duk_push_hstring_stridx(duk_context *ctx, duk_small_int_t stridx);
+DUK_INTERNAL_DECL void duk_push_hobject(duk_context *ctx, duk_hobject *h);
+DUK_INTERNAL_DECL void duk_push_hbuffer(duk_context *ctx, duk_hbuffer *h);
+#define duk_push_hthread(ctx,h) \
+ duk_push_hobject((ctx), (duk_hobject *) (h))
+#define duk_push_hcompiledfunction(ctx,h) \
+ duk_push_hobject((ctx), (duk_hobject *) (h))
+#define duk_push_hnativefunction(ctx,h) \
+ duk_push_hobject((ctx), (duk_hobject *) (h))
+DUK_INTERNAL_DECL void duk_push_hobject_bidx(duk_context *ctx, duk_small_int_t builtin_idx);
+DUK_INTERNAL_DECL duk_idx_t duk_push_object_helper(duk_context *ctx, duk_uint_t hobject_flags_and_class, duk_small_int_t prototype_bidx);
+DUK_INTERNAL_DECL duk_idx_t duk_push_object_helper_proto(duk_context *ctx, duk_uint_t hobject_flags_and_class, duk_hobject *proto);
+DUK_INTERNAL_DECL duk_idx_t duk_push_object_internal(duk_context *ctx);
+DUK_INTERNAL_DECL duk_idx_t duk_push_compiledfunction(duk_context *ctx);
+DUK_INTERNAL_DECL void duk_push_c_function_noexotic(duk_context *ctx, duk_c_function func, duk_int_t nargs);
+DUK_INTERNAL_DECL void duk_push_c_function_noconstruct_noexotic(duk_context *ctx, duk_c_function func, duk_int_t nargs);
+
+DUK_INTERNAL_DECL void duk_push_string_funcptr(duk_context *ctx, duk_uint8_t *ptr, duk_size_t sz);
+DUK_INTERNAL_DECL void duk_push_lightfunc_name(duk_context *ctx, duk_tval *tv);
+DUK_INTERNAL_DECL void duk_push_lightfunc_tostring(duk_context *ctx, duk_tval *tv);
+
+DUK_INTERNAL_DECL duk_bool_t duk_get_prop_stridx(duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx); /* [] -> [val] */
+DUK_INTERNAL_DECL duk_bool_t duk_put_prop_stridx(duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx); /* [val] -> [] */
+DUK_INTERNAL_DECL duk_bool_t duk_del_prop_stridx(duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx); /* [] -> [] */
+DUK_INTERNAL_DECL duk_bool_t duk_has_prop_stridx(duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx); /* [] -> [] */
+
+DUK_INTERNAL_DECL duk_bool_t duk_get_prop_stridx_boolean(duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx, duk_bool_t *out_has_prop); /* [] -> [] */
+
+DUK_INTERNAL_DECL void duk_xdef_prop(duk_context *ctx, duk_idx_t obj_index, duk_small_uint_t desc_flags); /* [key val] -> [] */
+DUK_INTERNAL_DECL void duk_xdef_prop_index(duk_context *ctx, duk_idx_t obj_index, duk_uarridx_t arr_index, duk_small_uint_t desc_flags); /* [val] -> [] */
+DUK_INTERNAL_DECL void duk_xdef_prop_stridx(duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx, duk_small_uint_t desc_flags); /* [val] -> [] */
+DUK_INTERNAL_DECL void duk_xdef_prop_stridx_builtin(duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx, duk_small_int_t builtin_idx, duk_small_uint_t desc_flags); /* [] -> [] */
+DUK_INTERNAL_DECL void duk_xdef_prop_stridx_thrower(duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx, duk_small_uint_t desc_flags); /* [] -> [] */
+
+/* These are macros for now, but could be separate functions to reduce code
+ * footprint (check call site count before refactoring).
+ */
+#define duk_xdef_prop_wec(ctx,obj_index) \
+ duk_xdef_prop((ctx), (obj_index), DUK_PROPDESC_FLAGS_WEC)
+#define duk_xdef_prop_index_wec(ctx,obj_index,arr_index) \
+ duk_xdef_prop_index((ctx), (obj_index), (arr_index), DUK_PROPDESC_FLAGS_WEC)
+#define duk_xdef_prop_stridx_wec(ctx,obj_index,stridx) \
+ duk_xdef_prop_stridx((ctx), (obj_index), (stridx), DUK_PROPDESC_FLAGS_WEC)
+
+/* Set object 'length'. */
+DUK_INTERNAL_DECL void duk_set_length(duk_context *ctx, duk_idx_t index, duk_size_t length);
+
+#endif /* DUK_API_INTERNAL_H_INCLUDED */
+#line 1 "duk_hstring.h"
+/*
+ * Heap string representation.
+ *
+ * Strings are byte sequences ordinarily stored in extended UTF-8 format,
+ * allowing values larger than the official UTF-8 range (used internally)
+ * and also allowing UTF-8 encoding of surrogate pairs (CESU-8 format).
+ * Strings may also be invalid UTF-8 altogether which is the case e.g. with
+ * strings used as internal property names and raw buffers converted to
+ * strings. In such cases the 'clen' field contains an inaccurate value.
+ *
+ * Ecmascript requires support for 32-bit long strings. However, since each
+ * 16-bit codepoint can take 3 bytes in CESU-8, this representation can only
+ * support about 1.4G codepoint long strings in extreme cases. This is not
+ * really a practical issue.
+ */
+
+#ifndef DUK_HSTRING_H_INCLUDED
+#define DUK_HSTRING_H_INCLUDED
+
+/* Impose a maximum string length for now. Restricted artificially to
+ * ensure adding a heap header length won't overflow size_t. The limit
+ * should be synchronized with DUK_HBUFFER_MAX_BYTELEN.
+ *
+ * E5.1 makes provisions to support strings longer than 4G characters.
+ * This limit should be eliminated on 64-bit platforms (and increased
+ * closer to maximum support on 32-bit platforms).
+ */
+
+#if defined(DUK_USE_STRLEN16)
+#define DUK_HSTRING_MAX_BYTELEN (0x0000ffffUL)
+#else
+#define DUK_HSTRING_MAX_BYTELEN (0x7fffffffUL)
+#endif
+
+/* XXX: could add flags for "is valid CESU-8" (Ecmascript compatible strings),
+ * "is valid UTF-8", "is valid extended UTF-8" (internal strings are not,
+ * regexp bytecode is), and "contains non-BMP characters". These are not
+ * needed right now.
+ */
+
+#define DUK_HSTRING_FLAG_ARRIDX DUK_HEAPHDR_USER_FLAG(0) /* string is a valid array index */
+#define DUK_HSTRING_FLAG_INTERNAL DUK_HEAPHDR_USER_FLAG(1) /* string is internal */
+#define DUK_HSTRING_FLAG_RESERVED_WORD DUK_HEAPHDR_USER_FLAG(2) /* string is a reserved word (non-strict) */
+#define DUK_HSTRING_FLAG_STRICT_RESERVED_WORD DUK_HEAPHDR_USER_FLAG(3) /* string is a reserved word (strict) */
+#define DUK_HSTRING_FLAG_EVAL_OR_ARGUMENTS DUK_HEAPHDR_USER_FLAG(4) /* string is 'eval' or 'arguments' */
+#define DUK_HSTRING_FLAG_EXTDATA DUK_HEAPHDR_USER_FLAG(5) /* string data is external (duk_hstring_external) */
+
+#define DUK_HSTRING_HAS_ARRIDX(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ARRIDX)
+#define DUK_HSTRING_HAS_INTERNAL(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_INTERNAL)
+#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_SET_ARRIDX(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ARRIDX)
+#define DUK_HSTRING_SET_INTERNAL(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_INTERNAL)
+#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_CLEAR_ARRIDX(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ARRIDX)
+#define DUK_HSTRING_CLEAR_INTERNAL(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_INTERNAL)
+#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_IS_ASCII(x) (DUK_HSTRING_GET_BYTELEN((x)) == DUK_HSTRING_GET_CHARLEN((x)))
+#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 { \
+ (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 { \
+ (x)->hash = (v); \
+ } while (0)
+#endif
+
+#if defined(DUK_USE_STRLEN16)
+#define DUK_HSTRING_GET_BYTELEN(x) ((x)->blen16)
+#define DUK_HSTRING_SET_BYTELEN(x,v) do { \
+ (x)->blen16 = (v); \
+ } while (0)
+#define DUK_HSTRING_GET_CHARLEN(x) ((x)->clen16)
+#define DUK_HSTRING_SET_CHARLEN(x,v) do { \
+ (x)->clen16 = (v); \
+ } while (0)
+#else
+#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) ((x)->clen)
+#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_DATA(x) \
+ (DUK_HSTRING_HAS_EXTDATA((x)) ? \
+ DUK_HSTRING_GET_EXTDATA((duk_hstring_external *) (x)) : ((const duk_uint8_t *) ((x) + 1)))
+#else
+#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)
+
+/* 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)
+
+/* 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) \
+ (DUK_HSTRING_HAS_ARRIDX((h)) ? duk_js_to_arrayindex_string_helper((h)) : DUK_HSTRING_NO_ARRAY_INDEX)
+
+/* slower but more compact variant */
+#define DUK_HSTRING_GET_ARRIDX_SLOW(h) \
+ (duk_js_to_arrayindex_string_helper((h)))
+
+/*
+ * Misc
+ */
+
+struct duk_hstring {
+ /* Smaller heaphdr than for other objects, because strings are held
+ * in string intern table which requires no link pointers. Much of
+ * the 32-bit flags field is unused by flags, so we can stuff a 16-bit
+ * field in there.
+ */
+ duk_heaphdr_string hdr;
+
+ /* Note: we could try to stuff a partial hash (e.g. 16 bits) into the
+ * shared heap header. Good hashing needs more hash bits though.
+ */
+
+ /* string hash */
+#if defined(DUK_USE_STRHASH16)
+ /* If 16-bit hash is in use, stuff it into duk_heaphdr_string flags. */
+#else
+ duk_uint32_t hash;
+#endif
+
+ /* length in bytes (not counting NUL term) */
+#if defined(DUK_USE_STRLEN16)
+ duk_uint16_t blen16;
+#else
+ duk_uint32_t blen;
+#endif
+
+ /* length in codepoints (must be E5 compatible) */
+#if defined(DUK_USE_STRLEN16)
+ duk_uint16_t clen16;
+#else
+ duk_uint32_t clen;
+#endif
+
+ /*
+ * String value of 'blen+1' bytes follows (+1 for NUL termination
+ * convenience for C API). No alignment needs to be guaranteed
+ * for strings, but fields above should guarantee alignment-by-4
+ * (but not alignment-by-8).
+ */
+};
+
+/* The external string struct is defined even when the feature is inactive. */
+struct duk_hstring_external {
+ duk_hstring str;
+
+ /*
+ * For an external string, the NUL-terminated string data is stored
+ * externally. The user must guarantee that data behind this pointer
+ * doesn't change while it's used.
+ */
+
+ const duk_uint8_t *extdata;
+};
+
+/*
+ * Prototypes
+ */
+
+DUK_INTERNAL_DECL duk_ucodepoint_t duk_hstring_char_code_at_raw(duk_hthread *thr, duk_hstring *h, duk_uint_t pos);
+
+#endif /* DUK_HSTRING_H_INCLUDED */
+#line 1 "duk_hobject.h"
+/*
+ * Heap object representation.
+ *
+ * Heap objects are used for Ecmascript objects, arrays, and functions,
+ * but also for internal control like declarative and object environment
+ * records. Compiled functions, native functions, and threads are also
+ * objects but with an extended C struct.
+ *
+ * Objects provide the required Ecmascript semantics and exotic behaviors
+ * especially for property access.
+ *
+ * Properties are stored in three conceptual parts:
+ *
+ * 1. A linear 'entry part' contains ordered key-value-attributes triples
+ * and is the main method of string properties.
+ *
+ * 2. An optional linear 'array part' is used for array objects to store a
+ * (dense) range of [0,N[ array indexed entries with default attributes
+ * (writable, enumerable, configurable). If the array part would become
+ * sparse or non-default attributes are required, the array part is
+ * abandoned and moved to the 'entry part'.
+ *
+ * 3. An optional 'hash part' is used to optimize lookups of the entry
+ * part; it is used only for objects with sufficiently many properties
+ * and can be abandoned without loss of information.
+ *
+ * These three conceptual parts are stored in a single memory allocated area.
+ * This minimizes memory allocation overhead but also means that all three
+ * parts are resized together, and makes property access a bit complicated.
+ */
+
+#ifndef DUK_HOBJECT_H_INCLUDED
+#define DUK_HOBJECT_H_INCLUDED
+
+/* there are currently 26 flag bits available */
+#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_BOUND DUK_HEAPHDR_USER_FLAG(2) /* object established using Function.prototype.bind() */
+#define DUK_HOBJECT_FLAG_COMPILEDFUNCTION DUK_HEAPHDR_USER_FLAG(4) /* object is a compiled function (duk_hcompiledfunction) */
+#define DUK_HOBJECT_FLAG_NATIVEFUNCTION DUK_HEAPHDR_USER_FLAG(5) /* object is a native function (duk_hnativefunction) */
+#define DUK_HOBJECT_FLAG_THREAD DUK_HEAPHDR_USER_FLAG(6) /* object is a thread (duk_hthread) */
+#define DUK_HOBJECT_FLAG_ARRAY_PART DUK_HEAPHDR_USER_FLAG(7) /* object has an array part (a_size may still be 0) */
+#define DUK_HOBJECT_FLAG_STRICT DUK_HEAPHDR_USER_FLAG(8) /* function: function object is strict */
+#define DUK_HOBJECT_FLAG_NOTAIL DUK_HEAPHDR_USER_FLAG(9) /* function: function must not be tailcalled */
+#define DUK_HOBJECT_FLAG_NEWENV DUK_HEAPHDR_USER_FLAG(10) /* function: create new environment when called (see duk_hcompiledfunction) */
+#define DUK_HOBJECT_FLAG_NAMEBINDING DUK_HEAPHDR_USER_FLAG(11) /* function: create binding for func name (function templates only, used for named function expressions) */
+#define DUK_HOBJECT_FLAG_CREATEARGS DUK_HEAPHDR_USER_FLAG(12) /* function: create an arguments object on function call */
+#define DUK_HOBJECT_FLAG_ENVRECCLOSED DUK_HEAPHDR_USER_FLAG(13) /* envrec: (declarative) record is closed */
+#define DUK_HOBJECT_FLAG_EXOTIC_ARRAY DUK_HEAPHDR_USER_FLAG(14) /* 'Array' object, array length and index exotic behavior */
+#define DUK_HOBJECT_FLAG_EXOTIC_STRINGOBJ DUK_HEAPHDR_USER_FLAG(15) /* 'String' object, array index exotic behavior */
+#define DUK_HOBJECT_FLAG_EXOTIC_ARGUMENTS DUK_HEAPHDR_USER_FLAG(16) /* 'Arguments' object and has arguments exotic behavior (non-strict callee) */
+#define DUK_HOBJECT_FLAG_EXOTIC_DUKFUNC DUK_HEAPHDR_USER_FLAG(17) /* Duktape/C (nativefunction) object, exotic 'length' */
+#define DUK_HOBJECT_FLAG_EXOTIC_BUFFEROBJ DUK_HEAPHDR_USER_FLAG(18) /* 'Buffer' object, array index exotic behavior, virtual 'length' */
+#define DUK_HOBJECT_FLAG_EXOTIC_PROXYOBJ DUK_HEAPHDR_USER_FLAG(19) /* 'Proxy' object */
+/* bit 20 unused */
+
+#define DUK_HOBJECT_FLAG_CLASS_BASE DUK_HEAPHDR_USER_FLAG_NUMBER(21)
+#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) \
+ DUK_HEAPHDR_SET_FLAG_RANGE(&(h)->hdr, DUK_HOBJECT_FLAG_CLASS_BASE, DUK_HOBJECT_FLAG_CLASS_BITS, (v))
+
+/* Macro for creating flag initializer from a class number.
+ * Unsigned type cast is needed to avoid warnings about coercing
+ * 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)
+
+/* E5 Section 8.6.2 + custom classes */
+#define DUK_HOBJECT_CLASS_UNUSED 0
+#define DUK_HOBJECT_CLASS_ARGUMENTS 1
+#define DUK_HOBJECT_CLASS_ARRAY 2
+#define DUK_HOBJECT_CLASS_BOOLEAN 3
+#define DUK_HOBJECT_CLASS_DATE 4
+#define DUK_HOBJECT_CLASS_ERROR 5
+#define DUK_HOBJECT_CLASS_FUNCTION 6
+#define DUK_HOBJECT_CLASS_JSON 7
+#define DUK_HOBJECT_CLASS_MATH 8
+#define DUK_HOBJECT_CLASS_NUMBER 9
+#define DUK_HOBJECT_CLASS_OBJECT 10
+#define DUK_HOBJECT_CLASS_REGEXP 11
+#define DUK_HOBJECT_CLASS_STRING 12
+#define DUK_HOBJECT_CLASS_GLOBAL 13
+#define DUK_HOBJECT_CLASS_OBJENV 14 /* custom */
+#define DUK_HOBJECT_CLASS_DECENV 15 /* custom */
+#define DUK_HOBJECT_CLASS_BUFFER 16 /* custom */
+#define DUK_HOBJECT_CLASS_POINTER 17 /* custom */
+#define DUK_HOBJECT_CLASS_THREAD 18 /* custom */
+
+#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_GET_CLASS_NUMBER((h)) == DUK_HOBJECT_CLASS_ARRAY)
+#define DUK_HOBJECT_IS_COMPILEDFUNCTION(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_COMPILEDFUNCTION)
+#define DUK_HOBJECT_IS_NATIVEFUNCTION(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NATIVEFUNCTION)
+#define DUK_HOBJECT_IS_THREAD(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_THREAD)
+
+#define DUK_HOBJECT_IS_NONBOUND_FUNCTION(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, \
+ DUK_HOBJECT_FLAG_COMPILEDFUNCTION | \
+ DUK_HOBJECT_FLAG_NATIVEFUNCTION)
+
+#define DUK_HOBJECT_IS_FUNCTION(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, \
+ DUK_HOBJECT_FLAG_BOUND | \
+ DUK_HOBJECT_FLAG_COMPILEDFUNCTION | \
+ DUK_HOBJECT_FLAG_NATIVEFUNCTION)
+
+#define DUK_HOBJECT_IS_CALLABLE(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, \
+ DUK_HOBJECT_FLAG_BOUND | \
+ DUK_HOBJECT_FLAG_COMPILEDFUNCTION | \
+ DUK_HOBJECT_FLAG_NATIVEFUNCTION)
+
+/* 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_EXOTIC_DUKFUNC | \
+ DUK_HOBJECT_FLAG_EXOTIC_BUFFEROBJ | \
+ 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_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_BOUND(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BOUND)
+#define DUK_HOBJECT_HAS_COMPILEDFUNCTION(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_COMPILEDFUNCTION)
+#define DUK_HOBJECT_HAS_NATIVEFUNCTION(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NATIVEFUNCTION)
+#define DUK_HOBJECT_HAS_THREAD(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_THREAD)
+#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_ENVRECCLOSED(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_ENVRECCLOSED)
+#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_EXOTIC_DUKFUNC(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_DUKFUNC)
+#define DUK_HOBJECT_HAS_EXOTIC_BUFFEROBJ(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_BUFFEROBJ)
+#define DUK_HOBJECT_HAS_EXOTIC_PROXYOBJ(h) DUK_HEAPHDR_CHECK_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_PROXYOBJ)
+
+#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_BOUND(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BOUND)
+#define DUK_HOBJECT_SET_COMPILEDFUNCTION(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_COMPILEDFUNCTION)
+#define DUK_HOBJECT_SET_NATIVEFUNCTION(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NATIVEFUNCTION)
+#define DUK_HOBJECT_SET_THREAD(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_THREAD)
+#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_ENVRECCLOSED(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_ENVRECCLOSED)
+#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_EXOTIC_DUKFUNC(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_DUKFUNC)
+#define DUK_HOBJECT_SET_EXOTIC_BUFFEROBJ(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_BUFFEROBJ)
+#define DUK_HOBJECT_SET_EXOTIC_PROXYOBJ(h) DUK_HEAPHDR_SET_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_PROXYOBJ)
+
+#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_BOUND(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_BOUND)
+#define DUK_HOBJECT_CLEAR_COMPILEDFUNCTION(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_COMPILEDFUNCTION)
+#define DUK_HOBJECT_CLEAR_NATIVEFUNCTION(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_NATIVEFUNCTION)
+#define DUK_HOBJECT_CLEAR_THREAD(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_THREAD)
+#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_ENVRECCLOSED(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_ENVRECCLOSED)
+#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_EXOTIC_DUKFUNC(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_DUKFUNC)
+#define DUK_HOBJECT_CLEAR_EXOTIC_BUFFEROBJ(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_BUFFEROBJ)
+#define DUK_HOBJECT_CLEAR_EXOTIC_PROXYOBJ(h) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(h)->hdr, DUK_HOBJECT_FLAG_EXOTIC_PROXYOBJ)
+
+/* flags used for property attributes in duk_propdesc and packed flags */
+#define DUK_PROPDESC_FLAG_WRITABLE (1 << 0) /* E5 Section 8.6.1 */
+#define DUK_PROPDESC_FLAG_ENUMERABLE (1 << 1) /* E5 Section 8.6.1 */
+#define DUK_PROPDESC_FLAG_CONFIGURABLE (1 << 2) /* E5 Section 8.6.1 */
+#define DUK_PROPDESC_FLAG_ACCESSOR (1 << 3) /* accessor */
+#define DUK_PROPDESC_FLAG_VIRTUAL (1 << 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 (1 << 4) /* internal define property: skip write silently if exists */
+
+/* convenience */
+#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)
+
+/*
+ * Macros to access the 'props' allocation.
+ */
+
+#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 { \
+ ((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 { \
+ (h)->props = (x); \
+ } while (0)
+#endif
+
+#if defined(DUK_USE_HOBJECT_LAYOUT_1)
+/* LAYOUT 1 */
+#define DUK_HOBJECT_E_GET_KEY_BASE(heap,h) \
+ ((duk_hstring **) ( \
+ DUK_HOBJECT_GET_PROPS((heap), (h)) \
+ ))
+#define DUK_HOBJECT_E_GET_VALUE_BASE(heap,h) \
+ ((duk_propvalue *) ( \
+ 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 *) ( \
+ 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 *) ( \
+ 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 *) ( \
+ 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 **) (p_base); \
+ (set_e_pv) = (duk_propvalue *) ((set_e_k) + (n_ent)); \
+ (set_e_f) = (duk_uint8_t *) ((set_e_pv) + (n_ent)); \
+ (set_a) = (duk_tval *) ((set_e_f) + (n_ent)); \
+ (set_h) = (duk_uint32_t *) ((set_a) + (n_arr)); \
+ } while (0)
+#elif defined(DUK_USE_HOBJECT_LAYOUT_2)
+/* LAYOUT 2 */
+#if defined(DUK_USE_ALIGN_4)
+#define DUK_HOBJECT_E_FLAG_PADDING(e_sz) ((4 - (e_sz)) & 0x03)
+#elif defined(DUK_USE_ALIGN_8)
+#define DUK_HOBJECT_E_FLAG_PADDING(e_sz) ((8 - (e_sz)) & 0x07)
+#else
+#define DUK_HOBJECT_E_FLAG_PADDING(e_sz) 0
+#endif
+#define DUK_HOBJECT_E_GET_KEY_BASE(heap,h) \
+ ((duk_hstring **) ( \
+ 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 *) ( \
+ DUK_HOBJECT_GET_PROPS((heap), (h)) \
+ ))
+#define DUK_HOBJECT_E_GET_FLAGS_BASE(heap,h) \
+ ((duk_uint8_t *) ( \
+ 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 *) ( \
+ 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 *) ( \
+ 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 *) (p_base); \
+ (set_e_k) = (duk_hstring **) ((set_e_pv) + (n_ent)); \
+ (set_e_f) = (duk_uint8_t *) ((set_e_k) + (n_ent)); \
+ (set_a) = (duk_tval *) (((duk_uint8_t *) (set_e_f)) + \
+ sizeof(duk_uint8_t) * (n_ent) + \
+ DUK_HOBJECT_E_FLAG_PADDING((n_ent))); \
+ (set_h) = (duk_uint32_t *) ((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 **) ( \
+ 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 *) ( \
+ DUK_HOBJECT_GET_PROPS((heap), (h)) \
+ ))
+#define DUK_HOBJECT_E_GET_FLAGS_BASE(heap,h) \
+ ((duk_uint8_t *) ( \
+ 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 *) ( \
+ 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 *) ( \
+ 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 *) (p_base); \
+ (set_a) = (duk_tval *) ((set_e_pv) + (n_ent)); \
+ (set_e_k) = (duk_hstring **) ((set_a) + (n_arr)); \
+ (set_h) = (duk_uint32_t *) ((set_e_k) + (n_ent)); \
+ (set_e_f) = (duk_uint8_t *) ((set_h) + (n_hash)); \
+ } while (0)
+#else
+#error invalid hobject layout defines
+#endif /* hobject property layout */
+
+#define DUK_HOBJECT_E_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 { \
+ DUK_HOBJECT_E_GET_KEY((heap), (h), (i)) = (k); \
+ } while (0)
+#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 { \
+ DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).v = (v); \
+ } while (0)
+#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 { \
+ DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).a.set = (v); \
+ } while (0)
+#define DUK_HOBJECT_E_SET_FLAGS(heap,h,i,f) do { \
+ DUK_HOBJECT_E_GET_FLAGS((heap), (h), (i)) = (f); \
+ } while (0)
+#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 { \
+ DUK_HOBJECT_H_GET_INDEX((heap), (h), (i)) = (v); \
+ } while (0)
+
+#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 { \
+ 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_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_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
+
+/*
+ * Macros for accessing size fields
+ */
+
+#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_GET_ENEXT(h) ((h)->e_next16)
+#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)
+#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)
+#else
+#define DUK_HOBJECT_GET_HSIZE(h) 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_GET_ENEXT(h) ((h)->e_next)
+#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)
+#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)
+#else
+#define DUK_HOBJECT_GET_HSIZE(h) 0
+#define DUK_HOBJECT_SET_HSIZE(h,v) do { DUK_ASSERT((v) == 0); } while (0)
+#endif
+#endif
+
+/*
+ * Misc
+ */
+
+/* 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
+
+/* Maximum traversal depth for "bound function" chains. */
+#define DUK_HOBJECT_BOUND_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_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 { \
+ (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 { \
+ (h)->prototype = (x); \
+ } while (0)
+#endif
+
+/* note: this updates refcounts */
+#define DUK_HOBJECT_SET_PROTOTYPE_UPDREF(thr,h,p) duk_hobject_set_prototype((thr), (h), (p))
+
+/*
+ * Resizing and hash behavior
+ */
+
+/* Sanity limit on max number of properties (allocated, not necessarily used).
+ * This is somewhat arbitrary, but if we're close to 2**32 properties some
+ * algorithms will fail (e.g. hash size selection, next prime selection).
+ * Also, we use negative array/entry table indices to indicate 'not found',
+ * so anything above 0x80000000 will cause trouble now.
+ */
+#if defined(DUK_USE_OBJSIZES16)
+#define DUK_HOBJECT_MAX_PROPERTIES 0x0000ffffUL
+#else
+#define DUK_HOBJECT_MAX_PROPERTIES 0x7fffffffUL /* 2**31-1 ~= 2G properties */
+#endif
+
+/* higher value conserves memory; also note that linear scan is cache friendly */
+#define DUK_HOBJECT_E_USE_HASH_LIMIT 32
+
+/* hash size relative to entries size: for value X, approx. hash_prime(e_size + e_size / X) */
+#define DUK_HOBJECT_H_SIZE_DIVISOR 4 /* hash size approx. 1.25 times entries size */
+
+/* if new_size < L * old_size, resize without abandon check; L = 3-bit fixed point, e.g. 9 -> 9/8 = 112.5% */
+#define DUK_HOBJECT_A_FAST_RESIZE_LIMIT 9 /* 112.5%, i.e. new size less than 12.5% higher -> fast resize */
+
+/* if density < L, abandon array part, L = 3-bit fixed point, e.g. 2 -> 2/8 = 25% */
+/* limit is quite low: one array entry is 8 bytes, one normal entry is 4+1+8+4 = 17 bytes (with hash entry) */
+#define DUK_HOBJECT_A_ABANDON_LIMIT 2 /* 25%, i.e. less than 25% used -> abandon */
+
+/* internal align target for props allocation, must be 2*n for some n */
+#if defined(DUK_USE_ALIGN_4)
+#define DUK_HOBJECT_ALIGN_TARGET 4
+#elif defined(DUK_USE_ALIGN_8)
+#define DUK_HOBJECT_ALIGN_TARGET 8
+#else
+#define DUK_HOBJECT_ALIGN_TARGET 1
+#endif
+
+/* controls for minimum entry part growth */
+#define DUK_HOBJECT_E_MIN_GROW_ADD 16
+#define DUK_HOBJECT_E_MIN_GROW_DIVISOR 8 /* 2^3 -> 1/8 = 12.5% min growth */
+
+/* controls for minimum array part growth */
+#define DUK_HOBJECT_A_MIN_GROW_ADD 16
+#define DUK_HOBJECT_A_MIN_GROW_DIVISOR 8 /* 2^3 -> 1/8 = 12.5% min growth */
+
+/* probe sequence */
+#define DUK_HOBJECT_HASH_INITIAL(hash,h_size) ((hash) % (h_size))
+#define DUK_HOBJECT_HASH_PROBE_STEP(hash) DUK_UTIL_GET_HASH_PROBE_STEP((hash))
+
+/*
+ * PC-to-line constants
+ */
+
+#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)
+
+/*
+ * Struct defs
+ */
+
+struct duk_propaccessor {
+ duk_hobject *get;
+ duk_hobject *set;
+};
+
+union duk_propvalue {
+ /* The get/set pointers could be 16-bit pointer compressed but it
+ * would make no difference on 32-bit platforms because duk_tval is
+ * 8 bytes or more anyway.
+ */
+ duk_tval v;
+ duk_propaccessor a;
+};
+
+struct duk_propdesc {
+ /* read-only values 'lifted' for ease of use */
+ duk_small_int_t flags;
+ duk_hobject *get;
+ 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 */
+};
+
+struct duk_hobject {
+ duk_heaphdr hdr;
+
+ /*
+ * 'props' contains {key,value,flags} entries, optional array entries, and
+ * an optional hash lookup table for non-array entries in a single 'sliced'
+ * allocation. There are several layout options, which differ slightly in
+ * generated code size/speed and alignment/padding; duk_features.h selects
+ * the layout used.
+ *
+ * Layout 1 (DUK_USE_HOBJECT_LAYOUT_1):
+ *
+ * e_size * sizeof(duk_hstring *) bytes of entry keys (e_next gc reachable)
+ * e_size * sizeof(duk_propvalue) bytes of entry values (e_next gc reachable)
+ * e_size * sizeof(duk_uint8_t) bytes of entry flags (e_next gc reachable)
+ * a_size * sizeof(duk_tval) bytes of (opt) array values (plain only) (all gc reachable)
+ * h_size * sizeof(duk_uint32_t) bytes of (opt) hash indexes to entries (e_size),
+ * 0xffffffffUL = unused, 0xfffffffeUL = deleted
+ *
+ * Layout 2 (DUK_USE_HOBJECT_LAYOUT_2):
+ *
+ * e_size * sizeof(duk_propvalue) bytes of entry values (e_next gc reachable)
+ * e_size * sizeof(duk_hstring *) bytes of entry keys (e_next gc reachable)
+ * e_size * sizeof(duk_uint8_t) + pad bytes of entry flags (e_next gc reachable)
+ * a_size * sizeof(duk_tval) bytes of (opt) array values (plain only) (all gc reachable)
+ * h_size * sizeof(duk_uint32_t) bytes of (opt) hash indexes to entries (e_size),
+ * 0xffffffffUL = unused, 0xfffffffeUL = deleted
+ *
+ * Layout 3 (DUK_USE_HOBJECT_LAYOUT_3):
+ *
+ * e_size * sizeof(duk_propvalue) bytes of entry values (e_next gc reachable)
+ * a_size * sizeof(duk_tval) bytes of (opt) array values (plain only) (all gc reachable)
+ * e_size * sizeof(duk_hstring *) bytes of entry keys (e_next gc reachable)
+ * h_size * sizeof(duk_uint32_t) bytes of (opt) hash indexes to entries (e_size),
+ * 0xffffffffUL = unused, 0xfffffffeUL = deleted
+ * e_size * sizeof(duk_uint8_t) bytes of entry flags (e_next gc reachable)
+ *
+ * In layout 1, the 'e_next' count is rounded to 4 or 8 on platforms
+ * requiring 4 or 8 byte alignment. This ensures proper alignment
+ * for the entries, at the cost of memory footprint. However, it's
+ * probably preferable to use another layout on such platforms instead.
+ *
+ * In layout 2, the key and value parts are swapped to avoid padding
+ * the key array on platforms requiring alignment by 8. The flags part
+ * is padded to get alignment for array entries. The 'e_next' count does
+ * not need to be rounded as in layout 1.
+ *
+ * In layout 3, entry values and array values are always aligned properly,
+ * and assuming pointers are at most 8 bytes, so are the entry keys. Hash
+ * indices will be properly aligned (assuming pointers are at least 4 bytes).
+ * Finally, flags don't need additional alignment. This layout provides
+ * compact allocations without padding (even on platforms with alignment
+ * requirements) at the cost of a bit slower lookups.
+ *
+ * Objects with few keys don't have a hash index; keys are looked up linearly,
+ * which is cache efficient because the keys are consecutive. Larger objects
+ * have a hash index part which contains integer indexes to the entries part.
+ *
+ * A single allocation reduces memory allocation overhead but requires more
+ * work when any part needs to be resized. A sliced allocation for entries
+ * makes linear key matching faster on most platforms (more locality) and
+ * skimps on flags size (which would be followed by 3 bytes of padding in
+ * most architectures if entries were placed in a struct).
+ *
+ * 'props' also contains internal properties distinguished with a non-BMP
+ * prefix. Often used properties should be placed early in 'props' whenever
+ * possible to make accessing them as fast a possible.
+ */
+
+#if defined(DUK_USE_HEAPPTR16)
+ /* Located in duk_heaphdr h_extra16. Subclasses of duk_hobject (like
+ * duk_hcompiledfunction) are not free to use h_extra16 for this reason.
+ */
+#else
+ duk_uint8_t *props;
+#endif
+
+ /* prototype: the only internal property lifted outside 'e' as it is so central */
+#if defined(DUK_USE_HEAPPTR16)
+ duk_uint16_t prototype16;
+#else
+ duk_hobject *prototype;
+#endif
+
+#if defined(DUK_USE_OBJSIZES16)
+ duk_uint16_t e_size16;
+ duk_uint16_t e_next16;
+ duk_uint16_t a_size16;
+#if defined(DUK_USE_HOBJECT_HASH_PART)
+ 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) */
+#if defined(DUK_USE_HOBJECT_HASH_PART)
+ duk_uint32_t h_size; /* hash part size or 0 if unused */
+#endif
+#endif
+};
+
+/*
+ * Exposed data
+ */
+
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL duk_uint8_t duk_class_number_to_stridx[32];
+#endif /* !DUK_SINGLE_FILE */
+
+/*
+ * Prototypes
+ */
+
+/* alloc and init */
+DUK_INTERNAL_DECL duk_hobject *duk_hobject_alloc(duk_heap *heap, duk_uint_t hobject_flags);
+#if 0 /* unused */
+DUK_INTERNAL_DECL duk_hobject *duk_hobject_alloc_checked(duk_hthread *thr, duk_uint_t hobject_flags);
+#endif
+DUK_INTERNAL_DECL duk_hcompiledfunction *duk_hcompiledfunction_alloc(duk_heap *heap, duk_uint_t hobject_flags);
+DUK_INTERNAL_DECL duk_hnativefunction *duk_hnativefunction_alloc(duk_heap *heap, duk_uint_t hobject_flags);
+DUK_INTERNAL_DECL duk_hthread *duk_hthread_alloc(duk_heap *heap, duk_uint_t hobject_flags);
+
+/* low-level property functions */
+DUK_INTERNAL_DECL void duk_hobject_find_existing_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_existing_entry_tval_ptr(duk_heap *heap, duk_hobject *obj, duk_hstring *key);
+DUK_INTERNAL_DECL duk_tval *duk_hobject_find_existing_entry_tval_ptr_and_attrs(duk_heap *heap, duk_hobject *obj, duk_hstring *key, duk_int_t *out_attrs);
+DUK_INTERNAL_DECL duk_tval *duk_hobject_find_existing_array_entry_tval_ptr(duk_heap *heap, duk_hobject *obj, duk_uarridx_t i);
+
+/* 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_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 (1 << 0)
+#define DUK_DELPROP_FLAG_FORCE (1 << 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_accessor_internal(duk_hthread *thr, duk_hobject *obj, duk_hstring *key, duk_hobject *getter, duk_hobject *setter, duk_small_uint_t propflags);
+DUK_INTERNAL_DECL void duk_hobject_set_length(duk_hthread *thr, duk_hobject *obj, duk_uint32_t length); /* XXX: duk_uarridx_t? */
+DUK_INTERNAL_DECL void duk_hobject_set_length_zero(duk_hthread *thr, duk_hobject *obj);
+DUK_INTERNAL_DECL duk_uint32_t duk_hobject_get_length(duk_hthread *thr, duk_hobject *obj); /* XXX: duk_uarridx_t? */
+
+/* helpers for defineProperty() and defineProperties() */
+DUK_INTERNAL_DECL
+void duk_hobject_prepare_property_descriptor(duk_context *ctx,
+ duk_idx_t idx_in,
+ duk_uint_t *out_defprop_flags,
+ duk_idx_t *out_idx_value,
+ duk_hobject **out_getter,
+ duk_hobject **out_setter);
+DUK_INTERNAL_DECL
+void duk_hobject_define_property_helper(duk_context *ctx,
+ duk_uint_t defprop_flags,
+ duk_hobject *obj,
+ duk_hstring *key,
+ duk_idx_t idx_value,
+ duk_hobject *get,
+ duk_hobject *set);
+
+/* Object built-in methods */
+DUK_INTERNAL_DECL duk_ret_t duk_hobject_object_get_own_property_descriptor(duk_context *ctx);
+DUK_INTERNAL_DECL void duk_hobject_object_seal_freeze_helper(duk_hthread *thr, duk_hobject *obj, duk_bool_t is_freeze);
+DUK_INTERNAL_DECL duk_bool_t duk_hobject_object_is_sealed_frozen_helper(duk_hthread *thr, duk_hobject *obj, duk_bool_t is_frozen);
+DUK_INTERNAL_DECL duk_bool_t duk_hobject_object_ownprop_helper(duk_context *ctx, duk_small_uint_t required_desc_flags);
+
+/* internal properties */
+DUK_INTERNAL_DECL duk_bool_t duk_hobject_get_internal_value(duk_heap *heap, duk_hobject *obj, duk_tval *tv);
+DUK_INTERNAL_DECL duk_hstring *duk_hobject_get_internal_value_string(duk_heap *heap, duk_hobject *obj);
+DUK_INTERNAL_DECL duk_hbuffer *duk_hobject_get_internal_value_buffer(duk_heap *heap, duk_hobject *obj);
+
+/* hobject management functions */
+DUK_INTERNAL_DECL void duk_hobject_compact_props(duk_hthread *thr, duk_hobject *obj);
+
+/* ES6 proxy */
+#if defined(DUK_USE_ES6_PROXY)
+DUK_INTERNAL_DECL duk_bool_t duk_hobject_proxy_check(duk_hthread *thr, duk_hobject *obj, duk_hobject **out_target, duk_hobject **out_handler);
+#endif
+
+/* enumeration */
+DUK_INTERNAL_DECL void duk_hobject_enumerator_create(duk_context *ctx, duk_small_uint_t enum_flags);
+DUK_INTERNAL_DECL duk_ret_t duk_hobject_get_enumerated_keys(duk_context *ctx, duk_small_uint_t enum_flags);
+DUK_INTERNAL_DECL duk_bool_t duk_hobject_enumerator_next(duk_context *ctx, duk_bool_t get_value);
+
+/* macros */
+DUK_INTERNAL_DECL void duk_hobject_set_prototype(duk_hthread *thr, duk_hobject *h, duk_hobject *p);
+
+/* finalization */
+DUK_INTERNAL_DECL void duk_hobject_run_finalizer(duk_hthread *thr, duk_hobject *obj);
+
+/* pc2line */
+#if defined(DUK_USE_PC2LINE)
+DUK_INTERNAL_DECL void duk_hobject_pc2line_pack(duk_hthread *thr, duk_compiler_instr *instrs, duk_uint_fast32_t length);
+DUK_INTERNAL_DECL duk_uint_fast32_t duk_hobject_pc2line_query(duk_context *ctx, duk_idx_t idx_func, duk_uint_fast32_t pc);
+#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);
+
+#endif /* DUK_HOBJECT_H_INCLUDED */
+#line 1 "duk_hcompiledfunction.h"
+/*
+ * Heap compiled function (Ecmascript function) representation.
+ *
+ * There is a single data buffer containing the Ecmascript function's
+ * bytecode, constants, and inner functions.
+ */
+
+#ifndef DUK_HCOMPILEDFUNCTION_H_INCLUDED
+#define DUK_HCOMPILEDFUNCTION_H_INCLUDED
+
+/*
+ * Field accessor macros
+ */
+
+/* XXX: casts could be improved, especially for GET/SET DATA */
+
+#if defined(DUK_USE_HEAPPTR16)
+#define DUK_HCOMPILEDFUNCTION_GET_DATA(heap,h) \
+ ((duk_hbuffer_fixed *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->data16))
+#define DUK_HCOMPILEDFUNCTION_SET_DATA(heap,h,v) do { \
+ (h)->data16 = DUK_USE_HEAPPTR_ENC16((heap)->heap_udata, (void *) (v)); \
+ } while (0)
+#define DUK_HCOMPILEDFUNCTION_GET_FUNCS(heap,h) \
+ ((duk_hobject **) (DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->funcs16)))
+#define DUK_HCOMPILEDFUNCTION_SET_FUNCS(heap,h,v) do { \
+ (h)->funcs16 = DUK_USE_HEAPPTR_ENC16((heap)->heap_udata, (void *) (v)); \
+ } while (0)
+#define DUK_HCOMPILEDFUNCTION_GET_BYTECODE(heap,h) \
+ ((duk_instr_t *) (DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->bytecode16)))
+#define DUK_HCOMPILEDFUNCTION_SET_BYTECODE(heap,h,v) do { \
+ (h)->bytecode16 = DUK_USE_HEAPPTR_ENC16((heap)->heap_udata, (void *) (v)); \
+ } while (0)
+#else
+#define DUK_HCOMPILEDFUNCTION_GET_DATA(heap,h) \
+ ((duk_hbuffer_fixed *) (h)->data)
+#define DUK_HCOMPILEDFUNCTION_SET_DATA(heap,h,v) do { \
+ (h)->data = (duk_hbuffer *) (v); \
+ } while (0)
+#define DUK_HCOMPILEDFUNCTION_GET_FUNCS(heap,h) \
+ ((h)->funcs)
+#define DUK_HCOMPILEDFUNCTION_SET_FUNCS(heap,h,v) do { \
+ (h)->funcs = (v); \
+ } while (0)
+#define DUK_HCOMPILEDFUNCTION_GET_BYTECODE(heap,h) \
+ ((h)->bytecode)
+#define DUK_HCOMPILEDFUNCTION_SET_BYTECODE(heap,h,v) do { \
+ (h)->bytecode = (v); \
+ } while (0)
+#endif
+
+/*
+ * Accessor macros for function specific data areas
+ */
+
+/* Note: assumes 'data' is always a fixed buffer */
+#define DUK_HCOMPILEDFUNCTION_GET_BUFFER_BASE(heap,h) \
+ DUK_HBUFFER_FIXED_GET_DATA_PTR((heap), DUK_HCOMPILEDFUNCTION_GET_DATA((heap), (h)))
+
+#define DUK_HCOMPILEDFUNCTION_GET_CONSTS_BASE(heap,h) \
+ ((duk_tval *) DUK_HCOMPILEDFUNCTION_GET_BUFFER_BASE((heap), (h)))
+
+#define DUK_HCOMPILEDFUNCTION_GET_FUNCS_BASE(heap,h) \
+ DUK_HCOMPILEDFUNCTION_GET_FUNCS((heap), (h))
+
+#define DUK_HCOMPILEDFUNCTION_GET_CODE_BASE(heap,h) \
+ DUK_HCOMPILEDFUNCTION_GET_BYTECODE((heap), (h))
+
+#define DUK_HCOMPILEDFUNCTION_GET_CONSTS_END(heap,h) \
+ ((duk_tval *) DUK_HCOMPILEDFUNCTION_GET_FUNCS((heap), (h)))
+
+#define DUK_HCOMPILEDFUNCTION_GET_FUNCS_END(heap,h) \
+ ((duk_hobject **) DUK_HCOMPILEDFUNCTION_GET_BYTECODE((heap), (h)))
+
+/* XXX: double evaluation of DUK_HCOMPILEDFUNCTION_GET_DATA() */
+#define DUK_HCOMPILEDFUNCTION_GET_CODE_END(heap,h) \
+ ((duk_instr_t *) (DUK_HBUFFER_FIXED_GET_DATA_PTR((heap), DUK_HCOMPILEDFUNCTION_GET_DATA((heap), (h))) + \
+ DUK_HBUFFER_GET_SIZE((duk_hbuffer *) DUK_HCOMPILEDFUNCTION_GET_DATA((heap), h))))
+
+#define DUK_HCOMPILEDFUNCTION_GET_CONSTS_SIZE(heap,h) \
+ ( \
+ (duk_size_t) \
+ ( \
+ ((const duk_uint8_t *) DUK_HCOMPILEDFUNCTION_GET_CONSTS_END((heap), (h))) - \
+ ((const duk_uint8_t *) DUK_HCOMPILEDFUNCTION_GET_CONSTS_BASE((heap), (h))) \
+ ) \
+ )
+
+#define DUK_HCOMPILEDFUNCTION_GET_FUNCS_SIZE(heap,h) \
+ ( \
+ (duk_size_t) \
+ ( \
+ ((const duk_uint8_t *) DUK_HCOMPILEDFUNCTION_GET_FUNCS_END((heap), (h))) - \
+ ((const duk_uint8_t *) DUK_HCOMPILEDFUNCTION_GET_FUNCS_BASE((heap), (h))) \
+ ) \
+ )
+
+#define DUK_HCOMPILEDFUNCTION_GET_CODE_SIZE(heap,h) \
+ ( \
+ (duk_size_t) \
+ ( \
+ ((const duk_uint8_t *) DUK_HCOMPILEDFUNCTION_GET_CODE_END((heap),(h))) - \
+ ((const duk_uint8_t *) DUK_HCOMPILEDFUNCTION_GET_CODE_BASE((heap),(h))) \
+ ) \
+ )
+
+#define DUK_HCOMPILEDFUNCTION_GET_CONSTS_COUNT(heap,h) \
+ ((duk_size_t) (DUK_HCOMPILEDFUNCTION_GET_CONSTS_SIZE((heap), (h)) / sizeof(duk_tval)))
+
+#define DUK_HCOMPILEDFUNCTION_GET_FUNCS_COUNT(heap,h) \
+ ((duk_size_t) (DUK_HCOMPILEDFUNCTION_GET_FUNCS_SIZE((heap), (h)) / sizeof(duk_hobject *)))
+
+#define DUK_HCOMPILEDFUNCTION_GET_CODE_COUNT(heap,h) \
+ ((duk_size_t) (DUK_HCOMPILEDFUNCTION_GET_CODE_SIZE((heap), (h)) / sizeof(duk_instr_t)))
+
+
+/*
+ * Main struct
+ */
+
+struct duk_hcompiledfunction {
+ /* shared object part */
+ duk_hobject obj;
+
+ /*
+ * Pointers to function data area for faster access. Function
+ * data is a buffer shared between all closures of the same
+ * "template" function. The data buffer is always fixed (non-
+ * dynamic, hence stable), with a layout as follows:
+ *
+ * constants (duk_tval)
+ * inner functions (duk_hobject *)
+ * bytecode (duk_instr_t)
+ *
+ * Note: bytecode end address can be computed from 'data' buffer
+ * size. It is not strictly necessary functionally, assuming
+ * bytecode never jumps outside its allocated area. However,
+ * it's a safety/robustness feature for avoiding the chance of
+ * executing random data as bytecode due to a compiler error.
+ *
+ * Note: values in the data buffer must be incref'd (they will
+ * be decref'd on release) for every compiledfunction referring
+ * to the 'data' element.
+ */
+
+ /* Data area, fixed allocation, stable data ptrs. */
+#if defined(DUK_USE_HEAPPTR16)
+ duk_uint16_t data16;
+#else
+ duk_hbuffer *data;
+#endif
+
+ /* No need for constants pointer (= same as data).
+ *
+ * When using 16-bit packing alignment to 4 is nice. 'funcs' will be
+ * 4-byte aligned because 'constants' are duk_tvals. For now the
+ * inner function pointers are not compressed, so that 'bytecode' will
+ * also be 4-byte aligned.
+ */
+#if defined(DUK_USE_HEAPPTR16)
+ duk_uint16_t funcs16;
+ duk_uint16_t bytecode16;
+#else
+ duk_hobject **funcs;
+ duk_instr_t *bytecode;
+#endif
+
+ /*
+ * 'nregs' registers are allocated on function entry, at most 'nargs'
+ * are initialized to arguments, and the rest to undefined. Arguments
+ * above 'nregs' are not mapped to registers. All registers in the
+ * active stack range must be initialized because they are GC reachable.
+ * 'nargs' is needed so that if the function is given more than 'nargs'
+ * arguments, the additional arguments do not 'clobber' registers
+ * beyond 'nregs' which must be consistently initialized to undefined.
+ *
+ * Usually there is no need to know which registers are mapped to
+ * local variables. Registers may be allocated to variable in any
+ * way (even including gaps). However, a register-variable mapping
+ * must be the same for the duration of the function execution and
+ * the register cannot be used for anything else.
+ *
+ * When looking up variables by name, the '_Varmap' map is used.
+ * When an activation closes, registers mapped to arguments are
+ * copied into the environment record based on the same map. The
+ * reverse map (from register to variable) is not currently needed
+ * 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 */
+
+ /*
+ * Additional control information is placed into the object itself
+ * as internal properties to avoid unnecessary fields for the
+ * majority of functions. The compiler tries to omit internal
+ * control fields when possible.
+ *
+ * Function templates:
+ *
+ * {
+ * name: "func", // declaration, named function expressions
+ * fileName: <debug info for creating nice errors>
+ * _Varmap: { "arg1": 0, "arg2": 1, "varname": 2 },
+ * _Formals: [ "arg1", "arg2" ],
+ * _Source: "function func(arg1, arg2) { ... }",
+ * _Pc2line: <debug info for pc-to-line mapping>,
+ * }
+ *
+ * Function instances:
+ *
+ * {
+ * length: 2,
+ * prototype: { constructor: <func> },
+ * caller: <thrower>,
+ * arguments: <thrower>,
+ * name: "func", // declaration, named function expressions
+ * fileName: <debug info for creating nice errors>
+ * _Varmap: { "arg1": 0, "arg2": 1, "varname": 2 },
+ * _Formals: [ "arg1", "arg2" ],
+ * _Source: "function func(arg1, arg2) { ... }",
+ * _Pc2line: <debug info for pc-to-line mapping>,
+ * _Varenv: <variable environment of closure>,
+ * _Lexenv: <lexical environment of closure (if differs from _Varenv)>
+ * }
+ *
+ * More detailed description of these properties can be found
+ * in the documentation.
+ */
+
+#if defined(DUK_USE_DEBUGGER_SUPPORT)
+ /* Line number range for function. Needed during debugging to
+ * determine active breakpoints.
+ */
+ duk_uint32_t start_line;
+ duk_uint32_t end_line;
+#endif
+};
+
+#endif /* DUK_HCOMPILEDFUNCTION_H_INCLUDED */
+#line 1 "duk_hnativefunction.h"
+/*
+ * Heap native function representation.
+ */
+
+#ifndef DUK_HNATIVEFUNCTION_H_INCLUDED
+#define DUK_HNATIVEFUNCTION_H_INCLUDED
+
+#define DUK_HNATIVEFUNCTION_NARGS_VARARGS ((duk_int16_t) -1)
+#define DUK_HNATIVEFUNCTION_NARGS_MAX ((duk_int16_t) 0x7fff)
+
+struct duk_hnativefunction {
+ /* shared object part */
+ duk_hobject obj;
+
+ duk_c_function func;
+ duk_int16_t nargs;
+ duk_int16_t magic;
+
+ /* The 'magic' field allows an opaque 16-bit field to be accessed by the
+ * Duktape/C function. This allows, for instance, the same native function
+ * to be used for a set of very similar functions, with the 'magic' field
+ * providing the necessary non-argument flags / values to guide the behavior
+ * of the native function. The value is signed on purpose: it is easier to
+ * convert a signed value to unsigned (simply AND with 0xffff) than vice
+ * versa.
+ *
+ * Note: cannot place nargs/magic into the heaphdr flags, because
+ * duk_hobject takes almost all flags already (and needs the spare).
+ */
+};
+
+#endif /* DUK_HNATIVEFUNCTION_H_INCLUDED */
+#line 1 "duk_hthread.h"
+/*
+ * Heap thread object representation.
+ *
+ * duk_hthread is also the 'context' (duk_context) for exposed APIs
+ * which mostly operate on the topmost frame of the value stack.
+ */
+
+#ifndef DUK_HTHREAD_H_INCLUDED
+#define DUK_HTHREAD_H_INCLUDED
+
+/*
+ * Stack constants
+ */
+
+#define DUK_VALSTACK_GROW_STEP 128 /* roughly 1 kiB */
+#define DUK_VALSTACK_SHRINK_THRESHOLD 256 /* roughly 2 kiB */
+#define DUK_VALSTACK_SHRINK_SPARE 64 /* roughly 0.5 kiB */
+#define DUK_VALSTACK_INITIAL_SIZE 128 /* roughly 1.0 kiB -> but rounds up to DUK_VALSTACK_GROW_STEP in practice */
+#define DUK_VALSTACK_INTERNAL_EXTRA 64 /* internal extra elements assumed on function entry,
+ * always added to user-defined 'extra' for e.g. the
+ * duk_check_stack() call.
+ */
+#define DUK_VALSTACK_API_ENTRY_MINIMUM DUK_API_ENTRY_STACK
+ /* number of elements guaranteed to be user accessible
+ * (in addition to call arguments) on Duktape/C function entry.
+ */
+
+/* Note: DUK_VALSTACK_INITIAL_SIZE must be >= DUK_VALSTACK_API_ENTRY_MINIMUM
+ * + DUK_VALSTACK_INTERNAL_EXTRA so that the initial stack conforms to spare
+ * requirements.
+ */
+
+#define DUK_VALSTACK_DEFAULT_MAX 1000000L
+
+#define DUK_CALLSTACK_GROW_STEP 8 /* roughly 256 bytes */
+#define DUK_CALLSTACK_SHRINK_THRESHOLD 16 /* roughly 512 bytes */
+#define DUK_CALLSTACK_SHRINK_SPARE 8 /* roughly 256 bytes */
+#define DUK_CALLSTACK_INITIAL_SIZE 8
+#define DUK_CALLSTACK_DEFAULT_MAX 10000L
+
+#define DUK_CATCHSTACK_GROW_STEP 4 /* roughly 64 bytes */
+#define DUK_CATCHSTACK_SHRINK_THRESHOLD 8 /* roughly 128 bytes */
+#define DUK_CATCHSTACK_SHRINK_SPARE 4 /* roughly 64 bytes */
+#define DUK_CATCHSTACK_INITIAL_SIZE 4
+#define DUK_CATCHSTACK_DEFAULT_MAX 10000L
+
+/*
+ * Activation defines
+ */
+
+#define DUK_ACT_FLAG_STRICT (1 << 0) /* function executes in strict mode */
+#define DUK_ACT_FLAG_TAILCALLED (1 << 1) /* activation has tailcalled one or more times */
+#define DUK_ACT_FLAG_CONSTRUCT (1 << 2) /* function executes as a constructor (called via "new") */
+#define DUK_ACT_FLAG_PREVENT_YIELD (1 << 3) /* activation prevents yield (native call or "new") */
+#define DUK_ACT_FLAG_DIRECT_EVAL (1 << 4) /* activation is a direct eval call */
+#define DUK_ACT_FLAG_BREAKPOINT_ACTIVE (1 << 5) /* activation has active breakpoint(s) */
+
+#define DUK_ACT_GET_FUNC(act) ((act)->func)
+
+/*
+ * Flags for __FILE__ / __LINE__ registered into tracedata
+ */
+
+#define DUK_TB_FLAG_NOBLAME_FILELINE (1 << 0) /* don't report __FILE__ / __LINE__ as fileName/lineNumber */
+
+/*
+ * Catcher defines
+ */
+
+/* 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 (1 << 4) /* catch part will catch */
+#define DUK_CAT_FLAG_FINALLY_ENABLED (1 << 5) /* finally part will catch */
+#define DUK_CAT_FLAG_CATCH_BINDING_ENABLED (1 << 6) /* request to create catch binding */
+#define DUK_CAT_FLAG_LEXENV_ACTIVE (1 << 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 { \
+ (c)->flags |= DUK_CAT_FLAG_FINALLY_ENABLED; \
+ } while (0)
+#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 { \
+ (c)->flags |= DUK_CAT_FLAG_LEXENV_ACTIVE; \
+ } while (0)
+
+#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 { \
+ (c)->flags &= ~DUK_CAT_FLAG_FINALLY_ENABLED; \
+ } while (0)
+#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 { \
+ (c)->flags &= ~DUK_CAT_FLAG_LEXENV_ACTIVE; \
+ } while (0)
+
+/*
+ * Thread defines
+ */
+
+#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)]))
+#else
+#define DUK_HTHREAD_GET_STRING(thr,idx) \
+ ((thr)->strs[(idx)])
+#endif
+
+#define DUK_HTHREAD_GET_CURRENT_ACTIVATION(thr) (&(thr)->callstack[(thr)->callstack_top - 1])
+
+/* 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 */
+
+/*
+ * Struct defines
+ */
+
+/* XXX: for a memory-code tradeoff, remove 'func' and make it's access either a function
+ * or a macro. This would make the activation 32 bytes long on 32-bit platforms again.
+ */
+
+/* Note: it's nice if size is 2^N (at least for 32-bit platforms). */
+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_hobject *var_env; /* current variable environment (may be NULL if delayed) */
+ duk_hobject *lex_env; /* current lexical environment (may be NULL if delayed) */
+#ifdef DUK_USE_NONSTD_FUNC_CALLER_PROPERTY
+ /* Previous value of 'func' caller, restored when unwound. Only in use
+ * when 'func' is non-strict.
+ */
+ duk_hobject *prev_caller;
+#endif
+
+ duk_small_uint_t flags;
+ duk_uint32_t pc; /* next instruction to execute */
+#if defined(DUK_USE_DEBUGGER_SUPPORT)
+ duk_uint32_t prev_line; /* needed for stepping */
+#endif
+
+ /* idx_bottom and idx_retval are only used for book-keeping of
+ * Ecmascript-initiated calls, to allow returning to an Ecmascript
+ * function properly. They are duk_size_t to match the convention
+ * that value stack sizes are duk_size_t and local frame indices
+ * are duk_idx_t.
+ */
+
+ /* Bottom of valstack for this activation, used to reset
+ * valstack_bottom on return; index is absolute. Note:
+ * idx_top not needed because top is set to 'nregs' always
+ * when returning to an Ecmascript activation.
+ */
+ duk_size_t idx_bottom;
+
+ /* Return value when returning to this activation (points to caller
+ * reg, not callee reg); index is absolute (only set if activation is
+ * not topmost).
+ *
+ * Note: idx_bottom is always set, while idx_retval is only applicable
+ * for activations below the topmost one. Currently idx_retval for
+ * the topmost activation is considered garbage (and it not initialized
+ * on entry or cleared on return; may contain previous or garbage
+ * values).
+ */
+ duk_size_t idx_retval;
+
+ /* Current 'this' binding is the value just below idx_bottom.
+ * Previously, 'this' binding was handled with an index to the
+ * (calling) valstack. This works for everything except tail
+ * calls, which must not "cumulate" valstack temps.
+ */
+};
+
+/* Note: it's nice if size is 2^N (not 4x4 = 16 bytes on 32 bit) */
+struct duk_catcher {
+ duk_hstring *h_varname; /* borrowed reference to catch variable name (or NULL if none) */
+ /* (reference is valid as long activation exists) */
+ duk_size_t callstack_index; /* callstack index of related activation */
+ duk_size_t idx_base; /* idx_base and idx_base+1 get completion value and type */
+ duk_uint32_t pc_base; /* resume execution from pc_base or pc_base+1 */
+ duk_uint32_t flags; /* type and control flags, label number */
+};
+
+struct duk_hthread {
+ /* shared object part */
+ duk_hobject obj;
+
+ /* backpointers */
+ duk_heap *heap;
+
+ /* current strictness flag: affects API calls */
+ duk_uint8_t strict;
+ duk_uint8_t state;
+ duk_uint8_t unused1;
+ duk_uint8_t unused2;
+
+ /* sanity limits */
+ duk_size_t valstack_max;
+ duk_size_t callstack_max;
+ duk_size_t catchstack_max;
+
+ /* XXX: valstack, callstack, and catchstack are currently assumed
+ * to have non-NULL pointers. Relaxing this would not lead to big
+ * benefits (except perhaps for terminated threads).
+ */
+
+ /* value stack: these are expressed as pointers for faster stack manipulation */
+ duk_tval *valstack; /* start of valstack allocation */
+ duk_tval *valstack_end; /* end of valstack allocation (exclusive) */
+ duk_tval *valstack_bottom; /* bottom of current frame */
+ duk_tval *valstack_top; /* top of current frame (exclusive) */
+
+ /* call stack */
+ duk_activation *callstack;
+ duk_size_t callstack_size; /* allocation size */
+ duk_size_t callstack_top; /* next to use, highest used is top - 1 */
+ duk_size_t callstack_preventcount; /* number of activation records in callstack preventing a yield */
+
+ /* catch stack */
+ duk_catcher *catchstack;
+ duk_size_t catchstack_size; /* allocation size */
+ duk_size_t catchstack_top; /* next to use, highest used is top - 1 */
+
+ /* yield/resume book-keeping */
+ duk_hthread *resumer; /* who resumed us (if any) */
+
+ /* current compiler state (if any), used for augmenting SyntaxErrors */
+ duk_compiler_ctx *compile_ctx;
+
+#ifdef DUK_USE_INTERRUPT_COUNTER
+ /* Interrupt counter for triggering a slow path check for execution
+ * timeout, debugger interaction such as breakpoints, etc. This is
+ * actually a value copied from the heap structure into the current
+ * thread to be more convenient for the bytecode executor inner loop.
+ * The final value is copied back to the heap structure on a thread
+ * switch by DUK_HEAP_SWITCH_THREAD().
+ */
+ duk_int_t interrupt_counter;
+#endif
+
+ /* Builtin-objects; may or may not be shared with other threads,
+ * threads existing in different "compartments" will have different
+ * built-ins. Must be stored on a per-thread basis because there
+ * is no intermediate structure for a thread group / compartment.
+ * This takes quite a lot of space, currently 43x4 = 172 bytes on
+ * 32-bit platforms.
+ */
+ duk_hobject *builtins[DUK_NUM_BUILTINS];
+
+ /* convenience copies from heap/vm for faster access */
+#if defined(DUK_USE_HEAPPTR16)
+ duk_uint16_t *strs16;
+#else
+ duk_hstring **strs;
+#endif
+};
+
+/*
+ * Prototypes
+ */
+
+DUK_INTERNAL_DECL void duk_hthread_copy_builtin_objects(duk_hthread *thr_from, duk_hthread *thr_to);
+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 void duk_hthread_callstack_grow(duk_hthread *thr);
+DUK_INTERNAL_DECL void duk_hthread_callstack_shrink_check(duk_hthread *thr);
+DUK_INTERNAL_DECL void duk_hthread_callstack_unwind(duk_hthread *thr, duk_size_t new_top);
+DUK_INTERNAL_DECL void duk_hthread_catchstack_grow(duk_hthread *thr);
+DUK_INTERNAL_DECL void duk_hthread_catchstack_shrink_check(duk_hthread *thr);
+DUK_INTERNAL_DECL void duk_hthread_catchstack_unwind(duk_hthread *thr, duk_size_t new_top);
+
+DUK_INTERNAL_DECL duk_activation *duk_hthread_get_current_activation(duk_hthread *thr);
+DUK_INTERNAL_DECL void *duk_hthread_get_valstack_ptr(duk_heap *heap, void *ud); /* indirect allocs */
+DUK_INTERNAL_DECL void *duk_hthread_get_callstack_ptr(duk_heap *heap, void *ud); /* indirect allocs */
+DUK_INTERNAL_DECL void *duk_hthread_get_catchstack_ptr(duk_heap *heap, void *ud); /* indirect allocs */
+
+#endif /* DUK_HTHREAD_H_INCLUDED */
+#line 1 "duk_hbuffer.h"
+/*
+ * Heap buffer representation.
+ *
+ * Heap allocated user data buffer which is either:
+ *
+ * 1. A fixed size buffer (data follows header statically)
+ * 2. A dynamic size buffer (data pointer follows header)
+ *
+ * The data pointer for a variable size buffer of zero size may be NULL.
+ */
+
+#ifndef DUK_HBUFFER_H_INCLUDED
+#define DUK_HBUFFER_H_INCLUDED
+
+/*
+ * Flags
+ */
+
+#define DUK_HBUFFER_FLAG_DYNAMIC DUK_HEAPHDR_USER_FLAG(0) /* buffer is resizable */
+
+#define DUK_HBUFFER_HAS_DYNAMIC(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_DYNAMIC)
+
+#define DUK_HBUFFER_SET_DYNAMIC(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_DYNAMIC)
+
+#define DUK_HBUFFER_CLEAR_DYNAMIC(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_DYNAMIC)
+
+#define DUK_HBUFFER_FIXED_GET_DATA_PTR(heap,x) ((duk_uint8_t *) (((duk_hbuffer_fixed *) (x)) + 1))
+
+/*
+ * Misc defines
+ */
+
+/* Impose a maximum buffer length for now. Restricted artificially to
+ * ensure resize computations or adding a heap header length won't
+ * overflow size_t. The limit should be synchronized with
+ * DUK_HSTRING_MAX_BYTELEN.
+ */
+
+#if defined(DUK_USE_BUFLEN16)
+#define DUK_HBUFFER_MAX_BYTELEN (0x0000ffffUL)
+#else
+#define DUK_HBUFFER_MAX_BYTELEN (0x7fffffffUL)
+#endif
+
+/*
+ * Field access
+ */
+
+/* Get/set the current user visible size, without accounting for a dynamic
+ * buffer's "spare" (= usable size).
+ */
+#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 { \
+ (x)->hdr.h_flags = ((x)->hdr.h_flags & 0x0000ffffUL) | ((v) << 16); \
+ } while (0)
+#define DUK_HBUFFER_ADD_SIZE(x,dv) do { \
+ (x)->hdr.h_flags += ((dv) << 16); \
+ } while (0)
+#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 { \
+ ((duk_hbuffer *) (x))->size = (v); \
+ } while (0)
+#define DUK_HBUFFER_ADD_SIZE(x,dv) do { \
+ (x)->size += (dv); \
+ } while (0)
+#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_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))
+
+#if defined(DUK_USE_BUFLEN16) && defined(DUK_USE_HEAPPTR16)
+/* alloc_size16 stored in duk_heaphdr h_extra16, available with pointer compression. */
+#define DUK_HBUFFER_DYNAMIC_GET_ALLOC_SIZE(x) ((duk_size_t) ((x)->hdr.h_extra16))
+#define DUK_HBUFFER_DYNAMIC_SET_ALLOC_SIZE(x,v) do { \
+ (x)->hdr.h_extra16 = (duk_uint16_t) (v); \
+ } while (0)
+#elif defined(DUK_USE_BUFLEN16)
+/* alloc_size16 stored in an explicit 16-bit fields. */
+#define DUK_HBUFFER_DYNAMIC_GET_ALLOC_SIZE(x) ((duk_size_t) ((x)->alloc_size16))
+#define DUK_HBUFFER_DYNAMIC_SET_ALLOC_SIZE(x,v) do { \
+ (x)->alloc_size16 = (duk_uint16_t) (v); \
+ } while (0)
+#else
+/* normal case */
+#define DUK_HBUFFER_DYNAMIC_GET_ALLOC_SIZE(x) ((x)->alloc_size)
+#define DUK_HBUFFER_DYNAMIC_SET_ALLOC_SIZE(x,v) do { \
+ (x)->alloc_size = (v); \
+ } while (0)
+#endif
+
+#define DUK_HBUFFER_DYNAMIC_GET_SPARE_SIZE(x) \
+ (duk_size_t) (DUK_HBUFFER_DYNAMIC_GET_ALLOC_SIZE((x)) - DUK_HBUFFER_DYNAMIC_GET_SIZE((x)))
+
+#if defined(DUK_USE_HEAPPTR16)
+#define DUK_HBUFFER_DYNAMIC_GET_DATA_PTR(heap,x) \
+ ((void *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (x)->curr_alloc16))
+#define DUK_HBUFFER_DYNAMIC_SET_DATA_PTR(heap,x,v) do { \
+ (x)->curr_alloc16 = DUK_USE_HEAPPTR_ENC16((heap)->heap_udata, (void *) (v)); \
+ } while (0)
+#define DUK_HBUFFER_DYNAMIC_SET_DATA_PTR_NULL(heap,x) do { \
+ (x)->curr_alloc16 = 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 { \
+ (x)->curr_alloc = (void *) (v); \
+ } while (0)
+#define DUK_HBUFFER_DYNAMIC_SET_DATA_PTR_NULL(heap,x) do { \
+ (x)->curr_alloc = (void *) NULL; \
+ } while (0)
+#endif
+
+/* Gets the actual buffer contents which matches the current allocation size
+ * (may be NULL for zero size dynamic buffer).
+ */
+#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 *) (x)) \
+ )
+
+/* Growth parameters for dynamic buffers. */
+#define DUK_HBUFFER_SPARE_ADD 16
+#define DUK_HBUFFER_SPARE_DIVISOR 16 /* 2^4 -> 1/16 = 6.25% spare */
+
+/*
+ * Structs
+ */
+
+struct duk_hbuffer {
+ duk_heaphdr hdr;
+
+ /* It's not strictly necessary to track the current size, but
+ * it is useful for writing robust native code.
+ */
+
+ /* Current size (not counting a dynamic buffer's "spare"). */
+#if defined(DUK_USE_BUFLEN16)
+ /* Stored in duk_heaphdr unused flags. */
+#else
+ duk_size_t size;
+#endif
+
+ /*
+ * Data following the header depends on the DUK_HBUFFER_FLAG_DYNAMIC
+ * flag.
+ *
+ * If the flag is clear (the buffer is a fixed size one), the buffer
+ * data follows the header directly, consisting of 'size' bytes.
+ *
+ * If the flag is set, the actual buffer is allocated separately, and
+ * a few control fields follow the header. Specifically:
+ *
+ * - a "void *" pointing to the current allocation
+ * - a duk_size_t indicating the full allocated size (always >= 'size')
+ *
+ * Unlike strings, no terminator byte (NUL) is guaranteed after the
+ * data. This would be convenient, but would pad aligned user buffers
+ * unnecessarily upwards in size. For instance, if user code requested
+ * a 64-byte dynamic buffer, 65 bytes would actually be allocated which
+ * would then potentially round upwards to perhaps 68 or 72 bytes.
+ */
+};
+
+#if defined(DUK_USE_ALIGN_8) && defined(DUK_USE_PACK_MSVC_PRAGMA)
+#pragma pack(push, 8)
+#endif
+struct duk_hbuffer_fixed {
+ /* A union is used here as a portable struct size / alignment trick:
+ * by adding a 32-bit or a 64-bit (unused) union member, the size of
+ * the struct is effectively forced to be a multiple of 4 or 8 bytes
+ * (respectively) without increasing the size of the struct unless
+ * necessary.
+ */
+ union {
+ struct {
+ duk_heaphdr hdr;
+#if defined(DUK_USE_BUFLEN16)
+ /* Stored in duk_heaphdr unused flags. */
+#else
+ duk_size_t size;
+#endif
+ } s;
+#if defined(DUK_USE_ALIGN_4)
+ duk_uint32_t dummy_for_align4;
+#elif defined(DUK_USE_ALIGN_8)
+ duk_double_t dummy_for_align8;
+#else
+ /* no extra padding */
+#endif
+ } u;
+
+ /*
+ * Data follows the struct header. The struct size is padded by the
+ * compiler based on the struct members. This guarantees that the
+ * buffer data will be aligned-by-4 but not necessarily aligned-by-8.
+ *
+ * On platforms where alignment does not matter, the struct padding
+ * could be removed (if there is any). On platforms where alignment
+ * by 8 is required, the struct size must be forced to be a multiple
+ * of 8 by some means. Without it, some user code may break, and also
+ * Duktape itself breaks (e.g. the compiler stores duk_tvals in a
+ * dynamic buffer).
+ */
+}
+#if defined(DUK_USE_ALIGN_8) && defined(DUK_USE_PACK_GCC_ATTR)
+__attribute__ ((aligned (8)))
+#elif defined(DUK_USE_ALIGN_8) && defined(DUK_USE_PACK_CLANG_ATTR)
+__attribute__ ((aligned (8)))
+#endif
+;
+#if defined(DUK_USE_ALIGN_8) && defined(DUK_USE_PACK_MSVC_PRAGMA)
+#pragma pack(pop)
+#endif
+
+struct duk_hbuffer_dynamic {
+ duk_heaphdr hdr;
+
+#if defined(DUK_USE_BUFLEN16)
+ /* Stored in duk_heaphdr unused flags. */
+#else
+ duk_size_t size;
+#endif
+
+#if defined(DUK_USE_BUFLEN16) && defined(DUK_USE_HEAPPTR16)
+ /* Stored in duk_heaphdr h_extra16. */
+#elif defined(DUK_USE_BUFLEN16)
+ duk_uint16_t alloc_size16;
+#else
+ duk_size_t alloc_size;
+#endif
+
+#if defined(DUK_USE_HEAPPTR16)
+ duk_uint16_t curr_alloc16;
+#else
+ void *curr_alloc; /* may be NULL if alloc_size == 0 */
+#endif
+
+ /*
+ * Allocation size for 'curr_alloc' is alloc_size. There is no
+ * automatic NUL terminator for buffers (see above for rationale).
+ *
+ * 'curr_alloc' is explicitly allocated with heap allocation
+ * primitives and will thus always have alignment suitable for
+ * e.g. duk_tval and an IEEE double.
+ */
+};
+
+/*
+ * Prototypes
+ */
+
+DUK_INTERNAL_DECL duk_hbuffer *duk_hbuffer_alloc(duk_heap *heap, duk_size_t size, duk_small_uint_t flags);
+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_size_t new_alloc_size);
+DUK_INTERNAL_DECL void duk_hbuffer_reset(duk_hthread *thr, duk_hbuffer_dynamic *buf);
+#if 0 /*unused*/
+DUK_INTERNAL_DECL void duk_hbuffer_compact(duk_hthread *thr, duk_hbuffer_dynamic *buf);
+#endif
+DUK_INTERNAL_DECL void duk_hbuffer_append_bytes(duk_hthread *thr, duk_hbuffer_dynamic *buf, const duk_uint8_t *data, duk_size_t length);
+DUK_INTERNAL_DECL void duk_hbuffer_append_byte(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_uint8_t byte);
+DUK_INTERNAL_DECL duk_size_t duk_hbuffer_append_cstring(duk_hthread *thr, duk_hbuffer_dynamic *buf, const char *str);
+DUK_INTERNAL_DECL duk_size_t duk_hbuffer_append_hstring(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_hstring *str);
+DUK_INTERNAL_DECL duk_size_t duk_hbuffer_append_xutf8(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_ucodepoint_t codepoint);
+DUK_INTERNAL_DECL duk_size_t duk_hbuffer_append_cesu8(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_ucodepoint_t codepoint);
+#if 0
+DUK_INTERNAL_DECL void duk_hbuffer_append_native_u32(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_uint32_t val);
+#endif
+DUK_INTERNAL_DECL void duk_hbuffer_insert_bytes(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, const duk_uint8_t *data, duk_size_t length);
+#if 0 /*unused*/
+DUK_INTERNAL_DECL void duk_hbuffer_insert_byte(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_uint8_t byte);
+#endif
+#if 0 /*unused*/
+DUK_INTERNAL_DECL duk_size_t duk_hbuffer_insert_cstring(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, const char *str);
+#endif
+#if 0 /*unused*/
+DUK_INTERNAL_DECL duk_size_t duk_hbuffer_insert_hstring(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_hstring *str);
+#endif
+DUK_INTERNAL_DECL duk_size_t duk_hbuffer_insert_xutf8(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_ucodepoint_t codepoint);
+#if 0 /*unused*/
+DUK_INTERNAL_DECL duk_size_t duk_hbuffer_insert_cesu8(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_ucodepoint_t codepoint);
+#endif
+DUK_INTERNAL_DECL void duk_hbuffer_remove_slice(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_size_t length);
+DUK_INTERNAL_DECL void duk_hbuffer_insert_slice(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t dst_offset, duk_size_t src_offset, duk_size_t length);
+DUK_INTERNAL_DECL void duk_hbuffer_append_slice(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t src_offset, duk_size_t length);
+
+#endif /* DUK_HBUFFER_H_INCLUDED */
+#line 1 "duk_heap.h"
+/*
+ * Heap structure.
+ *
+ * Heap contains allocated heap objects, interned strings, and built-in
+ * strings for one or more threads.
+ */
+
+#ifndef DUK_HEAP_H_INCLUDED
+#define DUK_HEAP_H_INCLUDED
+
+/* alloc function typedefs in duktape.h */
+
+/*
+ * Heap flags
+ */
+
+#define DUK_HEAP_FLAG_MARKANDSWEEP_RUNNING (1 << 0) /* mark-and-sweep is currently running */
+#define DUK_HEAP_FLAG_MARKANDSWEEP_RECLIMIT_REACHED (1 << 1) /* mark-and-sweep marking reached a recursion limit and must use multi-pass marking */
+#define DUK_HEAP_FLAG_REFZERO_FREE_RUNNING (1 << 2) /* refcount code is processing refzero list */
+#define DUK_HEAP_FLAG_ERRHANDLER_RUNNING (1 << 3) /* an error handler (user callback to augment/replace error) is running */
+#define DUK_HEAP_FLAG_INTERRUPT_RUNNING (1 << 4) /* executor interrupt running (used to avoid nested interrupts) */
+
+#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 { \
+ (heap)->flags &= ~(bits); \
+ } while (0)
+
+#define DUK_HEAP_HAS_MARKANDSWEEP_RUNNING(heap) DUK__HEAP_HAS_FLAGS((heap), DUK_HEAP_FLAG_MARKANDSWEEP_RUNNING)
+#define DUK_HEAP_HAS_MARKANDSWEEP_RECLIMIT_REACHED(heap) DUK__HEAP_HAS_FLAGS((heap), DUK_HEAP_FLAG_MARKANDSWEEP_RECLIMIT_REACHED)
+#define DUK_HEAP_HAS_REFZERO_FREE_RUNNING(heap) DUK__HEAP_HAS_FLAGS((heap), DUK_HEAP_FLAG_REFZERO_FREE_RUNNING)
+#define DUK_HEAP_HAS_ERRHANDLER_RUNNING(heap) DUK__HEAP_HAS_FLAGS((heap), DUK_HEAP_FLAG_ERRHANDLER_RUNNING)
+#define DUK_HEAP_HAS_INTERRUPT_RUNNING(heap) DUK__HEAP_HAS_FLAGS((heap), DUK_HEAP_FLAG_INTERRUPT_RUNNING)
+
+#define DUK_HEAP_SET_MARKANDSWEEP_RUNNING(heap) DUK__HEAP_SET_FLAGS((heap), DUK_HEAP_FLAG_MARKANDSWEEP_RUNNING)
+#define DUK_HEAP_SET_MARKANDSWEEP_RECLIMIT_REACHED(heap) DUK__HEAP_SET_FLAGS((heap), DUK_HEAP_FLAG_MARKANDSWEEP_RECLIMIT_REACHED)
+#define DUK_HEAP_SET_REFZERO_FREE_RUNNING(heap) DUK__HEAP_SET_FLAGS((heap), DUK_HEAP_FLAG_REFZERO_FREE_RUNNING)
+#define DUK_HEAP_SET_ERRHANDLER_RUNNING(heap) DUK__HEAP_SET_FLAGS((heap), DUK_HEAP_FLAG_ERRHANDLER_RUNNING)
+#define DUK_HEAP_SET_INTERRUPT_RUNNING(heap) DUK__HEAP_SET_FLAGS((heap), DUK_HEAP_FLAG_INTERRUPT_RUNNING)
+
+#define DUK_HEAP_CLEAR_MARKANDSWEEP_RUNNING(heap) DUK__HEAP_CLEAR_FLAGS((heap), DUK_HEAP_FLAG_MARKANDSWEEP_RUNNING)
+#define DUK_HEAP_CLEAR_MARKANDSWEEP_RECLIMIT_REACHED(heap) DUK__HEAP_CLEAR_FLAGS((heap), DUK_HEAP_FLAG_MARKANDSWEEP_RECLIMIT_REACHED)
+#define DUK_HEAP_CLEAR_REFZERO_FREE_RUNNING(heap) DUK__HEAP_CLEAR_FLAGS((heap), DUK_HEAP_FLAG_REFZERO_FREE_RUNNING)
+#define DUK_HEAP_CLEAR_ERRHANDLER_RUNNING(heap) DUK__HEAP_CLEAR_FLAGS((heap), DUK_HEAP_FLAG_ERRHANDLER_RUNNING)
+#define DUK_HEAP_CLEAR_INTERRUPT_RUNNING(heap) DUK__HEAP_CLEAR_FLAGS((heap), DUK_HEAP_FLAG_INTERRUPT_RUNNING)
+
+/*
+ * Longjmp types, also double as identifying continuation type for a rethrow (in 'finally')
+ */
+
+#define DUK_LJ_TYPE_UNKNOWN 0 /* unused */
+#define DUK_LJ_TYPE_RETURN 1 /* value1 -> return value */
+#define DUK_LJ_TYPE_THROW 2 /* value1 -> error object */
+#define DUK_LJ_TYPE_BREAK 3 /* value1 -> label number */
+#define DUK_LJ_TYPE_CONTINUE 4 /* value1 -> label number */
+#define DUK_LJ_TYPE_YIELD 5 /* value1 -> yield value, iserror -> error / normal */
+#define DUK_LJ_TYPE_RESUME 6 /* value1 -> resume value, value2 -> resumee thread, iserror -> error/normal */
+#define DUK_LJ_TYPE_NORMAL 7 /* pseudo-type to indicate a normal continuation (for 'finally' rethrowing) */
+
+/*
+ * Mark-and-sweep flags
+ *
+ * These are separate from heap level flags now but could be merged.
+ * The heap structure only contains a 'base mark-and-sweep flags'
+ * field and the GC caller can impose further flags.
+ */
+
+#define DUK_MS_FLAG_EMERGENCY (1 << 0) /* emergency mode: try extra hard */
+#define DUK_MS_FLAG_NO_STRINGTABLE_RESIZE (1 << 1) /* don't resize stringtable (but may sweep it); needed during stringtable resize */
+#define DUK_MS_FLAG_NO_FINALIZERS (1 << 2) /* don't run finalizers (which may have arbitrary side effects) */
+#define DUK_MS_FLAG_NO_OBJECT_COMPACTION (1 << 3) /* don't compact objects; needed during object property allocation resize */
+
+/*
+ * Thread switching
+ *
+ * To switch heap->curr_thread, use the macro below so that interrupt counters
+ * get updated correctly. The macro allows a NULL target thread because that
+ * happens e.g. in call handling.
+ */
+
+#if defined(DUK_USE_INTERRUPT_COUNTER)
+#define DUK_HEAP_SWITCH_THREAD(heap,newthr) duk_heap_switch_thread((heap), (newthr))
+#else
+#define DUK_HEAP_SWITCH_THREAD(heap,newthr) do { \
+ (heap)->curr_thread = (newthr); \
+ } while (0)
+#endif
+
+/*
+ * Other heap related defines
+ */
+
+/* Maximum duk_handle_call / duk_handle_safe_call depth. Note that this
+ * does not limit bytecode executor internal call depth at all (e.g.
+ * for Ecmascript-to-Ecmascript calls, thread yields/resumes, etc).
+ * There is a separate callstack depth limit for threads.
+ */
+
+#if defined(DUK_USE_DEEP_C_STACK)
+#define DUK_HEAP_DEFAULT_CALL_RECURSION_LIMIT 1000 /* assuming 0.5 kB between calls, about 500kB of stack */
+#else
+#define DUK_HEAP_DEFAULT_CALL_RECURSION_LIMIT 60 /* assuming 0.5 kB between calls, about 30kB of stack */
+#endif
+
+/* Mark-and-sweep C recursion depth for marking phase; if reached,
+ * mark object as a TEMPROOT and use multi-pass marking.
+ */
+#if defined(DUK_USE_MARK_AND_SWEEP)
+#if defined(DUK_USE_GC_TORTURE)
+#define DUK_HEAP_MARK_AND_SWEEP_RECURSION_LIMIT 3
+#elif defined(DUK_USE_DEEP_C_STACK)
+#define DUK_HEAP_MARK_AND_SWEEP_RECURSION_LIMIT 256
+#else
+#define DUK_HEAP_MARK_AND_SWEEP_RECURSION_LIMIT 32
+#endif
+#endif
+
+/* Mark-and-sweep interval is relative to combined count of objects and
+ * strings kept in the heap during the latest mark-and-sweep pass.
+ * Fixed point .8 multiplier and .0 adder. Trigger count (interval) is
+ * decreased by each (re)allocation attempt (regardless of size), and each
+ * refzero processed object.
+ *
+ * 'SKIP' indicates how many (re)allocations to wait until a retry if
+ * GC is skipped because there is no thread do it with yet (happens
+ * only during init phases).
+ */
+#if defined(DUK_USE_MARK_AND_SWEEP)
+#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
+#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
+#endif
+#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 */
+
+/* helper to insert a (non-string) heap object into heap allocated list */
+#define DUK_HEAP_INSERT_INTO_HEAP_ALLOCATED(heap,hdr) duk_heap_insert_into_heap_allocated((heap),(hdr))
+
+/* Executor interrupt default interval when nothing else requires a
+ * smaller value. The default interval must be small enough to allow
+ * for reasonable execution timeout checking.
+ */
+#if defined(DUK_USE_INTERRUPT_COUNTER)
+#define DUK_HEAP_INTCTR_DEFAULT (256L * 1024L)
+#endif
+
+/*
+ * Stringtable
+ */
+
+/* initial stringtable size, must be prime and higher than DUK_UTIL_MIN_HASH_PRIME */
+#define DUK_STRTAB_INITIAL_SIZE 17
+
+/* indicates a deleted string; any fixed non-NULL, non-hstring pointer works */
+#define DUK_STRTAB_DELETED_MARKER(heap) ((duk_hstring *) heap)
+
+/* resizing parameters */
+#define DUK_STRTAB_MIN_FREE_DIVISOR 4 /* load factor max 75% */
+#define DUK_STRTAB_MIN_USED_DIVISOR 4 /* load factor min 25% */
+#define DUK_STRTAB_GROW_ST_SIZE(n) ((n) + (n)) /* used entries + approx 100% -> reset load to 50% */
+
+#define DUK_STRTAB_U32_MAX_STRLEN 10 /* 4'294'967'295 */
+#define DUK_STRTAB_HIGHEST_32BIT_PRIME 0xfffffffbUL
+
+/* probe sequence (open addressing) */
+#define DUK_STRTAB_HASH_INITIAL(hash,h_size) ((hash) % (h_size))
+#define DUK_STRTAB_HASH_PROBE_STEP(hash) DUK_UTIL_GET_HASH_PROBE_STEP((hash))
+
+/* fixed top level hashtable size (separate chaining) */
+#define DUK_STRTAB_CHAIN_SIZE DUK_USE_STRTAB_CHAIN_SIZE
+
+/*
+ * Built-in strings
+ */
+
+/* heap string indices are autogenerated in duk_strings.h */
+#if defined(DUK_USE_HEAPPTR16)
+#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)])
+#endif
+
+/*
+ * 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_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)))
+
+/*
+ * Memory calls: relative to heap, GC interaction, but no error throwing.
+ *
+ * XXX: Currently a mark-and-sweep triggered by memory allocation will run
+ * using the heap->heap_thread. This thread is also used for running
+ * mark-and-sweep finalization; this is not ideal because it breaks the
+ * isolation between multiple global environments.
+ *
+ * Notes:
+ *
+ * - DUK_FREE() is required to ignore NULL and any other possible return
+ * value of a zero-sized alloc/realloc (same as ANSI C free()).
+ *
+ * - There is no DUK_REALLOC_ZEROED because we don't assume to know the
+ * old size. Caller must zero the reallocated memory.
+ *
+ * - DUK_REALLOC_INDIRECT() must be used when a mark-and-sweep triggered
+ * by an allocation failure might invalidate the original 'ptr', thus
+ * causing a realloc retry to use an invalid pointer. Example: we're
+ * reallocating the value stack and a finalizer resizes the same value
+ * stack during mark-and-sweep. The indirect variant requests for the
+ * current location of the pointer being reallocated using a callback
+ * right before every realloc attempt; this circuitous approach is used
+ * to avoid strict aliasing issues in a more straightforward indirect
+ * pointer (void **) approach. Note: the pointer in the storage
+ * location is read but is NOT updated; the caller must do that.
+ */
+
+/* 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))
+
+/*
+ * Memory constants
+ */
+
+#define DUK_HEAP_ALLOC_FAIL_MARKANDSWEEP_LIMIT 5 /* 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.
+ */
+
+/*
+ * Debugger support
+ */
+
+/* Maximum number of breakpoints. Only breakpoints that are set are
+ * consulted so increasing this has no performance impact.
+ */
+#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
+
+/* Milliseconds between status notify and transport peeks. */
+#define DUK_HEAP_DBG_RATELIMIT_MILLISECS 200
+
+/* Step types */
+#define DUK_STEP_TYPE_NONE 0
+#define DUK_STEP_TYPE_INTO 1
+#define DUK_STEP_TYPE_OVER 2
+#define DUK_STEP_TYPE_OUT 3
+
+struct duk_breakpoint {
+ duk_hstring *filename;
+ duk_uint32_t line;
+};
+
+#if defined(DUK_USE_DEBUGGER_SUPPORT)
+#define DUK_HEAP_IS_DEBUGGER_ATTACHED(heap) ((heap)->dbg_read_cb != NULL)
+#define DUK_HEAP_CLEAR_STEP_STATE(heap) do { \
+ (heap)->dbg_step_type = DUK_STEP_TYPE_NONE; \
+ (heap)->dbg_step_thread = NULL; \
+ (heap)->dbg_step_csindex = 0; \
+ (heap)->dbg_step_startline = 0; \
+ } while (0)
+#define DUK_HEAP_SET_PAUSED(heap) do { \
+ (heap)->dbg_paused = 1; \
+ (heap)->dbg_state_dirty = 1; \
+ DUK_HEAP_CLEAR_STEP_STATE((heap)); \
+ } while (0)
+#define DUK_HEAP_CLEAR_PAUSED(heap) do { \
+ (heap)->dbg_paused = 0; \
+ (heap)->dbg_state_dirty = 1; \
+ DUK_HEAP_CLEAR_STEP_STATE((heap)); \
+ } while (0)
+#endif /* DUK_USE_DEBUGGER_SUPPORT */
+
+/*
+ * String cache should ideally be at duk_hthread level, but that would
+ * cause string finalization to slow down relative to the number of
+ * threads; string finalization must check the string cache for "weak"
+ * references to the string being finalized to avoid dead pointers.
+ *
+ * Thus, string caches are now at the heap level now.
+ */
+
+struct duk_strcache {
+ duk_hstring *h;
+ duk_uint32_t bidx;
+ duk_uint32_t cidx;
+};
+
+/*
+ * Longjmp state, contains the information needed to perform a longjmp.
+ * Longjmp related values are written to value1, value2, and iserror.
+ */
+
+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) */
+};
+
+/*
+ * Stringtable entry for fixed size stringtable
+ */
+
+struct duk_strtab_entry {
+#if defined(DUK_USE_HEAPPTR16)
+ /* A 16-bit listlen makes sense with 16-bit heap pointers: there
+ * won't be space for 64k strings anyway.
+ */
+ duk_uint16_t listlen; /* if 0, 'str16' used, if > 0, 'strlist16' used */
+ union {
+ duk_uint16_t strlist16;
+ duk_uint16_t str16;
+ } u;
+#else
+ duk_size_t listlen; /* if 0, 'str' used, if > 0, 'strlist' used */
+ union {
+ duk_hstring **strlist;
+ duk_hstring *str;
+ } u;
+#endif
+};
+
+/*
+ * Main heap structure
+ */
+
+struct duk_heap {
+ duk_small_uint_t flags;
+
+ /* Allocator functions. */
+ duk_alloc_function alloc_func;
+ duk_realloc_function realloc_func;
+ duk_free_function free_func;
+
+ /* Heap udata, used for allocator functions but also for other heap
+ * level callbacks like pointer compression, etc.
+ */
+ void *heap_udata;
+
+ /* Precomputed pointers when using 16-bit heap pointer packing. */
+#if defined(DUK_USE_HEAPPTR16)
+ duk_uint16_t heapptr_null16;
+ duk_uint16_t heapptr_deleted16;
+#endif
+
+ /* Fatal error handling, called e.g. when a longjmp() is needed but
+ * lj.jmpbuf_ptr is NULL. fatal_func must never return; it's not
+ * declared as "noreturn" because doing that for typedefs is a bit
+ * challenging portability-wise.
+ */
+ duk_fatal_function fatal_func;
+
+ /* allocated heap objects */
+ duk_heaphdr *heap_allocated;
+
+ /* work list for objects whose refcounts are zero but which have not been
+ * "finalized"; avoids recursive C calls when refcounts go to zero in a
+ * chain of objects.
+ */
+#if defined(DUK_USE_REFERENCE_COUNTING)
+ duk_heaphdr *refzero_list;
+ duk_heaphdr *refzero_list_tail;
+#endif
+
+#if defined(DUK_USE_MARK_AND_SWEEP)
+ /* mark-and-sweep control */
+#if defined(DUK_USE_VOLUNTARY_GC)
+ duk_int_t mark_and_sweep_trigger_counter;
+#endif
+ duk_int_t mark_and_sweep_recursion_depth;
+
+ /* mark-and-sweep flags automatically active (used for critical sections) */
+ duk_small_uint_t mark_and_sweep_base_flags;
+
+ /* work list for objects to be finalized (by mark-and-sweep) */
+ duk_heaphdr *finalize_list;
+#endif
+
+ /* longjmp state */
+ duk_ljstate lj;
+
+ /* marker for detecting internal "double faults", see duk_error_throw.c */
+ duk_bool_t handling_error;
+
+ /* heap thread, used internally and for finalization */
+ duk_hthread *heap_thread;
+
+ /* current thread */
+ duk_hthread *curr_thread; /* currently running thread */
+
+ /* heap level "stash" object (e.g., various reachability roots) */
+ duk_hobject *heap_object;
+
+ /* heap level temporary log formatting buffer */
+ duk_hbuffer_dynamic *log_buffer;
+
+ /* duk_handle_call / duk_handle_safe_call recursion depth limiting */
+ duk_int_t call_recursion_depth;
+ duk_int_t call_recursion_limit;
+
+ /* mix-in value for computing string hashes; should be reasonably unpredictable */
+ duk_uint32_t hash_seed;
+
+ /* rnd_state for duk_util_tinyrandom.c */
+ duk_uint32_t rnd_state;
+
+ /* interrupt counter */
+#if defined(DUK_USE_INTERRUPT_COUNTER)
+ duk_int_t interrupt_init; /* start value for current countdown */
+ duk_int_t interrupt_counter; /* countdown state (mirrored in current thread state) */
+#endif
+
+ /* debugger */
+
+#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_peek_function dbg_peek_cb;
+ duk_debug_read_flush_function dbg_read_flush_cb;
+ duk_debug_write_flush_function dbg_write_flush_cb;
+ duk_debug_detached_function dbg_detached_cb;
+ void *dbg_udata;
+
+ /* debugger state, only relevant when 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_paused; /* currently paused: talk with debug client until step/resume */
+ duk_bool_t dbg_state_dirty; /* resend state next time executor is about to run */
+ duk_small_uint_t dbg_step_type; /* step type: none, step into, step over, step out */
+ duk_hthread *dbg_step_thread; /* borrowed; NULL if no step state (NULLed in unwind) */
+ duk_size_t dbg_step_csindex; /* callstack index */
+ duk_uint32_t dbg_step_startline; /* starting line number */
+ 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 */
+ /* XXX: make active breakpoints actual copies instead of pointers? */
+
+ /* These are for rate limiting Status notifications and transport peeking. */
+ duk_uint32_t dbg_exec_counter; /* cumulative opcode execution count (overflows are OK) */
+ duk_uint32_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) */
+#endif
+
+ /* string intern table (weak refs) */
+#if defined(DUK_USE_STRTAB_PROBE)
+#if defined(DUK_USE_HEAPPTR16)
+ duk_uint16_t *strtable16;
+#else
+ duk_hstring **strtable;
+#endif
+ duk_uint32_t st_size; /* alloc size in elements */
+ duk_uint32_t st_used; /* used elements (includes DELETED) */
+#endif
+
+ /* XXX: static alloc is OK until separate chaining stringtable
+ * resizing is implemented.
+ */
+#if defined(DUK_USE_STRTAB_CHAIN)
+ duk_strtab_entry strtable[DUK_STRTAB_CHAIN_SIZE];
+#endif
+
+ /* string access cache (codepoint offset -> byte offset) for fast string
+ * character looping; 'weak' reference which needs special handling in GC.
+ */
+ duk_strcache strcache[DUK_HEAP_STRCACHE_SIZE];
+
+ /* built-in strings */
+#if defined(DUK_USE_HEAPPTR16)
+ duk_uint16_t strs16[DUK_HEAP_NUM_STRINGS];
+#else
+ duk_hstring *strs[DUK_HEAP_NUM_STRINGS];
+#endif
+};
+
+/*
+ * Prototypes
+ */
+
+DUK_INTERNAL_DECL
+duk_heap *duk_heap_alloc(duk_alloc_function alloc_func,
+ duk_realloc_function realloc_func,
+ duk_free_function free_func,
+ void *heap_udata,
+ duk_fatal_function fatal_func);
+DUK_INTERNAL_DECL void duk_heap_free(duk_heap *heap);
+DUK_INTERNAL_DECL void duk_free_hobject_inner(duk_heap *heap, duk_hobject *h);
+DUK_INTERNAL_DECL void duk_free_hbuffer_inner(duk_heap *heap, duk_hbuffer *h);
+DUK_INTERNAL_DECL void duk_free_hstring_inner(duk_heap *heap, duk_hstring *h);
+DUK_INTERNAL_DECL void duk_heap_free_heaphdr_raw(duk_heap *heap, duk_heaphdr *hdr);
+
+DUK_INTERNAL_DECL void duk_heap_insert_into_heap_allocated(duk_heap *heap, duk_heaphdr *hdr);
+#if defined(DUK_USE_DOUBLE_LINKED_HEAP) && defined(DUK_USE_REFERENCE_COUNTING)
+DUK_INTERNAL_DECL void duk_heap_remove_any_from_heap_allocated(duk_heap *heap, duk_heaphdr *hdr);
+#endif
+#if defined(DUK_USE_INTERRUPT_COUNTER)
+DUK_INTERNAL_DECL void duk_heap_switch_thread(duk_heap *heap, duk_hthread *new_thr);
+#endif
+
+#if 0 /*unused*/
+DUK_INTERNAL_DECL duk_hstring *duk_heap_string_lookup(duk_heap *heap, const duk_uint8_t *str, duk_uint32_t blen);
+#endif
+DUK_INTERNAL_DECL duk_hstring *duk_heap_string_intern(duk_heap *heap, const duk_uint8_t *str, duk_uint32_t blen);
+DUK_INTERNAL_DECL duk_hstring *duk_heap_string_intern_checked(duk_hthread *thr, const duk_uint8_t *str, duk_uint32_t len);
+#if 0 /*unused*/
+DUK_INTERNAL_DECL duk_hstring *duk_heap_string_lookup_u32(duk_heap *heap, duk_uint32_t val);
+#endif
+DUK_INTERNAL_DECL duk_hstring *duk_heap_string_intern_u32(duk_heap *heap, duk_uint32_t val);
+DUK_INTERNAL_DECL duk_hstring *duk_heap_string_intern_u32_checked(duk_hthread *thr, duk_uint32_t val);
+DUK_INTERNAL_DECL void duk_heap_string_remove(duk_heap *heap, duk_hstring *h);
+#if defined(DUK_USE_MARK_AND_SWEEP) && defined(DUK_USE_MS_STRINGTABLE_RESIZE)
+DUK_INTERNAL_DECL void duk_heap_force_strtab_resize(duk_heap *heap);
+#endif
+DUK_INTERNAL void duk_heap_free_strtab(duk_heap *heap);
+#if defined(DUK_USE_DEBUG)
+DUK_INTERNAL void duk_heap_dump_strtab(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);
+
+#if defined(DUK_USE_PROVIDE_DEFAULT_ALLOC_FUNCTIONS)
+DUK_INTERNAL_DECL void *duk_default_alloc_function(void *udata, duk_size_t size);
+DUK_INTERNAL_DECL void *duk_default_realloc_function(void *udata, void *ptr, duk_size_t newsize);
+DUK_INTERNAL_DECL void duk_default_free_function(void *udata, void *ptr);
+#endif
+
+DUK_INTERNAL_DECL void *duk_heap_mem_alloc(duk_heap *heap, duk_size_t size);
+DUK_INTERNAL_DECL void *duk_heap_mem_alloc_zeroed(duk_heap *heap, duk_size_t size);
+DUK_INTERNAL_DECL void *duk_heap_mem_realloc(duk_heap *heap, void *ptr, duk_size_t newsize);
+DUK_INTERNAL_DECL void *duk_heap_mem_realloc_indirect(duk_heap *heap, duk_mem_getptr cb, void *ud, duk_size_t newsize);
+DUK_INTERNAL_DECL void duk_heap_mem_free(duk_heap *heap, void *ptr);
+
+#ifdef DUK_USE_REFERENCE_COUNTING
+#if !defined(DUK_USE_FAST_REFCOUNT_DEFAULT)
+DUK_INTERNAL_DECL void duk_tval_incref(duk_tval *tv);
+#endif
+#if 0 /* unused */
+DUK_INTERNAL_DECL void duk_tval_incref_allownull(duk_tval *tv);
+#endif
+DUK_INTERNAL_DECL void duk_tval_decref(duk_hthread *thr, duk_tval *tv);
+#if 0 /* unused */
+DUK_INTERNAL_DECL void duk_tval_decref_allownull(duk_hthread *thr, duk_tval *tv);
+#endif
+#if !defined(DUK_USE_FAST_REFCOUNT_DEFAULT)
+DUK_INTERNAL_DECL void duk_heaphdr_incref(duk_heaphdr *h);
+#endif
+#if 0 /* unused */
+DUK_INTERNAL_DECL void duk_heaphdr_incref_allownull(duk_heaphdr *h);
+#endif
+DUK_INTERNAL_DECL void duk_heaphdr_decref(duk_hthread *thr, duk_heaphdr *h);
+DUK_INTERNAL_DECL void duk_heaphdr_decref_allownull(duk_hthread *thr, duk_heaphdr *h);
+DUK_INTERNAL_DECL void duk_heaphdr_refzero(duk_hthread *thr, duk_heaphdr *h);
+DUK_INTERNAL_DECL void duk_heaphdr_refcount_finalize(duk_hthread *thr, duk_heaphdr *hdr);
+#else
+/* no refcounting */
+#endif
+
+#if defined(DUK_USE_MARK_AND_SWEEP)
+DUK_INTERNAL_DECL duk_bool_t duk_heap_mark_and_sweep(duk_heap *heap, duk_small_uint_t flags);
+#endif
+
+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 */
+#line 1 "duk_debugger.h"
+#ifndef DUK_DEBUGGER_H_INCLUDED
+#define DUK_DEBUGGER_H_INCLUDED
+
+/* Debugger protocol version is defined in the public API header. */
+
+#define DUK_DBG_MARKER_EOM 0x00
+#define DUK_DBG_MARKER_REQUEST 0x01
+#define DUK_DBG_MARKER_REPLY 0x02
+#define DUK_DBG_MARKER_ERROR 0x03
+#define DUK_DBG_MARKER_NOTIFY 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
+
+/* Initiated by Duktape */
+#define DUK_DBG_CMD_STATUS 0x01
+#define DUK_DBG_CMD_PRINT 0x02
+#define DUK_DBG_CMD_ALERT 0x03
+#define DUK_DBG_CMD_LOG 0x04
+
+/* 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
+
+#if defined(DUK_USE_DEBUGGER_SUPPORT)
+DUK_INTERNAL_DECL void duk_debug_do_detach(duk_heap *heap);
+
+DUK_INTERNAL_DECL duk_bool_t duk_debug_read_peek(duk_hthread *thr);
+DUK_INTERNAL_DECL void duk_debug_write_flush(duk_hthread *thr);
+
+DUK_INTERNAL_DECL void duk_debug_skip_bytes(duk_hthread *thr, duk_size_t length);
+DUK_INTERNAL_DECL void duk_debug_skip_byte(duk_hthread *thr);
+
+DUK_INTERNAL_DECL void duk_debug_read_bytes(duk_hthread *thr, duk_uint8_t *data, duk_size_t length);
+DUK_INTERNAL_DECL duk_uint8_t duk_debug_read_byte(duk_hthread *thr);
+DUK_INTERNAL_DECL duk_int32_t duk_debug_read_int(duk_hthread *thr);
+DUK_INTERNAL_DECL duk_hstring *duk_debug_read_hstring(duk_hthread *thr);
+/* XXX: exposed duk_debug_read_pointer */
+/* XXX: exposed duk_debug_read_buffer */
+/* XXX: exposed duk_debug_read_hbuffer */
+DUK_INTERNAL_DECL void duk_debug_read_tval(duk_hthread *thr);
+
+DUK_INTERNAL_DECL void duk_debug_write_bytes(duk_hthread *thr, const duk_uint8_t *data, duk_size_t length);
+DUK_INTERNAL_DECL void duk_debug_write_byte(duk_hthread *thr, duk_uint8_t x);
+DUK_INTERNAL_DECL void duk_debug_write_unused(duk_hthread *thr);
+DUK_INTERNAL_DECL void duk_debug_write_undefined(duk_hthread *thr);
+DUK_INTERNAL_DECL void duk_debug_write_int(duk_hthread *thr, duk_int32_t x);
+DUK_INTERNAL_DECL void duk_debug_write_uint(duk_hthread *thr, duk_uint32_t x);
+DUK_INTERNAL_DECL void duk_debug_write_string(duk_hthread *thr, const char *data, duk_size_t length);
+DUK_INTERNAL_DECL void duk_debug_write_cstring(duk_hthread *thr, const char *data);
+DUK_INTERNAL_DECL void duk_debug_write_hstring(duk_hthread *thr, duk_hstring *h);
+DUK_INTERNAL_DECL void duk_debug_write_buffer(duk_hthread *thr, const char *data, duk_size_t length);
+DUK_INTERNAL_DECL void duk_debug_write_hbuffer(duk_hthread *thr, duk_hbuffer *h);
+DUK_INTERNAL_DECL void duk_debug_write_pointer(duk_hthread *thr, const void *ptr);
+#if defined(DUK_USE_DEBUGGER_DUMPHEAP)
+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 */
+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);
+DUK_INTERNAL_DECL void duk_debug_write_error_eom(duk_hthread *thr, duk_small_uint_t err_code, const char *msg);
+DUK_INTERNAL_DECL void duk_debug_write_notify(duk_hthread *thr, duk_small_uint_t command);
+DUK_INTERNAL_DECL void duk_debug_write_eom(duk_hthread *thr);
+
+DUK_INTERNAL duk_uint_fast32_t duk_debug_curr_line(duk_hthread *thr);
+DUK_INTERNAL void duk_debug_send_status(duk_hthread *thr);
+
+DUK_INTERNAL_DECL duk_bool_t duk_debug_process_messages(duk_hthread *thr, duk_bool_t no_block);
+
+DUK_INTERNAL_DECL duk_small_int_t duk_debug_add_breakpoint(duk_hthread *thr, duk_hstring *filename, duk_uint32_t line);
+DUK_INTERNAL_DECL duk_bool_t duk_debug_remove_breakpoint(duk_hthread *thr, duk_small_uint_t breakpoint_index);
+#endif
+
+#endif /* DUK_DEBUGGER_H_INCLUDED */
+#line 1 "duk_debug.h"
+/*
+ * Debugging macros, DUK_DPRINT() and its variants in particular.
+ *
+ * DUK_DPRINT() allows formatted debug prints, and supports standard
+ * and Duktape specific formatters. See duk_debug_vsnprintf.c for details.
+ *
+ * DUK_D(x), DUK_DD(x), and DUK_DDD(x) are used together with log macros
+ * for technical reasons. They are concretely used to hide 'x' from the
+ * compiler when the corresponding log level is disabled. This allows
+ * clean builds on non-C99 compilers, at the cost of more verbose code.
+ * Examples:
+ *
+ * DUK_D(DUK_DPRINT("foo"));
+ * DUK_DD(DUK_DDPRINT("foo"));
+ * DUK_DDD(DUK_DDDPRINT("foo"));
+ *
+ * This approach is preferable to the old "double parentheses" hack because
+ * double parentheses make the C99 solution worse: __FILE__ and __LINE__ can
+ * no longer be added transparently without going through globals, which
+ * works poorly with threading.
+ */
+
+#ifndef DUK_DEBUG_H_INCLUDED
+#define DUK_DEBUG_H_INCLUDED
+
+#ifdef DUK_USE_DEBUG
+
+#if defined(DUK_USE_DPRINT)
+#define DUK_D(x) x
+#else
+#define DUK_D(x) do { } while (0) /* omit */
+#endif
+
+#if defined(DUK_USE_DDPRINT)
+#define DUK_DD(x) x
+#else
+#define DUK_DD(x) do { } while (0) /* omit */
+#endif
+
+#if defined(DUK_USE_DDDPRINT)
+#define DUK_DDD(x) x
+#else
+#define DUK_DDD(x) do { } while (0) /* omit */
+#endif
+
+/*
+ * Exposed debug macros: debugging enabled
+ */
+
+#define DUK_LEVEL_DEBUG 1
+#define DUK_LEVEL_DDEBUG 2
+#define DUK_LEVEL_DDDEBUG 3
+
+#ifdef DUK_USE_VARIADIC_MACROS
+
+/* 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_small_int_t) (lev), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO, DUK_FUNC_MACRO, __VA_ARGS__);
+
+#define DUK_DPRINT(...) DUK__DEBUG_LOG(DUK_LEVEL_DEBUG, __VA_ARGS__)
+
+#ifdef DUK_USE_DDPRINT
+#define DUK_DDPRINT(...) DUK__DEBUG_LOG(DUK_LEVEL_DDEBUG, __VA_ARGS__)
+#else
+#define DUK_DDPRINT(...)
+#endif
+
+#ifdef DUK_USE_DDDPRINT
+#define DUK_DDDPRINT(...) DUK__DEBUG_LOG(DUK_LEVEL_DDDEBUG, __VA_ARGS__)
+#else
+#define DUK_DDDPRINT(...)
+#endif
+
+#else /* DUK_USE_VARIADIC_MACROS */
+
+#define DUK__DEBUG_STASH(lev) \
+ (void) DUK_SNPRINTF(duk_debug_file_stash, DUK_DEBUG_STASH_SIZE, "%s", (const char *) DUK_FILE_MACRO), \
+ duk_debug_file_stash[DUK_DEBUG_STASH_SIZE - 1] = (char) 0; \
+ (void) DUK_SNPRINTF(duk_debug_line_stash, DUK_DEBUG_STASH_SIZE, "%ld", (long) DUK_LINE_MACRO), \
+ duk_debug_line_stash[DUK_DEBUG_STASH_SIZE - 1] = (char) 0; \
+ (void) DUK_SNPRINTF(duk_debug_func_stash, DUK_DEBUG_STASH_SIZE, "%s", (const char *) DUK_FUNC_MACRO), \
+ 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
+ * needed normally because DUK_D() and friends will hide the entire debug log
+ * statement from the compiler.
+ */
+
+#ifdef DUK_USE_DPRINT
+#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 */
+#endif
+
+#ifdef DUK_USE_DDPRINT
+#define DUK_DDPRINT DUK__DEBUG_STASH(DUK_LEVEL_DDEBUG), (void) duk_debug_log /* args go here in parens */
+#else
+#define DUK_DDPRINT 0 && /* args */
+#endif
+
+#ifdef DUK_USE_DDDPRINT
+#define DUK_DDDPRINT DUK__DEBUG_STASH(DUK_LEVEL_DDDEBUG), (void) duk_debug_log /* args go here in parens */
+#else
+#define DUK_DDDPRINT 0 && /* args */
+#endif
+
+#endif /* DUK_USE_VARIADIC_MACROS */
+
+#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 */
+
+#ifdef DUK_USE_VARIADIC_MACROS
+
+#define DUK_DPRINT(...)
+#define DUK_DDPRINT(...)
+#define DUK_DDDPRINT(...)
+
+#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 */
+
+#endif /* DUK_USE_VARIADIC_MACROS */
+
+#endif /* DUK_USE_DEBUG */
+
+/*
+ * Structs
+ */
+
+#ifdef DUK_USE_DEBUG
+struct duk_fixedbuffer {
+ duk_uint8_t *buffer;
+ duk_size_t length;
+ duk_size_t offset;
+ duk_bool_t truncated;
+};
+#endif
+
+/*
+ * Prototypes
+ */
+
+#ifdef 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*/
+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);
+
+#ifdef DUK_USE_VARIADIC_MACROS
+DUK_INTERNAL_DECL void duk_debug_log(duk_small_int_t level, const char *file, duk_int_t line, const char *func, const char *fmt, ...);
+#else /* DUK_USE_VARIADIC_MACROS */
+/* parameter passing, not thread safe */
+#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 char duk_debug_line_stash[DUK_DEBUG_STASH_SIZE];
+DUK_INTERNAL_DECL char duk_debug_func_stash[DUK_DEBUG_STASH_SIZE];
+DUK_INTERNAL_DECL duk_small_int_t duk_debug_level_stash;
+#endif
+DUK_INTERNAL_DECL void duk_debug_log(const char *fmt, ...);
+#endif /* DUK_USE_VARIADIC_MACROS */
+
+DUK_INTERNAL_DECL void duk_fb_put_bytes(duk_fixedbuffer *fb, duk_uint8_t *buffer, duk_size_t length);
+DUK_INTERNAL_DECL void duk_fb_put_byte(duk_fixedbuffer *fb, duk_uint8_t x);
+DUK_INTERNAL_DECL void duk_fb_put_cstring(duk_fixedbuffer *fb, const char *x);
+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_DEBUG_H_INCLUDED */
+#line 1 "duk_error.h"
+/*
+ * Error handling macros, assertion macro, error codes.
+ *
+ * There are three level of 'errors':
+ *
+ * 1. Ordinary errors, relative to a thread, cause a longjmp, catchable.
+ * 2. Fatal errors, relative to a heap, cause fatal handler to be called.
+ * 3. Panic errors, unrelated to a heap and cause a process exit.
+ *
+ * Panics are used by the default fatal error handler and by debug code
+ * such as assertions. By providing a proper fatal error handler, user
+ * code can avoid panics in non-debug builds.
+ */
+
+#ifndef DUK_ERROR_H_INCLUDED
+#define DUK_ERROR_H_INCLUDED
+
+/*
+ * Error codes: defined in duktape.h
+ *
+ * Error codes are used as a shorthand to throw exceptions from inside
+ * the implementation. The appropriate Ecmascript object is constructed
+ * based on the code. Ecmascript code throws objects directly. The error
+ * codes are defined in the public API header because they are also used
+ * by calling code.
+ */
+
+/*
+ * Normal error
+ *
+ * Normal error is thrown with a longjmp() through the current setjmp()
+ * catchpoint record in the duk_heap. The 'curr_thread' of the duk_heap
+ * identifies the throwing thread.
+ *
+ * Error formatting is not always necessary but there are no separate calls
+ * (to minimize code size). Error object creation will consume a considerable
+ * amount of time, compared to which formatting is probably trivial. Note
+ * that special formatting (provided by DUK_DEBUG macros) is NOT available.
+ *
+ * The _RAW variants allow the caller to specify file and line. This makes
+ * it easier to write checked calls which want to use the call site of the
+ * checked function, not the error macro call inside the checked function.
+ *
+ * We prefer the standard variadic macros; if they are not available, we
+ * fall back to awkward hacks.
+ */
+
+#ifdef DUK_USE_VERBOSE_ERRORS
+
+#ifdef DUK_USE_VARIADIC_MACROS
+
+/* __VA_ARGS__ has comma issues for empty lists, so we mandate at least 1 argument for '...' (format string) */
+#define DUK_ERROR(thr,err,...) duk_err_handle_error(DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO, (thr), (err), __VA_ARGS__)
+#define DUK_ERROR_RAW(file,line,thr,err,...) duk_err_handle_error((file), (line), (thr), (err), __VA_ARGS__)
+
+#else /* DUK_USE_VARIADIC_MACROS */
+
+/* Parameter passing here is not thread safe. We rely on the __FILE__
+ * pointer being a constant which can be passed through a global.
+ */
+
+#define DUK_ERROR \
+ (void) (duk_err_file_stash = (const char *) DUK_FILE_MACRO, \
+ duk_err_line_stash = (duk_int_t) DUK_LINE_MACRO, \
+ duk_err_handle_error_stash) /* arguments follow */
+#define DUK_ERROR_RAW duk_err_handle_error
+
+#endif /* DUK_USE_VARIADIC_MACROS */
+
+#else /* DUK_USE_VERBOSE_ERRORS */
+
+#ifdef DUK_USE_VARIADIC_MACROS
+
+#define DUK_ERROR(thr,err,...) duk_err_handle_error((thr), (err))
+#define DUK_ERROR_RAW(file,line,thr,err,...) duk_err_handle_error((thr), (err))
+
+#else /* DUK_USE_VARIADIC_MACROS */
+
+/* This is sub-optimal because arguments will be passed but ignored, and the strings
+ * will go into the object file. Can't think of how to do this portably and still
+ * relatively conveniently.
+ */
+#define DUK_ERROR duk_err_handle_error_nonverbose1
+#define DUK_ERROR_RAW duk_err_handle_error_nonverbose2
+
+#endif /* DUK_USE_VARIADIC_MACROS */
+
+#endif /* DUK_USE_VERBOSE_ERRORS */
+
+/*
+ * Fatal error
+ *
+ * There are no fatal error macros at the moment. There are so few call
+ * sites that the fatal error handler is called directly.
+ */
+
+/*
+ * Panic error
+ *
+ * Panic errors are not relative to either a heap or a thread, and cause
+ * DUK_PANIC() macro to be invoked. Unlesa a user provides DUK_OPT_PANIC_HANDLER,
+ * DUK_PANIC() calls a helper which prints out the error and causes a process
+ * exit.
+ *
+ * The user can override the macro to provide custom handling. A macro is
+ * used to allow the user to have inline panic handling if desired (without
+ * causing a potentially risky function call).
+ *
+ * Panics are only used in debug code such as assertions, and by the default
+ * fatal error handler.
+ */
+
+#if defined(DUK_USE_PANIC_HANDLER)
+/* already defined, good */
+#define DUK_PANIC(code,msg) DUK_USE_PANIC_HANDLER((code),(msg))
+#else
+#define DUK_PANIC(code,msg) duk_default_panic_handler((code),(msg))
+#endif /* DUK_USE_PANIC_HANDLER */
+
+/*
+ * Assert macro: failure causes panic.
+ */
+
+#ifdef DUK_USE_ASSERTIONS
+
+/* the message should be a compile time constant without formatting (less risk);
+ * we don't care about assertion text size because they're not used in production
+ * builds.
+ */
+#define DUK_ASSERT(x) do { \
+ if (!(x)) { \
+ DUK_PANIC(DUK_ERR_ASSERTION_ERROR, \
+ "assertion failed: " #x \
+ " (" DUK_FILE_MACRO ":" DUK_MACRO_STRINGIFY(DUK_LINE_MACRO) ")"); \
+ } \
+ } while (0)
+
+#else /* DUK_USE_ASSERTIONS */
+
+#define DUK_ASSERT(x) do { /* assertion omitted */ } while(0)
+
+#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)
+
+/*
+ * Assertion helpers
+ */
+
+#if defined(DUK_USE_ASSERTIONS) && defined(DUK_USE_REFERENCE_COUNTING)
+#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 { \
+ 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 */
+#endif
+
+#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 { \
+ duk_double_union assert_tmp_du; \
+ assert_tmp_du.d = (dval); \
+ DUK_ASSERT(DUK_DBLUNION_IS_NORMALIZED(&assert_tmp_du)); \
+ } while (0)
+#else
+#define DUK_ASSERT_DOUBLE_IS_NORMALIZED(dval) /* nop */
+#endif
+
+/*
+ * Helper for valstack space
+ *
+ * Caller of DUK_ASSERT_VALSTACK_SPACE() estimates the number of free stack entries
+ * required for its own use, and any child calls which are not (a) Duktape API calls
+ * 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
+ */
+#if defined(DUK_USE_ASSERTIONS)
+#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 */
+#endif
+
+/*
+ * Prototypes
+ */
+
+#ifdef DUK_USE_VERBOSE_ERRORS
+#ifdef DUK_USE_VARIADIC_MACROS
+DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_handle_error(const char *filename, duk_int_t line, duk_hthread *thr, duk_errcode_t code, const char *fmt, ...));
+#else /* DUK_USE_VARIADIC_MACROS */
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL const char *duk_err_file_stash;
+DUK_INTERNAL_DECL duk_int_t duk_err_line_stash;
+#endif /* !DUK_SINGLE_FILE */
+DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_handle_error(const char *filename, duk_int_t line, duk_hthread *thr, duk_errcode_t code, const char *fmt, ...));
+DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_handle_error_stash(duk_hthread *thr, duk_errcode_t code, const char *fmt, ...));
+#endif /* DUK_USE_VARIADIC_MACROS */
+#else /* DUK_USE_VERBOSE_ERRORS */
+#ifdef DUK_USE_VARIADIC_MACROS
+DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_handle_error(duk_hthread *thr, duk_errcode_t code));
+#else /* DUK_USE_VARIADIC_MACROS */
+DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_handle_error_nonverbose1(duk_hthread *thr, duk_errcode_t code, const char *fmt, ...));
+DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_handle_error_nonverbose2(const char *filename, duk_int_t line, duk_hthread *thr, duk_errcode_t code, const char *fmt, ...));
+#endif /* DUK_USE_VARIADIC_MACROS */
+#endif /* DUK_USE_VERBOSE_ERRORS */
+
+#ifdef 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));
+#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));
+
+#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_bool_t noblame_fileline);
+#endif
+#if defined(DUK_USE_AUGMENT_ERROR_THROW)
+DUK_INTERNAL_DECL void duk_err_augment_error_throw(duk_hthread *thr);
+#endif
+
+DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_longjmp(duk_hthread *thr));
+
+DUK_NORETURN(DUK_INTERNAL_DECL void duk_default_fatal_handler(duk_context *ctx, duk_errcode_t code, const char *msg));
+
+#if !defined(DUK_USE_PANIC_HANDLER)
+DUK_NORETURN(DUK_INTERNAL_DECL void duk_default_panic_handler(duk_errcode_t code, const char *msg));
+#endif
+
+DUK_INTERNAL_DECL void duk_err_setup_heap_ljstate(duk_hthread *thr, duk_small_int_t lj_type);
+
+DUK_INTERNAL_DECL duk_hobject *duk_error_prototype_from_code(duk_hthread *thr, duk_errcode_t err_code);
+
+#endif /* DUK_ERROR_H_INCLUDED */
+#line 1 "duk_util.h"
+/*
+ * Utilities
+ */
+
+#ifndef DUK_UTIL_H_INCLUDED
+#define DUK_UTIL_H_INCLUDED
+
+#define DUK_UTIL_MIN_HASH_PRIME 17 /* must match genhashsizes.py */
+
+#define DUK_UTIL_GET_HASH_PROBE_STEP(hash) (duk_util_probe_steps[(hash) & 0x1f])
+
+/*
+ * Bitstream decoder
+ */
+
+struct duk_bitdecoder_ctx {
+ const duk_uint8_t *data;
+ duk_size_t offset;
+ duk_size_t length;
+ duk_uint32_t currval;
+ duk_small_int_t currbits;
+};
+
+/*
+ * Bitstream encoder
+ */
+
+struct duk_bitencoder_ctx {
+ duk_uint8_t *data;
+ duk_size_t offset;
+ duk_size_t length;
+ duk_uint32_t currval;
+ duk_small_int_t currbits;
+ duk_small_int_t truncated;
+};
+
+/*
+ * Externs and prototypes
+ */
+
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL duk_uint8_t duk_lc_digits[36];
+DUK_INTERNAL_DECL duk_uint8_t duk_uc_nybbles[16];
+DUK_INTERNAL_DECL duk_int8_t duk_hex_dectab[256];
+#endif /* !DUK_SINGLE_FILE */
+
+/* Note: assumes that duk_util_probe_steps size is 32 */
+#if defined(DUK_USE_HOBJECT_HASH_PART) || defined(DUK_USE_STRTAB_PROBE)
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL duk_uint8_t duk_util_probe_steps[32];
+#endif /* !DUK_SINGLE_FILE */
+#endif
+
+DUK_INTERNAL_DECL duk_uint32_t duk_util_hashbytes(const duk_uint8_t *data, duk_size_t len, duk_uint32_t seed);
+
+#if defined(DUK_USE_HOBJECT_HASH_PART) || defined(DUK_USE_STRTAB_PROBE)
+DUK_INTERNAL_DECL duk_uint32_t duk_util_get_hash_prime(duk_uint32_t size);
+#endif
+
+DUK_INTERNAL_DECL duk_int32_t duk_bd_decode(duk_bitdecoder_ctx *ctx, duk_small_int_t bits);
+DUK_INTERNAL_DECL duk_small_int_t duk_bd_decode_flag(duk_bitdecoder_ctx *ctx);
+DUK_INTERNAL_DECL duk_int32_t duk_bd_decode_flagged(duk_bitdecoder_ctx *ctx, duk_small_int_t bits, duk_int32_t def_value);
+
+DUK_INTERNAL_DECL void duk_be_encode(duk_bitencoder_ctx *ctx, duk_uint32_t data, duk_small_int_t bits);
+DUK_INTERNAL_DECL void duk_be_finish(duk_bitencoder_ctx *ctx);
+
+DUK_INTERNAL_DECL duk_uint32_t duk_util_tinyrandom_get_bits(duk_hthread *thr, duk_small_int_t n);
+DUK_INTERNAL_DECL duk_double_t duk_util_tinyrandom_get_double(duk_hthread *thr);
+
+#if defined(DUK_USE_DEBUGGER_SUPPORT) /* For now only needed by the debugger. */
+DUK_INTERNAL void duk_byteswap_bytes(duk_uint8_t *p, duk_small_uint_t len);
+#endif
+
+#endif /* DUK_UTIL_H_INCLUDED */
+#line 1 "duk_unicode.h"
+/*
+ * Unicode helpers
+ */
+
+#ifndef DUK_UNICODE_H_INCLUDED
+#define DUK_UNICODE_H_INCLUDED
+
+/*
+ * UTF-8 / XUTF-8 / CESU-8 constants
+ */
+
+#define DUK_UNICODE_MAX_XUTF8_LENGTH 7 /* up to 36 bit codepoints */
+#define DUK_UNICODE_MAX_CESU8_LENGTH 6 /* all codepoints up to U+10FFFF */
+
+/*
+ * Useful Unicode codepoints
+ *
+ * Integer constants must be signed to avoid unexpected coercions
+ * 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 */
+
+/*
+ * ASCII character constants
+ *
+ * C character literals like 'x' have a platform specific value and do
+ * not match ASCII (UTF-8) values on e.g. EBCDIC platforms. So, use
+ * these (admittedly awkward) constants instead. These constants must
+ * also have signed values to avoid unexpected coercions in comparisons.
+ *
+ * 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
+
+/*
+ * Unicode tables
+ */
+
+#ifdef DUK_USE_SOURCE_NONBMP
+/*
+ * Automatically generated by extract_chars.py, do not edit!
+ */
+
+extern const duk_uint8_t duk_unicode_ids_noa[791];
+#else
+/*
+ * Automatically generated by extract_chars.py, do not edit!
+ */
+
+extern const duk_uint8_t duk_unicode_ids_noabmp[611];
+#endif
+
+#ifdef DUK_USE_SOURCE_NONBMP
+/*
+ * Automatically generated by extract_chars.py, do not edit!
+ */
+
+extern const duk_uint8_t duk_unicode_ids_m_let_noa[42];
+#else
+/*
+ * Automatically generated by extract_chars.py, do not edit!
+ */
+
+extern const duk_uint8_t duk_unicode_ids_m_let_noabmp[24];
+#endif
+
+#ifdef DUK_USE_SOURCE_NONBMP
+/*
+ * Automatically generated by extract_chars.py, do not edit!
+ */
+
+extern const duk_uint8_t duk_unicode_idp_m_ids_noa[397];
+#else
+/*
+ * Automatically generated by extract_chars.py, do not edit!
+ */
+
+extern const duk_uint8_t duk_unicode_idp_m_ids_noabmp[348];
+#endif
+
+/*
+ * Automatically generated by extract_caseconv.py, do not edit!
+ */
+
+extern const duk_uint8_t duk_unicode_caseconv_uc[1288];
+extern const duk_uint8_t duk_unicode_caseconv_lc[616];
+
+/*
+ * Extern
+ */
+
+/* duk_unicode_support.c */
+#if !defined(DUK_SINGLE_FILE)
+DUK_INTERNAL_DECL duk_uint8_t duk_unicode_xutf8_markers[7];
+DUK_INTERNAL_DECL duk_uint16_t duk_unicode_re_ranges_digit[2];
+DUK_INTERNAL_DECL duk_uint16_t duk_unicode_re_ranges_white[22];
+DUK_INTERNAL_DECL duk_uint16_t duk_unicode_re_ranges_wordchar[8];
+DUK_INTERNAL_DECL duk_uint16_t duk_unicode_re_ranges_not_digit[4];
+DUK_INTERNAL_DECL duk_uint16_t duk_unicode_re_ranges_not_white[24];
+DUK_INTERNAL_DECL duk_uint16_t duk_unicode_re_ranges_not_wordchar[10];
+#endif /* !DUK_SINGLE_FILE */
+
+/*
+ * Prototypes
+ */
+
+DUK_INTERNAL_DECL duk_small_int_t duk_unicode_get_xutf8_length(duk_ucodepoint_t cp);
+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_size_t duk_unicode_unvalidated_utf8_length(const duk_uint8_t *data, duk_size_t blen);
+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);
+DUK_INTERNAL_DECL duk_small_int_t duk_unicode_is_identifier_part(duk_codepoint_t cp);
+DUK_INTERNAL_DECL duk_small_int_t duk_unicode_is_letter(duk_codepoint_t cp);
+DUK_INTERNAL_DECL void duk_unicode_case_convert_string(duk_hthread *thr, duk_bool_t uppercase);
+DUK_INTERNAL_DECL duk_codepoint_t duk_unicode_re_canonicalize_char(duk_hthread *thr, duk_codepoint_t cp);
+DUK_INTERNAL_DECL duk_small_int_t duk_unicode_re_is_wordchar(duk_codepoint_t cp);
+
+#endif /* DUK_UNICODE_H_INCLUDED */
+#line 1 "duk_json.h"
+/*
+ * Defines for JSON, especially duk_bi_json.c.
+ */
+
+#ifndef DUK_JSON_H_INCLUDED
+#define DUK_JSON_H_INCLUDED
+
+/* Object/array recursion limit (to protect C stack) */
+#if defined(DUK_USE_DEEP_C_STACK)
+#define DUK_JSON_ENC_RECURSION_LIMIT 1000
+#define DUK_JSON_DEC_RECURSION_LIMIT 1000
+#else
+#define DUK_JSON_ENC_RECURSION_LIMIT 100
+#define DUK_JSON_DEC_RECURSION_LIMIT 100
+#endif
+
+/* Encoding/decoding flags */
+#define DUK_JSON_FLAG_ASCII_ONLY (1 << 0) /* escape any non-ASCII characters */
+#define DUK_JSON_FLAG_AVOID_KEY_QUOTES (1 << 1) /* avoid key quotes when key is an ASCII Identifier */
+#define DUK_JSON_FLAG_EXT_CUSTOM (1 << 2) /* extended types: custom encoding */
+#define DUK_JSON_FLAG_EXT_COMPATIBLE (1 << 3) /* extended types: compatible encoding */
+
+/* How much stack to require on entry to object/array encode */
+#define DUK_JSON_ENC_REQSTACK 32
+
+/* How much stack to require on entry to object/array decode */
+#define DUK_JSON_DEC_REQSTACK 32
+
+/* Encoding state. Heap object references are all borrowed. */
+typedef struct {
+ duk_hthread *thr;
+ duk_hbuffer_dynamic *h_buf;
+ duk_hobject *h_replacer; /* replacer function */
+ duk_hstring *h_gap; /* gap (if empty string, NULL) */
+ duk_hstring *h_indent; /* current indent (if gap is NULL, this is 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;
+#if defined(DUK_USE_JX) || defined(DUK_USE_JC)
+ duk_small_uint_t flag_ext_custom;
+ duk_small_uint_t flag_ext_compatible;
+#endif
+ duk_int_t recursion_depth;
+ duk_int_t recursion_limit;
+ 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;
+ duk_small_uint_t stridx_custom_neginf;
+ duk_small_uint_t stridx_custom_posinf;
+ duk_small_uint_t stridx_custom_function;
+#endif
+} duk_json_enc_ctx;
+
+typedef struct {
+ duk_hthread *thr;
+ const duk_uint8_t *p;
+ const duk_uint8_t *p_start;
+ const duk_uint8_t *p_end;
+ duk_idx_t idx_reviver;
+ duk_small_uint_t flags;
+#if defined(DUK_USE_JX) || defined(DUK_USE_JC)
+ duk_small_uint_t flag_ext_custom;
+ duk_small_uint_t flag_ext_compatible;
+#endif
+ duk_int_t recursion_depth;
+ duk_int_t recursion_limit;
+} duk_json_dec_ctx;
+
+#endif /* DUK_JSON_H_INCLUDED */
+#line 1 "duk_js.h"
+/*
+ * Ecmascript execution, support primitives.
+ */
+
+#ifndef DUK_JS_H_INCLUDED
+#define DUK_JS_H_INCLUDED
+
+/* Flags for call handling. */
+#define DUK_CALL_FLAG_PROTECTED (1 << 0) /* duk_handle_call: call is protected */
+#define DUK_CALL_FLAG_IGNORE_RECLIMIT (1 << 1) /* duk_handle_call: call ignores C recursion limit (for errhandler calls) */
+#define DUK_CALL_FLAG_CONSTRUCTOR_CALL (1 << 2) /* duk_handle_call: constructor call (i.e. called as 'new Foo()') */
+#define DUK_CALL_FLAG_IS_RESUME (1 << 3) /* duk_handle_ecma_call_setup: setup for a resume() */
+#define DUK_CALL_FLAG_IS_TAILCALL (1 << 4) /* duk_handle_ecma_call_setup: setup for a tailcall */
+#define DUK_CALL_FLAG_DIRECT_EVAL (1 << 5) /* call is a direct eval call */
+
+/* Flags for duk_js_equals_helper(). */
+#define DUK_EQUALS_FLAG_SAMEVALUE (1 << 0) /* use SameValue instead of non-strict equality */
+#define DUK_EQUALS_FLAG_STRICT (1 << 1) /* use strict equality instead of non-strict equality */
+
+/* Flags for duk_js_compare_helper(). */
+#define DUK_COMPARE_FLAG_EVAL_LEFT_FIRST (1 << 0) /* eval left argument first */
+#define DUK_COMPARE_FLAG_NEGATE (1 << 1) /* negate result */
+
+/* conversions, coercions, comparison, etc */
+DUK_INTERNAL_DECL duk_bool_t duk_js_toboolean(duk_tval *tv);
+DUK_INTERNAL_DECL duk_double_t duk_js_tonumber(duk_hthread *thr, duk_tval *tv);
+DUK_INTERNAL_DECL duk_double_t duk_js_tointeger_number(duk_double_t x);
+DUK_INTERNAL_DECL duk_double_t duk_js_tointeger(duk_hthread *thr, duk_tval *tv);
+DUK_INTERNAL_DECL duk_uint32_t duk_js_touint32(duk_hthread *thr, duk_tval *tv);
+DUK_INTERNAL_DECL duk_int32_t duk_js_toint32(duk_hthread *thr, duk_tval *tv);
+DUK_INTERNAL_DECL duk_uint16_t duk_js_touint16(duk_hthread *thr, duk_tval *tv);
+DUK_INTERNAL_DECL duk_small_int_t duk_js_to_arrayindex_raw_string(const duk_uint8_t *str, duk_uint32_t blen, duk_uarridx_t *out_idx);
+DUK_INTERNAL_DECL duk_uarridx_t duk_js_to_arrayindex_string_helper(duk_hstring *h);
+DUK_INTERNAL_DECL duk_bool_t duk_js_equals_helper(duk_hthread *thr, duk_tval *tv_x, duk_tval *tv_y, duk_small_int_t flags);
+DUK_INTERNAL_DECL duk_small_int_t duk_js_string_compare(duk_hstring *h1, duk_hstring *h2);
+DUK_INTERNAL_DECL duk_bool_t duk_js_compare_helper(duk_hthread *thr, duk_tval *tv_x, duk_tval *tv_y, duk_small_int_t flags);
+DUK_INTERNAL_DECL duk_bool_t duk_js_instanceof(duk_hthread *thr, duk_tval *tv_x, duk_tval *tv_y);
+DUK_INTERNAL_DECL duk_bool_t duk_js_in(duk_hthread *thr, duk_tval *tv_x, duk_tval *tv_y);
+DUK_INTERNAL_DECL duk_hstring *duk_js_typeof(duk_hthread *thr, duk_tval *tv_x);
+
+#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)
+
+/* 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)
+
+/* 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)
+
+/* E5 Sections 11.8.4, 11.8.5; x >= y --> not (x < 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*/
+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_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_int_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_hobject *func, duk_size_t regbase);
+DUK_INTERNAL_DECL duk_hobject *duk_create_activation_environment_record(duk_hthread *thr, duk_hobject *func, duk_size_t idx_bottom);
+DUK_INTERNAL_DECL
+void duk_js_push_closure(duk_hthread *thr,
+ duk_hcompiledfunction *fun_temp,
+ duk_hobject *outer_var_env,
+ duk_hobject *outer_lex_env);
+
+/* call handling */
+DUK_INTERNAL_DECL duk_int_t duk_handle_call(duk_hthread *thr, duk_idx_t num_stack_args, duk_small_uint_t call_flags);
+DUK_INTERNAL_DECL duk_int_t duk_handle_safe_call(duk_hthread *thr, duk_safe_call_function func, duk_idx_t num_stack_args, duk_idx_t num_stack_res);
+DUK_INTERNAL_DECL duk_bool_t duk_handle_ecma_call_setup(duk_hthread *thr, duk_idx_t num_stack_args, duk_small_uint_t call_flags);
+
+/* bytecode execution */
+DUK_INTERNAL_DECL void duk_js_execute_bytecode(duk_hthread *exec_thr);
+
+#endif /* DUK_JS_H_INCLUDED */
+#line 1 "duk_numconv.h"
+#ifndef DUK_NUMCONV_H_INCLUDED
+#define DUK_NUMCONV_H_INCLUDED
+
+/*
+ * Number-to-string conversion. The semantics of these is very tightly
+ * bound with the Ecmascript semantics required for call sites.
+ */
+
+/* Output a specified number of digits instead of using the shortest
+ * form. Used for toPrecision() and toFixed().
+ */
+#define DUK_N2S_FLAG_FIXED_FORMAT (1 << 0)
+
+/* Force exponential format. Used for toExponential(). */
+#define DUK_N2S_FLAG_FORCE_EXP (1 << 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 (1 << 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 (1 << 3)
+
+/*
+ * String-to-number conversion
+ */
+
+/* Maximum exponent value when parsing numbers. This is not strictly
+ * compliant as there should be no upper limit, but as we parse the
+ * exponent without a bigint, impose some limit.
+ */
+#define DUK_S2N_MAX_EXPONENT 1000000000
+
+/* Trim white space (= allow leading and trailing whitespace) */
+#define DUK_S2N_FLAG_TRIM_WHITE (1 << 0)
+
+/* Allow exponent */
+#define DUK_S2N_FLAG_ALLOW_EXP (1 << 1)
+
+/* Allow trailing garbage (e.g. treat "123foo" as "123) */
+#define DUK_S2N_FLAG_ALLOW_GARBAGE (1 << 2)
+
+/* Allow leading plus sign */
+#define DUK_S2N_FLAG_ALLOW_PLUS (1 << 3)
+
+/* Allow leading minus sign */
+#define DUK_S2N_FLAG_ALLOW_MINUS (1 << 4)
+
+/* Allow 'Infinity' */
+#define DUK_S2N_FLAG_ALLOW_INF (1 << 5)
+
+/* Allow fraction part */
+#define DUK_S2N_FLAG_ALLOW_FRAC (1 << 6)
+
+/* Allow naked fraction (e.g. ".123") */
+#define DUK_S2N_FLAG_ALLOW_NAKED_FRAC (1 << 7)
+
+/* Allow empty fraction (e.g. "123.") */
+#define DUK_S2N_FLAG_ALLOW_EMPTY_FRAC (1 << 8)
+
+/* Allow empty string to be interpreted as 0 */
+#define DUK_S2N_FLAG_ALLOW_EMPTY_AS_ZERO (1 << 9)
+
+/* Allow leading zeroes (e.g. "0123" -> "123") */
+#define DUK_S2N_FLAG_ALLOW_LEADING_ZERO (1 << 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 (1 << 11)
+
+/* Allow automatic detection of octal base, overrides radix
+ * argument and forces integer mode.
+ */
+#define DUK_S2N_FLAG_ALLOW_AUTO_OCT_INT (1 << 12)
+
+/*
+ * Prototypes
+ */
+
+DUK_INTERNAL_DECL void duk_numconv_stringify(duk_context *ctx, duk_small_int_t radix, duk_small_int_t digits, duk_small_uint_t flags);
+DUK_INTERNAL_DECL void duk_numconv_parse(duk_context *ctx, duk_small_int_t radix, duk_small_uint_t flags);
+
+#endif /* DUK_NUMCONV_H_INCLUDED */
+#line 1 "duk_bi_protos.h"
+/*
+ * Prototypes for all built-in functions.
+ */
+
+#ifndef DUK_BUILTIN_PROTOS_H_INCLUDED
+#define DUK_BUILTIN_PROTOS_H_INCLUDED
+
+/* Buffer size needed for duk_bi_date_format_timeval().
+ * Accurate value is 32 + 1 for NUL termination:
+ * >>> len('+123456-01-23T12:34:56.123+12:34')
+ * 32
+ * Include additional space to be safe.
+ */
+#define DUK_BI_DATE_ISO8601_BUFSIZE 48
+
+/* Buffer size for "short log message" which use a heap-level pre-allocated
+ * dynamic buffer to reduce memory churn.
+ */
+#define DUK_BI_LOGGER_SHORT_MSG_LIMIT 256
+
+/* Maximum length of CommonJS module identifier to resolve. Length includes
+ * both current module ID, requested (possibly relative) module ID, and a
+ * slash in between.
+ */
+#define DUK_BI_COMMONJS_MODULE_ID_LIMIT 256
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_array_constructor(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_array_constructor_is_array(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_to_string(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_concat(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_join_shared(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_pop(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_push(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_reverse(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_shift(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_slice(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_sort(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_splice(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_unshift(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_indexof_shared(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_iter_shared(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_reduce_shared(duk_context *ctx);
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_boolean_constructor(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_boolean_prototype_tostring_shared(duk_context *ctx);
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_buffer_constructor(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_buffer_prototype_tostring_shared(duk_context *ctx);
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_date_constructor(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_date_constructor_parse(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_date_constructor_utc(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_date_constructor_now(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_tostring_shared(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_value_of(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_to_json(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_get_shared(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_get_timezone_offset(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_set_shared(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_set_time(duk_context *ctx);
+/* Helpers exposed for internal use */
+DUK_INTERNAL_DECL duk_double_t duk_bi_date_get_now(duk_context *ctx);
+DUK_INTERNAL_DECL void duk_bi_date_format_timeval(duk_double_t timeval, duk_uint8_t *out_buf);
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_duktape_object_info(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_duktape_object_act(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_duktape_object_gc(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_duktape_object_fin(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_duktape_object_enc(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_duktape_object_dec(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_duktape_object_compact(duk_context *ctx);
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_error_constructor_shared(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_error_prototype_to_string(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_error_prototype_stack_getter(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_error_prototype_filename_getter(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_error_prototype_linenumber_getter(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_error_prototype_nop_setter(duk_context *ctx);
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_function_constructor(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_function_prototype(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_function_prototype_to_string(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_function_prototype_apply(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_function_prototype_call(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_function_prototype_bind(duk_context *ctx);
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_eval(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_parse_int(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_parse_float(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_is_nan(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_is_finite(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_decode_uri(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_decode_uri_component(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_encode_uri(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_encode_uri_component(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_escape(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_unescape(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_print_helper(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_require(duk_context *ctx);
+
+DUK_INTERNAL_DECL
+void duk_bi_json_parse_helper(duk_context *ctx,
+ 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_context *ctx,
+ duk_idx_t idx_value,
+ duk_idx_t idx_replacer,
+ duk_idx_t idx_space,
+ duk_small_uint_t flags);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_json_object_parse(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_json_object_stringify(duk_context *ctx);
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_math_object_onearg_shared(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_math_object_twoarg_shared(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_math_object_max(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_math_object_min(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_math_object_random(duk_context *ctx);
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_number_constructor(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_number_prototype_to_string(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_number_prototype_to_locale_string(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_number_prototype_value_of(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_number_prototype_to_fixed(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_number_prototype_to_exponential(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_number_prototype_to_precision(duk_context *ctx);
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_getprototype_shared(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_setprototype_shared(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_get_own_property_descriptor(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_create(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_define_property(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_define_properties(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_seal_freeze_shared(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_prevent_extensions(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_is_sealed_frozen_shared(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_is_extensible(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_keys_shared(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_prototype_to_string(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_prototype_to_locale_string(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_prototype_value_of(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_prototype_has_own_property(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_prototype_is_prototype_of(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_object_prototype_property_is_enumerable(duk_context *ctx);
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_pointer_constructor(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_pointer_prototype_tostring_shared(duk_context *ctx);
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_regexp_constructor(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_regexp_prototype_exec(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_regexp_prototype_test(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_regexp_prototype_to_string(duk_context *ctx);
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_string_constructor(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_string_constructor_from_char_code(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_to_string(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_char_at(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_char_code_at(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_concat(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_indexof_shared(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_locale_compare(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_match(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_replace(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_search(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_slice(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_split(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_substring(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_caseconv_shared(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_trim(duk_context *ctx);
+/* Note: present even if DUK_OPT_NO_SECTION_B given because genbuiltins.py
+ * will point to it.
+ */
+DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_substr(duk_context *ctx);
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_proxy_constructor(duk_context *ctx);
+#if 0 /* unimplemented now */
+DUK_INTERNAL_DECL duk_ret_t duk_bi_proxy_constructor_revocable(duk_context *ctx);
+#endif
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_thread_constructor(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_thread_resume(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_thread_yield(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_thread_current(duk_context *ctx);
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_logger_constructor(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_logger_prototype_fmt(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_logger_prototype_raw(duk_context *ctx);
+DUK_INTERNAL_DECL duk_ret_t duk_bi_logger_prototype_log_shared(duk_context *ctx);
+
+DUK_INTERNAL_DECL duk_ret_t duk_bi_type_error_thrower(duk_context *ctx);
+
+#endif /* DUK_BUILTIN_PROTOS_H_INCLUDED */
+#line 1 "duk_selftest.h"
+/*
+ * Selftest code
+ */
+
+#ifndef DUK_SELFTEST_H_INCLUDED
+#define DUK_SELFTEST_H_INCLUDED
+
+#if defined(DUK_USE_SELF_TESTS)
+DUK_INTERNAL_DECL void duk_selftest_run_tests(void);
+#endif
+
+#endif /* DUK_SELFTEST_H_INCLUDED */
+#line 76 "duk_internal.h"
+
+#endif /* DUK_INTERNAL_H_INCLUDED */
+#line 1 "duk_strings.c"
+/*
+ * Shared error message strings
+ *
+ * To minimize code footprint, try to share error messages inside Duktape
+ * code.
+ */
+
+/* include removed: duk_internal.h */
+
+/* Mostly API and built-in method related */
+DUK_INTERNAL const char *duk_str_internal_error = "internal error";
+DUK_INTERNAL const char *duk_str_invalid_count = "invalid count";
+DUK_INTERNAL const char *duk_str_invalid_call_args = "invalid call args";
+DUK_INTERNAL const char *duk_str_not_constructable = "not constructable";
+DUK_INTERNAL const char *duk_str_not_callable = "not callable";
+DUK_INTERNAL const char *duk_str_not_extensible = "not extensible";
+DUK_INTERNAL const char *duk_str_not_writable = "not writable";
+DUK_INTERNAL const char *duk_str_not_configurable = "not configurable";
+
+DUK_INTERNAL const char *duk_str_invalid_context = "invalid context";
+DUK_INTERNAL const char *duk_str_invalid_index = "invalid index";
+DUK_INTERNAL const char *duk_str_push_beyond_alloc_stack = "attempt to push beyond currently allocated stack";
+DUK_INTERNAL const char *duk_str_not_undefined = "not undefined";
+DUK_INTERNAL const char *duk_str_not_null = "not null";
+DUK_INTERNAL const char *duk_str_not_boolean = "not boolean";
+DUK_INTERNAL const char *duk_str_not_number = "not number";
+DUK_INTERNAL const char *duk_str_not_string = "not string";
+DUK_INTERNAL const char *duk_str_not_pointer = "not pointer";
+DUK_INTERNAL const char *duk_str_not_buffer = "not buffer";
+DUK_INTERNAL const char *duk_str_unexpected_type = "unexpected type";
+DUK_INTERNAL const char *duk_str_not_thread = "not thread";
+#if 0 /*unused*/
+DUK_INTERNAL const char *duk_str_not_compiledfunction = "not compiledfunction";
+#endif
+DUK_INTERNAL const char *duk_str_not_nativefunction = "not nativefunction";
+DUK_INTERNAL const char *duk_str_not_c_function = "not c function";
+DUK_INTERNAL const char *duk_str_defaultvalue_coerce_failed = "[[DefaultValue]] coerce failed";
+DUK_INTERNAL const char *duk_str_number_outside_range = "number outside range";
+DUK_INTERNAL const char *duk_str_not_object_coercible = "not object coercible";
+DUK_INTERNAL const char *duk_str_string_too_long = "string too long";
+DUK_INTERNAL const char *duk_str_buffer_too_long = "buffer too long";
+DUK_INTERNAL const char *duk_str_sprintf_too_long = "sprintf message too long";
+DUK_INTERNAL const char *duk_str_object_alloc_failed = "object alloc failed";
+DUK_INTERNAL const char *duk_str_thread_alloc_failed = "thread alloc failed";
+DUK_INTERNAL const char *duk_str_func_alloc_failed = "func alloc failed";
+DUK_INTERNAL const char *duk_str_buffer_alloc_failed = "buffer alloc failed";
+DUK_INTERNAL const char *duk_str_pop_too_many = "attempt to pop too many entries";
+DUK_INTERNAL const char *duk_str_buffer_not_dynamic = "buffer is not dynamic";
+DUK_INTERNAL const char *duk_str_failed_to_extend_valstack = "failed to extend valstack";
+DUK_INTERNAL const char *duk_str_base64_encode_failed = "base64 encode failed";
+DUK_INTERNAL const char *duk_str_base64_decode_failed = "base64 decode failed";
+DUK_INTERNAL const char *duk_str_hex_decode_failed = "hex decode failed";
+DUK_INTERNAL const char *duk_str_no_sourcecode = "no sourcecode";
+DUK_INTERNAL const char *duk_str_concat_result_too_long = "concat result too long";
+DUK_INTERNAL const char *duk_str_unimplemented = "unimplemented";
+DUK_INTERNAL const char *duk_str_array_length_over_2g = "array length over 2G";
+
+/* JSON */
+DUK_INTERNAL const char *duk_str_fmt_ptr = "%p";
+DUK_INTERNAL const char *duk_str_fmt_invalid_json = "invalid json (at offset %ld)";
+DUK_INTERNAL const char *duk_str_jsondec_reclimit = "json decode recursion limit";
+DUK_INTERNAL const char *duk_str_jsonenc_reclimit = "json encode recursion limit";
+DUK_INTERNAL const char *duk_str_cyclic_input = "cyclic input";
+
+/* Object property access */
+DUK_INTERNAL const char *duk_str_proxy_revoked = "proxy revoked";
+DUK_INTERNAL const char *duk_str_object_resize_failed = "object resize failed";
+DUK_INTERNAL const char *duk_str_invalid_base = "invalid base value";
+DUK_INTERNAL const char *duk_str_strict_caller_read = "attempt to read strict 'caller'";
+DUK_INTERNAL const char *duk_str_proxy_rejected = "proxy rejected";
+DUK_INTERNAL const char *duk_str_invalid_array_length = "invalid array length";
+DUK_INTERNAL const char *duk_str_array_length_write_failed = "array length write failed";
+DUK_INTERNAL const char *duk_str_array_length_not_writable = "array length non-writable";
+DUK_INTERNAL const char *duk_str_setter_undefined = "setter undefined";
+DUK_INTERNAL const char *duk_str_redefine_virt_prop = "attempt to redefine virtual property";
+DUK_INTERNAL const char *duk_str_invalid_descriptor = "invalid descriptor";
+DUK_INTERNAL const char *duk_str_property_is_virtual = "property is virtual";
+
+/* Compiler */
+DUK_INTERNAL const char *duk_str_parse_error = "parse error";
+DUK_INTERNAL const char *duk_str_duplicate_label = "duplicate label";
+DUK_INTERNAL const char *duk_str_invalid_label = "invalid label";
+DUK_INTERNAL const char *duk_str_invalid_array_literal = "invalid array literal";
+DUK_INTERNAL const char *duk_str_invalid_object_literal = "invalid object literal";
+DUK_INTERNAL const char *duk_str_invalid_var_declaration = "invalid variable declaration";
+DUK_INTERNAL const char *duk_str_cannot_delete_identifier = "cannot delete identifier";
+DUK_INTERNAL const char *duk_str_invalid_expression = "invalid expression";
+DUK_INTERNAL const char *duk_str_invalid_lvalue = "invalid lvalue";
+DUK_INTERNAL const char *duk_str_expected_identifier = "expected identifier";
+DUK_INTERNAL const char *duk_str_empty_expr_not_allowed = "empty expression not allowed";
+DUK_INTERNAL const char *duk_str_invalid_for = "invalid for statement";
+DUK_INTERNAL const char *duk_str_invalid_switch = "invalid switch statement";
+DUK_INTERNAL const char *duk_str_invalid_break_cont_label = "invalid break/continue label";
+DUK_INTERNAL const char *duk_str_invalid_return = "invalid return";
+DUK_INTERNAL const char *duk_str_invalid_try = "invalid try";
+DUK_INTERNAL const char *duk_str_invalid_throw = "invalid throw";
+DUK_INTERNAL const char *duk_str_with_in_strict_mode = "with in strict mode";
+DUK_INTERNAL const char *duk_str_func_stmt_not_allowed = "function statement not allowed";
+DUK_INTERNAL const char *duk_str_unterminated_stmt = "unterminated statement";
+DUK_INTERNAL const char *duk_str_invalid_arg_name = "invalid argument name";
+DUK_INTERNAL const char *duk_str_invalid_func_name = "invalid function name";
+DUK_INTERNAL const char *duk_str_invalid_getset_name = "invalid getter/setter name";
+DUK_INTERNAL const char *duk_str_func_name_required = "function name required";
+
+/* Executor */
+DUK_INTERNAL const char *duk_str_internal_error_exec_longjmp = "internal error in bytecode executor longjmp handler";
+
+/* Regexp */
+DUK_INTERNAL const char *duk_str_invalid_quantifier_no_atom = "quantifier without preceding atom";
+DUK_INTERNAL const char *duk_str_invalid_quantifier_values = "quantifier values invalid (qmin > qmax)";
+DUK_INTERNAL const char *duk_str_quantifier_too_many_copies = "quantifier expansion requires too many atom copies";
+DUK_INTERNAL const char *duk_str_unexpected_closing_paren = "unexpected closing parenthesis";
+DUK_INTERNAL const char *duk_str_unexpected_end_of_pattern = "unexpected end of pattern";
+DUK_INTERNAL const char *duk_str_unexpected_regexp_token = "unexpected token in regexp";
+DUK_INTERNAL const char *duk_str_invalid_regexp_flags = "invalid regexp flags";
+DUK_INTERNAL const char *duk_str_invalid_backrefs = "invalid backreference(s)";
+DUK_INTERNAL const char *duk_str_regexp_backtrack_failed = "regexp backtrack failed";
+DUK_INTERNAL const char *duk_str_regexp_advance_failed = "regexp advance failed";
+DUK_INTERNAL const char *duk_str_regexp_internal_error = "regexp internal error";
+
+/* Limits */
+DUK_INTERNAL const char *duk_str_valstack_limit = "valstack limit";
+DUK_INTERNAL const char *duk_str_callstack_limit = "callstack limit";
+DUK_INTERNAL const char *duk_str_catchstack_limit = "catchstack limit";
+DUK_INTERNAL const char *duk_str_object_property_limit = "object property limit";
+DUK_INTERNAL const char *duk_str_prototype_chain_limit = "prototype chain limit";
+DUK_INTERNAL const char *duk_str_bound_chain_limit = "function call bound chain limit";
+DUK_INTERNAL const char *duk_str_c_callstack_limit = "C call stack depth limit";
+DUK_INTERNAL const char *duk_str_compiler_recursion_limit = "compiler recursion limit";
+DUK_INTERNAL const char *duk_str_bytecode_limit = "bytecode limit";
+DUK_INTERNAL const char *duk_str_reg_limit = "register limit";
+DUK_INTERNAL const char *duk_str_temp_limit = "temp limit";
+DUK_INTERNAL const char *duk_str_const_limit = "const limit";
+DUK_INTERNAL const char *duk_str_func_limit = "function limit";
+DUK_INTERNAL const char *duk_str_regexp_compiler_recursion_limit = "regexp compiler recursion limit";
+DUK_INTERNAL const char *duk_str_regexp_executor_recursion_limit = "regexp executor recursion limit";
+DUK_INTERNAL const char *duk_str_regexp_executor_step_limit = "regexp step limit";
+
+/* Misc */
+DUK_INTERNAL const char *duk_str_anon = "anon";
+DUK_INTERNAL const char *duk_str_realloc_failed = "realloc failed";
+#line 1 "duk_debug_macros.c"
+/*
+ * Debugging macro calls.
+ */
+
+/* include removed: duk_internal.h */
+
+#ifdef DUK_USE_DEBUG
+
+/*
+ * Debugging enabled
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#define DUK__DEBUG_BUFSIZE DUK_USE_DEBUG_BUFSIZE
+DUK_LOCAL char duk__debug_buf[DUK__DEBUG_BUFSIZE];
+
+DUK_LOCAL const char *duk__get_level_string(duk_small_int_t level) {
+ switch ((int) level) {
+ case DUK_LEVEL_DEBUG:
+ return "D";
+ case DUK_LEVEL_DDEBUG:
+ return "DD";
+ case DUK_LEVEL_DDDEBUG:
+ return "DDD";
+ }
+ return "???";
+}
+
+#ifdef DUK_USE_DPRINT_COLORS
+
+/* http://en.wikipedia.org/wiki/ANSI_escape_code */
+#define DUK__TERM_REVERSE "\x1b[7m"
+#define DUK__TERM_BRIGHT "\x1b[1m"
+#define DUK__TERM_RESET "\x1b[0m"
+#define DUK__TERM_BLUE "\x1b[34m"
+#define DUK__TERM_RED "\x1b[31m"
+
+DUK_LOCAL const char *duk__get_term_1(duk_small_int_t level) {
+ DUK_UNREF(level);
+ return (const char *) DUK__TERM_RED;
+}
+
+DUK_LOCAL const char *duk__get_term_2(duk_small_int_t level) {
+ switch ((int) level) {
+ case DUK_LEVEL_DEBUG:
+ return (const char *) (DUK__TERM_RESET DUK__TERM_BRIGHT);
+ case DUK_LEVEL_DDEBUG:
+ return (const char *) (DUK__TERM_RESET);
+ case DUK_LEVEL_DDDEBUG:
+ return (const char *) (DUK__TERM_RESET DUK__TERM_BLUE);
+ }
+ return (const char *) DUK__TERM_RESET;
+}
+
+DUK_LOCAL const char *duk__get_term_3(duk_small_int_t level) {
+ DUK_UNREF(level);
+ return (const char *) DUK__TERM_RESET;
+}
+
+#else
+
+DUK_LOCAL const char *duk__get_term_1(duk_small_int_t level) {
+ DUK_UNREF(level);
+ return (const char *) "";
+}
+
+DUK_LOCAL const char *duk__get_term_2(duk_small_int_t level) {
+ DUK_UNREF(level);
+ return (const char *) "";
+}
+
+DUK_LOCAL const char *duk__get_term_3(duk_small_int_t level) {
+ DUK_UNREF(level);
+ return (const char *) "";
+}
+
+#endif /* DUK_USE_DPRINT_COLORS */
+
+#ifdef DUK_USE_VARIADIC_MACROS
+
+DUK_INTERNAL void duk_debug_log(duk_small_int_t level, const char *file, duk_int_t line, const char *func, const char *fmt, ...) {
+ va_list ap;
+
+ va_start(ap, fmt);
+
+ DUK_MEMZERO((void *) duk__debug_buf, (size_t) DUK__DEBUG_BUFSIZE);
+ duk_debug_vsnprintf(duk__debug_buf, DUK__DEBUG_BUFSIZE - 1, fmt, ap);
+
+#ifdef DUK_USE_DPRINT_RDTSC
+ DUK_FPRINTF(DUK_STDERR, "%s[%s] <%llu> %s:%ld (%s):%s %s%s\n",
+ (const char *) duk__get_term_1(level),
+ (const char *) duk__get_level_string(level),
+ (unsigned long long) duk_rdtsc(), /* match the inline asm in duk_features.h */
+ (const char *) file,
+ (long) line,
+ (const char *) func,
+ (const char *) duk__get_term_2(level),
+ (const char *) duk__debug_buf,
+ (const char *) duk__get_term_3(level));
+#else
+ DUK_FPRINTF(DUK_STDERR, "%s[%s] %s:%ld (%s):%s %s%s\n",
+ (const char *) duk__get_term_1(level),
+ (const char *) duk__get_level_string(level),
+ (const char *) file,
+ (long) line,
+ (const char *) func,
+ (const char *) duk__get_term_2(level),
+ (const char *) duk__debug_buf,
+ (const char *) duk__get_term_3(level));
+#endif
+ DUK_FFLUSH(DUK_STDERR);
+
+ va_end(ap);
+}
+
+#else /* DUK_USE_VARIADIC_MACROS */
+
+DUK_INTERNAL char duk_debug_file_stash[DUK_DEBUG_STASH_SIZE];
+DUK_INTERNAL char duk_debug_line_stash[DUK_DEBUG_STASH_SIZE];
+DUK_INTERNAL char duk_debug_func_stash[DUK_DEBUG_STASH_SIZE];
+DUK_INTERNAL duk_small_int_t duk_debug_level_stash;
+
+DUK_INTERNAL void duk_debug_log(const char *fmt, ...) {
+ va_list ap;
+ duk_small_int_t level = duk_debug_level_stash;
+
+ va_start(ap, fmt);
+
+ DUK_MEMZERO((void *) duk__debug_buf, (size_t) DUK__DEBUG_BUFSIZE);
+ duk_debug_vsnprintf(duk__debug_buf, DUK__DEBUG_BUFSIZE - 1, fmt, ap);
+
+#ifdef DUK_USE_DPRINT_RDTSC
+ DUK_FPRINTF(DUK_STDERR, "%s[%s] <%llu> %s:%s (%s):%s %s%s\n",
+ (const char *) duk__get_term_1(level),
+ (const char *) duk__get_level_string(duk_debug_level_stash),
+ (unsigned long long) duk_rdtsc(), /* match duk_features.h */
+ (const char *) duk_debug_file_stash,
+ (const char *) duk_debug_line_stash,
+ (const char *) duk_debug_func_stash,
+ (const char *) duk__get_term_2(level),
+ (const char *) duk__debug_buf,
+ (const char *) duk__get_term_3(level));
+#else
+ DUK_FPRINTF(DUK_STDERR, "%s[%s] %s:%s (%s):%s %s%s\n",
+ (const char *) duk__get_term_1(level),
+ (const char *) duk__get_level_string(duk_debug_level_stash),
+ (const char *) duk_debug_file_stash,
+ (const char *) duk_debug_line_stash,
+ (const char *) duk_debug_func_stash,
+ (const char *) duk__get_term_2(level),
+ (const char *) duk__debug_buf,
+ (const char *) duk__get_term_3(level));
+#endif
+ DUK_FFLUSH(DUK_STDERR);
+
+ va_end(ap);
+}
+
+#endif /* DUK_USE_VARIADIC_MACROS */
+
+#else /* DUK_USE_DEBUG */
+
+/*
+ * Debugging disabled
+ */
+
+#endif /* DUK_USE_DEBUG */
+#line 1 "duk_builtins.c"
+/*
+ * Automatically generated by genbuiltins.py, do not edit!
+ */
+
+/* include removed: duk_internal.h */
+
+#if defined(DUK_USE_DOUBLE_LE)
+DUK_INTERNAL const duk_uint8_t duk_strings_data[1943] = {
+55,86,227,24,145,55,102,120,144,3,63,94,228,54,100,137,186,26,20,164,137,
+186,50,11,164,109,77,215,5,61,35,106,3,25,110,8,22,158,130,38,163,8,217,
+200,158,76,156,210,117,128,153,203,210,70,46,137,187,18,27,164,187,201,209,
+130,100,55,91,70,4,145,63,66,231,44,128,105,187,41,197,13,49,122,8,196,24,
+71,75,70,138,104,115,77,215,5,36,20,201,214,209,107,79,104,209,144,168,105,
+6,207,251,209,104,209,125,212,227,66,127,235,191,239,232,180,90,52,95,69,
+247,83,141,9,255,174,255,191,162,211,80,210,253,23,221,78,52,39,254,183,
+254,254,139,72,105,126,139,238,167,26,19,255,91,255,127,69,166,129,191,69,
+247,83,141,9,255,175,255,191,162,213,26,50,23,232,190,234,113,161,63,245,
+115,119,86,227,118,83,138,26,98,9,110,48,86,22,148,160,152,22,82,70,46,137,
+44,8,180,163,32,104,98,206,32,17,7,16,88,101,100,206,42,70,36,108,205,18,
+74,140,33,196,230,60,2,152,146,33,38,230,8,36,79,182,251,65,156,151,24,200,
+33,145,162,25,80,209,24,67,0,166,68,52,174,61,73,25,33,205,25,27,84,177,
+195,234,220,1,144,105,99,135,217,16,17,17,208,72,199,179,60,93,100,146,49,
+232,162,64,76,135,19,152,244,44,136,223,98,67,4,18,33,247,217,158,36,0,209,
+190,156,13,26,201,21,111,165,67,64,180,100,145,62,250,32,45,100,33,55,214,
+1,229,223,65,19,72,187,236,206,137,35,125,120,190,201,104,105,15,190,201,
+212,136,136,125,246,160,137,27,83,239,171,37,200,218,159,125,168,34,192,61,
+27,233,93,22,1,114,78,250,28,76,130,112,200,93,245,164,188,207,190,204,17,
+49,38,109,246,160,93,8,119,185,13,153,34,96,208,165,36,85,190,206,32,17,6,
+9,129,75,67,73,214,209,129,36,80,84,44,157,104,24,65,60,69,148,192,37,59,
+179,60,93,110,207,15,39,73,24,186,39,232,232,169,129,228,18,6,120,146,20,
+68,72,157,105,241,116,221,173,58,68,159,95,23,77,211,195,201,215,20,238,
+179,122,162,98,73,35,104,194,68,19,35,134,69,146,100,235,226,231,146,51,
+192,206,9,23,175,139,175,131,8,11,89,8,206,161,181,2,208,63,160,232,193,50,
+23,246,254,187,235,190,187,247,69,241,95,18,31,160,15,214,11,235,126,192,
+95,87,246,1,251,4,253,111,80,210,161,168,158,19,245,125,67,74,134,162,120,
+71,80,210,161,168,158,12,224,164,130,153,165,56,161,166,51,104,192,146,39,
+11,156,178,1,169,163,70,66,161,164,26,101,56,161,166,65,112,57,129,164,148,
+35,49,201,13,44,93,70,140,209,3,70,230,13,238,176,216,134,141,128,184,214,
+227,20,171,115,162,50,93,227,19,164,65,17,11,40,38,6,253,145,1,48,52,128,
+146,26,64,9,210,24,3,34,250,80,140,254,200,254,148,35,63,177,215,217,11,
+207,65,188,183,27,236,126,192,133,242,220,111,178,32,252,182,253,145,60,
+182,253,143,216,7,164,59,9,41,0,196,35,64,194,21,13,125,38,84,52,100,185,
+62,163,239,254,235,234,82,176,74,125,67,70,75,165,148,92,208,180,52,138,65,
+154,232,147,162,4,136,105,58,145,17,9,50,74,100,37,200,37,205,222,51,39,47,
+78,40,105,143,34,79,184,32,34,115,18,125,193,1,19,77,222,76,156,213,205,
+222,68,157,47,78,40,105,151,55,122,147,20,189,56,161,166,116,137,63,82,98,
+47,168,181,247,4,4,87,34,79,165,162,215,220,16,17,92,137,63,82,98,103,156,
+217,157,18,36,250,199,54,103,84,137,63,82,98,31,129,50,30,68,159,70,9,145,
+114,36,253,73,136,254,117,35,36,72,147,233,221,72,201,178,36,253,73,137,
+158,67,105,50,73,82,36,250,196,54,147,36,155,34,79,212,152,165,226,9,205,
+28,149,34,79,178,32,156,209,202,82,36,253,73,137,158,66,214,137,16,78,104,
+228,249,18,125,98,22,180,72,130,115,71,35,200,147,236,208,194,68,196,159,
+102,134,19,46,105,58,226,150,68,156,140,73,250,147,19,60,133,173,18,32,156,
+209,201,230,36,250,196,45,104,145,4,230,142,77,49,39,234,76,82,241,4,230,
+142,74,49,39,217,16,78,104,228,211,18,126,164,196,207,33,180,153,36,163,18,
+125,98,27,73,146,75,49,39,234,76,71,243,169,25,32,196,159,78,234,70,73,49,
+39,234,76,67,240,48,99,18,125,24,48,163,18,126,164,196,63,2,100,57,137,62,
+140,19,34,204,73,250,147,19,60,230,204,232,49,39,214,57,179,59,140,73,250,
+147,17,125,69,175,184,32,34,179,18,125,45,22,190,224,128,137,204,73,246,
+104,97,37,55,117,110,16,22,78,205,12,39,101,56,161,166,148,221,213,184,64,
+89,58,48,76,157,148,226,134,153,147,119,102,134,19,178,156,80,211,50,110,
+232,193,50,118,83,138,26,97,181,214,31,169,49,21,224,140,136,185,187,175,
+137,4,137,33,205,108,221,210,93,238,105,27,52,1,103,155,186,84,92,131,143,
+158,233,34,104,169,52,134,149,13,68,241,31,52,134,4,209,82,105,13,42,26,
+137,224,125,104,58,212,249,136,110,170,5,208,137,243,1,125,84,11,161,13,42,
+6,83,137,39,20,50,51,119,86,225,1,100,237,30,242,71,162,4,136,185,187,180,
+123,201,30,136,18,36,102,238,173,194,2,201,213,186,196,143,68,9,17,115,119,
+86,235,18,61,16,36,68,202,129,148,226,134,152,178,122,209,51,72,128,136,
+142,120,145,235,0,136,86,2,98,59,86,225,1,100,232,156,199,130,36,80,142,8,
+244,78,25,58,9,152,71,4,122,9,176,177,115,58,35,130,61,19,134,69,196,131,
+160,137,216,160,199,153,162,65,208,68,49,80,185,146,35,96,30,114,186,61,32,
+4,114,73,204,33,73,82,71,11,88,37,62,161,163,37,250,226,157,13,25,47,215,
+20,244,108,142,130,204,210,122,208,34,18,78,140,203,37,160,68,44,142,130,
+204,241,37,73,25,16,143,164,142,55,185,228,75,144,211,9,205,16,38,116,75,
+160,140,65,132,130,38,163,8,217,200,194,2,214,72,144,40,104,200,32,45,101,
+3,222,188,81,241,115,201,25,227,168,151,72,218,48,145,0,86,70,162,93,124,
+93,55,79,15,39,92,87,28,18,235,172,222,190,46,121,35,60,30,160,93,9,215,21,
+211,119,86,225,1,100,236,167,20,52,200,155,187,41,197,13,50,196,230,202,
+113,160,166,232,142,68,152,204,73,168,141,163,9,16,5,100,96,156,210,160,
+212,136,2,178,34,209,68,192,21,144,181,2,232,66,40,152,147,17,46,146,243,
+35,100,128,172,136,68,186,88,187,36,106,17,46,200,128,89,7,23,196,149,35,
+103,210,94,100,108,144,230,200,197,137,9,146,18,68,2,224,50,21,13,39,95,23,
+60,145,154,9,39,12,133,67,73,215,197,207,36,103,131,10,36,4,201,51,18,125,
+117,155,215,197,207,36,103,142,180,12,36,176,98,79,174,179,122,248,185,228,
+140,241,209,146,66,138,31,55,69,198,36,250,248,186,110,158,30,78,184,169,
+124,93,55,79,15,33,150,70,154,103,40,22,72,204,175,138,27,52,81,164,144,
+128,242,24,146,16,30,73,17,162,112,201,234,69,2,243,152,247,52,141,154,72,
+209,56,100,245,34,137,12,130,112,201,234,69,2,243,152,247,52,141,154,70,65,
+56,100,245,34,132,34,93,42,26,137,144,168,151,90,14,181,79,4,100,78,149,
+110,4,208,240,70,68,234,27,50,18,160,90,61,72,160,158,140,93,20,246,120,
+121,58,72,197,209,95,101,134,204,23,233,35,23,69,221,137,10,72,145,162,39,
+73,24,186,42,236,64,211,19,164,140,93,20,244,149,2,250,72,197,209,40,98,64,
+40,130,4,136,81,2,98,58,4,230,205,13,161,16,50,6,134,49,34,113,144,160,162,
+230,97,145,100,153,4,55,16,139,145,14,84,52,11,94,6,87,69,5,163,69,52,57,
+162,65,68,134,169,13,148,192,209,17,197,27,73,99,68,147,164,90,105,89,19,
+17,201,51,162,69,153,226,235,14,113,193,167,135,145,197,29,65,18,85,200,25,
+108,116,44,132,178,38,114,137,96,148,138,39,54,83,33,27,70,24,151,123,163,
+51,146,243,35,71,35,33,143,116,102,89,81,228,137,27,69,172,147,141,8,82,
+129,114,34,144,199,172,140,35,103,36,161,179,36,74,1,16,107,36,206,240,9,
+64,49,14,248,162,160,153,18,248,186,100,20,200,51,62,129,90,4,105,76,19,64,
+139,132,17,99,
+};
+
+/* to convert a heap stridx to a token number, subtract
+ * DUK_STRIDX_START_RESERVED and add DUK_TOK_START_RESERVED.
+ */
+
+/* native functions: 128 */
+DUK_INTERNAL const duk_c_function duk_bi_native_functions[128] = {
+ duk_bi_array_constructor,
+ duk_bi_array_constructor_is_array,
+ duk_bi_array_prototype_concat,
+ duk_bi_array_prototype_indexof_shared,
+ duk_bi_array_prototype_iter_shared,
+ duk_bi_array_prototype_join_shared,
+ duk_bi_array_prototype_pop,
+ duk_bi_array_prototype_push,
+ duk_bi_array_prototype_reduce_shared,
+ duk_bi_array_prototype_reverse,
+ duk_bi_array_prototype_shift,
+ duk_bi_array_prototype_slice,
+ duk_bi_array_prototype_sort,
+ duk_bi_array_prototype_splice,
+ duk_bi_array_prototype_to_string,
+ duk_bi_array_prototype_unshift,
+ duk_bi_boolean_constructor,
+ duk_bi_boolean_prototype_tostring_shared,
+ duk_bi_buffer_constructor,
+ duk_bi_buffer_prototype_tostring_shared,
+ duk_bi_date_constructor,
+ duk_bi_date_constructor_now,
+ duk_bi_date_constructor_parse,
+ duk_bi_date_constructor_utc,
+ duk_bi_date_prototype_get_shared,
+ duk_bi_date_prototype_get_timezone_offset,
+ duk_bi_date_prototype_set_shared,
+ duk_bi_date_prototype_set_time,
+ duk_bi_date_prototype_to_json,
+ duk_bi_date_prototype_tostring_shared,
+ duk_bi_date_prototype_value_of,
+ duk_bi_duktape_object_act,
+ duk_bi_duktape_object_compact,
+ duk_bi_duktape_object_dec,
+ duk_bi_duktape_object_enc,
+ duk_bi_duktape_object_fin,
+ duk_bi_duktape_object_gc,
+ duk_bi_duktape_object_info,
+ duk_bi_error_constructor_shared,
+ duk_bi_error_prototype_filename_getter,
+ duk_bi_error_prototype_linenumber_getter,
+ duk_bi_error_prototype_nop_setter,
+ duk_bi_error_prototype_stack_getter,
+ duk_bi_error_prototype_to_string,
+ duk_bi_function_constructor,
+ duk_bi_function_prototype,
+ duk_bi_function_prototype_apply,
+ duk_bi_function_prototype_bind,
+ duk_bi_function_prototype_call,
+ duk_bi_function_prototype_to_string,
+ duk_bi_global_object_decode_uri,
+ duk_bi_global_object_decode_uri_component,
+ duk_bi_global_object_encode_uri,
+ duk_bi_global_object_encode_uri_component,
+ duk_bi_global_object_escape,
+ duk_bi_global_object_eval,
+ duk_bi_global_object_is_finite,
+ duk_bi_global_object_is_nan,
+ duk_bi_global_object_parse_float,
+ duk_bi_global_object_parse_int,
+ duk_bi_global_object_print_helper,
+ duk_bi_global_object_require,
+ duk_bi_global_object_unescape,
+ duk_bi_json_object_parse,
+ duk_bi_json_object_stringify,
+ duk_bi_logger_constructor,
+ duk_bi_logger_prototype_fmt,
+ duk_bi_logger_prototype_log_shared,
+ duk_bi_logger_prototype_raw,
+ duk_bi_math_object_max,
+ duk_bi_math_object_min,
+ duk_bi_math_object_onearg_shared,
+ duk_bi_math_object_random,
+ duk_bi_math_object_twoarg_shared,
+ duk_bi_number_constructor,
+ duk_bi_number_prototype_to_exponential,
+ duk_bi_number_prototype_to_fixed,
+ duk_bi_number_prototype_to_locale_string,
+ duk_bi_number_prototype_to_precision,
+ duk_bi_number_prototype_to_string,
+ duk_bi_number_prototype_value_of,
+ duk_bi_object_constructor,
+ duk_bi_object_constructor_create,
+ duk_bi_object_constructor_define_properties,
+ duk_bi_object_constructor_define_property,
+ duk_bi_object_constructor_get_own_property_descriptor,
+ duk_bi_object_constructor_is_extensible,
+ duk_bi_object_constructor_is_sealed_frozen_shared,
+ duk_bi_object_constructor_keys_shared,
+ duk_bi_object_constructor_prevent_extensions,
+ duk_bi_object_constructor_seal_freeze_shared,
+ duk_bi_object_getprototype_shared,
+ duk_bi_object_prototype_has_own_property,
+ duk_bi_object_prototype_is_prototype_of,
+ duk_bi_object_prototype_property_is_enumerable,
+ duk_bi_object_prototype_to_locale_string,
+ duk_bi_object_prototype_to_string,
+ duk_bi_object_prototype_value_of,
+ duk_bi_object_setprototype_shared,
+ duk_bi_pointer_constructor,
+ duk_bi_pointer_prototype_tostring_shared,
+ duk_bi_proxy_constructor,
+ duk_bi_regexp_constructor,
+ duk_bi_regexp_prototype_exec,
+ duk_bi_regexp_prototype_test,
+ duk_bi_regexp_prototype_to_string,
+ duk_bi_string_constructor,
+ duk_bi_string_constructor_from_char_code,
+ duk_bi_string_prototype_caseconv_shared,
+ duk_bi_string_prototype_char_at,
+ duk_bi_string_prototype_char_code_at,
+ duk_bi_string_prototype_concat,
+ duk_bi_string_prototype_indexof_shared,
+ duk_bi_string_prototype_locale_compare,
+ duk_bi_string_prototype_match,
+ duk_bi_string_prototype_replace,
+ duk_bi_string_prototype_search,
+ duk_bi_string_prototype_slice,
+ duk_bi_string_prototype_split,
+ duk_bi_string_prototype_substr,
+ duk_bi_string_prototype_substring,
+ duk_bi_string_prototype_to_string,
+ duk_bi_string_prototype_trim,
+ duk_bi_thread_constructor,
+ duk_bi_thread_current,
+ duk_bi_thread_resume,
+ duk_bi_thread_yield,
+ duk_bi_type_error_thrower,
+};
+
+DUK_INTERNAL const duk_uint8_t duk_builtins_data[1341] = {
+105,195,74,136,77,40,105,44,9,124,104,45,3,3,72,0,71,225,65,165,168,33,243,
+6,145,0,122,24,210,148,14,249,35,120,160,55,226,13,76,192,196,177,164,152,
+22,192,4,202,52,147,72,152,0,169,70,146,105,11,0,23,40,210,77,32,96,3,37,
+26,73,163,236,0,108,163,73,52,121,128,14,148,105,38,142,176,1,242,144,56,
+208,254,84,6,166,82,242,80,210,246,1,250,67,72,144,15,232,13,44,96,47,162,
+52,160,128,62,80,160,255,253,102,76,0,0,0,0,0,0,15,135,243,84,0,0,0,0,0,0,
+15,7,243,124,64,153,132,18,49,2,38,48,64,200,7,153,64,227,48,26,103,3,13,0,
+89,165,34,53,36,38,180,128,216,143,155,81,227,114,58,111,2,142,0,73,194,94,
+56,202,167,33,209,195,114,70,206,209,26,58,36,100,228,145,131,130,69,204,
+137,22,51,36,84,208,145,67,82,68,205,137,18,62,36,68,240,122,32,120,62,0,2,
+87,61,39,255,254,9,46,24,0,10,31,224,29,13,91,40,0,9,101,137,32,0,48,197,
+84,66,214,9,10,82,68,37,81,144,133,52,65,214,137,6,90,40,0,12,21,100,144,
+69,114,64,213,202,0,3,2,86,36,5,96,160,0,63,254,16,37,135,91,98,25,242,192,
+7,194,248,30,236,32,123,46,17,234,186,71,162,241,5,23,240,0,15,241,1,70,74,
+3,8,249,49,3,204,185,15,35,3,231,137,121,240,163,254,0,46,224,18,7,248,192,
+42,249,14,3,224,20,32,0,46,208,35,231,96,41,29,96,192,117,3,159,58,66,64,
+232,10,3,156,45,14,96,194,57,67,87,156,129,231,206,48,51,240,0,23,16,25,
+255,255,251,132,16,209,192,8,106,0,2,223,4,53,0,2,111,2,26,128,1,183,65,13,
+64,1,27,129,7,224,0,45,176,131,255,255,241,73,252,0,91,77,103,193,254,64,
+36,200,64,101,31,47,32,123,188,129,178,218,70,195,113,29,173,231,206,55,3,
+71,19,129,168,0,11,93,196,141,103,34,53,92,208,212,116,35,157,213,13,55,
+100,52,158,16,209,108,3,65,176,12,246,192,128,0,179,155,2,0,2,205,122,3,49,
+221,2,151,248,0,7,249,64,147,35,4,249,17,8,0,11,220,68,2,155,248,172,184,
+31,255,255,255,255,255,253,239,236,168,0,32,0,0,0,0,0,0,12,152,0,0,0,0,0,0,
+31,15,236,120,0,0,0,0,0,0,30,15,236,136,0,0,0,0,0,0,30,31,224,7,249,128,
+147,32,0,0,0,0,0,0,0,0,12,249,79,35,225,52,143,117,0,49,147,8,197,75,35,17,
+56,130,159,248,1,176,197,136,194,23,254,96,138,128,63,206,4,153,32,0,0,0,0,
+0,3,225,254,215,200,232,24,3,161,0,1,95,142,132,0,9,240,58,16,0,53,240,232,
+64,1,23,163,161,0,5,77,142,132,0,25,52,58,16,0,116,200,225,30,227,192,94,
+15,1,118,48,16,0,133,208,192,64,2,87,35,1,0,10,92,12,4,0,45,110,48,16,0,
+197,176,192,64,3,86,163,1,0,14,90,12,4,0,61,102,48,16,1,5,144,192,64,4,86,
+35,1,0,18,88,12,4,0,77,94,48,16,1,69,112,192,64,5,85,163,1,0,22,86,12,4,0,
+93,86,50,5,80,217,21,35,69,0,24,84,13,20,0,101,78,52,190,0,52,166,26,95,0,
+27,82,141,63,128,14,41,6,159,192,7,84,99,83,224,3,202,33,169,240,1,245,8,
+209,64,8,20,3,69,0,33,79,141,47,128,17,39,134,151,192,8,211,163,79,224,4,
+137,193,167,240,2,84,192,192,64,9,146,227,69,0,39,21,31,192,0,63,208,24,
+147,4,12,0,32,41,56,72,240,60,100,148,100,140,100,132,128,0,0,0,0,0,0,0,0,
+210,172,228,74,52,17,242,210,1,83,252,0,3,253,33,81,132,11,69,144,24,166,
+229,69,37,23,39,41,40,57,65,72,47,146,176,10,175,224,0,159,234,4,140,41,18,
+44,128,192,10,191,224,0,159,235,4,140,41,10,44,128,192,10,207,224,0,159,
+236,4,140,41,2,44,128,192,10,223,224,0,159,237,4,140,40,250,44,128,192,10,
+239,224,0,159,238,4,140,40,242,44,128,192,10,255,224,0,159,239,4,140,40,
+234,44,128,192,7,255,228,34,160,52,171,138,69,133,95,130,160,34,96,11,42,
+218,221,216,181,129,32,34,32,119,156,253,127,33,23,115,31,161,224,127,65,
+21,178,163,138,251,159,161,160,7,114,147,10,189,229,237,159,161,96,12,22,
+162,42,125,144,132,160,33,32,102,157,191,179,79,80,115,31,160,224,102,157,
+191,179,79,80,123,31,164,130,71,34,5,28,160,0,40,4,114,128,1,31,209,202,0,
+6,126,73,65,245,28,160,0,135,196,114,128,2,158,209,202,0,12,122,71,40,0,57,
+229,28,160,1,7,132,85,227,186,50,241,217,37,32,0,39,84,128,29,17,202,0,18,
+115,71,40,0,81,201,28,160,1,103,20,114,128,6,7,255,224,4,195,63,65,193,1,
+130,255,248,0,11,255,224,0,31,255,138,52,128,0,0,0,0,1,219,134,128,3,57,
+192,71,72,4,229,0,29,99,140,201,72,50,31,32,196,144,131,2,49,225,121,16,
+240,184,132,120,82,64,65,102,252,0,233,239,200,20,62,176,78,248,0,255,148,
+0,5,163,240,0,15,249,192,9,242,38,16,0,23,184,152,5,171,240,0,15,250,64,9,
+242,200,16,0,23,187,32,5,179,240,0,15,250,194,15,72,0,0,0,0,0,0,0,64,15,
+201,4,195,187,126,226,4,200,68,18,162,16,72,134,60,35,67,31,0,1,25,161,143,
+128,1,8,144,199,192,0,196,40,99,224,0,130,4,49,240,0,84,255,252,36,100,16,
+184,155,250,226,217,150,47,46,91,249,34,224,139,229,229,203,127,36,26,119,
+32,203,203,150,254,72,52,97,221,147,102,157,217,192,
+};
+#ifdef DUK_USE_BUILTIN_INITJS
+DUK_INTERNAL const duk_uint8_t duk_initjs_data[187] = {
+40,102,117,110,99,116,105,111,110,40,100,44,97,41,123,102,117,110,99,116,
+105,111,110,32,98,40,97,44,98,44,99,41,123,79,98,106,101,99,116,46,100,101,
+102,105,110,101,80,114,111,112,101,114,116,121,40,97,44,98,44,123,118,97,
+108,117,101,58,99,44,119,114,105,116,97,98,108,101,58,33,48,44,101,110,117,
+109,101,114,97,98,108,101,58,33,49,44,99,111,110,102,105,103,117,114,97,98,
+108,101,58,33,48,125,41,125,98,40,97,46,76,111,103,103,101,114,44,34,99,
+108,111,103,34,44,110,101,119,32,97,46,76,111,103,103,101,114,40,34,67,34,
+41,41,59,98,40,97,44,34,109,111,100,76,111,97,100,101,100,34,44,123,125,41,
+125,41,40,116,104,105,115,44,68,117,107,116,97,112,101,41,59,10,0,
+};
+#endif /* DUK_USE_BUILTIN_INITJS */
+#elif defined(DUK_USE_DOUBLE_BE)
+DUK_INTERNAL const duk_uint8_t duk_strings_data[1943] = {
+55,86,227,24,145,55,102,120,144,3,63,94,228,54,100,137,186,26,20,164,137,
+186,50,11,164,109,77,215,5,61,35,106,3,25,110,8,22,158,130,38,163,8,217,
+200,158,76,156,210,117,128,153,203,210,70,46,137,187,18,27,164,187,201,209,
+130,100,55,91,70,4,145,63,66,231,44,128,105,187,41,197,13,49,122,8,196,24,
+71,75,70,138,104,115,77,215,5,36,20,201,214,209,107,79,104,209,144,168,105,
+6,207,251,209,104,209,125,212,227,66,127,235,191,239,232,180,90,52,95,69,
+247,83,141,9,255,174,255,191,162,211,80,210,253,23,221,78,52,39,254,183,
+254,254,139,72,105,126,139,238,167,26,19,255,91,255,127,69,166,129,191,69,
+247,83,141,9,255,175,255,191,162,213,26,50,23,232,190,234,113,161,63,245,
+115,119,86,227,118,83,138,26,98,9,110,48,86,22,148,160,152,22,82,70,46,137,
+44,8,180,163,32,104,98,206,32,17,7,16,88,101,100,206,42,70,36,108,205,18,
+74,140,33,196,230,60,2,152,146,33,38,230,8,36,79,182,251,65,156,151,24,200,
+33,145,162,25,80,209,24,67,0,166,68,52,174,61,73,25,33,205,25,27,84,177,
+195,234,220,1,144,105,99,135,217,16,17,17,208,72,199,179,60,93,100,146,49,
+232,162,64,76,135,19,152,244,44,136,223,98,67,4,18,33,247,217,158,36,0,209,
+190,156,13,26,201,21,111,165,67,64,180,100,145,62,250,32,45,100,33,55,214,
+1,229,223,65,19,72,187,236,206,137,35,125,120,190,201,104,105,15,190,201,
+212,136,136,125,246,160,137,27,83,239,171,37,200,218,159,125,168,34,192,61,
+27,233,93,22,1,114,78,250,28,76,130,112,200,93,245,164,188,207,190,204,17,
+49,38,109,246,160,93,8,119,185,13,153,34,96,208,165,36,85,190,206,32,17,6,
+9,129,75,67,73,214,209,129,36,80,84,44,157,104,24,65,60,69,148,192,37,59,
+179,60,93,110,207,15,39,73,24,186,39,232,232,169,129,228,18,6,120,146,20,
+68,72,157,105,241,116,221,173,58,68,159,95,23,77,211,195,201,215,20,238,
+179,122,162,98,73,35,104,194,68,19,35,134,69,146,100,235,226,231,146,51,
+192,206,9,23,175,139,175,131,8,11,89,8,206,161,181,2,208,63,160,232,193,50,
+23,246,254,187,235,190,187,247,69,241,95,18,31,160,15,214,11,235,126,192,
+95,87,246,1,251,4,253,111,80,210,161,168,158,19,245,125,67,74,134,162,120,
+71,80,210,161,168,158,12,224,164,130,153,165,56,161,166,51,104,192,146,39,
+11,156,178,1,169,163,70,66,161,164,26,101,56,161,166,65,112,57,129,164,148,
+35,49,201,13,44,93,70,140,209,3,70,230,13,238,176,216,134,141,128,184,214,
+227,20,171,115,162,50,93,227,19,164,65,17,11,40,38,6,253,145,1,48,52,128,
+146,26,64,9,210,24,3,34,250,80,140,254,200,254,148,35,63,177,215,217,11,
+207,65,188,183,27,236,126,192,133,242,220,111,178,32,252,182,253,145,60,
+182,253,143,216,7,164,59,9,41,0,196,35,64,194,21,13,125,38,84,52,100,185,
+62,163,239,254,235,234,82,176,74,125,67,70,75,165,148,92,208,180,52,138,65,
+154,232,147,162,4,136,105,58,145,17,9,50,74,100,37,200,37,205,222,51,39,47,
+78,40,105,143,34,79,184,32,34,115,18,125,193,1,19,77,222,76,156,213,205,
+222,68,157,47,78,40,105,151,55,122,147,20,189,56,161,166,116,137,63,82,98,
+47,168,181,247,4,4,87,34,79,165,162,215,220,16,17,92,137,63,82,98,103,156,
+217,157,18,36,250,199,54,103,84,137,63,82,98,31,129,50,30,68,159,70,9,145,
+114,36,253,73,136,254,117,35,36,72,147,233,221,72,201,178,36,253,73,137,
+158,67,105,50,73,82,36,250,196,54,147,36,155,34,79,212,152,165,226,9,205,
+28,149,34,79,178,32,156,209,202,82,36,253,73,137,158,66,214,137,16,78,104,
+228,249,18,125,98,22,180,72,130,115,71,35,200,147,236,208,194,68,196,159,
+102,134,19,46,105,58,226,150,68,156,140,73,250,147,19,60,133,173,18,32,156,
+209,201,230,36,250,196,45,104,145,4,230,142,77,49,39,234,76,82,241,4,230,
+142,74,49,39,217,16,78,104,228,211,18,126,164,196,207,33,180,153,36,163,18,
+125,98,27,73,146,75,49,39,234,76,71,243,169,25,32,196,159,78,234,70,73,49,
+39,234,76,67,240,48,99,18,125,24,48,163,18,126,164,196,63,2,100,57,137,62,
+140,19,34,204,73,250,147,19,60,230,204,232,49,39,214,57,179,59,140,73,250,
+147,17,125,69,175,184,32,34,179,18,125,45,22,190,224,128,137,204,73,246,
+104,97,37,55,117,110,16,22,78,205,12,39,101,56,161,166,148,221,213,184,64,
+89,58,48,76,157,148,226,134,153,147,119,102,134,19,178,156,80,211,50,110,
+232,193,50,118,83,138,26,97,181,214,31,169,49,21,224,140,136,185,187,175,
+137,4,137,33,205,108,221,210,93,238,105,27,52,1,103,155,186,84,92,131,143,
+158,233,34,104,169,52,134,149,13,68,241,31,52,134,4,209,82,105,13,42,26,
+137,224,125,104,58,212,249,136,110,170,5,208,137,243,1,125,84,11,161,13,42,
+6,83,137,39,20,50,51,119,86,225,1,100,237,30,242,71,162,4,136,185,187,180,
+123,201,30,136,18,36,102,238,173,194,2,201,213,186,196,143,68,9,17,115,119,
+86,235,18,61,16,36,68,202,129,148,226,134,152,178,122,209,51,72,128,136,
+142,120,145,235,0,136,86,2,98,59,86,225,1,100,232,156,199,130,36,80,142,8,
+244,78,25,58,9,152,71,4,122,9,176,177,115,58,35,130,61,19,134,69,196,131,
+160,137,216,160,199,153,162,65,208,68,49,80,185,146,35,96,30,114,186,61,32,
+4,114,73,204,33,73,82,71,11,88,37,62,161,163,37,250,226,157,13,25,47,215,
+20,244,108,142,130,204,210,122,208,34,18,78,140,203,37,160,68,44,142,130,
+204,241,37,73,25,16,143,164,142,55,185,228,75,144,211,9,205,16,38,116,75,
+160,140,65,132,130,38,163,8,217,200,194,2,214,72,144,40,104,200,32,45,101,
+3,222,188,81,241,115,201,25,227,168,151,72,218,48,145,0,86,70,162,93,124,
+93,55,79,15,39,92,87,28,18,235,172,222,190,46,121,35,60,30,160,93,9,215,21,
+211,119,86,225,1,100,236,167,20,52,200,155,187,41,197,13,50,196,230,202,
+113,160,166,232,142,68,152,204,73,168,141,163,9,16,5,100,96,156,210,160,
+212,136,2,178,34,209,68,192,21,144,181,2,232,66,40,152,147,17,46,146,243,
+35,100,128,172,136,68,186,88,187,36,106,17,46,200,128,89,7,23,196,149,35,
+103,210,94,100,108,144,230,200,197,137,9,146,18,68,2,224,50,21,13,39,95,23,
+60,145,154,9,39,12,133,67,73,215,197,207,36,103,131,10,36,4,201,51,18,125,
+117,155,215,197,207,36,103,142,180,12,36,176,98,79,174,179,122,248,185,228,
+140,241,209,146,66,138,31,55,69,198,36,250,248,186,110,158,30,78,184,169,
+124,93,55,79,15,33,150,70,154,103,40,22,72,204,175,138,27,52,81,164,144,
+128,242,24,146,16,30,73,17,162,112,201,234,69,2,243,152,247,52,141,154,72,
+209,56,100,245,34,137,12,130,112,201,234,69,2,243,152,247,52,141,154,70,65,
+56,100,245,34,132,34,93,42,26,137,144,168,151,90,14,181,79,4,100,78,149,
+110,4,208,240,70,68,234,27,50,18,160,90,61,72,160,158,140,93,20,246,120,
+121,58,72,197,209,95,101,134,204,23,233,35,23,69,221,137,10,72,145,162,39,
+73,24,186,42,236,64,211,19,164,140,93,20,244,149,2,250,72,197,209,40,98,64,
+40,130,4,136,81,2,98,58,4,230,205,13,161,16,50,6,134,49,34,113,144,160,162,
+230,97,145,100,153,4,55,16,139,145,14,84,52,11,94,6,87,69,5,163,69,52,57,
+162,65,68,134,169,13,148,192,209,17,197,27,73,99,68,147,164,90,105,89,19,
+17,201,51,162,69,153,226,235,14,113,193,167,135,145,197,29,65,18,85,200,25,
+108,116,44,132,178,38,114,137,96,148,138,39,54,83,33,27,70,24,151,123,163,
+51,146,243,35,71,35,33,143,116,102,89,81,228,137,27,69,172,147,141,8,82,
+129,114,34,144,199,172,140,35,103,36,161,179,36,74,1,16,107,36,206,240,9,
+64,49,14,248,162,160,153,18,248,186,100,20,200,51,62,129,90,4,105,76,19,64,
+139,132,17,99,
+};
+
+/* to convert a heap stridx to a token number, subtract
+ * DUK_STRIDX_START_RESERVED and add DUK_TOK_START_RESERVED.
+ */
+
+/* native functions: 128 */
+DUK_INTERNAL const duk_c_function duk_bi_native_functions[128] = {
+ duk_bi_array_constructor,
+ duk_bi_array_constructor_is_array,
+ duk_bi_array_prototype_concat,
+ duk_bi_array_prototype_indexof_shared,
+ duk_bi_array_prototype_iter_shared,
+ duk_bi_array_prototype_join_shared,
+ duk_bi_array_prototype_pop,
+ duk_bi_array_prototype_push,
+ duk_bi_array_prototype_reduce_shared,
+ duk_bi_array_prototype_reverse,
+ duk_bi_array_prototype_shift,
+ duk_bi_array_prototype_slice,
+ duk_bi_array_prototype_sort,
+ duk_bi_array_prototype_splice,
+ duk_bi_array_prototype_to_string,
+ duk_bi_array_prototype_unshift,
+ duk_bi_boolean_constructor,
+ duk_bi_boolean_prototype_tostring_shared,
+ duk_bi_buffer_constructor,
+ duk_bi_buffer_prototype_tostring_shared,
+ duk_bi_date_constructor,
+ duk_bi_date_constructor_now,
+ duk_bi_date_constructor_parse,
+ duk_bi_date_constructor_utc,
+ duk_bi_date_prototype_get_shared,
+ duk_bi_date_prototype_get_timezone_offset,
+ duk_bi_date_prototype_set_shared,
+ duk_bi_date_prototype_set_time,
+ duk_bi_date_prototype_to_json,
+ duk_bi_date_prototype_tostring_shared,
+ duk_bi_date_prototype_value_of,
+ duk_bi_duktape_object_act,
+ duk_bi_duktape_object_compact,
+ duk_bi_duktape_object_dec,
+ duk_bi_duktape_object_enc,
+ duk_bi_duktape_object_fin,
+ duk_bi_duktape_object_gc,
+ duk_bi_duktape_object_info,
+ duk_bi_error_constructor_shared,
+ duk_bi_error_prototype_filename_getter,
+ duk_bi_error_prototype_linenumber_getter,
+ duk_bi_error_prototype_nop_setter,
+ duk_bi_error_prototype_stack_getter,
+ duk_bi_error_prototype_to_string,
+ duk_bi_function_constructor,
+ duk_bi_function_prototype,
+ duk_bi_function_prototype_apply,
+ duk_bi_function_prototype_bind,
+ duk_bi_function_prototype_call,
+ duk_bi_function_prototype_to_string,
+ duk_bi_global_object_decode_uri,
+ duk_bi_global_object_decode_uri_component,
+ duk_bi_global_object_encode_uri,
+ duk_bi_global_object_encode_uri_component,
+ duk_bi_global_object_escape,
+ duk_bi_global_object_eval,
+ duk_bi_global_object_is_finite,
+ duk_bi_global_object_is_nan,
+ duk_bi_global_object_parse_float,
+ duk_bi_global_object_parse_int,
+ duk_bi_global_object_print_helper,
+ duk_bi_global_object_require,
+ duk_bi_global_object_unescape,
+ duk_bi_json_object_parse,
+ duk_bi_json_object_stringify,
+ duk_bi_logger_constructor,
+ duk_bi_logger_prototype_fmt,
+ duk_bi_logger_prototype_log_shared,
+ duk_bi_logger_prototype_raw,
+ duk_bi_math_object_max,
+ duk_bi_math_object_min,
+ duk_bi_math_object_onearg_shared,
+ duk_bi_math_object_random,
+ duk_bi_math_object_twoarg_shared,
+ duk_bi_number_constructor,
+ duk_bi_number_prototype_to_exponential,
+ duk_bi_number_prototype_to_fixed,
+ duk_bi_number_prototype_to_locale_string,
+ duk_bi_number_prototype_to_precision,
+ duk_bi_number_prototype_to_string,
+ duk_bi_number_prototype_value_of,
+ duk_bi_object_constructor,
+ duk_bi_object_constructor_create,
+ duk_bi_object_constructor_define_properties,
+ duk_bi_object_constructor_define_property,
+ duk_bi_object_constructor_get_own_property_descriptor,
+ duk_bi_object_constructor_is_extensible,
+ duk_bi_object_constructor_is_sealed_frozen_shared,
+ duk_bi_object_constructor_keys_shared,
+ duk_bi_object_constructor_prevent_extensions,
+ duk_bi_object_constructor_seal_freeze_shared,
+ duk_bi_object_getprototype_shared,
+ duk_bi_object_prototype_has_own_property,
+ duk_bi_object_prototype_is_prototype_of,
+ duk_bi_object_prototype_property_is_enumerable,
+ duk_bi_object_prototype_to_locale_string,
+ duk_bi_object_prototype_to_string,
+ duk_bi_object_prototype_value_of,
+ duk_bi_object_setprototype_shared,
+ duk_bi_pointer_constructor,
+ duk_bi_pointer_prototype_tostring_shared,
+ duk_bi_proxy_constructor,
+ duk_bi_regexp_constructor,
+ duk_bi_regexp_prototype_exec,
+ duk_bi_regexp_prototype_test,
+ duk_bi_regexp_prototype_to_string,
+ duk_bi_string_constructor,
+ duk_bi_string_constructor_from_char_code,
+ duk_bi_string_prototype_caseconv_shared,
+ duk_bi_string_prototype_char_at,
+ duk_bi_string_prototype_char_code_at,
+ duk_bi_string_prototype_concat,
+ duk_bi_string_prototype_indexof_shared,
+ duk_bi_string_prototype_locale_compare,
+ duk_bi_string_prototype_match,
+ duk_bi_string_prototype_replace,
+ duk_bi_string_prototype_search,
+ duk_bi_string_prototype_slice,
+ duk_bi_string_prototype_split,
+ duk_bi_string_prototype_substr,
+ duk_bi_string_prototype_substring,
+ duk_bi_string_prototype_to_string,
+ duk_bi_string_prototype_trim,
+ duk_bi_thread_constructor,
+ duk_bi_thread_current,
+ duk_bi_thread_resume,
+ duk_bi_thread_yield,
+ duk_bi_type_error_thrower,
+};
+
+DUK_INTERNAL const duk_uint8_t duk_builtins_data[1341] = {
+105,195,74,136,77,40,105,44,9,124,104,45,3,3,72,0,71,225,65,165,168,33,243,
+6,145,0,122,24,210,148,14,249,35,120,160,55,226,13,76,192,196,177,164,152,
+22,192,4,202,52,147,72,152,0,169,70,146,105,11,0,23,40,210,77,32,96,3,37,
+26,73,163,236,0,108,163,73,52,121,128,14,148,105,38,142,176,1,242,144,56,
+208,254,84,6,166,82,242,80,210,246,1,250,67,72,144,15,232,13,44,96,47,162,
+52,160,128,62,80,160,255,253,102,76,7,255,128,0,0,0,0,0,3,84,7,255,0,0,0,0,
+0,0,3,124,64,153,132,18,49,2,38,48,64,200,7,153,64,227,48,26,103,3,13,0,89,
+165,34,53,36,38,180,128,216,143,155,81,227,114,58,111,2,142,0,73,194,94,56,
+202,167,33,209,195,114,70,206,209,26,58,36,100,228,145,131,130,69,204,137,
+22,51,36,84,208,145,67,82,68,205,137,18,62,36,68,240,122,32,120,62,0,2,87,
+61,39,255,254,9,46,24,0,10,31,224,29,13,91,40,0,9,101,137,32,0,48,197,84,
+66,214,9,10,82,68,37,81,144,133,52,65,214,137,6,90,40,0,12,21,100,144,69,
+114,64,213,202,0,3,2,86,36,5,96,160,0,63,254,16,37,135,91,98,25,242,192,7,
+194,248,30,236,32,123,46,17,234,186,71,162,241,5,23,240,0,15,241,1,70,74,3,
+8,249,49,3,204,185,15,35,3,231,137,121,240,163,254,0,46,224,18,7,248,192,
+42,249,14,3,224,20,32,0,46,208,35,231,96,41,29,96,192,117,3,159,58,66,64,
+232,10,3,156,45,14,96,194,57,67,87,156,129,231,206,48,51,240,0,23,16,25,
+255,255,251,132,16,209,192,8,106,0,2,223,4,53,0,2,111,2,26,128,1,183,65,13,
+64,1,27,129,7,224,0,45,176,131,255,255,241,73,252,0,91,77,103,193,254,64,
+36,200,64,101,31,47,32,123,188,129,178,218,70,195,113,29,173,231,206,55,3,
+71,19,129,168,0,11,93,196,141,103,34,53,92,208,212,116,35,157,213,13,55,
+100,52,158,16,209,108,3,65,176,12,246,192,128,0,179,155,2,0,2,205,122,3,49,
+221,2,151,248,0,7,249,64,147,35,4,249,17,8,0,11,220,68,2,155,248,172,184,
+15,253,255,255,255,255,255,255,236,168,0,0,0,0,0,0,0,0,44,152,15,255,0,0,0,
+0,0,0,12,120,15,254,0,0,0,0,0,0,12,136,31,254,0,0,0,0,0,0,0,7,249,128,147,
+32,0,0,0,0,0,0,0,0,12,249,79,35,225,52,143,117,0,49,147,8,197,75,35,17,56,
+130,159,248,1,176,197,136,194,23,254,96,138,128,63,206,4,153,33,255,224,0,
+0,0,0,0,2,215,200,232,24,3,161,0,1,95,142,132,0,9,240,58,16,0,53,240,232,
+64,1,23,163,161,0,5,77,142,132,0,25,52,58,16,0,116,200,225,30,227,192,94,
+15,1,118,48,16,0,133,208,192,64,2,87,35,1,0,10,92,12,4,0,45,110,48,16,0,
+197,176,192,64,3,86,163,1,0,14,90,12,4,0,61,102,48,16,1,5,144,192,64,4,86,
+35,1,0,18,88,12,4,0,77,94,48,16,1,69,112,192,64,5,85,163,1,0,22,86,12,4,0,
+93,86,50,5,80,217,21,35,69,0,24,84,13,20,0,101,78,52,190,0,52,166,26,95,0,
+27,82,141,63,128,14,41,6,159,192,7,84,99,83,224,3,202,33,169,240,1,245,8,
+209,64,8,20,3,69,0,33,79,141,47,128,17,39,134,151,192,8,211,163,79,224,4,
+137,193,167,240,2,84,192,192,64,9,146,227,69,0,39,21,31,192,0,63,208,24,
+147,4,12,0,32,41,56,72,240,60,100,148,100,140,100,132,128,0,0,0,0,0,0,0,0,
+210,172,228,74,52,17,242,210,1,83,252,0,3,253,33,81,132,11,69,144,24,166,
+229,69,37,23,39,41,40,57,65,72,47,146,176,10,175,224,0,159,234,4,140,41,18,
+44,128,192,10,191,224,0,159,235,4,140,41,10,44,128,192,10,207,224,0,159,
+236,4,140,41,2,44,128,192,10,223,224,0,159,237,4,140,40,250,44,128,192,10,
+239,224,0,159,238,4,140,40,242,44,128,192,10,255,224,0,159,239,4,140,40,
+234,44,128,192,7,255,228,34,160,32,2,223,133,69,138,43,180,162,96,32,1,53,
+216,221,218,170,139,34,32,31,243,23,33,127,125,28,247,161,224,31,251,138,
+163,178,149,193,127,33,160,31,237,229,189,138,147,114,135,33,96,32,4,144,
+253,170,34,22,140,33,32,31,243,80,79,51,63,157,230,160,224,31,251,80,79,51,
+63,157,230,164,130,71,34,5,28,160,0,40,4,114,128,1,31,209,202,0,6,126,73,
+65,245,28,160,0,135,196,114,128,2,158,209,202,0,12,122,71,40,0,57,229,28,
+160,1,7,132,85,227,186,50,241,217,37,32,0,39,84,128,29,17,202,0,18,115,71,
+40,0,81,201,28,160,1,103,20,114,128,6,7,255,224,4,195,63,65,193,1,130,255,
+248,0,11,255,224,0,31,255,138,52,128,129,135,218,0,0,0,0,0,3,57,192,71,72,
+4,229,0,29,99,140,201,72,50,31,32,196,144,131,2,49,225,121,16,240,184,132,
+120,82,64,65,102,252,0,233,239,200,20,62,176,78,248,0,255,148,0,5,163,240,
+0,15,249,192,9,242,38,16,0,23,184,152,5,171,240,0,15,250,64,9,242,200,16,0,
+23,187,32,5,179,240,0,15,250,194,15,72,64,0,0,0,0,0,0,0,15,201,4,195,187,
+126,226,4,200,68,18,162,16,72,134,60,35,67,31,0,1,25,161,143,128,1,8,144,
+199,192,0,196,40,99,224,0,130,4,49,240,0,84,255,252,36,100,16,184,155,250,
+226,217,150,47,46,91,249,34,224,139,229,229,203,127,36,26,119,32,203,203,
+150,254,72,52,97,221,147,102,157,217,192,
+};
+#ifdef DUK_USE_BUILTIN_INITJS
+DUK_INTERNAL const duk_uint8_t duk_initjs_data[187] = {
+40,102,117,110,99,116,105,111,110,40,100,44,97,41,123,102,117,110,99,116,
+105,111,110,32,98,40,97,44,98,44,99,41,123,79,98,106,101,99,116,46,100,101,
+102,105,110,101,80,114,111,112,101,114,116,121,40,97,44,98,44,123,118,97,
+108,117,101,58,99,44,119,114,105,116,97,98,108,101,58,33,48,44,101,110,117,
+109,101,114,97,98,108,101,58,33,49,44,99,111,110,102,105,103,117,114,97,98,
+108,101,58,33,48,125,41,125,98,40,97,46,76,111,103,103,101,114,44,34,99,
+108,111,103,34,44,110,101,119,32,97,46,76,111,103,103,101,114,40,34,67,34,
+41,41,59,98,40,97,44,34,109,111,100,76,111,97,100,101,100,34,44,123,125,41,
+125,41,40,116,104,105,115,44,68,117,107,116,97,112,101,41,59,10,0,
+};
+#endif /* DUK_USE_BUILTIN_INITJS */
+#elif defined(DUK_USE_DOUBLE_ME)
+DUK_INTERNAL const duk_uint8_t duk_strings_data[1943] = {
+55,86,227,24,145,55,102,120,144,3,63,94,228,54,100,137,186,26,20,164,137,
+186,50,11,164,109,77,215,5,61,35,106,3,25,110,8,22,158,130,38,163,8,217,
+200,158,76,156,210,117,128,153,203,210,70,46,137,187,18,27,164,187,201,209,
+130,100,55,91,70,4,145,63,66,231,44,128,105,187,41,197,13,49,122,8,196,24,
+71,75,70,138,104,115,77,215,5,36,20,201,214,209,107,79,104,209,144,168,105,
+6,207,251,209,104,209,125,212,227,66,127,235,191,239,232,180,90,52,95,69,
+247,83,141,9,255,174,255,191,162,211,80,210,253,23,221,78,52,39,254,183,
+254,254,139,72,105,126,139,238,167,26,19,255,91,255,127,69,166,129,191,69,
+247,83,141,9,255,175,255,191,162,213,26,50,23,232,190,234,113,161,63,245,
+115,119,86,227,118,83,138,26,98,9,110,48,86,22,148,160,152,22,82,70,46,137,
+44,8,180,163,32,104,98,206,32,17,7,16,88,101,100,206,42,70,36,108,205,18,
+74,140,33,196,230,60,2,152,146,33,38,230,8,36,79,182,251,65,156,151,24,200,
+33,145,162,25,80,209,24,67,0,166,68,52,174,61,73,25,33,205,25,27,84,177,
+195,234,220,1,144,105,99,135,217,16,17,17,208,72,199,179,60,93,100,146,49,
+232,162,64,76,135,19,152,244,44,136,223,98,67,4,18,33,247,217,158,36,0,209,
+190,156,13,26,201,21,111,165,67,64,180,100,145,62,250,32,45,100,33,55,214,
+1,229,223,65,19,72,187,236,206,137,35,125,120,190,201,104,105,15,190,201,
+212,136,136,125,246,160,137,27,83,239,171,37,200,218,159,125,168,34,192,61,
+27,233,93,22,1,114,78,250,28,76,130,112,200,93,245,164,188,207,190,204,17,
+49,38,109,246,160,93,8,119,185,13,153,34,96,208,165,36,85,190,206,32,17,6,
+9,129,75,67,73,214,209,129,36,80,84,44,157,104,24,65,60,69,148,192,37,59,
+179,60,93,110,207,15,39,73,24,186,39,232,232,169,129,228,18,6,120,146,20,
+68,72,157,105,241,116,221,173,58,68,159,95,23,77,211,195,201,215,20,238,
+179,122,162,98,73,35,104,194,68,19,35,134,69,146,100,235,226,231,146,51,
+192,206,9,23,175,139,175,131,8,11,89,8,206,161,181,2,208,63,160,232,193,50,
+23,246,254,187,235,190,187,247,69,241,95,18,31,160,15,214,11,235,126,192,
+95,87,246,1,251,4,253,111,80,210,161,168,158,19,245,125,67,74,134,162,120,
+71,80,210,161,168,158,12,224,164,130,153,165,56,161,166,51,104,192,146,39,
+11,156,178,1,169,163,70,66,161,164,26,101,56,161,166,65,112,57,129,164,148,
+35,49,201,13,44,93,70,140,209,3,70,230,13,238,176,216,134,141,128,184,214,
+227,20,171,115,162,50,93,227,19,164,65,17,11,40,38,6,253,145,1,48,52,128,
+146,26,64,9,210,24,3,34,250,80,140,254,200,254,148,35,63,177,215,217,11,
+207,65,188,183,27,236,126,192,133,242,220,111,178,32,252,182,253,145,60,
+182,253,143,216,7,164,59,9,41,0,196,35,64,194,21,13,125,38,84,52,100,185,
+62,163,239,254,235,234,82,176,74,125,67,70,75,165,148,92,208,180,52,138,65,
+154,232,147,162,4,136,105,58,145,17,9,50,74,100,37,200,37,205,222,51,39,47,
+78,40,105,143,34,79,184,32,34,115,18,125,193,1,19,77,222,76,156,213,205,
+222,68,157,47,78,40,105,151,55,122,147,20,189,56,161,166,116,137,63,82,98,
+47,168,181,247,4,4,87,34,79,165,162,215,220,16,17,92,137,63,82,98,103,156,
+217,157,18,36,250,199,54,103,84,137,63,82,98,31,129,50,30,68,159,70,9,145,
+114,36,253,73,136,254,117,35,36,72,147,233,221,72,201,178,36,253,73,137,
+158,67,105,50,73,82,36,250,196,54,147,36,155,34,79,212,152,165,226,9,205,
+28,149,34,79,178,32,156,209,202,82,36,253,73,137,158,66,214,137,16,78,104,
+228,249,18,125,98,22,180,72,130,115,71,35,200,147,236,208,194,68,196,159,
+102,134,19,46,105,58,226,150,68,156,140,73,250,147,19,60,133,173,18,32,156,
+209,201,230,36,250,196,45,104,145,4,230,142,77,49,39,234,76,82,241,4,230,
+142,74,49,39,217,16,78,104,228,211,18,126,164,196,207,33,180,153,36,163,18,
+125,98,27,73,146,75,49,39,234,76,71,243,169,25,32,196,159,78,234,70,73,49,
+39,234,76,67,240,48,99,18,125,24,48,163,18,126,164,196,63,2,100,57,137,62,
+140,19,34,204,73,250,147,19,60,230,204,232,49,39,214,57,179,59,140,73,250,
+147,17,125,69,175,184,32,34,179,18,125,45,22,190,224,128,137,204,73,246,
+104,97,37,55,117,110,16,22,78,205,12,39,101,56,161,166,148,221,213,184,64,
+89,58,48,76,157,148,226,134,153,147,119,102,134,19,178,156,80,211,50,110,
+232,193,50,118,83,138,26,97,181,214,31,169,49,21,224,140,136,185,187,175,
+137,4,137,33,205,108,221,210,93,238,105,27,52,1,103,155,186,84,92,131,143,
+158,233,34,104,169,52,134,149,13,68,241,31,52,134,4,209,82,105,13,42,26,
+137,224,125,104,58,212,249,136,110,170,5,208,137,243,1,125,84,11,161,13,42,
+6,83,137,39,20,50,51,119,86,225,1,100,237,30,242,71,162,4,136,185,187,180,
+123,201,30,136,18,36,102,238,173,194,2,201,213,186,196,143,68,9,17,115,119,
+86,235,18,61,16,36,68,202,129,148,226,134,152,178,122,209,51,72,128,136,
+142,120,145,235,0,136,86,2,98,59,86,225,1,100,232,156,199,130,36,80,142,8,
+244,78,25,58,9,152,71,4,122,9,176,177,115,58,35,130,61,19,134,69,196,131,
+160,137,216,160,199,153,162,65,208,68,49,80,185,146,35,96,30,114,186,61,32,
+4,114,73,204,33,73,82,71,11,88,37,62,161,163,37,250,226,157,13,25,47,215,
+20,244,108,142,130,204,210,122,208,34,18,78,140,203,37,160,68,44,142,130,
+204,241,37,73,25,16,143,164,142,55,185,228,75,144,211,9,205,16,38,116,75,
+160,140,65,132,130,38,163,8,217,200,194,2,214,72,144,40,104,200,32,45,101,
+3,222,188,81,241,115,201,25,227,168,151,72,218,48,145,0,86,70,162,93,124,
+93,55,79,15,39,92,87,28,18,235,172,222,190,46,121,35,60,30,160,93,9,215,21,
+211,119,86,225,1,100,236,167,20,52,200,155,187,41,197,13,50,196,230,202,
+113,160,166,232,142,68,152,204,73,168,141,163,9,16,5,100,96,156,210,160,
+212,136,2,178,34,209,68,192,21,144,181,2,232,66,40,152,147,17,46,146,243,
+35,100,128,172,136,68,186,88,187,36,106,17,46,200,128,89,7,23,196,149,35,
+103,210,94,100,108,144,230,200,197,137,9,146,18,68,2,224,50,21,13,39,95,23,
+60,145,154,9,39,12,133,67,73,215,197,207,36,103,131,10,36,4,201,51,18,125,
+117,155,215,197,207,36,103,142,180,12,36,176,98,79,174,179,122,248,185,228,
+140,241,209,146,66,138,31,55,69,198,36,250,248,186,110,158,30,78,184,169,
+124,93,55,79,15,33,150,70,154,103,40,22,72,204,175,138,27,52,81,164,144,
+128,242,24,146,16,30,73,17,162,112,201,234,69,2,243,152,247,52,141,154,72,
+209,56,100,245,34,137,12,130,112,201,234,69,2,243,152,247,52,141,154,70,65,
+56,100,245,34,132,34,93,42,26,137,144,168,151,90,14,181,79,4,100,78,149,
+110,4,208,240,70,68,234,27,50,18,160,90,61,72,160,158,140,93,20,246,120,
+121,58,72,197,209,95,101,134,204,23,233,35,23,69,221,137,10,72,145,162,39,
+73,24,186,42,236,64,211,19,164,140,93,20,244,149,2,250,72,197,209,40,98,64,
+40,130,4,136,81,2,98,58,4,230,205,13,161,16,50,6,134,49,34,113,144,160,162,
+230,97,145,100,153,4,55,16,139,145,14,84,52,11,94,6,87,69,5,163,69,52,57,
+162,65,68,134,169,13,148,192,209,17,197,27,73,99,68,147,164,90,105,89,19,
+17,201,51,162,69,153,226,235,14,113,193,167,135,145,197,29,65,18,85,200,25,
+108,116,44,132,178,38,114,137,96,148,138,39,54,83,33,27,70,24,151,123,163,
+51,146,243,35,71,35,33,143,116,102,89,81,228,137,27,69,172,147,141,8,82,
+129,114,34,144,199,172,140,35,103,36,161,179,36,74,1,16,107,36,206,240,9,
+64,49,14,248,162,160,153,18,248,186,100,20,200,51,62,129,90,4,105,76,19,64,
+139,132,17,99,
+};
+
+/* to convert a heap stridx to a token number, subtract
+ * DUK_STRIDX_START_RESERVED and add DUK_TOK_START_RESERVED.
+ */
+
+/* native functions: 128 */
+DUK_INTERNAL const duk_c_function duk_bi_native_functions[128] = {
+ duk_bi_array_constructor,
+ duk_bi_array_constructor_is_array,
+ duk_bi_array_prototype_concat,
+ duk_bi_array_prototype_indexof_shared,
+ duk_bi_array_prototype_iter_shared,
+ duk_bi_array_prototype_join_shared,
+ duk_bi_array_prototype_pop,
+ duk_bi_array_prototype_push,
+ duk_bi_array_prototype_reduce_shared,
+ duk_bi_array_prototype_reverse,
+ duk_bi_array_prototype_shift,
+ duk_bi_array_prototype_slice,
+ duk_bi_array_prototype_sort,
+ duk_bi_array_prototype_splice,
+ duk_bi_array_prototype_to_string,
+ duk_bi_array_prototype_unshift,
+ duk_bi_boolean_constructor,
+ duk_bi_boolean_prototype_tostring_shared,
+ duk_bi_buffer_constructor,
+ duk_bi_buffer_prototype_tostring_shared,
+ duk_bi_date_constructor,
+ duk_bi_date_constructor_now,
+ duk_bi_date_constructor_parse,
+ duk_bi_date_constructor_utc,
+ duk_bi_date_prototype_get_shared,
+ duk_bi_date_prototype_get_timezone_offset,
+ duk_bi_date_prototype_set_shared,
+ duk_bi_date_prototype_set_time,
+ duk_bi_date_prototype_to_json,
+ duk_bi_date_prototype_tostring_shared,
+ duk_bi_date_prototype_value_of,
+ duk_bi_duktape_object_act,
+ duk_bi_duktape_object_compact,
+ duk_bi_duktape_object_dec,
+ duk_bi_duktape_object_enc,
+ duk_bi_duktape_object_fin,
+ duk_bi_duktape_object_gc,
+ duk_bi_duktape_object_info,
+ duk_bi_error_constructor_shared,
+ duk_bi_error_prototype_filename_getter,
+ duk_bi_error_prototype_linenumber_getter,
+ duk_bi_error_prototype_nop_setter,
+ duk_bi_error_prototype_stack_getter,
+ duk_bi_error_prototype_to_string,
+ duk_bi_function_constructor,
+ duk_bi_function_prototype,
+ duk_bi_function_prototype_apply,
+ duk_bi_function_prototype_bind,
+ duk_bi_function_prototype_call,
+ duk_bi_function_prototype_to_string,
+ duk_bi_global_object_decode_uri,
+ duk_bi_global_object_decode_uri_component,
+ duk_bi_global_object_encode_uri,
+ duk_bi_global_object_encode_uri_component,
+ duk_bi_global_object_escape,
+ duk_bi_global_object_eval,
+ duk_bi_global_object_is_finite,
+ duk_bi_global_object_is_nan,
+ duk_bi_global_object_parse_float,
+ duk_bi_global_object_parse_int,
+ duk_bi_global_object_print_helper,
+ duk_bi_global_object_require,
+ duk_bi_global_object_unescape,
+ duk_bi_json_object_parse,
+ duk_bi_json_object_stringify,
+ duk_bi_logger_constructor,
+ duk_bi_logger_prototype_fmt,
+ duk_bi_logger_prototype_log_shared,
+ duk_bi_logger_prototype_raw,
+ duk_bi_math_object_max,
+ duk_bi_math_object_min,
+ duk_bi_math_object_onearg_shared,
+ duk_bi_math_object_random,
+ duk_bi_math_object_twoarg_shared,
+ duk_bi_number_constructor,
+ duk_bi_number_prototype_to_exponential,
+ duk_bi_number_prototype_to_fixed,
+ duk_bi_number_prototype_to_locale_string,
+ duk_bi_number_prototype_to_precision,
+ duk_bi_number_prototype_to_string,
+ duk_bi_number_prototype_value_of,
+ duk_bi_object_constructor,
+ duk_bi_object_constructor_create,
+ duk_bi_object_constructor_define_properties,
+ duk_bi_object_constructor_define_property,
+ duk_bi_object_constructor_get_own_property_descriptor,
+ duk_bi_object_constructor_is_extensible,
+ duk_bi_object_constructor_is_sealed_frozen_shared,
+ duk_bi_object_constructor_keys_shared,
+ duk_bi_object_constructor_prevent_extensions,
+ duk_bi_object_constructor_seal_freeze_shared,
+ duk_bi_object_getprototype_shared,
+ duk_bi_object_prototype_has_own_property,
+ duk_bi_object_prototype_is_prototype_of,
+ duk_bi_object_prototype_property_is_enumerable,
+ duk_bi_object_prototype_to_locale_string,
+ duk_bi_object_prototype_to_string,
+ duk_bi_object_prototype_value_of,
+ duk_bi_object_setprototype_shared,
+ duk_bi_pointer_constructor,
+ duk_bi_pointer_prototype_tostring_shared,
+ duk_bi_proxy_constructor,
+ duk_bi_regexp_constructor,
+ duk_bi_regexp_prototype_exec,
+ duk_bi_regexp_prototype_test,
+ duk_bi_regexp_prototype_to_string,
+ duk_bi_string_constructor,
+ duk_bi_string_constructor_from_char_code,
+ duk_bi_string_prototype_caseconv_shared,
+ duk_bi_string_prototype_char_at,
+ duk_bi_string_prototype_char_code_at,
+ duk_bi_string_prototype_concat,
+ duk_bi_string_prototype_indexof_shared,
+ duk_bi_string_prototype_locale_compare,
+ duk_bi_string_prototype_match,
+ duk_bi_string_prototype_replace,
+ duk_bi_string_prototype_search,
+ duk_bi_string_prototype_slice,
+ duk_bi_string_prototype_split,
+ duk_bi_string_prototype_substr,
+ duk_bi_string_prototype_substring,
+ duk_bi_string_prototype_to_string,
+ duk_bi_string_prototype_trim,
+ duk_bi_thread_constructor,
+ duk_bi_thread_current,
+ duk_bi_thread_resume,
+ duk_bi_thread_yield,
+ duk_bi_type_error_thrower,
+};
+
+DUK_INTERNAL const duk_uint8_t duk_builtins_data[1341] = {
+105,195,74,136,77,40,105,44,9,124,104,45,3,3,72,0,71,225,65,165,168,33,243,
+6,145,0,122,24,210,148,14,249,35,120,160,55,226,13,76,192,196,177,164,152,
+22,192,4,202,52,147,72,152,0,169,70,146,105,11,0,23,40,210,77,32,96,3,37,
+26,73,163,236,0,108,163,73,52,121,128,14,148,105,38,142,176,1,242,144,56,
+208,254,84,6,166,82,242,80,210,246,1,250,67,72,144,15,232,13,44,96,47,162,
+52,160,128,62,80,160,255,253,102,76,0,0,15,135,240,0,0,0,3,84,0,0,15,7,240,
+0,0,0,3,124,64,153,132,18,49,2,38,48,64,200,7,153,64,227,48,26,103,3,13,0,
+89,165,34,53,36,38,180,128,216,143,155,81,227,114,58,111,2,142,0,73,194,94,
+56,202,167,33,209,195,114,70,206,209,26,58,36,100,228,145,131,130,69,204,
+137,22,51,36,84,208,145,67,82,68,205,137,18,62,36,68,240,122,32,120,62,0,2,
+87,61,39,255,254,9,46,24,0,10,31,224,29,13,91,40,0,9,101,137,32,0,48,197,
+84,66,214,9,10,82,68,37,81,144,133,52,65,214,137,6,90,40,0,12,21,100,144,
+69,114,64,213,202,0,3,2,86,36,5,96,160,0,63,254,16,37,135,91,98,25,242,192,
+7,194,248,30,236,32,123,46,17,234,186,71,162,241,5,23,240,0,15,241,1,70,74,
+3,8,249,49,3,204,185,15,35,3,231,137,121,240,163,254,0,46,224,18,7,248,192,
+42,249,14,3,224,20,32,0,46,208,35,231,96,41,29,96,192,117,3,159,58,66,64,
+232,10,3,156,45,14,96,194,57,67,87,156,129,231,206,48,51,240,0,23,16,25,
+255,255,251,132,16,209,192,8,106,0,2,223,4,53,0,2,111,2,26,128,1,183,65,13,
+64,1,27,129,7,224,0,45,176,131,255,255,241,73,252,0,91,77,103,193,254,64,
+36,200,64,101,31,47,32,123,188,129,178,218,70,195,113,29,173,231,206,55,3,
+71,19,129,168,0,11,93,196,141,103,34,53,92,208,212,116,35,157,213,13,55,
+100,52,158,16,209,108,3,65,176,12,246,192,128,0,179,155,2,0,2,205,122,3,49,
+221,2,151,248,0,7,249,64,147,35,4,249,17,8,0,11,220,68,2,155,248,172,184,
+31,255,253,239,255,255,255,255,236,168,0,0,0,0,0,32,0,0,12,152,0,0,31,15,
+224,0,0,0,12,120,0,0,30,15,224,0,0,0,12,136,0,0,30,31,224,0,0,0,0,7,249,
+128,147,32,0,0,0,0,0,0,0,0,12,249,79,35,225,52,143,117,0,49,147,8,197,75,
+35,17,56,130,159,248,1,176,197,136,194,23,254,96,138,128,63,206,4,153,32,0,
+3,225,252,0,0,0,2,215,200,232,24,3,161,0,1,95,142,132,0,9,240,58,16,0,53,
+240,232,64,1,23,163,161,0,5,77,142,132,0,25,52,58,16,0,116,200,225,30,227,
+192,94,15,1,118,48,16,0,133,208,192,64,2,87,35,1,0,10,92,12,4,0,45,110,48,
+16,0,197,176,192,64,3,86,163,1,0,14,90,12,4,0,61,102,48,16,1,5,144,192,64,
+4,86,35,1,0,18,88,12,4,0,77,94,48,16,1,69,112,192,64,5,85,163,1,0,22,86,12,
+4,0,93,86,50,5,80,217,21,35,69,0,24,84,13,20,0,101,78,52,190,0,52,166,26,
+95,0,27,82,141,63,128,14,41,6,159,192,7,84,99,83,224,3,202,33,169,240,1,
+245,8,209,64,8,20,3,69,0,33,79,141,47,128,17,39,134,151,192,8,211,163,79,
+224,4,137,193,167,240,2,84,192,192,64,9,146,227,69,0,39,21,31,192,0,63,208,
+24,147,4,12,0,32,41,56,72,240,60,100,148,100,140,100,132,128,0,0,0,0,0,0,0,
+0,210,172,228,74,52,17,242,210,1,83,252,0,3,253,33,81,132,11,69,144,24,166,
+229,69,37,23,39,41,40,57,65,72,47,146,176,10,175,224,0,159,234,4,140,41,18,
+44,128,192,10,191,224,0,159,235,4,140,41,10,44,128,192,10,207,224,0,159,
+236,4,140,41,2,44,128,192,10,223,224,0,159,237,4,140,40,250,44,128,192,10,
+239,224,0,159,238,4,140,40,242,44,128,192,10,255,224,0,159,239,4,140,40,
+234,44,128,192,7,255,228,34,160,5,95,130,160,52,171,138,69,162,96,88,181,
+129,32,11,42,218,221,162,32,33,23,115,31,247,156,253,127,33,224,35,138,251,
+159,255,65,21,178,161,160,61,229,237,159,135,114,147,10,161,96,125,144,132,
+160,12,22,162,42,33,32,79,80,115,31,230,157,191,179,32,224,79,80,123,31,
+230,157,191,179,36,130,71,34,5,28,160,0,40,4,114,128,1,31,209,202,0,6,126,
+73,65,245,28,160,0,135,196,114,128,2,158,209,202,0,12,122,71,40,0,57,229,
+28,160,1,7,132,85,227,186,50,241,217,37,32,0,39,84,128,29,17,202,0,18,115,
+71,40,0,81,201,28,160,1,103,20,114,128,6,7,255,224,4,195,63,65,193,1,130,
+255,248,0,11,255,224,0,31,255,138,52,128,1,219,134,128,0,0,0,0,3,57,192,71,
+72,4,229,0,29,99,140,201,72,50,31,32,196,144,131,2,49,225,121,16,240,184,
+132,120,82,64,65,102,252,0,233,239,200,20,62,176,78,248,0,255,148,0,5,163,
+240,0,15,249,192,9,242,38,16,0,23,184,152,5,171,240,0,15,250,64,9,242,200,
+16,0,23,187,32,5,179,240,0,15,250,194,15,72,0,0,0,64,0,0,0,0,15,201,4,195,
+187,126,226,4,200,68,18,162,16,72,134,60,35,67,31,0,1,25,161,143,128,1,8,
+144,199,192,0,196,40,99,224,0,130,4,49,240,0,84,255,252,36,100,16,184,155,
+250,226,217,150,47,46,91,249,34,224,139,229,229,203,127,36,26,119,32,203,
+203,150,254,72,52,97,221,147,102,157,217,192,
+};
+#ifdef DUK_USE_BUILTIN_INITJS
+DUK_INTERNAL const duk_uint8_t duk_initjs_data[187] = {
+40,102,117,110,99,116,105,111,110,40,100,44,97,41,123,102,117,110,99,116,
+105,111,110,32,98,40,97,44,98,44,99,41,123,79,98,106,101,99,116,46,100,101,
+102,105,110,101,80,114,111,112,101,114,116,121,40,97,44,98,44,123,118,97,
+108,117,101,58,99,44,119,114,105,116,97,98,108,101,58,33,48,44,101,110,117,
+109,101,114,97,98,108,101,58,33,49,44,99,111,110,102,105,103,117,114,97,98,
+108,101,58,33,48,125,41,125,98,40,97,46,76,111,103,103,101,114,44,34,99,
+108,111,103,34,44,110,101,119,32,97,46,76,111,103,103,101,114,40,34,67,34,
+41,41,59,98,40,97,44,34,109,111,100,76,111,97,100,101,100,34,44,123,125,41,
+125,41,40,116,104,105,115,44,68,117,107,116,97,112,101,41,59,10,0,
+};
+#endif /* DUK_USE_BUILTIN_INITJS */
+#else
+#error invalid endianness defines
+#endif
+#line 1 "duk_error_macros.c"
+/*
+ * Error, fatal, and panic handling.
+ */
+
+/* include removed: duk_internal.h */
+
+#define DUK__ERRFMT_BUFSIZE 256 /* size for formatting buffers */
+
+#ifdef DUK_USE_VERBOSE_ERRORS
+
+#ifdef DUK_USE_VARIADIC_MACROS
+DUK_INTERNAL void duk_err_handle_error(const char *filename, duk_int_t line, duk_hthread *thr, duk_errcode_t code, const char *fmt, ...) {
+ va_list ap;
+ char msg[DUK__ERRFMT_BUFSIZE];
+ va_start(ap, fmt);
+ (void) DUK_VSNPRINTF(msg, sizeof(msg), fmt, ap);
+ msg[sizeof(msg) - 1] = (char) 0;
+ duk_err_create_and_throw(thr, code, msg, filename, line);
+ va_end(ap); /* dead code, but ensures portability (see Linux man page notes) */
+}
+#else /* DUK_USE_VARIADIC_MACROS */
+DUK_INTERNAL const char *duk_err_file_stash = NULL;
+DUK_INTERNAL duk_int_t duk_err_line_stash = 0;
+
+DUK_NORETURN(DUK_LOCAL_DECL void duk__handle_error(const char *filename, duk_int_t line, duk_hthread *thr, duk_errcode_t code, const char *fmt, va_list ap));
+
+DUK_LOCAL void duk__handle_error(const char *filename, duk_int_t line, duk_hthread *thr, duk_errcode_t code, const char *fmt, va_list ap) {
+ char msg[DUK__ERRFMT_BUFSIZE];
+ (void) DUK_VSNPRINTF(msg, sizeof(msg), fmt, ap);
+ msg[sizeof(msg) - 1] = (char) 0;
+ duk_err_create_and_throw(thr, code, msg, filename, line);
+}
+
+DUK_INTERNAL void duk_err_handle_error(const char *filename, duk_int_t line, duk_hthread *thr, duk_errcode_t code, const char *fmt, ...) {
+ va_list ap;
+ va_start(ap, fmt);
+ duk__handle_error(filename, line, thr, code, fmt, ap);
+ va_end(ap); /* dead code */
+}
+
+DUK_INTERNAL void duk_err_handle_error_stash(duk_hthread *thr, duk_errcode_t code, const char *fmt, ...) {
+ va_list ap;
+ va_start(ap, fmt);
+ duk__handle_error(duk_err_file_stash, duk_err_line_stash, thr, code, fmt, ap);
+ va_end(ap); /* dead code */
+}
+#endif /* DUK_USE_VARIADIC_MACROS */
+
+#else /* DUK_USE_VERBOSE_ERRORS */
+
+#ifdef DUK_USE_VARIADIC_MACROS
+DUK_INTERNAL void duk_err_handle_error(duk_hthread *thr, duk_errcode_t code) {
+ duk_err_create_and_throw(thr, code);
+}
+
+#else /* DUK_USE_VARIADIC_MACROS */
+DUK_INTERNAL void duk_err_handle_error_nonverbose1(duk_hthread *thr, duk_errcode_t code, const char *fmt, ...) {
+ DUK_UNREF(fmt);
+ duk_err_create_and_throw(thr, code);
+}
+
+DUK_INTERNAL void duk_err_handle_error_nonverbose2(const char *filename, duk_int_t line, duk_hthread *thr, duk_errcode_t code, const char *fmt, ...) {
+ DUK_UNREF(filename);
+ DUK_UNREF(line);
+ DUK_UNREF(fmt);
+ duk_err_create_and_throw(thr, code);
+}
+#endif /* DUK_USE_VARIADIC_MACROS */
+
+#endif /* DUK_USE_VERBOSE_ERRORS */
+
+/*
+ * Default fatal error handler
+ */
+
+DUK_INTERNAL void duk_default_fatal_handler(duk_context *ctx, duk_errcode_t code, const char *msg) {
+ DUK_UNREF(ctx);
+#ifdef DUK_USE_FILE_IO
+ DUK_FPRINTF(DUK_STDERR, "FATAL %ld: %s\n", (long) code, (const char *) (msg ? msg : "null"));
+ DUK_FFLUSH(DUK_STDERR);
+#else
+ /* omit print */
+#endif
+ DUK_D(DUK_DPRINT("default fatal handler called, code %ld -> calling DUK_PANIC()", (long) code));
+ DUK_PANIC(code, msg);
+ DUK_UNREACHABLE();
+}
+
+/*
+ * Default panic handler
+ */
+
+#if !defined(DUK_USE_PANIC_HANDLER)
+DUK_INTERNAL void duk_default_panic_handler(duk_errcode_t code, const char *msg) {
+#ifdef DUK_USE_FILE_IO
+ DUK_FPRINTF(DUK_STDERR, "PANIC %ld: %s ("
+#if defined(DUK_USE_PANIC_ABORT)
+ "calling abort"
+#elif defined(DUK_USE_PANIC_EXIT)
+ "calling exit"
+#elif defined(DUK_USE_PANIC_SEGFAULT)
+ "segfaulting on purpose"
+#else
+#error no DUK_USE_PANIC_xxx macro defined
+#endif
+ ")\n", (long) code, (const char *) (msg ? msg : "null"));
+ DUK_FFLUSH(DUK_STDERR);
+#else
+ /* omit print */
+ DUK_UNREF(code);
+ DUK_UNREF(msg);
+#endif
+
+#if defined(DUK_USE_PANIC_ABORT)
+ DUK_ABORT();
+#elif defined(DUK_USE_PANIC_EXIT)
+ DUK_EXIT(-1);
+#elif defined(DUK_USE_PANIC_SEGFAULT)
+ /* exit() afterwards to satisfy "noreturn" */
+ DUK_CAUSE_SEGFAULT(); /* SCANBUILD: "Dereference of null pointer", normal */
+ DUK_EXIT(-1);
+#else
+#error no DUK_USE_PANIC_xxx macro defined
+#endif
+
+ DUK_UNREACHABLE();
+}
+#endif /* !DUK_USE_PANIC_HANDLER */
+
+#undef DUK__ERRFMT_BUFSIZE
+#line 1 "duk_unicode_support.c"
+/*
+ * Various Unicode help functions for character classification predicates,
+ * case conversion, decoding, etc.
+ */
+
+/* include removed: duk_internal.h */
+
+/*
+ * XUTF-8 and CESU-8 encoding/decoding
+ */
+
+DUK_INTERNAL duk_small_int_t duk_unicode_get_xutf8_length(duk_ucodepoint_t cp) {
+ duk_uint_fast32_t x = (duk_uint_fast32_t) cp;
+ if (x < 0x80UL) {
+ /* 7 bits */
+ return 1;
+ } else if (x < 0x800UL) {
+ /* 11 bits */
+ return 2;
+ } else if (x < 0x10000UL) {
+ /* 16 bits */
+ return 3;
+ } else if (x < 0x200000UL) {
+ /* 21 bits */
+ return 4;
+ } else if (x < 0x4000000UL) {
+ /* 26 bits */
+ return 5;
+ } else if (x < (duk_ucodepoint_t) 0x80000000UL) {
+ /* 31 bits */
+ return 6;
+ } else {
+ /* 36 bits */
+ return 7;
+ }
+}
+
+DUK_INTERNAL duk_uint8_t duk_unicode_xutf8_markers[7] = {
+ 0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe
+};
+
+/* Encode to extended UTF-8; 'out' must have space for at least
+ * DUK_UNICODE_MAX_XUTF8_LENGTH bytes. Allows encoding of any
+ * 32-bit (unsigned) codepoint.
+ */
+DUK_INTERNAL duk_small_int_t duk_unicode_encode_xutf8(duk_ucodepoint_t cp, duk_uint8_t *out) {
+ duk_uint_fast32_t x = (duk_uint_fast32_t) cp;
+ duk_small_int_t len;
+ duk_uint8_t marker;
+ duk_small_int_t i;
+
+ len = duk_unicode_get_xutf8_length(cp);
+ DUK_ASSERT(len > 0);
+
+ marker = duk_unicode_xutf8_markers[len - 1]; /* 64-bit OK because always >= 0 */
+
+ i = len;
+ DUK_ASSERT(i > 0);
+ do {
+ i--;
+ if (i > 0) {
+ out[i] = (duk_uint8_t) (0x80 + (x & 0x3f));
+ x >>= 6;
+ } else {
+ /* Note: masking of 'x' is not necessary because of
+ * range check and shifting -> no bits overlapping
+ * the marker should be set.
+ */
+ out[0] = (duk_uint8_t) (marker + x);
+ }
+ } while (i > 0);
+
+ return len;
+}
+
+/* Encode to CESU-8; 'out' must have space for at least
+ * DUK_UNICODE_MAX_CESU8_LENGTH bytes; codepoints above U+10FFFF
+ * will encode to garbage but won't overwrite the output buffer.
+ */
+DUK_INTERNAL duk_small_int_t duk_unicode_encode_cesu8(duk_ucodepoint_t cp, duk_uint8_t *out) {
+ duk_uint_fast32_t x = (duk_uint_fast32_t) cp;
+ duk_small_int_t len;
+
+ if (x < 0x80UL) {
+ out[0] = (duk_uint8_t) x;
+ len = 1;
+ } else if (x < 0x800UL) {
+ out[0] = (duk_uint8_t) (0xc0 + ((x >> 6) & 0x1f));
+ out[1] = (duk_uint8_t) (0x80 + (x & 0x3f));
+ len = 2;
+ } else if (x < 0x10000UL) {
+ /* surrogate pairs get encoded here */
+ out[0] = (duk_uint8_t) (0xe0 + ((x >> 12) & 0x0f));
+ out[1] = (duk_uint8_t) (0x80 + ((x >> 6) & 0x3f));
+ out[2] = (duk_uint8_t) (0x80 + (x & 0x3f));
+ len = 3;
+ } else {
+ /*
+ * Unicode codepoints above U+FFFF are encoded as surrogate
+ * pairs here. This ensures that all CESU-8 codepoints are
+ * 16-bit values as expected in Ecmascript. The surrogate
+ * pairs always get a 3-byte encoding (each) in CESU-8.
+ * See: http://en.wikipedia.org/wiki/Surrogate_pair
+ *
+ * 20-bit codepoint, 10 bits (A and B) per surrogate pair:
+ *
+ * x = 0b00000000 0000AAAA AAAAAABB BBBBBBBB
+ * sp1 = 0b110110AA AAAAAAAA (0xd800 + ((x >> 10) & 0x3ff))
+ * sp2 = 0b110111BB BBBBBBBB (0xdc00 + (x & 0x3ff))
+ *
+ * Encoded into CESU-8:
+ *
+ * sp1 -> 0b11101101 (0xe0 + ((sp1 >> 12) & 0x0f))
+ * -> 0b1010AAAA (0x80 + ((sp1 >> 6) & 0x3f))
+ * -> 0b10AAAAAA (0x80 + (sp1 & 0x3f))
+ * sp2 -> 0b11101101 (0xe0 + ((sp2 >> 12) & 0x0f))
+ * -> 0b1011BBBB (0x80 + ((sp2 >> 6) & 0x3f))
+ * -> 0b10BBBBBB (0x80 + (sp2 & 0x3f))
+ *
+ * Note that 0x10000 must be subtracted first. The code below
+ * avoids the sp1, sp2 temporaries which saves around 20 bytes
+ * of code.
+ */
+
+ x -= 0x10000UL;
+
+ out[0] = (duk_uint8_t) (0xed);
+ out[1] = (duk_uint8_t) (0xa0 + ((x >> 16) & 0x0f));
+ out[2] = (duk_uint8_t) (0x80 + ((x >> 10) & 0x3f));
+ out[3] = (duk_uint8_t) (0xed);
+ out[4] = (duk_uint8_t) (0xb0 + ((x >> 6) & 0x0f));
+ out[5] = (duk_uint8_t) (0x80 + (x & 0x3f));
+ len = 6;
+ }
+
+ return len;
+}
+
+/* Decode helper. Return zero on error. */
+DUK_INTERNAL 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) {
+ const duk_uint8_t *p;
+ duk_uint32_t res;
+ duk_uint_fast8_t ch;
+ duk_small_int_t n;
+
+ DUK_UNREF(thr);
+
+ p = *ptr;
+ if (p < ptr_start || p >= ptr_end) {
+ goto fail;
+ }
+
+ /*
+ * UTF-8 decoder which accepts longer than standard byte sequences.
+ * This allows full 32-bit code points to be used.
+ */
+
+ ch = (duk_uint_fast8_t) (*p++);
+ if (ch < 0x80) {
+ /* 0xxx xxxx [7 bits] */
+ res = (duk_uint32_t) (ch & 0x7f);
+ n = 0;
+ } else if (ch < 0xc0) {
+ /* 10xx xxxx -> invalid */
+ goto fail;
+ } else if (ch < 0xe0) {
+ /* 110x xxxx 10xx xxxx [11 bits] */
+ res = (duk_uint32_t) (ch & 0x1f);
+ n = 1;
+ } else if (ch < 0xf0) {
+ /* 1110 xxxx 10xx xxxx 10xx xxxx [16 bits] */
+ res = (duk_uint32_t) (ch & 0x0f);
+ n = 2;
+ } else if (ch < 0xf8) {
+ /* 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx [21 bits] */
+ res = (duk_uint32_t) (ch & 0x07);
+ n = 3;
+ } else if (ch < 0xfc) {
+ /* 1111 10xx 10xx xxxx 10xx xxxx 10xx xxxx 10xx xxxx [26 bits] */
+ res = (duk_uint32_t) (ch & 0x03);
+ n = 4;
+ } else if (ch < 0xfe) {
+ /* 1111 110x 10xx xxxx 10xx xxxx 10xx xxxx 10xx xxxx 10xx xxxx [31 bits] */
+ res = (duk_uint32_t) (ch & 0x01);
+ n = 5;
+ } else if (ch < 0xff) {
+ /* 1111 1110 10xx xxxx 10xx xxxx 10xx xxxx 10xx xxxx 10xx xxxx 10xx xxxx [36 bits] */
+ res = (duk_uint32_t) (0);
+ n = 6;
+ } else {
+ /* 8-byte format could be:
+ * 1111 1111 10xx xxxx 10xx xxxx 10xx xxxx 10xx xxxx 10xx xxxx 10xx xxxx 10xx xxxx [41 bits]
+ *
+ * However, this format would not have a zero bit following the
+ * leading one bits and would not allow 0xFF to be used as an
+ * "invalid xutf-8" marker for internal keys. Further, 8-byte
+ * encodings (up to 41 bit code points) are not currently needed.
+ */
+ goto fail;
+ }
+
+ DUK_ASSERT(p >= ptr_start); /* verified at beginning */
+ if (p + n > ptr_end) {
+ /* check pointer at end */
+ goto fail;
+ }
+
+ while (n > 0) {
+ DUK_ASSERT(p >= ptr_start && p < ptr_end);
+ res = res << 6;
+ res += (duk_uint32_t) ((*p++) & 0x3f);
+ n--;
+ }
+
+ *ptr = p;
+ *out_cp = res;
+ return 1;
+
+ fail:
+ return 0;
+}
+
+/* used by e.g. duk_regexp_executor.c, string built-ins */
+DUK_INTERNAL 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_ucodepoint_t cp;
+
+ if (duk_unicode_decode_xutf8(thr, ptr, ptr_start, ptr_end, &cp)) {
+ return cp;
+ }
+ DUK_ERROR(thr, DUK_ERR_INTERNAL_ERROR, "utf-8 decode failed");
+ DUK_UNREACHABLE();
+ return 0;
+}
+
+/* (extended) utf-8 length without codepoint encoding validation, used
+ * for string interning (should probably be inlined).
+ */
+DUK_INTERNAL duk_size_t duk_unicode_unvalidated_utf8_length(const duk_uint8_t *data, duk_size_t blen) {
+ const duk_uint8_t *p = data;
+ const duk_uint8_t *p_end = data + blen;
+ duk_size_t clen = 0;
+
+ while (p < p_end) {
+ duk_uint8_t x = *p++;
+ if (x < 0x80 || x >= 0xc0) {
+ /* 10xxxxxx = continuation chars (0x80...0xbf), above
+ * and below that initial bytes.
+ */
+ clen++;
+ }
+ }
+
+ return clen;
+}
+
+/*
+ * Unicode range matcher
+ *
+ * Matches a codepoint against a packed bitstream of character ranges.
+ * Used for slow path Unicode matching.
+ */
+
+/* Must match src/extract_chars.py, generate_match_table3(). */
+DUK_LOCAL duk_uint32_t duk__uni_decode_value(duk_bitdecoder_ctx *bd_ctx) {
+ duk_uint32_t t;
+
+ t = (duk_uint32_t) duk_bd_decode(bd_ctx, 4);
+ if (t <= 0x0eU) {
+ return t;
+ }
+ t = (duk_uint32_t) duk_bd_decode(bd_ctx, 8);
+ if (t <= 0xfdU) {
+ return t + 0x0f;
+ }
+ if (t == 0xfeU) {
+ t = (duk_uint32_t) duk_bd_decode(bd_ctx, 12);
+ return t + 0x0fU + 0xfeU;
+ } else {
+ t = (duk_uint32_t) duk_bd_decode(bd_ctx, 24);
+ return t + 0x0fU + 0xfeU + 0x1000UL;
+ }
+}
+
+DUK_LOCAL duk_small_int_t duk__uni_range_match(const duk_uint8_t *unitab, duk_size_t unilen, duk_codepoint_t cp) {
+ duk_bitdecoder_ctx bd_ctx;
+ duk_codepoint_t prev_re;
+
+ DUK_MEMZERO(&bd_ctx, sizeof(bd_ctx));
+ bd_ctx.data = (duk_uint8_t *) unitab;
+ bd_ctx.length = (duk_size_t) unilen;
+
+ prev_re = 0;
+ for (;;) {
+ duk_codepoint_t r1, r2;
+ r1 = (duk_codepoint_t) duk__uni_decode_value(&bd_ctx);
+ if (r1 == 0) {
+ break;
+ }
+ r2 = (duk_codepoint_t) duk__uni_decode_value(&bd_ctx);
+
+ r1 = prev_re + r1;
+ r2 = r1 + r2;
+ prev_re = r2;
+
+ /* [r1,r2] is the range */
+
+ DUK_DDD(DUK_DDDPRINT("duk__uni_range_match: cp=%06lx range=[0x%06lx,0x%06lx]",
+ (unsigned long) cp, (unsigned long) r1, (unsigned long) r2));
+ if (cp >= r1 && cp <= r2) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+/*
+ * "WhiteSpace" production check.
+ */
+
+DUK_INTERNAL duk_small_int_t duk_unicode_is_whitespace(duk_codepoint_t cp) {
+ /*
+ * E5 Section 7.2 specifies six characters specifically as
+ * white space:
+ *
+ * 0009;<control>;Cc;0;S;;;;;N;CHARACTER TABULATION;;;;
+ * 000B;<control>;Cc;0;S;;;;;N;LINE TABULATION;;;;
+ * 000C;<control>;Cc;0;WS;;;;;N;FORM FEED (FF);;;;
+ * 0020;SPACE;Zs;0;WS;;;;;N;;;;;
+ * 00A0;NO-BREAK SPACE;Zs;0;CS;<noBreak> 0020;;;;N;NON-BREAKING SPACE;;;;
+ * FEFF;ZERO WIDTH NO-BREAK SPACE;Cf;0;BN;;;;;N;BYTE ORDER MARK;;;;
+ *
+ * It also specifies any Unicode category 'Zs' characters as white
+ * space. These can be extracted with the "src/extract_chars.py" script.
+ * Current result:
+ *
+ * RAW OUTPUT:
+ * ===========
+ * 0020;SPACE;Zs;0;WS;;;;;N;;;;;
+ * 00A0;NO-BREAK SPACE;Zs;0;CS;<noBreak> 0020;;;;N;NON-BREAKING SPACE;;;;
+ * 1680;OGHAM SPACE MARK;Zs;0;WS;;;;;N;;;;;
+ * 180E;MONGOLIAN VOWEL SEPARATOR;Zs;0;WS;;;;;N;;;;;
+ * 2000;EN QUAD;Zs;0;WS;2002;;;;N;;;;;
+ * 2001;EM QUAD;Zs;0;WS;2003;;;;N;;;;;
+ * 2002;EN SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+ * 2003;EM SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+ * 2004;THREE-PER-EM SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+ * 2005;FOUR-PER-EM SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+ * 2006;SIX-PER-EM SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+ * 2007;FIGURE SPACE;Zs;0;WS;<noBreak> 0020;;;;N;;;;;
+ * 2008;PUNCTUATION SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+ * 2009;THIN SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+ * 200A;HAIR SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+ * 202F;NARROW NO-BREAK SPACE;Zs;0;CS;<noBreak> 0020;;;;N;;;;;
+ * 205F;MEDIUM MATHEMATICAL SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+ * 3000;IDEOGRAPHIC SPACE;Zs;0;WS;<wide> 0020;;;;N;;;;;
+ *
+ * RANGES:
+ * =======
+ * 0x0020
+ * 0x00a0
+ * 0x1680
+ * 0x180e
+ * 0x2000 ... 0x200a
+ * 0x202f
+ * 0x205f
+ * 0x3000
+ *
+ * A manual decoder (below) is probably most compact for this.
+ */
+
+ duk_uint_fast8_t lo;
+ duk_uint_fast32_t hi;
+
+ /* cp == -1 (EOF) never matches and causes return value 0 */
+
+ lo = (duk_uint_fast8_t) (cp & 0xff);
+ hi = (duk_uint_fast32_t) (cp >> 8); /* does not fit into an uchar */
+
+ if (hi == 0x0000UL) {
+ if (lo == 0x09U || lo == 0x0bU || lo == 0x0cU ||
+ lo == 0x20U || lo == 0xa0U) {
+ return 1;
+ }
+ } else if (hi == 0x0020UL) {
+ if (lo <= 0x0aU || lo == 0x2fU || lo == 0x5fU) {
+ return 1;
+ }
+ } else if (cp == 0x1680L || cp == 0x180eL || cp == 0x3000L ||
+ cp == 0xfeffL) {
+ return 1;
+ }
+
+ return 0;
+}
+
+/*
+ * "LineTerminator" production check.
+ */
+
+DUK_INTERNAL duk_small_int_t duk_unicode_is_line_terminator(duk_codepoint_t cp) {
+ /*
+ * E5 Section 7.3
+ *
+ * A LineTerminatorSequence essentially merges <CR> <LF> sequences
+ * into a single line terminator. This must be handled by the caller.
+ */
+
+ if (cp == 0x000aL || cp == 0x000dL || cp == 0x2028L ||
+ cp == 0x2029L) {
+ return 1;
+ }
+
+ return 0;
+}
+
+/*
+ * "IdentifierStart" production check.
+ */
+
+DUK_INTERNAL duk_small_int_t duk_unicode_is_identifier_start(duk_codepoint_t cp) {
+ /*
+ * E5 Section 7.6:
+ *
+ * IdentifierStart:
+ * UnicodeLetter
+ * $
+ * _
+ * \ UnicodeEscapeSequence
+ *
+ * IdentifierStart production has one multi-character production:
+ *
+ * \ UnicodeEscapeSequence
+ *
+ * The '\' character is -not- matched by this function. Rather, the caller
+ * should decode the escape and then call this function to check whether the
+ * decoded character is acceptable (see discussion in E5 Section 7.6).
+ *
+ * The "UnicodeLetter" alternative of the production allows letters
+ * from various Unicode categories. These can be extracted with the
+ * "src/extract_chars.py" script.
+ *
+ * Because the result has hundreds of Unicode codepoint ranges, matching
+ * for any values >= 0x80 are done using a very slow range-by-range scan
+ * and a packed range format.
+ *
+ * The ASCII portion (codepoints 0x00 ... 0x7f) is fast-pathed below because
+ * it matters the most. The ASCII related ranges of IdentifierStart are:
+ *
+ * 0x0041 ... 0x005a ['A' ... 'Z']
+ * 0x0061 ... 0x007a ['a' ... 'z']
+ * 0x0024 ['$']
+ * 0x005f ['_']
+ */
+
+ /* ASCII (and EOF) fast path -- quick accept and reject */
+ if (cp <= 0x7fL) {
+ if ((cp >= 'a' && cp <= 'z') ||
+ (cp >= 'A' && cp <= 'Z') ||
+ cp == '_' || cp == '$') {
+ return 1;
+ }
+ return 0;
+ }
+
+ /* Non-ASCII slow path (range-by-range linear comparison), very slow */
+
+#ifdef DUK_USE_SOURCE_NONBMP
+ if (duk__uni_range_match(duk_unicode_ids_noa,
+ (duk_size_t) sizeof(duk_unicode_ids_noa),
+ (duk_codepoint_t) cp)) {
+ return 1;
+ }
+ return 0;
+#else
+ if (cp < 0x10000L) {
+ if (duk__uni_range_match(duk_unicode_ids_noabmp,
+ sizeof(duk_unicode_ids_noabmp),
+ (duk_codepoint_t) cp)) {
+ return 1;
+ }
+ return 0;
+ } else {
+ /* without explicit non-BMP support, assume non-BMP characters
+ * are always accepted as identifier characters.
+ */
+ return 1;
+ }
+#endif
+}
+
+/*
+ * "IdentifierPart" production check.
+ */
+
+DUK_INTERNAL duk_small_int_t duk_unicode_is_identifier_part(duk_codepoint_t cp) {
+ /*
+ * E5 Section 7.6:
+ *
+ * IdentifierPart:
+ * IdentifierStart
+ * UnicodeCombiningMark
+ * UnicodeDigit
+ * UnicodeConnectorPunctuation
+ * <ZWNJ> [U+200C]
+ * <ZWJ> [U+200D]
+ *
+ * IdentifierPart production has one multi-character production
+ * as part of its IdentifierStart alternative. The '\' character
+ * of an escape sequence is not matched here, see discussion in
+ * duk_unicode_is_identifier_start().
+ *
+ * To match non-ASCII characters (codepoints >= 0x80), a very slow
+ * linear range-by-range scan is used. The codepoint is first compared
+ * to the IdentifierStart ranges, and if it doesn't match, then to a
+ * set consisting of code points in IdentifierPart but not in
+ * IdentifierStart. This is done to keep the unicode range data small,
+ * at the expense of speed.
+ *
+ * The ASCII fast path consists of:
+ *
+ * 0x0030 ... 0x0039 ['0' ... '9', UnicodeDigit]
+ * 0x0041 ... 0x005a ['A' ... 'Z', IdentifierStart]
+ * 0x0061 ... 0x007a ['a' ... 'z', IdentifierStart]
+ * 0x0024 ['$', IdentifierStart]
+ * 0x005f ['_', IdentifierStart and
+ * UnicodeConnectorPunctuation]
+ *
+ * UnicodeCombiningMark has no code points <= 0x7f.
+ *
+ * The matching code reuses the "identifier start" tables, and then
+ * consults a separate range set for characters in "identifier part"
+ * but not in "identifier start". These can be extracted with the
+ * "src/extract_chars.py" script.
+ *
+ * UnicodeCombiningMark -> categories Mn, Mc
+ * UnicodeDigit -> categories Nd
+ * UnicodeConnectorPunctuation -> categories Pc
+ */
+
+ /* ASCII (and EOF) fast path -- quick accept and reject */
+ if (cp <= 0x7fL) {
+ if ((cp >= 'a' && cp <= 'z') ||
+ (cp >= 'A' && cp <= 'Z') ||
+ (cp >= '0' && cp <= '9') ||
+ cp == '_' || cp == '$') {
+ return 1;
+ }
+ return 0;
+ }
+
+ /* Non-ASCII slow path (range-by-range linear comparison), very slow */
+
+#ifdef DUK_USE_SOURCE_NONBMP
+ if (duk__uni_range_match(duk_unicode_ids_noa,
+ sizeof(duk_unicode_ids_noa),
+ (duk_codepoint_t) cp) ||
+ duk__uni_range_match(duk_unicode_idp_m_ids_noa,
+ sizeof(duk_unicode_idp_m_ids_noa),
+ (duk_codepoint_t) cp)) {
+ return 1;
+ }
+ return 0;
+#else
+ if (cp < 0x10000L) {
+ if (duk__uni_range_match(duk_unicode_ids_noabmp,
+ sizeof(duk_unicode_ids_noabmp),
+ (duk_codepoint_t) cp) ||
+ duk__uni_range_match(duk_unicode_idp_m_ids_noabmp,
+ sizeof(duk_unicode_idp_m_ids_noabmp),
+ (duk_codepoint_t) cp)) {
+ return 1;
+ }
+ return 0;
+ } else {
+ /* without explicit non-BMP support, assume non-BMP characters
+ * are always accepted as identifier characters.
+ */
+ return 1;
+ }
+#endif
+}
+
+/*
+ * Unicode letter check.
+ */
+
+DUK_INTERNAL duk_small_int_t duk_unicode_is_letter(duk_codepoint_t cp) {
+ /*
+ * Unicode letter is now taken to be the categories:
+ *
+ * Lu, Ll, Lt, Lm, Lo
+ *
+ * (Not sure if this is exactly correct.)
+ *
+ * The ASCII fast path consists of:
+ *
+ * 0x0041 ... 0x005a ['A' ... 'Z']
+ * 0x0061 ... 0x007a ['a' ... 'z']
+ */
+
+ /* ASCII (and EOF) fast path -- quick accept and reject */
+ if (cp <= 0x7fL) {
+ if ((cp >= 'a' && cp <= 'z') ||
+ (cp >= 'A' && cp <= 'Z')) {
+ return 1;
+ }
+ return 0;
+ }
+
+ /* Non-ASCII slow path (range-by-range linear comparison), very slow */
+
+#ifdef DUK_USE_SOURCE_NONBMP
+ if (duk__uni_range_match(duk_unicode_ids_noa,
+ sizeof(duk_unicode_ids_noa),
+ (duk_codepoint_t) cp) &&
+ !duk__uni_range_match(duk_unicode_ids_m_let_noa,
+ sizeof(duk_unicode_ids_m_let_noa),
+ (duk_codepoint_t) cp)) {
+ return 1;
+ }
+ return 0;
+#else
+ if (cp < 0x10000L) {
+ if (duk__uni_range_match(duk_unicode_ids_noabmp,
+ sizeof(duk_unicode_ids_noabmp),
+ (duk_codepoint_t) cp) &&
+ !duk__uni_range_match(duk_unicode_ids_m_let_noabmp,
+ sizeof(duk_unicode_ids_m_let_noabmp),
+ (duk_codepoint_t) cp)) {
+ return 1;
+ }
+ return 0;
+ } else {
+ /* without explicit non-BMP support, assume non-BMP characters
+ * are always accepted as letters.
+ */
+ return 1;
+ }
+#endif
+}
+
+/*
+ * Complex case conversion helper which decodes a bit-packed conversion
+ * control stream generated by unicode/extract_caseconv.py. The conversion
+ * is very slow because it runs through the conversion data in a linear
+ * fashion to save space (which is why ASCII characters have a special
+ * fast path before arriving here).
+ *
+ * The particular bit counts etc have been determined experimentally to
+ * be small but still sufficient, and must match the Python script
+ * (src/extract_caseconv.py).
+ *
+ * The return value is the case converted codepoint or -1 if the conversion
+ * results in multiple characters (this is useful for regexp Canonicalization
+ * operation). If 'buf' is not NULL, the result codepoint(s) are also
+ * appended to the hbuffer.
+ *
+ * Context and locale specific rules must be checked before consulting
+ * this function.
+ */
+
+DUK_LOCAL
+duk_codepoint_t duk__slow_case_conversion(duk_hthread *thr,
+ duk_hbuffer_dynamic *buf,
+ duk_codepoint_t cp,
+ duk_bitdecoder_ctx *bd_ctx) {
+ duk_small_int_t skip = 0;
+ duk_small_int_t n;
+ duk_small_int_t t;
+ duk_small_int_t count;
+ duk_codepoint_t tmp_cp;
+ duk_codepoint_t start_i;
+ duk_codepoint_t start_o;
+
+ DUK_DDD(DUK_DDDPRINT("slow case conversion for codepoint: %ld", (long) cp));
+
+ /* range conversion with a "skip" */
+ DUK_DDD(DUK_DDDPRINT("checking ranges"));
+ for (;;) {
+ skip++;
+ n = (duk_small_int_t) duk_bd_decode(bd_ctx, 6);
+ if (n == 0x3f) {
+ /* end marker */
+ break;
+ }
+ DUK_DDD(DUK_DDDPRINT("skip=%ld, n=%ld", (long) skip, (long) n));
+
+ while (n--) {
+ start_i = (duk_codepoint_t) duk_bd_decode(bd_ctx, 16);
+ start_o = (duk_codepoint_t) duk_bd_decode(bd_ctx, 16);
+ count = (duk_small_int_t) duk_bd_decode(bd_ctx, 7);
+ DUK_DDD(DUK_DDDPRINT("range: start_i=%ld, start_o=%ld, count=%ld, skip=%ld",
+ (long) start_i, (long) start_o, (long) count, (long) skip));
+
+ if (cp >= start_i) {
+ tmp_cp = cp - start_i; /* always >= 0 */
+ if (tmp_cp < (duk_codepoint_t) count * (duk_codepoint_t) skip &&
+ (tmp_cp % (duk_codepoint_t) skip) == 0) {
+ DUK_DDD(DUK_DDDPRINT("range matches input codepoint"));
+ cp = start_o + tmp_cp;
+ goto single;
+ }
+ }
+ }
+ }
+
+ /* 1:1 conversion */
+ n = (duk_small_int_t) duk_bd_decode(bd_ctx, 6);
+ DUK_DDD(DUK_DDDPRINT("checking 1:1 conversions (count %ld)", (long) n));
+ while (n--) {
+ start_i = (duk_codepoint_t) duk_bd_decode(bd_ctx, 16);
+ start_o = (duk_codepoint_t) duk_bd_decode(bd_ctx, 16);
+ DUK_DDD(DUK_DDDPRINT("1:1 conversion %ld -> %ld", (long) start_i, (long) start_o));
+ if (cp == start_i) {
+ DUK_DDD(DUK_DDDPRINT("1:1 matches input codepoint"));
+ cp = start_o;
+ goto single;
+ }
+ }
+
+ /* complex, multicharacter conversion */
+ n = (duk_small_int_t) duk_bd_decode(bd_ctx, 7);
+ DUK_DDD(DUK_DDDPRINT("checking 1:n conversions (count %ld)", (long) n));
+ while (n--) {
+ start_i = (duk_codepoint_t) duk_bd_decode(bd_ctx, 16);
+ t = (duk_small_int_t) duk_bd_decode(bd_ctx, 2);
+ DUK_DDD(DUK_DDDPRINT("1:n conversion %ld -> %ld chars", (long) start_i, (long) t));
+ if (cp == start_i) {
+ DUK_DDD(DUK_DDDPRINT("1:n matches input codepoint"));
+ if (buf) {
+ while (t--) {
+ tmp_cp = (duk_codepoint_t) duk_bd_decode(bd_ctx, 16);
+ DUK_ASSERT(buf != NULL);
+ duk_hbuffer_append_xutf8(thr, buf, (duk_ucodepoint_t) tmp_cp);
+ }
+ }
+ return -1;
+ } else {
+ while (t--) {
+ (void) duk_bd_decode(bd_ctx, 16);
+ }
+ }
+ }
+
+ /* default: no change */
+ DUK_DDD(DUK_DDDPRINT("no rule matches, output is same as input"));
+ /* fall through */
+
+ single:
+ if (buf) {
+ duk_hbuffer_append_xutf8(thr, buf, cp);
+ }
+ return cp;
+}
+
+/*
+ * Case conversion helper, with context/local sensitivity.
+ * For proper case conversion, one needs to know the character
+ * and the preceding and following characters, as well as
+ * locale/language.
+ */
+
+/* XXX: add 'language' argument when locale/language sensitive rule
+ * support added.
+ */
+DUK_LOCAL
+duk_codepoint_t duk__case_transform_helper(duk_hthread *thr,
+ duk_hbuffer_dynamic *buf,
+ duk_codepoint_t cp,
+ duk_codepoint_t prev,
+ duk_codepoint_t next,
+ duk_bool_t uppercase) {
+ duk_bitdecoder_ctx bd_ctx;
+
+ /* fast path for ASCII */
+ if (cp < 0x80L) {
+ /* XXX: there are language sensitive rules for the ASCII range.
+ * If/when language/locale support is implemented, they need to
+ * be implemented here for the fast path. There are no context
+ * sensitive rules for ASCII range.
+ */
+
+ if (uppercase) {
+ if (cp >= 'a' && cp <= 'z') {
+ cp = cp - 'a' + 'A';
+ }
+ } else {
+ if (cp >= 'A' && cp <= 'Z') {
+ cp = cp - 'A' + 'a';
+ }
+ }
+ goto singlechar;
+ }
+
+ /* context and locale specific rules which cannot currently be represented
+ * in the caseconv bitstream: hardcoded rules in C
+ */
+ if (uppercase) {
+ /* XXX: turkish / azeri */
+ } else {
+ /*
+ * Final sigma context specific rule. This is a rather tricky
+ * rule and this handling is probably not 100% correct now.
+ * The rule is not locale/language specific so it is supported.
+ */
+
+ if (cp == 0x03a3L && /* U+03A3 = GREEK CAPITAL LETTER SIGMA */
+ duk_unicode_is_letter(prev) && /* prev exists and is not a letter */
+ !duk_unicode_is_letter(next)) { /* next does not exist or next is not a letter */
+ /* Capital sigma occurred at "end of word", lowercase to
+ * U+03C2 = GREEK SMALL LETTER FINAL SIGMA. Otherwise
+ * fall through and let the normal rules lowercase it to
+ * U+03C3 = GREEK SMALL LETTER SIGMA.
+ */
+ cp = 0x03c2L;
+ goto singlechar;
+ }
+
+ /* XXX: lithuanian not implemented */
+ /* XXX: lithuanian, explicit dot rules */
+ /* XXX: turkish / azeri, lowercase rules */
+ }
+
+ /* 1:1 or special conversions, but not locale/context specific: script generated rules */
+ DUK_MEMZERO(&bd_ctx, sizeof(bd_ctx));
+ if (uppercase) {
+ bd_ctx.data = (duk_uint8_t *) duk_unicode_caseconv_uc;
+ bd_ctx.length = (duk_size_t) sizeof(duk_unicode_caseconv_uc);
+ } else {
+ bd_ctx.data = (duk_uint8_t *) duk_unicode_caseconv_lc;
+ bd_ctx.length = (duk_size_t) sizeof(duk_unicode_caseconv_lc);
+ }
+ return duk__slow_case_conversion(thr, buf, cp, &bd_ctx);
+
+ singlechar:
+ if (buf) {
+ duk_hbuffer_append_xutf8(thr, buf, cp);
+ }
+ return cp;
+
+ /* unused now, not needed until Turkish/Azeri */
+#if 0
+ nochar:
+ return -1;
+#endif
+}
+
+/*
+ * Replace valstack top with case converted version.
+ */
+
+DUK_INTERNAL void duk_unicode_case_convert_string(duk_hthread *thr, duk_small_int_t uppercase) {
+ duk_context *ctx = (duk_context *) thr;
+ duk_hstring *h_input;
+ duk_hbuffer_dynamic *h_buf;
+ const duk_uint8_t *p, *p_start, *p_end;
+ duk_codepoint_t prev, curr, next;
+
+ h_input = duk_require_hstring(ctx, -1);
+ DUK_ASSERT(h_input != NULL);
+
+ /* XXX: should init the buffer with a spare of at least h_input->blen
+ * to avoid unnecessary growth steps.
+ */
+ duk_push_dynamic_buffer(ctx, 0);
+ h_buf = (duk_hbuffer_dynamic *) duk_get_hbuffer(ctx, -1);
+ DUK_ASSERT(h_buf != NULL);
+ DUK_ASSERT(DUK_HBUFFER_HAS_DYNAMIC(h_buf));
+
+ /* [ ... input buffer ] */
+
+ p_start = (duk_uint8_t *) DUK_HSTRING_GET_DATA(h_input);
+ p_end = p_start + DUK_HSTRING_GET_BYTELEN(h_input);
+ p = p_start;
+
+ prev = -1; DUK_UNREF(prev);
+ curr = -1;
+ next = -1;
+ for (;;) {
+ prev = curr;
+ curr = next;
+ next = -1;
+ if (p < p_end) {
+ next = (int) duk_unicode_decode_xutf8_checked(thr, &p, p_start, p_end);
+ } else {
+ /* end of input and last char has been processed */
+ if (curr < 0) {
+ break;
+ }
+ }
+
+ /* on first round, skip */
+ if (curr >= 0) {
+ /* may generate any number of output codepoints */
+ duk__case_transform_helper(thr,
+ h_buf,
+ (duk_codepoint_t) curr,
+ prev,
+ next,
+ uppercase);
+ }
+ }
+
+ duk_to_string(ctx, -1); /* invalidates h_buf pointer */
+ duk_remove(ctx, -2);
+}
+
+#ifdef DUK_USE_REGEXP_SUPPORT
+
+/*
+ * Canonicalize() abstract operation needed for canonicalization of individual
+ * codepoints during regexp compilation and execution, see E5 Section 15.10.2.8.
+ * Note that codepoints are canonicalized one character at a time, so no context
+ * specific rules can apply. Locale specific rules can apply, though.
+ */
+
+DUK_INTERNAL duk_codepoint_t duk_unicode_re_canonicalize_char(duk_hthread *thr, duk_codepoint_t cp) {
+ duk_codepoint_t y;
+
+ y = duk__case_transform_helper(thr,
+ NULL, /* buf */
+ cp, /* curr char */
+ -1, /* prev char */
+ -1, /* next char */
+ 1); /* uppercase */
+
+ if ((y < 0) || (cp >= 0x80 && y < 0x80)) {
+ /* multiple codepoint conversion or non-ASCII mapped to ASCII
+ * --> leave as is.
+ */
+ return cp;
+ }
+
+ return y;
+}
+
+/*
+ * E5 Section 15.10.2.6 "IsWordChar" abstract operation. Assume
+ * x < 0 for characters read outside the string.
+ */
+
+DUK_INTERNAL duk_small_int_t duk_unicode_re_is_wordchar(duk_codepoint_t x) {
+ /*
+ * Note: the description in E5 Section 15.10.2.6 has a typo, it
+ * contains 'A' twice and lacks 'a'; the intent is [0-9a-zA-Z_].
+ */
+ if ((x >= '0' && x <= '9') ||
+ (x >= 'a' && x <= 'z') ||
+ (x >= 'A' && x <= 'Z') ||
+ (x == '_')) {
+ return 1;
+ }
+ return 0;
+}
+
+/*
+ * Regexp range tables
+ */
+
+/* exposed because lexer needs these too */
+DUK_INTERNAL duk_uint16_t duk_unicode_re_ranges_digit[2] = {
+ (duk_uint16_t) 0x0030UL, (duk_uint16_t) 0x0039UL,
+};
+DUK_INTERNAL duk_uint16_t duk_unicode_re_ranges_white[22] = {
+ (duk_uint16_t) 0x0009UL, (duk_uint16_t) 0x000DUL,
+ (duk_uint16_t) 0x0020UL, (duk_uint16_t) 0x0020UL,
+ (duk_uint16_t) 0x00A0UL, (duk_uint16_t) 0x00A0UL,
+ (duk_uint16_t) 0x1680UL, (duk_uint16_t) 0x1680UL,
+ (duk_uint16_t) 0x180EUL, (duk_uint16_t) 0x180EUL,
+ (duk_uint16_t) 0x2000UL, (duk_uint16_t) 0x200AUL,
+ (duk_uint16_t) 0x2028UL, (duk_uint16_t) 0x2029UL,
+ (duk_uint16_t) 0x202FUL, (duk_uint16_t) 0x202FUL,
+ (duk_uint16_t) 0x205FUL, (duk_uint16_t) 0x205FUL,
+ (duk_uint16_t) 0x3000UL, (duk_uint16_t) 0x3000UL,
+ (duk_uint16_t) 0xFEFFUL, (duk_uint16_t) 0xFEFFUL,
+};
+DUK_INTERNAL duk_uint16_t duk_unicode_re_ranges_wordchar[8] = {
+ (duk_uint16_t) 0x0030UL, (duk_uint16_t) 0x0039UL,
+ (duk_uint16_t) 0x0041UL, (duk_uint16_t) 0x005AUL,
+ (duk_uint16_t) 0x005FUL, (duk_uint16_t) 0x005FUL,
+ (duk_uint16_t) 0x0061UL, (duk_uint16_t) 0x007AUL,
+};
+DUK_INTERNAL duk_uint16_t duk_unicode_re_ranges_not_digit[4] = {
+ (duk_uint16_t) 0x0000UL, (duk_uint16_t) 0x002FUL,
+ (duk_uint16_t) 0x003AUL, (duk_uint16_t) 0xFFFFUL,
+};
+DUK_INTERNAL duk_uint16_t duk_unicode_re_ranges_not_white[24] = {
+ (duk_uint16_t) 0x0000UL, (duk_uint16_t) 0x0008UL,
+ (duk_uint16_t) 0x000EUL, (duk_uint16_t) 0x001FUL,
+ (duk_uint16_t) 0x0021UL, (duk_uint16_t) 0x009FUL,
+ (duk_uint16_t) 0x00A1UL, (duk_uint16_t) 0x167FUL,
+ (duk_uint16_t) 0x1681UL, (duk_uint16_t) 0x180DUL,
+ (duk_uint16_t) 0x180FUL, (duk_uint16_t) 0x1FFFUL,
+ (duk_uint16_t) 0x200BUL, (duk_uint16_t) 0x2027UL,
+ (duk_uint16_t) 0x202AUL, (duk_uint16_t) 0x202EUL,
+ (duk_uint16_t) 0x2030UL, (duk_uint16_t) 0x205EUL,
+ (duk_uint16_t) 0x2060UL, (duk_uint16_t) 0x2FFFUL,
+ (duk_uint16_t) 0x3001UL, (duk_uint16_t) 0xFEFEUL,
+ (duk_uint16_t) 0xFF00UL, (duk_uint16_t) 0xFFFFUL,
+};
+DUK_INTERNAL duk_uint16_t duk_unicode_re_ranges_not_wordchar[10] = {
+ (duk_uint16_t) 0x0000UL, (duk_uint16_t) 0x002FUL,
+ (duk_uint16_t) 0x003AUL, (duk_uint16_t) 0x0040UL,
+ (duk_uint16_t) 0x005BUL, (duk_uint16_t) 0x005EUL,
+ (duk_uint16_t) 0x0060UL, (duk_uint16_t) 0x0060UL,
+ (duk_uint16_t) 0x007BUL, (duk_uint16_t) 0xFFFFUL,
+};
+
+#endif /* DUK_USE_REGEXP_SUPPORT */
+#line 1 "duk_util_misc.c"
+/*
+ * Misc util stuff
+ */
+
+/* include removed: duk_internal.h */
+
+/*
+ * Lowercase digits for radix values 2 to 36. Also doubles as lowercase
+ * hex nybble table.
+ */
+
+DUK_INTERNAL duk_uint8_t duk_lc_digits[36] = {
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
+ 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
+ 'w', 'x', 'y', 'z'
+};
+
+DUK_INTERNAL duk_uint8_t duk_uc_nybbles[16] = {
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
+};
+
+/*
+ * Table for decoding ASCII hex digits, -1 if invalid.
+ */
+
+DUK_INTERNAL duk_int8_t duk_hex_dectab[256] = {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x00-0x0f */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x10-0x1f */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x20-0x2f */
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, /* 0x30-0x3f */
+ -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x40-0x4f */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x50-0x5f */
+ -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x60-0x6f */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x70-0x7f */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x80-0x8f */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x90-0x9f */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xa0-0xaf */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xb0-0xbf */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xc0-0xcf */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xd0-0xdf */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xe0-0xef */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 /* 0xf0-0xff */
+};
+
+/*
+ * Arbitrary byteswap for potentially unaligned values
+ *
+ * Used to byteswap pointers e.g. in debugger code.
+ */
+
+#if defined(DUK_USE_DEBUGGER_SUPPORT) /* For now only needed by the debugger. */
+DUK_INTERNAL void duk_byteswap_bytes(duk_uint8_t *p, duk_small_uint_t len) {
+ duk_uint8_t tmp;
+ duk_uint8_t *q = p + len - 1;
+
+ while (p - q < 0) {
+ tmp = *p;
+ *p = *q;
+ *q = tmp;
+ p++;
+ q--;
+ }
+}
+#endif
+#line 1 "duk_util_hashprime.c"
+/*
+ * Round a number upwards to a prime (not usually the nearest one).
+ *
+ * Uses a table of successive 32-bit primes whose ratio is roughly
+ * constant. This keeps the relative upwards 'rounding error' bounded
+ * and the data size small. A simple 'predict-correct' compression is
+ * used to compress primes to one byte per prime. See genhashsizes.py
+ * for details.
+ *
+ * The minimum prime returned here must be coordinated with the possible
+ * probe sequence steps in duk_hobject and duk_heap stringtable.
+ */
+
+/* include removed: duk_internal.h */
+
+/* Awkward inclusion condition: drop out of compilation if not needed by any
+ * call site: object hash part or probing stringtable.
+ */
+#if defined(DUK_USE_HOBJECT_HASH_PART) || defined(DUK_USE_STRTAB_PROBE)
+
+/* hash size ratio goal, must match genhashsizes.py */
+#define DUK__HASH_SIZE_RATIO 1177 /* floor(1.15 * (1 << 10)) */
+
+/* prediction corrections for prime list (see genhashsizes.py) */
+DUK_LOCAL const duk_int8_t duk__hash_size_corrections[] = {
+ 17, /* minimum prime */
+ 4, 3, 4, 1, 4, 1, 1, 2, 2, 2, 2, 1, 6, 6, 9, 5, 1, 2, 2, 5, 1, 3, 3, 3,
+ 5, 4, 4, 2, 4, 8, 3, 4, 23, 2, 4, 7, 8, 11, 2, 12, 15, 10, 1, 1, 5, 1, 5,
+ 8, 9, 17, 14, 10, 7, 5, 2, 46, 21, 1, 9, 9, 4, 4, 10, 23, 36, 6, 20, 29,
+ 18, 6, 19, 21, 16, 11, 5, 5, 48, 9, 1, 39, 14, 8, 4, 29, 9, 1, 15, 48, 12,
+ 22, 6, 15, 27, 4, 2, 17, 28, 8, 9, 4, 5, 8, 3, 3, 8, 37, 11, 15, 8, 30,
+ 43, 6, 33, 41, 5, 20, 32, 41, 38, 24, 77, 14, 19, 11, 4, 35, 18, 19, 41,
+ 10, 23, 16, 9, 2,
+ -1
+};
+
+/* probe steps (see genhashsizes.py), currently assumed to be 32 entries long
+ * (DUK_UTIL_GET_HASH_PROBE_STEP macro).
+ */
+DUK_INTERNAL duk_uint8_t duk_util_probe_steps[32] = {
+ 2, 3, 5, 7, 11, 13, 19, 31, 41, 47, 59, 67, 73, 79, 89, 101, 103, 107,
+ 109, 127, 137, 139, 149, 157, 163, 167, 173, 181, 191, 193, 197, 199
+};
+
+DUK_INTERNAL duk_uint32_t duk_util_get_hash_prime(duk_uint32_t size) {
+ const duk_int8_t *p = duk__hash_size_corrections;
+ duk_uint32_t curr;
+
+ curr = (duk_uint32_t) *p++;
+ for (;;) {
+ duk_small_int_t t = (duk_small_int_t) *p++;
+ if (t < 0) {
+ /* may happen if size is very close to 2^32-1 */
+ break;
+ }
+
+ /* prediction: portable variant using doubles if 64-bit values not available */
+#ifdef DUK_USE_64BIT_OPS
+ curr = (duk_uint32_t) ((((duk_uint64_t) curr) * ((duk_uint64_t) DUK__HASH_SIZE_RATIO)) >> 10);
+#else
+ /* 32-bit x 11-bit = 43-bit, fits accurately into a double */
+ curr = (duk_uint32_t) DUK_FLOOR(((double) curr) * ((double) DUK__HASH_SIZE_RATIO) / 1024.0);
+#endif
+
+ /* correction */
+ curr += t;
+
+ DUK_DDD(DUK_DDDPRINT("size=%ld, curr=%ld", (long) size, (long) curr));
+
+ if (curr >= size) {
+ return curr;
+ }
+ }
+ return 0;
+}
+
+#endif /* DUK_USE_HOBJECT_HASH_PART || DUK_USE_STRTAB_PROBE */
+#line 1 "duk_hobject_class.c"
+/*
+ * Hobject Ecmascript [[Class]].
+ */
+
+/* include removed: duk_internal.h */
+
+/* Maybe better to check these elsewhere */
+#if (DUK_STRIDX_UC_ARGUMENTS > 255)
+#error constant too large
+#endif
+#if (DUK_STRIDX_ARRAY > 255)
+#error constant too large
+#endif
+#if (DUK_STRIDX_UC_BOOLEAN > 255)
+#error constant too large
+#endif
+#if (DUK_STRIDX_DATE > 255)
+#error constant too large
+#endif
+#if (DUK_STRIDX_UC_ERROR > 255)
+#error constant too large
+#endif
+#if (DUK_STRIDX_UC_FUNCTION > 255)
+#error constant too large
+#endif
+#if (DUK_STRIDX_JSON > 255)
+#error constant too large
+#endif
+#if (DUK_STRIDX_MATH > 255)
+#error constant too large
+#endif
+#if (DUK_STRIDX_UC_NUMBER > 255)
+#error constant too large
+#endif
+#if (DUK_STRIDX_UC_OBJECT > 255)
+#error constant too large
+#endif
+#if (DUK_STRIDX_REG_EXP > 255)
+#error constant too large
+#endif
+#if (DUK_STRIDX_UC_STRING > 255)
+#error constant too large
+#endif
+#if (DUK_STRIDX_GLOBAL > 255)
+#error constant too large
+#endif
+#if (DUK_STRIDX_EMPTY_STRING > 255)
+#error constant too large
+#endif
+
+/* Note: assumes that these string indexes are 8-bit, genstrings.py must ensure that */
+DUK_INTERNAL duk_uint8_t duk_class_number_to_stridx[32] = {
+ DUK_STRIDX_EMPTY_STRING, /* UNUSED, intentionally empty */
+ DUK_STRIDX_UC_ARGUMENTS,
+ DUK_STRIDX_ARRAY,
+ DUK_STRIDX_UC_BOOLEAN,
+ DUK_STRIDX_DATE,
+ DUK_STRIDX_UC_ERROR,
+ DUK_STRIDX_UC_FUNCTION,
+ DUK_STRIDX_JSON,
+ DUK_STRIDX_MATH,
+ DUK_STRIDX_UC_NUMBER,
+ DUK_STRIDX_UC_OBJECT,
+ DUK_STRIDX_REG_EXP,
+ DUK_STRIDX_UC_STRING,
+ DUK_STRIDX_GLOBAL,
+ DUK_STRIDX_OBJ_ENV,
+ DUK_STRIDX_DEC_ENV,
+ DUK_STRIDX_UC_BUFFER,
+ DUK_STRIDX_UC_POINTER,
+ DUK_STRIDX_UC_THREAD, /* UNUSED, intentionally empty */
+ DUK_STRIDX_EMPTY_STRING, /* UNUSED, intentionally empty */
+ DUK_STRIDX_EMPTY_STRING, /* UNUSED, intentionally empty */
+ DUK_STRIDX_EMPTY_STRING, /* UNUSED, intentionally empty */
+ DUK_STRIDX_EMPTY_STRING, /* UNUSED, intentionally empty */
+ DUK_STRIDX_EMPTY_STRING, /* UNUSED, intentionally empty */
+ DUK_STRIDX_EMPTY_STRING, /* UNUSED, intentionally empty */
+ DUK_STRIDX_EMPTY_STRING, /* UNUSED, intentionally empty */
+ DUK_STRIDX_EMPTY_STRING, /* UNUSED, intentionally empty */
+ DUK_STRIDX_EMPTY_STRING, /* UNUSED, intentionally empty */
+ DUK_STRIDX_EMPTY_STRING, /* UNUSED, intentionally empty */
+ DUK_STRIDX_EMPTY_STRING, /* UNUSED, intentionally empty */
+ DUK_STRIDX_EMPTY_STRING, /* UNUSED, intentionally empty */
+ DUK_STRIDX_EMPTY_STRING, /* UNUSED, intentionally empty */
+};
+#line 1 "duk_alloc_default.c"
+/*
+ * Default allocation functions.
+ *
+ * Assumes behavior such as malloc allowing zero size, yielding
+ * a NULL or a unique pointer which is a no-op for free.
+ */
+
+/* include removed: duk_internal.h */
+
+DUK_INTERNAL void *duk_default_alloc_function(void *udata, duk_size_t size) {
+ void *res;
+ DUK_UNREF(udata);
+ res = DUK_ANSI_MALLOC(size);
+ DUK_DDD(DUK_DDDPRINT("default alloc function: %lu -> %p",
+ (unsigned long) size, (void *) res));
+ return res;
+}
+
+DUK_INTERNAL void *duk_default_realloc_function(void *udata, void *ptr, duk_size_t newsize) {
+ void *res;
+ DUK_UNREF(udata);
+ res = DUK_ANSI_REALLOC(ptr, newsize);
+ DUK_DDD(DUK_DDDPRINT("default realloc function: %p %lu -> %p",
+ (void *) ptr, (unsigned long) newsize, (void *) res));
+ return res;
+}
+
+DUK_INTERNAL void duk_default_free_function(void *udata, void *ptr) {
+ DUK_DDD(DUK_DDDPRINT("default free function: %p", (void *) ptr));
+ DUK_UNREF(udata);
+ DUK_ANSI_FREE(ptr);
+}
+#line 1 "duk_api_buffer.c"
+/*
+ * Buffer
+ */
+
+/* include removed: duk_internal.h */
+
+DUK_EXTERNAL void *duk_resize_buffer(duk_context *ctx, duk_idx_t index, duk_size_t new_size) {
+ duk_hthread *thr = (duk_hthread *) ctx;
+ duk_hbuffer_dynamic *h;
+
+ DUK_ASSERT(ctx != NULL);
+
+ h = (duk_hbuffer_dynamic *) duk_require_hbuffer(ctx, index);
+ DUK_ASSERT(h != NULL);
+
+ if (!DUK_HBUFFER_HAS_DYNAMIC(h)) {
+ DUK_ERROR(thr, DUK_ERR_TYPE_ERROR, DUK_STR_BUFFER_NOT_DYNAMIC);
+ }
+
+ /* maximum size check is handled by callee */
+ duk_hbuffer_resize(thr, h, new_size, new_size); /* snug */
+
+ return DUK_HBUFFER_DYNAMIC_GET_DATA_PTR(thr->heap, h);
+}
+#line 1 "duk_api_call.c"
+/*
+ * Calls.
+ *
+ * Protected variants should avoid ever throwing an error.
+ */
+
+/* include removed: duk_internal.h */
+
+/* Prepare value stack for a method call through an object property.
+ * May currently throw an error e.g. when getting the property.
+ */
+DUK_LOCAL void duk__call_prop_prep_stack(duk_context *ctx, duk_idx_t normalized_obj_index, duk_idx_t nargs) {
+ DUK_DDD(DUK_DDDPRINT("duk__call_prop_prep_stack, normalized_obj_index=%ld, nargs=%ld, stacktop=%ld",
+ (long) normalized_obj_index, (long) nargs, (long) duk_get_top(ctx)));
+
+ /* [... key arg1 ... argN] */
+
+ /* duplicate key */
+ duk_dup(ctx, -nargs - 1); /* Note: -nargs alone would fail for nargs == 0, this is OK */
+ duk_get_prop(ctx, normalized_obj_index);
+
+ DUK_DDD(DUK_DDDPRINT("func: %!T", (duk_tval *) duk_get_tval(ctx, -1)));
+
+ /* [... key arg1 ... argN func] */
+
+ duk_replace(ctx, -nargs - 2);
+
+ /* [... func arg1 ... argN] */
+
+ duk_dup(ctx, normalized_obj_index);
+ duk_insert(ctx, -nargs - 1);
+
+ /* [... func this arg1 ... argN] */
+}
+
+DUK_EXTERNAL void duk_call(duk_context *ctx, duk_idx_t nargs) {
+ duk_hthread *thr = (duk_hthread *) ctx;
+ duk_small_uint_t call_flags;
+ duk_idx_t idx_func;
+ duk_int_t rc;
+
+ DUK_ASSERT(ctx != NULL);
+ DUK_ASSERT(thr != NULL);
+
+ idx_func = duk_get_top(ctx) - nargs - 1;
+ if (idx_func < 0 || nargs < 0) {
+ /* note that we can't reliably pop anything here */
+ DUK_ERROR(thr, DUK_ERR_API_ERROR, DUK_STR_INVALID_CALL_ARGS);
+ }
+
+ /* XXX: awkward; we assume there is space for this, overwrite
+ * directly instead?
+ */
+ duk_push_undefined(ctx);
+ duk_insert(ctx, idx_func + 1);
+
+ call_flags = 0; /* not protected, respect reclimit, not constructor */
+
+ rc = duk_handle_call(thr, /* thread */
+ nargs, /* num_stack_args */
+ call_flags); /* call_flags */
+ DUK_UNREF(rc);
+}
+
+DUK_EXTERNAL void duk_call_method(duk_context *ctx, duk_idx_t nargs) {
+ duk_hthread *thr = (duk_hthread *) ctx;
+ duk_small_uint_t call_flags;
+ duk_idx_t idx_func;
+ duk_int_t rc;
+
+ DUK_ASSERT(ctx != NULL);
+ DUK_ASSERT(thr != NULL);
+
+ idx_func = duk_get_top(ctx) - nargs - 2; /* must work for nargs <= 0 */
+ if (idx_func < 0 || nargs < 0) {
+ /* note that we can't reliably pop anything here */
+ DUK_ERROR(thr, DUK_ERR_API_ERROR, DUK_STR_INVALID_CALL_ARGS);
+ }
+
+ call_flags = 0; /* not protected, respect reclimit, not constructor */
+
+ rc = duk_handle_call(thr, /* thread */
+ nargs, /* num_stack_args */
+ call_flags); /* call_flags */
+ DUK_UNREF(rc);
+}
+
+DUK_EXTERNAL void duk_call_prop(duk_context *ctx, duk_idx_t obj_index, duk_idx_t nargs) {
+ /*
+ * XXX: if duk_handle_call() took values through indices, this could be
+ * made much more sensible. However, duk_handle_call() needs to fudge
+ * the 'this' and 'func' values to handle bound function chains, which
+ * is now done "in-place", so this is not a trivial change.
+ */
+
+ obj_index = duk_require_normalize_index(ctx, obj_index); /* make absolute */
+
+ duk__call_prop_prep_stack(ctx, obj_index, nargs);
+
+ duk_call_method(ctx, nargs);
+}
+
+DUK_EXTERNAL duk_int_t duk_pcall(duk_context *ctx, duk_idx_t nargs) {
+ duk_hthread *thr = (duk_hthread *) ctx;
+ duk_small_uint_t call_flags;
+ duk_idx_t idx_func;
+ duk_int_t rc;
+
+ DUK_ASSERT(ctx != NULL);
+ DUK_ASSERT(thr != NULL);
+
+ idx_func = duk_get_top(ctx) - nargs - 1; /* must work for nargs <= 0 */
+ if (idx_func < 0 || nargs < 0) {
+ /* We can't reliably pop anything here because the stack input
+ * shape is incorrect. So we throw an error; if the caller has
+ * no catch point for this, a fatal error will occur. Another
+ * alternative would be to just return an error. But then the
+ * stack would be in an unknown state which might cause some
+ * very hard to diagnose problems later on. Also note that even
+ * if we did not throw an error here, the underlying call handler
+ * might STILL throw an out-of-memory error or some other internal
+ * fatal error.
+ */
+ DUK_ERROR(thr, DUK_ERR_API_ERROR, DUK_STR_INVALID_CALL_ARGS);
+ return DUK_EXEC_ERROR; /* unreachable */
+ }
+
+ /* awkward; we assume there is space for this */
+ duk_push_undefined(ctx);
+ duk_insert(ctx, idx_func + 1);
+
+ call_flags = DUK_CALL_FLAG_PROTECTED; /* protected, respect reclimit, not constructor */
+
+ rc = duk_handle_call(thr, /* thread */
+ nargs, /* num_stack_args */
+ call_flags); /* call_flags */
+
+ return rc;
+}
+
+DUK_EXTERNAL duk_int_t duk_pcall_method(duk_context *ctx, duk_idx_t nargs) {
+ duk_hthread *thr = (duk_hthread *) ctx;
+ duk_small_uint_t call_flags;
+ duk_idx_t idx_func;
+ duk_int_t rc;
+
+ DUK_ASSERT(ctx != NULL);
+ DUK_ASSERT(thr != NULL);
+
+ idx_func = duk_get_top(ctx) - nargs - 2; /* must work for nargs <= 0 */
+ if (idx_func < 0 || nargs < 0) {
+ /* See comments in duk_pcall(). */
+ DUK_ERROR(thr, DUK_ERR_API_ERROR, DUK_STR_INVALID_CALL_ARGS);
+ return DUK_EXEC_ERROR; /* unreachable */
+ }
+
+ call_flags = DUK_CALL_FLAG_PROTECTED; /* protected, respect reclimit, not constructor */
+
+ rc = duk_handle_call(thr, /* thread */
+ nargs, /* num_stack_args */
+ call_flags); /* call_flags */
+
+ return rc;
+}
+
+DUK_LOCAL duk_ret_t duk__pcall_prop_raw(duk_context *ctx) {
+ duk_idx_t obj_index;
+ duk_idx_t nargs;
+
+ /* Get the original arguments. Note that obj_index may be a relative
+ * index so the stack must have the same top when we use it.
+ */
+
+ obj_index = (duk_idx_t) duk_get_int(ctx, -2);
+ nargs = (duk_idx_t) duk_get_int(ctx, -1);
+ duk_pop_2(ctx);
+
+ obj_index = duk_require_normalize_index(ctx, obj_index); /* make absolute */
+ duk__call_prop_prep_stack(ctx, obj_index, nargs);
+ duk_call_method(ctx, nargs);
+ return 1;
+}
+
+DUK_EXTERNAL duk_int_t duk_pcall_prop(duk_context *ctx, duk_idx_t obj_index, duk_idx_t nargs) {
+ /*
+ * Must be careful to catch errors related to value stack manipulation
+ * and property lookup, not just the call itself.
+ */
+
+ duk_push_idx(ctx, obj_index);
+ duk_push_idx(ctx, nargs);
+
+ /* Inputs: explicit arguments (nargs), +1 for key, +2 for obj_index/nargs passing.
+ * If the value stack does not contain enough args, an error is thrown; this matches
+ * behavior of the other protected call API functions.
+ */
+ return duk_safe_call(ctx, duk__pcall_prop_raw, nargs + 1 + 2 /*nargs*/, 1 /*nrets*/);
+}
+
+DUK_EXTERNAL duk_int_t duk_safe_call(duk_context *ctx, duk_safe_call_function func, duk_idx_t nargs, duk_idx_t nrets) {
+ duk_hthread *thr = (duk_hthread *) ctx;
+ duk_int_t rc;
+
+ DUK_ASSERT(ctx != NULL);
+ DUK_ASSERT(thr != NULL);
+
+ if (duk_get_top(ctx) < nargs || nrets < 0) {
+ /* See comments in duk_pcall(). */
+ DUK_ERROR(thr, DUK_ERR_API_ERROR, DUK_STR_INVALID_CALL_ARGS);
+ return DUK_EXEC_ERROR; /* unreachable */
+ }
+
+ rc = duk_handle_safe_call(thr, /* thread */
+ func, /* func */
+ nargs, /* num_stack_args */
+ nrets); /* num_stack_res */
+
+ return rc;
+}
+
+DUK_EXTERNAL void duk_new(duk_context *ctx, duk_idx_t nargs) {
+ /*
+ * There are two [[Construct]] operations in the specification:
+ *
+ * - E5 Section 13.2.2: for Function objects
+ * - E5 Section 15.3.4.5.2: for "bound" Function objects
+ *
+ * The chain of bound functions is resolved in Section 15.3.4.5.2,
+ * with arguments "piling up" until the [[Construct]] internal
+ * method is called on the final, actual Function object. Note
+ * that the "prototype" property is looked up *only* from the
+ * final object, *before* calling the constructor.
+ *
+ * Currently we follow the bound function chain here to get the
+ * "prototype" property value from the final, non-bound function.
+ * However, we let duk_handle_call() handle the argument "piling"
+ * when the constructor is called. The bound function chain is
+ * thus now processed twice.
+ *
+ * When constructing new Array instances, an unnecessary object is
+ * created and discarded now: the standard [[Construct]] creates an
+ * object, and calls the Array constructor. The Array constructor
+ * returns an Array instance, which is used as the result value for
+ * the "new" operation; the object created before the Array constructor
+ * call is discarded.
+ *
+ * This would be easy to fix, e.g. by knowing that the Array constructor
+ * will always create a replacement object and skip creating the fallback
+ * object in that case.
+ *
+ * Note: functions called via "new" need to know they are called as a
+ * constructor. For instance, built-in constructors behave differently
+ * depending on how they are called.
+ */
+
+ /* XXX: merge this with duk_js_call.c, as this function implements
+ * core semantics (or perhaps merge the two files altogether).
+ */
+
+ duk_hthread *thr = (duk_hthread *) ctx;
+ duk_hobject *proto;
+ duk_hobject *cons;
+ duk_hobject *fallback;
+ duk_idx_t idx_cons;
+ duk_small_uint_t call_flags;
+ duk_int_t rc;
+
+ /* [... constructor arg1 ... argN] */
+
+ idx_cons = duk_require_normalize_index(ctx, -nargs - 1);
+
+ DUK_DDD(DUK_DDDPRINT("top=%ld, nargs=%ld, idx_cons=%ld",
+ (long) duk_get_top(ctx), (long) nargs, (long) idx_cons));
+
+ /* XXX: code duplication */
+
+ /*
+ * Figure out the final, non-bound constructor, to get "prototype"
+ * property.
+ */
+
+ duk_dup(ctx, idx_cons);
+ for (;;) {
+ cons = duk_get_hobject(ctx, -1);
+ if (cons == NULL || !DUK_HOBJECT_HAS_CONSTRUCTABLE(cons)) {
+ /* Checking constructability from anything else than the
+ * initial constructor is not strictly necessary, but a
+ * nice sanity check.
+ */
+ goto not_constructable;
+ }
+ if (!DUK_HOBJECT_HAS_BOUND(cons)) {
+ break;
+ }
+ duk_get_prop_stridx(ctx, -1, DUK_STRIDX_INT_TARGET); /* -> [... cons target] */
+ duk_remove(ctx, -2); /* -> [... target] */
+ }
+ DUK_ASSERT(cons != NULL && !DUK_HOBJECT_HAS_BOUND(cons));
+
+ /* [... constructor arg1 ... argN final_cons] */
+
+ /*
+ * Create "fallback" object to be used as the object instance,
+ * unless the constructor returns a replacement value.
+ * Its internal prototype needs to be set based on "prototype"
+ * property of the constructor.
+ */
+
+ duk_push_object(ctx); /* class Object, extensible */
+
+ /* [... constructor arg1 ... argN final_cons fallback] */
+
+ duk_get_prop_stridx(ctx, -2, DUK_STRIDX_PROTOTYPE);
+ proto = duk_get_hobject(ctx, -1);
+ if (!proto) {
+ DUK_DDD(DUK_DDDPRINT("constructor has no 'prototype' property, or value not an object "
+ "-> leave standard Object prototype as fallback prototype"));
+ } else {
+ DUK_DDD(DUK_DDDPRINT("constructor has 'prototype' property with object value "
+ "-> set fallback prototype to that value: %!iO", (duk_heaphdr *) proto));
+ fallback = duk_get_hobject(ctx, -2);
+ DUK_ASSERT(fallback != NULL);
+ DUK_HOBJECT_SET_PROTOTYPE_UPDREF(thr, fallback, proto);
+ }
+ duk_pop(ctx);
+
+ /* [... constructor arg1 ... argN final_cons fallback] */
+
+ /*
+ * Manipulate callstack for the call.
+ */
+
+ duk_dup_top(ctx);
+ duk_insert(ctx, idx_cons + 1); /* use fallback as 'this' value */
+ duk_insert(ctx, idx_cons); /* also stash it before constructor,
+ * in case we need it (as the fallback value)
+ */
+ duk_pop(ctx); /* pop final_cons */
+
+
+ /* [... fallback constructor fallback(this) arg1 ... argN];
+ * Note: idx_cons points to first 'fallback', not 'constructor'.
+ */
+
+ DUK_DDD(DUK_DDDPRINT("before call, idx_cons+1 (constructor) -> %!T, idx_cons+2 (fallback/this) -> %!T, "
+ "nargs=%ld, top=%ld",
+ (duk_tval *) duk_get_tval(ctx, idx_cons + 1),
+ (duk_tval *) duk_get_tval(ctx, idx_cons + 2),
+ (long) nargs,
+ (long) duk_get_top(ctx)));
+
+ /*
+ * Call the constructor function (called in "constructor mode").
+ */
+
+ call_flags = DUK_CALL_FLAG_CONSTRUCTOR_CALL; /* not protected, respect reclimit, is a constructor call */
+
+ rc = duk_handle_call(thr, /* thread */
+ nargs, /* num_stack_args */
+ call_flags); /* call_flags */
+ DUK_UNREF(rc);
+
+ /* [... fallback retval] */
+
+ DUK_DDD(DUK_DDDPRINT("constructor call finished, rc=%ld, fallback=%!iT, retval=%!iT",
+ (long) rc,
+ (duk_tval *) duk_get_tval(ctx, -2),
+ (duk_tval *) duk_get_tval(ctx, -1)));
+
+ /*
+ * Determine whether to use the constructor return value as the created
+ * object instance or not.
+ */
+
+ if (duk_is_object(ctx, -1)) {
+ duk_remove(ctx, -2);
+ } else {
+ duk_pop(ctx);
+ }
+
+ /*
+ * Augment created errors upon creation (not when they are thrown or
+ * rethrown). __FILE__ and __LINE__ are not desirable here; the call
+ * stack reflects the caller which is correct.
+ */
+
+#ifdef DUK_USE_AUGMENT_ERROR_CREATE
+ duk_err_augment_error_create(thr, thr, NULL, 0, 1 /*noblame_fileline*/);
+#endif
+
+ /* [... retval] */
+
+ return;
+
+ not_constructable:
+ DUK_ERROR(thr, DUK_ERR_TYPE_ERROR, DUK_STR_NOT_CONSTRUCTABLE);
+}
+
+DUK_EXTERNAL duk_bool_t duk_is_constructor_call(duk_context *ctx) {
+ duk_hthread *thr = (duk_hthread *) ctx;
+ duk_activation *act;
+
+ DUK_ASSERT(ctx != NULL);
+ DUK_ASSERT(thr != NULL);
+ DUK_ASSERT_DISABLE(thr->callstack_top >= 0);
+
+ act = duk_hthread_get_current_activation(thr);
+ DUK_ASSERT(act != NULL); /* because callstack_top > 0 */
+ return ((act->flags & DUK_ACT_FLAG_CONSTRUCT) != 0 ? 1 : 0);
+}
+
+DUK_EXTERNAL duk_bool_t duk_is_strict_call(duk_context *ctx) {
+ duk_hthread *thr = (duk_hthread *) ctx;
+ duk_activation *act;
+
+ /* For user code this could just return 1 (strict) always
+ * because all Duktape/C functions are considered strict,
+ * and strict is also the default when nothing is running.
+ * However, Duktape may call this function internally when
+ * the current activation is an Ecmascript function, so
+ * this cannot be replaced by a 'return 1' without fixing
+ * the internal call sites.
+ */
+
+ DUK_ASSERT(ctx != NULL);
+ DUK_ASSERT(thr != NULL);
+ DUK_ASSERT_DISABLE(thr->callstack_top >= 0);
+
+ act = duk_hthread_get_current_activation(thr);
+ if (act == NULL) {
+ /* Strict by default. */
+ return 1;
+ }
+ return ((act->flags & DUK_ACT_FLAG_STRICT) != 0 ? 1 : 0);
+}
+
+/*
+ * Duktape/C function magic
+ */
+
+DUK_EXTERNAL duk_int_t duk_get_current_magic(duk_context *ctx) {
+ duk_hthread *thr = (duk_hthread *) ctx;
+ duk_activation *act;
+ duk_hobject *func;
+
+ DUK_ASSERT(ctx != NULL);
+ DUK_ASSERT(thr != NULL);
+ DUK_ASSERT_DISABLE(thr->callstack_top >= 0);
+
+ act = duk_hthread_get_current_activation(thr);
+ if (act) {
+ func = DUK_ACT_GET_FUNC(act);
+ if (!func) {
+ duk_tval *tv = &act->tv_func;
+ duk_small_uint_t lf_flags;
+ lf_flags = DUK_TVAL_GET_LIGHTFUNC_FLAGS(tv);
+ return (duk_int_t) DUK_LFUNC_FLAGS_GET_MAGIC(lf_flags);
+ }
+ DUK_ASSERT(func != NULL);
+
+ if (DUK_HOBJECT_IS_NATIVEFUNCTION(func)) {
+ duk_hnativefunction *nf = (duk_hnativefunction *) func;
+ return (duk_int_t) nf->magic;
+ }
+ }
+ return 0;
+}
+
+DUK_EXTERNAL duk_int_t duk_get_magic(duk_context *ctx, duk_idx_t index) {
+ duk_hthread *thr = (duk_hthread *) ctx;
+ duk_tval *tv;
+ duk_hobject *h;
+
+ DUK_ASSERT(ctx != NULL);
+
+ tv = duk_require_tval(ctx, index);
+ if (DUK_TVAL_IS_OBJECT(tv)) {
+ h = DUK_TVAL_GET_OBJECT(tv);
+ DUK_ASSERT(h != NULL);
+ if (!DUK_HOBJECT_HAS_NATIVEFUNCTION(h)) {
+ goto type_error;
+ }
+ return (duk_int_t) ((duk_hnativefunction *) h)->magic;
+ } else if (DUK_TVAL_IS_LIGHTFUNC(tv)) {
+ duk_small_uint_t lf_flags = DUK_TVAL_GET_LIGHTFUNC_FLAGS(tv);
+ return (duk_int_t) DUK_LFUNC_FLAGS_GET_MAGIC(lf_flags);
+ }
+
+ /* fall through */
+ type_error:
+ DUK_ERROR(thr, DUK_ERR_TYPE_ERROR, DUK_STR_UNEXPECTED_TYPE);
+ return 0;
+}
+
+DUK_EXTERNAL void duk_set_magic(duk_context *ctx, duk_idx_t index, duk_int_t magic) {
+ duk_hnativefunction *nf;
+
+ DUK_ASSERT(ctx != NULL);
+
+ nf = duk_require_hnativefunction(ctx, index);
+ DUK_ASSERT(nf != NULL);
+ nf->magic = (duk_int16_t) magic;
+}
+#line 1 "duk_api_codec.c"
+/*
+ * Encoding and decoding basic formats: hex, base64.
+ *
+ * These are in-place operations which may allow an optimized implementation.
+ */
+
+/* include removed: duk_internal.h */
+
+/* dst length must be exactly ceil(len/3)*4 */
+DUK_LOCAL void duk__base64_encode_helper(const duk_uint8_t *src, const duk_uint8_t *src_end,
+ duk_uint8_t *dst, duk_uint8_t *dst_end) {
+ duk_small_uint_t i, snip;
+ duk_uint_fast32_t t;
+ duk_uint_fast8_t x, y;
+
+ DUK_UNREF(dst_end);
+
+ while (src < src_end) {
+ /* read 3 bytes into 't', padded by zero */
+ snip = 4;
+ t = 0;
+ for (i = 0; i < 3; i++) {
+ t = t << 8;
+ if (src >= src_end) {
+ snip--;
+ } else {
+ t += (duk_uint_fast32_t) (*src++);
+ }
+ }
+
+ /*
+ * Missing bytes snip base64 example
+ * 0 4 XXXX
+ * 1 3 XXX=
+ * 2 2 XX==
+ */
+
+ DUK_ASSERT(snip >= 2 && snip <= 4);
+
+ for (i = 0; i < 4; i++) {
+ x = (duk_uint_fast8_t) ((t >> 18) & 0x3f);
+ t = t << 6;
+
+ /* A straightforward 64-byte lookup would be faster
+ * and cleaner, but this is shorter.
+ */
+ if (i >= snip) {
+ y = '=';
+ } else if (x <= 25) {
+ y = x + 'A';
+ } else if (x <= 51) {
+ y = x - 26 + 'a';
+ } else if (x <= 61) {
+ y = x - 52 + '0';
+ } else if (x == 62) {
+ y = '+';
+ } else {
+ y = '/';
+ }
+
+ DUK_ASSERT(dst < dst_end);
+ *dst++ = (duk_uint8_t) y;
+ }
+ }
+}
+
+DUK_LOCAL duk_bool_t duk__base64_decode_helper(const duk_uint8_t *src, const duk_uint8_t *src_end,
+ duk_uint8_t *dst, duk_uint8_t *dst_end, duk_uint8_t **out_dst_final) {
+ duk_uint_fast32_t t;
+ duk_uint_fast8_t x, y;
+ duk_small_uint_t group_idx;
+
+ DUK_UNREF(dst_end);
+
+ t = 0;
+ group_idx = 0;
+
+ while (src < src_end) {
+ x = *src++;
+
+ if (x >= 'A' && x <= 'Z') {
+ y = x - 'A' + 0;
+ } else if (x >= 'a' && x <= 'z') {
+ y = x - 'a' + 26;
+ } else if (x >= '0' && x <= '9') {
+ y = x - '0' + 52;
+ } else if (x == '+') {
+ y = 62;
+ } else if (x == '/') {
+ y = 63;
+ } else if (x == '=') {
+ /* We don't check the zero padding bytes here right now.
+ * This seems to be common behavior for base-64 decoders.
+ */
+
+ if (group_idx == 2) {
+ /* xx== -> 1 byte, t contains 12 bits, 4 on right are zero */
+ t = t >> 4;
+ DUK_ASSERT(dst < dst_end);
+ *dst++ = (duk_uint8_t) t;
+
+ if (src >= src_end) {
+ goto error;
+ }
+ x = *src++;
+ if (x != '=') {
+ goto error;
+ }
+ } else if (group_idx == 3) {
+ /* xxx= -> 2 bytes, t contains 18 bits, 2 on right are zero */
+ t = t >> 2;
+ DUK_ASSERT(dst < dst_end);
+ *dst++ = (duk_uint8_t) ((t >> 8) & 0xff);
+ DUK_ASSERT(dst < dst_end);
+ *dst++ = (duk_uint8_t) (t & 0xff);
+ } else {
+ goto error;
+ }
+
+ /* Here we can choose either to end parsing and ignore
+ * whatever follows, or to continue parsing in case
+ * multiple (possibly padded) base64 strings have been
+ * concatenated. Currently, keep on parsing.
+ */
+ t = 0;
+ group_idx = 0;
+ continue;
+ } else if (x == 0x09 || x == 0x0a || x == 0x0d || x == 0x20) {
+ /* allow basic ASCII whitespace */
+ continue;
+ } else {
+ goto error;
+ }
+
+ t = (t << 6) + y;
+
+ if (group_idx == 3) {
+ /* output 3 bytes from 't' */
+ DUK_ASSERT(dst < dst_end);
+ *dst++ = (duk_uint8_t) ((t >> 16) & 0xff);
+ DUK_ASSERT(dst < dst_end);
+ *dst++ = (duk_uint8_t) ((t >> 8) & 0xff);
+ DUK_ASSERT(dst < dst_end);
+ *dst++ = (duk_uint8_t) (t & 0xff);
+ t = 0;
+ group_idx = 0;
+ } else {
+ group_idx++;
+ }
+ }
+
+ if (group_idx != 0) {
+ /* Here we'd have the option of decoding unpadded base64
+ * (e.g. "xxxxyy" instead of "xxxxyy==". Currently not
+ * accepted.
+ */
+ goto error;
+ }
+
+ *out_dst_final = dst;
+ return 1;
+
+ error:
+ return 0;
+}
+
+/* Shared handling for encode/decode argument. Fast path handling for
+ * buffer and string values because they're the most common. In particular,
+ * avoid creating a temporary string or buffer when possible.
+ */
+DUK_LOCAL const duk_uint8_t *duk__prep_codec_arg(duk_context *ctx, duk_idx_t index, duk_size_t *out_len) {
+ DUK_ASSERT(duk_is_valid_index(ctx, index)); /* checked by caller */
+ if (duk_is_buffer(ctx, index)) {
+ return (const duk_uint8_t *) duk_get_buffer(ctx, index, out_len);
+ } else {
+ return (const duk_uint8_t *) duk_to_lstring(ctx, index, out_len);
+ }
+}
+
+DUK_EXTERNAL const char *duk_base64_encode(duk_context *ctx, duk_idx_t index) {
+ duk_hthread *thr = (duk_hthread *) ctx;
+ duk_uint8_t *src;
+ duk_size_t srclen;
+ duk_size_t dstlen;
+ duk_uint8_t *dst;
+ const char *ret;
+
+ /* XXX: optimize for string inputs: no need to coerce to a buffer
+ * which makes a copy of the input.
+ */
+
+ index = duk_require_normalize_index(ctx, index);
+ src = (duk_uint8_t *) duk_to_buffer(ctx, index, &srclen);
+ /* Note: for srclen=0, src may be NULL */
+
+ /* Computation must not wrap; this limit works for 32-bit size_t:
+ * >>> srclen = 3221225469
+ * >>> '%x' % ((srclen + 2) / 3 * 4)
+ * 'fffffffc'
+ */
+ if (srclen > 3221225469UL) {
+ goto type_error;
+ }
+ dstlen = (srclen + 2) / 3 * 4;
+ dst = (duk_uint8_t *) duk_push_fixed_buffer(ctx, dstlen);
+
+ duk__base64_encode_helper((const duk_uint8_t *) src, (const duk_uint8_t *) (src + srclen),
+ dst, (dst + dstlen));
+
+ ret = duk_to_string(ctx, -1);
+ duk_replace(ctx, index);
+ return ret;
+
+ type_error:
+ DUK_ERROR(thr, DUK_ERR_TYPE_ERROR, DUK_STR_BASE64_ENCODE_FAILED);
+ return NULL; /* never here */
+}
+
+DUK_EXTERNAL void duk_base64_decode(duk_context *ctx, duk_idx_t index) {
+ duk_hthread *thr = (duk_hthread *) ctx;
+ const duk_uint8_t *src;
+ duk_size_t srclen;
+ duk_size_t dstlen;
+ duk_uint8_t *dst;
+ duk_uint8_t *dst_final;
+ duk_bool_t retval;
+
+ /* XXX: optimize for buffer inputs: no need to coerce to a string
+ * which causes an unnecessary interning.
+ */
+
+ index = duk_require_normalize_index(ctx, index);
+ src = (const duk_uint8_t *) duk_to_lstring(ctx, index, &srclen);
+
+ /* Computation must not wrap, only srclen + 3 is at risk of
+ * wrapping because after that the number gets smaller.
+ * This limit works for 32-bit size_t:
+ * 0x100000000 - 3 - 1 = 4294967292
+ */
+ if (srclen > 4294967292UL) {
+ goto type_error;
+ }
+ dstlen = (srclen + 3) / 4 * 3; /* upper limit */
+ dst = (duk_uint8_t *) duk_push_dynamic_buffer(ctx, dstlen);
+ /* Note: for dstlen=0, dst may be NULL */
+
+ retval = duk__base64_decode_helper((const duk_uint8_t *) src, (const duk_uint8_t *) (src + srclen),
+ dst, dst + dstlen, &dst_final);
+ if (!retval) {
+ goto type_error;
+ }
+
+ /* XXX: convert to fixed buffer? */
+ (void) duk_resize_buffer(ctx, -1, (duk_size_t) (dst_final - dst));
+ duk_replace(ctx, index);
+ return;
+
+ type_error:
+ DUK_ERROR(thr, DUK_ERR_TYPE_ERROR, DUK_STR_BASE64_DECODE_FAILED);
+}
+
+DUK_EXTERNAL const char *duk_hex_encode(duk_context *ctx, duk_idx_t index) {
+ const duk_uint8_t *inp;
+ duk_size_t len;
+ duk_size_t i;
+ duk_small_uint_t t;
+ duk_uint8_t *buf;
+ const char *ret;
+
+ index = duk_require_normalize_index(ctx, index);
+ inp = duk__prep_codec_arg(ctx, index, &len);
+ DUK_ASSERT(inp != NULL || len == 0);
+
+ /* Fixed buffer, no zeroing because we'll fill all the data. */
+ buf = (duk_uint8_t *) duk_push_buffer_raw(ctx, len * 2, DUK_BUF_FLAG_NOZERO /*flags*/);
+ DUK_ASSERT(buf != NULL);
+
+ for (i = 0; i < len; i++) {
+ /* XXX: by using two 256-entry tables could avoid shifting and masking. */
+ t = (duk_small_uint_t) inp[i];
+ buf[i*2 + 0] = duk_lc_digits[t >> 4];
+ buf[i*2 + 1] = duk_lc_digits[t & 0x0f];
+ }
+
+ /* XXX: Using a string return value forces a string intern which is
+ * not always necessary. As a rough performance measure, hex encode
+ * time for perf-testcases/test-hex-encode.js dropped from ~35s to
+ * ~15s without string coercion. Change to returning a buffer and
+ * let the caller coerce to string if necessary?
+ */
+
+ ret = duk_to_string(ctx, -1);
+ duk_replace(ctx, index);
+ return ret;
+}
+
+DUK_EXTERNAL void duk_hex_decode(duk_context *ctx, duk_idx_t index) {
+ duk_hthread *thr = (duk_hthread *) ctx;
+ const duk_uint8_t *inp;
+ duk_size_t len;
+ duk_size_t i;
+ duk_small_int_t t;
+ duk_uint8_t *buf;
+
+ index = duk_require_normalize_index(ctx, index);
+ inp = duk__prep_codec_arg(ctx, index, &len);
+ DUK_ASSERT(inp != NULL || len == 0);
+
+ if (len & 0x01) {
+ goto type_error;
+ }
+
+ /* Fixed buffer, no zeroing because we'll fill all the data. */
+ buf = (duk_uint8_t *) duk_push_buffer_raw(ctx, len / 2, DUK_BUF_FLAG_NOZERO /*flags*/);
+ DUK_ASSERT(buf != NULL);
+
+ for (i = 0; i < len; i += 2) {
+ /* For invalid characters the value -1 gets extended to
+ * at least 16 bits. If either nybble is invalid, the
+ * resulting 't' will be < 0.
+ */
+ t = (((duk_small_int_t) duk_hex_dectab[inp[i]]) << 4) |
+ ((duk_small_int_t) duk_hex_dectab[inp[i + 1]]);
+ if (DUK_UNLIKELY(t < 0)) {
+ goto type_error;
+ }
+ buf[i >> 1] = (duk_uint8_t) t;
+ }
+
+ duk_replace(ctx, index);
+ return;
+
+ type_error:
+ DUK_ERROR(thr, DUK_ERR_TYPE_ERROR, DUK_STR_HEX_DECODE_FAILED);
+}
+
+DUK_EXTERNAL const char *duk_json_encode(duk_context *ctx, duk_idx_t index) {
+#ifdef DUK_USE_ASSERTIONS
+ duk_idx_t top_at_entry = duk_get_top(ctx);
+#endif
+ const char *ret;
+
+ index = duk_require_normalize_index(ctx, index);
+ duk_bi_json_stringify_helper(ctx,
+ index /*idx_value*/,
+ DUK_INVALID_INDEX /*idx_replacer*/,
+ DUK_INVALID_INDEX /*idx_space*/,
+ 0 /*flags*/);
+ DUK_ASSERT(duk_is_string(ctx, -1));
+ duk_replace(ctx, index);
+ ret = duk_get_string(ctx, index);
+
+ DUK_ASSERT(duk_get_top(ctx) == top_at_entry);
+
+ return ret;
+}
+
+DUK_EXTERNAL void duk_json_decode(duk_context *ctx, duk_idx_t index) {
+#ifdef DUK_USE_ASSERTIONS
+ duk_idx_t top_at_entry = duk_get_top(ctx);
+#endif
+
+ index = duk_require_normalize_index(ctx, index);
+ duk_bi_json_parse_helper(ctx,
+ index /*idx_value*/,
+ DUK_INVALID_INDEX /*idx_reviver*/,
+ 0 /*flags*/);
+ duk_replace(ctx, index);
+
+ DUK_ASSERT(duk_get_top(ctx) == top_at_entry);
+}
+#line 1 "duk_api_compile.c"
+/*
+ * Compilation and evaluation
+ */
+
+/* include removed: duk_internal.h */
+
+typedef struct duk__compile_raw_args duk__compile_raw_args;
+struct duk__compile_raw_args {
+ duk_size_t src_length; /* should be first on 64-bit platforms */
+ const duk_uint8_t *src_buffer;
+ duk_uint_t flags;
+};
+
+/* Eval is just a wrapper now. */
+DUK_EXTERNAL duk_int_t duk_eval_raw(duk_context *ctx, const char *src_buffer, duk_size_t src_length, duk_uint_t flags) {
+ duk_uint_t comp_flags;
+ duk_int_t rc;
+
+ /* Note: strictness is *not* inherited from the current Duktape/C.
+ * This would be confusing because the current strictness state
+ * depends on whether we're running inside a Duktape/C activation
+ * (= strict mode) or outside of any activation (= non-strict mode).
+ * See api-testcases/test-eval-strictness.c for more discussion.
+ */
+
+ /* [ ... source? filename ] (depends on flags) */
+
+ comp_flags = flags;
+ comp_flags |= DUK_COMPILE_EVAL;
+ rc = duk_compile_raw(ctx, src_buffer, src_length, comp_flags); /* may be safe, or non-safe depending on flags */
+
+ /* [ ... closure/error ] */
+
+ if (rc != DUK_EXEC_SUCCESS) {
+ rc = DUK_EXEC_ERROR;
+ goto got_rc;
+ }
+
+ if (flags & DUK_COMPILE_SAFE) {
+ rc = duk_pcall(ctx, 0);
+ } else {
+ duk_call(ctx, 0);
+ rc = DUK_EXEC_SUCCESS;
+ }
+
+ /* [ ... result/error ] */
+
+ got_rc:
+ if (flags & DUK_COMPILE_NORESULT) {
+ duk_pop(ctx);
+ }
+
+ return rc;
+}
+
+/* Helper which can be called both directly and with duk_safe_call(). */
+DUK_LOCAL duk_ret_t duk__do_compile(duk_context *ctx) {
+ duk_hthread *thr = (duk_hthread *) ctx;
+ duk__compile_raw_args *comp_args;
+ duk_uint_t flags;
+ duk_small_uint_t comp_flags;
+ duk_hcompiledfunction *h_templ;
+
+ /* Note: strictness is not inherited from the current Duktape/C
+ * context. Otherwise it would not be possible to compile
+ * non-strict code inside a Duktape/C activation (which is
+ * always strict now). See api-testcases/test-eval-strictness.c
+ * for discussion.
+ */
+
+ /* [ ... source? filename &comp_args ] (depends on flags) */
+
+ comp_args = (duk__compile_raw_args *) duk_require_pointer(ctx, -1);
+ flags = comp_args->flags;
+ duk_pop(ctx);
+
+ /* [ ... source? filename ] */
+
+ if (!comp_args->src_buffer) {
+ duk_hstring *h_sourcecode;
+
+ h_sourcecode = duk_get_hstring(ctx, -2);
+ if ((flags & DUK_COMPILE_NOSOURCE) || /* args incorrect */
+ (h_sourcecode == NULL)) { /* e.g. duk_push_file_string_raw() pushed undefined */
+ /* XXX: when this error is caused by a nonexistent
+ * file given to duk_peval_file() or similar, the
+ * error message is not the best possible.
+ */
+ DUK_ERROR(thr, DUK_ERR_API_ERROR, DUK_STR_NO_SOURCECODE);
+ }
+ DUK_ASSERT(h_sourcecode != NULL);
+ comp_args->src_buffer = (const duk_uint8_t *) DUK_HSTRING_GET_DATA(h_sourcecode);
+ comp_args->src_length = (duk_size_t) DUK_HSTRING_GET_BYTELEN(h_sourcecode);
+ }
+ DUK_ASSERT(comp_args->src_buffer != NULL);
+
+ /* XXX: unnecessary translation of flags */
+ comp_flags = 0;
+ if (flags & DUK_COMPILE_EVAL) {
+ comp_flags |= DUK_JS_COMPILE_FLAG_EVAL;
+ }
+ if (flags & DUK_COMPILE_FUNCTION) {
+ comp_flags |= DUK_JS_COMPILE_FLAG_EVAL |
+ DUK_JS_COMPILE_FLAG_FUNCEXPR;
+ }
+ if (flags & DUK_COMPILE_STRICT) {
+ comp_flags |= DUK_JS_COMPILE_FLAG_STRICT;
+ }
+
+ /* [ ... source? filename ] */
+
+ duk_js_compile(thr, comp_args->src_buffer, comp_args->src_length, comp_flags);
+
+ /* [ ... source? func_template ] */
+
+ if (flags & DUK_COMPILE_NOSOURCE) {
+ ;
+ } else {
+ duk_remove(ctx, -2);
+ }
+
+ /* [ ... func_template ] */
+
+ h_templ = (duk_hcompiledfunction *) duk_get_hobject(ctx, -1);
+ DUK_ASSERT(h_templ != NULL);
+ duk_js_push_closure(thr,
+ h_templ,
+ thr->builtins[DUK_BIDX_GLOBAL_ENV],
+ thr->builtins[DUK_BIDX_GLOBAL_ENV]);
+ duk_remove(ctx, -2); /* -> [ ... closure ] */
+
+ /* [ ... closure ] */
+
+ return 1;
+}
+
+DUK_EXTERNAL duk_int_t duk_compile_raw(duk_context *ctx, const char *src_buffer, duk_size_t src_length, duk_uint_t flags) {
+ duk__compile_raw_args comp_args_alloc;
+ duk__compile_raw_args *comp_args = &comp_args_alloc;
+
+ if ((flags & DUK_COMPILE_STRLEN) && (src_buffer != NULL)) {
+ /* String length is computed here to avoid multiple evaluation
+ * of a macro argument in the calling side.
+ */
+ src_length = DUK_STRLEN(src_buffer);
+ }
+
+ comp_args->src_buffer = (const duk_uint8_t *) src_buffer;
+ comp_args->src_length = src_length;
+ comp_args->flags = flags;
+ duk_push_pointer(ctx, (void *) comp_args);
+
+ /* [ ... source? filename &comp_args ] (depends on flags) */
+
+ if (flags & DUK_COMPILE_SAFE) {
+ duk_int_t rc;
+ duk_int_t nargs;
+ duk_int_t nrets = 1;
+
+ /* Arguments are either: [ filename &comp_args ] or [ source filename &comp_args ] */
+ nargs = (flags & DUK_COMPILE_NOSOURCE) ? 2 : 3;
+ rc = duk_safe_call(ctx, duk__do_compile, nargs, nrets);
+
+ /* [ ... closure ] */
+ return rc;
+ }
+
+ (void) duk__do_compile(ctx);
+
+ /* [ ... closure ] */
+ return DUK_EXEC_SUCCESS;
+}
+#line 1 "duk_api_debug.c"
+/*
+ * Debugging related API calls
+ */
+
+/* include removed: duk_internal.h */
+
+DUK_EXTERNAL void duk_push_context_dump(duk_context *ctx) {
+ duk_idx_t idx;
+ duk_idx_t top;
+
+ /* We don't duk_require_stack() here now, but rely on the caller having
+ * enough space.
+ */
+
+ top = duk_get_top(ctx);
+ duk_push_array(ctx);
+ for (idx = 0; idx < top; idx++) {
+ duk_dup(ctx, idx);
+ duk_put_prop_index(ctx, -2, idx);
+ }
+
+ /* XXX: conversion errors should not propagate outwards.
+ * Perhaps values need to be coerced individually?
+ */
+ duk_bi_json_stringify_helper(ctx,
+ duk_get_top_index(ctx), /*idx_value*/
+ DUK_INVALID_INDEX, /*idx_replacer*/
+ DUK_INVALID_INDEX, /*idx_space*/
+ DUK_JSON_FLAG_EXT_CUSTOM |
+ DUK_JSON_FLAG_ASCII_ONLY |
+ DUK_JSON_FLAG_AVOID_KEY_QUOTES /*flags*/);
+
+ duk_push_sprintf(ctx, "ctx: top=%ld, stack=%s", (long) top, (const char *) duk_safe_to_string(ctx, -1));
+ duk_replace(ctx, -3); /* [ ... arr jsonx(arr) res ] -> [ ... res jsonx(arr) ] */
+ duk_pop(ctx);
+ DUK_ASSERT(duk_is_string(ctx, -1));
+}
+
+#if defined(DUK_USE_DEBUGGER_SUPPORT)
+
+DUK_EXTERNAL void duk_debugger_attach(duk_context *ctx,
+ duk_debug_read_function read_cb,
+ duk_debug_write_function write_cb,
+ duk_debug_peek_function peek_cb,
+ duk_debug_read_flush_function read_flush_cb,
+ duk_debug_write_flush_function write_flush_cb,
+ duk_debug_detached_function detached_cb,
+ void *udata) {
+ duk_hthread *thr = (duk_hthread *) ctx;
+ duk_heap *heap;
+ const char *str;
+ duk_size_t len;
+
+ DUK_ASSERT(ctx != NULL);
+ DUK_ASSERT(read_cb != NULL);
+ DUK_ASSERT(write_cb != NULL);
+ /* Other callbacks are optional. */
+
+ heap = thr->heap;
+ heap->dbg_read_cb = read_cb;
+ heap->dbg_write_cb = write_cb;
+ heap->dbg_peek_cb = peek_cb;
+ heap->dbg_read_flush_cb = read_flush_cb;
+ heap->dbg_write_flush_cb = write_flush_cb;
+ heap->dbg_detached_cb = detached_cb;
+ heap->dbg_udata = udata;
+
+ /* Start in paused state. */
+ heap->dbg_processing = 0;
+ heap->dbg_paused = 1;
+ heap->dbg_state_dirty = 1;
+ heap->dbg_step_type = 0;
+ heap->dbg_step_thread = NULL;
+ heap->dbg_step_csindex = 0;
+ heap->dbg_step_startline = 0;
+ heap->dbg_exec_counter = 0;
+ heap->dbg_last_counter = 0;
+ heap->dbg_last_time = 0.0;
+
+ /* Send version identification and flush right afterwards. Note that
+ * we must write raw, unframed bytes here.
+ */
+ duk_push_sprintf(ctx, "%ld %ld %s %s\n",
+ (long) DUK_DEBUG_PROTOCOL_VERSION,
+ (long) DUK_VERSION,
+ (const char *) DUK_GIT_DESCRIBE,
+ (const char *) DUK_USE_TARGET_INFO);
+ str = duk_get_lstring(ctx, -1, &len);
+ DUK_ASSERT(str != NULL);
+ duk_debug_write_bytes(thr, (const duk_uint8_t *) str, len);
+ duk_debug_write_flush(thr);
+ duk_pop(ctx);
+}
+
+DUK_EXTERNAL void duk_debugger_detach(duk_context *ctx) {
+ duk_hthread *thr;
+
+ thr = (duk_hthread *) ctx;
+ DUK_ASSERT(ctx != NULL);
+ DUK_ASSERT(thr != NULL);
+ DUK_ASSERT(thr->heap != NULL);
+
+ /* Can be called muliple times with no harm. */
+ duk_debug_do_detach(thr->heap);
+}
+
+DUK_EXTERNAL void duk_debugger_cooperate(duk_context *ctx) {
+ duk_hthread *thr;
+ duk_bool_t processed_messages;
+
+ thr = (duk_hthread *) ctx;
+ DUK_ASSERT(ctx != NULL);
+ DUK_ASSERT(thr != NULL);
+ DUK_ASSERT(thr->heap != NULL);
+
+ if (!DUK_HEAP_IS_DEBUGGER_ATTACHED(thr->heap)) {
+ return;
+ }
+ if (thr->callstack_top > 0 || thr->heap->dbg_processing) {
+ /* Calling duk_debugger_cooperate() while Duktape is being
+ * called into is not supported. This is not a 100% check
+ * but prevents any damage in most cases.
+ */
+ return;
+ }
+
+ thr->heap->dbg_processing = 1;
+ processed_messages = duk_debug_process_messages(thr, 1 /*no_block*/);
+ thr->heap->dbg_processing = 0;
+ DUK_UNREF(processed_messages);
+}
+
+#else /* DUK_USE_DEBUGGER_SUPPORT */
+
+DUK_EXTERNAL void duk_debugger_attach(duk_context *ctx,
+ duk_debug_read_function read_cb,
+ duk_debug_write_function write_cb,
+ duk_debug_peek_function peek_cb,
+ duk_debug_read_flush_function read_flush_cb,
+ duk_debug_write_flush_function write_flush_cb,
+ duk_debug_detached_function detached_cb,
+ void *udata) {
+ DUK_UNREF(read_cb);
+ DUK_UNREF(write_cb);
+ DUK_UNREF(peek_cb);
+ DUK_UNREF(read_flush_cb);
+ DUK_UNREF(write_flush_cb);
+ DUK_UNREF(detached_cb);
+ DUK_UNREF(udata);
+ duk_error(ctx, DUK_ERR_API_ERROR, "no debugger support");
+}
+
+DUK_EXTERNAL void duk_debugger_detach(duk_context *ctx) {
+ duk_error(ctx, DUK_ERR_API_ERROR, "no debugger support");
+}
+
+DUK_EXTERNAL void duk_debugger_cooperate(duk_context *ctx) {
+ /* nop */
+ DUK_UNREF(ctx);
+}
+
+#endif /* DUK_USE_DEBUGGER_SUPPORT */
+#line 1 "duk_api_heap.c"
+/*
+ * Heap creation and destruction
+ */
+
+/* include removed: duk_internal.h */
+
+DUK_EXTERNAL
+duk_context *duk_create_heap(duk_alloc_function alloc_func,
+ duk_realloc_function realloc_func,
+ duk_free_function free_func,
+ void *heap_udata,
+ duk_fatal_function fatal_handler) {
+ duk_heap *heap = NULL;
+ duk_context *ctx;
+
+ /* Assume that either all memory funcs are NULL or non-NULL, mixed
+ * cases will now be unsafe.
+ */
+
+ /* XXX: just assert non-NULL values here and make caller arguments
+ * do the defaulting to the default implementations (smaller code)?
+ */
+
+ if (!alloc_func) {
+ DUK_ASSERT(realloc_func == NULL);
+ DUK_ASSERT(free_func == NULL);
+ alloc_func = duk_default_alloc_function;
+ realloc_func = duk_default_realloc_function;
+ free_func = duk_default_free_function;
+ } else {
+ DUK_ASSERT(realloc_func != NULL);
+ DUK_ASSERT(free_func != NULL);
+ }
+
+ if (!fatal_handler) {
+ fatal_handler = duk_default_fatal_handler;
+ }
+
+ DUK_ASSERT(alloc_func != NULL);
+ DUK_ASSERT(realloc_func != NULL);
+ DUK_ASSERT(free_func != NULL);
+ DUK_ASSERT(fatal_handler != NULL);
+
+ heap = duk_heap_alloc(alloc_func, realloc_func, free_func, heap_udata, fatal_handler);
+ if (!heap) {
+ return NULL;
+ }
+ ctx = (duk_context *) heap->heap_thread;
+ DUK_ASSERT(ctx != NULL);
+ DUK_ASSERT(((duk_hthread *) ctx)->heap != NULL);
+ return ctx;
+}
+
+DUK_EXTERNAL void duk_destroy_heap(duk_context *ctx) {
+ duk_hthread *thr = (duk_hthread *) ctx;
+ duk_heap *heap;
+
+ if (!ctx) {
+ return;
+ }
+ heap = thr->heap;
+ DUK_ASSERT(heap != NULL);
+
+ duk_heap_free(heap);
+}
+
+/* XXX: better place for this */
+DUK_EXTERNAL void duk_set_global_object(duk_context *ctx) {
+ duk_hthread *thr = (duk_hthread *) ctx;
+ duk_hobject *h_glob;
+ duk_hobject *h_prev_glob;
+ duk_hobject *h_env;
+ duk_hobject *h_prev_env;
+
+ DUK_D(DUK_DPRINT("replace global object with: %!T", duk_get_tval(ctx, -1)));
+
+ h_glob = duk_require_hobject(ctx, -1);
+ DUK_ASSERT(h_glob != NULL);
+
+ /*
+ * Replace global object.
+ */
+
+ h_prev_glob = thr->builtins[DUK_BIDX_GLOBAL];
+ thr->builtins[DUK_BIDX_GLOBAL] =