mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Remove raw_instr.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
parent
173becc3ac
commit
cbdc48a1fc
@ -311,9 +311,8 @@ dumper_try_replace_var_with_reg (scopes_tree tree, /**< a function scope, create
|
|||||||
{
|
{
|
||||||
om.lit_id[arg_index] = NOT_A_LITERAL;
|
om.lit_id[arg_index] = NOT_A_LITERAL;
|
||||||
|
|
||||||
raw_instr *raw_p = (raw_instr *) (&om.op);
|
JERRY_ASSERT (om.op.data.raw_args[arg_index] == VM_IDX_REWRITE_LITERAL_UID);
|
||||||
JERRY_ASSERT (raw_p->uids[arg_index + 1] == VM_IDX_REWRITE_LITERAL_UID);
|
om.op.data.raw_args[arg_index] = reg;
|
||||||
raw_p->uids[arg_index + 1] = reg;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,19 +30,17 @@ assert_tree (scopes_tree t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static vm_idx_t
|
static vm_idx_t
|
||||||
get_uid (op_meta *op, uint8_t i)
|
get_uid (op_meta *op, size_t i)
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (i < 4);
|
JERRY_ASSERT (i < 3);
|
||||||
raw_instr *raw = (raw_instr *) &op->op;
|
return op->op.data.raw_args[i];
|
||||||
return raw->uids[i + 1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_uid (op_meta *op, uint8_t i, vm_idx_t uid)
|
set_uid (op_meta *op, size_t i, vm_idx_t uid)
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (i < 4);
|
JERRY_ASSERT (i < 3);
|
||||||
raw_instr *raw = (raw_instr *) &op->op;
|
op->op.data.raw_args[i] = uid;
|
||||||
raw->uids[i + 1] = uid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vm_instr_counter_t
|
vm_instr_counter_t
|
||||||
|
|||||||
@ -257,6 +257,14 @@ typedef struct vm_instr_t
|
|||||||
} opcode_name;
|
} opcode_name;
|
||||||
|
|
||||||
#include "vm-opcodes.inc.h"
|
#include "vm-opcodes.inc.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opcode-independent arguments accessor
|
||||||
|
*
|
||||||
|
* Note:
|
||||||
|
* If opcode is statically known, opcode-specific way of accessing arguments should be used.
|
||||||
|
*/
|
||||||
|
vm_idx_t raw_args[3];
|
||||||
} data;
|
} data;
|
||||||
} vm_instr_t;
|
} vm_instr_t;
|
||||||
|
|
||||||
@ -300,10 +308,4 @@ typedef ecma_completion_value_t (*opfunc) (vm_instr_t, vm_frame_ctx_t *);
|
|||||||
|
|
||||||
#include "vm-opcodes.inc.h"
|
#include "vm-opcodes.inc.h"
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint8_t uids[4];
|
|
||||||
} raw_instr;
|
|
||||||
|
|
||||||
#endif /* OPCODES_H */
|
#endif /* OPCODES_H */
|
||||||
|
|||||||
@ -95,23 +95,22 @@ tmp_id_to_str (vm_idx_t id)
|
|||||||
static const char *
|
static const char *
|
||||||
var_to_str (vm_instr_t instr, lit_cpointer_t lit_ids[], vm_instr_counter_t oc, uint8_t current_arg)
|
var_to_str (vm_instr_t instr, lit_cpointer_t lit_ids[], vm_instr_counter_t oc, uint8_t current_arg)
|
||||||
{
|
{
|
||||||
raw_instr raw = *(raw_instr*) &instr;
|
JERRY_ASSERT (current_arg >= 1 && current_arg <= 3);
|
||||||
if (raw.uids[current_arg] == VM_IDX_REWRITE_LITERAL_UID)
|
|
||||||
|
if (instr.data.raw_args[current_arg - 1] == VM_IDX_REWRITE_LITERAL_UID)
|
||||||
{
|
{
|
||||||
if (lit_ids == NULL)
|
JERRY_ASSERT (lit_ids != NULL);
|
||||||
{
|
|
||||||
return "hz";
|
|
||||||
}
|
|
||||||
JERRY_ASSERT (lit_ids[current_arg - 1].packed_value != MEM_CP_NULL);
|
JERRY_ASSERT (lit_ids[current_arg - 1].packed_value != MEM_CP_NULL);
|
||||||
|
|
||||||
return lit_cp_to_str (lit_ids[current_arg - 1]);
|
return lit_cp_to_str (lit_ids[current_arg - 1]);
|
||||||
}
|
}
|
||||||
else if (raw.uids[current_arg] >= 128)
|
else if (instr.data.raw_args[current_arg - 1] >= 128)
|
||||||
{
|
{
|
||||||
return tmp_id_to_str (raw.uids[current_arg]);
|
return tmp_id_to_str (instr.data.raw_args[current_arg - 1]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return lit_cp_to_str (serializer_get_literal_cp_by_uid (raw.uids[current_arg], NULL, oc));
|
return lit_cp_to_str (serializer_get_literal_cp_by_uid (instr.data.raw_args[current_arg - 1], NULL, oc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,14 +133,12 @@ pp_printf (const char *format, vm_instr_t instr, lit_cpointer_t lit_ids[], vm_in
|
|||||||
{
|
{
|
||||||
case 'd':
|
case 'd':
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (current_arg <= 3);
|
JERRY_ASSERT (current_arg >= 1 && current_arg <= 3);
|
||||||
raw_instr raw = *(raw_instr*) &instr;
|
printf ("%d", instr.data.raw_args[current_arg - 1]);
|
||||||
printf ("%d", raw.uids[current_arg]);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 's':
|
case 's':
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (current_arg <= 3);
|
|
||||||
printf ("%s", var_to_str (instr, lit_ids, oc, current_arg));
|
printf ("%s", var_to_str (instr, lit_ids, oc, current_arg));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -159,8 +156,8 @@ pp_printf (const char *format, vm_instr_t instr, lit_cpointer_t lit_ids[], vm_in
|
|||||||
#define PP_OP(op_name, format) \
|
#define PP_OP(op_name, format) \
|
||||||
case op_name: pp_printf (format, opm.op, opm.lit_id, oc, 1); break;
|
case op_name: pp_printf (format, opm.op, opm.lit_id, oc, 1); break;
|
||||||
#define VAR(i) var_to_str (opm.op, opm.lit_id, oc, i)
|
#define VAR(i) var_to_str (opm.op, opm.lit_id, oc, i)
|
||||||
#define OC(i, j) __extension__({ raw_instr* raw = (raw_instr *) &opm.op; \
|
#define OC(i, j) __extension__({ vm_calc_instr_counter_from_idx_idx (opm.op.data.raw_args[i - 1], \
|
||||||
vm_calc_instr_counter_from_idx_idx (raw->uids[i], raw->uids[j]); })
|
opm.op.data.raw_args[j - 1]); })
|
||||||
|
|
||||||
static int vargs_num = 0;
|
static int vargs_num = 0;
|
||||||
static int seen_vargs = 0;
|
static int seen_vargs = 0;
|
||||||
@ -174,7 +171,7 @@ dump_asm (vm_instr_counter_t oc, vm_instr_t instr)
|
|||||||
|
|
||||||
for (i = 1; i <= opcode_sizes[opcode_id]; i++)
|
for (i = 1; i <= opcode_sizes[opcode_id]; i++)
|
||||||
{
|
{
|
||||||
printf ("%4d ", ((raw_instr *) &instr)->uids[i]);
|
printf ("%4d ", instr.data.raw_args[i - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; i < 4; i++)
|
for (; i < 4; i++)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user