Fixing is_false_jmp, is_true_jmp opcodes; adding them to var_decl and assignment unit tests as partial checks.

This commit is contained in:
Ruben Ayrapetyan
2014-07-23 22:22:50 +04:00
parent d659b703a1
commit 2718d8e918
3 changed files with 24 additions and 14 deletions
+10 -6
View File
@@ -410,8 +410,6 @@ opfunc_is_true_jmp (OPCODE opdata, /**< operation data */
const T_IDX cond_var_idx = opdata.data.is_true_jmp.value;
const T_IDX dst_opcode_idx = opdata.data.is_true_jmp.opcode;
int_data->pos = dst_opcode_idx;
ecma_completion_value_t ret_value;
TRY_CATCH(cond_value, get_variable_value( int_data, cond_var_idx, false), ret_value);
@@ -421,7 +419,11 @@ opfunc_is_true_jmp (OPCODE opdata, /**< operation data */
if ( ecma_is_value_true( to_bool_completion.value) )
{
int_data->pos = opdata.data.jmp.opcode_idx;
int_data->pos = dst_opcode_idx;
}
else
{
int_data->pos++;
}
ret_value = ecma_make_empty_completion_value();
@@ -445,8 +447,6 @@ opfunc_is_false_jmp (OPCODE opdata, /**< operation data */
const T_IDX cond_var_idx = opdata.data.is_false_jmp.value;
const T_IDX dst_opcode_idx = opdata.data.is_false_jmp.opcode;
int_data->pos = dst_opcode_idx;
ecma_completion_value_t ret_value;
TRY_CATCH(cond_value, get_variable_value( int_data, cond_var_idx, false), ret_value);
@@ -456,7 +456,11 @@ opfunc_is_false_jmp (OPCODE opdata, /**< operation data */
if ( !ecma_is_value_true( to_bool_completion.value) )
{
int_data->pos = opdata.data.jmp.opcode_idx;
int_data->pos = dst_opcode_idx;
}
else
{
int_data->pos++;
}
ret_value = ecma_make_empty_completion_value();
+11 -7
View File
@@ -26,13 +26,17 @@ main( int __unused argc,
char __unused **argv)
{
const OPCODE test_program[] = {
getop_var_decl( 0),
getop_var_decl( 1),
getop_assignment( 0, OPCODE_ARG_TYPE_STRING, 1),
getop_assignment( 1, OPCODE_ARG_TYPE_VARIABLE, 0),
getop_assignment( 0, OPCODE_ARG_TYPE_SMALLINT, 253),
getop_assignment( 1, OPCODE_ARG_TYPE_NUMBER, 2),
getop_exitval( 0)
/* 0: */ getop_var_decl( 0),
/* 1: */ getop_var_decl( 1),
/* 2: */ getop_assignment( 0, OPCODE_ARG_TYPE_STRING, 1),
/* 3: */ getop_assignment( 1, OPCODE_ARG_TYPE_VARIABLE, 0),
/* 4: */ getop_is_true_jmp( 1, 6),
/* 5: */ getop_jmp_down( 5),
/* 6: */ getop_assignment( 0, OPCODE_ARG_TYPE_SMALLINT, 253),
/* 7: */ getop_assignment( 1, OPCODE_ARG_TYPE_NUMBER, 2),
/* 8: */ getop_is_false_jmp( 1, 10),
/* 9: */ getop_exitval( 0),
/* 10: */ getop_exitval( 1)
};
mem_init();
@@ -27,7 +27,9 @@ main( int __unused argc,
{
const OPCODE test_program[] = {
getop_var_decl( 0),
getop_exitval( 0)
getop_is_true_jmp( 0, 3),
getop_exitval( 0),
getop_exitval( 1)
};
mem_init();