Fast and Precise Hybrid Type Inference for Java']JavaScript

被引:55
作者
Hackett, Brian [1 ]
Guo, Shu-yu [1 ]
机构
[1] Univ Calif Los Angeles, Los Angeles, CA USA
关键词
type inference; hybrid; just-in-time compilation; OPTIMIZATION; LANGUAGES; PROGRAMS; SYSTEM; OBJECT;
D O I
10.1145/2345156.2254094
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
JavaScript performance is often bound by its dynamically typed nature. Compilers do not have access to static type information, making generation of efficient, type-specialized machine code difficult. We seek to solve this problem by inferring types. In this paper we present a hybrid type inference algorithm for JavaScript based on points-to analysis. Our algorithm is fast, in that it pays for itself in the optimizations it enables. Our algorithm is also precise, generating information that closely reflects the program's actual behavior even when analyzing polymorphic code, by augmenting static analysis with run-time type barriers. We showcase an implementation for Mozilla Firefox's JavaScript engine, demonstrating both performance gains and viability. Through integration with the just-in-time (JIT) compiler in Fire-fox, we have improved performance on major benchmarks and JavaScript-heavy websites by up to 50%. Inference-enabled compilation is the default compilation mode as of Firefox 9.
引用
收藏
页码:239 / 249
页数:11
相关论文
共 27 条
[1]  
Agesen O., 1993, ECOOP '93 - Object-Oriented Programming. 7th European Conference Proceedings, P247
[2]  
AGESEN O, 1995, SIGPLAN NOTICES, V30, P91, DOI 10.1145/217839.217847
[3]  
Agesen O., 1994, CONSTRAINT BASED TYP
[4]  
Aiken A., 1993, FPCA '93. Conference on Functional Programming Languages and Computer Architecture, P31, DOI 10.1145/165180.165188
[5]  
Aiken Alexander., 1991, POPL 91, P279, DOI [DOI 10.1145/99583.99621, 10.1145/99583.99621]
[6]  
Andersen Lars Ole, 1994, Ph.D. Dissertation
[7]  
Anderson C, 2005, LECT NOTES COMPUT SC, V3586, P428
[8]  
CARTWRIGHT R, 1991, SIGPLAN NOTICES, V26, P278, DOI 10.1145/113446.113469
[9]  
Chambers C., 1992, THESIS DEP COMPUTER
[10]  
Chambers C., 1989, PLDI