標題: 為JavaScript設計之預先式編譯器
JASM: An Ahead-of-Time Compiler for JavaScript Programs
作者: 吳晞浩
Wu, Si-Hao
游逸平
You, Yi-Ping
資訊科學與工程研究所
關鍵字: JavaScript;編譯器;型別推導;程式碼生成;JavaScript;Compiler;Type inference;Code generation
公開日期: 2014
摘要: 由於網路應用程式的發展和流行,JavaScript已經不同於以往只是來做網頁上頁面排版及顯示的輔助,而是在網路應用程式中負責高密集運算的程式,對高效能JavaScript程式的需求也與日俱增。 近年來JavaScript engine不斷地做改進優化並且也引用了即時編譯的技術,在效能上都有明顯得改進。但是JavaScript中允許變數型別直接轉換,此先天語言的弱型別特性從過去以來不斷造成了效能突破上的瓶頸。 在本篇論文,我們實作了一個Ahead-of-time的編譯器(JSAM)並且提出了data-flow-based 型別推理的方法將JavaScript程式在靜態時期轉成具強型別且執行效能較佳的JavaScript子及 : asm.js,如此我們能夠受益於asm.js的優化。我們跑在SunsPider benchmark實驗的結果顯示了我們所提出的方法能夠有效地提升JavaScript benchmark程式平均約40倍的執行效能。
Due to the development and the popularity of Web applications, JavaScript is not only for assisting the display of items in websites but also be used for computation-intensive programs. The demand for higher performance JavaScript programs is growing. For decades, JavaScript engines have improved dramatically due to the introduced just-in-time (JIT) compilation techniques and some other optimizations. However, the nature of JavaScript language makes it difficult for further optimizations because its dynamic features make the program behavior unpredictable and hard to determine its type information at static time. In this thesis, we present an ahead-of-time JavaScript compiler, called JASM, which translates JavaScript programs into asm.js programs, which is a subset of the JavaScript language and has high-performance execution. subset of JavaScript and runs with high speeds. We also propose a data-flow-based type-inference system that infer all possible data types at static time. Our evaluations demonstrated that the proposed method is effective in improving the execution time of JavaScript programs in the test benchmarks on an average of 40x and 20x speedup on a PC and a mobile device, respectively.
URI: http://140.113.39.130/cdrfb3/record/nctu/#GT070256043
http://hdl.handle.net/11536/76509
顯示於類別:畢業論文