diff --git a/source/quickjs-opcode.h b/source/quickjs-opcode.h index 13479376..1bb4ff71 100644 --- a/source/quickjs-opcode.h +++ b/source/quickjs-opcode.h @@ -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) diff --git a/source/quickjs.c b/source/quickjs.c index a7c433de..4b4bd0e5 100644 --- a/source/quickjs.c +++ b/source/quickjs.c @@ -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,