Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Special case conditionals for $Set operations on abstract object #2219

Closed

Conversation

sebmarkbage
Copy link
Contributor

This lets the simplifier do it work and allows intermediate objects to be dead code eliminated.

If this looks good, I'll do $SetPartial and $Delete too.

This lets the simplifier do it work and allows intermediate objects to
be dead code eliminated.

If this looks good, I'll do $SetPartial and $Delete too.
let d1 = ob1.$GetOwnProperty(P);
let d2 = ob2.$GetOwnProperty(P);
let oldVal1 =
d1 === undefined ? this.$Realm.intrinsics.undefined : IsDataDescriptor(this.$Realm, d1) ? d1.value : undefined;
Copy link
Contributor Author

@sebmarkbage sebmarkbage Jul 6, 2018

Choose a reason for hiding this comment

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

This is not right. Should be empty, not undefined. I'll add a test.

@@ -0,0 +1,13 @@
// does not contain:unnecessaryIndirection
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is what is different with this diff. The intermediate objects are now eliminated.

invariant(ob1 instanceof ObjectValue || ob1 instanceof AbstractObjectValue);
invariant(ob2 instanceof ObjectValue || ob2 instanceof AbstractObjectValue);
let d1 = ob1.$GetOwnProperty(P);
let d2 = ob2.$GetOwnProperty(P);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Found an existing bug. These don't consider setters on the prototype chain. #2226

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@sebmarkbage is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

facebook-github-bot pushed a commit that referenced this pull request Jul 27, 2018
…rtial and $Delete (#2329)

Summary:
Follow up to #2219

This also includes two relevant bonus fixes: 2aa1ad3 and e96ac8c
Pull Request resolved: #2329

Differential Revision: D9033950

Pulled By: sebmarkbage

fbshipit-source-id: b28b608b7449f0bbd7781c7d6aab5717d638d904
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants