ES6 in JavaScript in Chromium

108 views
Skip to first unread message

James Hawkins

unread,
Jun 25, 2015, 5:04:21 PM6/25/15
to chromium-dev
Hey folks,

If you don't write JavaScript in Chromium, you can stop reading now.

As of crrev.com/336241 ES6 mode is turned on for the JSCompiler infrastructure in Chromium [1].  Enjoy productivity boosters such as for (var...of) [2] for iterable objects (most notably Array, Map, and Set).

Thanks,
James

[1] https://code.google.com/p/chromium/codesearch#chromium/src/third_party/closure_compiler/

Elliott Sprehn

unread,
Jun 25, 2015, 5:45:18 PM6/25/15
to jhaw...@chromium.org, Chromium-dev

Does v8 optimize for/of loops? It used to deopt the whole function.

Adam Klein

unread,
Jun 26, 2015, 11:49:05 AM6/26/15
to Elliott Sprehn, jhaw...@chromium.org, Chromium-dev
On Thu, Jun 25, 2015 at 4:44 PM, Elliott Sprehn <esp...@chromium.org> wrote:

Does v8 optimize for/of loops? It used to deopt the whole function.

Two things:

1. v8 currently uses the TurboFan compiler when optimizing a function that uses for...of loops.
2. It looks like Chromium is using the JSCompiler to compile ES6 down to ES5, so V8 never sees for...of loops here.

- Adam

Chris Harrelson

unread,
Jun 26, 2015, 1:15:10 PM6/26/15
to Adam Klein, Chromium-dev, James Hawkins, Elliott Sprehn

Really? Is there no mode to stop compiling down yet?

>
> - Adam
>
> --
> --
> Chromium Developers mailing list: chromi...@chromium.org
> View archives, change email options, or unsubscribe:
> http://groups.google.com/a/chromium.org/group/chromium-dev
>
> To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.

Stuart Morgan

unread,
Jul 8, 2015, 6:39:43 PM7/8/15
to jhaw...@chromium.org, chromium-dev, jyq...@chromium.org
One caveat about ES6 use in WebUI: since some WebUI (and thus much of the WebUI infrastructure) is used on iOS, and we support back to iOS 7, not all files are ES6-safe. (E.g., a recent change adding use of Map in cr.js caused issues on iOS). If you're changing core files, please reach out to myself and/or jyquinn@ about ES6 use.

Unfortunately there's not a good general solution of iOS trailing the other platforms here. As we've done in the past with things like new CSS, we'll look at each case and figure out how to best balance iOS support against WebUI development on the other platforms.

-Stuart

--

Elliott Sprehn

unread,
Jul 8, 2015, 6:56:47 PM7/8/15
to Stuart Morgan, James Hawkins, chromium-dev, jyq...@chromium.org
Can we compile ES6 code into ES5 code for iOS?

It seems sad to handicap the development process for the other hundreds of millions of users for small number of iOS users.

Stuart Morgan

unread,
Jul 8, 2015, 7:52:46 PM7/8/15
to Elliott Sprehn, James Hawkins, chromium-dev, jyq...@chromium.org
On Wed, Jul 8, 2015 at 3:55 PM Elliott Sprehn <esp...@chromium.org> wrote:
Can we compile ES6 code into ES5 code for iOS?

James and I were just discussing this; apparently collections aren't affected at the moment, so that wouldn't help in this case. In other cases, it might be a workable solution.
 
It seems sad to handicap the development process for the other hundreds of millions of users for small number of iOS users.

It's certainly not ideal, but on the flip side losing all WebUI on iOS (including many important debugging tools) would also bee a sad outcome. That's why we've tried to carefully balance on a case-by-case basis for the last several years, rather than making sweeping rules.

(That said, the number of end users on each platform is not really relevant here, so it's not nearly as unbalanced as you are making it out to be. This is a question of the cost to developers of not using new things in certain cases vs. the cost to developers of re-implementing all necessary WebUI pages in native code for iOS. The number of, say, Windows users who care whether the some piece of WebUI internals uses Map instead of an Object is zero.)

-Stuart

Elliott Sprehn

unread,
Jul 8, 2015, 8:36:20 PM7/8/15
to Stuart Morgan, James Hawkins, chromium-dev, Jackie Quinn
Stuart pointed out the importance of iOS Chrome off thread to me, carry on making WebUI awesome. 
Reply all
Reply to author
Forward
0 new messages