summaryrefslogtreecommitdiff
path: root/javascript/duktape/duktape.h
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2015-10-31 17:48:18 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2015-10-31 17:51:57 +0000
commitc22706b9049c4c85205a8cc9a3dc72a4e4a52be5 (patch)
treef47a6325e859cbe4c83cf3dff42af85417e7c08a /javascript/duktape/duktape.h
parent3aacba15f821f8d7902473cff93bc506bad3b547 (diff)
downloadnetsurf-c22706b9049c4c85205a8cc9a3dc72a4e4a52be5.tar.gz
netsurf-c22706b9049c4c85205a8cc9a3dc72a4e4a52be5.tar.bz2
Update duktape to regexp-canonicalize-lookup branch.
- Add an optional 128kB lookup to optimize regexp canonicalization #411. https://github.com/svaarala/duktape/pull/411 This speeds up worst-case case-insensitive unicode regex handling.
Diffstat (limited to 'javascript/duktape/duktape.h')
-rw-r--r--javascript/duktape/duktape.h77
1 files changed, 58 insertions, 19 deletions
diff --git a/javascript/duktape/duktape.h b/javascript/duktape/duktape.h
index 8d4c31312..6fba18d8b 100644
--- a/javascript/duktape/duktape.h
+++ b/javascript/duktape/duktape.h
@@ -1,11 +1,12 @@
/*
- * Duktape public API for Duktape 1.2.99.
+ * Duktape public API for Duktape 1.3.99.
* See the API reference for documentation on call semantics.
* The exposed API is inside the DUK_API_PUBLIC_H_INCLUDED
* include guard. Other parts of the header are Duktape
* internal and related to platform/compiler/feature detection.
*
- * Git commit 2a41d0a38eef5edfe8691cf09427b6ee8a3ad5c9 (v1.2.0-310-g2a41d0a).
+ * Git commit 40453939c5a5aa16898d19bbac4d02f77196cc8b (v1.3.0-138-g4045393).
+ * Git branch regexp-canonicalize-lookup.
*
* See Duktape AUTHORS.rst and LICENSE.txt for copyright and
* licensing information.
@@ -59,8 +60,9 @@
* 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):
+ * The following people have contributed code, website contents, or Wiki contents,
+ * and agreed to irrevocably license their contributions under the Duktape
+ * ``LICENSE.txt`` (in order of appearance):
*
* * Sami Vaarala <sami.vaarala@iki.fi>
* * Niki Dobrev
@@ -68,6 +70,7 @@
* * L\u00e1szl\u00f3 Lang\u00f3 <llango.u-szeged@partner.samsung.com>
* * Legimet <legimet.calc@gmail.com>
* * Karl Skomski <karl@skomski.com>
+ * * Bruce Pascoe <fatcerberus1@gmail.com>
*
* Other contributions
* ===================
@@ -208,13 +211,16 @@ struct duk_number_list_entry {
* have 99 for patch level (e.g. 0.10.99 would be a development version
* after 0.10.0 but before the next official release).
*/
-#define DUK_VERSION 10299L
+#define DUK_VERSION 10399L
-/* Git describe for Duktape build. Useful for non-official snapshot builds
- * so that application code can easily log which Duktape snapshot was used.
- * Not available in the Ecmascript environment.
+/* Git commit, describe, and branch for Duktape build. Useful for
+ * non-official snapshot builds so that application code can easily log
+ * which Duktape snapshot was used. Not available in the Ecmascript
+ * environment.
*/
-#define DUK_GIT_DESCRIBE "v1.2.0-310-g2a41d0a"
+#define DUK_GIT_COMMIT "40453939c5a5aa16898d19bbac4d02f77196cc8b"
+#define DUK_GIT_DESCRIBE "v1.3.0-138-g4045393"
+#define DUK_GIT_BRANCH "regexp-canonicalize-lookup"
/* Duktape debug protocol version used by this build. */
#define DUK_DEBUG_PROTOCOL_VERSION 1
@@ -276,9 +282,9 @@ struct duk_number_list_entry {
#define DUK_ENUM_NO_PROXY_BEHAVIOR (1 << 5) /* enumerate a proxy object itself without invoking proxy behavior */
/* Compilation flags for duk_compile() and duk_eval() */
-#define DUK_COMPILE_EVAL (1 << 0) /* compile eval code (instead of program) */
-#define DUK_COMPILE_FUNCTION (1 << 1) /* compile function code (instead of program) */
-#define DUK_COMPILE_STRICT (1 << 2) /* use strict (outer) context for program, eval, or function */
+#define DUK_COMPILE_EVAL (1 << 0) /* compile eval code (instead of global code) */
+#define DUK_COMPILE_FUNCTION (1 << 1) /* compile function code (instead of global code) */
+#define DUK_COMPILE_STRICT (1 << 2) /* use strict (outer) context for global, eval, or function code */
#define DUK_COMPILE_SAFE (1 << 3) /* (internal) catch compilation errors */
#define DUK_COMPILE_NORESULT (1 << 4) /* (internal) omit eval result */
#define DUK_COMPILE_NOSOURCE (1 << 5) /* (internal) no source string on stack */
@@ -536,16 +542,36 @@ DUK_EXTERNAL_DECL duk_idx_t duk_push_error_object_va_raw(duk_context *ctx, duk_e
duk_push_error_object_va_raw((ctx), (err_code), (const char *) (__FILE__), (duk_int_t) (__LINE__), (fmt), (ap))
#define DUK_BUF_FLAG_DYNAMIC (1 << 0) /* internal flag: dynamic buffer */
-#define DUK_BUF_FLAG_NOZERO (1 << 1) /* internal flag: don't zero allocated buffer */
+#define DUK_BUF_FLAG_EXTERNAL (1 << 1) /* internal flag: external buffer */
+#define DUK_BUF_FLAG_NOZERO (1 << 2) /* internal flag: don't zero allocated buffer */
DUK_EXTERNAL_DECL void *duk_push_buffer_raw(duk_context *ctx, duk_size_t size, duk_small_uint_t flags);
#define duk_push_buffer(ctx,size,dynamic) \
- duk_push_buffer_raw((ctx), (size), (dynamic));
+ duk_push_buffer_raw((ctx), (size), (dynamic) ? DUK_BUF_FLAG_DYNAMIC : 0);
#define duk_push_fixed_buffer(ctx,size) \
- duk_push_buffer_raw((ctx), (size), 0 /*dynamic*/)
+ duk_push_buffer_raw((ctx), (size), 0 /*flags*/)
#define duk_push_dynamic_buffer(ctx,size) \
- duk_push_buffer_raw((ctx), (size), 1 /*dynamic*/)
+ duk_push_buffer_raw((ctx), (size), DUK_BUF_FLAG_DYNAMIC /*flags*/)
+#define duk_push_external_buffer(ctx) \
+ ((void) duk_push_buffer_raw((ctx), 0, DUK_BUF_FLAG_DYNAMIC | DUK_BUF_FLAG_EXTERNAL))
+
+#define DUK_BUFOBJ_CREATE_ARRBUF (1 << 4) /* internal flag: create backing ArrayBuffer; keep in one byte */
+#define DUK_BUFOBJ_DUKTAPE_BUFFER 0
+#define DUK_BUFOBJ_NODEJS_BUFFER 1
+#define DUK_BUFOBJ_ARRAYBUFFER 2
+#define DUK_BUFOBJ_DATAVIEW (3 | DUK_BUFOBJ_CREATE_ARRBUF)
+#define DUK_BUFOBJ_INT8ARRAY (4 | DUK_BUFOBJ_CREATE_ARRBUF)
+#define DUK_BUFOBJ_UINT8ARRAY (5 | DUK_BUFOBJ_CREATE_ARRBUF)
+#define DUK_BUFOBJ_UINT8CLAMPEDARRAY (6 | DUK_BUFOBJ_CREATE_ARRBUF)
+#define DUK_BUFOBJ_INT16ARRAY (7 | DUK_BUFOBJ_CREATE_ARRBUF)
+#define DUK_BUFOBJ_UINT16ARRAY (8 | DUK_BUFOBJ_CREATE_ARRBUF)
+#define DUK_BUFOBJ_INT32ARRAY (9 | DUK_BUFOBJ_CREATE_ARRBUF)
+#define DUK_BUFOBJ_UINT32ARRAY (10 | DUK_BUFOBJ_CREATE_ARRBUF)
+#define DUK_BUFOBJ_FLOAT32ARRAY (11 | DUK_BUFOBJ_CREATE_ARRBUF)
+#define DUK_BUFOBJ_FLOAT64ARRAY (12 | DUK_BUFOBJ_CREATE_ARRBUF)
+
+DUK_EXTERNAL_DECL void duk_push_buffer_object(duk_context *ctx, duk_idx_t idx_buffer, duk_size_t byte_offset, duk_size_t byte_length, duk_uint_t flags);
DUK_EXTERNAL_DECL duk_idx_t duk_push_heapptr(duk_context *ctx, void *ptr);
@@ -592,8 +618,18 @@ DUK_EXTERNAL_DECL duk_bool_t duk_is_thread(duk_context *ctx, duk_idx_t index);
DUK_EXTERNAL_DECL duk_bool_t duk_is_callable(duk_context *ctx, duk_idx_t index);
DUK_EXTERNAL_DECL duk_bool_t duk_is_dynamic_buffer(duk_context *ctx, duk_idx_t index);
DUK_EXTERNAL_DECL duk_bool_t duk_is_fixed_buffer(duk_context *ctx, duk_idx_t index);
+DUK_EXTERNAL_DECL duk_bool_t duk_is_external_buffer(duk_context *ctx, duk_idx_t index);
+
+#define duk_is_primitive(ctx,index) \
+ duk_check_type_mask((ctx), (index), DUK_TYPE_MASK_UNDEFINED | \
+ DUK_TYPE_MASK_NULL | \
+ DUK_TYPE_MASK_BOOLEAN | \
+ DUK_TYPE_MASK_NUMBER | \
+ DUK_TYPE_MASK_STRING | \
+ DUK_TYPE_MASK_BUFFER | \
+ DUK_TYPE_MASK_POINTER | \
+ DUK_TYPE_MASK_LIGHTFUNC)
-DUK_EXTERNAL_DECL duk_bool_t duk_is_primitive(duk_context *ctx, duk_idx_t index);
#define duk_is_object_coercible(ctx,index) \
duk_check_type_mask((ctx), (index), DUK_TYPE_MASK_BOOLEAN | \
DUK_TYPE_MASK_NUMBER | \
@@ -719,6 +755,7 @@ DUK_EXTERNAL_DECL void duk_json_decode(duk_context *ctx, duk_idx_t index);
DUK_EXTERNAL_DECL void *duk_resize_buffer(duk_context *ctx, duk_idx_t index, duk_size_t new_size);
DUK_EXTERNAL_DECL void *duk_steal_buffer(duk_context *ctx, duk_idx_t index, duk_size_t *out_size);
+DUK_EXTERNAL_DECL void duk_config_buffer(duk_context *ctx, duk_idx_t index, void *ptr, duk_size_t len);
/*
* Property access
@@ -831,6 +868,7 @@ DUK_EXTERNAL_DECL duk_int_t duk_pcall(duk_context *ctx, duk_idx_t nargs);
DUK_EXTERNAL_DECL duk_int_t duk_pcall_method(duk_context *ctx, duk_idx_t nargs);
DUK_EXTERNAL_DECL duk_int_t duk_pcall_prop(duk_context *ctx, duk_idx_t obj_index, duk_idx_t nargs);
DUK_EXTERNAL_DECL void duk_new(duk_context *ctx, duk_idx_t nargs);
+DUK_EXTERNAL_DECL duk_int_t duk_pnew(duk_context *ctx, duk_idx_t nargs);
DUK_EXTERNAL_DECL duk_int_t duk_safe_call(duk_context *ctx, duk_safe_call_function func, duk_idx_t nargs, duk_idx_t nrets);
/*
@@ -1314,7 +1352,7 @@ typedef union duk_double_union duk_double_union;
*
* When packed duk_tval is used, the NaN space is used to store pointers
* and other tagged values in addition to NaNs. Actual NaNs are normalized
- * to a specific format. The macros below are used by the implementation
+ * to a specific quiet NaN. The macros below are used by the implementation
* to check and normalize NaN values when they might be created. The macros
* are essentially NOPs when the non-packed duk_tval representation is used.
*
@@ -1322,7 +1360,8 @@ typedef union duk_double_union duk_double_union;
* the packed duk_tval and works correctly for all NaNs except those that
* begin with 0x7ff0. Since the 'normalized NaN' values used with packed
* duk_tval begin with 0x7ff8, the partial check is reliable when packed
- * duk_tval is used.
+ * duk_tval is used. The 0x7ff8 prefix means the normalized NaN will be a
+ * quiet NaN regardless of its remaining lower bits.
*
* The ME variant below is specifically for ARM byte order, which has the
* feature that while doubles have a mixed byte order (32107654), unsigned