Open
Conversation
Accessing elements after the end of the arguments array triggers deoptimization of the entire function on v8, so avoid doing so. Also tweak all the checks into the same standard form for consistency.
Add a bogus assignment to a function prototype, which appears to be the magic hint to treat function assignments as constant (until proven otherwise). Also get rid of the after-the-fact mutation of the ES object by making IsPromise an ordinary function. (We could also call `Object.freeze(ES)` but it doesn't actually improve performance further.)
55fdd32 to
b9c8385
Compare
Collaborator
There was a problem hiding this comment.
how does this impact other engines? v8-specific optimizations have hurt other engines' performance in the past, with bluebird for example.
Contributor
Author
There was a problem hiding this comment.
I can't imagine it would hurt performance, since it's just a throwaway assignment. I'll try to double-check, but I don't know of any equivalent low-level IR tools on the firefox side. (jsperf can be highly misleading.)
Collaborator
|
I've cherry-picked in one of these commits - a rebase should result in only the one commit left on top |
9647bf8 to
49a96e8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Be careful about how
argumentsis accessed, and ensure that theES.*helpers are treated as constant functions which can be inlined.