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
es6.regexp.constructor polyfill moves RegExps onto slow path in V8 #5771
Comments
Hey @schuay! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
Thanks for the report and article @schuay, much appreciated 😎! I mentioned in https://twitter.com/left_pad/status/866691698306539520, but at the moment babel-polyfill is basically an alias for https://github.com/zloirock/core-js (https://github.com/babel/babel/blob/7.0/packages/babel-polyfill/src/index.js) so we can move it to that repo if that's cool |
What can I say... It should be an issue only for old V8 versions, it should not be a problem in modern V8, and I don't see any ways for fix it. |
Created a new bug at zloirock/core-js#306 . |
@zloirock it also triggers on current chrome / current v8. |
See https://medium.com/@schuay/js-regexp-fast-and-slow-d29d6b77b06 and mishoo/UglifyJS#1964 for more context.
es6.regexp.constructor (and possibly other regexp polyfills) cause all regexps to take the slow path in V8 by modifying RegExp.prototype.
Repro instructions here: mishoo/UglifyJS#1964 (comment)
Input Code
Expected Behavior
RegExp.prototype remains unmodified when possible:
Current Behavior
RegExp.prototype.constructor is set by es6.regexp.constructor.
Environment
See mishoo/UglifyJS#1964
babel-polyfill@6.23.0 browserify@14.3.0 uglify-js@3.0.7
Possible fix
Avoid modifying RegExp.prototype if possible.
The text was updated successfully, but these errors were encountered: