* Fix OOB string character access in Printer#_maybeAddParen. The `_maybeAddParen` method of the `Printer` class does ```js const chaPost = str[i + 1] ``` without checking that `i + 1` is still within the bounds of `str`. It seems like this triggers fairly often that the `str[i + 1]` access is out of bounds. The first out of bounds access will turn the KeyedLoadIC (in case of V8) into *MEGAMORPHIC* state, which is significantly slower for strings (there's a fix in flight for V8 to mitigate the cost a bit in that case). Even worse than that, the out of bounds access also pollutes the later comparisons, namely ```js chaPost === "/" ``` and ```js chaPost === "*" ``` which are now no longer monomorphic on strings, since `chaPost` was sometimes `undefined`. This is a non-breaking performance fix, which improves babel execution on the [web-tooling-benchmark](github.com/v8/web-tooling-benchmark) workload by around 6-9%. * Restructure and optimize the code a bit.
The compiler for writing next generation JavaScript.
Supporting Babel
Babel is community-driven and thus mostly maintained by a group of volunteers. It has a lot of companies and projects using it but almost no sponsors/people funded to work on it. If you'd like to help maintain the future of the project, please consider:
- Giving developer time on the project. (Message us on Twitter or Slack)
- Giving funds by becoming a backer/sponsor on OpenCollective
Intro
Babel is a tool that helps you write code in the latest version of JavaScript. When your supported environments don't support certain features natively, Babel will help you compile those features down to a supported version.
In
// ES2015 arrow function
[1, 2, 3].map((n) => n + 1);
Out
[1, 2, 3].map(function(n) {
return n + 1;
});
Try it out at our REPL.
FAQ
Who maintains Babel?
Mostly a handful of volunteers! Please check out our team page!
Looking for support?
For questions and support please visit join our Slack Community, ask a question on Stack Overflow, or ping us on Twitter.
Where are the docs?
Check out our website: babeljs.io, and report issues/features at babel/website.
Want to report a bug or request a feature?
Please read through our CONTRIBUTING.md and fill out the issue template at babel/issues!
Want to contribute to Babel?
Check out our CONTRIBUTING.md to get started with setting up the repo.
- If you have already joined Slack, join our #development channel and say hi!
- Check out the issues with the good first issue and help wanted label. We suggest also looking at the closed ones to get a sense of the kinds of issues you can tackle.
- Our discussions/notes/roadmap: babel/notes
- Our progress on TC39 proposals: babel/proposals
How is the repo structured?
The Babel repo is managed as a monorepo that is composed of many npm packages.
Backers
Support us with a monthly donation and help us continue our activities. [Become a backer]
Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]