Dynamic Flow Analysis for JavaScript

Publication date

2019-02-21

Authors

Naus, N.ISNI 000000049329940X
Thiemann, Peter

Editors

Advisors

Supervisors

Document Type

Part of book
Open Access logo

License

taverne

Abstract

Static flow analyses compute a safe approximation of a program’s dataflow without executing it. Dynamic flow analyses compute a similar safe approximation by running the program on test data such that it achieves sufficient coverage. We design and implement a dynamic flow analysis for JavaScript. Our formalization and implementation observe a program’s execution in a training run and generate flow constraints from the observations. We show that a solution of the constraints yields a safe approximation to the program’s dataflow if each path in every function is executed at least once in the training run. As a by-product, we can reconstruct types for JavaScript functions from the results of the flow analysis. Our implementation shows that dynamic flow analysis is feasible for JavaScript. While our formalization concentrates on a core language, the implementation covers full JavaScript. We evaluated the implementation using the SunSpider benchmark.

Keywords

Type inference, JavaScript, Flow analysis, Dynamic languages, Taverne

Citation

Naus, N & Thiemann, P 2019, Dynamic Flow Analysis for JavaScript. in Trends in Functional Programming. 2016 edn, Lecture Notes in Computer Science, vol. 17, pp. 75-93. https://doi.org/10.1007/978-3-030-14805-8_5