Instead of generating vanilla js, we can use a type inferencer (maybe with some manual annotations) that helps V8 by inlining every involved method, generating something like this:
SInstVarBinding>>valueWithin: anEvaluationContext
^ anEvaluationContext self at: index
Our interpreter is implemented using nice OO practices, but V8 doesn't optimize it well. For example:
reads an ivar for the receiver in the evaluation context, the evaluation context delegates that to the runtime:
then:
and finally:
Instead of generating vanilla js, we can use a type inferencer (maybe with some manual annotations) that helps V8 by inlining every involved method, generating something like this: