-
Notifications
You must be signed in to change notification settings - Fork 683
Optimize ecma_string_get_array_index #1207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
if (ECMA_STRING_GET_CONTAINER (str_p) == ECMA_STRING_CONTAINER_UINT32_IN_DESC) | ||
uint32_t index; | ||
const ecma_string_container_t type = ECMA_STRING_GET_CONTAINER (str_p); | ||
if (type == ECMA_STRING_CONTAINER_UINT32_IN_DESC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline before if.
Nice catch btw. |
LGTM |
|
||
ecma_deref_ecma_string (to_uint32_to_string_p); | ||
} | ||
if (size > 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put the zero check first:
if (*raw_str_p == LIT_CHAR_0) return size == 1;
if (size == 10) | ||
{ | ||
if (index > UINT32_MAX / 10 | ||
|| raw_str_p[9] > LIT_CHAR_9 || raw_str_p[9] < LIT_CHAR_0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style issue: two || in one line.
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
LGTM |
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu