Skip to main content

Typed JS: A Lightweight Typed JavaScript Engine for Mobile Devices

  • Conference paper

Part of the Lecture Notes of the Institute for Computer Sciences, Social Informatics and Telecommunications Engineering book series (LNICST,volume 162)

Abstract

Web applications have been gaining huge popularity due to being platform independent and also enabling fast development. Unfortunately, due to insufficient performance of web applications, they are generally limited to non-performance-critical use. The performance of web applications is largely affected by the performance of JavaScript. To address this problem, modern JavaScript engines such as Google’s V8 incorporate many state-of-the-art optimization and engineering techniques. In industry, recent approaches are to extend JavaScript to decorate objects with types to better utilize just-in-time (JIT) compilers.

In this paper, we present Typed JS, a subset of JavaScript that utilizes type-decorated syntax. Unlike previous approaches, Typed JS supports most of the JS core operations while utilizing the ahead-of-time (AOT) compilation technique, which was not possible in the existing solution. Typed JS is specifically designed for running Web applications on mobile devices with goals of having smaller memory footprint while achieving high-performance, which is accomplished by utilizing the type information and AOT technique. Experiments show that Typed JS requires significantly much less memory usage while performing better than industry-leading JavaScript engines on a mobile platform.

Keywords

  • Typed JavaScript
  • Static type
  • Mobile

This is a preview of subscription content, access via your institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • DOI: 10.1007/978-3-319-29003-4_7
  • Chapter length: 15 pages
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
eBook
USD   54.99
Price excludes VAT (USA)
  • ISBN: 978-3-319-29003-4
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
Softcover Book
USD   69.99
Price excludes VAT (USA)
Fig. 1.
Fig. 2.
Fig. 3.
Fig. 4.
Fig. 5.
Fig. 6.
Fig. 7.
Fig. 8.
Fig. 9.

Notes

  1. 1.

    https://www.enlightenment.org/.

  2. 2.

    https://www.tizen.org.

  3. 3.

    https://developer.tizen.org/.

  4. 4.

    https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API.

  5. 5.

    http://esprima.org/.

  6. 6.

    https://github.com/estools/escodegen.

  7. 7.

    http://www.hboehm.info/gc.

  8. 8.

    http://llvm.org.

  9. 9.

    http://nodejs.org.

  10. 10.

    http://www.webkit.org/perf/sunspider/sunspider.html.

References

  1. Ahn, W., Choi, J., Shull, T., Garzarán, M.J., Torrellas, J.: Improving javascript performance by deconstructing the type system. In: Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation, p. 51. ACM, Edinburgh, United Kingdom, June 2014

    Google Scholar 

  2. Apple.Javascriptcore (2005). http://trac.webkit.org/wiki/JavaScriptCore

  3. Böhm, I., von Koch, T.J.K.E., Kyle, S.C., Franke, B., Topham, N.P.: Generalized just-in-time trace compilation using a parallel task farm in a dynamic binary translator. In: Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 74–85. ACM, San Jose, CA, June 2011

    Google Scholar 

  4. Bolz, C.F., Cuni, A., Fijalkowski, M., Rigo, A.: Tracing the meta-level: Pypy’s tracing JIT compiler. In: Proceedings of the 4th Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, pp. 18–25. ACM, Genova, Italy (2009)

    Google Scholar 

  5. Bracha, G., Griswold, D.: Strongtalk: typechecking smalltalk in a production environment. In: Proceedings of the Eighth Annual Conference on Object-Oriented Programming Systems, Languages, and Applications, pp. 215–230. ACM, Washington, DC, October 1993

    Google Scholar 

  6. Chambers, C., Ungar, D., Lee, E.: An efficient implementation of SELF, a dynamically-typed object-oriented language based on prototypes. Lisp Symb. Comput. 4(3), 243–281 (1991)

    CrossRef  Google Scholar 

  7. Choi, P.W., Chandra, S., Necula, G., Sen, K.: SJS: a typed subset of javascript with fixed object layout. Technical report UCB/EECS-2015-10, EECS Department, University of California, Berkeley, March 2015

    Google Scholar 

  8. Facebook.flow (2014). http://flowtype.org/

  9. Google.Chrome v8 (2008). https://developers.google.com/v8/

  10. Google.NaCl and PNaCl (2013). https://developer.chrome.com/native-client/nacl-and-pnacl/

  11. Hölzle, U., Chambers, C., Ungar, D.: Optimizing dynamically-typed object-oriented languages with polymorphic inline caches. In: Proceedings of European Conference on Object-Oriented Programming, pp. 21–38. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, Geneva, Switzerland, July 1991

    Google Scholar 

  12. Hölzle, U., Chambers, C., Ungar, D.: Debugging optimized code with dynamic deoptimization. In: Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 32–43. ACM, San Francisco CA, June 1992

    Google Scholar 

  13. IBM.Wala (2006). https://wala.sourceforge.net

  14. Microsoft.TypeScript (2012). http://www.typescriptlang.org/

  15. Mozilla.asm.js (2013). http://asmjs.org/

  16. Rompf, T., Sujeeth, A.K., Brown, K.J., Lee, H., Chafi, H., Olukotun, K.: Surgical precision JIT compilers. In: Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation, p. 8. ACM, Edinburgh, United Kingdom, June 2014

    Google Scholar 

  17. Vilk, J., Berger, E.D.: Doppio: breaking the browser language barrier. In: Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 52. ACM, Edinburgh, United Kingdom, June 2014

    Google Scholar 

Download references

Acknowledgment

We thank our group members Junyoung Cho, Eunji Jeong, Saebom Kim, Wonyong Kim, Sanggyu Lee, Seungsoo Lee, Jaeman Park, and Youngsoo Son for their contributions to this paper. We are also grateful to the anonymous reviewers for their constructive comments on this paper.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Ryan H. Choi .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and Permissions

Copyright information

© 2015 Institute for Computer Sciences, Social Informatics and Telecommunications Engineering

About this paper

Cite this paper

Choi, R.H., Choi, Y. (2015). Typed JS: A Lightweight Typed JavaScript Engine for Mobile Devices. In: Sigg, S., Nurmi, P., Salim, F. (eds) Mobile Computing, Applications, and Services. MobiCASE 2015. Lecture Notes of the Institute for Computer Sciences, Social Informatics and Telecommunications Engineering, vol 162. Springer, Cham. https://doi.org/10.1007/978-3-319-29003-4_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-29003-4_7

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-29002-7

  • Online ISBN: 978-3-319-29003-4

  • eBook Packages: Computer ScienceComputer Science (R0)