-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[FIX] Prevent setting of __nextSuper on frozen objects #5374
Conversation
this seems like a good work around, but since since a somewhat recent fix to super, we are actually apply this wrapper to methods and objects that we where not before. I am slightly concerned that this will be even more of a performance drain then the current super is... @mixonic any thoughts? |
Object.isFrozen does not work in IE6 - IE8. |
@rwjblue So should we go with this solution we should polyfill
Found a bit more context from #3683. Getting a better understanding of what is going on here. I have confirmed that This is interesting to me because So far I've been focusing on |
@stefanpenner can we stash |
@mixonic where would that happen? (tryin' to keep up. :) |
@mixonic so currently we are super wrapping literally everything. Which means to store on the meta would mean to first create a meta for everything and this just continues to slow down our method calls. I wonder if the older functionality was actually with less caveats then this one.. |
@stefanpenner only what has a possible A few options:
For now I can fix the |
I don't know whether you've already considered this, but |
Properties cannot be modified on a frozen object, which means even if the functions to not alter the context, the super implementation itself will raise an exception when a wrapped method calls (and __nextSuper is set). Part of the challenge here is that Ember wraps functions defensively- it has no insight into if super will be called by a function and no tools for hinting about non-super-calling functions. Ember also follows a pattern of using hooks, so many methods are intended to be overridden even if the override will never call super. Unfortunately this patterns costs us. But putting super on the meta we kill two birds with one stone. The property does not need to use slow defineProperty (it is already not enumerable on the object) and it can still be set regardless of an object being frozen. This is not expected to have an impact on performance. The number of meta objects created during a run of the tests remains steady at about 22000 objects, and the number of requests for meta triples from 30k to 90k. Fixes emberjs#4970, Fixes emberjs#5324, Fixes emberjs#5374
Ignoring sets of Closing in favor of #5464 |
@rondale-sc thank you for the research and effort! @stefanpenner's commit buys us some time to figure out the real cause. |
It looks like I was wrong about |
This fixes #5324
If the object is frozen we should not modify it. This includes the setting of
__nextSuper
which is used by_super
.