DOI QR코드

DOI QR Code

64-bit 자바스크립트 적시 컴파일러를 위한 상수 값 생성 최적화

Optimizing Constant Value Generation in Just-in-time Compiler for 64-bit JavaScript Engine

  • 최형규 (삼성전자 소프트웨어센터) ;
  • 이제형 (삼성전자 소프트웨어센터)
  • 투고 : 2015.07.23
  • 심사 : 2015.10.04
  • 발행 : 2016.01.15

초록

자바스크립트는 웹 페이지에서 HTML과 더불어 널리 사용되고 있다. 많은 자바스크립트 수행 엔진들은 성능 향상을 위해 적시 컴파일러를 채택하고 있다. 최근에는 32-bit 뿐만 아니라 64-bit 마이크로프로세서가 탑재된 다양한 기기가 소개되고 있으며 이를 위한 적시 컴파일러도 개발되고 있다. 하지만 64-bit 적시 컴파일러는 아직 문제점이 많으며, 특히 메모리 주소와 값들이 64-bit을 사용하여 코드의 크기가 증가하는 문제점이 있다. 본 논문은 64-bit 환경에서 생성되는 코드, 특히 주소와 상수 값들이 더 많은 공간을 사용함을 보여주고, 적시 컴파일러가 64-bit 값들의 생성을 최적화하여 메모리 사용량을 줄이는 기법들을 제안한다. 이를 V8 자바스크립트 엔진에 적용하여, Octane과 SunSpider 벤치마크에서 생성되는 코드의 크기와 성능을 평가하였다. 성능은 각각 3.6%와 0.32% 향상되었으며, 코드 크기는 0.7%와 2.8% 감소하였다.

JavaScript is widely used in web pages with HTML. Many JavaScript engines adopt Just-in-time compilers to accelerate the execution of JavaScript programs. Recently, many newly introduced devices are adopting 64-bit CPUs instead of 32-bit and Just-in-time compilers for 64-bit CPU are slowly being introduced in JavaScript engines. However, there are many inefficiencies in the currently available Just-in-time compilers for 64-bit devices. Especially, the size of code is significantly increased compared to 32-bit devices, mainly due to 64-bit wide addresses in 64-bit devices. In this paper, we are going to address the inefficiencies introduced by 64-bit wide addresses and values in the Just-in-time compiler for the V8 JavaScript engine and propose more efficient ways of generating constant values and addresses to reduce the size of code. We implemented the proposed optimization in the V8 JavaScript engine and measured the size of code as well as performance improvements with Octane and SunSpider benchmarks. We observed a 3.6% performance gain and 0.7% code size reduction in Octane and a 0.32% performance gain and 2.8% code size reduction in SunSpider.

키워드

참고문헌

  1. Ecma International (2015, Jun.). ECMAScript 2015 Language Specification (6th ed.) [Online]. Available: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf (downloaded 2015, Jul. 10)
  2. G. Richards, S. Lebresne, B. Burg, J. Vitek, "An Analysis of the Dynamic Behavior of JavaScript Programs," Proc. of the 2010 conference on Programming Language Design and Implementation, pp. 1-12, 2010
  3. W.-K. Jung, Y.-W. Kim and S.-M. Moon, "An Optimization for JavaScript Just-in-Time Compiler Using Variable Type Hint," Proc. of the KIISE Korea Computer Congress 2014, pp. 1400-1402, 2014. (in Korean)
  4. J. Aycock, "A brief history of just-in-time," ACM Computing Surveys, Vol. 35, Issue 2, pp. 97-113, 2003. https://doi.org/10.1145/857076.857077
  5. J. Nah, H. Kim, H. Kim, G. J, J. Lee, "Implementation of Register Allocator for JavaScript JIT Compiler," Proc. of the KIISE Korea Computer Congress 2011, pp. 194-197, 2011. (in Korean)
  6. H. Park, Y.-H. Yoo, S.-M. Moon, "Performance Analysis of Adaptive Compilation In V8 CrankShaft JavaScript Engine," Proc. of the KIISE Korea Computer Congress 2011, pp. 202-205, 2011. (in Korean)
  7. JavaScriptCore - Webkit [Online]. Available: http://trac.webkit.org/wiki/JavaScriptCore
  8. V8 JavaScript Engine [Online]. Available: http://code.google.com/p/v8/
  9. ARM Limited (2015, Mar. 25). ARMv8-A Reference Manual (Issue A.f) [Online]. Available: http://infocenter.arm.com/help/topic/com.arm.doc.ddi0487a.f/index.html (downloaded 2015, Jul. 10)
  10. ARM Limited (2015, Mar. 24). ARM Cortex-A Series Programmer's Guide for ARMv8-A [Online]. Available: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0024a/ch05s01s03.html (downloaded 2015, Jul. 10)
  11. K. Venstermans, L. Eeckhout, K. Bosschere, "Object-relative addressing: compressed pointers in 64-bit java virtual machines," Proc. of the 21st European conference on Object-Oriented Programming (ECOOP'07), pp. 79-100, 2007.

피인용 문헌

  1. Accelerating Javascript Using Operator Analysis vol.22, pp.8, 2016, https://doi.org/10.5626/KTCP.2016.22.8.399