Skip to content

Optimize conditional jumps. #1104

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

Merged

Conversation

zherczeg
Copy link
Member

The ecma_op_to_boolean return value is changed to bool for faster
evaluation, and no need to swap operandos of relational compare.

@LaszloLango LaszloLango added enhancement An improvement performance Affects performance labels May 30, 2016
inline ecma_value_t __attr_pure___ __attr_always_inline___
ecma_invert_boolean_value (ecma_value_t value) /**< ecma value */
{
JERRY_STATIC_ASSERT ((ECMA_SIMPLE_VALUE_FALSE | 0x1) == ECMA_SIMPLE_VALUE_TRUE
Copy link
Contributor

Choose a reason for hiding this comment

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

This static assert should be right after the definition of ECMA_SIMPLE_VALUE_TRUE and ECMA_SIMPLE_VALUE_FALSE.

Copy link
Member Author

Choose a reason for hiding this comment

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

You cannot do that because they are in the header. And only this function depends on this condition at the moment.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, at least move out of the function. IMHO, it should be placed at the top of the file like in ecma-helpers.c

@zherczeg zherczeg force-pushed the relational_improvements branch from eacc295 to 7895cd5 Compare May 30, 2016 12:36
@zherczeg
Copy link
Member Author

Thank you, fixed.

@dbatyai
Copy link
Member

dbatyai commented May 30, 2016

LGTM

The ecma_op_to_boolean return value is changed to bool for faster
evaluation, and no need to swap operandos of relational compare.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
@zherczeg zherczeg force-pushed the relational_improvements branch from 7895cd5 to f24be95 Compare May 30, 2016 13:01
@zherczeg
Copy link
Member Author

Moved to the beginning

@LaszloLango
Copy link
Contributor

@zherczeg, thanks for the update. LGTM

@LaszloLango LaszloLango added the binary size Affects binary size label May 30, 2016
@zherczeg zherczeg merged commit f24be95 into jerryscript-project:master May 30, 2016
@zherczeg zherczeg deleted the relational_improvements branch May 30, 2016 13:26
@seanshpark seanshpark mentioned this pull request May 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binary size Affects binary size enhancement An improvement performance Affects performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants