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.

consolidate GC forward callback dispatch logic to use goto table

+10 -2
+10 -2
src/gc.c
··· 427 427 jsoff_t new_off = fwd_lookup(&ctx->fwd, old_off); 428 428 if (new_off != (jsoff_t)~0) return new_off; 429 429 430 - new_off = gc_reserve_object(ctx, old_off); 431 - return (new_off != (jsoff_t)~0) ? new_off : old_off; 430 + static const void *dispatch[] = { &&l_obj, &&l_prop, &&l_str, &&l_default }; 431 + jsoff_t header = gc_loadoff(ctx->js->mem, old_off); 432 + goto *dispatch[header & 3]; 433 + 434 + l_obj: new_off = gc_reserve_object(ctx, old_off); goto l_done; 435 + l_prop: new_off = gc_reserve_prop(ctx, old_off); goto l_done; 436 + l_str: new_off = gc_copy_string(ctx, old_off); goto l_done; 437 + l_default: return old_off; 438 + 439 + l_done: return (new_off != (jsoff_t)~0) ? new_off : old_off; 432 440 } 433 441 434 442 static jsval_t gc_fwd_val_callback(void *ctx_ptr, jsval_t val) {