Skip to content

Conversation

@robertsipka
Copy link
Contributor

Create new ecma-string from positive integers without cast it to ecma_number

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com

@LaszloLango LaszloLango added enhancement An improvement performance Affects performance labels May 25, 2016
res_p = ecma_new_ecma_string_from_uint32 ((uint32_t) (ecma_get_integer_from_value (value)));
}
}
else if (ecma_is_value_float_number (value))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would call ecma_get_integer_from_value (value) first, then check the sign, and that makes ecma_get_number_from_value call unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, indeed, thanks! I've updated this patch.

else if (ecma_is_value_integer_number (value))
{
ecma_integer_value_t num = ecma_get_integer_from_value (value);
if (num < 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a newline before this. After that LGTM.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, thanks.

if (ecma_is_value_string (value))
{
res_p = ecma_get_string_from_value (value);
res_p = ecma_get_string_from_value (value);ecma-array-object.c
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accident change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly, fixed.

@LaszloLango
Copy link
Contributor

LGTM

1 similar comment
@zherczeg
Copy link
Member

LGTM

Create new ecma-string from positive integers without cast it to ecma_number

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
@robertsipka
Copy link
Contributor Author

rebased with master

@LaszloLango LaszloLango merged commit 3796987 into jerryscript-project:master May 26, 2016
@robertsipka robertsipka deleted the number_opt branch November 24, 2016 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement An improvement performance Affects performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants