2013/7/15 Brendan Eich <[email protected]> > Andreas Rossberg wrote: > >> Yes, VMs do a lot to handle these cases well, and e.g. produce a flat >> object representation for such examples. But like with all those >> optimisations they are just optimistic, you still need to guard all >> over the place, because JavaScript semantics is rather deprived of >> useful invariants. There is very little that provably holds for a >> larger region of code or for a non-trivial extend of object life time. >> So you get tons of repetitive checks even in optimised code. >> > > That's one way to do it. Another is to invalidate more aggressively > optimized, less-guarded code when the unlikely bad thing happens.
What is the expected improvements from const/sealed classes against such a strategy? Same question for checked type annotation? (are type annotation a form of "userland" guard?) Unrelated, but I'm curious: What do engines do when they face an object-as-map (random and potentially numerous keys)? Do they try to find a shape/hidden class and give up after realizing that the object really isn't stable? Do you have stats (I also take guesstimates) on how often object-as-map occur against "class-ed" objects? Will the use of ES6 maps to replace object-as-map make a significant dfference as far as perf is concerned? Thanks, David
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

