1 / 15

WebKit JavaScript Engine optimizations

WebKit JavaScript Engine optimizations. By Kiril Knysh. Why WebKit ?. Why WebKit ?. +. Why WebKit ?. What is WebKit JavaScriptCore. WebKit JavaScriptCore overview. LLInt. 100 x statement execution 6 calls. Baseline JIT. 1000 x statement execution 66 calls. DFG JIT.

Download Presentation

WebKit JavaScript Engine optimizations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. WebKit JavaScript Engine optimizations By Kiril Knysh

  2. Why WebKit?

  3. Why WebKit? +

  4. Why WebKit?

  5. What is WebKitJavaScriptCore

  6. WebKitJavaScriptCore overview LLInt 100 x statement execution 6 calls Baseline JIT 1000 x statement execution 66 calls DFG JIT

  7. WebKitJavaScriptCoreoverviewDFG JIT optimizations • Type prediction • Dead-code elimination • Register allocation optimization function sum(a, b) { return a + b; } If a NOT integer -> back to Baseline JIT If b NOT integer -> back to Baseline JIT result = a + b If overflow -> back to Baseline JIT • Common subexpression elimination • Constant propagation

  8. WebKitJavaScriptCore overview Tiers speed-up (OS simulation by Martin Richards benchmark) Higher is better

  9. 29 Apr 2014

  10. FTL JIT Faster Than Light Fourth Tier LLVM

  11. FTL JIT Tiers speed-up (OS simulation by Martin Richards benchmark) Higher is better

  12. FTL JIT • Previous levels optimizations • Aggressive C-like optimizations • Low Level Virtual Machine • Memory-to-Register • Instruction Combining • Global Value Numbering • Control Flow Simplification

  13. FTL JIT LLInt 100 x statement execution 6 calls Baseline JIT -1 000 x C DFG JIT -100 000 x C FTL JIT

  14. We recommend • Avoid polymorphic code • Use JS types (e.g. typed arrays) Prototype.js var Class = { create: function() { function constructor() { this.initialize.apply(this, arguments); } return constructor; } } var Person = Class.create(); Person.prototype = { initialize: function(name) { this.name = name; }, say: function(message) { return this.name + ': ' + message; } }; • No need in Asm.js • Avoid enormous functions • Avoid complex recursions, try-catch

  15. Thanks for your attention

More Related