1 Commits

Author SHA1 Message Date
John Alanbrook
058ad89c96 op switch 2025-12-29 20:46:12 -06:00
2 changed files with 11 additions and 0 deletions

View File

@@ -207,10 +207,14 @@ DEF( delete, 1, 2, 1, none)
DEF( delete_var, 5, 0, 1, atom)
DEF( mul, 1, 2, 1, none)
DEF( mul_float, 1, 2, 1, none)
DEF( div, 1, 2, 1, none)
DEF( div_float, 1, 2, 1, none)
DEF( mod, 1, 2, 1, none)
DEF( add, 1, 2, 1, none)
DEF( add_float, 1, 2, 1, none)
DEF( sub, 1, 2, 1, none)
DEF( sub_float, 1, 2, 1, none)
DEF( pow, 1, 2, 1, none)
DEF( shl, 1, 2, 1, none)
DEF( sar, 1, 2, 1, none)

View File

@@ -13049,6 +13049,13 @@ static JSValue JS_CallInternal_OLD(JSContext *caller_ctx, JSValueConst func_obj,
#define CASE(op) case op
#define DEFAULT default
#define BREAK break
#define SWITCH_OPCODE(new_op, target_label) do { \
const uint8_t *instr_ptr = pc-1; \
uint8_t *bc = (uint8_t *)b->byte_code_buf; \
size_t instr_idx = instr_ptr - b->byte_code_buf; \
bc[instr_idx] = new_op; \
goto target_label; \
} while(0)
#else
static const void * const dispatch_table[256] = {
#define DEF(id, size, n_pop, n_push, f) && case_OP_ ## id,