SJS: A Type System for JavaScript with Fixed Object Layout [chapter]

Wontae Choi, Satish Chandra, George Necula, Koushik Sen
2015 Lecture Notes in Computer Science  
We propose a static type system for a significant subset of JavaScript, dubbed SJS, with the goal of ensuring that objects have a statically known layout at the allocation time, which in turn can enable an ahead-of-time (AOT) compiler to generate efficient code. The main technical challenge we address is to ensure fixed object layout, while supporting popular language features such as objects with prototype inheritance, structural subtyping, and method updates, with the additional constraint
more » ... t SJS programs can run on any available standard JavaScript engine, with no deviation from JavaScript's standard operational semantics. The core difficulty arises from the way standard JavaScript semantics implements object attribute update with prototypebased inheritance. To our knowledge, combining a fixed object layout property with prototype inheritance and subtyping has not been achieved previously.
doi:10.1007/978-3-662-48288-9_11 fatcat:xhra2lcbs5hmhaapujk56xbtyu