MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

timers root fix

+21 -4
+3 -1
include/modules/events.h
··· 4 4 #include "types.h" 5 5 6 6 void init_events_module(void); 7 + void events_gc_update_roots(void (*op_val)(void *, jsval_t *), void *ctx); 8 + 7 9 jsval_t events_library(struct js *js); 8 10 9 - #endif 11 + #endif
+10 -3
src/ant.c
··· 16 16 #include "stack.h" 17 17 #include "errors.h" 18 18 #include "utf8.h" 19 + #include "esm/remote.h" 19 20 20 21 #include <uv.h> 21 22 #include <oxc.h> ··· 55 56 #include "modules/collections.h" 56 57 #include "modules/navigator.h" 57 58 #include "modules/server.h" 58 - #include "esm/remote.h" 59 + #include "modules/events.h" 59 60 60 61 #define D(x) ((double)(x)) 61 62 ··· 22458 22459 process_gc_update_roots(op_val, c); 22459 22460 navigator_gc_update_roots(op_val, c); 22460 22461 server_gc_update_roots(op_val, c); 22462 + events_gc_update_roots(op_val, c); 22461 22463 22462 22464 for (int i = 0; i < c->js->for_let_stack_len; i++) { 22463 22465 op_val(c, &c->js->for_let_stack[i].body_scope); ··· 22508 22510 RSV_VAL(proxy->target); 22509 22511 RSV_VAL(proxy->handler); 22510 22512 } 22513 + 22514 + descriptor_entry_t *desc, *desc_tmp; 22515 + HASH_ITER(hh, desc_registry, desc, desc_tmp) { 22516 + if (desc->has_getter) RSV_VAL(desc->getter); 22517 + if (desc->has_setter) RSV_VAL(desc->setter); 22518 + } 22511 22519 22512 - // accessor/descriptor registry are weak references 22520 + // accessor registry is a weak reference 22513 22521 // objects only survive if reachable from other roots 22514 22522 (void)accessor_registry; 22515 - (void)desc_registry; 22516 22523 22517 22524 #undef RSV_OFF 22518 22525 #undef RSV_VAL
+7
src/modules/events.c
··· 591 591 js_set(js, global, "getEventListeners", js_mkfun(js_get_event_listeners)); 592 592 js_set(js, global, "EventTarget", js_obj_to_func(eventtarget_ctor)); 593 593 } 594 + 595 + void events_gc_update_roots(void (*op_val)(void *, jsval_t *), void *ctx) { 596 + EventType *evt, *tmp; 597 + HASH_ITER(hh, global_events, evt, tmp) { 598 + for (int i = 0; i < evt->listener_count; i++) op_val(ctx, &evt->listeners[i].listener); 599 + } 600 + }
+1
src/modules/timer.c
··· 342 342 void timer_gc_update_roots(GC_OP_VAL_ARGS) { 343 343 for (timer_entry_t *t = timer_state.timers; t; t = t->next) { 344 344 op_val(ctx, &t->callback); 345 + for (int i = 0; i < t->nargs; i++) op_val(ctx, &t->args[i]); 345 346 } 346 347 for (microtask_entry_t *m = timer_state.microtasks; m; m = m->next) { 347 348 if (m->promise_id == 0) op_val(ctx, &m->callback);