Lines Matching refs:thr
38 DUK_ASSERT(!(thr->valstack_top >= thr->valstack_end)); \
42 if (DUK_UNLIKELY(thr->valstack_top >= thr->valstack_end)) { \
43 DUK_ERROR_API(thr, DUK_STR_PUSH_BEYOND_ALLOC_STACK); \
51 duk_hthread *thr; in duk__api_coerce_d2i() local
56 thr = (duk_hthread *) ctx; in duk__api_coerce_d2i()
111 DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, "number", DUK_STR_NOT_NUMBER); in duk__api_coerce_d2i()
118 duk_hthread *thr; in duk__api_coerce_d2ui() local
125 thr = (duk_hthread *) ctx; in duk__api_coerce_d2ui()
168 DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, "number", DUK_STR_NOT_NUMBER); in duk__api_coerce_d2ui()
184 duk_hthread *thr = (duk_hthread *) ctx; in duk_normalize_index() local
198 DUK_ASSERT(thr->valstack_top >= thr->valstack_bottom); in duk_normalize_index()
199 vs_size = (duk_uidx_t) (thr->valstack_top - thr->valstack_bottom); in duk_normalize_index()
220 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_normalize_index() local
227 DUK_ASSERT(thr->valstack_top >= thr->valstack_bottom); in duk_require_normalize_index()
228 vs_size = (duk_uidx_t) (thr->valstack_top - thr->valstack_bottom); in duk_require_normalize_index()
244 DUK_ERROR_API_INDEX(thr, index); in duk_require_normalize_index()
249 duk_hthread *thr = (duk_hthread *) ctx; in duk_get_tval() local
256 DUK_ASSERT(thr->valstack_top >= thr->valstack_bottom); in duk_get_tval()
257 vs_size = (duk_uidx_t) (thr->valstack_top - thr->valstack_bottom); in duk_get_tval()
271 return thr->valstack_bottom + uindex; in duk_get_tval()
277 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_tval() local
284 DUK_ASSERT(thr->valstack_top >= thr->valstack_bottom); in duk_require_tval()
285 vs_size = (duk_uidx_t) (thr->valstack_top - thr->valstack_bottom); in duk_require_tval()
300 return thr->valstack_bottom + uindex; in duk_require_tval()
302 DUK_ERROR_API_INDEX(thr, index); in duk_require_tval()
316 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_valid_index() local
322 DUK_ERROR_API_INDEX(thr, index); in duk_require_valid_index()
332 duk_hthread *thr = (duk_hthread *) ctx; in duk_get_top() local
336 return (duk_idx_t) (thr->valstack_top - thr->valstack_bottom); in duk_get_top()
344 duk_hthread *thr = (duk_hthread *) ctx; in duk_set_top() local
353 DUK_ASSERT(thr->valstack_top >= thr->valstack_bottom); in duk_set_top()
354 DUK_ASSERT(thr->valstack_end >= thr->valstack_bottom); in duk_set_top()
355 vs_size = (duk_uidx_t) (thr->valstack_top - thr->valstack_bottom); in duk_set_top()
356 vs_limit = (duk_uidx_t) (thr->valstack_end - thr->valstack_bottom); in duk_set_top()
379 DUK_ERROR_API_INDEX(thr, index); in duk_set_top()
399 tv = thr->valstack_top + count; in duk_set_top()
403 thr->valstack_top = thr->valstack_bottom + uindex; in duk_set_top()
413 tv = --thr->valstack_top; /* tv -> value just before prev top value; must relookup */ in duk_set_top()
414 DUK_ASSERT(tv >= thr->valstack_bottom); in duk_set_top()
415 DUK_TVAL_SET_UNDEFINED_UPDREF(thr, tv); /* side effects */ in duk_set_top()
422 tv = thr->valstack_top; in duk_set_top()
429 thr->valstack_top = tv_end; in duk_set_top()
435 duk_hthread *thr = (duk_hthread *) ctx; in duk_get_top_index() local
440 ret = ((duk_idx_t) (thr->valstack_top - thr->valstack_bottom)) - 1; in duk_get_top_index()
452 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_top_index() local
457 ret = ((duk_idx_t) (thr->valstack_top - thr->valstack_bottom)) - 1; in duk_require_top_index()
459 DUK_ERROR_API_INDEX(thr, -1); in duk_require_top_index()
488 duk_hthread *thr = (duk_hthread *) ctx; in duk__resize_valstack() local
502 DUK_ASSERT(thr != NULL); in duk__resize_valstack()
503 DUK_ASSERT(thr->valstack_bottom >= thr->valstack); in duk__resize_valstack()
504 DUK_ASSERT(thr->valstack_top >= thr->valstack_bottom); in duk__resize_valstack()
505 DUK_ASSERT(thr->valstack_end >= thr->valstack_top); in duk__resize_valstack()
506 …DUK_ASSERT((duk_size_t) (thr->valstack_top - thr->valstack) <= new_size); /* can't resize below '… in duk__resize_valstack()
507 …DUK_ASSERT(new_size <= thr->valstack_max); /* valstack limit caller has check, prevents wrapping … in duk__resize_valstack()
511 old_bottom_offset = (((duk_uint8_t *) thr->valstack_bottom) - ((duk_uint8_t *) thr->valstack)); in duk__resize_valstack()
512 old_top_offset = (((duk_uint8_t *) thr->valstack_top) - ((duk_uint8_t *) thr->valstack)); in duk__resize_valstack()
514 …old_end_offset_pre = (((duk_uint8_t *) thr->valstack_end) - ((duk_uint8_t *) thr->valstack)); /* … in duk__resize_valstack()
515 old_valstack_pre = thr->valstack; in duk__resize_valstack()
526 …new_valstack = (duk_tval *) DUK_REALLOC_INDIRECT(thr->heap, duk_hthread_get_valstack_ptr, (void *)… in duk__resize_valstack()
554 …DUK_ASSERT((((duk_uint8_t *) thr->valstack_bottom) - ((duk_uint8_t *) thr->valstack)) == old_botto… in duk__resize_valstack()
555 …DUK_ASSERT((((duk_uint8_t *) thr->valstack_top) - ((duk_uint8_t *) thr->valstack)) == old_top_offs… in duk__resize_valstack()
558 …old_end_offset_post = (((duk_uint8_t *) thr->valstack_end) - ((duk_uint8_t *) thr->valstack)); /*… in duk__resize_valstack()
560 old_valstack_post = thr->valstack; in duk__resize_valstack()
562 thr->valstack = new_valstack; in duk__resize_valstack()
563 thr->valstack_end = new_valstack + new_size; in duk__resize_valstack()
565 thr->valstack_size = new_size; in duk__resize_valstack()
567 thr->valstack_bottom = (duk_tval *) (void *) ((duk_uint8_t *) new_valstack + old_bottom_offset); in duk__resize_valstack()
568 thr->valstack_top = (duk_tval *) (void *) ((duk_uint8_t *) new_valstack + old_top_offset); in duk__resize_valstack()
570 DUK_ASSERT(thr->valstack_bottom >= thr->valstack); in duk__resize_valstack()
571 DUK_ASSERT(thr->valstack_top >= thr->valstack_bottom); in duk__resize_valstack()
572 DUK_ASSERT(thr->valstack_end >= thr->valstack_top); in duk__resize_valstack()
592 (long) (thr->valstack_bottom - thr->valstack), in duk__resize_valstack()
593 (long) (thr->valstack_top - thr->valstack), in duk__resize_valstack()
594 (void *) thr->valstack, (void *) thr->valstack_end, in duk__resize_valstack()
595 (void *) thr->valstack_bottom, (void *) thr->valstack_top)); in duk__resize_valstack()
598 p = (duk_tval *) (void *) ((duk_uint8_t *) thr->valstack + old_end_offset_post); in duk__resize_valstack()
599 while (p < thr->valstack_end) { in duk__resize_valstack()
607 p = thr->valstack_top; in duk__resize_valstack()
608 while (p < thr->valstack_end) { in duk__resize_valstack()
621 duk_hthread *thr = (duk_hthread *) ctx; in duk_valstack_resize_raw() local
632 (long) (thr->valstack_end - thr->valstack), in duk_valstack_resize_raw()
633 (long) (thr->valstack_top - thr->valstack), in duk_valstack_resize_raw()
634 (long) (thr->valstack_bottom - thr->valstack), in duk_valstack_resize_raw()
638 DUK_ASSERT(thr != NULL); in duk_valstack_resize_raw()
639 DUK_ASSERT(thr->valstack_bottom >= thr->valstack); in duk_valstack_resize_raw()
640 DUK_ASSERT(thr->valstack_top >= thr->valstack_bottom); in duk_valstack_resize_raw()
641 DUK_ASSERT(thr->valstack_end >= thr->valstack_top); in duk_valstack_resize_raw()
644 old_size = (duk_size_t) (thr->valstack_end - thr->valstack); in duk_valstack_resize_raw()
646 DUK_ASSERT((duk_size_t) (thr->valstack_end - thr->valstack) == thr->valstack_size); in duk_valstack_resize_raw()
647 old_size = thr->valstack_size; in duk_valstack_resize_raw()
675 if (new_size > thr->valstack_max) { in duk_valstack_resize_raw()
680 DUK_ERROR_RANGE(thr, DUK_STR_VALSTACK_LIMIT); in duk_valstack_resize_raw()
707 DUK_ERROR_ALLOC_DEFMSG(thr); in duk_valstack_resize_raw()
718 duk_hthread *thr = (duk_hthread *) ctx; in duk_check_stack() local
722 DUK_ASSERT(thr != NULL); in duk_check_stack()
731 min_new_size = (thr->valstack_top - thr->valstack) + extra + DUK_VALSTACK_INTERNAL_EXTRA; in duk_check_stack()
740 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_stack() local
744 DUK_ASSERT(thr != NULL); in duk_require_stack()
753 min_new_size = (thr->valstack_top - thr->valstack) + extra + DUK_VALSTACK_INTERNAL_EXTRA; in duk_require_stack()
762 duk_hthread *thr; in duk_check_stack_top() local
766 thr = (duk_hthread *) ctx; in duk_check_stack_top()
775 min_new_size = (thr->valstack_bottom - thr->valstack) + top + DUK_VALSTACK_INTERNAL_EXTRA; in duk_check_stack_top()
784 duk_hthread *thr; in duk_require_stack_top() local
788 thr = (duk_hthread *) ctx; in duk_require_stack_top()
797 min_new_size = (thr->valstack_bottom - thr->valstack) + top + DUK_VALSTACK_INTERNAL_EXTRA; in duk_require_stack_top()
834 duk_hthread *thr; in duk_dup() local
839 thr = (duk_hthread *) ctx; in duk_dup()
843 tv_to = thr->valstack_top++; in duk_dup()
847 DUK_TVAL_INCREF(thr, tv_to); /* no side effects */ in duk_dup()
851 duk_hthread *thr; in duk_dup_top() local
856 thr = (duk_hthread *) ctx; in duk_dup_top()
859 if (thr->valstack_top - thr->valstack_bottom <= 0) { in duk_dup_top()
860 DUK_ERROR_API_INDEX(thr, -1); in duk_dup_top()
863 tv_from = thr->valstack_top - 1; in duk_dup_top()
864 tv_to = thr->valstack_top++; in duk_dup_top()
868 DUK_TVAL_INCREF(thr, tv_to); /* no side effects */ in duk_dup_top()
912 duk_hthread *thr = (duk_hthread *) ctx; in duk_replace() local
930 thr->valstack_top--; in duk_replace()
931 DUK_TVAL_DECREF(thr, &tv_tmp); /* side effects */ in duk_replace()
935 duk_hthread *thr = (duk_hthread *) ctx; in duk_copy() local
940 DUK_UNREF(thr); /* w/o refcounting */ in duk_copy()
948 DUK_TVAL_SET_TVAL_UPDREF(thr, tv2, tv1); /* side effects */ in duk_copy()
952 duk_hthread *thr = (duk_hthread *) ctx; in duk_remove() local
984 thr->valstack_top--; in duk_remove()
987 DUK_TVAL_DECREF(thr, &tv_tmp); /* side effects */ in duk_remove()
1069 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_undefined() local
1078 DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, "undefined", DUK_STR_NOT_UNDEFINED); in duk_require_undefined()
1083 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_null() local
1092 DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, "null", DUK_STR_NOT_NULL); in duk_require_null()
1112 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_boolean() local
1123 DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, "boolean", DUK_STR_NOT_BOOLEAN); in duk_require_boolean()
1149 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_number() local
1167 DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, "number", DUK_STR_NOT_NUMBER); in duk_require_number()
1224 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_lstring() local
1236 DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, "string", DUK_STR_NOT_STRING); in duk_require_lstring()
1267 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_pointer() local
1280 DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, "pointer", DUK_STR_NOT_POINTER); in duk_require_pointer()
1302 duk_hthread *thr = (duk_hthread *) ctx; in duk__get_buffer_helper() local
1306 DUK_UNREF(thr); in duk__get_buffer_helper()
1319 return (void *) DUK_HBUFFER_GET_DATA_PTR(thr->heap, h); /* may be NULL (but only if size is 0) */ in duk__get_buffer_helper()
1323 DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, "buffer", DUK_STR_NOT_BUFFER); in duk__get_buffer_helper()
1337 duk_hthread *thr = (duk_hthread *) ctx; in duk__get_buffer_data_helper() local
1341 DUK_UNREF(thr); in duk__get_buffer_data_helper()
1358 return (void *) DUK_HBUFFER_GET_DATA_PTR(thr->heap, h); /* may be NULL (but only if size is 0) */ in duk__get_buffer_data_helper()
1373 p = (duk_uint8_t *) DUK_HBUFFER_GET_DATA_PTR(thr->heap, h_bufobj->buf); in duk__get_buffer_data_helper()
1385 DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, "buffer", DUK_STR_NOT_BUFFER); in duk__get_buffer_data_helper()
1467 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_hthread() local
1470 DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, "thread", DUK_STR_NOT_THREAD); in duk_require_hthread()
1484 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_hcompiledfunction() local
1487 DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, "compiledfunction", DUK_STR_NOT_COMPILEDFUNCTION); in duk_require_hcompiledfunction()
1501 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_hnativefunction() local
1504 DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, "nativefunction", DUK_STR_NOT_NATIVEFUNCTION); in duk_require_hnativefunction()
1536 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_c_function() local
1543 DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, "nativefunction", DUK_STR_NOT_NATIVEFUNCTION); in duk_require_c_function()
1583 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_heapptr() local
1597 DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, "heapobject", DUK_STR_UNEXPECTED_TYPE); in duk_require_heapptr()
1635 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_hobject_or_lfunc() local
1647 DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, "object", DUK_STR_NOT_OBJECT); in duk_require_hobject_or_lfunc()
1656 duk_hthread *thr = (duk_hthread *) ctx; in duk_require_hobject_or_lfunc_coerce() local
1668 DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, "object", DUK_STR_NOT_OBJECT); in duk_require_hobject_or_lfunc_coerce()
1687 duk_hthread *thr; in duk_require_hobject_with_class() local
1693 thr = (duk_hthread *) ctx; in duk_require_hobject_with_class()
1698 h_class = DUK_HTHREAD_GET_STRING(thr, DUK_HOBJECT_CLASS_NUMBER_TO_STRIDX(classnum)); in duk_require_hobject_with_class()
1701 …DUK_ERROR_REQUIRE_TYPE_INDEX(thr, index, (const char *) DUK_HSTRING_GET_DATA(h_class), DUK_STR_UNE… in duk_require_hobject_with_class()
1756 duk_hthread *thr = (duk_hthread *) ctx; in duk_set_length() local
1766 duk_hobject_set_length(thr, h, (duk_uint32_t) length); /* XXX: typing */ in duk_set_length()
1797 duk_hthread *thr = (duk_hthread *) ctx; in duk_to_defaultvalue() local
1803 DUK_ASSERT(thr != NULL); in duk_to_defaultvalue()
1832 DUK_ERROR_TYPE(thr, DUK_STR_DEFAULTVALUE_COERCE_FAILED); in duk_to_defaultvalue()
1836 duk_hthread *thr = (duk_hthread *) ctx; in duk_to_undefined() local
1840 DUK_UNREF(thr); in duk_to_undefined()
1844 DUK_TVAL_SET_UNDEFINED_UPDREF(thr, tv); /* side effects */ in duk_to_undefined()
1848 duk_hthread *thr = (duk_hthread *) ctx; in duk_to_null() local
1852 DUK_UNREF(thr); in duk_to_null()
1856 DUK_TVAL_SET_NULL_UPDREF(thr, tv); /* side effects */ in duk_to_null()
1876 duk_hthread *thr = (duk_hthread *) ctx; in duk_to_boolean() local
1881 DUK_UNREF(thr); in duk_to_boolean()
1893 DUK_TVAL_SET_BOOLEAN_UPDREF(thr, tv, val); /* side effects */ in duk_to_boolean()
1898 duk_hthread *thr = (duk_hthread *) ctx; in duk_to_number() local
1907 d = duk_js_tonumber(thr, tv); in duk_to_number()
1911 DUK_TVAL_SET_NUMBER_UPDREF(thr, tv, d); /* side effects */ in duk_to_number()
1919 typedef duk_double_t (*duk__toint_coercer)(duk_hthread *thr, duk_tval *tv);
1922 duk_hthread *thr = (duk_hthread *) ctx; in duk__to_int_uint_helper() local
1930 d = coerce_func(thr, tv); in duk__to_int_uint_helper()
1936 DUK_TVAL_SET_NUMBER_UPDREF(thr, tv, d); /* side effects */ in duk__to_int_uint_helper()
1959 duk_hthread *thr = (duk_hthread *) ctx; in duk_to_int32() local
1967 ret = duk_js_toint32(thr, tv); in duk_to_int32()
1971 DUK_TVAL_SET_FASTINT_I32_UPDREF(thr, tv, ret); /* side effects */ in duk_to_int32()
1976 duk_hthread *thr = (duk_hthread *) ctx; in duk_to_uint32() local
1984 ret = duk_js_touint32(thr, tv); in duk_to_uint32()
1988 DUK_TVAL_SET_FASTINT_U32_UPDREF(thr, tv, ret); /* side effects */ in duk_to_uint32()
1993 duk_hthread *thr = (duk_hthread *) ctx; in duk_to_uint16() local
2001 ret = duk_js_touint16(thr, tv); in duk_to_uint16()
2005 DUK_TVAL_SET_FASTINT_U32_UPDREF(thr, tv, ret); /* side effects */ in duk_to_uint16()
2103 duk_hthread *thr; in duk_to_object_class_string_top() local
2108 thr = (duk_hthread *) ctx; in duk_to_object_class_string_top()
2109 DUK_UNREF(thr); in duk_to_object_class_string_top()
2113 h_strclass = DUK_HTHREAD_STRING_UC_UNDEFINED(thr); in duk_to_object_class_string_top()
2115 h_strclass = DUK_HTHREAD_STRING_UC_NULL(thr); in duk_to_object_class_string_top()
2123 h_strclass = DUK_HOBJECT_GET_CLASS_STRING(thr->heap, h_obj); in duk_to_object_class_string_top()
2133 duk_hthread *thr; in duk_push_hobject_class_string() local
2138 thr = (duk_hthread *) ctx; in duk_push_hobject_class_string()
2139 DUK_UNREF(thr); in duk_push_hobject_class_string()
2141 h_strclass = DUK_HOBJECT_GET_CLASS_STRING(thr->heap, h); in duk_push_hobject_class_string()
2149 duk_hthread *thr = (duk_hthread *) ctx; in duk_to_int_clamped_raw() local
2160 d = duk_js_tointeger(thr, tv); /* E5 Section 9.4, ToInteger() */ in duk_to_int_clamped_raw()
2197 DUK_TVAL_DECREF(thr, &tv_tmp); /* side effects */ in duk_to_int_clamped_raw()
2204 DUK_ERROR_RANGE(thr, DUK_STR_NUMBER_OUTSIDE_RANGE); in duk_to_int_clamped_raw()
2221 duk_hthread *thr = (duk_hthread *) ctx; in duk_to_string() local
2225 DUK_UNREF(thr); in duk_to_string()
2264 (const char *) DUK_HBUFFER_GET_DATA_PTR(thr->heap, h), in duk_to_string()
2318 duk_hthread *thr = (duk_hthread *) ctx; in duk_to_buffer_raw() local
2325 DUK_UNREF(thr); in duk_to_buffer_raw()
2339 tmp_ptr = (duk_uint8_t *) DUK_HBUFFER_GET_DATA_PTR(thr->heap, h_buf); in duk_to_buffer_raw()
2431 duk_hthread *thr = (duk_hthread *) ctx; in duk_to_object() local
2446 DUK_ERROR_TYPE(thr, DUK_STR_NOT_OBJECT_COERCIBLE); in duk_to_object()
2488 DUK_HBUFFER_INCREF(thr, h_val); in duk_to_object()
2717 duk_hthread *thr = (duk_hthread *) ctx; in duk_check_type_mask() local
2725 DUK_ERROR_TYPE(thr, DUK_STR_UNEXPECTED_TYPE); in duk_check_type_mask()
2950 duk_hthread *thr = (duk_hthread *) ctx; in duk_get_error_code() local
2963 if (h == thr->builtins[DUK_BIDX_EVAL_ERROR_PROTOTYPE]) { in duk_get_error_code()
2966 if (h == thr->builtins[DUK_BIDX_RANGE_ERROR_PROTOTYPE]) { in duk_get_error_code()
2969 if (h == thr->builtins[DUK_BIDX_REFERENCE_ERROR_PROTOTYPE]) { in duk_get_error_code()
2972 if (h == thr->builtins[DUK_BIDX_SYNTAX_ERROR_PROTOTYPE]) { in duk_get_error_code()
2975 if (h == thr->builtins[DUK_BIDX_TYPE_ERROR_PROTOTYPE]) { in duk_get_error_code()
2978 if (h == thr->builtins[DUK_BIDX_URI_ERROR_PROTOTYPE]) { in duk_get_error_code()
2981 if (h == thr->builtins[DUK_BIDX_ERROR_PROTOTYPE]) { in duk_get_error_code()
2985 h = DUK_HOBJECT_GET_PROTOTYPE(thr->heap, h); in duk_get_error_code()
2996 duk_hthread *thr; in duk_push_tval() local
3001 thr = (duk_hthread *) ctx; in duk_push_tval()
3003 tv_slot = thr->valstack_top++; in duk_push_tval()
3005 DUK_TVAL_INCREF(thr, tv); /* no side effects */ in duk_push_tval()
3009 duk_hthread *thr; in duk_push_undefined() local
3012 thr = (duk_hthread *) ctx; in duk_push_undefined()
3018 thr->valstack_top++; in duk_push_undefined()
3019 DUK_ASSERT(DUK_TVAL_IS_UNDEFINED(thr->valstack_top - 1)); in duk_push_undefined()
3023 duk_hthread *thr; in duk_push_null() local
3027 thr = (duk_hthread *) ctx; in duk_push_null()
3029 tv_slot = thr->valstack_top++; in duk_push_null()
3034 duk_hthread *thr; in duk_push_boolean() local
3039 thr = (duk_hthread *) ctx; in duk_push_boolean()
3042 tv_slot = thr->valstack_top++; in duk_push_boolean()
3047 duk_hthread *thr; in duk_push_true() local
3051 thr = (duk_hthread *) ctx; in duk_push_true()
3053 tv_slot = thr->valstack_top++; in duk_push_true()
3058 duk_hthread *thr; in duk_push_false() local
3062 thr = (duk_hthread *) ctx; in duk_push_false()
3064 tv_slot = thr->valstack_top++; in duk_push_false()
3070 duk_hthread *thr; in duk_push_number() local
3075 thr = (duk_hthread *) ctx; in duk_push_number()
3079 tv_slot = thr->valstack_top++; in duk_push_number()
3085 duk_hthread *thr; in duk_push_int() local
3089 thr = (duk_hthread *) ctx; in duk_push_int()
3091 tv_slot = thr->valstack_top++; in duk_push_int()
3103 duk_hthread *thr; in duk_push_int()
3108 thr = (duk_hthread *) ctx; in duk_push_int()
3111 tv_slot = thr->valstack_top++; in duk_push_int()
3118 duk_hthread *thr; in duk_push_uint() local
3122 thr = (duk_hthread *) ctx; in duk_push_uint()
3124 tv_slot = thr->valstack_top++; in duk_push_uint()
3137 duk_hthread *thr; in duk_push_uint()
3142 thr = (duk_hthread *) ctx; in duk_push_uint()
3145 tv_slot = thr->valstack_top++; in duk_push_uint()
3151 duk_hthread *thr; in duk_push_nan() local
3156 thr = (duk_hthread *) ctx; in duk_push_nan()
3160 tv_slot = thr->valstack_top++; in duk_push_nan()
3165 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_lstring() local
3172 if (thr->valstack_top >= thr->valstack_end) { in duk_push_lstring()
3173 DUK_ERROR_API(thr, DUK_STR_PUSH_BEYOND_ALLOC_STACK); in duk_push_lstring()
3187 DUK_ERROR_RANGE(thr, DUK_STR_STRING_TOO_LONG); in duk_push_lstring()
3190 h = duk_heap_string_intern_checked(thr, (const duk_uint8_t *) str, (duk_uint32_t) len); in duk_push_lstring()
3193 tv_slot = thr->valstack_top++; in duk_push_lstring()
3195 DUK_HSTRING_INCREF(thr, h); /* no side effects */ in duk_push_lstring()
3217 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_string_file_raw() local
3260 DUK_ERROR_TYPE(thr, "read file error"); in duk_push_string_file_raw()
3266 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_string_file_raw() local
3275 DUK_ERROR_UNSUPPORTED(thr, "file I/O disabled"); in duk_push_string_file_raw()
3282 duk_hthread *thr; in duk_push_pointer() local
3286 thr = (duk_hthread *) ctx; in duk_push_pointer()
3288 tv_slot = thr->valstack_top++; in duk_push_pointer()
3293 duk_hthread *thr; in duk__push_this_helper() local
3297 DUK_ASSERT_DISABLE(thr->callstack_top >= 0); /* avoid warning (unsigned) */ in duk__push_this_helper()
3298 thr = (duk_hthread *) ctx; in duk__push_this_helper()
3299 DUK_ASSERT(thr->callstack_top <= thr->callstack_size); in duk__push_this_helper()
3302 DUK_ASSERT(DUK_TVAL_IS_UNDEFINED(thr->valstack_top)); /* because of valstack init policy */ in duk__push_this_helper()
3303 tv_slot = thr->valstack_top++; in duk__push_this_helper()
3305 if (DUK_UNLIKELY(thr->callstack_top == 0)) { in duk__push_this_helper()
3314 DUK_ASSERT(thr->valstack_bottom > thr->valstack); in duk__push_this_helper()
3315 tv = thr->valstack_bottom - 1; in duk__push_this_helper()
3323 DUK_TVAL_INCREF(thr, tv); in duk__push_this_helper()
3328 DUK_ERROR_TYPE(thr, DUK_STR_NOT_OBJECT_COERCIBLE); in duk__push_this_helper()
3368 duk_hthread *thr; in duk_get_borrowed_this_tval() local
3371 thr = (duk_hthread *) ctx; in duk_get_borrowed_this_tval()
3373 DUK_ASSERT(thr->callstack_top > 0); /* caller required to know */ in duk_get_borrowed_this_tval()
3374 DUK_ASSERT(thr->valstack_bottom > thr->valstack); /* consequence of above */ in duk_get_borrowed_this_tval()
3375 DUK_ASSERT(thr->valstack_bottom - 1 >= thr->valstack); /* 'this' binding exists */ in duk_get_borrowed_this_tval()
3377 return thr->valstack_bottom - 1; in duk_get_borrowed_this_tval()
3381 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_current_function() local
3385 DUK_ASSERT(thr != NULL); in duk_push_current_function()
3386 DUK_ASSERT_DISABLE(thr->callstack_top >= 0); in duk_push_current_function()
3387 DUK_ASSERT(thr->callstack_top <= thr->callstack_size); in duk_push_current_function()
3389 act = duk_hthread_get_current_activation(thr); in duk_push_current_function()
3398 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_current_thread() local
3401 DUK_ASSERT(thr != NULL); in duk_push_current_thread()
3403 if (thr->heap->curr_thread) { in duk_push_current_thread()
3404 duk_push_hobject(ctx, (duk_hobject *) thr->heap->curr_thread); in duk_push_current_thread()
3430 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_heap_stash() local
3433 heap = thr->heap; in duk_push_heap_stash()
3446 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_thread_stash() local
3449 DUK_ERROR_API(thr, DUK_STR_INVALID_CALL_ARGS); in duk_push_thread_stash()
3475 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_vsprintf() local
3489 h_str = DUK_HTHREAD_STRING_EMPTY_STRING(thr); /* rely on interning, must be this string */ in duk_push_vsprintf()
3526 DUK_ERROR_API(thr, DUK_STR_SPRINTF_TOO_LONG); in duk_push_vsprintf()
3555 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_object_helper() local
3565 if (thr->valstack_top >= thr->valstack_end) { in duk_push_object_helper()
3566 DUK_ERROR_API(thr, DUK_STR_PUSH_BEYOND_ALLOC_STACK); in duk_push_object_helper()
3569 h = duk_hobject_alloc(thr->heap, hobject_flags_and_class); in duk_push_object_helper()
3571 DUK_ERROR_ALLOC_DEFMSG(thr); in duk_push_object_helper()
3576 tv_slot = thr->valstack_top; in duk_push_object_helper()
3578 DUK_HOBJECT_INCREF(thr, h); /* no side effects */ in duk_push_object_helper()
3579 ret = (duk_idx_t) (thr->valstack_top - thr->valstack_bottom); in duk_push_object_helper()
3580 thr->valstack_top++; in duk_push_object_helper()
3585 DUK_HOBJECT_SET_PROTOTYPE_UPDREF(thr, h, thr->builtins[prototype_bidx]); in duk_push_object_helper()
3588 DUK_ASSERT(DUK_HOBJECT_GET_PROTOTYPE(thr->heap, h) == NULL); in duk_push_object_helper()
3595 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_object_helper_proto() local
3604 DUK_ASSERT(DUK_HOBJECT_GET_PROTOTYPE(thr->heap, h) == NULL); in duk_push_object_helper_proto()
3605 DUK_HOBJECT_SET_PROTOTYPE_UPDREF(thr, h, proto); in duk_push_object_helper_proto()
3619 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_array() local
3647 duk_hobject_define_property_internal(thr, in duk_push_array()
3649 DUK_HTHREAD_STRING_LENGTH(thr), in duk_push_array()
3657 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_thread_raw() local
3665 if (thr->valstack_top >= thr->valstack_end) { in duk_push_thread_raw()
3666 DUK_ERROR_API(thr, DUK_STR_PUSH_BEYOND_ALLOC_STACK); in duk_push_thread_raw()
3669 obj = duk_hthread_alloc(thr->heap, in duk_push_thread_raw()
3674 DUK_ERROR_ALLOC_DEFMSG(thr); in duk_push_thread_raw()
3681 obj->strs16 = thr->strs16; in duk_push_thread_raw()
3683 obj->strs = thr->strs; in duk_push_thread_raw()
3689 tv_slot = thr->valstack_top; in duk_push_thread_raw()
3691 DUK_HTHREAD_INCREF(thr, obj); in duk_push_thread_raw()
3692 ret = (duk_idx_t) (thr->valstack_top - thr->valstack_bottom); in duk_push_thread_raw()
3693 thr->valstack_top++; in duk_push_thread_raw()
3696 if (!duk_hthread_init_stacks(thr->heap, obj)) { in duk_push_thread_raw()
3697 DUK_ERROR_ALLOC_DEFMSG(thr); in duk_push_thread_raw()
3704 duk_hthread_copy_builtin_objects(thr, obj); in duk_push_thread_raw()
3708 …DUK_HOBJECT_SET_PROTOTYPE_UPDREF(thr, (duk_hobject *) obj, obj->builtins[DUK_BIDX_THREAD_PROTOTYPE… in duk_push_thread_raw()
3720 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_compiledfunction() local
3728 if (thr->valstack_top >= thr->valstack_end) { in duk_push_compiledfunction()
3729 DUK_ERROR_API(thr, DUK_STR_PUSH_BEYOND_ALLOC_STACK); in duk_push_compiledfunction()
3737 obj = duk_hcompiledfunction_alloc(thr->heap, in duk_push_compiledfunction()
3742 DUK_ERROR_ALLOC_DEFMSG(thr); in duk_push_compiledfunction()
3747 tv_slot = thr->valstack_top; in duk_push_compiledfunction()
3749 DUK_HOBJECT_INCREF(thr, obj); in duk_push_compiledfunction()
3750 ret = (duk_idx_t) (thr->valstack_top - thr->valstack_bottom); in duk_push_compiledfunction()
3751 thr->valstack_top++; in duk_push_compiledfunction()
3754 …DUK_HOBJECT_SET_PROTOTYPE_UPDREF(thr, (duk_hobject *) obj, thr->builtins[DUK_BIDX_FUNCTION_PROTOTY… in duk_push_compiledfunction()
3760 duk_hthread *thr = (duk_hthread *) ctx; in duk__push_c_function_raw() local
3769 if (thr->valstack_top >= thr->valstack_end) { in duk__push_c_function_raw()
3770 DUK_ERROR_API(thr, DUK_STR_PUSH_BEYOND_ALLOC_STACK); in duk__push_c_function_raw()
3783 obj = duk_hnativefunction_alloc(thr->heap, flags); in duk__push_c_function_raw()
3785 DUK_ERROR_ALLOC_DEFMSG(thr); in duk__push_c_function_raw()
3794 tv_slot = thr->valstack_top; in duk__push_c_function_raw()
3796 DUK_HOBJECT_INCREF(thr, obj); in duk__push_c_function_raw()
3797 ret = (duk_idx_t) (thr->valstack_top - thr->valstack_bottom); in duk__push_c_function_raw()
3798 thr->valstack_top++; in duk__push_c_function_raw()
3801 …DUK_HOBJECT_SET_PROTOTYPE_UPDREF(thr, (duk_hobject *) obj, thr->builtins[DUK_BIDX_FUNCTION_PROTOTY… in duk__push_c_function_raw()
3806 DUK_ERROR_API(thr, DUK_STR_INVALID_CALL_ARGS); in duk__push_c_function_raw()
3859 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_c_lightfunc() local
3866 if (thr->valstack_top >= thr->valstack_end) { in duk_push_c_lightfunc()
3867 DUK_ERROR_API(thr, DUK_STR_PUSH_BEYOND_ALLOC_STACK); in duk_push_c_lightfunc()
3887 DUK_ASSERT(thr->valstack_top != thr->valstack_bottom); in duk_push_c_lightfunc()
3888 return ((duk_idx_t) (thr->valstack_top - thr->valstack_bottom)) - 1; in duk_push_c_lightfunc()
3891 DUK_ERROR_API(thr, DUK_STR_INVALID_CALL_ARGS); in duk_push_c_lightfunc()
3896 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_bufferobject_raw() local
3904 if (thr->valstack_top >= thr->valstack_end) { in duk_push_bufferobject_raw()
3905 DUK_ERROR_API(thr, DUK_STR_PUSH_BEYOND_ALLOC_STACK); in duk_push_bufferobject_raw()
3908 obj = duk_hbufferobject_alloc(thr->heap, hobject_flags_and_class); in duk_push_bufferobject_raw()
3910 DUK_ERROR_ALLOC_DEFMSG(thr); in duk_push_bufferobject_raw()
3913 DUK_HOBJECT_SET_PROTOTYPE_UPDREF(thr, (duk_hobject *) obj, thr->builtins[prototype_bidx]); in duk_push_bufferobject_raw()
3916 tv_slot = thr->valstack_top; in duk_push_bufferobject_raw()
3918 DUK_HOBJECT_INCREF(thr, obj); in duk_push_bufferobject_raw()
3919 thr->valstack_top++; in duk_push_bufferobject_raw()
3955 duk_hthread *thr; in duk_push_buffer_object() local
3965 thr = (duk_hthread *) ctx; in duk_push_buffer_object()
3966 DUK_UNREF(thr); in duk_push_buffer_object()
4005 DUK_HBUFFER_INCREF(thr, h_val); in duk_push_buffer_object()
4032 DUK_HBUFFER_INCREF(thr, h_val); in duk_push_buffer_object()
4048 DUK_ERROR_RANGE(thr, DUK_STR_INVALID_CALL_ARGS); in duk_push_buffer_object()
4052 DUK_ERROR_TYPE(thr, DUK_STR_INVALID_CALL_ARGS); in duk_push_buffer_object()
4057 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_error_object_va_raw() local
4065 DUK_ASSERT(thr != NULL); in duk_push_error_object_va_raw()
4076 proto = duk_error_prototype_from_code(thr, err_code); in duk_push_error_object_va_raw()
4102 duk_err_augment_error_create(thr, thr, filename, line, noblame_fileline); /* may throw an error */ in duk_push_error_object_va_raw()
4139 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_buffer_raw() local
4147 if (thr->valstack_top >= thr->valstack_end) { in duk_push_buffer_raw()
4148 DUK_ERROR_API(thr, DUK_STR_PUSH_BEYOND_ALLOC_STACK); in duk_push_buffer_raw()
4153 DUK_ERROR_RANGE(thr, DUK_STR_BUFFER_TOO_LONG); in duk_push_buffer_raw()
4156 h = duk_hbuffer_alloc(thr->heap, size, flags, &buf_data); in duk_push_buffer_raw()
4158 DUK_ERROR_ALLOC_DEFMSG(thr); in duk_push_buffer_raw()
4161 tv_slot = thr->valstack_top; in duk_push_buffer_raw()
4163 DUK_HBUFFER_INCREF(thr, h); in duk_push_buffer_raw()
4164 thr->valstack_top++; in duk_push_buffer_raw()
4173 duk_hthread *thr; in duk__validate_push_heapptr() local
4176 thr = (duk_hthread *) ctx; in duk__validate_push_heapptr()
4195 for (curr = thr->heap->finalize_list; in duk__validate_push_heapptr()
4197 curr = DUK_HEAPHDR_GET_NEXT(thr->heap, curr)) { in duk__validate_push_heapptr()
4215 for (curr = thr->heap->refzero_list; in duk__validate_push_heapptr()
4217 curr = DUK_HEAPHDR_GET_NEXT(thr->heap, curr)) { in duk__validate_push_heapptr()
4238 for (curr = thr->heap->heap_allocated; in duk__validate_push_heapptr()
4240 curr = DUK_HEAPHDR_GET_NEXT(thr->heap, curr)) { in duk__validate_push_heapptr()
4252 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_heapptr() local
4268 ret = (duk_idx_t) (thr->valstack_top - thr->valstack_bottom); in duk_push_heapptr()
4310 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_hstring_stridx() local
4311 DUK_UNREF(thr); in duk_push_hstring_stridx()
4313 duk_push_hstring(ctx, DUK_HTHREAD_GET_STRING(thr, stridx)); in duk_push_hstring_stridx()
4333 duk_hthread *thr = (duk_hthread *) ctx; in duk_push_hobject_bidx() local
4335 DUK_ASSERT(thr != NULL); in duk_push_hobject_bidx()
4337 DUK_ASSERT(thr->builtins[builtin_idx] != NULL); in duk_push_hobject_bidx()
4338 duk_push_hobject(ctx, thr->builtins[builtin_idx]); in duk_push_hobject_bidx()
4346 duk_hthread *thr = (duk_hthread *) ctx; in duk_pop_n() local
4352 DUK_ERROR_API(thr, DUK_STR_INVALID_COUNT); in duk_pop_n()
4356 DUK_ASSERT(thr->valstack_top >= thr->valstack_bottom); in duk_pop_n()
4357 if (DUK_UNLIKELY((duk_size_t) (thr->valstack_top - thr->valstack_bottom) < (duk_size_t) count)) { in duk_pop_n()
4358 DUK_ERROR_API(thr, DUK_STR_POP_TOO_MANY); in duk_pop_n()
4376 tv = --thr->valstack_top; /* tv points to element just below prev top */ in duk_pop_n()
4377 DUK_ASSERT(tv >= thr->valstack_bottom); in duk_pop_n()
4378 DUK_TVAL_SET_UNDEFINED_UPDREF(thr, tv); /* side effects */ in duk_pop_n()
4381 tv = thr->valstack_top; in duk_pop_n()
4385 DUK_ASSERT(tv >= thr->valstack_bottom); in duk_pop_n()
4388 thr->valstack_top = tv; in duk_pop_n()
4391 DUK_ASSERT(thr->valstack_top >= thr->valstack_bottom); in duk_pop_n()
4404 duk_hthread *thr = (duk_hthread *) ctx; in duk_pop() local
4408 DUK_ASSERT(thr->valstack_top >= thr->valstack_bottom); in duk_pop()
4409 if (DUK_UNLIKELY(thr->valstack_top == thr->valstack_bottom)) { in duk_pop()
4410 DUK_ERROR_API(thr, DUK_STR_POP_TOO_MANY); in duk_pop()
4413 tv = --thr->valstack_top; /* tv points to element just below prev top */ in duk_pop()
4414 DUK_ASSERT(tv >= thr->valstack_bottom); in duk_pop()
4416 DUK_TVAL_SET_UNDEFINED_UPDREF(thr, tv); /* side effects */ in duk_pop()
4420 DUK_ASSERT(thr->valstack_top >= thr->valstack_bottom); in duk_pop()
4439 duk_hthread *thr = (duk_hthread *) ctx; in duk_throw() local
4441 DUK_ASSERT(thr->valstack_bottom >= thr->valstack); in duk_throw()
4442 DUK_ASSERT(thr->valstack_top >= thr->valstack_bottom); in duk_throw()
4443 DUK_ASSERT(thr->valstack_end >= thr->valstack_top); in duk_throw()
4445 if (thr->valstack_top == thr->valstack_bottom) { in duk_throw()
4446 DUK_ERROR_API(thr, DUK_STR_INVALID_CALL_ARGS); in duk_throw()
4458 duk_hthread_sync_and_null_currpc(thr); in duk_throw()
4462 duk_err_augment_error_throw(thr); in duk_throw()
4466 duk_err_setup_heap_ljstate(thr, DUK_LJ_TYPE_THROW); in duk_throw()
4473 duk_err_longjmp(thr); in duk_throw()
4478 duk_hthread *thr = (duk_hthread *) ctx; in duk_fatal() local
4481 DUK_ASSERT(thr != NULL); in duk_fatal()
4482 DUK_ASSERT(thr->heap != NULL); in duk_fatal()
4483 DUK_ASSERT(thr->heap->fatal_func != NULL); in duk_fatal()
4492 thr->heap->fatal_func(ctx, err_code, err_msg); in duk_fatal()
4540 duk_hthread *thr = (duk_hthread *) ctx; in duk_equals() local
4554 return duk_js_equals(thr, tv1, tv2); in duk_equals()
4682 duk_hthread *thr; in duk__push_hstring_readable_unicode() local
4692 thr = (duk_hthread *) ctx; in duk__push_hstring_readable_unicode()
4711 if (duk_unicode_decode_xutf8(thr, &p, p_start, p_end, &cp)) { in duk__push_hstring_readable_unicode()
4734 duk_hthread *thr; in duk_push_string_tval_readable() local
4737 thr = (duk_hthread *) ctx; in duk_push_string_tval_readable()
4738 DUK_UNREF(thr); in duk_push_string_tval_readable()