-
Notifications
You must be signed in to change notification settings - Fork 683
Replace multiple boolean arguments to one uint8_t. #1100
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
Replace multiple boolean arguments to one uint8_t. #1100
Conversation
Binary size decreased by 1K. |
bool is_writable, /**< 'Writable' attribute */ | ||
bool is_enumerable, /**< 'Enumerable' attribute */ | ||
bool is_configurable) /**< 'Configurable' attribute */ | ||
uint8_t prop_attributes) /**< property attributes */ |
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 like this idea, but I'd give a name to this. What do you think about typedef uint8_t prop_attr_t;
or typedef uint8_t prop_attr_flag_t;
?
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 just saw that we already have a ecma_property_flags_t
, but it is an enum, so it'll be 32bit long (usually, but not always). In this case I think it is unnecessary to create a new type, but it should be mentioned in the comment.
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.
That is a flagset, not a flag. The type_and_flags in ecma_property_t is also an uint8_t. I wouldn't want to change it.
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.
As I said, you don't have to change the name, just make a comment.
...
uint8_t prop_attributes) /**< property attributes (See: ecma_property_flags_t) */
Any more thoughts? |
a396b0f
to
73807c6
Compare
LGTM, after the comment fixed. |
the three boolean arguments of ecma_create_named_data_property and the two boolean arguments of ecma_create_named_accessor_property are combined into one uint8_t argument. On ARM-32 it is preferred to have less than four arguments, since these arguments can be passed in registers. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
73807c6
to
8c92972
Compare
LGTM |
No description provided.