Slide 1

Slide 1 text

Latest ES6 work on WebKit Yusuke Suzuki @Constellation

Slide 2

Slide 2 text

Self-introduction • WebKit Reviewer – Expertise: CSS JIT, ECMAScript / JavaScript – IRC: yusukesuzuki • Owner of some ECMAScript modules – Escodegen, Escope, Esmangle, Estraverse, Doctrine etc. – Have you ever used it?

Slide 3

Slide 3 text

ES6 in Safari9 • Safari9

Slide 4

Slide 4 text

ES6 supported by WebKit • This list is the part of the whole ES6 support

Slide 5

Slide 5 text

ES6 supported by WebKit • This list is the part of the whole ES6 support

Slide 6

Slide 6 text

ES6 supported by WebKit • This list is the part of the whole ES6 support

Slide 7

Slide 7 text

Do you know the status of ES6 in WebKit? • The status of ES6 in WebKit JavaScriptCore – Not V8 / SpiderMonkey / Chakra • Already announced a lot of features will be shipped in Safari9

Slide 8

Slide 8 text

The other parts (1) • iterators & for-of – Complete support of `iterator.return()` – Of course, @@iterator is supported • You can easily create the custom iterators • destructuring – Array, Object patterns are already supported – Rest element is just supported (WK) – Destructuring accepts iterators (WK) – Spec conformance becomes higher than Firefox 40

Slide 9

Slide 9 text

The other parts (2) • Default initializer for assignments & decls – Like, `var { a = 20 } = obj;` • Several well-known Symbols – @@unscopable – @@iterator

Slide 10

Slide 10 text

The other parts (3) • String extra methods – String#codePointAt, String#repeat etc. • Array extra methods – Array#find etc • Object extra methods – Object.assign, Object.getPrototypeOf etc. • Math extra methods – Math.imul etc. • Number extra methods

Slide 11

Slide 11 text

The other parts (4) • Map, Set, WeakMap – Their implementation is upgraded to match to the ES6 spec – e.g. entries() returns iterator

Slide 12

Slide 12 text

WebKit implementation status • WebKit now has a status page – http://www.webkit.org/status.html • Supported ES6 features are also listed here – When I implemented something, I will add it.

Slide 13

Slide 13 text

Ongoing parts (1) • Arrow functions – Parsing functionality is just landed (today) • http://trac.webkit.org/changeset/185989 • Block scoped variables (let, const) – Patch by Saam • https://bugs.webkit.org/show_bug.cgi?id=142944

Slide 14

Slide 14 text

Ongoing parts (2) • Default parameters – Since it requires blocked scope system (TDZ) • Spread operators

Slide 15

Slide 15 text

Details of JSC • JSC already has the system to write builtin functions in JS – For example, Array#sort is rewritten in JS – Bucket & merge sort • Privileged JS code can emit bytecodes – @putDirectByVal • JS-written builtin encourages DFG/FTL JIT – ArrayIterator#next is written in JS • Inlining • Object sinking

Slide 16

Slide 16 text

Conclusion • The latest WebKit will ship a lot of ES6 features • ES6 features are now actively implemented in WebKit