3 ms·
> Or could there be a way to alter the execution graph so that once you add in the optimization, you never have to check if it's there? One of the things V8 do
by Leszek 6y ago
> Or could there be a way to alter the execution graph so that once you add in the optimization, you never have to check if it's there?
One of the things V8 does is store "field dependencies" -- a list of optimized code attached to fields that is invalidated if that field is modified in a certain way. The optimized code is known to only access that field in a certain way, thus doesn't need to check it, so this only slows down unoptimized paths (and only on their slow paths too, since even unoptimized code has fast paths for known access patterns thanks to inline caches). Comes with a memory/generality cost though, so this isn't used for every type of check.