op switch
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user