Re:ChowJS: An AOT JavaScript engine for game consoles
by ridiculous_fish on Thursday September 16, 2021 @05:10PM
(#28557664)
Agreed, there's a lot of optimizations you can unlock if you ignore JS misfeatures like modifying Array.prototype. But it's important for compilers to be precise about the semantics they implement. I just saw the section about enabling checks for when the assumptions are violated, that's a good thing to have.
As such I'd guess that they have an initial pass that just looks for bad patterns (eval,etc) and totally ignores optimizing those, next up you look for other things (like writes to named properties, if nobody ever writes to a .log property it's probably fairly safe since the main task is AOT compiling code). There's probably a switch-es to enable a safer mode for various things where a fast-path is the default but fallbacks would work,etc.