diff --git a/src/libcoreint/opcodes.c b/src/libcoreint/opcodes.c index 116a1f55b..9ba6c8842 100644 --- a/src/libcoreint/opcodes.c +++ b/src/libcoreint/opcodes.c @@ -119,7 +119,7 @@ free_string_literal_copy (string_literal_copy *str_lit_descr_p) /**< string lite #define OP_UNIMPLEMENTED_LIST(op) \ op (native_call) \ op (func_expr_n) \ - op (varg_list) \ + op (varg) \ op (array_decl) \ op (prop) \ op (prop_get_decl) \ @@ -749,21 +749,10 @@ opfunc_func_decl_n (opcode_t opdata, /**< operation data */ ecma_length_t arg_index = 0; opcode_t next_opcode = read_opcode (int_data->pos); - while (next_opcode.op_idx == __op__idx_varg_list) + while (next_opcode.op_idx == __op__idx_varg) { - const idx_t arg1_lit_idx = next_opcode.data.varg_list.arg1_lit_idx; - const idx_t arg2_lit_idx = next_opcode.data.varg_list.arg2_lit_idx; - const idx_t arg3_lit_idx = next_opcode.data.varg_list.arg3_lit_idx; - - arg_names[arg_index++] = ecma_new_ecma_string_from_lit_index (arg1_lit_idx); - if (arg_index < args_number) - { - arg_names[arg_index++] = ecma_new_ecma_string_from_lit_index (arg2_lit_idx); - } - if (arg_index < args_number) - { - arg_names[arg_index++] = ecma_new_ecma_string_from_lit_index (arg3_lit_idx); - } + const idx_t arg_lit_idx = next_opcode.data.varg.arg_lit_idx; + arg_names[arg_index++] = ecma_new_ecma_string_from_lit_index (arg_lit_idx); JERRY_ASSERT (arg_index <= args_number); @@ -860,32 +849,20 @@ opfunc_call_n (opcode_t opdata, /**< operation data */ ecma_length_t arg_index = 0; opcode_t next_opcode = read_opcode (int_data->pos); - while (next_opcode.op_idx == __op__idx_varg_list + while (next_opcode.op_idx == __op__idx_varg && ecma_is_completion_value_normal (get_arg_completion)) { - const idx_t arg_lits[3] = + const idx_t arg = next_opcode.data.varg.arg_lit_idx; + + get_arg_completion = get_variable_value (int_data, arg, false); + if (unlikely (ecma_is_completion_value_throw (get_arg_completion))) { - next_opcode.data.varg_list.arg1_lit_idx, - next_opcode.data.varg_list.arg2_lit_idx, - next_opcode.data.varg_list.arg3_lit_idx - }; - - ecma_length_t local_arg_index = 0; - - while (local_arg_index < 3 - && arg_index < args_number) + break; + } + else { - get_arg_completion = get_variable_value (int_data, arg_lits[local_arg_index++], false); - - if (unlikely (ecma_is_completion_value_throw (get_arg_completion))) - { - break; - } - else - { - JERRY_ASSERT (ecma_is_completion_value_normal (get_arg_completion)); - arg_values[arg_index++] = get_arg_completion.value; - } + JERRY_ASSERT (ecma_is_completion_value_normal (get_arg_completion)); + arg_values[arg_index++] = get_arg_completion.value; } JERRY_ASSERT (arg_index <= args_number); @@ -976,32 +953,21 @@ opfunc_construct_n (opcode_t opdata, /**< operation data */ ecma_length_t arg_index = 0; opcode_t next_opcode = read_opcode (int_data->pos); - while (next_opcode.op_idx == __op__idx_varg_list + while (next_opcode.op_idx == __op__idx_varg && ecma_is_completion_value_normal (get_arg_completion)) { - const idx_t arg_lits[3] = + const idx_t arg = next_opcode.data.varg.arg_lit_idx; + + get_arg_completion = get_variable_value (int_data, arg, false); + + if (unlikely (ecma_is_completion_value_throw (get_arg_completion))) { - next_opcode.data.varg_list.arg1_lit_idx, - next_opcode.data.varg_list.arg2_lit_idx, - next_opcode.data.varg_list.arg3_lit_idx - }; - - ecma_length_t local_arg_index = 0; - - while (local_arg_index < 3 - && arg_index < args_number) + break; + } + else { - get_arg_completion = get_variable_value (int_data, arg_lits[local_arg_index++], false); - - if (unlikely (ecma_is_completion_value_throw (get_arg_completion))) - { - break; - } - else - { - JERRY_ASSERT (ecma_is_completion_value_normal (get_arg_completion)); - arg_values[arg_index++] = get_arg_completion.value; - } + JERRY_ASSERT (ecma_is_completion_value_normal (get_arg_completion)); + arg_values[arg_index++] = get_arg_completion.value; } JERRY_ASSERT (arg_index <= args_number); diff --git a/src/libcoreint/opcodes.h b/src/libcoreint/opcodes.h index 00808310d..08077808b 100644 --- a/src/libcoreint/opcodes.h +++ b/src/libcoreint/opcodes.h @@ -78,7 +78,7 @@ typedef struct p##_3 (a, func_decl_2, name_lit_idx, arg1_lit_idx, arg2_lit_idx) \ p##_2 (a, func_decl_n, name_lit_idx, arg_list) \ p##_3 (a, func_expr_n, lhs, name_lit_idx, arg_list) \ - p##_3 (a, varg_list, arg1_lit_idx, arg2_lit_idx, arg3_lit_idx) \ + p##_1 (a, varg, arg_lit_idx) \ p##_1 (a, exitval, status_code) \ p##_1 (a, retval, ret_value) \ p##_0 (a, ret) diff --git a/src/liboptimizer/pretty-printer.c b/src/liboptimizer/pretty-printer.c index a3c1d6a43..6fbf3da1c 100644 --- a/src/liboptimizer/pretty-printer.c +++ b/src/liboptimizer/pretty-printer.c @@ -294,15 +294,9 @@ dump_variable (idx_t id) __printf ("%s;", varg_end); \ break; -#define CASE_VARG_3(op, arg1, arg2, arg3) \ +#define CASE_VARG_1(op, arg) \ case NAME_TO_ID (op): \ - __printf ("... "); \ - dump_variable (opcode.data.op.arg1); \ - __printf (", "); \ - dump_variable (opcode.data.op.arg2); \ - __printf (", "); \ - dump_variable (opcode.data.op.arg3); \ - __printf (" ..."); \ + dump_variable (opcode.data.op.arg); \ break; #define CASE_EXIT(op, name, field) \ @@ -418,7 +412,7 @@ pp_opcode (opcode_counter_t oc, opcode_t opcode, bool is_rewrite) CASE_VARG_1_NAME (func_decl_1, "function", name_lit_idx, "(", arg1_lit_idx, ")") CASE_VARG_2_NAME (func_decl_2, "function", name_lit_idx, "(", arg1_lit_idx, arg2_lit_idx, ")") CASE_VARG_N_NAME (func_decl_n, "function", name_lit_idx, arg_list) - CASE_VARG_3 (varg_list, arg1_lit_idx, arg2_lit_idx, arg3_lit_idx); + CASE_VARG_1 (varg, arg_lit_idx); CASE_EXIT (exitval, "exit", status_code) CASE_SINGLE_ADDRESS (retval, "return", ret_value) CASE_ZERO_ADDRESS (ret, "return")