Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
duk_api_internal.h File Reference

Go to the source code of this file.

Macros

#define DUK_PUSH_SPRINTF_INITIAL_SIZE   256L
 
#define DUK_PUSH_SPRINTF_SANITY_LIMIT   (1L * 1024L * 1024L * 1024L)
 
#define DUK_ERRCODE_FLAG_NOBLAME_FILELINE   (1L << 24)
 
#define DUK_VSRESIZE_FLAG_SHRINK   (1 << 0)
 
#define DUK_VSRESIZE_FLAG_COMPACT   (1 << 1)
 
#define DUK_VSRESIZE_FLAG_THROW   (1 << 2)
 
#define duk_push_u64(ctx, val)    duk_push_number((ctx), (duk_double_t) (val))
 
#define duk_push_i64(ctx, val)    duk_push_number((ctx), (duk_double_t) (val))
 
#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))
 
#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 */
 
#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))
 
#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)
 
#define DUK_ASSERT_VALID_NEGIDX(ctx, idx)    (DUK_ASSERT_EXPR((idx) < 0), DUK_ASSERT_EXPR(duk_is_valid_index((ctx), (idx))))
 
#define DUK_ASSERT_VALID_POSIDX(ctx, idx)    (DUK_ASSERT_EXPR((idx) >= 0), DUK_ASSERT_EXPR(duk_is_valid_index((ctx), (idx))))
 
#define DUK_GET_TVAL_NEGIDX(ctx, idx)    (DUK_ASSERT_VALID_NEGIDX((ctx),(idx)), ((duk_hthread *) (ctx))->valstack_top + (idx))
 
#define DUK_GET_TVAL_POSIDX(ctx, idx)    (DUK_ASSERT_VALID_POSIDX((ctx),(idx)), ((duk_hthread *) (ctx))->valstack_bottom + (idx))
 
#define DUK_GET_HOBJECT_NEGIDX(ctx, idx)    (DUK_ASSERT_VALID_NEGIDX((ctx),(idx)), DUK_TVAL_GET_OBJECT(((duk_hthread *) (ctx))->valstack_top + (idx)))
 
#define DUK_GET_HOBJECT_POSIDX(ctx, idx)    (DUK_ASSERT_VALID_POSIDX((ctx),(idx)), DUK_TVAL_GET_OBJECT(((duk_hthread *) (ctx))->valstack_bottom + (idx)))
 

Functions

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_tvalduk_get_tval (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL duk_tvalduk_require_tval (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL void duk_push_tval (duk_context *ctx, duk_tval *tv)
 
DUK_INTERNAL_DECL void duk_push_this_check_object_coercible (duk_context *ctx)
 
DUK_INTERNAL_DECL duk_hobjectduk_push_this_coercible_to_object (duk_context *ctx)
 
DUK_INTERNAL_DECL duk_hstringduk_push_this_coercible_to_string (duk_context *ctx)
 
DUK_INTERNAL_DECL duk_tvalduk_get_borrowed_this_tval (duk_context *ctx)
 
DUK_INTERNAL_DECL duk_hstringduk_get_hstring (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL duk_hobjectduk_get_hobject (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL duk_hbufferduk_get_hbuffer (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL duk_hthreadduk_get_hthread (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL duk_hcompiledfunctionduk_get_hcompiledfunction (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL duk_hnativefunctionduk_get_hnativefunction (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL duk_hobjectduk_get_hobject_with_class (duk_context *ctx, duk_idx_t index, duk_small_uint_t classnum)
 
DUK_INTERNAL_DECL duk_hobjectduk_get_hobject_or_lfunc_coerce (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL duk_hstringduk_to_hstring (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL void duk_to_object_class_string_top (duk_context *ctx)
 
DUK_INTERNAL_DECL void duk_push_hobject_class_string (duk_context *ctx, duk_hobject *h)
 
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)
 
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_hstringduk_require_hstring (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL duk_hobjectduk_require_hobject (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL duk_hbufferduk_require_hbuffer (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL duk_hthreadduk_require_hthread (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL duk_hcompiledfunctionduk_require_hcompiledfunction (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL duk_hnativefunctionduk_require_hnativefunction (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL duk_hobjectduk_require_hobject_with_class (duk_context *ctx, duk_idx_t index, duk_small_uint_t classnum)
 
DUK_INTERNAL_DECL duk_hobjectduk_require_hobject_or_lfunc (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL duk_hobjectduk_require_hobject_or_lfunc_coerce (duk_context *ctx, duk_idx_t index)
 
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)
 
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_hbufferobjectduk_push_bufferobject_raw (duk_context *ctx, duk_uint_t hobject_flags_and_class, duk_small_int_t prototype_bidx)
 
DUK_INTERNAL_DECL const char * duk_push_string_readable (duk_context *ctx, duk_idx_t index)
 
DUK_INTERNAL_DECL const char * duk_push_string_tval_readable (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)
 
DUK_INTERNAL_DECL duk_bool_t duk_put_prop_stridx (duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx)
 
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)
 
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)
 
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)
 
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)
 
DUK_INTERNAL_DECL void duk_set_length (duk_context *ctx, duk_idx_t index, duk_size_t length)
 

Macro Definition Documentation

◆ DUK_ASSERT_VALID_NEGIDX

#define DUK_ASSERT_VALID_NEGIDX ( ctx,
idx )    (DUK_ASSERT_EXPR((idx) < 0), DUK_ASSERT_EXPR(duk_is_valid_index((ctx), (idx))))

Definition at line 181 of file duktape-1.8.0/src-separate/duk_api_internal.h.

181#define DUK_ASSERT_VALID_NEGIDX(ctx,idx) \
182 (DUK_ASSERT_EXPR((idx) < 0), DUK_ASSERT_EXPR(duk_is_valid_index((ctx), (idx))))

◆ DUK_ASSERT_VALID_POSIDX

#define DUK_ASSERT_VALID_POSIDX ( ctx,
idx )    (DUK_ASSERT_EXPR((idx) >= 0), DUK_ASSERT_EXPR(duk_is_valid_index((ctx), (idx))))

Definition at line 183 of file duktape-1.8.0/src-separate/duk_api_internal.h.

183#define DUK_ASSERT_VALID_POSIDX(ctx,idx) \
184 (DUK_ASSERT_EXPR((idx) >= 0), DUK_ASSERT_EXPR(duk_is_valid_index((ctx), (idx))))

◆ DUK_ERRCODE_FLAG_NOBLAME_FILELINE

#define DUK_ERRCODE_FLAG_NOBLAME_FILELINE   (1L << 24)

◆ DUK_GET_HOBJECT_NEGIDX

#define DUK_GET_HOBJECT_NEGIDX ( ctx,
idx )    (DUK_ASSERT_VALID_NEGIDX((ctx),(idx)), DUK_TVAL_GET_OBJECT(((duk_hthread *) (ctx))->valstack_top + (idx)))

Definition at line 189 of file duktape-1.8.0/src-separate/duk_api_internal.h.

189#define DUK_GET_HOBJECT_NEGIDX(ctx,idx) \
190 (DUK_ASSERT_VALID_NEGIDX((ctx),(idx)), DUK_TVAL_GET_OBJECT(((duk_hthread *) (ctx))->valstack_top + (idx)))

◆ DUK_GET_HOBJECT_POSIDX

#define DUK_GET_HOBJECT_POSIDX ( ctx,
idx )    (DUK_ASSERT_VALID_POSIDX((ctx),(idx)), DUK_TVAL_GET_OBJECT(((duk_hthread *) (ctx))->valstack_bottom + (idx)))

Definition at line 191 of file duktape-1.8.0/src-separate/duk_api_internal.h.

191#define DUK_GET_HOBJECT_POSIDX(ctx,idx) \
192 (DUK_ASSERT_VALID_POSIDX((ctx),(idx)), DUK_TVAL_GET_OBJECT(((duk_hthread *) (ctx))->valstack_bottom + (idx)))

◆ DUK_GET_TVAL_NEGIDX

#define DUK_GET_TVAL_NEGIDX ( ctx,
idx )    (DUK_ASSERT_VALID_NEGIDX((ctx),(idx)), ((duk_hthread *) (ctx))->valstack_top + (idx))

Definition at line 185 of file duktape-1.8.0/src-separate/duk_api_internal.h.

185#define DUK_GET_TVAL_NEGIDX(ctx,idx) \
186 (DUK_ASSERT_VALID_NEGIDX((ctx),(idx)), ((duk_hthread *) (ctx))->valstack_top + (idx))

◆ DUK_GET_TVAL_POSIDX

#define DUK_GET_TVAL_POSIDX ( ctx,
idx )    (DUK_ASSERT_VALID_POSIDX((ctx),(idx)), ((duk_hthread *) (ctx))->valstack_bottom + (idx))

Definition at line 187 of file duktape-1.8.0/src-separate/duk_api_internal.h.

187#define DUK_GET_TVAL_POSIDX(ctx,idx) \
188 (DUK_ASSERT_VALID_POSIDX((ctx),(idx)), ((duk_hthread *) (ctx))->valstack_bottom + (idx))

◆ duk_push_hcompiledfunction

#define duk_push_hcompiledfunction ( ctx,
h )    duk_push_hobject((ctx), (duk_hobject *) (h))

Definition at line 128 of file duktape-1.8.0/src-separate/duk_api_internal.h.

128#define duk_push_hcompiledfunction(ctx,h) \
129 duk_push_hobject((ctx), (duk_hobject *) (h))

◆ duk_push_hnativefunction

#define duk_push_hnativefunction ( ctx,
h )    duk_push_hobject((ctx), (duk_hobject *) (h))

Definition at line 130 of file duktape-1.8.0/src-separate/duk_api_internal.h.

130#define duk_push_hnativefunction(ctx,h) \
131 duk_push_hobject((ctx), (duk_hobject *) (h))

◆ duk_push_hthread

#define duk_push_hthread ( ctx,
h )    duk_push_hobject((ctx), (duk_hobject *) (h))

Definition at line 126 of file duktape-1.8.0/src-separate/duk_api_internal.h.

126#define duk_push_hthread(ctx,h) \
127 duk_push_hobject((ctx), (duk_hobject *) (h))

◆ duk_push_i32

#define duk_push_i32 ( ctx,
val )    duk_push_int((ctx), (duk_int_t) (val))

Definition at line 65 of file duktape-1.8.0/src-separate/duk_api_internal.h.

65#define duk_push_i32(ctx,val) \
66 duk_push_int((ctx), (duk_int_t) (val))

◆ duk_push_i64

#define duk_push_i64 ( ctx,
val )    duk_push_number((ctx), (duk_double_t) (val))

Definition at line 59 of file duktape-1.8.0/src-separate/duk_api_internal.h.

59#define duk_push_i64(ctx,val) \
60 duk_push_number((ctx), (duk_double_t) (val))

◆ duk_push_idx

#define duk_push_idx ( ctx,
val )    duk_push_int((ctx), (duk_int_t) (val))

Definition at line 69 of file duktape-1.8.0/src-separate/duk_api_internal.h.

69#define duk_push_idx(ctx,val) \
70 duk_push_int((ctx), (duk_int_t) (val))

◆ duk_push_size_t

#define duk_push_size_t ( ctx,
val )    duk_push_uint((ctx), (duk_uint_t) (val)) /* XXX: assumed to fit for now */

Definition at line 73 of file duktape-1.8.0/src-separate/duk_api_internal.h.

73#define duk_push_size_t(ctx,val) \
74 duk_push_uint((ctx), (duk_uint_t) (val)) /* XXX: assumed to fit for now */

◆ DUK_PUSH_SPRINTF_INITIAL_SIZE

#define DUK_PUSH_SPRINTF_INITIAL_SIZE   256L

◆ DUK_PUSH_SPRINTF_SANITY_LIMIT

#define DUK_PUSH_SPRINTF_SANITY_LIMIT   (1L * 1024L * 1024L * 1024L)

◆ duk_push_u32

#define duk_push_u32 ( ctx,
val )    duk_push_uint((ctx), (duk_uint_t) (val))

Definition at line 63 of file duktape-1.8.0/src-separate/duk_api_internal.h.

63#define duk_push_u32(ctx,val) \
64 duk_push_uint((ctx), (duk_uint_t) (val))

◆ duk_push_u64

#define duk_push_u64 ( ctx,
val )    duk_push_number((ctx), (duk_double_t) (val))

Definition at line 57 of file duktape-1.8.0/src-separate/duk_api_internal.h.

57#define duk_push_u64(ctx,val) \
58 duk_push_number((ctx), (duk_double_t) (val))

◆ duk_push_uarridx

#define duk_push_uarridx ( ctx,
val )    duk_push_uint((ctx), (duk_uint_t) (val))

Definition at line 71 of file duktape-1.8.0/src-separate/duk_api_internal.h.

71#define duk_push_uarridx(ctx,val) \
72 duk_push_uint((ctx), (duk_uint_t) (val))

◆ DUK_VSRESIZE_FLAG_COMPACT

#define DUK_VSRESIZE_FLAG_COMPACT   (1 << 1)

◆ DUK_VSRESIZE_FLAG_SHRINK

#define DUK_VSRESIZE_FLAG_SHRINK   (1 << 0)

◆ DUK_VSRESIZE_FLAG_THROW

#define DUK_VSRESIZE_FLAG_THROW   (1 << 2)

◆ duk_xdef_prop_index_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)

Definition at line 168 of file duktape-1.8.0/src-separate/duk_api_internal.h.

168#define duk_xdef_prop_index_wec(ctx,obj_index,arr_index) \
169 duk_xdef_prop_index((ctx), (obj_index), (arr_index), DUK_PROPDESC_FLAGS_WEC)

◆ duk_xdef_prop_stridx_wec

#define duk_xdef_prop_stridx_wec ( ctx,
obj_index,
stridx )    duk_xdef_prop_stridx((ctx), (obj_index), (stridx), DUK_PROPDESC_FLAGS_WEC)

Definition at line 170 of file duktape-1.8.0/src-separate/duk_api_internal.h.

170#define duk_xdef_prop_stridx_wec(ctx,obj_index,stridx) \
171 duk_xdef_prop_stridx((ctx), (obj_index), (stridx), DUK_PROPDESC_FLAGS_WEC)

◆ duk_xdef_prop_wec

#define duk_xdef_prop_wec ( ctx,
obj_index )    duk_xdef_prop((ctx), (obj_index), DUK_PROPDESC_FLAGS_WEC)

Definition at line 166 of file duktape-1.8.0/src-separate/duk_api_internal.h.

166#define duk_xdef_prop_wec(ctx,obj_index) \
167 duk_xdef_prop((ctx), (obj_index), DUK_PROPDESC_FLAGS_WEC)

Function Documentation

◆ duk_del_prop_stridx()

DUK_INTERNAL_DECL duk_bool_t duk_del_prop_stridx ( duk_context * ctx,
duk_idx_t obj_index,
duk_small_int_t stridx )

Definition at line 14458 of file duktape-1.5.2/src-noline/duktape.c.

14458 {
14460 DUK_ASSERT(key != NULL);
14461
14462 obj_index = duk_require_normalize_index(ctx, obj_index);
14463 duk_push_string(ctx, key);
14464 return duk_del_prop(ctx, obj_index);
14465}
14466
14469
duk_small_int_t duk_bool_t
#define DUK_ASSERT_CTX_VALID(ctx)
DUK_EXTERNAL const char * duk_push_string(duk_context *ctx, const char *str)
DUK_EXTERNAL duk_idx_t duk_require_normalize_index(duk_context *ctx, duk_idx_t index)
DUK_EXTERNAL duk_bool_t duk_del_prop_index(duk_context *ctx, duk_idx_t obj_index, duk_uarridx_t arr_index)
DUK_EXTERNAL duk_bool_t duk_del_prop(duk_context *ctx, duk_idx_t obj_index)
#define NULL
Definition gmacros.h:924

References DUK_ASSERT, DUK_ASSERT_CTX_VALID, DUK_ASSERT_DISABLE, duk_del_prop(), DUK_HEAP_NUM_STRINGS, DUK_HTHREAD_GET_STRING, duk_push_hstring(), duk_push_string(), duk_require_normalize_index(), DUK_UNREF, and NULL.

Referenced by duk_js_close_environment_record().

◆ duk_get_borrowed_this_tval()

DUK_INTERNAL_DECL duk_tval * duk_get_borrowed_this_tval ( duk_context * ctx)

Definition at line 18207 of file duktape-1.5.2/src-noline/duktape.c.

18212 {
18213 duk_hstring *h;
18214
18216
18217 duk__push_this_helper(ctx, 1 /*check_object_coercible*/);
18218 duk_to_string(ctx, -1);
DUK_LOCAL void duk__push_this_helper(duk_context *ctx, duk_small_uint_t check_object_coercible)
DUK_EXTERNAL const char * duk_to_string(duk_context *ctx, duk_idx_t index)

References duk_hthread::callstack_top, DUK_ASSERT, NULL, duk_hthread::valstack, and duk_hthread::valstack_bottom.

Referenced by duk__getrequire_bufobj_this(), and duk_bi_buffer_prototype_tostring_shared().

◆ duk_get_hbuffer()

◆ duk_get_hcompiledfunction()

DUK_INTERNAL_DECL duk_hcompiledfunction * duk_get_hcompiledfunction ( duk_context * ctx,
duk_idx_t index )

Definition at line 16344 of file duktape-1.5.2/src-noline/duktape.c.

16344 {
16346 if (h != NULL && !DUK_HOBJECT_IS_THREAD(h)) {
16347 h = NULL;
16348 }
16349 return (duk_hthread *) h;
16350}
guint index
#define DUK_HOBJECT_IS_THREAD(h)
DUK_LOCAL_DECL duk_heaphdr * duk__get_tagged_heaphdr_raw(duk_context *ctx, duk_idx_t index, duk_uint_t tag)

References duk__get_tagged_heaphdr_raw(), DUK_HOBJECT_IS_COMPILEDFUNCTION, DUK_HOBJECT_IS_THREAD, DUK_TAG_OBJECT, index, and NULL.

Referenced by duk__load_func(), duk__load_func(), and duk_js_push_closure().

◆ duk_get_hnativefunction()

◆ duk_get_hobject()

◆ duk_get_hobject_or_lfunc_coerce()

DUK_INTERNAL_DECL duk_hobject * duk_get_hobject_or_lfunc_coerce ( duk_context * ctx,
duk_idx_t index )

Definition at line 16483 of file duktape-1.5.2/src-noline/duktape.c.

16491 {
16492}
16493#endif
16494
16495/* Useful for internal call sites where we either expect an object (function)
16496 * or a lightfunc. Accepts an object (returned as is) or a lightfunc (coerced
16497 * to an object). Return value is NULL if value is neither an object nor a
16498 * lightfunc.

References DUK_ASSERT, DUK_ASSERT_CTX_VALID, duk_require_hobject(), duk_require_tval(), duk_to_object(), DUK_TVAL_GET_OBJECT, DUK_TVAL_IS_LIGHTFUNC, DUK_TVAL_IS_OBJECT, index, and NULL.

Referenced by duk__enc_value(), duk_def_prop(), duk_hobject_prepare_property_descriptor(), and duk_js_instanceof().

◆ duk_get_hobject_with_class()

DUK_INTERNAL_DECL duk_hobject * duk_get_hobject_with_class ( duk_context * ctx,
duk_idx_t index,
duk_small_uint_t classnum )

Definition at line 16541 of file duktape-1.5.2/src-noline/duktape.c.

16541 {
16542 duk_hthread *thr = (duk_hthread *) ctx;
16543 duk_tval *tv;
16544
16546
16547 tv = duk_require_tval(ctx, index);
16548 if (DUK_TVAL_IS_OBJECT(tv)) {
16549 return DUK_TVAL_GET_OBJECT(tv);
16550 } else if (DUK_TVAL_IS_LIGHTFUNC(tv)) {
16551 duk_to_object(ctx, index);
16552 return duk_require_hobject(ctx, index);
16553 }
DUK_INTERNAL_DECL duk_hobject * duk_require_hobject(duk_context *ctx, duk_idx_t index)
#define DUK_TVAL_GET_OBJECT(tv)
#define DUK_TVAL_IS_OBJECT(tv)
#define DUK_TVAL_IS_LIGHTFUNC(tv)
DUK_INTERNAL_DECL duk_tval * duk_require_tval(duk_context *ctx, duk_idx_t index)
DUK_EXTERNAL void duk_to_object(duk_context *ctx, duk_idx_t index)

References duk__get_tagged_heaphdr_raw(), DUK_ASSERT, DUK_ASSERT_CTX_VALID, DUK_ASSERT_DISABLE, DUK_ERROR_REQUIRE_TYPE_INDEX, DUK_HOBJECT_CLASS_MAX, DUK_HOBJECT_GET_CLASS_NUMBER, duk_require_hobject(), duk_require_tval(), DUK_STR_NOT_OBJECT, DUK_TAG_OBJECT, duk_to_object(), DUK_TVAL_GET_OBJECT, DUK_TVAL_IS_LIGHTFUNC, DUK_TVAL_IS_OBJECT, index, and NULL.

Referenced by duk__to_regexp_helper(), duk_bi_array_constructor_is_array(), duk_bi_array_prototype_concat(), duk_bi_array_prototype_to_string(), duk_bi_string_prototype_replace(), and duk_bi_string_prototype_split().

◆ duk_get_hstring()

◆ duk_get_hthread()

◆ duk_get_prop_stridx()

DUK_INTERNAL_DECL duk_bool_t duk_get_prop_stridx ( duk_context * ctx,
duk_idx_t obj_index,
duk_small_int_t stridx )

Definition at line 14318 of file duktape-1.5.2/src-noline/duktape.c.

14318 {
14320 DUK_ASSERT(key != NULL);
14321
14322 obj_index = duk_require_normalize_index(ctx, obj_index);
14323 duk_push_string(ctx, key);
14324 return duk_get_prop(ctx, obj_index);
14325}
14326
14329
DUK_EXTERNAL duk_bool_t duk_get_prop_index(duk_context *ctx, duk_idx_t obj_index, duk_uarridx_t arr_index)
DUK_EXTERNAL duk_bool_t duk_get_prop(duk_context *ctx, duk_idx_t obj_index)

References DUK_ASSERT, DUK_ASSERT_CTX_VALID, DUK_ASSERT_DISABLE, duk_get_prop(), DUK_HEAP_NUM_STRINGS, DUK_HTHREAD_GET_STRING, duk_push_hstring(), duk_push_string(), duk_require_normalize_index(), DUK_UNREF, and NULL.

Referenced by duk__add_compiler_error_line(), duk__create_arguments_object(), duk__defaultvalue_coerce_attempt(), duk__enc_value(), duk__error_getter_helper(), duk__finalize_helper(), duk__handle_bound_chain_for_call(), duk__js_execute_bytecode_inner(), duk__parse_stmt(), duk__proxy_check_prop(), duk__push_stash(), duk__push_this_get_timeval_tzoffset(), duk__push_this_number_plain(), duk__push_this_obj_len_u32(), duk__push_this_obj_len_u32_limited(), duk__put_prop_shared(), duk__regexp_match_helper(), duk_bi_array_prototype_join_shared(), duk_bi_array_prototype_to_string(), duk_bi_boolean_constructor(), duk_bi_boolean_prototype_tostring_shared(), duk_bi_buffer_slice_shared(), duk_bi_date_prototype_to_json(), duk_bi_duktape_object_fin(), duk_bi_error_prototype_to_string(), duk_bi_function_prototype_apply(), duk_bi_function_prototype_bind(), duk_bi_function_prototype_to_string(), duk_bi_global_object_require(), duk_bi_logger_constructor(), duk_bi_logger_prototype_fmt(), duk_bi_logger_prototype_log_shared(), duk_bi_object_constructor_keys_shared(), duk_bi_object_prototype_is_prototype_of(), duk_bi_object_prototype_to_locale_string(), duk_bi_pointer_prototype_tostring_shared(), duk_bi_regexp_constructor(), duk_bi_regexp_prototype_to_string(), duk_bi_string_prototype_match(), duk_bi_string_prototype_replace(), duk_bi_string_prototype_search(), duk_bi_string_prototype_split(), duk_bi_string_prototype_to_string(), duk_get_finalizer(), duk_get_prop_stridx_boolean(), duk_hobject_enumerator_create(), duk_hobject_enumerator_next(), duk_hobject_pc2line_query(), duk_hobject_prepare_property_descriptor(), duk_hthread_create_builtin_objects(), duk_js_close_environment_record(), duk_js_instanceof(), duk_js_push_closure(), duk_log_va(), duk_new(), and duk_to_defaultvalue().

◆ duk_get_prop_stridx_boolean()

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 )

Definition at line 14331 of file duktape-1.5.2/src-noline/duktape.c.

14335 {
14336 duk_hthread *thr = (duk_hthread *) ctx;
14337
14339 DUK_ASSERT_DISABLE(stridx >= 0);
14341 DUK_UNREF(thr);
14342
14343 obj_index = duk_require_normalize_index(ctx, obj_index);
14344 duk_push_hstring(ctx, DUK_HTHREAD_GET_STRING(thr, stridx));
14345 return duk_get_prop(ctx, obj_index);
14346}
#define DUK_ASSERT_DISABLE(x)
#define DUK_HTHREAD_GET_STRING(thr, idx)
DUK_INTERNAL_DECL void duk_push_hstring(duk_context *ctx, duk_hstring *h)

References DUK_ASSERT, DUK_ASSERT_CTX_VALID, DUK_ASSERT_DISABLE, duk_get_prop_stridx(), DUK_HEAP_NUM_STRINGS, duk_pop(), and duk_to_boolean().

Referenced by duk_bi_regexp_constructor(), duk_bi_string_prototype_match(), and duk_bi_string_prototype_replace().

◆ duk_get_tval()

DUK_INTERNAL_DECL duk_tval * duk_get_tval ( duk_context * ctx,
duk_idx_t index )

Definition at line 15121 of file duktape-1.5.2/src-noline/duktape.c.

15121 {
15122 uindex = vs_size + (duk_uidx_t) index;
15123 } else {
15125 uindex = (duk_uidx_t) index;
15126 }
15127
15128 /* DUK_INVALID_INDEX won't be accepted as a valid index. */
15129 DUK_ASSERT(vs_size + (duk_uidx_t) DUK_INVALID_INDEX >= vs_size);
15130
15131 if (DUK_LIKELY(uindex < vs_size)) {
15132 return (duk_idx_t) uindex;
15133 }
15135 return 0; /* unreachable */
15136}
15137
15139 duk_hthread *thr = (duk_hthread *) ctx;
15140 duk_uidx_t vs_size;
15141 duk_uidx_t uindex;
15142
15145
15147 vs_size = (duk_uidx_t) (thr->valstack_top - thr->valstack_bottom);
#define DUK_ERROR_API_INDEX(thr, index)
DUK_INTERNAL_DECL duk_tval * duk_get_tval(duk_context *ctx, duk_idx_t index)

References DUK_ASSERT, DUK_ASSERT_CTX_VALID, DUK_ASSERT_DISABLE, DUK_INVALID_INDEX, DUK_LIKELY, index, NULL, duk_hthread::valstack_bottom, and duk_hthread::valstack_top.

Referenced by duk__add_compiler_error_line(), duk__add_traceback(), duk__advance_helper(), duk__api_coerce_d2i(), duk__api_coerce_d2ui(), duk__array_qsort(), duk__array_sort_compare(), duk__call_prop_prep_stack(), duk__concat_and_join_helper(), duk__convert_to_func_template(), duk__dec_array(), duk__dec_number(), duk__dec_object(), duk__dec_reviver_walk(), duk__enc_array(), duk__enc_objarr_entry(), duk__enc_objarr_exit(), duk__enc_object(), duk__enc_value(), duk__error_setter_helper(), duk__get_buffer_data_helper(), duk__get_buffer_helper(), duk__get_own_propdesc_raw(), duk__get_tagged_heaphdr_raw(), duk__handle_bound_chain_for_call(), duk__handle_call_inner(), duk__handle_put_array_length(), duk__init_varmap_and_prologue_for_pass2(), duk__ispec_toregconst_raw(), duk__ivalue_toplain_raw(), duk__ivalue_toregconst_raw(), duk__js_execute_bytecode_inner(), duk__load_func(), duk__load_func(), duk__lookup_active_register_binding(), duk__lookup_arguments_map(), duk__nud_object_literal(), duk__nud_object_literal_key_check(), duk__parse_stmt(), duk__parse_try_stmt(), duk__push_this_number_plain(), duk__regexp_match_helper(), duk__tag_check(), duk_bi_array_prototype_join_shared(), duk_bi_array_prototype_reduce_shared(), duk_bi_array_prototype_to_string(), duk_bi_boolean_prototype_tostring_shared(), duk_bi_buffer_writefield(), duk_bi_duktape_object_info(), 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_eval(), duk_bi_global_object_require(), duk_bi_json_parse_helper(), duk_bi_json_stringify_helper(), duk_bi_nodejs_buffer_is_buffer(), duk_bi_object_constructor_create(), duk_bi_object_constructor_define_properties(), duk_bi_object_constructor_define_property(), duk_bi_regexp_constructor(), duk_bi_string_prototype_char_code_at(), duk_bi_thread_resume(), duk_bi_thread_yield(), duk_bi_typedarray_constructor(), duk_dump_function(), duk_equals(), duk_err_create_and_throw(), duk_get_boolean(), duk_get_c_function(), duk_get_heapptr(), duk_get_length(), duk_get_lstring(), duk_get_number(), duk_get_pointer(), duk_get_type(), duk_get_type_mask(), duk_handle_ecma_call_setup(), duk_hobject_define_property_helper(), duk_hobject_define_property_internal(), duk_hobject_define_property_internal_arridx(), duk_hobject_enumerator_create(), duk_hobject_enumerator_next(), duk_hobject_getprop(), duk_hobject_pc2line_pack(), duk_hobject_prototype_chain_contains(), duk_hobject_putprop(), duk_hobject_run_finalizer(), duk_hthread_create_builtin_objects(), duk_is_buffer_data(), duk_is_c_function(), duk_is_dynamic_buffer(), duk_is_external_buffer(), duk_is_fixed_buffer(), duk_is_function(), duk_is_nan(), duk_is_null_or_undefined(), duk_is_number(), duk_js_close_environment_record(), duk_js_push_closure(), duk_new(), duk_numconv_parse(), duk_push_string_readable(), duk_regexp_compile(), duk_require_boolean(), duk_require_heapptr(), duk_require_null(), duk_require_number(), duk_require_pointer(), duk_require_undefined(), duk_set_global_object(), duk_strict_equals(), duk_throw(), and duk_to_int_clamped_raw().

◆ duk_has_prop_stridx()

DUK_INTERNAL_DECL duk_bool_t duk_has_prop_stridx ( duk_context * ctx,
duk_idx_t obj_index,
duk_small_int_t stridx )

Definition at line 14510 of file duktape-1.5.2/src-noline/duktape.c.

14510 {
14512 DUK_ASSERT(key != NULL);
14513
14514 obj_index = duk_require_normalize_index(ctx, obj_index);
14515 duk_push_string(ctx, key);
14516 return duk_has_prop(ctx, obj_index);
14517}
14518
14521
DUK_EXTERNAL duk_bool_t duk_has_prop_index(duk_context *ctx, duk_idx_t obj_index, duk_uarridx_t arr_index)
DUK_EXTERNAL duk_bool_t duk_has_prop(duk_context *ctx, duk_idx_t obj_index)

References DUK_ASSERT, DUK_ASSERT_CTX_VALID, DUK_ASSERT_DISABLE, duk_has_prop(), DUK_HEAP_NUM_STRINGS, DUK_HTHREAD_GET_STRING, duk_push_hstring(), duk_push_string(), duk_require_normalize_index(), DUK_UNREF, and NULL.

Referenced by duk__init_varmap_and_prologue_for_pass2(), and duk_js_push_closure().

◆ duk_push_bufferobject_raw()

DUK_INTERNAL_DECL duk_hbufferobject * duk_push_bufferobject_raw ( duk_context * ctx,
duk_uint_t hobject_flags_and_class,
duk_small_int_t prototype_bidx )

Definition at line 18735 of file duktape-1.5.2/src-noline/duktape.c.

18737 {
18738 goto api_error;
18739 }
18740
18741 lf_flags = DUK_LFUNC_FLAGS_PACK(magic, length, nargs);
18742 DUK_TVAL_SET_LIGHTFUNC(&tv_tmp, func, lf_flags);
18743 duk_push_tval(ctx, &tv_tmp); /* XXX: direct valstack write */
18744 DUK_ASSERT(thr->valstack_top != thr->valstack_bottom);
18745 return ((duk_idx_t) (thr->valstack_top - thr->valstack_bottom)) - 1;
18746
18747 api_error:
18749 return 0; /* not reached */
18750}
18751
18752DUK_INTERNAL duk_hbufferobject *duk_push_bufferobject_raw(duk_context *ctx, duk_uint_t hobject_flags_and_class, duk_small_int_t prototype_bidx) {
18753 duk_hthread *thr = (duk_hthread *) ctx;
18754 duk_hbufferobject *obj;
18755 duk_tval *tv_slot;
18756
18757 DUK_ASSERT(ctx != NULL);
18758 DUK_ASSERT(prototype_bidx >= 0);
18759
18760 /* check stack first */
18761 if (thr->valstack_top >= thr->valstack_end) {
duk_uint_fast32_t duk_uint_t
#define DUK_STR_INVALID_CALL_ARGS
#define DUK_ERROR_API(thr, msg)
#define DUK_LFUNC_FLAGS_PACK(magic, length, nargs)
DUK_INTERNAL_DECL void duk_push_tval(duk_context *ctx, duk_tval *tv)
DUK_INTERNAL_DECL duk_hbufferobject * duk_push_bufferobject_raw(duk_context *ctx, duk_uint_t hobject_flags_and_class, duk_small_int_t prototype_bidx)
#define DUK_STR_PUSH_BEYOND_ALLOC_STACK
#define DUK_TVAL_SET_LIGHTFUNC(tv, fp, flags)

References duk_hthread::builtins, DUK_ASSERT, DUK_ASSERT_HBUFFEROBJECT_VALID, DUK_ERROR_ALLOC_DEFMSG, DUK_ERROR_API, duk_hbufferobject_alloc(), DUK_HOBJECT_INCREF, DUK_HOBJECT_SET_PROTOTYPE_UPDREF, DUK_STR_PUSH_BEYOND_ALLOC_STACK, DUK_TVAL_SET_OBJECT, duk_hthread::heap, NULL, duk_hthread::valstack_end, and duk_hthread::valstack_top.

Referenced by duk__push_arraybuffer_with_length(), duk_bi_arraybuffer_constructor(), duk_bi_buffer_constructor(), duk_bi_buffer_slice_shared(), duk_bi_dataview_constructor(), duk_bi_nodejs_buffer_concat(), duk_bi_nodejs_buffer_constructor(), duk_bi_typedarray_constructor(), duk_push_buffer_object(), and duk_to_object().

◆ duk_push_c_function_noconstruct_noexotic()

DUK_INTERNAL_DECL void duk_push_c_function_noconstruct_noexotic ( duk_context * ctx,
duk_c_function func,
duk_int_t nargs )

Definition at line 18683 of file duktape-1.5.2/src-noline/duktape.c.

References duk__push_c_function_raw(), DUK_ASSERT_CTX_VALID, DUK_HOBJECT_CLASS_AS_FLAGS, DUK_HOBJECT_CLASS_FUNCTION, DUK_HOBJECT_FLAG_CONSTRUCTABLE, DUK_HOBJECT_FLAG_EXTENSIBLE, DUK_HOBJECT_FLAG_NATIVEFUNCTION, DUK_HOBJECT_FLAG_NEWENV, DUK_HOBJECT_FLAG_NOTAIL, and DUK_HOBJECT_FLAG_STRICT.

Referenced by duk_hthread_create_builtin_objects().

◆ duk_push_c_function_noexotic()

◆ duk_push_compiledfunction()

DUK_INTERNAL_DECL duk_idx_t duk_push_compiledfunction ( duk_context * ctx)

Definition at line 18559 of file duktape-1.5.2/src-noline/duktape.c.

18560 {
18562 }
18563
18564 /* default prototype (Note: 'obj' must be reachable) */
18566
18567 /* Initial stack size satisfies the stack spare constraints so there
18568 * is no need to require stack here.
18569 */
18572
18573 return ret;
18574}
18575
18577 duk_hthread *thr = (duk_hthread *) ctx;
18579 duk_idx_t ret;
18580 duk_tval *tv_slot;
18581
18583
18584 /* check stack first */
18585 if (thr->valstack_top >= thr->valstack_end) {
18587 }
18588
18589 /* Template functions are not strictly constructable (they don't
18590 * have a "prototype" property for instance), so leave the
18591 * DUK_HOBJECT_FLAG_CONSRUCTABLE flag cleared here.
18592 */
18593
#define DUK_HOBJECT_FLAG_COMPILEDFUNCTION
DUK_INTERNAL_DECL duk_hcompiledfunction * duk_hcompiledfunction_alloc(duk_heap *heap, duk_uint_t hobject_flags)
#define DUK_HOBJECT_SET_PROTOTYPE_UPDREF(thr, h, p)
#define DUK_VALSTACK_INITIAL_SIZE
#define DUK_BIDX_THREAD_PROTOTYPE
DUK_INTERNAL_DECL duk_idx_t duk_push_compiledfunction(duk_context *ctx)
#define DUK_VALSTACK_API_ENTRY_MINIMUM
#define DUK_VALSTACK_INTERNAL_EXTRA
DUK_INTERNAL_DECL void duk_hthread_copy_builtin_objects(duk_hthread *thr_from, duk_hthread *thr_to)

References duk_hthread::builtins, DUK_ASSERT_CTX_VALID, DUK_BIDX_FUNCTION_PROTOTYPE, DUK_DDD, DUK_DDDPRINT, DUK_ERROR_ALLOC_DEFMSG, DUK_ERROR_API, duk_hcompiledfunction_alloc(), DUK_HOBJECT_CLASS_AS_FLAGS, DUK_HOBJECT_CLASS_FUNCTION, DUK_HOBJECT_FLAG_COMPILEDFUNCTION, DUK_HOBJECT_FLAG_EXTENSIBLE, DUK_HOBJECT_INCREF, DUK_HOBJECT_SET_PROTOTYPE_UPDREF, DUK_STR_PUSH_BEYOND_ALLOC_STACK, DUK_TVAL_SET_OBJECT, duk_heaphdr::h_flags, duk_hobject::hdr, duk_hthread::heap, duk_hcompiledfunction::obj, duk_hthread::valstack_bottom, duk_hthread::valstack_end, and duk_hthread::valstack_top.

Referenced by duk__convert_to_func_template(), duk__load_func(), duk__load_func(), and duk_js_push_closure().

◆ duk_push_hbuffer()

◆ duk_push_hobject()

◆ duk_push_hobject_bidx()

◆ duk_push_hobject_class_string()

DUK_INTERNAL_DECL void duk_push_hobject_class_string ( duk_context * ctx,
duk_hobject * h )

Definition at line 17001 of file duktape-1.5.2/src-noline/duktape.c.

17002 {
17003 duk_hobject *h_obj;
17004
17005 duk_to_object(ctx, -1);
17006 h_obj = duk_get_hobject(ctx, -1);
17007 DUK_ASSERT(h_obj != NULL);
17008
17009 h_strclass = DUK_HOBJECT_GET_CLASS_STRING(thr->heap, h_obj);
17010 }
17011 DUK_ASSERT(h_strclass != NULL);
17012
17013 duk_pop(ctx);
#define DUK_HOBJECT_GET_CLASS_STRING(heap, h)
DUK_EXTERNAL void duk_pop(duk_context *ctx)
DUK_INTERNAL_DECL duk_hobject * duk_get_hobject(duk_context *ctx, duk_idx_t index)

References DUK_ASSERT, DUK_ASSERT_CTX_VALID, DUK_HOBJECT_GET_CLASS_STRING, DUK_HSTRING_GET_DATA, duk_push_sprintf(), DUK_UNREF, duk_hthread::heap, and NULL.

Referenced by duk_push_string_tval_readable().

◆ duk_push_hstring()

◆ duk_push_hstring_stridx()

DUK_INTERNAL_DECL void duk_push_hstring_stridx ( duk_context * ctx,
duk_small_int_t stridx )

◆ duk_push_lightfunc_name()

DUK_INTERNAL_DECL void duk_push_lightfunc_name ( duk_context * ctx,
duk_tval * tv )

Definition at line 19342 of file duktape-1.5.2/src-noline/duktape.c.

19359 {
19360 duk_c_function func;
19361
19363
19364 /* Lightfunc name, includes Duktape/C native function pointer, which
duk_ret_t(* duk_c_function)(duk_context *ctx)

References DUK_ASSERT, duk_concat(), duk_push_sprintf(), duk_push_string_funcptr(), DUK_TVAL_GET_LIGHTFUNC_FLAGS, DUK_TVAL_GET_LIGHTFUNC_FUNCPTR, and DUK_TVAL_IS_LIGHTFUNC.

Referenced by duk_hobject_getprop(), duk_push_lightfunc_tostring(), duk_push_string_funcptr(), and duk_to_object().

◆ duk_push_lightfunc_tostring()

◆ duk_push_object_helper()

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 )

Definition at line 18394 of file duktape-1.5.2/src-noline/duktape.c.

18397 {
18398 va_list ap;
18399 const char *ret;
18400
18402
18403 /* allow fmt==NULL */
18404 va_start(ap, fmt);
18405 ret = duk_push_vsprintf(ctx, fmt, ap);
18406 va_end(ap);
18407
18408 return ret;
18409}
18410
18411DUK_INTERNAL duk_idx_t duk_push_object_helper(duk_context *ctx, duk_uint_t hobject_flags_and_class, duk_small_int_t prototype_bidx) {
18412 duk_hthread *thr = (duk_hthread *) ctx;
18413 duk_tval *tv_slot;
18414 duk_hobject *h;
18415 duk_idx_t ret;
18416
18418 DUK_ASSERT(prototype_bidx == -1 ||
18419 (prototype_bidx >= 0 && prototype_bidx < DUK_NUM_BUILTINS));
18420
18421 /* check stack first */
18422 if (thr->valstack_top >= thr->valstack_end) {
18424 }
18425
18426 h = duk_hobject_alloc(thr->heap, hobject_flags_and_class);
18427 if (!h) {
18429 }
18430
18431 DUK_DDD(DUK_DDDPRINT("created object with flags: 0x%08lx", (unsigned long) h->hdr.h_flags));
18432
#define DUK_ERROR_ALLOC_DEFMSG(thr)
DUK_EXTERNAL const char * duk_push_vsprintf(duk_context *ctx, const char *fmt, va_list ap)
DUK_INTERNAL_DECL duk_hobject * duk_hobject_alloc(duk_heap *heap, duk_uint_t hobject_flags)

References duk_hthread::builtins, DUK_ASSERT, DUK_ASSERT_CTX_VALID, DUK_DDD, DUK_DDDPRINT, DUK_ERROR_ALLOC_DEFMSG, DUK_ERROR_API, duk_hobject_alloc(), DUK_HOBJECT_GET_PROTOTYPE, DUK_HOBJECT_INCREF, DUK_HOBJECT_SET_PROTOTYPE_UPDREF, DUK_NUM_BUILTINS, DUK_STR_PUSH_BEYOND_ALLOC_STACK, DUK_TVAL_SET_OBJECT, duk_heaphdr::h_flags, duk_hobject::hdr, duk_hthread::heap, NULL, duk_hthread::valstack_bottom, duk_hthread::valstack_end, and duk_hthread::valstack_top.

Referenced by duk__create_arguments_object(), duk__js_execute_bytecode_inner(), duk_bi_date_constructor(), duk_bi_error_constructor_shared(), duk_bi_function_prototype_bind(), duk_bi_object_constructor(), duk_bi_pointer_constructor(), duk_bi_string_constructor(), duk_bi_string_constructor_from_char_code(), duk_create_activation_environment_record(), duk_hthread_create_builtin_objects(), duk_push_array(), duk_push_object(), duk_push_object_helper_proto(), duk_push_object_internal(), duk_set_global_object(), and duk_to_object().

◆ duk_push_object_helper_proto()

◆ duk_push_object_internal()

DUK_INTERNAL_DECL duk_idx_t duk_push_object_internal ( duk_context * ctx)

Definition at line 19037 of file duktape-1.5.2/src-noline/duktape.c.

19038 :
19039 duk_push_hobject(ctx, (duk_hobject *) ptr);
19040 break;
19041 case DUK_HTYPE_BUFFER:
19042 duk_push_hbuffer(ctx, (duk_hbuffer *) ptr);
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)

References DUK_HOBJECT_CLASS_AS_FLAGS, DUK_HOBJECT_CLASS_OBJECT, DUK_HOBJECT_FLAG_EXTENSIBLE, and duk_push_object_helper().

Referenced by duk__init_func_valstack_slots(), duk__push_stash(), duk__reset_func_for_pass2(), duk_bi_json_stringify_helper(), and duk_hobject_enumerator_create().

◆ duk_push_string_funcptr()

DUK_INTERNAL_DECL void duk_push_string_funcptr ( duk_context * ctx,
duk_uint8_t * ptr,
duk_size_t sz )

Definition at line 19382 of file duktape-1.5.2/src-noline/duktape.c.

19383 {
19385
19386 duk_push_string(ctx, "function ");
19387 duk_push_lightfunc_name(ctx, tv);
19388 duk_push_string(ctx, "() {\"light\"}");
19389 duk_concat(ctx, 3);
19390}
19391
19392/*
19393 * Function pointers
19394 *
19395 * Printing function pointers is non-portable, so we do that by hex printing
19396 * bytes from memory.
19397 */
19398
19399DUK_INTERNAL void duk_push_string_funcptr(duk_context *ctx, duk_uint8_t *ptr, duk_size_t sz) {
19400 duk_uint8_t buf[32 * 2];
19401 duk_uint8_t *p, *q;
19404
19405 DUK_ASSERT(sz <= 32); /* sanity limit for function pointer size */
19406
19407 p = buf;
unsigned int duk_small_uint_t
DUK_EXTERNAL void duk_concat(duk_context *ctx, duk_idx_t count)
DUK_INTERNAL_DECL void duk_push_lightfunc_name(duk_context *ctx, duk_tval *tv)
DUK_INTERNAL_DECL void duk_push_string_funcptr(duk_context *ctx, duk_uint8_t *ptr, duk_size_t sz)

References DUK_ASSERT, duk_concat(), duk_lc_digits, duk_push_lightfunc_name(), duk_push_lstring(), duk_push_string(), and DUK_TVAL_IS_LIGHTFUNC.

Referenced by duk_push_lightfunc_name().

◆ duk_push_string_readable()

DUK_INTERNAL_DECL const char * duk_push_string_readable ( duk_context * ctx,
duk_idx_t index )

◆ duk_push_string_tval_readable()

DUK_INTERNAL_DECL const char * duk_push_string_tval_readable ( duk_context * ctx,
duk_tval * tv )

Definition at line 19476 of file duktape-1.5.2/src-noline/duktape.c.

19479 {
19480 q += duk_unicode_encode_xutf8(cp, q);
19481 }
19482 } else {
19483 p++; /* advance manually */
19484 *q++ = (duk_uint8_t) DUK_ASC_QUESTION;
19485 }
19486 nchars++;
19487 }
19488 *q++ = (duk_uint8_t) DUK_ASC_SINGLEQUOTE;
19489
19490 duk_push_lstring(ctx, (const char *) buf, (duk_size_t) (q - buf));
19491}
19492
19494 duk_hthread *thr;
19495
19497 thr = (duk_hthread *) ctx;
19498 DUK_UNREF(thr);
19499
19500 if (tv == NULL) {
19501 duk_push_string(ctx, "none");
19502 } else {
19503 switch (DUK_TVAL_GET_TAG(tv)) {
19504 case DUK_TAG_STRING: {
19506 break;
19507 }
19508 case DUK_TAG_OBJECT: {
19510 DUK_ASSERT(h != NULL);
19512 break;
19513 }
19514 case DUK_TAG_BUFFER: {
19515 /* XXX: Hex encoded, length limited buffer summary here? */
19517 DUK_ASSERT(h != NULL);
19518 duk_push_sprintf(ctx, "[buffer:%ld]", (long) DUK_HBUFFER_GET_SIZE(h));
19519 break;
19520 }
19521 case DUK_TAG_POINTER: {
DUK_INTERNAL_DECL duk_small_int_t duk_unicode_encode_xutf8(duk_ucodepoint_t cp, duk_uint8_t *out)
DUK_LOCAL void duk__push_hstring_readable_unicode(duk_context *ctx, duk_hstring *h_input)
#define DUK_TVAL_GET_BUFFER(tv)
#define DUK_TVAL_GET_TAG(tv)
DUK_EXTERNAL const char * duk_push_lstring(duk_context *ctx, const char *str, duk_size_t len)
#define DUK_TVAL_GET_STRING(tv)
DUK_INTERNAL_DECL void duk_push_hobject_class_string(duk_context *ctx, duk_hobject *h)
DUK_EXTERNAL const char * duk_push_sprintf(duk_context *ctx, const char *fmt,...)
DUK_INTERNAL_DECL const char * duk_push_string_tval_readable(duk_context *ctx, duk_tval *tv)
#define DUK_HBUFFER_GET_SIZE(x)

References duk__push_hstring_readable_unicode(), DUK_ASSERT, DUK_ASSERT_CTX_VALID, DUK_HBUFFER_GET_SIZE, duk_push_hobject_class_string(), duk_push_sprintf(), duk_push_string(), duk_push_tval(), duk_remove(), DUK_TAG_BUFFER, DUK_TAG_OBJECT, DUK_TAG_POINTER, DUK_TAG_STRING, duk_to_string(), DUK_TVAL_GET_BUFFER, DUK_TVAL_GET_OBJECT, DUK_TVAL_GET_STRING, DUK_TVAL_GET_TAG, DUK_UNREF, and NULL.

Referenced by duk__concat_and_join_helper(), duk__nonbound_func_lookup(), duk_hobject_delprop(), duk_hobject_getprop(), duk_hobject_putprop(), and duk_push_string_readable().

◆ duk_push_this_check_object_coercible()

DUK_INTERNAL_DECL void duk_push_this_check_object_coercible ( duk_context * ctx)

◆ duk_push_this_coercible_to_object()

◆ duk_push_this_coercible_to_string()

◆ duk_push_tval()

DUK_INTERNAL_DECL void duk_push_tval ( duk_context * ctx,
duk_tval * tv )

Definition at line 17835 of file duktape-1.5.2/src-noline/duktape.c.

17835 {
17836 return DUK_ERR_URI_ERROR;
17837 }
17838 if (h == thr->builtins[DUK_BIDX_ERROR_PROTOTYPE]) {
17839 return DUK_ERR_ERROR;
17840 }
17841
17842 h = DUK_HOBJECT_GET_PROTOTYPE(thr->heap, h);
17843 } while (--sanity > 0);
17844
17845 return DUK_ERR_NONE;
17846}
#define DUK_BIDX_ERROR_PROTOTYPE

References DUK__CHECK_SPACE, DUK_ASSERT, DUK_ASSERT_CTX_VALID, DUK_ERR_URI_ERROR, DUK_TVAL_INCREF, DUK_TVAL_SET_TVAL, NULL, and duk_hthread::valstack_top.

Referenced by duk__add_traceback(), duk__declvar_helper(), duk__err_augment_user(), duk__get_own_propdesc_raw(), duk__getvar_helper(), duk__handle_catch(), duk__handle_longjmp(), duk__handle_safe_call_error(), duk__js_execute_bytecode_inner(), duk__load_func(), duk__load_func(), duk__push_tval_to_hstring_arr_idx(), duk__putprop_fastpath_bufobj_tval(), duk__vm_arith_add(), duk__vm_arith_binary_op(), duk__vm_bitwise_binary_op(), duk__vm_bitwise_not(), duk_bi_duktape_object_act(), duk_bi_global_object_eval(), duk_hobject_delprop(), duk_hobject_getprop(), duk_hobject_hasprop(), duk_hobject_putprop(), duk_hthread_create_builtin_objects(), duk_js_close_environment_record(), duk_js_compare_helper(), duk_js_equals_helper(), duk_js_in(), duk_js_instanceof(), duk_js_tonumber(), duk_push_c_lightfunc(), duk_push_current_function(), duk_push_current_thread(), duk_push_hbuffer(), duk_push_hobject(), duk_push_hobject_bidx(), duk_push_hstring(), duk_push_string_tval_readable(), duk_suspend(), and duk_to_string().

◆ duk_put_prop_stridx()

◆ duk_require_hbuffer()

◆ duk_require_hcompiledfunction()

DUK_INTERNAL_DECL duk_hcompiledfunction * duk_require_hcompiledfunction ( duk_context * ctx,
duk_idx_t index )

◆ duk_require_hnativefunction()

◆ duk_require_hobject()

DUK_INTERNAL_DECL duk_hobject * duk_require_hobject ( duk_context * ctx,
duk_idx_t index )

Definition at line 16305 of file duktape-1.5.2/src-noline/duktape.c.

16305 {
16307}
16308
16310 duk_heaphdr *h;
16312 if (h == NULL) {
DUK_INTERNAL_DECL duk_hstring * duk_require_hstring(duk_context *ctx, duk_idx_t index)

References duk__get_tagged_heaphdr_raw(), DUK_ERROR_REQUIRE_TYPE_INDEX, DUK_STR_NOT_OBJECT, DUK_TAG_OBJECT, DUK_TAG_STRING, index, and NULL.

Referenced by duk__check_arguments_map_for_delete(), duk__create_arguments_object(), duk__lookup_arguments_map(), duk__regexp_match_helper(), duk_bi_duktape_object_fin(), duk_bi_global_object_eval(), duk_bi_global_object_require(), duk_bi_nodejs_buffer_concat(), duk_bi_object_constructor_define_property(), duk_bi_object_constructor_keys_shared(), duk_bi_typedarray_set(), duk_create_activation_environment_record(), duk_def_prop(), duk_get_hobject_or_lfunc_coerce(), duk_get_hobject_with_class(), duk_get_prototype(), duk_hobject_enumerator_create(), duk_hobject_enumerator_next(), duk_hobject_get_enumerated_keys(), duk_hobject_prepare_property_descriptor(), duk_hthread_copy_builtin_objects(), duk_hthread_create_builtin_objects(), duk_js_close_environment_record(), duk_js_instanceof(), duk_next(), duk_push_array(), duk_require_hobject_or_lfunc_coerce(), duk_set_global_object(), duk_set_prototype(), duk_xdef_prop(), duk_xdef_prop_index(), duk_xdef_prop_stridx(), duk_xdef_prop_stridx_builtin(), and duk_xdef_prop_stridx_thrower().

◆ duk_require_hobject_or_lfunc()

DUK_INTERNAL_DECL duk_hobject * duk_require_hobject_or_lfunc ( duk_context * ctx,
duk_idx_t index )

Definition at line 16503 of file duktape-1.5.2/src-noline/duktape.c.

16507 {
16508 return DUK_TVAL_GET_OBJECT(tv);
16509 } else if (DUK_TVAL_IS_LIGHTFUNC(tv)) {
16510 duk_to_object(ctx, index);
16511 return duk_require_hobject(ctx, index);
16512 }
16513
16514 return NULL;
16515}
16516
16517/* Useful for internal call sites where we either expect an object (function)
16518 * or a lightfunc. Returns NULL for a lightfunc.

References DUK_ASSERT, DUK_ASSERT_CTX_VALID, DUK_ERROR_REQUIRE_TYPE_INDEX, duk_require_tval(), DUK_STR_NOT_OBJECT, DUK_TVAL_GET_OBJECT, DUK_TVAL_IS_LIGHTFUNC, DUK_TVAL_IS_OBJECT, index, and NULL.

Referenced by duk_bi_object_constructor_is_extensible(), duk_bi_object_constructor_is_sealed_frozen_shared(), duk_bi_object_constructor_prevent_extensions(), duk_bi_object_constructor_seal_freeze_shared(), duk_bi_object_getprototype_shared(), and duk_to_defaultvalue().

◆ duk_require_hobject_or_lfunc_coerce()

DUK_INTERNAL_DECL duk_hobject * duk_require_hobject_or_lfunc_coerce ( duk_context * ctx,
duk_idx_t index )

Definition at line 16524 of file duktape-1.5.2/src-noline/duktape.c.

16528 {
16529 return DUK_TVAL_GET_OBJECT(tv);
16530 } else if (DUK_TVAL_IS_LIGHTFUNC(tv)) {
16531 return NULL;
16532 }
16534 return NULL; /* not reachable */
16535}
16536
16537/* Useful for internal call sites where we either expect an object (function)
16538 * or a lightfunc. Accepts an object (returned as is) or a lightfunc (coerced
16539 * to an object). Return value is never NULL.

References DUK_ASSERT_CTX_VALID, DUK_ERROR_REQUIRE_TYPE_INDEX, duk_require_hobject(), duk_require_tval(), DUK_STR_NOT_OBJECT, duk_to_object(), DUK_TVAL_GET_OBJECT, DUK_TVAL_IS_LIGHTFUNC, DUK_TVAL_IS_OBJECT, index, and NULL.

Referenced by duk_bi_error_prototype_to_string(), duk_bi_object_constructor_define_properties(), duk_bi_object_constructor_define_property(), duk_bi_object_constructor_keys_shared(), duk_bi_proxy_constructor(), duk_bi_thread_constructor(), duk_enum(), and duk_hobject_object_get_own_property_descriptor().

◆ duk_require_hobject_with_class()

DUK_INTERNAL_DECL duk_hobject * duk_require_hobject_with_class ( duk_context * ctx,
duk_idx_t index,
duk_small_uint_t classnum )

Definition at line 16555 of file duktape-1.5.2/src-noline/duktape.c.

16558 {
16559 duk_hobject *h;
16560
16562 DUK_ASSERT_DISABLE(classnum >= 0); /* unsigned */
16563 DUK_ASSERT(classnum <= DUK_HOBJECT_CLASS_MAX);
16564
16566 if (h != NULL && DUK_HOBJECT_GET_CLASS_NUMBER(h) != classnum) {
16567 h = NULL;
16568 }
16569 return h;
16570}
16571
16573 duk_hthread *thr;
DUK_INTERNAL_DECL duk_hobject * duk_require_hobject_with_class(duk_context *ctx, duk_idx_t index, duk_small_uint_t classnum)
#define DUK_HOBJECT_CLASS_MAX
#define DUK_HOBJECT_GET_CLASS_NUMBER(h)

References duk__get_tagged_heaphdr_raw(), DUK_ASSERT, DUK_ASSERT_CTX_VALID, DUK_ASSERT_DISABLE, DUK_ERROR_REQUIRE_TYPE_INDEX, DUK_HOBJECT_CLASS_MAX, DUK_HOBJECT_CLASS_NUMBER_TO_STRIDX, DUK_HOBJECT_GET_CLASS_NUMBER, DUK_HSTRING_GET_DATA, DUK_HTHREAD_GET_STRING, DUK_STR_UNEXPECTED_TYPE, DUK_TAG_OBJECT, DUK_UNREF, index, and NULL.

Referenced by duk__get_this_regexp(), duk__regexp_match_helper(), and duk_bi_regexp_constructor().

◆ duk_require_hstring()

◆ duk_require_hthread()

◆ duk_require_tval()

DUK_INTERNAL_DECL duk_tval * duk_require_tval ( duk_context * ctx,
duk_idx_t index )

Definition at line 15149 of file duktape-1.5.2/src-noline/duktape.c.

15150 {
15151 uindex = vs_size + (duk_uidx_t) index;
15152 } else {
15154 uindex = (duk_uidx_t) index;
15155 }
15156
15157 /* DUK_INVALID_INDEX won't be accepted as a valid index. */
15158 DUK_ASSERT(vs_size + (duk_uidx_t) DUK_INVALID_INDEX >= vs_size);
15159
15160 if (DUK_LIKELY(uindex < vs_size)) {
15161 return thr->valstack_bottom + uindex;
15162 }
15163 return NULL;
15164}
15165
15167 duk_hthread *thr = (duk_hthread *) ctx;
15168 duk_uidx_t vs_size;
15169 duk_uidx_t uindex;
15170
15173
15175 vs_size = (duk_uidx_t) (thr->valstack_top - thr->valstack_bottom);
15176 DUK_ASSERT_DISABLE(vs_size >= 0); /* unsigned */
15177

References DUK_ASSERT, DUK_ASSERT_CTX_VALID, DUK_ASSERT_DISABLE, DUK_ERROR_API_INDEX, DUK_INVALID_INDEX, DUK_LIKELY, index, NULL, duk_hthread::valstack_bottom, and duk_hthread::valstack_top.

Referenced by duk__check_arguments_map_for_put(), duk__handle_bound_chain_for_call(), duk__nonbound_func_lookup(), duk__put_prop_shared(), duk__require_bufobj_value(), duk__to_int_uint_helper(), duk_bi_pointer_prototype_tostring_shared(), duk_bi_string_prototype_to_string(), duk_copy(), duk_del_prop(), duk_dup(), duk_dup_top(), duk_get_hobject_or_lfunc_coerce(), duk_get_hobject_with_class(), duk_get_magic(), duk_get_prop(), duk_has_prop(), duk_hobject_define_property_helper(), duk_hobject_define_property_internal(), duk_hobject_define_property_internal_arridx(), duk_hobject_getprop(), duk_hobject_prepare_property_descriptor(), duk_hobject_putprop(), duk_insert(), duk_instanceof(), duk_js_tonumber(), duk_push_array(), duk_put_var(), duk_remove(), duk_replace(), duk_require_heapptr(), duk_require_hobject_or_lfunc(), duk_require_hobject_or_lfunc_coerce(), duk_swap(), duk_to_boolean(), duk_to_int32(), duk_to_int_clamped_raw(), duk_to_null(), duk_to_number(), duk_to_object(), duk_to_pointer(), duk_to_string(), duk_to_uint16(), duk_to_uint32(), duk_to_undefined(), duk_xdef_prop(), and duk_xdef_prop_stridx().

◆ duk_set_length()

DUK_INTERNAL_DECL void duk_set_length ( duk_context * ctx,
duk_idx_t index,
duk_size_t length )

Definition at line 16624 of file duktape-1.5.2/src-noline/duktape.c.

16629 :
16630#endif
16631 default:
16632 /* number */
16635 return 0;
16636 }
#define DUK_TVAL_IS_NUMBER(tv)
#define DUK_TVAL_IS_UNUSED(tv)

References DUK_ASSERT_CTX_VALID, duk_get_hobject(), duk_hobject_set_length(), and index.

Referenced by duk__dec_array().

◆ duk_to_hstring()

◆ duk_to_int_check_range()

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_to_int_clamped()

◆ duk_to_int_clamped_raw()

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 )

Definition at line 17017 of file duktape-1.5.2/src-noline/duktape.c.

17018 {
17019 duk_hthread *thr;
17020 duk_hstring *h_strclass;
17021
17023 DUK_ASSERT(h != NULL);
17024 thr = (duk_hthread *) ctx;
17025 DUK_UNREF(thr);
17026
17027 h_strclass = DUK_HOBJECT_GET_CLASS_STRING(thr->heap, h);
17028 DUK_ASSERT(h_strclass != NULL);
17029 duk_push_sprintf(ctx, "[object %s]", (const char *) DUK_HSTRING_GET_DATA(h_strclass));
17030}
17031#endif /* !DUK_USE_PARANOID_ERRORS */
17032
17033/* XXX: other variants like uint, u32 etc */
17035 duk_hthread *thr = (duk_hthread *) ctx;
17036 duk_tval *tv;
17037 duk_tval tv_tmp;
17038 duk_double_t d, dmin, dmax;
17039 duk_int_t res;
17040 duk_bool_t clamped = 0;
17041
17043
17044 tv = duk_require_tval(ctx, index);
17045 DUK_ASSERT(tv != NULL);
17046 d = duk_js_tointeger(thr, tv); /* E5 Section 9.4, ToInteger() */
17047
17048 dmin = (duk_double_t) minval;
17049 dmax = (duk_double_t) maxval;
17050
17051 if (d < dmin) {
17052 clamped = 1;
17053 res = minval;
17054 d = dmin;
17055 } else if (d > dmax) {
17056 clamped = 1;
17057 res = maxval;
17058 d = dmax;
17059 } else {
17060 res = (duk_int_t) d;
17061 }
17062 DUK_UNREF(d); /* SCANBUILD: with suitable dmin/dmax limits 'd' is unused */
17063 /* 'd' and 'res' agree here */
17064
17065 /* Relookup in case duk_js_tointeger() ends up e.g. coercing an object. */
17066 tv = duk_get_tval(ctx, index);
17067 DUK_ASSERT(tv != NULL); /* not popped by side effect */
17068 DUK_TVAL_SET_TVAL(&tv_tmp, tv);
17069#if defined(DUK_USE_FASTINT)
17070#if (DUK_INT_MAX <= 0x7fffffffL)
17071 DUK_TVAL_SET_FASTINT_I32(tv, res);
17072#else
17073 /* Clamping needed if duk_int_t is 64 bits. */
17074 if (res >= DUK_FASTINT_MIN && res <= DUK_FASTINT_MAX) {
17075 DUK_TVAL_SET_FASTINT(tv, res);
17076 } else {
17077 DUK_TVAL_SET_NUMBER(tv, d);
17078 }
duk_int_fast32_t duk_int_t
#define DUK_TVAL_SET_TVAL(v, x)
#define DUK_HSTRING_GET_DATA(x)
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)
DUK_INTERNAL_DECL duk_double_t duk_js_tointeger(duk_hthread *thr, duk_tval *tv)
#define DUK_TVAL_SET_FASTINT(tv, val)
#define DUK_TVAL_SET_FASTINT_I32(tv, val)
#define DUK_TVAL_SET_NUMBER(tv, val)

References DUK_ASSERT, DUK_ASSERT_CTX_VALID, DUK_ERROR_RANGE, duk_get_tval(), DUK_HOBJECT_GET_CLASS_STRING, DUK_HSTRING_GET_DATA, duk_js_tointeger(), duk_push_sprintf(), duk_require_tval(), DUK_STR_NUMBER_OUTSIDE_RANGE, DUK_TVAL_DECREF, DUK_TVAL_SET_FASTINT, DUK_TVAL_SET_FASTINT_I32, DUK_TVAL_SET_NUMBER, DUK_TVAL_SET_TVAL, DUK_UNREF, duk_hthread::heap, index, and NULL.

Referenced by duk_bi_string_prototype_char_code_at(), duk_to_int_check_range(), and duk_to_int_clamped().

◆ duk_to_object_class_string_top()

DUK_INTERNAL_DECL void duk_to_object_class_string_top ( duk_context * ctx)

Definition at line 16971 of file duktape-1.5.2/src-noline/duktape.c.

16979 {
16980 (void) duk_safe_to_string(ctx, index);
16983 return duk_get_hstring(ctx, index);
16984}
16985#endif
16986
16987/* Coerce top into Object.prototype.toString() output. */
16989 duk_hthread *thr;
16990 duk_uint_t typemask;
16991 duk_hstring *h_strclass;
16992
16994 thr = (duk_hthread *) ctx;
16995 DUK_UNREF(thr);
16996
16997 typemask = duk_get_type_mask(ctx, -1);
16998 if (typemask & DUK_TYPE_MASK_UNDEFINED) {
DUK_EXTERNAL duk_uint_t duk_get_type_mask(duk_context *ctx, duk_idx_t index)
DUK_INTERNAL_DECL void duk_to_object_class_string_top(duk_context *ctx)
DUK_INTERNAL_DECL duk_hstring * duk_get_hstring(duk_context *ctx, duk_idx_t index)
DUK_EXTERNAL duk_bool_t duk_is_string(duk_context *ctx, duk_idx_t index)
#define duk_safe_to_string(ctx, index)
#define DUK_TYPE_MASK_UNDEFINED

References DUK_ASSERT, DUK_ASSERT_CTX_VALID, duk_get_hobject(), duk_get_type_mask(), DUK_HOBJECT_GET_CLASS_STRING, DUK_HSTRING_GET_DATA, DUK_HTHREAD_STRING_UC_NULL, DUK_HTHREAD_STRING_UC_UNDEFINED, duk_pop(), duk_push_sprintf(), duk_to_object(), DUK_TYPE_MASK_NULL, DUK_TYPE_MASK_UNDEFINED, DUK_UNREF, duk_hthread::heap, and NULL.

Referenced by duk_bi_object_prototype_to_string().

◆ duk_valstack_resize_raw()

DUK_INTERNAL_DECL duk_bool_t duk_valstack_resize_raw ( duk_context * ctx,
duk_size_t min_new_size,
duk_small_uint_t flags )

Definition at line 15491 of file duktape-1.5.2/src-noline/duktape.c.

15498 {
15500 p++;
15501 }
15502#endif
15503
15504 return 1;
15505}
15506
15509 duk_size_t min_new_size,
15510 duk_small_uint_t flags) {
15511 duk_hthread *thr = (duk_hthread *) ctx;
15512 duk_size_t old_size;
15513 duk_size_t new_size;
15514 duk_bool_t is_shrink = 0;
15515 duk_small_uint_t shrink_flag = (flags & DUK_VSRESIZE_FLAG_SHRINK);
15516 duk_small_uint_t compact_flag = (flags & DUK_VSRESIZE_FLAG_COMPACT);
15517 duk_small_uint_t throw_flag = (flags & DUK_VSRESIZE_FLAG_THROW);
15518
15519 DUK_DDD(DUK_DDDPRINT("check valstack resize: min_new_size=%lu, curr_size=%ld, curr_top=%ld, "
15520 "curr_bottom=%ld, shrink=%d, compact=%d, throw=%d",
15521 (unsigned long) min_new_size,
15522 (long) (thr->valstack_end - thr->valstack),
15523 (long) (thr->valstack_top - thr->valstack),
15524 (long) (thr->valstack_bottom - thr->valstack),
15525 (int) shrink_flag, (int) compact_flag, (int) throw_flag));
15526
15528 DUK_ASSERT(thr != NULL);
15529 DUK_ASSERT(thr->valstack_bottom >= thr->valstack);
15531 DUK_ASSERT(thr->valstack_end >= thr->valstack_top);
15532
15533#if defined(DUK_USE_PREFER_SIZE)
15534 old_size = (duk_size_t) (thr->valstack_end - thr->valstack);
15535#else
15536 DUK_ASSERT((duk_size_t) (thr->valstack_end - thr->valstack) == thr->valstack_size);
15537 old_size = thr->valstack_size;
15538#endif
15539
15540 if (min_new_size <= old_size) {
15541 is_shrink = 1;
15542 if (!shrink_flag ||
15543 old_size - min_new_size < DUK_VALSTACK_SHRINK_THRESHOLD) {
15544 DUK_DDD(DUK_DDDPRINT("no need to grow or shrink valstack"));
15545 return 1;
15546 }
15547 }
15548
15549 new_size = min_new_size;
15550 if (!compact_flag) {
15551 if (is_shrink) {
15552 /* shrink case; leave some spare */
15553 new_size += DUK_VALSTACK_SHRINK_SPARE;
15554 }
15555
15556 /* round up roughly to next 'grow step' */
15557 new_size = (new_size / DUK_VALSTACK_GROW_STEP + 1) * DUK_VALSTACK_GROW_STEP;
15558 }
15559
15560 DUK_DD(DUK_DDPRINT("want to %s valstack: %lu -> %lu elements (min_new_size %lu)",
15561 (const char *) (new_size > old_size ? "grow" : "shrink"),
15562 (unsigned long) old_size, (unsigned long) new_size,
15563 (unsigned long) min_new_size));
15564
15565 if (new_size > thr->valstack_max) {
15566 /* Note: may be triggered even if minimal new_size would not reach the limit,
15567 * plan limit accordingly (taking DUK_VALSTACK_GROW_STEP into account).
15568 */
15569 if (throw_flag) {
15571 } else {
15572 return 0;
15573 }
15574 }
15575
15576 /*
15577 * When resizing the valstack, a mark-and-sweep may be triggered for
15578 * the allocation of the new valstack. If the mark-and-sweep needs
15579 * to use our thread for something, it may cause *the same valstack*
15580 * to be resized recursively. This happens e.g. when mark-and-sweep
15581 * finalizers are called. This is taken into account carefully in
15582 * duk__resize_valstack().
15583 *
15584 * 'new_size' is known to be <= valstack_max, which ensures that
15585 * size_t and pointer arithmetic won't wrap in duk__resize_valstack().
15586 */
15587
15588 if (!duk__resize_valstack(ctx, new_size)) {
#define DUK_ERROR_RANGE(thr, msg)
#define DUK_VALSTACK_SHRINK_THRESHOLD
#define DUK_VSRESIZE_FLAG_THROW
DUK_LOCAL duk_bool_t duk__resize_valstack(duk_context *ctx, duk_size_t new_size)
#define DUK_STR_VALSTACK_LIMIT
#define DUK_TVAL_IS_UNDEFINED(tv)
#define DUK_VSRESIZE_FLAG_SHRINK
DUK_INTERNAL_DECL duk_bool_t duk_valstack_resize_raw(duk_context *ctx, duk_size_t min_new_size, duk_small_uint_t flags)
#define DUK_VSRESIZE_FLAG_COMPACT
#define DUK_VALSTACK_GROW_STEP
#define DUK_VALSTACK_SHRINK_SPARE

References duk__resize_valstack(), DUK_ASSERT, DUK_ASSERT_CTX_VALID, DUK_DD, DUK_DDD, DUK_DDDPRINT, DUK_DDPRINT, DUK_ERROR_ALLOC_DEFMSG, DUK_ERROR_RANGE, DUK_STR_VALSTACK_LIMIT, DUK_VALSTACK_GROW_STEP, DUK_VALSTACK_SHRINK_SPARE, DUK_VALSTACK_SHRINK_THRESHOLD, DUK_VSRESIZE_FLAG_COMPACT, DUK_VSRESIZE_FLAG_SHRINK, DUK_VSRESIZE_FLAG_THROW, NULL, duk_hthread::valstack, duk_hthread::valstack_bottom, duk_hthread::valstack_end, duk_hthread::valstack_max, duk_hthread::valstack_size, and duk_hthread::valstack_top.

Referenced by duk__adjust_valstack_and_top(), duk__handle_call_error(), duk__handle_call_inner(), duk__reconfig_valstack_ecma_catcher(), duk__reconfig_valstack_ecma_return(), duk_check_stack(), duk_check_stack_top(), duk_require_stack(), and duk_require_stack_top().

◆ duk_xdef_prop()

◆ duk_xdef_prop_index()

◆ duk_xdef_prop_stridx()

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 )

Definition at line 14559 of file duktape-1.5.2/src-noline/duktape.c.

14563 {
14564 duk_hthread *thr = (duk_hthread *) ctx;
14565 duk_hobject *obj;
14566
14568
14569 obj = duk_require_hobject(ctx, obj_index);
14570 DUK_ASSERT(obj != NULL);
14571
14572 duk_hobject_define_property_internal_arridx(thr, obj, arr_index, desc_flags);
14573 /* value popped by call */
14574}
14575
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_xdef_prop_stridx(duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx, duk_small_uint_t desc_flags)

References DUK_ASSERT, DUK_ASSERT_CTX_VALID, DUK_ASSERT_DISABLE, DUK_HEAP_NUM_STRINGS, duk_hobject_define_property_internal(), DUK_HTHREAD_GET_STRING, duk_require_hobject(), duk_require_tval(), and NULL.

Referenced by duk__add_traceback(), duk__convert_to_func_template(), duk__create_arguments_object(), duk__handle_createargs_for_call(), duk__js_execute_bytecode_inner(), duk__load_func(), duk__load_func(), duk__push_stash(), duk_bi_array_constructor(), duk_bi_array_prototype_concat(), duk_bi_array_prototype_iter_shared(), duk_bi_array_prototype_slice(), duk_bi_array_prototype_splice(), duk_bi_boolean_constructor(), duk_bi_buffer_slice_shared(), duk_bi_dataview_constructor(), duk_bi_date_constructor(), duk_bi_error_constructor_shared(), duk_bi_function_prototype_bind(), duk_bi_global_object_require(), duk_bi_number_constructor(), duk_bi_pointer_constructor(), duk_bi_proxy_constructor(), duk_bi_string_constructor(), duk_bi_string_constructor_from_char_code(), duk_bi_typedarray_constructor(), duk_hthread_create_builtin_objects(), duk_js_push_closure(), duk_push_buffer_object(), duk_push_error_object_va_raw(), duk_regexp_create_instance(), duk_set_global_object(), and duk_to_object().

◆ duk_xdef_prop_stridx_builtin()

◆ duk_xdef_prop_stridx_thrower()