Profile Guided Offline Optimization of Hidden Class Graphs for JavaScript VMs in Embedded Systems

Tomoharu Ugawa, Stefan Marr, Richard Jones

Research output: Chapter in Book/Report/Conference proceedingConference proceedingspeer-review

Abstract

JavaScript is increasingly used for the Internet of Things (IoT) on embedded systems. However, JavaScript's memory footprint is a challenge, because normal JavaScript virtual machines (VMs) do not fit into the small memory of IoT devices. In part this is because a significant amount of memory is used by hidden classes, which are used to represent JavaScript's dynamic objects efficiently. In this research, we optimize the hidden class graph to minimize their memory use. Our solution collects the hidden class graph and related information for an application in a profiling run, and optimizes the graph offline. We reduce the number of hidden classes by avoiding introducing intermediate ones, for instance when properties are added one after another. Our optimizations allow the VM to assign the most likely final hidden class to an object at its creation. They also minimize re-allocation of storage for property values, and reduce the polymorphism of inline caches. We implemented these optimizations in a JavaScript VM, eJSVM, and found that offline optimization can eliminate 61.9% of the hidden classes on average. It also improves execution speed by minimizing the number of hidden class transitions for an object and reducing inline cache misses.
Original languageEnglish
Title of host publicationProceedings of the 14th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages
EditorsChristos Kotselidis, Christos Kotselidis, Aleksandar Prokopec
PublisherACM
Pages11
Number of pages1
ISBN (Electronic)9781450399128
DOIs
Publication statusPublished - 05 Dec 2022
Externally publishedYes

Publication series

NameVMIL
PublisherACM

Fields of science

  • 102 Computer Sciences

Cite this