Lines Matching refs:rt

432     JSRuntime* rt;  member
999 static int JS_InitAtoms(JSRuntime* rt);
1000 static JSAtom __JS_NewAtomInit(JSRuntime* rt, const char* str, int len,
1002 static void JS_FreeAtomStruct(JSRuntime* rt, JSAtomStruct* p);
1003 static void free_function_bytecode(JSRuntime* rt, JSFunctionBytecode* b);
1026 static __maybe_unused void JS_DumpAtoms(JSRuntime* rt);
1027 static __maybe_unused void JS_DumpString(JSRuntime* rt,
1029 static __maybe_unused void JS_DumpObjectHeader(JSRuntime* rt);
1030 static __maybe_unused void JS_DumpObject(JSRuntime* rt, JSObject* p);
1031 static __maybe_unused void JS_DumpGCObject(JSRuntime* rt, JSGCObjectHeader* p);
1032 static __maybe_unused void JS_DumpValueShort(JSRuntime* rt,
1038 static __maybe_unused void JS_DumpShapes(JSRuntime* rt);
1041 static void js_array_finalizer(JSRuntime* rt, JSValue val);
1042 static void js_array_mark(JSRuntime* rt, JSValueConst val,
1044 static void js_object_data_finalizer(JSRuntime* rt, JSValue val);
1045 static void js_object_data_mark(JSRuntime* rt, JSValueConst val,
1047 static void js_c_function_finalizer(JSRuntime* rt, JSValue val);
1048 static void js_c_function_mark(JSRuntime* rt, JSValueConst val,
1050 static void js_bytecode_function_finalizer(JSRuntime* rt, JSValue val);
1051 static void js_bytecode_function_mark(JSRuntime* rt, JSValueConst val,
1053 static void js_bound_function_finalizer(JSRuntime* rt, JSValue val);
1054 static void js_bound_function_mark(JSRuntime* rt, JSValueConst val,
1056 static void js_for_in_iterator_finalizer(JSRuntime* rt, JSValue val);
1057 static void js_for_in_iterator_mark(JSRuntime* rt, JSValueConst val,
1059 static void js_regexp_finalizer(JSRuntime* rt, JSValue val);
1060 static void js_array_buffer_finalizer(JSRuntime* rt, JSValue val);
1061 static void js_typed_array_finalizer(JSRuntime* rt, JSValue val);
1062 static void js_typed_array_mark(JSRuntime* rt, JSValueConst val,
1064 static void js_proxy_finalizer(JSRuntime* rt, JSValue val);
1065 static void js_proxy_mark(JSRuntime* rt, JSValueConst val,
1067 static void js_map_finalizer(JSRuntime* rt, JSValue val);
1068 static void js_map_mark(JSRuntime* rt, JSValueConst val,
1070 static void js_map_iterator_finalizer(JSRuntime* rt, JSValue val);
1071 static void js_map_iterator_mark(JSRuntime* rt, JSValueConst val,
1073 static void js_array_iterator_finalizer(JSRuntime* rt, JSValue val);
1074 static void js_array_iterator_mark(JSRuntime* rt, JSValueConst val,
1076 static void js_regexp_string_iterator_finalizer(JSRuntime* rt, JSValue val);
1077 static void js_regexp_string_iterator_mark(JSRuntime* rt, JSValueConst val,
1079 static void js_generator_finalizer(JSRuntime* rt, JSValue obj);
1080 static void js_generator_mark(JSRuntime* rt, JSValueConst val,
1082 static void js_promise_finalizer(JSRuntime* rt, JSValue val);
1083 static void js_promise_mark(JSRuntime* rt, JSValueConst val,
1085 static void js_promise_resolve_function_finalizer(JSRuntime* rt, JSValue val);
1086 static void js_promise_resolve_function_mark(JSRuntime* rt, JSValueConst val,
1089 static void js_operator_set_finalizer(JSRuntime* rt, JSValue val);
1090 static void js_operator_set_mark(JSRuntime* rt, JSValueConst val,
1102 static void gc_decref(JSRuntime* rt);
1103 static int JS_NewClass1(JSRuntime* rt, JSClassID class_id,
1122 static void js_float_env_finalizer(JSRuntime* rt, JSValue val);
1165 static void reset_weak_ref(JSRuntime* rt, JSObject* p);
1186 static void js_async_function_resolve_finalizer(JSRuntime* rt, JSValue val);
1187 static void js_async_function_resolve_mark(JSRuntime* rt, JSValueConst val,
1193 static void js_mark_module_def(JSRuntime* rt, JSModuleDef* m,
1197 static void free_var_ref(JSRuntime* rt, JSVarRef* var_ref);
1218 static void async_func_mark(JSRuntime* rt, JSAsyncFunctionState* s,
1221 static void js_free_shape(JSRuntime* rt, JSShape* sh);
1222 static void js_free_shape_null(JSRuntime* rt, JSShape* sh);
1225 static int init_shape_hash(JSRuntime* rt);
1237 static void js_c_function_data_finalizer(JSRuntime* rt, JSValue val);
1238 static void js_c_function_data_mark(JSRuntime* rt, JSValueConst val,
1244 static void add_gc_object(JSRuntime* rt, JSGCObjectHeader* h,
1247 static void js_async_function_free0(JSRuntime* rt, JSAsyncFunctionData* s);
1261 static void js_trigger_gc(JSRuntime* rt, size_t size) in js_trigger_gc() argument
1267 force_gc = ((rt->malloc_state.malloc_size + size) > in js_trigger_gc()
1268 rt->malloc_gc_threshold); in js_trigger_gc()
1273 (uint64_t)rt->malloc_state.malloc_size); in js_trigger_gc()
1275 JS_RunGC(rt); in js_trigger_gc()
1276 rt->malloc_gc_threshold = rt->malloc_state.malloc_size + in js_trigger_gc()
1277 (rt->malloc_state.malloc_size >> 1); in js_trigger_gc()
1286 void* js_malloc_rt(JSRuntime* rt, size_t size) in js_malloc_rt() argument
1288 return rt->mf.js_malloc(&rt->malloc_state, size); in js_malloc_rt()
1291 void js_free_rt(JSRuntime* rt, void* ptr) in js_free_rt() argument
1293 rt->mf.js_free(&rt->malloc_state, ptr); in js_free_rt()
1296 void* js_realloc_rt(JSRuntime* rt, void* ptr, size_t size) in js_realloc_rt() argument
1298 return rt->mf.js_realloc(&rt->malloc_state, ptr, size); in js_realloc_rt()
1301 size_t js_malloc_usable_size_rt(JSRuntime* rt, const void* ptr) in js_malloc_usable_size_rt() argument
1303 return rt->mf.js_malloc_usable_size(ptr); in js_malloc_usable_size_rt()
1306 void* js_mallocz_rt(JSRuntime* rt, size_t size) in js_mallocz_rt() argument
1309 ptr = js_malloc_rt(rt, size); in js_mallocz_rt()
1319 JSRuntime* rt = opaque; in js_bf_realloc() local
1320 return js_realloc_rt(rt, ptr, size); in js_bf_realloc()
1328 ptr = js_malloc_rt(ctx->rt, size); in js_malloc()
1340 ptr = js_mallocz_rt(ctx->rt, size); in js_mallocz()
1350 js_free_rt(ctx->rt, ptr); in js_free()
1357 ret = js_realloc_rt(ctx->rt, ptr, size); in js_realloc()
1369 ret = js_realloc_rt(ctx->rt, ptr, size); in js_realloc2()
1375 size_t new_size = js_malloc_usable_size_rt(ctx->rt, ret); in js_realloc2()
1383 return js_malloc_usable_size_rt(ctx->rt, ptr); in js_malloc_usable_size()
1432 dbuf_init2(s, ctx->rt, (DynBufReallocFunc*)js_realloc_rt); in js_dbuf_init()
1500 static int init_class_range(JSRuntime* rt, JSClassShortDef const* tab, in init_class_range() argument
1511 if (JS_NewClass1(rt, class_id, cm, tab[i].class_name) < 0) in init_class_range()
1582 static inline BOOL js_check_stack_overflow(JSRuntime* rt, size_t alloca_size) in js_check_stack_overflow() argument
1593 static inline BOOL js_check_stack_overflow(JSRuntime* rt, size_t alloca_size) in js_check_stack_overflow() argument
1596 size = rt->stack_top - js_get_stack_pointer(); in js_check_stack_overflow()
1597 return unlikely((size + alloca_size) > rt->stack_size); in js_check_stack_overflow()
1603 JSRuntime* rt; in JS_NewRuntime2() local
1610 rt = mf->js_malloc(&ms, sizeof(JSRuntime)); in JS_NewRuntime2()
1611 if (!rt) in JS_NewRuntime2()
1613 memset(rt, 0, sizeof(*rt)); in JS_NewRuntime2()
1614 rt->mf = *mf; in JS_NewRuntime2()
1615 if (!rt->mf.js_malloc_usable_size) { in JS_NewRuntime2()
1617 rt->mf.js_malloc_usable_size = js_malloc_usable_size_unknown; in JS_NewRuntime2()
1619 rt->malloc_state = ms; in JS_NewRuntime2()
1620 rt->malloc_gc_threshold = 256 * 1024; in JS_NewRuntime2()
1623 bf_context_init(&rt->bf_ctx, js_bf_realloc, rt); in JS_NewRuntime2()
1624 set_dummy_numeric_ops(&rt->bigint_ops); in JS_NewRuntime2()
1625 set_dummy_numeric_ops(&rt->bigfloat_ops); in JS_NewRuntime2()
1626 set_dummy_numeric_ops(&rt->bigdecimal_ops); in JS_NewRuntime2()
1629 init_list_head(&rt->context_list); in JS_NewRuntime2()
1630 init_list_head(&rt->gc_obj_list); in JS_NewRuntime2()
1631 init_list_head(&rt->gc_zero_ref_count_list); in JS_NewRuntime2()
1632 rt->gc_phase = JS_GC_PHASE_NONE; in JS_NewRuntime2()
1635 init_list_head(&rt->string_list); in JS_NewRuntime2()
1637 init_list_head(&rt->job_list); in JS_NewRuntime2()
1639 if (JS_InitAtoms(rt)) in JS_NewRuntime2()
1643 if (init_class_range(rt, js_std_class_def, JS_CLASS_OBJECT, in JS_NewRuntime2()
1646 rt->class_array[JS_CLASS_ARGUMENTS].exotic = &js_arguments_exotic_methods; in JS_NewRuntime2()
1647 rt->class_array[JS_CLASS_STRING].exotic = &js_string_exotic_methods; in JS_NewRuntime2()
1648 rt->class_array[JS_CLASS_MODULE_NS].exotic = &js_module_ns_exotic_methods; in JS_NewRuntime2()
1650 rt->class_array[JS_CLASS_C_FUNCTION].call = js_call_c_function; in JS_NewRuntime2()
1651 rt->class_array[JS_CLASS_C_FUNCTION_DATA].call = js_c_function_data_call; in JS_NewRuntime2()
1652 rt->class_array[JS_CLASS_BOUND_FUNCTION].call = js_call_bound_function; in JS_NewRuntime2()
1653 rt->class_array[JS_CLASS_GENERATOR_FUNCTION].call = js_generator_function_call; in JS_NewRuntime2()
1654 if (init_shape_hash(rt)) in JS_NewRuntime2()
1657 rt->stack_top = js_get_stack_pointer(); in JS_NewRuntime2()
1658 rt->stack_size = JS_DEFAULT_STACK_SIZE; in JS_NewRuntime2()
1659 rt->current_exception = JS_NULL; in JS_NewRuntime2()
1661 return rt; in JS_NewRuntime2()
1663 JS_FreeRuntime(rt); in JS_NewRuntime2()
1667 void* JS_GetRuntimeOpaque(JSRuntime* rt) in JS_GetRuntimeOpaque() argument
1669 return rt->user_opaque; in JS_GetRuntimeOpaque()
1672 void JS_SetRuntimeOpaque(JSRuntime* rt, void* opaque) in JS_SetRuntimeOpaque() argument
1674 rt->user_opaque = opaque; in JS_SetRuntimeOpaque()
1788 void JS_SetMemoryLimit(JSRuntime* rt, size_t limit) in JS_SetMemoryLimit() argument
1790 rt->malloc_state.malloc_limit = limit; in JS_SetMemoryLimit()
1794 void JS_SetGCThreshold(JSRuntime* rt, size_t gc_threshold) in JS_SetGCThreshold() argument
1796 rt->malloc_gc_threshold = gc_threshold; in JS_SetGCThreshold()
1803 void JS_SetInterruptHandler(JSRuntime* rt, JSInterruptHandler* cb, void* opaque) in JS_SetInterruptHandler() argument
1805 rt->interrupt_handler = cb; in JS_SetInterruptHandler()
1806 rt->interrupt_opaque = opaque; in JS_SetInterruptHandler()
1809 void JS_SetCanBlock(JSRuntime* rt, BOOL can_block) in JS_SetCanBlock() argument
1811 rt->can_block = can_block; in JS_SetCanBlock()
1814 void JS_SetSharedArrayBufferFunctions(JSRuntime* rt, in JS_SetSharedArrayBufferFunctions() argument
1817 rt->sab_funcs = *sf; in JS_SetSharedArrayBufferFunctions()
1824 JSRuntime* rt = ctx->rt; in JS_EnqueueJob() local
1837 list_add_tail(&e->link, &rt->job_list); in JS_EnqueueJob()
1841 BOOL JS_IsJobPending(JSRuntime* rt) in JS_IsJobPending() argument
1843 return !list_empty(&rt->job_list); in JS_IsJobPending()
1848 int JS_ExecutePendingJob(JSRuntime* rt, JSContext** pctx) in JS_ExecutePendingJob() argument
1855 if (list_empty(&rt->job_list)) { in JS_ExecutePendingJob()
1861 e = list_entry(rt->job_list.next, JSJobEntry, link); in JS_ExecutePendingJob()
1893 static JSString* js_alloc_string_rt(JSRuntime* rt, int max_len, int is_wide_char) in js_alloc_string_rt() argument
1896 str = js_malloc_rt(rt, sizeof(JSString) + (max_len << is_wide_char) + 1 - is_wide_char); in js_alloc_string_rt()
1906 list_add_tail(&str->link, &rt->string_list); in js_alloc_string_rt()
1914 p = js_alloc_string_rt(ctx->rt, max_len, is_wide_char); in js_alloc_string()
1923 static inline void js_free_string(JSRuntime* rt, JSString* str) in js_free_string() argument
1927 JS_FreeAtomStruct(rt, str); in js_free_string()
1932 js_free_rt(rt, str); in js_free_string()
1937 void JS_SetRuntimeInfo(JSRuntime* rt, const char* s) in JS_SetRuntimeInfo() argument
1939 if (rt) in JS_SetRuntimeInfo()
1940 rt->rt_info = s; in JS_SetRuntimeInfo()
1943 void JS_FreeRuntime(JSRuntime* rt) in JS_FreeRuntime() argument
1948 JS_FreeValueRT(rt, rt->current_exception); in JS_FreeRuntime()
1950 list_for_each_safe(el, el1, &rt->job_list) in JS_FreeRuntime()
1954 JS_FreeValueRT(rt, e->argv[i]); in JS_FreeRuntime()
1955 js_free_rt(rt, e); in JS_FreeRuntime()
1957 init_list_head(&rt->job_list); in JS_FreeRuntime()
1959 JS_RunGC(rt); in JS_FreeRuntime()
1970 list_for_each(el, &rt->gc_obj_list) in JS_FreeRuntime()
1975 gc_decref(rt); in JS_FreeRuntime()
1978 list_for_each(el, &rt->gc_obj_list) in JS_FreeRuntime()
1984 JS_DumpObjectHeader(rt); in JS_FreeRuntime()
1987 JS_DumpGCObject(rt, p); in JS_FreeRuntime()
1992 list_for_each(el, &rt->gc_obj_list) in JS_FreeRuntime()
2003 if(!list_empty(&rt->gc_obj_list)) { in JS_FreeRuntime()
2008 for (i = 0; i < rt->class_count; i++) { in JS_FreeRuntime()
2009 JSClass* cl = &rt->class_array[i]; in JS_FreeRuntime()
2011 JS_FreeAtomRT(rt, cl->class_name); in JS_FreeRuntime()
2014 js_free_rt(rt, rt->class_array); in JS_FreeRuntime()
2017 bf_context_end(&rt->bf_ctx); in JS_FreeRuntime()
2025 for (i = 0; i < rt->atom_size; i++) { in JS_FreeRuntime()
2026 JSAtomStruct* p = rt->atom_array[i]; in JS_FreeRuntime()
2031 if (rt->rt_info) { in JS_FreeRuntime()
2032 printf("%s:1: atom leakage:", rt->rt_info); in JS_FreeRuntime()
2039 if (rt->rt_info) { in JS_FreeRuntime()
2046 JS_DumpString(rt, p); in JS_FreeRuntime()
2050 JS_DumpString(rt, p); in JS_FreeRuntime()
2056 JS_DumpString(rt, p); in JS_FreeRuntime()
2060 JS_DumpString(rt, p); in JS_FreeRuntime()
2065 if (rt->rt_info) { in JS_FreeRuntime()
2073 if (rt->rt_info && header_done) in JS_FreeRuntime()
2079 for (i = 0; i < rt->atom_size; i++) { in JS_FreeRuntime()
2080 JSAtomStruct* p = rt->atom_array[i]; in JS_FreeRuntime()
2085 js_free_rt(rt, p); in JS_FreeRuntime()
2088 js_free_rt(rt, rt->atom_array); in JS_FreeRuntime()
2089 js_free_rt(rt, rt->atom_hash); in JS_FreeRuntime()
2090 js_free_rt(rt, rt->shape_hash); in JS_FreeRuntime()
2092 if (!list_empty(&rt->string_list)) { in JS_FreeRuntime()
2093 if (rt->rt_info) { in JS_FreeRuntime()
2094 printf("%s:1: string leakage:", rt->rt_info); in JS_FreeRuntime()
2100 list_for_each_safe(el, el1, &rt->string_list) in JS_FreeRuntime()
2103 if (rt->rt_info) { in JS_FreeRuntime()
2108 JS_DumpString(rt, str); in JS_FreeRuntime()
2109 if (rt->rt_info) { in JS_FreeRuntime()
2115 js_free_rt(rt, str); in JS_FreeRuntime()
2117 if (rt->rt_info) in JS_FreeRuntime()
2121 JSMallocState* s = &rt->malloc_state; in JS_FreeRuntime()
2123 if (rt->rt_info) in JS_FreeRuntime()
2124 printf("%s:1: ", rt->rt_info); in JS_FreeRuntime()
2133 JSMallocState ms = rt->malloc_state; in JS_FreeRuntime()
2134 rt->mf.js_free(&ms, rt); in JS_FreeRuntime()
2138 JSContext* JS_NewContextRaw(JSRuntime* rt) in JS_NewContextRaw() argument
2143 ctx = js_mallocz_rt(rt, sizeof(JSContext)); in JS_NewContextRaw()
2147 add_gc_object(rt, &ctx->header, JS_GC_OBJ_TYPE_JS_CONTEXT); in JS_NewContextRaw()
2149 ctx->class_proto = js_malloc_rt(rt, sizeof(ctx->class_proto[0]) * in JS_NewContextRaw()
2150 rt->class_count); in JS_NewContextRaw()
2152 js_free_rt(rt, ctx); in JS_NewContextRaw()
2155 ctx->rt = rt; in JS_NewContextRaw()
2156 list_add_tail(&ctx->link, &rt->context_list); in JS_NewContextRaw()
2158 ctx->bf_ctx = &rt->bf_ctx; in JS_NewContextRaw()
2162 for (i = 0; i < rt->class_count; i++) in JS_NewContextRaw()
2173 JSContext* JS_NewContext(JSRuntime* rt) in JS_NewContext() argument
2177 ctx = JS_NewContextRaw(rt); in JS_NewContext()
2219 JSRuntime* rt = ctx->rt; in JS_SetClassProto() local
2220 assert(class_id < rt->class_count); in JS_SetClassProto()
2226 JSRuntime* rt = ctx->rt; in JS_GetClassProto() local
2227 assert(class_id < rt->class_count); in JS_GetClassProto()
2259 static void JS_MarkContext(JSRuntime* rt, JSContext* ctx, in JS_MarkContext() argument
2270 js_mark_module_def(rt, m, mark_func); in JS_MarkContext()
2273 JS_MarkValue(rt, ctx->global_obj, mark_func); in JS_MarkContext()
2274 JS_MarkValue(rt, ctx->global_var_obj, mark_func); in JS_MarkContext()
2276 JS_MarkValue(rt, ctx->throw_type_error, mark_func); in JS_MarkContext()
2277 JS_MarkValue(rt, ctx->eval_obj, mark_func); in JS_MarkContext()
2279 JS_MarkValue(rt, ctx->array_proto_values, mark_func); in JS_MarkContext()
2281 JS_MarkValue(rt, ctx->native_error_proto[i], mark_func); in JS_MarkContext()
2283 for (i = 0; i < rt->class_count; i++) { in JS_MarkContext()
2284 JS_MarkValue(rt, ctx->class_proto[i], mark_func); in JS_MarkContext()
2286 JS_MarkValue(rt, ctx->iterator_proto, mark_func); in JS_MarkContext()
2287 JS_MarkValue(rt, ctx->async_iterator_proto, mark_func); in JS_MarkContext()
2288 JS_MarkValue(rt, ctx->promise_ctor, mark_func); in JS_MarkContext()
2289 JS_MarkValue(rt, ctx->array_ctor, mark_func); in JS_MarkContext()
2290 JS_MarkValue(rt, ctx->regexp_ctor, mark_func); in JS_MarkContext()
2291 JS_MarkValue(rt, ctx->function_ctor, mark_func); in JS_MarkContext()
2292 JS_MarkValue(rt, ctx->function_proto, mark_func); in JS_MarkContext()
2295 mark_func(rt, &ctx->array_shape->header); in JS_MarkContext()
2300 JSRuntime* rt = ctx->rt; in JS_FreeContext() local
2308 JS_DumpAtoms(ctx->rt); in JS_FreeContext()
2311 JS_DumpShapes(ctx->rt); in JS_FreeContext()
2318 JS_DumpObjectHeader(ctx->rt); in JS_FreeContext()
2319 list_for_each(el, &rt->gc_obj_list) in JS_FreeContext()
2322 JS_DumpGCObject(rt, p); in JS_FreeContext()
2330 JS_ComputeMemoryUsage(rt, &stats); in JS_FreeContext()
2331 JS_DumpMemoryUsage(stdout, &stats, rt); in JS_FreeContext()
2347 for (i = 0; i < rt->class_count; i++) { in JS_FreeContext()
2350 js_free_rt(rt, ctx->class_proto); in JS_FreeContext()
2359 js_free_shape_null(ctx->rt, ctx->array_shape); in JS_FreeContext()
2363 js_free_rt(ctx->rt, ctx); in JS_FreeContext()
2368 return ctx->rt; in JS_GetRuntime()
2371 void JS_SetMaxStackSize(JSRuntime* rt, size_t stack_size) in JS_SetMaxStackSize() argument
2373 rt->stack_size = stack_size; in JS_SetMaxStackSize()
2378 JSStackFrame* sf = ctx->rt->current_stack_frame; in is_strict_mode()
2385 JSStackFrame* sf = ctx->rt->current_stack_frame; in is_math_mode()
2498 static __maybe_unused void JS_DumpString(JSRuntime* rt, in JS_DumpString() argument
2530 static __maybe_unused void JS_DumpAtoms(JSRuntime* rt) in JS_DumpAtoms() argument
2536 rt->atom_count, rt->atom_size, rt->atom_hash_size); in JS_DumpAtoms()
2538 for (i = 0; i < rt->atom_hash_size; i++) { in JS_DumpAtoms()
2539 h = rt->atom_hash[i]; in JS_DumpAtoms()
2543 p = rt->atom_array[h]; in JS_DumpAtoms()
2545 JS_DumpString(rt, p); in JS_DumpAtoms()
2553 for (i = 0; i < rt->atom_size; i++) { in JS_DumpAtoms()
2554 p = rt->atom_array[i]; in JS_DumpAtoms()
2558 JS_DumpString(rt, p); in JS_DumpAtoms()
2565 static int JS_ResizeAtomHash(JSRuntime* rt, int new_hash_size) in JS_ResizeAtomHash() argument
2572 new_hash = js_mallocz_rt(rt, sizeof(rt->atom_hash[0]) * new_hash_size); in JS_ResizeAtomHash()
2575 for (i = 0; i < rt->atom_hash_size; i++) { in JS_ResizeAtomHash()
2576 h = rt->atom_hash[i]; in JS_ResizeAtomHash()
2578 p = rt->atom_array[h]; in JS_ResizeAtomHash()
2587 js_free_rt(rt, rt->atom_hash); in JS_ResizeAtomHash()
2588 rt->atom_hash = new_hash; in JS_ResizeAtomHash()
2589 rt->atom_hash_size = new_hash_size; in JS_ResizeAtomHash()
2590 rt->atom_count_resize = JS_ATOM_COUNT_RESIZE(new_hash_size); in JS_ResizeAtomHash()
2595 static int JS_InitAtoms(JSRuntime* rt) in JS_InitAtoms() argument
2600 rt->atom_hash_size = 0; in JS_InitAtoms()
2601 rt->atom_hash = NULL; in JS_InitAtoms()
2602 rt->atom_count = 0; in JS_InitAtoms()
2603 rt->atom_size = 0; in JS_InitAtoms()
2604 rt->atom_free_index = 0; in JS_InitAtoms()
2605 if (JS_ResizeAtomHash(rt, 256)) /* there are at least 195 predefined atoms */ in JS_InitAtoms()
2617 if (__JS_NewAtomInit(rt, p, len, atom_type) == JS_ATOM_NULL) in JS_InitAtoms()
2624 static JSAtom JS_DupAtomRT(JSRuntime* rt, JSAtom v) in JS_DupAtomRT() argument
2629 p = rt->atom_array[v]; in JS_DupAtomRT()
2637 JSRuntime* rt; in JS_DupAtom() local
2641 rt = ctx->rt; in JS_DupAtom()
2642 p = rt->atom_array[v]; in JS_DupAtom()
2650 JSRuntime* rt; in JS_AtomGetKind() local
2653 rt = ctx->rt; in JS_AtomGetKind()
2656 p = rt->atom_array[v]; in JS_AtomGetKind()
2681 static JSAtom js_get_atom_index(JSRuntime* rt, JSAtomStruct* p) in js_get_atom_index() argument
2687 i = rt->atom_hash[p->hash & (rt->atom_hash_size - 1)]; in js_get_atom_index()
2688 p1 = rt->atom_array[i]; in js_get_atom_index()
2692 p1 = rt->atom_array[i]; in js_get_atom_index()
2700 static JSAtom __JS_NewAtom(JSRuntime* rt, JSString* str, int atom_type) in __JS_NewAtom() argument
2707 printf("__JS_NewAtom: "); JS_DumpString(rt, str); printf("\n"); in __JS_NewAtom()
2713 i = js_get_atom_index(rt, str); in __JS_NewAtom()
2723 h1 = h & (rt->atom_hash_size - 1); in __JS_NewAtom()
2724 i = rt->atom_hash[h1]; in __JS_NewAtom()
2726 p = rt->atom_array[i]; in __JS_NewAtom()
2747 if (rt->atom_free_index == 0) { in __JS_NewAtom()
2756 new_size = max_int(211, rt->atom_size * 3 / 2); in __JS_NewAtom()
2760 new_array = js_realloc_rt(rt, rt->atom_array, sizeof(*new_array) * new_size); in __JS_NewAtom()
2764 start = rt->atom_size; in __JS_NewAtom()
2767 p = js_mallocz_rt(rt, sizeof(JSAtomStruct)); in __JS_NewAtom()
2769 js_free_rt(rt, new_array); in __JS_NewAtom()
2775 list_add_tail(&p->link, &rt->string_list); in __JS_NewAtom()
2778 rt->atom_count++; in __JS_NewAtom()
2781 rt->atom_size = new_size; in __JS_NewAtom()
2782 rt->atom_array = new_array; in __JS_NewAtom()
2783 rt->atom_free_index = start; in __JS_NewAtom()
2790 rt->atom_array[i] = atom_set_free(next); in __JS_NewAtom()
2799 p = js_malloc_rt(rt, sizeof(JSString) + in __JS_NewAtom()
2808 list_add_tail(&p->link, &rt->string_list); in __JS_NewAtom()
2811 js_free_string(rt, str); in __JS_NewAtom()
2814 p = js_malloc_rt(rt, sizeof(JSAtomStruct)); /* empty wide string */ in __JS_NewAtom()
2821 list_add_tail(&p->link, &rt->string_list); in __JS_NewAtom()
2826 i = rt->atom_free_index; in __JS_NewAtom()
2827 rt->atom_free_index = atom_get_free(rt->atom_array[i]); in __JS_NewAtom()
2828 rt->atom_array[i] = p; in __JS_NewAtom()
2834 rt->atom_count++; in __JS_NewAtom()
2837 p->hash_next = rt->atom_hash[h1]; in __JS_NewAtom()
2838 rt->atom_hash[h1] = i; in __JS_NewAtom()
2839 if (unlikely(rt->atom_count >= rt->atom_count_resize)) in __JS_NewAtom()
2840 JS_ResizeAtomHash(rt, rt->atom_hash_size * 2); in __JS_NewAtom()
2850 js_free_string(rt, str); in __JS_NewAtom()
2855 static JSAtom __JS_NewAtomInit(JSRuntime* rt, const char* str, int len, in __JS_NewAtomInit() argument
2859 p = js_alloc_string_rt(rt, len, 0); in __JS_NewAtomInit()
2864 return __JS_NewAtom(rt, p, atom_type); in __JS_NewAtomInit()
2867 static JSAtom __JS_FindAtom(JSRuntime* rt, const char* str, size_t len, in __JS_FindAtom() argument
2875 h1 = h & (rt->atom_hash_size - 1); in __JS_FindAtom()
2876 i = rt->atom_hash[h1]; in __JS_FindAtom()
2878 p = rt->atom_array[i]; in __JS_FindAtom()
2893 static void JS_FreeAtomStruct(JSRuntime* rt, JSAtomStruct* p) in JS_FreeAtomStruct() argument
2906 h0 = p->hash & (rt->atom_hash_size - 1); in JS_FreeAtomStruct()
2907 i = rt->atom_hash[h0]; in JS_FreeAtomStruct()
2908 p1 = rt->atom_array[i]; in JS_FreeAtomStruct()
2910 rt->atom_hash[h0] = p1->hash_next; in JS_FreeAtomStruct()
2916 p1 = rt->atom_array[i]; in JS_FreeAtomStruct()
2925 rt->atom_array[i] = atom_set_free(rt->atom_free_index); in JS_FreeAtomStruct()
2926 rt->atom_free_index = i; in JS_FreeAtomStruct()
2931 js_free_rt(rt, p); in JS_FreeAtomStruct()
2932 rt->atom_count--; in JS_FreeAtomStruct()
2933 assert(rt->atom_count >= 0); in JS_FreeAtomStruct()
2936 static void __JS_FreeAtom(JSRuntime* rt, uint32_t i) in __JS_FreeAtom() argument
2940 p = rt->atom_array[i]; in __JS_FreeAtom()
2943 JS_FreeAtomStruct(rt, p); in __JS_FreeAtom()
2949 JSRuntime* rt = ctx->rt; in JS_NewAtomStr() local
2953 js_free_string(rt, p); in JS_NewAtomStr()
2958 return __JS_NewAtom(rt, p, JS_ATOM_TYPE_STRING); in JS_NewAtomStr()
2966 JSAtom atom = __JS_FindAtom(ctx->rt, str, len, JS_ATOM_TYPE_STRING); in JS_NewAtomLen()
2992 return __JS_NewAtom(ctx->rt, JS_VALUE_GET_STRING(val), in JS_NewAtomUInt32()
3008 return __JS_NewAtom(ctx->rt, JS_VALUE_GET_STRING(val), in JS_NewAtomInt64()
3016 JSRuntime* rt = ctx->rt; in JS_NewSymbol() local
3018 atom = __JS_NewAtom(rt, p, atom_type); in JS_NewSymbol()
3021 return JS_MKPTR(JS_TAG_SYMBOL, rt->atom_array[atom]); in JS_NewSymbol()
3028 JSRuntime* rt = ctx->rt; in JS_NewSymbolFromAtom() local
3032 assert(descr < rt->atom_size); in JS_NewSymbolFromAtom()
3033 p = rt->atom_array[descr]; in JS_NewSymbolFromAtom()
3041 static const char* JS_AtomGetStrRT(JSRuntime* rt, char* buf, int buf_size, in JS_AtomGetStrRT() argument
3048 assert(atom < rt->atom_size); in JS_AtomGetStrRT()
3057 p = rt->atom_array[atom]; in JS_AtomGetStrRT()
3092 return JS_AtomGetStrRT(ctx->rt, buf, buf_size, atom); in JS_AtomGetStr()
3103 JSRuntime* rt = ctx->rt; in __JS_AtomToValue() local
3105 assert(atom < rt->atom_size); in __JS_AtomToValue()
3106 p = rt->atom_array[atom]; in __JS_AtomToValue()
3112 p = rt->atom_array[JS_ATOM_empty_string]; in __JS_AtomToValue()
3140 JSRuntime* rt = ctx->rt; in JS_AtomIsArrayIndex() local
3144 assert(atom < rt->atom_size); in JS_AtomIsArrayIndex()
3145 p = rt->atom_array[atom]; in JS_AtomIsArrayIndex()
3162 JSRuntime* rt = ctx->rt; in JS_AtomIsNumericIndex1() local
3170 assert(atom < rt->atom_size); in JS_AtomIsNumericIndex1()
3171 p1 = rt->atom_array[atom]; in JS_AtomIsNumericIndex1()
3257 __JS_FreeAtom(ctx->rt, v); in JS_FreeAtom()
3260 void JS_FreeAtomRT(JSRuntime* rt, JSAtom v) in JS_FreeAtomRT() argument
3263 __JS_FreeAtom(rt, v); in JS_FreeAtomRT()
3269 JSRuntime* rt; in JS_AtomSymbolHasDescription() local
3272 rt = ctx->rt; in JS_AtomSymbolHasDescription()
3275 p = rt->atom_array[v]; in JS_AtomSymbolHasDescription()
3394 BOOL JS_IsRegisteredClass(JSRuntime* rt, JSClassID class_id) in JS_IsRegisteredClass() argument
3396 return (class_id < rt->class_count && in JS_IsRegisteredClass()
3397 rt->class_array[class_id].class_id != 0); in JS_IsRegisteredClass()
3402 static int JS_NewClass1(JSRuntime* rt, JSClassID class_id, in JS_NewClass1() argument
3409 if (class_id < rt->class_count && in JS_NewClass1()
3410 rt->class_array[class_id].class_id != 0) in JS_NewClass1()
3413 if (class_id >= rt->class_count) { in JS_NewClass1()
3415 max_int(class_id + 1, rt->class_count * 3 / 2)); in JS_NewClass1()
3418 list_for_each(el, &rt->context_list) in JS_NewClass1()
3422 new_tab = js_realloc_rt(rt, ctx->class_proto, in JS_NewClass1()
3426 for (i = rt->class_count; i < new_size; i++) in JS_NewClass1()
3431 new_class_array = js_realloc_rt(rt, rt->class_array, in JS_NewClass1()
3435 memset(new_class_array + rt->class_count, 0, in JS_NewClass1()
3436 (new_size - rt->class_count) * sizeof(JSClass)); in JS_NewClass1()
3437 rt->class_array = new_class_array; in JS_NewClass1()
3438 rt->class_count = new_size; in JS_NewClass1()
3440 cl = &rt->class_array[class_id]; in JS_NewClass1()
3442 cl->class_name = JS_DupAtomRT(rt, name); in JS_NewClass1()
3450 int JS_NewClass(JSRuntime* rt, JSClassID class_id, const JSClassDef* class_def) in JS_NewClass() argument
3456 name = __JS_FindAtom(rt, class_def->class_name, len, JS_ATOM_TYPE_STRING); in JS_NewClass()
3458 name = __JS_NewAtomInit(rt, class_def->class_name, len, JS_ATOM_TYPE_STRING); in JS_NewClass()
3462 ret = JS_NewClass1(rt, class_id, class_def, name); in JS_NewClass()
3463 JS_FreeAtomRT(rt, name); in JS_NewClass()
3856 …str = js_realloc_rt(s->ctx->rt, str, sizeof(JSString) + (s->len << s->is_wide_char) + 1 - s->is_wi… in string_buffer_end()
3864 list_add_tail(&str->link, &s->ctx->rt->string_list); in string_buffer_end()
4256 static int init_shape_hash(JSRuntime* rt) in init_shape_hash() argument
4258 rt->shape_hash_bits = 4; /* 16 shapes */ in init_shape_hash()
4259 rt->shape_hash_size = 1 << rt->shape_hash_bits; in init_shape_hash()
4260 rt->shape_hash_count = 0; in init_shape_hash()
4261 rt->shape_hash = js_mallocz_rt(rt, sizeof(rt->shape_hash[0]) * in init_shape_hash()
4262 rt->shape_hash_size); in init_shape_hash()
4263 if (!rt->shape_hash) in init_shape_hash()
4289 static int resize_shape_hash(JSRuntime* rt, int new_shape_hash_bits) in resize_shape_hash() argument
4296 new_shape_hash = js_mallocz_rt(rt, sizeof(rt->shape_hash[0]) * in resize_shape_hash()
4300 for (i = 0; i < rt->shape_hash_size; i++) { in resize_shape_hash()
4301 for (sh = rt->shape_hash[i]; sh != NULL; sh = sh_next) { in resize_shape_hash()
4308 js_free_rt(rt, rt->shape_hash); in resize_shape_hash()
4309 rt->shape_hash_bits = new_shape_hash_bits; in resize_shape_hash()
4310 rt->shape_hash_size = new_shape_hash_size; in resize_shape_hash()
4311 rt->shape_hash = new_shape_hash; in resize_shape_hash()
4315 static void js_shape_hash_link(JSRuntime* rt, JSShape* sh) in js_shape_hash_link() argument
4318 h = get_shape_hash(sh->hash, rt->shape_hash_bits); in js_shape_hash_link()
4319 sh->shape_hash_next = rt->shape_hash[h]; in js_shape_hash_link()
4320 rt->shape_hash[h] = sh; in js_shape_hash_link()
4321 rt->shape_hash_count++; in js_shape_hash_link()
4324 static void js_shape_hash_unlink(JSRuntime* rt, JSShape* sh) in js_shape_hash_unlink() argument
4329 h = get_shape_hash(sh->hash, rt->shape_hash_bits); in js_shape_hash_unlink()
4330 psh = &rt->shape_hash[h]; in js_shape_hash_unlink()
4334 rt->shape_hash_count--; in js_shape_hash_unlink()
4341 JSRuntime* rt = ctx->rt; in js_new_shape2() local
4346 if (2 * (rt->shape_hash_count + 1) > rt->shape_hash_size) { in js_new_shape2()
4347 resize_shape_hash(rt, rt->shape_hash_bits + 1); in js_new_shape2()
4355 add_gc_object(rt, &sh->header, JS_GC_OBJ_TYPE_SHAPE); in js_new_shape2()
4369 js_shape_hash_link(ctx->rt, sh); in js_new_shape2()
4398 add_gc_object(ctx->rt, &sh->header, JS_GC_OBJ_TYPE_SHAPE); in js_clone_shape()
4415 static void js_free_shape0(JSRuntime* rt, JSShape* sh) in js_free_shape0() argument
4422 js_shape_hash_unlink(rt, sh); in js_free_shape0()
4424 JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_OBJECT, sh->proto)); in js_free_shape0()
4428 JS_FreeAtomRT(rt, pr->atom); in js_free_shape0()
4432 js_free_rt(rt, get_alloc_from_shape(sh)); in js_free_shape0()
4435 static void js_free_shape(JSRuntime* rt, JSShape* sh) in js_free_shape() argument
4438 js_free_shape0(rt, sh); in js_free_shape()
4442 static void js_free_shape_null(JSRuntime* rt, JSShape* sh) in js_free_shape_null() argument
4445 js_free_shape(rt, sh); in js_free_shape_null()
4484 list_add_tail(&sh->header.link, &ctx->rt->gc_obj_list); in resize_properties()
4504 list_add_tail(&sh->header.link, &ctx->rt->gc_obj_list); in resize_properties()
4508 list_add_tail(&sh->header.link, &ctx->rt->gc_obj_list); in resize_properties()
4545 list_add_tail(&sh->header.link, &ctx->rt->gc_obj_list); in compact_properties()
4586 JSRuntime* rt = ctx->rt; in add_shape_property() local
4594 js_shape_hash_unlink(rt, sh); in add_shape_property()
4603 js_shape_hash_link(rt, sh); in add_shape_property()
4610 js_shape_hash_link(rt, sh); in add_shape_property()
4629 static JSShape* find_hashed_shape_proto(JSRuntime* rt, JSObject* proto) in find_hashed_shape_proto() argument
4635 h1 = get_shape_hash(h, rt->shape_hash_bits); in find_hashed_shape_proto()
4636 for (sh1 = rt->shape_hash[h1]; sh1 != NULL; sh1 = sh1->shape_hash_next) { in find_hashed_shape_proto()
4648 static JSShape* find_hashed_shape_prop(JSRuntime* rt, JSShape* sh, in find_hashed_shape_prop() argument
4657 h1 = get_shape_hash(h, rt->shape_hash_bits); in find_hashed_shape_prop()
4658 for (sh1 = rt->shape_hash[h1]; sh1 != NULL; sh1 = sh1->shape_hash_next) { in find_hashed_shape_prop()
4679 static __maybe_unused void JS_DumpShape(JSRuntime* rt, int i, JSShape* sh) in JS_DumpShape() argument
4689 printf(" %s", JS_AtomGetStrRT(rt, atom_buf, sizeof(atom_buf), in JS_DumpShape()
4695 static __maybe_unused void JS_DumpShapes(JSRuntime* rt) in JS_DumpShapes() argument
4705 for (i = 0; i < rt->shape_hash_size; i++) { in JS_DumpShapes()
4706 for (sh = rt->shape_hash[i]; sh != NULL; sh = sh->shape_hash_next) { in JS_DumpShapes()
4707 JS_DumpShape(rt, i, sh); in JS_DumpShapes()
4712 list_for_each(el, &rt->gc_obj_list) in JS_DumpShapes()
4718 JS_DumpShape(rt, -1, p->shape); in JS_DumpShapes()
4729 js_trigger_gc(ctx->rt, sizeof(JSObject)); in JS_NewObjectFromShape()
4748 js_free_shape(ctx->rt, sh); in JS_NewObjectFromShape()
4805 if (ctx->rt->class_array[class_id].exotic) { in JS_NewObjectFromShape()
4811 add_gc_object(ctx->rt, &p->header, JS_GC_OBJ_TYPE_JS_OBJECT); in JS_NewObjectFromShape()
4831 sh = find_hashed_shape_proto(ctx->rt, proto); in JS_NewObjectProtoClass()
5055 static void js_c_function_data_finalizer(JSRuntime* rt, JSValue val) in js_c_function_data_finalizer() argument
5062 JS_FreeValueRT(rt, s->data[i]); in js_c_function_data_finalizer()
5064 js_free_rt(rt, s); in js_c_function_data_finalizer()
5068 static void js_c_function_data_mark(JSRuntime* rt, JSValueConst val, in js_c_function_data_mark() argument
5076 JS_MarkValue(rt, s->data[i], mark_func); in js_c_function_data_mark()
5149 static void js_autoinit_free(JSRuntime* rt, JSProperty* pr) in js_autoinit_free() argument
5154 static void js_autoinit_mark(JSRuntime* rt, JSProperty* pr, in js_autoinit_mark() argument
5157 mark_func(rt, &js_autoinit_get_realm(pr)->header); in js_autoinit_mark()
5160 static void free_property(JSRuntime* rt, JSProperty* pr, int prop_flags) in free_property() argument
5165 JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_OBJECT, pr->u.getset.getter)); in free_property()
5167 JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_OBJECT, pr->u.getset.setter)); in free_property()
5169 free_var_ref(rt, pr->u.var_ref); in free_property()
5171 js_autoinit_free(rt, pr); in free_property()
5174 JS_FreeValueRT(rt, pr->u.value); in free_property()
5227 static void free_var_ref(JSRuntime* rt, JSVarRef* var_ref) in free_var_ref() argument
5233 JS_FreeValueRT(rt, var_ref->value); in free_var_ref()
5238 js_free_rt(rt, var_ref); in free_var_ref()
5243 static void js_array_finalizer(JSRuntime* rt, JSValue val) in js_array_finalizer() argument
5249 JS_FreeValueRT(rt, p->u.array.u.values[i]); in js_array_finalizer()
5251 js_free_rt(rt, p->u.array.u.values); in js_array_finalizer()
5254 static void js_array_mark(JSRuntime* rt, JSValueConst val, in js_array_mark() argument
5261 JS_MarkValue(rt, p->u.array.u.values[i], mark_func); in js_array_mark()
5265 static void js_object_data_finalizer(JSRuntime* rt, JSValue val) in js_object_data_finalizer() argument
5268 JS_FreeValueRT(rt, p->u.object_data); in js_object_data_finalizer()
5272 static void js_object_data_mark(JSRuntime* rt, JSValueConst val, in js_object_data_mark() argument
5276 JS_MarkValue(rt, p->u.object_data, mark_func); in js_object_data_mark()
5279 static void js_c_function_finalizer(JSRuntime* rt, JSValue val) in js_c_function_finalizer() argument
5287 static void js_c_function_mark(JSRuntime* rt, JSValueConst val, in js_c_function_mark() argument
5293 mark_func(rt, &p->u.cfunc.realm->header); in js_c_function_mark()
5296 static void js_bytecode_function_finalizer(JSRuntime* rt, JSValue val) in js_bytecode_function_finalizer() argument
5305 JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_OBJECT, p1)); in js_bytecode_function_finalizer()
5312 free_var_ref(rt, var_refs[i]); in js_bytecode_function_finalizer()
5313 js_free_rt(rt, var_refs); in js_bytecode_function_finalizer()
5315 JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_FUNCTION_BYTECODE, b)); in js_bytecode_function_finalizer()
5319 static void js_bytecode_function_mark(JSRuntime* rt, JSValueConst val, in js_bytecode_function_mark() argument
5328 JS_MarkValue(rt, JS_MKPTR(JS_TAG_OBJECT, p->u.func.home_object), in js_bytecode_function_mark()
5336 mark_func(rt, &var_ref->header); in js_bytecode_function_mark()
5342 JS_MarkValue(rt, JS_MKPTR(JS_TAG_FUNCTION_BYTECODE, b), mark_func); in js_bytecode_function_mark()
5346 static void js_bound_function_finalizer(JSRuntime* rt, JSValue val) in js_bound_function_finalizer() argument
5352 JS_FreeValueRT(rt, bf->func_obj); in js_bound_function_finalizer()
5353 JS_FreeValueRT(rt, bf->this_val); in js_bound_function_finalizer()
5355 JS_FreeValueRT(rt, bf->argv[i]); in js_bound_function_finalizer()
5357 js_free_rt(rt, bf); in js_bound_function_finalizer()
5360 static void js_bound_function_mark(JSRuntime* rt, JSValueConst val, in js_bound_function_mark() argument
5367 JS_MarkValue(rt, bf->func_obj, mark_func); in js_bound_function_mark()
5368 JS_MarkValue(rt, bf->this_val, mark_func); in js_bound_function_mark()
5370 JS_MarkValue(rt, bf->argv[i], mark_func); in js_bound_function_mark()
5373 static void js_for_in_iterator_finalizer(JSRuntime* rt, JSValue val) in js_for_in_iterator_finalizer() argument
5377 JS_FreeValueRT(rt, it->obj); in js_for_in_iterator_finalizer()
5378 js_free_rt(rt, it); in js_for_in_iterator_finalizer()
5381 static void js_for_in_iterator_mark(JSRuntime* rt, JSValueConst val, in js_for_in_iterator_mark() argument
5386 JS_MarkValue(rt, it->obj, mark_func); in js_for_in_iterator_mark()
5389 static void free_object(JSRuntime* rt, JSObject* p) in free_object() argument
5402 free_property(rt, &p->prop[i], pr->flags); in free_object()
5405 js_free_rt(rt, p->prop); in free_object()
5408 js_free_shape(rt, sh); in free_object()
5415 reset_weak_ref(rt, p); in free_object()
5418 finalizer = rt->class_array[p->class_id].finalizer; in free_object()
5420 (*finalizer)(rt, JS_MKPTR(JS_TAG_OBJECT, p)); in free_object()
5429 if (rt->gc_phase == JS_GC_PHASE_REMOVE_CYCLES && p->header.ref_count != 0) { in free_object()
5430 list_add_tail(&p->header.link, &rt->gc_zero_ref_count_list); in free_object()
5432 js_free_rt(rt, p); in free_object()
5436 static void free_gc_object(JSRuntime* rt, JSGCObjectHeader* gp) in free_gc_object() argument
5440 free_object(rt, (JSObject*)gp); in free_gc_object()
5443 free_function_bytecode(rt, (JSFunctionBytecode*)gp); in free_gc_object()
5450 static void free_zero_refcount(JSRuntime* rt) in free_zero_refcount() argument
5455 rt->gc_phase = JS_GC_PHASE_DECREF; in free_zero_refcount()
5457 el = rt->gc_zero_ref_count_list.next; in free_zero_refcount()
5458 if (el == &rt->gc_zero_ref_count_list) in free_zero_refcount()
5462 free_gc_object(rt, p); in free_zero_refcount()
5464 rt->gc_phase = JS_GC_PHASE_NONE; in free_zero_refcount()
5468 void __JS_FreeValueRT(JSRuntime* rt, JSValue v) in __JS_FreeValueRT() argument
5476 JS_DumpObject(rt, JS_VALUE_GET_OBJ(v)); in __JS_FreeValueRT()
5478 JS_DumpValueShort(rt, v); in __JS_FreeValueRT()
5488 JS_FreeAtomStruct(rt, p); in __JS_FreeValueRT()
5493 js_free_rt(rt, p); in __JS_FreeValueRT()
5499 if (rt->gc_phase != JS_GC_PHASE_REMOVE_CYCLES) { in __JS_FreeValueRT()
5501 list_add(&p->link, &rt->gc_zero_ref_count_list); in __JS_FreeValueRT()
5502 if (rt->gc_phase == JS_GC_PHASE_NONE) { in __JS_FreeValueRT()
5503 free_zero_refcount(rt); in __JS_FreeValueRT()
5515 js_free_rt(rt, bf); in __JS_FreeValueRT()
5520 js_free_rt(rt, bf); in __JS_FreeValueRT()
5525 JS_FreeAtomStruct(rt, p); in __JS_FreeValueRT()
5535 __JS_FreeValueRT(ctx->rt, v); in __JS_FreeValue()
5540 static void add_gc_object(JSRuntime* rt, JSGCObjectHeader* h, in add_gc_object() argument
5545 list_add_tail(&h->link, &rt->gc_obj_list); in add_gc_object()
5553 void JS_MarkValue(JSRuntime* rt, JSValueConst val, JS_MarkFunc* mark_func) in JS_MarkValue() argument
5559 mark_func(rt, JS_VALUE_GET_PTR(val)); in JS_MarkValue()
5567 static void mark_children(JSRuntime* rt, JSGCObjectHeader* gp, in mark_children() argument
5577 mark_func(rt, &sh->header); in mark_children()
5586 mark_func(rt, &pr->u.getset.getter->header); in mark_children()
5588 mark_func(rt, &pr->u.getset.setter->header); in mark_children()
5593 mark_func(rt, &pr->u.var_ref->header); in mark_children()
5596 js_autoinit_mark(rt, pr, mark_func); in mark_children()
5599 JS_MarkValue(rt, pr->u.value, mark_func); in mark_children()
5607 gc_mark = rt->class_array[p->class_id].gc_mark; in mark_children()
5609 gc_mark(rt, JS_MKPTR(JS_TAG_OBJECT, p), mark_func); in mark_children()
5618 JS_MarkValue(rt, b->cpool[i], mark_func); in mark_children()
5621 mark_func(rt, &b->realm->header); in mark_children()
5628 JS_MarkValue(rt, *var_ref->pvalue, mark_func); in mark_children()
5633 async_func_mark(rt, &s->func_state, mark_func); in mark_children()
5634 JS_MarkValue(rt, s->resolving_funcs[0], mark_func); in mark_children()
5635 JS_MarkValue(rt, s->resolving_funcs[1], mark_func); in mark_children()
5640 mark_func(rt, &sh->proto->header); in mark_children()
5645 JS_MarkContext(rt, ctx, mark_func); in mark_children()
5652 static void gc_decref_child(JSRuntime* rt, JSGCObjectHeader* p) in gc_decref_child() argument
5658 list_add_tail(&p->link, &rt->tmp_obj_list); in gc_decref_child()
5662 static void gc_decref(JSRuntime* rt) in gc_decref() argument
5667 init_list_head(&rt->tmp_obj_list); in gc_decref()
5672 list_for_each_safe(el, el1, &rt->gc_obj_list) in gc_decref()
5676 mark_children(rt, p, gc_decref_child); in gc_decref()
5680 list_add_tail(&p->link, &rt->tmp_obj_list); in gc_decref()
5685 static void gc_scan_incref_child(JSRuntime* rt, JSGCObjectHeader* p) in gc_scan_incref_child() argument
5692 list_add_tail(&p->link, &rt->gc_obj_list); in gc_scan_incref_child()
5697 static void gc_scan_incref_child2(JSRuntime* rt, JSGCObjectHeader* p) in gc_scan_incref_child2() argument
5702 static void gc_scan(JSRuntime* rt) in gc_scan() argument
5708 list_for_each(el, &rt->gc_obj_list) in gc_scan()
5713 mark_children(rt, p, gc_scan_incref_child); in gc_scan()
5717 list_for_each(el, &rt->tmp_obj_list) in gc_scan()
5720 mark_children(rt, p, gc_scan_incref_child2); in gc_scan()
5724 static void gc_free_cycles(JSRuntime* rt) in gc_free_cycles() argument
5732 rt->gc_phase = JS_GC_PHASE_REMOVE_CYCLES; in gc_free_cycles()
5735 el = rt->tmp_obj_list.next; in gc_free_cycles()
5736 if (el == &rt->tmp_obj_list) in gc_free_cycles()
5748 JS_DumpObjectHeader(rt); in gc_free_cycles()
5751 JS_DumpGCObject(rt, p); in gc_free_cycles()
5753 free_gc_object(rt, p); in gc_free_cycles()
5757 list_add_tail(&p->link, &rt->gc_zero_ref_count_list); in gc_free_cycles()
5761 rt->gc_phase = JS_GC_PHASE_NONE; in gc_free_cycles()
5763 list_for_each_safe(el, el1, &rt->gc_zero_ref_count_list) in gc_free_cycles()
5768 js_free_rt(rt, p); in gc_free_cycles()
5771 init_list_head(&rt->gc_zero_ref_count_list); in gc_free_cycles()
5774 void JS_RunGC(JSRuntime* rt) in JS_RunGC() argument
5778 gc_decref(rt); in JS_RunGC()
5781 gc_scan(rt); in JS_RunGC()
5784 gc_free_cycles(rt); in JS_RunGC()
5790 BOOL JS_IsLiveObject(JSRuntime* rt, JSValueConst obj) in JS_IsLiveObject() argument
5880 void JS_ComputeMemoryUsage(JSRuntime* rt, JSMemoryUsage* s) in JS_ComputeMemoryUsage() argument
5887 s->malloc_count = rt->malloc_state.malloc_count; in JS_ComputeMemoryUsage()
5888 s->malloc_size = rt->malloc_state.malloc_size; in JS_ComputeMemoryUsage()
5889 s->malloc_limit = rt->malloc_state.malloc_limit; in JS_ComputeMemoryUsage()
5892 s->memory_used_size = sizeof(JSRuntime) + sizeof(JSValue) * rt->class_count; in JS_ComputeMemoryUsage()
5894 list_for_each(el, &rt->context_list) in JS_ComputeMemoryUsage()
5900 sizeof(JSValue) * rt->class_count; in JS_ComputeMemoryUsage()
5944 list_for_each(el, &rt->gc_obj_list) in JS_ComputeMemoryUsage()
6130 s->memory_used_size += sizeof(rt->shape_hash[0]) * rt->shape_hash_size; in JS_ComputeMemoryUsage()
6131 for (i = 0; i < rt->shape_hash_size; i++) { in JS_ComputeMemoryUsage()
6133 for (sh = rt->shape_hash[i]; sh != NULL; sh = sh->shape_hash_next) { in JS_ComputeMemoryUsage()
6142 s->atom_count = rt->atom_count; in JS_ComputeMemoryUsage()
6143 s->atom_size = sizeof(rt->atom_array[0]) * rt->atom_size + in JS_ComputeMemoryUsage()
6144 sizeof(rt->atom_hash[0]) * rt->atom_hash_size; in JS_ComputeMemoryUsage()
6145 for (i = 0; i < rt->atom_size; i++) { in JS_ComputeMemoryUsage()
6146 JSAtomStruct* p = rt->atom_array[i]; in JS_ComputeMemoryUsage()
6168 void JS_DumpMemoryUsage(FILE* fp, const JSMemoryUsage* s, JSRuntime* rt) in JS_DumpMemoryUsage() argument
6178 if (rt) { in JS_DumpMemoryUsage()
6192 void *p = js_malloc_rt(rt, size); in JS_DumpMemoryUsage()
6194 unsigned int size1 = js_malloc_usable_size_rt(rt, p); in JS_DumpMemoryUsage()
6200 js_free_rt(rt, p); in JS_DumpMemoryUsage()
6210 list_for_each(el, &rt->gc_obj_list) { in JS_DumpMemoryUsage()
6225 … JS_AtomGetStrRT(rt, buf, sizeof(buf), js_std_class_def[class_id - 1].class_name)); in JS_DumpMemoryUsage()
6305 JSRuntime* rt = ctx->rt; in JS_Throw() local
6306 JS_FreeValue(ctx, rt->current_exception); in JS_Throw()
6307 rt->current_exception = obj; in JS_Throw()
6315 JSRuntime* rt = ctx->rt; in JS_GetException() local
6316 val = rt->current_exception; in JS_GetException()
6317 rt->current_exception = JS_NULL; in JS_GetException()
6475 for (sf = ctx->rt->current_stack_frame; sf != NULL; sf = sf->prev_frame) { in build_backtrace()
6573 JSRuntime* rt = ctx->rt; in JS_ThrowError() local
6578 sf = rt->current_stack_frame; in JS_ThrowError()
6579 add_backtrace = !rt->in_out_of_memory && in JS_ThrowError()
6688 JSRuntime* rt = ctx->rt; in JS_ThrowOutOfMemory() local
6689 if (!rt->in_out_of_memory) { in JS_ThrowOutOfMemory()
6690 rt->in_out_of_memory = TRUE; in JS_ThrowOutOfMemory()
6692 rt->in_out_of_memory = FALSE; in JS_ThrowOutOfMemory()
6728 JSRuntime* rt = ctx->rt; in JS_ThrowTypeErrorInvalidClass() local
6730 name = rt->class_array[class_id].class_name; in JS_ThrowTypeErrorInvalidClass()
6736 JSRuntime* rt = ctx->rt; in __js_poll_interrupts() local
6738 if (rt->interrupt_handler) { in __js_poll_interrupts()
6739 if (rt->interrupt_handler(rt, rt->interrupt_opaque)) { in __js_poll_interrupts()
6742 JS_SetUncatchableError(ctx, ctx->rt->current_exception, TRUE); in __js_poll_interrupts()
7123 const JSClassExoticMethods* em = ctx->rt->class_array[p->class_id].exotic; in JS_GetPropertyInternal()
7453 const JSClassExoticMethods* em = ctx->rt->class_array[p->class_id].exotic; in JS_GetOwnPropertyNamesInternal()
7681 const JSClassExoticMethods* em = ctx->rt->class_array[p->class_id].exotic; in JS_GetOwnPropertyInternal()
7741 const JSClassExoticMethods* em = ctx->rt->class_array[p->class_id].exotic; in JS_HasProperty()
7778 return js_get_atom_index(ctx->rt, p); in js_symbol_to_atom()
7793 atom = JS_DupAtom(ctx, js_get_atom_index(ctx->rt, p)); in JS_ValueToAtom()
7947 new_sh = find_hashed_shape_prop(ctx->rt, sh, prop, prop_flags); in add_property()
7959 js_free_shape(ctx->rt, sh); in add_property()
7968 js_shape_hash_link(ctx->rt, new_sh); in add_property()
7969 js_free_shape(ctx->rt, p->shape); in add_property()
8052 free_property(ctx->rt, pr1, pr->flags); in delete_property()
8091 const JSClassExoticMethods* em = ctx->rt->class_array[p->class_id].exotic; in delete_property()
8271 const JSClassExoticMethods* em = ctx->rt->class_array[p->class_id].exotic; in JS_SetPropertyGeneric()
8457 const JSClassExoticMethods* em = ctx->rt->class_array[p1->class_id].exotic; in JS_SetPropertyInternal()
8830 const JSClassExoticMethods* em = ctx->rt->class_array[p->class_id].exotic; in JS_CreateProperty()
8928 js_free_shape(ctx->rt, p->shape); in js_shape_prepare_update()
8933 js_shape_hash_unlink(ctx->rt, sh); in js_shape_prepare_update()
9007 free_var_ref(ctx->rt, pr->u.var_ref); in JS_DefineProperty()
9012 js_autoinit_free(ctx->rt, pr); in JS_DefineProperty()
9067 js_autoinit_free(ctx->rt, pr); in JS_DefineProperty()
9115 free_var_ref(ctx->rt, pr->u.var_ref); in JS_DefineProperty()
9648 return (ctx->rt->class_array[p->class_id].call != NULL); in JS_IsFunction()
9714 JS_SetUncatchableError(ctx, ctx->rt->current_exception, FALSE); in JS_ResetUncatchableError()
10190 buf = js_malloc_rt(ctx->rt, len + 2); /* no exception raised */ in js_atof2()
10251 val = ctx->rt->bigint_ops.from_string(ctx, buf, radix, flags, NULL); in js_atof2()
10256 val = ctx->rt->bigfloat_ops.from_string(ctx, buf, radix, flags, in js_atof2()
10262 val = ctx->rt->bigdecimal_ops.from_string(ctx, buf, radix, flags, NULL); in js_atof2()
10280 js_free_rt(ctx->rt, buf); in js_atof2()
11419 return ctx->rt->bigint_ops.to_string(ctx, val); in JS_ToStringInternal()
11421 return ctx->rt->bigfloat_ops.to_string(ctx, val); in JS_ToStringInternal()
11423 return ctx->rt->bigdecimal_ops.to_string(ctx, val); in JS_ToStringInternal()
11532 static __maybe_unused void JS_DumpObjectHeader(JSRuntime* rt) in JS_DumpObjectHeader() argument
11539 static __maybe_unused void JS_DumpObject(JSRuntime* rt, JSObject* p) in JS_DumpObject() argument
11562 … JS_AtomGetStrRT(rt, atom_buf, sizeof(atom_buf), rt->class_array[p->class_id].class_name)); in JS_DumpObject()
11571 JS_DumpValueShort(rt, p->u.array.u.values[i]); in JS_DumpObject()
11592 JS_AtomGetStrRT(rt, atom_buf, sizeof(atom_buf), prs->atom)); in JS_DumpObject()
11604 JS_DumpValueShort(rt, pr->u.value); in JS_DumpObject()
11620 JS_DumpValueShort(rt, var_refs[i]->value); in JS_DumpObject()
11624 JS_DumpValueShort(rt, JS_MKPTR(JS_TAG_OBJECT, p->u.func.home_object)); in JS_DumpObject()
11631 static __maybe_unused void JS_DumpGCObject(JSRuntime* rt, JSGCObjectHeader* p) in JS_DumpGCObject() argument
11634 JS_DumpObject(rt, (JSObject*)p); in JS_DumpGCObject()
11663 static __maybe_unused void JS_DumpValueShort(JSRuntime* rt, in JS_DumpValueShort() argument
11703 bf_realloc(&rt->bf_ctx, str, 0); in JS_DumpValueShort()
11711 bf_free(&rt->bf_ctx, str); in JS_DumpValueShort()
11719 bf_free(&rt->bf_ctx, str); in JS_DumpValueShort()
11725 JS_DumpString(rt, p); in JS_DumpValueShort()
11730 printf("[bytecode %s]", JS_AtomGetStrRT(rt, buf, sizeof(buf), b->func_name)); in JS_DumpValueShort()
11734 JSAtom atom = rt->class_array[p->class_id].class_name; in JS_DumpValueShort()
11737 JS_AtomGetStrRT(rt, atom_buf, sizeof(atom_buf), atom), (void*)p); in JS_DumpValueShort()
11743 JS_AtomGetStrRT(rt, atom_buf, sizeof(atom_buf), js_get_atom_index(rt, p))); in JS_DumpValueShort()
11757 JS_DumpValueShort(ctx->rt, val); in JS_DumpValue()
11765 JS_DumpValueShort(ctx->rt, val); in JS_PrintValue()
12691 if (ctx->rt->bigint_ops.unary_arith(ctx, sp - 1, op, op1)) in js_unary_arith_slow()
12695 if (ctx->rt->bigfloat_ops.unary_arith(ctx, sp - 1, op, op1)) in js_unary_arith_slow()
12699 if (ctx->rt->bigdecimal_ops.unary_arith(ctx, sp - 1, op, op1)) in js_unary_arith_slow()
12769 if (ctx->rt->bigint_ops.unary_arith(ctx, sp - 1, OP_not, op1)) in js_not_slow()
13195 if (ctx->rt->bigdecimal_ops.binary_arith(ctx, op, sp - 2, op1, op2)) in js_binary_arith_slow()
13198 if (ctx->rt->bigfloat_ops.binary_arith(ctx, op, sp - 2, op1, op2)) in js_binary_arith_slow()
13202 if (ctx->rt->bigint_ops.binary_arith(ctx, op, sp - 2, op1, op2)) in js_binary_arith_slow()
13336 if (ctx->rt->bigdecimal_ops.binary_arith(ctx, OP_add, sp - 2, op1, op2)) in js_add_slow()
13339 if (ctx->rt->bigfloat_ops.binary_arith(ctx, OP_add, sp - 2, op1, op2)) in js_add_slow()
13343 if (ctx->rt->bigint_ops.binary_arith(ctx, OP_add, sp - 2, op1, op2)) in js_add_slow()
13421 if (ctx->rt->bigint_ops.binary_arith(ctx, op, sp - 2, op1, op2)) in js_binary_logic_slow()
13679 res = ctx->rt->bigdecimal_ops.compare(ctx, op, op1, op2); in js_relational_slow()
13684 res = ctx->rt->bigfloat_ops.compare(ctx, op, op1, op2); in js_relational_slow()
13688 res = ctx->rt->bigint_ops.compare(ctx, op, op1, op2); in js_relational_slow()
13741 res = ctx->rt->bigdecimal_ops.compare(ctx, OP_eq, op1, op2); in js_eq_slow()
13745 res = ctx->rt->bigfloat_ops.compare(ctx, OP_eq, op1, op2); in js_eq_slow()
13749 res = ctx->rt->bigint_ops.compare(ctx, OP_eq, op1, op2); in js_eq_slow()
14776 free_var_ref(ctx->rt, var_ref); in js_build_mapped_arguments()
14796 JS_DupValue(ctx, ctx->rt->current_stack_frame->cur_func), in js_build_mapped_arguments()
15117 ex_obj = ctx->rt->current_exception; in JS_IteratorClose()
15118 ctx->rt->current_exception = JS_NULL; in JS_IteratorClose()
15432 return ctx->rt->current_stack_frame->cur_func; in JS_GetActiveFunction()
15684 static void close_var_refs(JSRuntime* rt, JSStackFrame* sf) in close_var_refs() argument
15695 var_ref->value = JS_DupValueRT(rt, sf->arg_buf[var_idx]); in close_var_refs()
15697 var_ref->value = JS_DupValueRT(rt, sf->var_buf[var_idx]); in close_var_refs()
15701 add_gc_object(rt, &var_ref->header, JS_GC_OBJ_TYPE_VAR_REF); in close_var_refs()
15720 add_gc_object(ctx->rt, &var_ref->header, JS_GC_OBJ_TYPE_VAR_REF); in close_lexical_var()
15732 JSRuntime* rt = ctx->rt; in js_call_c_function() local
15747 if (js_check_stack_overflow(rt, sizeof(arg_buf[0]) * arg_count)) in js_call_c_function()
15750 prev_sf = rt->current_stack_frame; in js_call_c_function()
15752 rt->current_stack_frame = sf; in js_call_c_function()
15859 rt->current_stack_frame = sf->prev_frame; in js_call_c_function()
15879 if (js_check_stack_overflow(ctx->rt, sizeof(JSValue) * arg_count)) in js_call_bound_function()
15924 JSRuntime* rt = caller_ctx->rt; in JS_CallInternal() local
15975 sf->prev_frame = rt->current_stack_frame; in JS_CallInternal()
15976 rt->current_stack_frame = sf; in JS_CallInternal()
15988 call_func = rt->class_array[p->class_id].call; in JS_CallInternal()
16006 if (js_check_stack_overflow(rt, alloca_size)) in JS_CallInternal()
16036 sf->prev_frame = rt->current_stack_frame; in JS_CallInternal()
16037 rt->current_stack_frame = sf; in JS_CallInternal()
17050 free_var_ref(rt, var_ref); in JS_CallInternal()
18231 if (rt->bigfloat_ops.mul_pow10(ctx, sp)) goto exception; in JS_CallInternal()
18486 if (is_backtrace_needed(ctx, rt->current_exception)) { in JS_CallInternal()
18491 build_backtrace(ctx, rt->current_exception, NULL, 0, 0); in JS_CallInternal()
18493 if (!JS_IsUncatchableError(ctx, rt->current_exception)) { in JS_CallInternal()
18505 *sp++ = rt->current_exception; in JS_CallInternal()
18506 rt->current_exception = JS_NULL; in JS_CallInternal()
18525 close_var_refs(rt, sf); in JS_CallInternal()
18532 rt->current_stack_frame = sf->prev_frame; in JS_CallInternal()
18643 call_func = ctx->rt->class_array[p->class_id].call; in JS_CallConstructorInternal()
18743 static void async_func_mark(JSRuntime* rt, JSAsyncFunctionState* s, in async_func_mark() argument
18750 JS_MarkValue(rt, sf->cur_func, mark_func); in async_func_mark()
18751 JS_MarkValue(rt, s->this_val, mark_func); in async_func_mark()
18758 JS_MarkValue(rt, *sp, mark_func); in async_func_mark()
18762 static void async_func_free(JSRuntime* rt, JSAsyncFunctionState* s) in async_func_free() argument
18770 close_var_refs(rt, sf); in async_func_free()
18776 JS_FreeValueRT(rt, *sp); in async_func_free()
18778 js_free_rt(rt, sf->arg_buf); in async_func_free()
18780 JS_FreeValueRT(rt, sf->cur_func); in async_func_free()
18781 JS_FreeValueRT(rt, s->this_val); in async_func_free()
18788 if (js_check_stack_overflow(ctx->rt, 0)) in async_func_resume()
18812 static void free_generator_stack_rt(JSRuntime* rt, JSGeneratorData* s) in free_generator_stack_rt() argument
18816 async_func_free(rt, &s->func_state); in free_generator_stack_rt()
18820 static void js_generator_finalizer(JSRuntime* rt, JSValue obj) in js_generator_finalizer() argument
18825 free_generator_stack_rt(rt, s); in js_generator_finalizer()
18826 js_free_rt(rt, s); in js_generator_finalizer()
18832 free_generator_stack_rt(ctx->rt, s); in free_generator_stack()
18835 static void js_generator_mark(JSRuntime* rt, JSValueConst val, in js_generator_mark() argument
18843 async_func_mark(rt, &s->func_state, mark_func); in js_generator_mark()
19038 free_generator_stack_rt(ctx->rt, s); in js_generator_function_call()
19045 static void js_async_function_terminate(JSRuntime* rt, JSAsyncFunctionData* s) in js_async_function_terminate() argument
19048 async_func_free(rt, &s->func_state); in js_async_function_terminate()
19053 static void js_async_function_free0(JSRuntime* rt, JSAsyncFunctionData* s) in js_async_function_free0() argument
19055 js_async_function_terminate(rt, s); in js_async_function_free0()
19056 JS_FreeValueRT(rt, s->resolving_funcs[0]); in js_async_function_free0()
19057 JS_FreeValueRT(rt, s->resolving_funcs[1]); in js_async_function_free0()
19059 js_free_rt(rt, s); in js_async_function_free0()
19062 static void js_async_function_free(JSRuntime* rt, JSAsyncFunctionData* s) in js_async_function_free() argument
19065 js_async_function_free0(rt, s); in js_async_function_free()
19069 static void js_async_function_resolve_finalizer(JSRuntime* rt, JSValue val) in js_async_function_resolve_finalizer() argument
19074 js_async_function_free(rt, s); in js_async_function_resolve_finalizer()
19078 static void js_async_function_resolve_mark(JSRuntime* rt, JSValueConst val, in js_async_function_resolve_mark() argument
19084 mark_func(rt, &s->header); in js_async_function_resolve_mark()
19123 js_async_function_terminate(ctx->rt, s); in js_async_function_resume()
19135 js_async_function_terminate(ctx->rt, s); in js_async_function_resume()
19205 add_gc_object(ctx->rt, &s->header, JS_GC_OBJ_TYPE_ASYNC_FUNCTION); in js_async_function_call()
19217 js_async_function_free(ctx->rt, s); in js_async_function_call()
19224 js_async_function_free(ctx->rt, s); in js_async_function_call()
19257 static void js_async_generator_free(JSRuntime* rt, in js_async_generator_free() argument
19266 JS_FreeValueRT(rt, req->result); in js_async_generator_free()
19267 JS_FreeValueRT(rt, req->promise); in js_async_generator_free()
19268 JS_FreeValueRT(rt, req->resolving_funcs[0]); in js_async_generator_free()
19269 JS_FreeValueRT(rt, req->resolving_funcs[1]); in js_async_generator_free()
19270 js_free_rt(rt, req); in js_async_generator_free()
19274 async_func_free(rt, &s->func_state); in js_async_generator_free()
19276 js_free_rt(rt, s); in js_async_generator_free()
19279 static void js_async_generator_finalizer(JSRuntime* rt, JSValue obj) in js_async_generator_finalizer() argument
19284 js_async_generator_free(rt, s); in js_async_generator_finalizer()
19288 static void js_async_generator_mark(JSRuntime* rt, JSValueConst val, in js_async_generator_mark() argument
19298 JS_MarkValue(rt, req->result, mark_func); in js_async_generator_mark()
19299 JS_MarkValue(rt, req->promise, mark_func); in js_async_generator_mark()
19300 JS_MarkValue(rt, req->resolving_funcs[0], mark_func); in js_async_generator_mark()
19301 JS_MarkValue(rt, req->resolving_funcs[1], mark_func); in js_async_generator_mark()
19305 async_func_mark(rt, &s->func_state, mark_func); in js_async_generator_mark()
19415 async_func_free(ctx->rt, &s->func_state); in js_async_generator_complete()
19658 js_async_generator_free(ctx->rt, s); in js_async_generator_function_call()
20116 build_backtrace(ctx, ctx->rt->current_exception, s->filename, s->line_num, in js_parse_error()
20529 if (js_check_stack_overflow(s->ctx->rt, 0)) { in next_token()
21045 if (js_check_stack_overflow(s->ctx->rt, 0)) { in json_next_token()
22152 val = s->ctx->rt->bigfloat_ops.mul_pow10_to_float64(s->ctx, &p->num, in js_parse_property_name()
24133 build_backtrace(s->ctx, s->ctx->rt->current_exception, in js_parse_postfix_expr()
26634 static void js_mark_module_def(JSRuntime* rt, JSModuleDef* m, in js_mark_module_def() argument
26643 mark_func(rt, &me->u.local.var_ref->header); in js_mark_module_def()
26647 JS_MarkValue(rt, m->module_ns, mark_func); in js_mark_module_def()
26648 JS_MarkValue(rt, m->func_obj, mark_func); in js_mark_module_def()
26649 JS_MarkValue(rt, m->eval_exception, mark_func); in js_mark_module_def()
26650 JS_MarkValue(rt, m->meta_obj, mark_func); in js_mark_module_def()
26668 free_var_ref(ctx->rt, me->u.local.var_ref); in js_free_module_def()
26830 void JS_SetModuleLoaderFunc(JSRuntime* rt, in JS_SetModuleLoaderFunc() argument
26834 rt->module_normalize_func = module_normalize; in JS_SetModuleLoaderFunc()
26835 rt->module_loader_func = module_loader; in JS_SetModuleLoaderFunc()
26836 rt->module_loader_opaque = opaque; in JS_SetModuleLoaderFunc()
26917 JSRuntime* rt = ctx->rt; in js_host_resolve_imported_module() local
26932 if (!rt->module_normalize_func) { in js_host_resolve_imported_module()
26935 cname = rt->module_normalize_func(ctx, base_cname, cname1, in js_host_resolve_imported_module()
26936 rt->module_loader_opaque); in js_host_resolve_imported_module()
26960 if (!rt->module_loader_func) { in js_host_resolve_imported_module()
26968 m = rt->module_loader_func(ctx, cname, rt->module_loader_opaque); in js_host_resolve_imported_module()
27439 add_gc_object(ctx->rt, &var_ref->header, JS_GC_OBJ_TYPE_VAR_REF); in js_create_module_var()
27699 sf = ctx->rt->current_stack_frame; in js_get_script_or_module_name()
27897 m->eval_exception = JS_DupValue(ctx, ctx->rt->current_exception); in js_evaluate_module()
28331 static void free_bytecode_atoms(JSRuntime* rt, in free_bytecode_atoms() argument
28355 JS_FreeAtomRT(rt, atom); in free_bytecode_atoms()
28377 free_bytecode_atoms(ctx->rt, fd->byte_code.buf, fd->byte_code.size, in js_free_function_def()
32106 add_gc_object(ctx->rt, &b->header, JS_GC_OBJ_TYPE_FUNCTION_BYTECODE); in js_create_function()
32126 static void free_function_bytecode(JSRuntime* rt, JSFunctionBytecode* b) in free_function_bytecode() argument
32134 JS_AtomGetStrRT(rt, buf, sizeof(buf), b->func_name)); in free_function_bytecode()
32137 free_bytecode_atoms(rt, b->byte_code_buf, b->byte_code_len, TRUE); in free_function_bytecode()
32141 JS_FreeAtomRT(rt, b->vardefs[i].var_name); in free_function_bytecode()
32145 JS_FreeValueRT(rt, b->cpool[i]); in free_function_bytecode()
32149 JS_FreeAtomRT(rt, cv->var_name); in free_function_bytecode()
32154 JS_FreeAtomRT(rt, b->func_name); in free_function_bytecode()
32156 JS_FreeAtomRT(rt, b->debug.filename); in free_function_bytecode()
32157 js_free_rt(rt, b->debug.pc2line_buf); in free_function_bytecode()
32158 js_free_rt(rt, b->debug.source); in free_function_bytecode()
32162 if (rt->gc_phase == JS_GC_PHASE_REMOVE_CYCLES && b->header.ref_count != 0) { in free_function_bytecode()
32163 list_add_tail(&b->header.link, &rt->gc_zero_ref_count_list); in free_function_bytecode()
32165 js_free_rt(rt, b); in free_function_bytecode()
32974 sf = ctx->rt->current_stack_frame; in __JS_EvalInternal()
33923 if (js_check_stack_overflow(s->ctx->rt, 0)) { in JS_WriteObjectRec()
34053 JSRuntime* rt = s->ctx->rt; in JS_WriteObjectAtoms() local
34068 JSAtomStruct* p = rt->atom_array[s->idx_to_atom[i]]; in JS_WriteObjectAtoms()
34353 js_free_string(s->ctx->rt, p); in JS_ReadString()
34362 JS_DumpString(s->ctx->rt, p); in JS_ReadString()
34661 add_gc_object(ctx->rt, &b->header, JS_GC_OBJ_TYPE_FUNCTION_BYTECODE); in JS_ReadFunctionTag()
35117 if (js_check_stack_overflow(ctx->rt, 0)) in JS_ReadObjectRec()
35181 if (!s->allow_sab || !ctx->rt->sab_funcs.sab_dup) in JS_ReadObjectRec()
35339 JSAtomStruct* p = ctx->rt->atom_array[atom]; in find_atom()
36281 atom = ctx->rt->class_array[p->class_id].class_name; in js_object_toString()
36546 atom = ctx->rt->class_array[class_id].class_name; in js_object___getClass()
38766 static void js_array_iterator_finalizer(JSRuntime* rt, JSValue val) in js_array_iterator_finalizer() argument
38771 JS_FreeValueRT(rt, it->obj); in js_array_iterator_finalizer()
38772 js_free_rt(rt, it); in js_array_iterator_finalizer()
38776 static void js_array_iterator_mark(JSRuntime* rt, JSValueConst val, in js_array_iterator_mark() argument
38782 JS_MarkValue(rt, it->obj, mark_func); in js_array_iterator_mark()
39452 … val = JS_ConcatString3(ctx, "Symbol(", JS_AtomToString(ctx, js_get_atom_index(ctx->rt, p)), ")"); in js_string_constructor()
40739 ctx->rt, (DynBufReallocFunc*)js_realloc_rt); in js_string_normalize()
41400 static void js_regexp_finalizer(JSRuntime* rt, JSValue val) in js_regexp_finalizer() argument
41404 JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_STRING, re->bytecode)); in js_regexp_finalizer()
41405 JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_STRING, re->pattern)); in js_regexp_finalizer()
41835 return js_check_stack_overflow(ctx->rt, alloca_size); in lre_check_stack_overflow()
41842 return js_realloc_rt(ctx->rt, ptr, size); in lre_realloc()
42202 static void js_regexp_string_iterator_finalizer(JSRuntime* rt, JSValue val) in js_regexp_string_iterator_finalizer() argument
42207 JS_FreeValueRT(rt, it->iterating_regexp); in js_regexp_string_iterator_finalizer()
42208 JS_FreeValueRT(rt, it->iterated_string); in js_regexp_string_iterator_finalizer()
42209 js_free_rt(rt, it); in js_regexp_string_iterator_finalizer()
42213 static void js_regexp_string_iterator_mark(JSRuntime* rt, JSValueConst val, in js_regexp_string_iterator_mark() argument
42219 JS_MarkValue(rt, it->iterating_regexp, mark_func); in js_regexp_string_iterator_mark()
42220 JS_MarkValue(rt, it->iterated_string, mark_func); in js_regexp_string_iterator_mark()
43021 if (js_check_stack_overflow(ctx->rt, 0)) { in internalize_json_property()
43714 static void js_proxy_finalizer(JSRuntime* rt, JSValue val) in js_proxy_finalizer() argument
43718 JS_FreeValueRT(rt, s->target); in js_proxy_finalizer()
43719 JS_FreeValueRT(rt, s->handler); in js_proxy_finalizer()
43720 js_free_rt(rt, s); in js_proxy_finalizer()
43724 static void js_proxy_mark(JSRuntime* rt, JSValueConst val, in js_proxy_mark() argument
43729 JS_MarkValue(rt, s->target, mark_func); in js_proxy_mark()
43730 JS_MarkValue(rt, s->handler, mark_func); in js_proxy_mark()
43746 if (js_check_stack_overflow(ctx->rt, 0)) { in get_proxy_method()
44648 JSRuntime* rt = ctx->rt; in JS_AddIntrinsicProxy() local
44651 if (!JS_IsRegisteredClass(rt, JS_CLASS_PROXY)) { in JS_AddIntrinsicProxy()
44652 init_class_range(rt, js_proxy_class_def, JS_CLASS_PROXY, in JS_AddIntrinsicProxy()
44654 rt->class_array[JS_CLASS_PROXY].exotic = &js_proxy_exotic_methods; in JS_AddIntrinsicProxy()
44655 rt->class_array[JS_CLASS_PROXY].call = js_proxy_call; in JS_AddIntrinsicProxy()
44734 ret = JS_AtomToString(ctx, js_get_atom_index(ctx->rt, p)); in js_symbol_get_description()
45049 static void delete_weak_ref(JSRuntime* rt, JSMapRecord* mr) in delete_weak_ref() argument
45066 static void map_delete_record(JSRuntime* rt, JSMapState* s, JSMapRecord* mr) in map_delete_record() argument
45072 delete_weak_ref(rt, mr); in map_delete_record()
45074 JS_FreeValueRT(rt, mr->key); in map_delete_record()
45076 JS_FreeValueRT(rt, mr->value); in map_delete_record()
45079 js_free_rt(rt, mr); in map_delete_record()
45089 static void map_decref_record(JSRuntime* rt, JSMapRecord* mr) in map_decref_record() argument
45095 js_free_rt(rt, mr); in map_decref_record()
45099 static void reset_weak_ref(JSRuntime* rt, JSObject* p) in reset_weak_ref() argument
45118 JS_FreeValueRT(rt, mr->value); in reset_weak_ref()
45119 js_free_rt(rt, mr); in reset_weak_ref()
45197 map_delete_record(ctx->rt, s, mr); in js_map_delete()
45213 map_delete_record(ctx->rt, s, mr); in js_map_clear()
45263 map_decref_record(ctx->rt, mr); in js_map_forEach()
45274 static void js_map_finalizer(JSRuntime* rt, JSValue val) in js_map_finalizer() argument
45291 delete_weak_ref(rt, mr); in js_map_finalizer()
45293 JS_FreeValueRT(rt, mr->key); in js_map_finalizer()
45294 JS_FreeValueRT(rt, mr->value); in js_map_finalizer()
45296 js_free_rt(rt, mr); in js_map_finalizer()
45298 js_free_rt(rt, s->hash_table); in js_map_finalizer()
45299 js_free_rt(rt, s); in js_map_finalizer()
45303 static void js_map_mark(JSRuntime* rt, JSValueConst val, JS_MarkFunc* mark_func) in js_map_mark() argument
45316 JS_MarkValue(rt, mr->key, mark_func); in js_map_mark()
45317 JS_MarkValue(rt, mr->value, mark_func); in js_map_mark()
45330 static void js_map_iterator_finalizer(JSRuntime* rt, JSValue val) in js_map_iterator_finalizer() argument
45340 if (JS_IsLiveObject(rt, it->obj) && it->cur_record) { in js_map_iterator_finalizer()
45341 map_decref_record(rt, it->cur_record); in js_map_iterator_finalizer()
45343 JS_FreeValueRT(rt, it->obj); in js_map_iterator_finalizer()
45344 js_free_rt(rt, it); in js_map_iterator_finalizer()
45348 static void js_map_iterator_mark(JSRuntime* rt, JSValueConst val, in js_map_iterator_mark() argument
45356 JS_MarkValue(rt, it->obj, mark_func); in js_map_iterator_mark()
45413 map_decref_record(ctx->rt, mr); /* the record can be freed here */ in js_map_iterator_next()
45609 static void promise_reaction_data_free(JSRuntime* rt, in promise_reaction_data_free() argument
45612 JS_FreeValueRT(rt, rd->resolving_funcs[0]); in promise_reaction_data_free()
45613 JS_FreeValueRT(rt, rd->resolving_funcs[1]); in promise_reaction_data_free()
45614 JS_FreeValueRT(rt, rd->handler); in promise_reaction_data_free()
45615 js_free_rt(rt, rd); in promise_reaction_data_free()
45660 void JS_SetHostPromiseRejectionTracker(JSRuntime* rt, in JS_SetHostPromiseRejectionTracker() argument
45664 rt->host_promise_rejection_tracker = cb; in JS_SetHostPromiseRejectionTracker()
45665 rt->host_promise_rejection_tracker_opaque = opaque; in JS_SetHostPromiseRejectionTracker()
45684 JSRuntime* rt = ctx->rt; in fulfill_or_reject_promise() local
45685 if (rt->host_promise_rejection_tracker) { in fulfill_or_reject_promise()
45686 rt->host_promise_rejection_tracker(ctx, promise, value, FALSE, in fulfill_or_reject_promise()
45687 rt->host_promise_rejection_tracker_opaque); in fulfill_or_reject_promise()
45701 promise_reaction_data_free(ctx->rt, rd); in fulfill_or_reject_promise()
45708 promise_reaction_data_free(ctx->rt, rd); in fulfill_or_reject_promise()
45744 static void js_promise_resolve_function_free_resolved(JSRuntime* rt, in js_promise_resolve_function_free_resolved() argument
45748 js_free_rt(rt, sr); in js_promise_resolve_function_free_resolved()
45790 js_promise_resolve_function_free_resolved(ctx->rt, sr); in js_create_resolving_functions()
45794 static void js_promise_resolve_function_finalizer(JSRuntime* rt, JSValue val) in js_promise_resolve_function_finalizer() argument
45798 js_promise_resolve_function_free_resolved(rt, s->presolved); in js_promise_resolve_function_finalizer()
45799 JS_FreeValueRT(rt, s->promise); in js_promise_resolve_function_finalizer()
45800 js_free_rt(rt, s); in js_promise_resolve_function_finalizer()
45804 static void js_promise_resolve_function_mark(JSRuntime* rt, JSValueConst val, in js_promise_resolve_function_mark() argument
45809 JS_MarkValue(rt, s->promise, mark_func); in js_promise_resolve_function_mark()
45866 static void js_promise_finalizer(JSRuntime* rt, JSValue val) in js_promise_finalizer() argument
45879 promise_reaction_data_free(rt, rd); in js_promise_finalizer()
45882 JS_FreeValueRT(rt, s->promise_result); in js_promise_finalizer()
45883 js_free_rt(rt, s); in js_promise_finalizer()
45886 static void js_promise_mark(JSRuntime* rt, JSValueConst val, in js_promise_mark() argument
45900 JS_MarkValue(rt, rd->resolving_funcs[0], mark_func); in js_promise_mark()
45901 JS_MarkValue(rt, rd->resolving_funcs[1], mark_func); in js_promise_mark()
45902 JS_MarkValue(rt, rd->handler, mark_func); in js_promise_mark()
45905 JS_MarkValue(rt, s->promise_result, mark_func); in js_promise_mark()
46406 promise_reaction_data_free(ctx->rt, rd_array[0]); in perform_promise_then()
46424 JSRuntime* rt = ctx->rt; in perform_promise_then() local
46425 if (rt->host_promise_rejection_tracker) { in perform_promise_then()
46426 rt->host_promise_rejection_tracker(ctx, promise, s->promise_result, in perform_promise_then()
46427 TRUE, rt->host_promise_rejection_tracker_opaque); in perform_promise_then()
46439 promise_reaction_data_free(ctx->rt, rd_array[i]); in perform_promise_then()
46629 static void js_async_from_sync_iterator_finalizer(JSRuntime* rt, JSValue val) in js_async_from_sync_iterator_finalizer() argument
46634 JS_FreeValueRT(rt, s->sync_iter); in js_async_from_sync_iterator_finalizer()
46635 JS_FreeValueRT(rt, s->next_method); in js_async_from_sync_iterator_finalizer()
46636 js_free_rt(rt, s); in js_async_from_sync_iterator_finalizer()
46640 static void js_async_from_sync_iterator_mark(JSRuntime* rt, JSValueConst val, in js_async_from_sync_iterator_mark() argument
46646 JS_MarkValue(rt, s->sync_iter, mark_func); in js_async_from_sync_iterator_mark()
46647 JS_MarkValue(rt, s->next_method, mark_func); in js_async_from_sync_iterator_mark()
46816 JSRuntime* rt = ctx->rt; in JS_AddIntrinsicPromise() local
46819 if (!JS_IsRegisteredClass(rt, JS_CLASS_PROMISE)) { in JS_AddIntrinsicPromise()
46820 init_class_range(rt, js_async_class_def, JS_CLASS_PROMISE, in JS_AddIntrinsicPromise()
46822 rt->class_array[JS_CLASS_PROMISE_RESOLVE_FUNCTION].call = js_promise_resolve_function_call; in JS_AddIntrinsicPromise()
46823 rt->class_array[JS_CLASS_PROMISE_REJECT_FUNCTION].call = js_promise_resolve_function_call; in JS_AddIntrinsicPromise()
46824 rt->class_array[JS_CLASS_ASYNC_FUNCTION].call = js_async_function_call; in JS_AddIntrinsicPromise()
46825 rt->class_array[JS_CLASS_ASYNC_FUNCTION_RESOLVE].call = js_async_function_resolve_call; in JS_AddIntrinsicPromise()
46826 rt->class_array[JS_CLASS_ASYNC_FUNCTION_REJECT].call = js_async_function_resolve_call; in JS_AddIntrinsicPromise()
46827 rt->class_array[JS_CLASS_ASYNC_GENERATOR_FUNCTION].call = js_async_generator_function_call; in JS_AddIntrinsicPromise()
48092 static void js_operator_set_finalizer(JSRuntime* rt, JSValue val) in js_operator_set_finalizer() argument
48101 JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_OBJECT, opset->self_ops[i])); in js_operator_set_finalizer()
48107 JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_OBJECT, ent->ops[i])); in js_operator_set_finalizer()
48110 js_free_rt(rt, opset->left.tab); in js_operator_set_finalizer()
48115 JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_OBJECT, ent->ops[i])); in js_operator_set_finalizer()
48118 js_free_rt(rt, opset->right.tab); in js_operator_set_finalizer()
48119 js_free_rt(rt, opset); in js_operator_set_finalizer()
48123 static void js_operator_set_mark(JSRuntime* rt, JSValueConst val, in js_operator_set_mark() argument
48133 JS_MarkValue(rt, JS_MKPTR(JS_TAG_OBJECT, opset->self_ops[i]), in js_operator_set_mark()
48140 JS_MarkValue(rt, JS_MKPTR(JS_TAG_OBJECT, ent->ops[i]), in js_operator_set_mark()
48148 JS_MarkValue(rt, JS_MKPTR(JS_TAG_OBJECT, ent->ops[i]), in js_operator_set_mark()
48169 if (ctx->rt->operator_count == UINT32_MAX) { in js_operators_create_internal()
48255 opset->operator_counter = ctx->rt->operator_count++; in js_operators_create_internal()
48705 JSRuntime* rt = ctx->rt; in JS_AddIntrinsicBigInt() local
48708 rt->bigint_ops.to_string = js_bigint_to_string; in JS_AddIntrinsicBigInt()
48709 rt->bigint_ops.from_string = js_string_to_bigint; in JS_AddIntrinsicBigInt()
48710 rt->bigint_ops.unary_arith = js_unary_arith_bigint; in JS_AddIntrinsicBigInt()
48711 rt->bigint_ops.binary_arith = js_binary_arith_bigint; in JS_AddIntrinsicBigInt()
48712 rt->bigint_ops.compare = js_compare_bigfloat; in JS_AddIntrinsicBigInt()
49415 static void js_float_env_finalizer(JSRuntime* rt, JSValue val) in js_float_env_finalizer() argument
49418 js_free_rt(rt, fe); in js_float_env_finalizer()
49590 JSRuntime* rt = ctx->rt; in JS_AddIntrinsicBigFloat() local
49594 rt->bigfloat_ops.to_string = js_bigfloat_to_string; in JS_AddIntrinsicBigFloat()
49595 rt->bigfloat_ops.from_string = js_string_to_bigfloat; in JS_AddIntrinsicBigFloat()
49596 rt->bigfloat_ops.unary_arith = js_unary_arith_bigfloat; in JS_AddIntrinsicBigFloat()
49597 rt->bigfloat_ops.binary_arith = js_binary_arith_bigfloat; in JS_AddIntrinsicBigFloat()
49598 rt->bigfloat_ops.compare = js_compare_bigfloat; in JS_AddIntrinsicBigFloat()
49599 rt->bigfloat_ops.mul_pow10_to_float64 = js_mul_pow10_to_float64; in JS_AddIntrinsicBigFloat()
49600 rt->bigfloat_ops.mul_pow10 = js_mul_pow10; in JS_AddIntrinsicBigFloat()
50073 JSRuntime* rt = ctx->rt; in JS_AddIntrinsicBigDecimal() local
50076 rt->bigdecimal_ops.to_string = js_bigdecimal_to_string; in JS_AddIntrinsicBigDecimal()
50077 rt->bigdecimal_ops.from_string = js_string_to_bigdecimal; in JS_AddIntrinsicBigDecimal()
50078 rt->bigdecimal_ops.unary_arith = js_unary_arith_bigdecimal; in JS_AddIntrinsicBigDecimal()
50079 rt->bigdecimal_ops.binary_arith = js_binary_arith_bigdecimal; in JS_AddIntrinsicBigDecimal()
50080 rt->bigdecimal_ops.compare = js_compare_bigdecimal; in JS_AddIntrinsicBigDecimal()
50399 JSRuntime* rt = ctx->rt; in js_array_buffer_constructor3() local
50417 rt->sab_funcs.sab_alloc) { in js_array_buffer_constructor3()
50418 abuf->data = rt->sab_funcs.sab_alloc(rt->sab_funcs.sab_opaque, in js_array_buffer_constructor3()
50431 rt->sab_funcs.sab_dup) { in js_array_buffer_constructor3()
50432 rt->sab_funcs.sab_dup(rt->sab_funcs.sab_opaque, buf); in js_array_buffer_constructor3()
50451 static void js_array_buffer_free(JSRuntime* rt, void* opaque, void* ptr) in js_array_buffer_free() argument
50453 js_free_rt(rt, ptr); in js_array_buffer_free()
50514 static void js_array_buffer_finalizer(JSRuntime* rt, JSValue val) in js_array_buffer_finalizer() argument
50523 if (abuf->shared && rt->sab_funcs.sab_free) { in js_array_buffer_finalizer()
50524 rt->sab_funcs.sab_free(rt->sab_funcs.sab_opaque, abuf->data); in js_array_buffer_finalizer()
50527 abuf->free_func(rt, abuf->opaque, abuf->data); in js_array_buffer_finalizer()
50529 js_free_rt(rt, abuf); in js_array_buffer_finalizer()
50580 abuf->free_func(ctx->rt, abuf->opaque, abuf->data); in JS_DetachArrayBuffer()
50870 return JS_AtomToString(ctx, ctx->rt->class_array[p->class_id].class_name); in js_typed_array_get_toStringTag()
52448 static void js_typed_array_finalizer(JSRuntime* rt, JSValue val) in js_typed_array_finalizer() argument
52455 if (JS_IsLiveObject(rt, JS_MKPTR(JS_TAG_OBJECT, ta->buffer))) { in js_typed_array_finalizer()
52458 JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_OBJECT, ta->buffer)); in js_typed_array_finalizer()
52459 js_free_rt(rt, ta); in js_typed_array_finalizer()
52463 static void js_typed_array_mark(JSRuntime* rt, JSValueConst val, in js_typed_array_mark() argument
52469 JS_MarkValue(rt, JS_MKPTR(JS_TAG_OBJECT, ta->buffer), mark_func); in js_typed_array_mark()
53115 if (!ctx->rt->can_block) in js_atomics_wait()