Handle getters on functions and improve property deoptimization #4493
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Closes #4492
Description
This PR supersedes #4492 as it reimplements the logic in a nicer way. At the core, this PR does two things:
Architecturally, the last two points are achieved by adding a new type of "unknown property key" in the logic, UnknownNonAccessorKey, that works similar to UnknownIntegerKey in that it is treated as unknown but we do not assume that reassignments to that key can create setters or getters and that we do not assume there will be setter side effects when reassigning that key.
For the function improvements, we now use
ObjectEntity
as a shared base for all object-like literals, i.e. objects, classes, functions (including arrow functions) and arrays. This will also make it easier to avoid code duplication for future features.