Performance optimizations

* inline some hot function
 * add 'ecma_copy_value_if_not_object' similer to 'ecma_value_free_if_not_object'
 * remove unnecessary helpers
 * improve 'do_number_bitwise_logic'

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
László Langó
2016-03-17 11:08:53 +01:00
parent 94f887919e
commit 2027caeda5
30 changed files with 202 additions and 242 deletions
+11 -11
View File
@@ -49,47 +49,47 @@ do_number_bitwise_logic (number_bitwise_logic_op op, /**< number bitwise logic o
ECMA_OP_TO_NUMBER_TRY_CATCH (num_right, right_value, ret_value);
ecma_number_t *res_p = ecma_alloc_number ();
int32_t left_int32 = ecma_number_to_int32 (num_left);
uint32_t left_uint32 = ecma_number_to_uint32 (num_left);
uint32_t right_uint32 = ecma_number_to_uint32 (num_right);
switch (op)
{
case NUMBER_BITWISE_LOGIC_AND:
{
*res_p = ecma_int32_to_number ((int32_t) (left_uint32 & right_uint32));
uint32_t left_uint32 = ecma_number_to_uint32 (num_left);
*res_p = (ecma_number_t) ((int32_t) (left_uint32 & right_uint32));
break;
}
case NUMBER_BITWISE_LOGIC_OR:
{
*res_p = ecma_int32_to_number ((int32_t) (left_uint32 | right_uint32));
uint32_t left_uint32 = ecma_number_to_uint32 (num_left);
*res_p = (ecma_number_t) ((int32_t) (left_uint32 | right_uint32));
break;
}
case NUMBER_BITWISE_LOGIC_XOR:
{
*res_p = ecma_int32_to_number ((int32_t) (left_uint32 ^ right_uint32));
uint32_t left_uint32 = ecma_number_to_uint32 (num_left);
*res_p = (ecma_number_t) ((int32_t) (left_uint32 ^ right_uint32));
break;
}
case NUMBER_BITWISE_SHIFT_LEFT:
{
*res_p = ecma_int32_to_number (left_int32 << (right_uint32 & 0x1F));
*res_p = (ecma_number_t) (ecma_number_to_int32 (num_left) << (right_uint32 & 0x1F));
break;
}
case NUMBER_BITWISE_SHIFT_RIGHT:
{
*res_p = ecma_int32_to_number (left_int32 >> (right_uint32 & 0x1F));
*res_p = (ecma_number_t) (ecma_number_to_int32 (num_left) >> (right_uint32 & 0x1F));
break;
}
case NUMBER_BITWISE_SHIFT_URIGHT:
{
*res_p = ecma_uint32_to_number (left_uint32 >> (right_uint32 & 0x1F));
uint32_t left_uint32 = ecma_number_to_uint32 (num_left);
*res_p = (ecma_number_t) (left_uint32 >> (right_uint32 & 0x1F));
break;
}
case NUMBER_BITWISE_NOT:
{
*res_p = ecma_int32_to_number ((int32_t) ~right_uint32);
*res_p = (ecma_number_t) ((int32_t) ~right_uint32);
break;
}
}