Add opcode description table containing an opcode's name, name and possible type of the opcode's arguments.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
Ruben Ayrapetyan
2015-07-20 21:53:40 +03:00
committed by Evgeny Gavrin
parent 25450d8a12
commit 1990762cf0
12 changed files with 704 additions and 507 deletions
+1 -28
View File
@@ -20,43 +20,16 @@
#include "test-common.h"
#define NAME_TO_ID(op) (__op__idx_##op)
#define __OPCODE_SIZE(name, arg1, arg2, arg3) \
(uint8_t) (sizeof (__op_##name) + 1),
static uint8_t opcode_sizes[] =
{
OP_LIST (OPCODE_SIZE)
0
};
static bool
opcodes_equal (const opcode_t *opcodes1, opcode_t *opcodes2, uint16_t size)
{
uint16_t i;
for (i = 0; i < size; i++)
{
uint8_t opcode_num1 = opcodes1[i].op_idx, opcode_num2 = opcodes2[i].op_idx;
uint8_t j;
if (opcode_num1 != opcode_num2)
if (memcmp (&opcodes1[i], &opcodes2[i], sizeof (opcode_t)) != 0)
{
return false;
}
if (opcode_num1 == NAME_TO_ID (nop) || opcode_num1 == NAME_TO_ID (ret))
{
return true;
}
for (j = 1; j < opcode_sizes[opcode_num1]; j++)
{
if (((uint8_t*)&opcodes1[i])[j] != ((uint8_t*)&opcodes2[i])[j])
{
return false;
}
}
}
return true;