标题: 为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
显示于类别:Thesis