Lines Matching refs:js_ctx

36381 DUK_LOCAL_DECL void duk__json_dec_syntax_error(duk_json_dec_ctx *js_ctx);
36382 DUK_LOCAL_DECL void duk__json_dec_eat_white(duk_json_dec_ctx *js_ctx);
36384 DUK_LOCAL_DECL duk_uint8_t duk__json_dec_peek(duk_json_dec_ctx *js_ctx);
36386 DUK_LOCAL_DECL duk_uint8_t duk__json_dec_get(duk_json_dec_ctx *js_ctx);
36387 DUK_LOCAL_DECL duk_uint8_t duk__json_dec_get_nonwhite(duk_json_dec_ctx *js_ctx);
36388 DUK_LOCAL_DECL duk_uint_fast32_t duk__json_dec_decode_hex_escape(duk_json_dec_ctx *js_ctx, duk_smal…
36389 DUK_LOCAL_DECL void duk__json_dec_req_stridx(duk_json_dec_ctx *js_ctx, duk_small_uint_t stridx);
36390 DUK_LOCAL_DECL void duk__json_dec_string(duk_json_dec_ctx *js_ctx);
36392 DUK_LOCAL_DECL void duk__json_dec_plain_string(duk_json_dec_ctx *js_ctx);
36393 DUK_LOCAL_DECL void duk__json_dec_pointer(duk_json_dec_ctx *js_ctx);
36394 DUK_LOCAL_DECL void duk__json_dec_buffer(duk_json_dec_ctx *js_ctx);
36396 DUK_LOCAL_DECL void duk__json_dec_number(duk_json_dec_ctx *js_ctx);
36397 DUK_LOCAL_DECL void duk__json_dec_objarr_entry(duk_json_dec_ctx *js_ctx);
36398 DUK_LOCAL_DECL void duk__json_dec_objarr_exit(duk_json_dec_ctx *js_ctx);
36399 DUK_LOCAL_DECL void duk__json_dec_object(duk_json_dec_ctx *js_ctx);
36400 DUK_LOCAL_DECL void duk__json_dec_array(duk_json_dec_ctx *js_ctx);
36401 DUK_LOCAL_DECL void duk__json_dec_value(duk_json_dec_ctx *js_ctx);
36402 DUK_LOCAL_DECL void duk__json_dec_reviver_walk(duk_json_dec_ctx *js_ctx);
36404 DUK_LOCAL_DECL void duk__emit_1(duk_json_enc_ctx *js_ctx, duk_uint_fast8_t ch);
36405 DUK_LOCAL_DECL void duk__emit_2(duk_json_enc_ctx *js_ctx, duk_uint_fast8_t ch1, duk_uint_fast8_t ch…
36406 DUK_LOCAL_DECL void duk__unemit_1(duk_json_enc_ctx *js_ctx);
36407 DUK_LOCAL_DECL void duk__emit_hstring(duk_json_enc_ctx *js_ctx, duk_hstring *h);
36409 DUK_LOCAL_DECL void duk__emit_cstring(duk_json_enc_ctx *js_ctx, const char *p);
36411 DUK_LOCAL_DECL void duk__emit_stridx(duk_json_enc_ctx *js_ctx, duk_small_uint_t stridx);
36412 DUK_LOCAL_DECL duk_uint8_t *duk__emit_esc_auto_fast(duk_json_enc_ctx *js_ctx, duk_uint_fast32_t cp,…
36413 DUK_LOCAL_DECL void duk__json_enc_key_autoquote(duk_json_enc_ctx *js_ctx, duk_hstring *k);
36414 DUK_LOCAL_DECL void duk__json_enc_quote_string(duk_json_enc_ctx *js_ctx, duk_hstring *h_str);
36415 DUK_LOCAL_DECL void duk__json_enc_objarr_entry(duk_json_enc_ctx *js_ctx, duk_idx_t *entry_top);
36416 DUK_LOCAL_DECL void duk__json_enc_objarr_exit(duk_json_enc_ctx *js_ctx, duk_idx_t *entry_top);
36417 DUK_LOCAL_DECL void duk__json_enc_object(duk_json_enc_ctx *js_ctx);
36418 DUK_LOCAL_DECL void duk__json_enc_array(duk_json_enc_ctx *js_ctx);
36419 DUK_LOCAL_DECL duk_bool_t duk__json_enc_value(duk_json_enc_ctx *js_ctx, duk_idx_t idx_holder);
36421 DUK_LOCAL_DECL void duk__json_enc_double(duk_json_enc_ctx *js_ctx);
36423 DUK_LOCAL_DECL void duk__json_enc_fastint_tval(duk_json_enc_ctx *js_ctx, duk_tval *tv);
36426 DUK_LOCAL_DECL void duk__json_enc_buffer_jx_jc(duk_json_enc_ctx *js_ctx, duk_hbuffer *h);
36427 DUK_LOCAL_DECL void duk__json_enc_pointer(duk_json_enc_ctx *js_ctx, void *ptr);
36429 DUK_LOCAL_DECL void duk__json_enc_bufobj(duk_json_enc_ctx *js_ctx, duk_hbufobj *h_bufobj);
36433 DUK_LOCAL_DECL void duk__json_enc_buffer_json_fastpath(duk_json_enc_ctx *js_ctx, duk_hbuffer *h);
36435 DUK_LOCAL_DECL void duk__json_enc_newline_indent(duk_json_enc_ctx *js_ctx, duk_uint_t depth);
36560 DUK_LOCAL void duk__json_dec_syntax_error(duk_json_dec_ctx *js_ctx) { in duk__json_dec_syntax_error() argument
36565 DUK_ERROR_FMT1(js_ctx->thr, DUK_ERR_SYNTAX_ERROR, DUK_STR_FMT_INVALID_JSON, in duk__json_dec_syntax_error()
36566 (long) (js_ctx->p - js_ctx->p_start)); in duk__json_dec_syntax_error()
36570 DUK_LOCAL void duk__json_dec_eat_white(duk_json_dec_ctx *js_ctx) { in duk__json_dec_eat_white() argument
36574 p = js_ctx->p; in duk__json_dec_eat_white()
36576 DUK_ASSERT(p <= js_ctx->p_end); in duk__json_dec_eat_white()
36597 js_ctx->p = p; in duk__json_dec_eat_white()
36601 DUK_LOCAL duk_uint8_t duk__json_dec_peek(duk_json_dec_ctx *js_ctx) { in duk__json_dec_peek() argument
36602 DUK_ASSERT(js_ctx->p <= js_ctx->p_end); in duk__json_dec_peek()
36603 return *js_ctx->p; in duk__json_dec_peek()
36607 DUK_LOCAL duk_uint8_t duk__json_dec_get(duk_json_dec_ctx *js_ctx) { in duk__json_dec_get() argument
36608 DUK_ASSERT(js_ctx->p <= js_ctx->p_end); in duk__json_dec_get()
36609 return *js_ctx->p++; in duk__json_dec_get()
36612 DUK_LOCAL duk_uint8_t duk__json_dec_get_nonwhite(duk_json_dec_ctx *js_ctx) { in duk__json_dec_get_nonwhite() argument
36613 duk__json_dec_eat_white(js_ctx); in duk__json_dec_get_nonwhite()
36614 return duk__json_dec_get(js_ctx); in duk__json_dec_get_nonwhite()
36618 DUK_LOCAL duk_uint_fast32_t duk__json_dec_decode_hex_escape(duk_json_dec_ctx *js_ctx, duk_small_uin… in duk__json_dec_decode_hex_escape() argument
36627 x = duk__json_dec_get(js_ctx); in duk__json_dec_decode_hex_escape()
36646 duk__json_dec_syntax_error(js_ctx); in duk__json_dec_decode_hex_escape()
36651 DUK_LOCAL void duk__json_dec_req_stridx(duk_json_dec_ctx *js_ctx, duk_small_uint_t stridx) { in duk__json_dec_req_stridx() argument
36662 h = DUK_HTHREAD_GET_STRING(js_ctx->thr, stridx); in duk__json_dec_req_stridx()
36666 DUK_ASSERT(*(js_ctx->p - 1) == *(p - 1)); /* first character has been matched */ in duk__json_dec_req_stridx()
36673 y = duk__json_dec_get(js_ctx); in duk__json_dec_req_stridx()
36684 duk__json_dec_syntax_error(js_ctx); in duk__json_dec_req_stridx()
36688 DUK_LOCAL duk_small_int_t duk__json_dec_string_escape(duk_json_dec_ctx *js_ctx, duk_uint8_t **ext_p… in duk__json_dec_string_escape() argument
36695 cp = (duk_uint_fast32_t) duk__json_dec_get(js_ctx); in duk__json_dec_string_escape()
36706 cp = duk__json_dec_decode_hex_escape(js_ctx, 4); in duk__json_dec_string_escape()
36711 if (js_ctx->flag_ext_custom) { in duk__json_dec_string_escape()
36712 cp = duk__json_dec_decode_hex_escape(js_ctx, 8); in duk__json_dec_string_escape()
36719 if (js_ctx->flag_ext_custom) { in duk__json_dec_string_escape()
36720 cp = duk__json_dec_decode_hex_escape(js_ctx, 2); in duk__json_dec_string_escape()
36737 DUK_LOCAL void duk__json_dec_string(duk_json_dec_ctx *js_ctx) { in duk__json_dec_string() argument
36738 duk_hthread *thr = js_ctx->thr; in duk__json_dec_string()
36751 DUK_BW_INIT_PUSHBUF(js_ctx->thr, bw, DUK__JSON_DECSTR_BUFSIZE); in duk__json_dec_string()
36752 q = DUK_BW_GET_PTR(js_ctx->thr, bw); in duk__json_dec_string()
36769 q = DUK_BW_ENSURE_RAW(js_ctx->thr, bw, safe + DUK_UNICODE_MAX_XUTF8_LENGTH, q); in duk__json_dec_string()
36771 p = js_ctx->p; /* temp copy, write back for next loop */ in duk__json_dec_string()
36774 js_ctx->p = p; in duk__json_dec_string()
36788 js_ctx->p = p; in duk__json_dec_string()
36795 js_ctx->p = p; in duk__json_dec_string()
36796 if (duk__json_dec_string_escape(js_ctx, &q) != 0) { in duk__json_dec_string()
36801 js_ctx->p = p; in duk__json_dec_string()
36811 q = DUK_BW_ENSURE_RAW(js_ctx->thr, bw, DUK_UNICODE_MAX_XUTF8_LENGTH, q); in duk__json_dec_string()
36813 x = duk__json_dec_get(js_ctx); in duk__json_dec_string()
36818 if (duk__json_dec_string_escape(js_ctx, &q) != 0) { in duk__json_dec_string()
36830 DUK_BW_SETPTR_AND_COMPACT(js_ctx->thr, bw, q); in duk__json_dec_string()
36838 duk__json_dec_syntax_error(js_ctx); in duk__json_dec_string()
36846 DUK_LOCAL void duk__json_dec_plain_string(duk_json_dec_ctx *js_ctx) { in duk__json_dec_plain_string() argument
36847 duk_hthread *thr = js_ctx->thr; in duk__json_dec_plain_string()
36853 js_ctx->p--; /* safe */ in duk__json_dec_plain_string()
36854 p = js_ctx->p; in duk__json_dec_plain_string()
36880 duk_push_lstring(thr, (const char *) js_ctx->p, (duk_size_t) (p - js_ctx->p)); in duk__json_dec_plain_string()
36881 js_ctx->p = p; in duk__json_dec_plain_string()
36888 DUK_LOCAL void duk__json_dec_pointer(duk_json_dec_ctx *js_ctx) { in duk__json_dec_pointer() argument
36889 duk_hthread *thr = js_ctx->thr; in duk__json_dec_pointer()
36896 p = js_ctx->p; in duk__json_dec_pointer()
36926 (void) DUK_SSCANF((const char *) js_ctx->p, DUK_STR_FMT_PTR, &voidptr); in duk__json_dec_pointer()
36928 js_ctx->p = p + 1; /* skip ')' */ in duk__json_dec_pointer()
36935 duk__json_dec_syntax_error(js_ctx); in duk__json_dec_pointer()
36941 DUK_LOCAL void duk__json_dec_buffer(duk_json_dec_ctx *js_ctx) { in duk__json_dec_buffer() argument
36942 duk_hthread *thr = js_ctx->thr; in duk__json_dec_buffer()
36950 p = js_ctx->p; in duk__json_dec_buffer()
36980 src_len = (duk_size_t) (p - js_ctx->p); in duk__json_dec_buffer()
36983 duk_memcpy((void *) buf, (const void *) js_ctx->p, src_len); in duk__json_dec_buffer()
36986 js_ctx->p = p + 1; /* skip '|' */ in duk__json_dec_buffer()
36993 duk__json_dec_syntax_error(js_ctx); in duk__json_dec_buffer()
36999 DUK_LOCAL void duk__json_dec_number(duk_json_dec_ctx *js_ctx) { in duk__json_dec_number() argument
37000 duk_hthread *thr = js_ctx->thr; in duk__json_dec_number()
37008 p_start = js_ctx->p; in duk__json_dec_number()
37014 p = js_ctx->p; in duk__json_dec_number()
37020 (const void *) js_ctx->p_end, (long) x)); in duk__json_dec_number()
37042 js_ctx->p = p; in duk__json_dec_number()
37044 DUK_ASSERT(js_ctx->p > p_start); in duk__json_dec_number()
37055 duk__json_dec_syntax_error(js_ctx); in duk__json_dec_number()
37064 DUK_LOCAL void duk__json_dec_objarr_entry(duk_json_dec_ctx *js_ctx) { in duk__json_dec_objarr_entry() argument
37065 duk_hthread *thr = js_ctx->thr; in duk__json_dec_objarr_entry()
37072 DUK_ASSERT_DISABLE(js_ctx->recursion_depth >= 0); /* unsigned */ in duk__json_dec_objarr_entry()
37073 DUK_ASSERT(js_ctx->recursion_depth <= js_ctx->recursion_limit); in duk__json_dec_objarr_entry()
37074 if (js_ctx->recursion_depth >= js_ctx->recursion_limit) { in duk__json_dec_objarr_entry()
37078 js_ctx->recursion_depth++; in duk__json_dec_objarr_entry()
37081 DUK_LOCAL void duk__json_dec_objarr_exit(duk_json_dec_ctx *js_ctx) { in duk__json_dec_objarr_exit() argument
37084 DUK_ASSERT(js_ctx->recursion_depth > 0); in duk__json_dec_objarr_exit()
37085 DUK_ASSERT(js_ctx->recursion_depth <= js_ctx->recursion_limit); in duk__json_dec_objarr_exit()
37086 js_ctx->recursion_depth--; in duk__json_dec_objarr_exit()
37089 DUK_LOCAL void duk__json_dec_object(duk_json_dec_ctx *js_ctx) { in duk__json_dec_object() argument
37090 duk_hthread *thr = js_ctx->thr; in duk__json_dec_object()
37096 duk__json_dec_objarr_entry(js_ctx); in duk__json_dec_object()
37104 x = duk__json_dec_get_nonwhite(js_ctx); in duk__json_dec_object()
37114 x = duk__json_dec_get_nonwhite(js_ctx); in duk__json_dec_object()
37131 duk__json_dec_string(js_ctx); in duk__json_dec_object()
37133 } else if (js_ctx->flag_ext_custom && in duk__json_dec_object()
37135 duk__json_dec_plain_string(js_ctx); in duk__json_dec_object()
37143 x = duk__json_dec_get_nonwhite(js_ctx); in duk__json_dec_object()
37148 duk__json_dec_value(js_ctx); in duk__json_dec_object()
37164 duk__json_dec_objarr_exit(js_ctx); in duk__json_dec_object()
37168 duk__json_dec_syntax_error(js_ctx); in duk__json_dec_object()
37172 DUK_LOCAL void duk__json_dec_array(duk_json_dec_ctx *js_ctx) { in duk__json_dec_array() argument
37173 duk_hthread *thr = js_ctx->thr; in duk__json_dec_array()
37179 duk__json_dec_objarr_entry(js_ctx); in duk__json_dec_array()
37187 x = duk__json_dec_get_nonwhite(js_ctx); in duk__json_dec_array()
37205 js_ctx->p--; /* backtrack (safe) */ in duk__json_dec_array()
37213 duk__json_dec_value(js_ctx); in duk__json_dec_array()
37232 duk__json_dec_objarr_exit(js_ctx); in duk__json_dec_array()
37236 duk__json_dec_syntax_error(js_ctx); in duk__json_dec_array()
37240 DUK_LOCAL void duk__json_dec_value(duk_json_dec_ctx *js_ctx) { argument
37241 duk_hthread *thr = js_ctx->thr;
37244 x = duk__json_dec_get_nonwhite(js_ctx);
37251 duk__json_dec_string(js_ctx);
37254 if (js_ctx->flag_ext_custom && x == DUK_ASC_MINUS && duk__json_dec_peek(js_ctx) == DUK_ASC_UC_I) {
37255 …duk__json_dec_req_stridx(js_ctx, DUK_STRIDX_MINUS_INFINITY); /* "-Infinity", '-' has been eaten */
37262 js_ctx->p--; /* safe */
37263 duk__json_dec_number(js_ctx);
37266 duk__json_dec_req_stridx(js_ctx, DUK_STRIDX_TRUE);
37269 duk__json_dec_req_stridx(js_ctx, DUK_STRIDX_FALSE);
37272 duk__json_dec_req_stridx(js_ctx, DUK_STRIDX_LC_NULL);
37275 } else if (js_ctx->flag_ext_custom && x == DUK_ASC_LC_U) {
37276 duk__json_dec_req_stridx(js_ctx, DUK_STRIDX_LC_UNDEFINED);
37278 } else if (js_ctx->flag_ext_custom && x == DUK_ASC_UC_N) {
37279 duk__json_dec_req_stridx(js_ctx, DUK_STRIDX_NAN);
37281 } else if (js_ctx->flag_ext_custom && x == DUK_ASC_UC_I) {
37282 duk__json_dec_req_stridx(js_ctx, DUK_STRIDX_INFINITY);
37284 } else if (js_ctx->flag_ext_custom && x == DUK_ASC_LPAREN) {
37285 duk__json_dec_pointer(js_ctx);
37286 } else if (js_ctx->flag_ext_custom && x == DUK_ASC_PIPE) {
37287 duk__json_dec_buffer(js_ctx);
37290 duk__json_dec_object(js_ctx);
37292 duk__json_dec_array(js_ctx);
37298 duk__json_dec_eat_white(js_ctx);
37304 duk__json_dec_syntax_error(js_ctx);
37313 DUK_LOCAL void duk__json_dec_reviver_walk(duk_json_dec_ctx *js_ctx) { argument
37314 duk_hthread *thr = js_ctx->thr;
37318 duk__json_dec_objarr_entry(js_ctx);
37342 duk__json_dec_reviver_walk(js_ctx); /* -> [ ... holder name val new_elem ] */
37369 duk__json_dec_reviver_walk(js_ctx);
37394 duk_dup(thr, js_ctx->idx_reviver);
37398 duk__json_dec_objarr_exit(js_ctx);
37408 #define DUK__EMIT_1(js_ctx,ch) duk__emit_1((js_ctx), (duk_uint_fast8_t) (ch)) argument
37409 #define DUK__EMIT_2(js_ctx,ch1,ch2) duk__emit_2((js_ctx), (duk_uint_fast8_t) (ch1), (duk_uint_f… argument
37410 #define DUK__EMIT_HSTR(js_ctx,h) duk__emit_hstring((js_ctx), (h)) argument
37412 #define DUK__EMIT_CSTR(js_ctx,p) duk__emit_cstring((js_ctx), (p)) argument
37414 #define DUK__EMIT_STRIDX(js_ctx,i) duk__emit_stridx((js_ctx), (i)) argument
37415 #define DUK__UNEMIT_1(js_ctx) duk__unemit_1((js_ctx)) argument
37417 DUK_LOCAL void duk__emit_1(duk_json_enc_ctx *js_ctx, duk_uint_fast8_t ch) { argument
37418 DUK_BW_WRITE_ENSURE_U8(js_ctx->thr, &js_ctx->bw, ch);
37421 DUK_LOCAL void duk__emit_2(duk_json_enc_ctx *js_ctx, duk_uint_fast8_t ch1, duk_uint_fast8_t ch2) { argument
37422 DUK_BW_WRITE_ENSURE_U8_2(js_ctx->thr, &js_ctx->bw, ch1, ch2);
37425 DUK_LOCAL void duk__emit_hstring(duk_json_enc_ctx *js_ctx, duk_hstring *h) { argument
37426 DUK_BW_WRITE_ENSURE_HSTRING(js_ctx->thr, &js_ctx->bw, h);
37430 DUK_LOCAL void duk__emit_cstring(duk_json_enc_ctx *js_ctx, const char *str) { argument
37431 DUK_BW_WRITE_ENSURE_CSTRING(js_ctx->thr, &js_ctx->bw, str);
37435 DUK_LOCAL void duk__emit_stridx(duk_json_enc_ctx *js_ctx, duk_small_uint_t stridx) { argument
37439 h = DUK_HTHREAD_GET_STRING(js_ctx->thr, stridx);
37442 DUK_BW_WRITE_ENSURE_HSTRING(js_ctx->thr, &js_ctx->bw, h);
37445 DUK_LOCAL void duk__unemit_1(duk_json_enc_ctx *js_ctx) { argument
37446 DUK_ASSERT(DUK_BW_GET_SIZE(js_ctx->thr, &js_ctx->bw) >= 1);
37447 DUK_BW_ADD_PTR(js_ctx->thr, &js_ctx->bw, -1);
37455 DUK_LOCAL duk_uint8_t *duk__emit_esc_auto_fast(duk_json_enc_ctx *js_ctx, duk_uint_fast32_t cp, duk_… argument
37459 DUK_UNREF(js_ctx);
37471 if (DUK_UNLIKELY(js_ctx->flag_ext_custom != 0U)) {
37482 if (DUK_LIKELY(js_ctx->flag_ext_custom != 0U)) {
37509 DUK_LOCAL void duk__json_enc_key_autoquote(duk_json_enc_ctx *js_ctx, duk_hstring *k) { argument
37523 if (js_ctx->flag_avoid_key_quotes) {
37547 DUK__EMIT_HSTR(js_ctx, k);
37552 duk__json_enc_quote_string(js_ctx, k);
37560 DUK_LOCAL void duk__json_enc_quote_string(duk_json_enc_ctx *js_ctx, duk_hstring *h_str) { argument
37561 duk_hthread *thr = js_ctx->thr;
37573 DUK__EMIT_1(js_ctx, DUK_ASC_DOUBLEQUOTE);
37592 q = DUK_BW_ENSURE_GETPTR(thr, &js_ctx->bw, space);
37609 q = duk__emit_esc_auto_fast(js_ctx, cp, q);
37610 } else if (b == 0x7f && js_ctx->flag_ascii_only) {
37614 q = duk__emit_esc_auto_fast(js_ctx, cp, q);
37641 q = duk__emit_esc_auto_fast(js_ctx, cp, q);
37643 } else if (cp == 0x7f && js_ctx->flag_ascii_only) {
37644 q = duk__emit_esc_auto_fast(js_ctx, cp, q);
37676 if (js_ctx->flag_ascii_only || cp == 0x2028 || cp == 0x2029) {
37678 if (js_ctx->flag_ascii_only) {
37680 q = duk__emit_esc_auto_fast(js_ctx, cp, q);
37688 DUK_BW_SET_PTR(thr, &js_ctx->bw, q);
37691 DUK__EMIT_1(js_ctx, DUK_ASC_DOUBLEQUOTE);
37697 DUK_LOCAL void duk__json_enc_double(duk_json_enc_ctx *js_ctx) { argument
37707 DUK_ASSERT(js_ctx != NULL);
37708 thr = js_ctx->thr;
37728 (js_ctx->flag_ext_custom_or_compatible))) {
37738 DUK__EMIT_HSTR(js_ctx, h_str);
37743 if (!(js_ctx->flags & (DUK_JSON_FLAG_EXT_CUSTOM |
37747 stridx = js_ctx->stridx_custom_nan;
37749 stridx = js_ctx->stridx_custom_posinf;
37751 stridx = js_ctx->stridx_custom_neginf;
37756 DUK__EMIT_STRIDX(js_ctx, stridx);
37761 DUK_LOCAL void duk__json_enc_fastint_tval(duk_json_enc_ctx *js_ctx, duk_tval *tv) { argument
37780 DUK__EMIT_CSTR(js_ctx, (const char *) buf);
37863 DUK_LOCAL void duk__json_enc_buffer_data(duk_json_enc_ctx *js_ctx, duk_uint8_t *buf_data, duk_size_… argument
37868 thr = js_ctx->thr;
37870 DUK_ASSERT(js_ctx->flag_ext_custom || js_ctx->flag_ext_compatible); /* caller checks */
37871 DUK_ASSERT(js_ctx->flag_ext_custom_or_compatible);
37887 q = DUK_BW_ENSURE_GETPTR(thr, &js_ctx->bw, space);
37890 if (js_ctx->flag_ext_custom)
37905 DUK_ASSERT(js_ctx->flag_ext_compatible);
37914 DUK_BW_SET_PTR(thr, &js_ctx->bw, q);
37917 DUK_LOCAL void duk__json_enc_buffer_jx_jc(duk_json_enc_ctx *js_ctx, duk_hbuffer *h) { argument
37918 duk__json_enc_buffer_data(js_ctx,
37919 (duk_uint8_t *) DUK_HBUFFER_GET_DATA_PTR(js_ctx->thr->heap, h),
37925 DUK_LOCAL void duk__json_enc_buffer_json_fastpath(duk_json_enc_ctx *js_ctx, duk_hbuffer *h) { argument
37932 DUK__EMIT_2(js_ctx, DUK_ASC_LCURLY, DUK_ASC_RCURLY);
37936 DUK__EMIT_1(js_ctx, DUK_ASC_LCURLY);
37946 buf = (const duk_uint8_t *) DUK_HBUFFER_GET_DATA_PTR(js_ctx->thr->heap, h);
37947 if (DUK_UNLIKELY(js_ctx->h_gap != NULL)) {
37949 duk__json_enc_newline_indent(js_ctx, js_ctx->recursion_depth + 1);
37950 q = DUK_BW_ENSURE_GETPTR(js_ctx->thr, &js_ctx->bw, 32);
37952 DUK_BW_SET_PTR(js_ctx->thr, &js_ctx->bw, q);
37955 q = DUK_BW_GET_PTR(js_ctx->thr, &js_ctx->bw);
37957 q = DUK_BW_ENSURE_RAW(js_ctx->thr, &js_ctx->bw, 32, q);
37960 DUK_BW_SET_PTR(js_ctx->thr, &js_ctx->bw, q);
37962 DUK__UNEMIT_1(js_ctx); /* eat trailing comma */
37964 if (DUK_UNLIKELY(js_ctx->h_gap != NULL)) {
37965 duk__json_enc_newline_indent(js_ctx, js_ctx->recursion_depth);
37967 DUK__EMIT_1(js_ctx, DUK_ASC_RCURLY);
37972 DUK_LOCAL void duk__json_enc_pointer(duk_json_enc_ctx *js_ctx, void *ptr) { argument
37976 DUK_ASSERT(js_ctx->flag_ext_custom || js_ctx->flag_ext_compatible); /* caller checks */
37977 DUK_ASSERT(js_ctx->flag_ext_custom_or_compatible);
37985 if (js_ctx->flag_ext_custom)
37997 DUK_ASSERT(js_ctx->flag_ext_compatible);
38004 DUK__EMIT_CSTR(js_ctx, buf);
38010 DUK_LOCAL void duk__json_enc_bufobj(duk_json_enc_ctx *js_ctx, duk_hbufobj *h_bufobj) { argument
38014 DUK__EMIT_STRIDX(js_ctx, DUK_STRIDX_LC_NULL);
38017 duk__json_enc_buffer_data(js_ctx,
38018 (duk_uint8_t *) DUK_HBUFOBJ_GET_SLICE_BASE(js_ctx->thr->heap, h_bufobj),
38029 DUK_LOCAL void duk__json_enc_newline_indent(duk_json_enc_ctx *js_ctx, duk_uint_t depth) { argument
38030 DUK_ASSERT(js_ctx->h_gap != NULL);
38031 DUK_ASSERT(DUK_HSTRING_GET_BYTELEN(js_ctx->h_gap) > 0); /* caller guarantees */
38033 DUK__EMIT_1(js_ctx, 0x0a);
38035 DUK__EMIT_HSTR(js_ctx, js_ctx->h_gap);
38039 DUK_LOCAL void duk__json_enc_newline_indent(duk_json_enc_ctx *js_ctx, duk_uint_t depth) { argument
38047 DUK_ASSERT(js_ctx->h_gap != NULL);
38048 DUK_ASSERT(DUK_HSTRING_GET_BYTELEN(js_ctx->h_gap) > 0); /* caller guarantees */
38050 DUK__EMIT_1(js_ctx, 0x0a);
38061 gap_data = (const duk_uint8_t *) DUK_HSTRING_GET_DATA(js_ctx->h_gap);
38062 gap_len = (duk_size_t) DUK_HSTRING_GET_BYTELEN(js_ctx->h_gap);
38066 p = DUK_BW_ENSURE_GETPTR(js_ctx->thr, &js_ctx->bw, need_bytes);
38087 DUK_BW_SET_PTR(js_ctx->thr, &js_ctx->bw, p);
38092 DUK_LOCAL void duk__json_enc_objarr_entry(duk_json_enc_ctx *js_ctx, duk_idx_t *entry_top) { argument
38093 duk_hthread *thr = js_ctx->thr;
38108 n = js_ctx->recursion_depth;
38113 if (DUK_UNLIKELY(js_ctx->visiting[i] == h_target)) {
38119 if (js_ctx->recursion_depth < DUK_JSON_ENC_LOOPARRAY) {
38120 js_ctx->visiting[js_ctx->recursion_depth] = h_target;
38124 if (duk_has_prop(thr, js_ctx->idx_loop)) {
38129 duk_put_prop(thr, js_ctx->idx_loop); /* -> [ ... ] */
38134 DUK_ASSERT_DISABLE(js_ctx->recursion_depth >= 0); /* unsigned */
38135 DUK_ASSERT(js_ctx->recursion_depth <= js_ctx->recursion_limit);
38136 if (js_ctx->recursion_depth >= js_ctx->recursion_limit) {
38140 js_ctx->recursion_depth++;
38143 (long) duk_get_top(thr), (duk_tval *) duk_get_tval(thr, js_ctx->idx_loop)));
38147 DUK_LOCAL void duk__json_enc_objarr_exit(duk_json_enc_ctx *js_ctx, duk_idx_t *entry_top) { argument
38148 duk_hthread *thr = js_ctx->thr;
38153 DUK_ASSERT(js_ctx->recursion_depth > 0);
38154 DUK_ASSERT(js_ctx->recursion_depth <= js_ctx->recursion_limit);
38155 js_ctx->recursion_depth--;
38161 if (js_ctx->recursion_depth < DUK_JSON_ENC_LOOPARRAY) {
38165 duk_del_prop(thr, js_ctx->idx_loop); /* -> [ ... ] */
38172 (long) duk_get_top(thr), (duk_tval *) duk_get_tval(thr, js_ctx->idx_loop)));
38179 DUK_LOCAL void duk__json_enc_object(duk_json_enc_ctx *js_ctx) { argument
38180 duk_hthread *thr = js_ctx->thr;
38191 duk__json_enc_objarr_entry(js_ctx, &entry_top);
38195 if (js_ctx->idx_proplist >= 0) {
38196 idx_keys = js_ctx->idx_proplist;
38210 DUK__EMIT_1(js_ctx, DUK_ASC_LCURLY);
38231 prev_size = DUK_BW_GET_SIZE(js_ctx->thr, &js_ctx->bw);
38232 if (DUK_UNLIKELY(js_ctx->h_gap != NULL)) {
38233 duk__json_enc_newline_indent(js_ctx, js_ctx->recursion_depth);
38234 duk__json_enc_key_autoquote(js_ctx, h_key);
38235 DUK__EMIT_2(js_ctx, DUK_ASC_COLON, DUK_ASC_SPACE);
38237 duk__json_enc_key_autoquote(js_ctx, h_key);
38238 DUK__EMIT_1(js_ctx, DUK_ASC_COLON);
38243 if (DUK_UNLIKELY(duk__json_enc_value(js_ctx, idx_obj) == 0)) {
38247 DUK_BW_SET_SIZE(js_ctx->thr, &js_ctx->bw, prev_size);
38249 DUK__EMIT_1(js_ctx, DUK_ASC_COMMA);
38257 DUK_ASSERT(*((duk_uint8_t *) DUK_BW_GET_PTR(js_ctx->thr, &js_ctx->bw) - 1) == DUK_ASC_COMMA);
38258 DUK__UNEMIT_1(js_ctx); /* eat trailing comma */
38259 if (DUK_UNLIKELY(js_ctx->h_gap != NULL)) {
38260 DUK_ASSERT(js_ctx->recursion_depth >= 1);
38261 duk__json_enc_newline_indent(js_ctx, js_ctx->recursion_depth - 1U);
38264 DUK__EMIT_1(js_ctx, DUK_ASC_RCURLY);
38266 duk__json_enc_objarr_exit(js_ctx, &entry_top);
38275 DUK_LOCAL void duk__json_enc_array(duk_json_enc_ctx *js_ctx) { argument
38276 duk_hthread *thr = js_ctx->thr;
38285 duk__json_enc_objarr_entry(js_ctx, &entry_top);
38291 DUK__EMIT_1(js_ctx, DUK_ASC_LBRACKET);
38300 if (DUK_UNLIKELY(js_ctx->h_gap != NULL)) {
38301 DUK_ASSERT(js_ctx->recursion_depth >= 1);
38302 duk__json_enc_newline_indent(js_ctx, js_ctx->recursion_depth);
38309 if (DUK_UNLIKELY(duk__json_enc_value(js_ctx, idx_arr) == 0)) {
38311 DUK__EMIT_STRIDX(js_ctx, DUK_STRIDX_LC_NULL);
38318 DUK__EMIT_1(js_ctx, DUK_ASC_COMMA);
38323 DUK_ASSERT(*((duk_uint8_t *) DUK_BW_GET_PTR(js_ctx->thr, &js_ctx->bw) - 1) == DUK_ASC_COMMA);
38324 DUK__UNEMIT_1(js_ctx); /* eat trailing comma */
38325 if (DUK_UNLIKELY(js_ctx->h_gap != NULL)) {
38326 DUK_ASSERT(js_ctx->recursion_depth >= 1);
38327 duk__json_enc_newline_indent(js_ctx, js_ctx->recursion_depth - 1U);
38330 DUK__EMIT_1(js_ctx, DUK_ASC_RBRACKET);
38332 duk__json_enc_objarr_exit(js_ctx, &entry_top);
38341 DUK_LOCAL duk_bool_t duk__json_enc_value(duk_json_enc_ctx *js_ctx, duk_idx_t idx_holder) { argument
38342 duk_hthread *thr = js_ctx->thr;
38388 if (js_ctx->h_replacer) {
38391 duk_push_hobject(thr, js_ctx->h_replacer); /* -> [ ... key val replacer ] */
38413 js_ctx->flags & (DUK_JSON_FLAG_EXT_CUSTOM | DUK_JSON_FLAG_EXT_COMPATIBLE)) {
38418 duk__json_enc_bufobj(js_ctx, h_bufobj);
38463 if (js_ctx->flags & (DUK_JSON_FLAG_EXT_CUSTOM |
38467 DUK_ASSERT(js_ctx->flag_ext_custom || js_ctx->flag_ext_compatible);
38468 DUK__EMIT_STRIDX(js_ctx, js_ctx->stridx_custom_function);
38487 if (duk_check_type_mask(thr, -1, js_ctx->mask_for_undefined)) {
38498 DUK__EMIT_STRIDX(js_ctx, js_ctx->stridx_custom_undefined);
38503 DUK__EMIT_STRIDX(js_ctx, DUK_STRIDX_LC_NULL);
38507 DUK__EMIT_STRIDX(js_ctx, DUK_TVAL_GET_BOOLEAN(tv) ?
38514 duk__json_enc_pointer(js_ctx, DUK_TVAL_GET_POINTER(tv));
38524 duk__json_enc_quote_string(js_ctx, h);
38537 duk__json_enc_array(js_ctx);
38539 duk__json_enc_object(js_ctx);
38551 if (js_ctx->flag_ext_custom_or_compatible) {
38552 duk__json_enc_buffer_jx_jc(js_ctx, DUK_TVAL_GET_BUFFER(tv));
38561 duk__json_enc_object(js_ctx);
38567 DUK_ASSERT(js_ctx->flag_ext_custom || js_ctx->flag_ext_compatible);
38568 DUK__EMIT_STRIDX(js_ctx, js_ctx->stridx_custom_function);
38580 duk__json_enc_fastint_tval(js_ctx, tv);
38590 duk__json_enc_double(js_ctx);
38647 DUK_LOCAL duk_bool_t duk__json_stringify_fast_value(duk_json_enc_ctx *js_ctx, duk_tval *tv) { argument
38652 DUK_ASSERT(js_ctx != NULL);
38653 DUK_ASSERT(js_ctx->thr != NULL);
38664 if (js_ctx->flag_ext_custom || js_ctx->flag_ext_compatible) {
38665 DUK__EMIT_STRIDX(js_ctx, js_ctx->stridx_custom_undefined);
38675 DUK__EMIT_STRIDX(js_ctx, DUK_STRIDX_LC_NULL);
38679 DUK__EMIT_STRIDX(js_ctx, DUK_TVAL_GET_BOOLEAN(tv) ?
38690 duk__json_enc_quote_string(js_ctx, h);
38731 DUK_ASSERT_DISABLE(js_ctx->recursion_depth >= 0); /* unsigned */
38732 DUK_ASSERT(js_ctx->recursion_depth <= js_ctx->recursion_limit);
38733 if (js_ctx->recursion_depth >= js_ctx->recursion_limit) {
38735 DUK_ERROR_RANGE(js_ctx->thr, DUK_STR_DEC_RECLIMIT);
38739 for (i = 0, n = (duk_uint_fast32_t) js_ctx->recursion_depth; i < n; i++) {
38740 if (DUK_UNLIKELY(js_ctx->visiting[i] == obj)) {
38742 DUK_ERROR_TYPE(js_ctx->thr, DUK_STR_CYCLIC_INPUT);
38750 DUK_ASSERT(js_ctx->recursion_depth < DUK_JSON_ENC_LOOPARRAY);
38751 js_ctx->visiting[js_ctx->recursion_depth] = obj;
38752 js_ctx->recursion_depth++;
38764 if (duk_hobject_hasprop_raw(js_ctx->thr, obj, DUK_HTHREAD_STRING_TO_JSON(js_ctx->thr)) ||
38780 if (js_ctx->flag_ext_custom_or_compatible) {
38816 DUK__EMIT_1(js_ctx, DUK_ASC_LCURLY);
38831 k = DUK_HOBJECT_E_GET_KEY(js_ctx->thr->heap, obj, i);
38844 if (!DUK_HOBJECT_E_SLOT_IS_ENUMERABLE(js_ctx->thr->heap, obj, i)) {
38847 if (DUK_HOBJECT_E_SLOT_IS_ACCESSOR(js_ctx->thr->heap, obj, i)) {
38858 tv_val = DUK_HOBJECT_E_GET_VALUE_TVAL_PTR(js_ctx->thr->heap, obj, i);
38860 prev_size = DUK_BW_GET_SIZE(js_ctx->thr, &js_ctx->bw);
38861 if (DUK_UNLIKELY(js_ctx->h_gap != NULL)) {
38862 duk__json_enc_newline_indent(js_ctx, js_ctx->recursion_depth);
38863 duk__json_enc_key_autoquote(js_ctx, k);
38864 DUK__EMIT_2(js_ctx, DUK_ASC_COLON, DUK_ASC_SPACE);
38866 duk__json_enc_key_autoquote(js_ctx, k);
38867 DUK__EMIT_1(js_ctx, DUK_ASC_COLON);
38870 if (duk__json_stringify_fast_value(js_ctx, tv_val) == 0) {
38872 DUK_BW_SET_SIZE(js_ctx->thr, &js_ctx->bw, prev_size);
38874 DUK__EMIT_1(js_ctx, DUK_ASC_COMMA);
38885 DUK_ASSERT(*((duk_uint8_t *) DUK_BW_GET_PTR(js_ctx->thr, &js_ctx->bw) - 1) == DUK_ASC_COMMA);
38886 DUK__UNEMIT_1(js_ctx); /* eat trailing comma */
38887 if (DUK_UNLIKELY(js_ctx->h_gap != NULL)) {
38888 DUK_ASSERT(js_ctx->recursion_depth >= 1);
38889 duk__json_enc_newline_indent(js_ctx, js_ctx->recursion_depth - 1U);
38892 DUK__EMIT_1(js_ctx, DUK_ASC_RCURLY);
38897 DUK__EMIT_1(js_ctx, DUK_ASC_LBRACKET);
38916 if (DUK_UNLIKELY(js_ctx->h_gap != NULL)) {
38917 duk__json_enc_newline_indent(js_ctx, js_ctx->recursion_depth);
38921 tv_arrval = DUK_HOBJECT_A_GET_VALUE_PTR(js_ctx->thr->heap, obj, i);
38924 if (duk__json_stringify_fast_value(js_ctx, tv_arrval) == 0) {
38925 DUK__EMIT_STRIDX(js_ctx, DUK_STRIDX_LC_NULL);
38936 h_tmp = duk_push_uint_to_hstring(js_ctx->thr, (duk_uint_t) i);
38937 has_inherited = duk_hobject_hasprop_raw(js_ctx->thr, obj, h_tmp);
38938 duk_pop(js_ctx->thr);
38950 DUK__EMIT_STRIDX(js_ctx, js_ctx->stridx_custom_undefined);
38952 DUK__EMIT_STRIDX(js_ctx, DUK_STRIDX_LC_NULL);
38957 DUK__EMIT_1(js_ctx, DUK_ASC_COMMA);
38962 DUK_ASSERT(*((duk_uint8_t *) DUK_BW_GET_PTR(js_ctx->thr, &js_ctx->bw) - 1) == DUK_ASC_COMMA);
38963 DUK__UNEMIT_1(js_ctx); /* eat trailing comma */
38964 if (DUK_UNLIKELY(js_ctx->h_gap != NULL)) {
38965 DUK_ASSERT(js_ctx->recursion_depth >= 1);
38966 duk__json_enc_newline_indent(js_ctx, js_ctx->recursion_depth - 1U);
38969 DUK__EMIT_1(js_ctx, DUK_ASC_RBRACKET);
38991 tv_internal = duk_hobject_get_internal_value_tval_ptr(js_ctx->thr->heap, obj);
38999 DUK_ASSERT(js_ctx->recursion_depth > 0);
39000 js_ctx->recursion_depth--; /* required to keep recursion depth correct */
39005 DUK__EMIT_STRIDX(js_ctx, js_ctx->stridx_custom_function);
39008 duk__json_enc_bufobj(js_ctx, (duk_hbufobj *) obj);
39018 DUK_ASSERT(js_ctx->recursion_depth > 0);
39019 DUK_ASSERT(js_ctx->recursion_depth <= js_ctx->recursion_limit);
39020 js_ctx->recursion_depth--;
39024 DUK_ASSERT(js_ctx->recursion_depth > 0);
39025 DUK_ASSERT(js_ctx->recursion_depth <= js_ctx->recursion_limit);
39026 js_ctx->recursion_depth--;
39038 if (duk_hobject_hasprop_raw(js_ctx->thr,
39039 js_ctx->thr->builtins[DUK_BIDX_UINT8ARRAY_PROTOTYPE],
39040 DUK_HTHREAD_STRING_TO_JSON(js_ctx->thr))) {
39047 if (js_ctx->flag_ext_custom_or_compatible) {
39048 duk__json_enc_buffer_jx_jc(js_ctx, DUK_TVAL_GET_BUFFER(tv));
39056 duk__json_enc_buffer_json_fastpath(js_ctx, DUK_TVAL_GET_BUFFER(tv));
39061 if (js_ctx->flag_ext_custom_or_compatible) {
39062 duk__json_enc_pointer(js_ctx, DUK_TVAL_GET_POINTER(tv));
39084 duk__json_enc_fastint_tval(js_ctx, tv);
39096 duk_push_tval(js_ctx->thr, tv);
39097 duk__json_enc_double(js_ctx);
39098 duk_pop(js_ctx->thr);
39111 DUK__EMIT_CSTR(js_ctx, buf);
39123 DUK_ERROR_INTERNAL(js_ctx->thr);
39128 duk_json_enc_ctx *js_ctx; local
39134 js_ctx = (duk_json_enc_ctx *) udata;
39135 DUK_ASSERT(js_ctx != NULL);
39138 if (duk__json_stringify_fast_value(js_ctx, tv) == 0) {
39157 duk_json_dec_ctx *js_ctx = &js_ctx_alloc; local
39174 js_ctx->thr = thr;
39178 js_ctx->recursion_limit = DUK_USE_JSON_DEC_RECLIMIT;
39179 DUK_ASSERT(js_ctx->recursion_depth == 0);
39185 js_ctx->flags = flags;
39187 js_ctx->flag_ext_custom = flags & DUK_JSON_FLAG_EXT_CUSTOM;
39190 js_ctx->flag_ext_compatible = flags & DUK_JSON_FLAG_EXT_COMPATIBLE;
39193js_ctx->flag_ext_custom_or_compatible = flags & (DUK_JSON_FLAG_EXT_CUSTOM | DUK_JSON_FLAG_EXT_COMP…
39203 js_ctx->p_start = (const duk_uint8_t *) DUK_HSTRING_GET_DATA(h_text);
39204 js_ctx->p = js_ctx->p_start;
39205 js_ctx->p_end = ((const duk_uint8_t *) DUK_HSTRING_GET_DATA(h_text)) +
39207 DUK_ASSERT(*(js_ctx->p_end) == 0x00);
39209 duk__json_dec_value(js_ctx); /* -> [ ... value ] */
39210 DUK_ASSERT(js_ctx->recursion_depth == 0);
39216 if (js_ctx->p != js_ctx->p_end) {
39217 duk__json_dec_syntax_error(js_ctx);
39224 js_ctx->idx_reviver = idx_reviver;
39235 DUK_ASSERT(js_ctx->recursion_depth == 0);
39236 duk__json_dec_reviver_walk(js_ctx); /* [ ... val root "" ] -> [ ... val val' ] */
39237 DUK_ASSERT(js_ctx->recursion_depth == 0);
39263 duk_json_enc_ctx *js_ctx = &js_ctx_alloc; local
39287 js_ctx->thr = thr;
39289 js_ctx->h_replacer = NULL;
39290 js_ctx->h_gap = NULL;
39292 js_ctx->idx_proplist = -1;
39298 js_ctx->flags = flags;
39299 js_ctx->flag_ascii_only = flags & DUK_JSON_FLAG_ASCII_ONLY;
39300 js_ctx->flag_avoid_key_quotes = flags & DUK_JSON_FLAG_AVOID_KEY_QUOTES;
39302 js_ctx->flag_ext_custom = flags & DUK_JSON_FLAG_EXT_CUSTOM;
39305 js_ctx->flag_ext_compatible = flags & DUK_JSON_FLAG_EXT_COMPATIBLE;
39308js_ctx->flag_ext_custom_or_compatible = flags & (DUK_JSON_FLAG_EXT_CUSTOM | DUK_JSON_FLAG_EXT_COMP…
39315 js_ctx->stridx_custom_undefined = DUK_STRIDX_LC_NULL; /* standard JSON; array gaps */
39318 js_ctx->stridx_custom_undefined = DUK_STRIDX_LC_UNDEFINED;
39319 js_ctx->stridx_custom_nan = DUK_STRIDX_NAN;
39320 js_ctx->stridx_custom_neginf = DUK_STRIDX_MINUS_INFINITY;
39321 js_ctx->stridx_custom_posinf = DUK_STRIDX_INFINITY;
39322 js_ctx->stridx_custom_function =
39332 if (js_ctx->flags & DUK_JSON_FLAG_EXT_COMPATIBLE) {
39333 js_ctx->stridx_custom_undefined = DUK_STRIDX_JSON_EXT_UNDEFINED;
39334 js_ctx->stridx_custom_nan = DUK_STRIDX_JSON_EXT_NAN;
39335 js_ctx->stridx_custom_neginf = DUK_STRIDX_JSON_EXT_NEGINF;
39336 js_ctx->stridx_custom_posinf = DUK_STRIDX_JSON_EXT_POSINF;
39337 js_ctx->stridx_custom_function = DUK_STRIDX_JSON_EXT_FUNCTION1;
39343 if (js_ctx->flags & (DUK_JSON_FLAG_EXT_CUSTOM |
39345 DUK_ASSERT(js_ctx->mask_for_undefined == 0); /* already zero */
39355 js_ctx->mask_for_undefined = DUK_TYPE_MASK_UNDEFINED |
39360 DUK_BW_INIT_PUSHBUF(thr, &js_ctx->bw, DUK__JSON_STRINGIFY_BUFSIZE);
39362 js_ctx->idx_loop = duk_push_bare_object(thr);
39363 DUK_ASSERT(js_ctx->idx_loop >= 0);
39374 js_ctx->h_replacer = h;
39385 js_ctx->idx_proplist = duk_push_bare_array(thr);
39444 js_ctx->h_gap = duk_known_hstring(thr, -1);
39445 DUK_ASSERT(js_ctx->h_gap != NULL);
39449 js_ctx->h_gap = duk_known_hstring(thr, -1);
39454 if (js_ctx->h_gap != NULL) {
39459 if (DUK_HSTRING_GET_BYTELEN(js_ctx->h_gap) == 0) {
39460 js_ctx->h_gap = NULL;
39472 if (js_ctx->h_replacer == NULL && /* replacer is a mutation risk */
39473 js_ctx->idx_proplist == -1) { /* proplist is very rare */
39485 js_ctx->recursion_limit = DUK_JSON_ENC_LOOPARRAY;
39486 DUK_ASSERT(js_ctx->recursion_depth == 0);
39503 …pcall_rc = duk_safe_call(thr, duk__json_stringify_fast, (void *) js_ctx /*udata*/, 1 /*nargs*/, 0 …
39511 DUK_BW_PUSH_AS_STRING(thr, &js_ctx->bw);
39521 DUK_BW_RESET_SIZE(thr, &js_ctx->bw);
39522 js_ctx->recursion_depth = 0;
39536 (unsigned long) js_ctx->flags,
39537 (duk_tval *) duk_get_tval(thr, js_ctx->idx_loop),
39538 (duk_heaphdr *) js_ctx->h_replacer,
39539 … (duk_tval *) (js_ctx->idx_proplist >= 0 ? duk_get_tval(thr, js_ctx->idx_proplist) : NULL),
39540 (duk_heaphdr *) js_ctx->h_gap,
39549 js_ctx->recursion_limit = DUK_USE_JSON_ENC_RECLIMIT;
39550 DUK_ASSERT(js_ctx->recursion_depth == 0);
39552 …if (DUK_UNLIKELY(duk__json_enc_value(js_ctx, idx_holder) == 0)) { /* [ ... holder key ] -> [ ... …
39557 DUK_BW_PUSH_AS_STRING(thr, &js_ctx->bw);
39562 (unsigned long) js_ctx->flags,
39563 (duk_tval *) duk_get_tval(thr, js_ctx->idx_loop),
39564 (duk_heaphdr *) js_ctx->h_replacer,
39565 … (duk_tval *) (js_ctx->idx_proplist >= 0 ? duk_get_tval(thr, js_ctx->idx_proplist) : NULL),
39566 (duk_heaphdr *) js_ctx->h_gap,