Optimize typed array access (#4806)
Use uint32 indexes instead of double indexes. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -147,7 +147,7 @@ ecma_builtin_object_prototype_object_has_own_property (ecma_object_t *obj_p, /**
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_PROXY */
|
||||
|
||||
return ecma_make_boolean_value (ecma_op_ordinary_object_has_own_property (obj_p, prop_name_p));
|
||||
return ecma_op_ordinary_object_has_own_property (obj_p, prop_name_p);
|
||||
} /* ecma_builtin_object_prototype_object_has_own_property */
|
||||
|
||||
/**
|
||||
|
||||
@@ -1352,7 +1352,7 @@ static ecma_value_t
|
||||
ecma_builtin_typedarray_prototype_at (ecma_typedarray_info_t *info_p, /**< object info */
|
||||
const ecma_value_t index) /**< index argument */
|
||||
{
|
||||
ecma_length_t len = (ecma_length_t) info_p->length;
|
||||
ecma_length_t len = info_p->length;
|
||||
ecma_length_t res_index;
|
||||
ecma_value_t return_value = ecma_builtin_helper_calculate_index (index, len, &res_index);
|
||||
|
||||
@@ -1361,7 +1361,12 @@ ecma_builtin_typedarray_prototype_at (ecma_typedarray_info_t *info_p, /**< objec
|
||||
return return_value;
|
||||
}
|
||||
|
||||
return ecma_get_typedarray_element (info_p, (ecma_number_t) res_index);
|
||||
if (res_index >= UINT32_MAX)
|
||||
{
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
|
||||
return ecma_get_typedarray_element (info_p, (uint32_t) res_index);
|
||||
} /* ecma_builtin_typedarray_prototype_at */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user