Skip to main content

Towards Specializing JavaScript Programs

  • Conference paper
  • First Online:
Book cover Perspectives of System Informatics (PSI 2014)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 8974))

Abstract

Program specialization is an effective tool for transforming interpreters to compilers. We present the first steps in the construction of a specialization tool chain for JavaScript programs. We report on an application of this tool chain in a case study that transforms a realistic interpreter implemented in JavaScript to a compiler.

The difference to previous work on compiling with program specialization is threefold. First, the interpreter has not been written with specialization in mind. Second, instead of specializing the interpreter, we transform it into a generating extension, which replaces parts of the interpreter’s code by a corresponding code generator. Third, the implementation language of the interpreter is not a restricted toy language, but full JavaScript.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    http://nodejs.org/.

References

  1. Andersen, L.O.: Program analysis and specialization for the c programming language. Ph.D. thesis, DIKU, University of Copenhagen (DIKU report 94/19) May 1994

    Google Scholar 

  2. Birkedal, L., Welinder, M.: Partial evaluation of Standard ML. Rapport 93/22, DIKU, University of Copenhagen (1993)

    Google Scholar 

  3. Bolz, C.F., et al.: Allocation removal by partial evaluation in a tracing JIT. In: PEPM 2011, Austin, TX, USA, pp. 43–52. ACM, January 2011

    Google Scholar 

  4. Bondorf, A.: Automatic autoprojection of higher order recursive equations. Sci. Comput. Program. 17, 3–34 (1991)

    Article  MATH  Google Scholar 

  5. Consel, C.: A tour of schism. In: Proceedings of the 1993 ACM Workshop Partial Evaluation and Semantics-Based Program Manipulation, Copenhagen, Denmark, pp. 134–154. ACM Press, June 1993

    Google Scholar 

  6. Consel, C., Lawall, J., Le Meur, A.-F.: A tour of tempo: a program specializer for the C language. Sci. Comput. Program. 52(1–3), 341–370 (2004)

    Article  MATH  Google Scholar 

  7. Danvy, O., Thiemann, P., Glück, R. (eds.): Dagstuhl Seminar 1996. LNCS, vol. 1110. Springer, Heidelberg (1996)

    Google Scholar 

  8. Danvy, O., Malmkjær, K., Palsberg, J.: Eta-expansion does the trick. ACM TOPLAS 18(6), 730–751 (1996)

    Article  Google Scholar 

  9. Futamura, Y.: Partial evaluation of computation process – an approach to a compiler-compiler. Syst. Comput. Controls 2(5), 45–50 (1971)

    Google Scholar 

  10. Hatcliff, J., Thiemann, P. (eds.): DIKU 1998. LNCS, vol. 1706. Springer, Heidelberg (1999)

    Google Scholar 

  11. Hedin, D., et al.: JSFlow: tracking information flow in JavaScript and its APIs. In: ACM Symposium on Applied Computing (SAC 2014), Gyeongju, Korea, March 2014

    Google Scholar 

  12. Hedin, D., Sabelfeld, A.: Information-flow security for a core of JavaScript. In: Chong, A.S. (ed.) CSF 2012, pp. 3–18. IEEE (2012)

    Google Scholar 

  13. Helsen, S., Thiemann, P.: Polymorphic specialization for ML. ACM TOPLAS 26(4), 1–50 (2004)

    Article  Google Scholar 

  14. Jones, N., Gomard, C., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice-Hall, New Jersey (1993)

    MATH  Google Scholar 

  15. Jones, N. D.: What not to do when writing an interpreter for specialisation. In: Danvy et al. [7], pp. 216–237

    Google Scholar 

  16. Jones, N.D., Sestoft, P., Søndergaard, H.: An experiment in partial evaluation: the generation of a compiler generator. In: Jouannaud, J.-P. (ed.) RTA 1985. LNCS, vol. 202, pp. 124–140. Springer, Heidelberg (1985)

    Chapter  Google Scholar 

  17. Jørgensen, J.: Compiler generation by partial evaluation. Master’s thesis, DIKU, University of Copenhagen (1991)

    Google Scholar 

  18. Mogensen, T.Æ.: Partially static structures in a self-applicable partial evaluator. In: Partial Evaluation and Mixed Computation, pp. 325–347. North-Holland, Amsterdam (1988)

    Google Scholar 

  19. Sperber, M.: Self-applicable online partial evaluation. In: Danvy et al. [7], pp. 465–480

    Google Scholar 

  20. Sumii, E., Kobayashi, N.: A hybrid approach to online and offline partial evaluation. Higher-Order Symbol. Comput. 14(2/3), 101–142 (2001)

    Article  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Peter Thiemann .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Thiemann, P. (2015). Towards Specializing JavaScript Programs. In: Voronkov, A., Virbitskaite, I. (eds) Perspectives of System Informatics. PSI 2014. Lecture Notes in Computer Science(), vol 8974. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-46823-4_26

Download citation

  • DOI: https://doi.org/10.1007/978-3-662-46823-4_26

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-662-46822-7

  • Online ISBN: 978-3-662-46823-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics