-
Notifications
You must be signed in to change notification settings - Fork 684
Primitive this values of accessors should not be coerced in strict mode #3854
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
jerry-core/vm/vm.c
Outdated
|
||
if (JERRY_UNLIKELY (!ecma_is_value_object (object))) | ||
if (JERRY_UNLIKELY (!ecma_is_value_object (base) |
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 think this part is always true if the second part is true.
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.
Since this case is extremely unlikely, I added the first condition to reduce the number of checks when base
is an object, which is more likely. I can remove it if you want.
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.
This looks like a very hoth path, and this is checked twice. What about moving the ecma_is_value_prop_name
part before this, and combine this part with the rest?
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.
Unfortunatley the errors must be thrown in this order, the base object needs to be checked first, followed by the property name. The checks could be reduced by adding a completely separate code path for the non-object case and duplicating/factoring out the property name coercion. What do you think?
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.
This is a key function of vm, so in this case I would not mind the extra binary size.
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (object)); | ||
|
||
object_p = ecma_get_object_from_value (object); | ||
ecma_op_ordinary_object_prevent_extensions (object_p); |
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.
Is this standard?
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.
This has been added as part of #2917, it seems to me that it's correct.
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai [email protected]
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.
LGTM
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.
LGTM
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai [email protected]