Remove 'logical_or' and 'logical_and' opcodes
This commit is contained in:
@@ -1162,94 +1162,6 @@ opfunc_logical_not (opcode_t opdata, /**< operation data */
|
||||
return ret_value;
|
||||
} /* opfunc_logical_not */
|
||||
|
||||
/**
|
||||
* 'Logical OR Operator' opcode handler.
|
||||
*
|
||||
* See also: ECMA-262 v5, 11.11
|
||||
*
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_logical_or (opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.logical_or.dst;
|
||||
const idx_t left_var_idx = opdata.data.logical_or.var_left;
|
||||
const idx_t right_var_idx = opdata.data.logical_or.var_right;
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
|
||||
ecma_completion_value_t to_bool_value = ecma_op_to_boolean (left_value.u.value);
|
||||
|
||||
if (ecma_is_value_true (to_bool_value.u.value))
|
||||
{
|
||||
ret_value = set_variable_value (int_data,
|
||||
dst_var_idx,
|
||||
left_value.u.value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret_value = set_variable_value (int_data,
|
||||
dst_var_idx,
|
||||
right_value.u.value);
|
||||
}
|
||||
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_logical_or */
|
||||
|
||||
/**
|
||||
* 'Logical AND Operator' opcode handler.
|
||||
*
|
||||
* See also: ECMA-262 v5, 11.11
|
||||
*
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_logical_and (opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.logical_and.dst;
|
||||
const idx_t left_var_idx = opdata.data.logical_and.var_left;
|
||||
const idx_t right_var_idx = opdata.data.logical_and.var_right;
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
|
||||
ecma_completion_value_t to_bool_value = ecma_op_to_boolean (left_value.u.value);
|
||||
|
||||
if (ecma_is_value_true (to_bool_value.u.value) == false)
|
||||
{
|
||||
ret_value = set_variable_value (int_data,
|
||||
dst_var_idx,
|
||||
left_value.u.value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret_value = set_variable_value (int_data,
|
||||
dst_var_idx,
|
||||
right_value.u.value);
|
||||
}
|
||||
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_logical_and */
|
||||
|
||||
/**
|
||||
* 'This' opcode handler.
|
||||
*
|
||||
|
||||
@@ -133,8 +133,6 @@ opcode_counter_t read_meta_opcode_counter (opcode_meta_type expected_type, int_d
|
||||
p##_2 (a, b_not, dst, var_right)
|
||||
|
||||
#define OP_B_LOGICAL(p, a) \
|
||||
p##_3 (a, logical_and, dst, var_left, var_right) \
|
||||
p##_3 (a, logical_or, dst, var_left, var_right) \
|
||||
p##_2 (a, logical_not, dst, var_right)
|
||||
|
||||
#define OP_EQUALITY(p, a) \
|
||||
|
||||
Reference in New Issue
Block a user