Counting hidden classes in JavaScript

How to count the total number of hidden classes generated in a JavaScript program using the v8 compiler? or memory used for all generated hidden classes using v8 compiler? Is there another way?

+3


source to share


1 answer


Do you need a number of unique hidden classes?

As I understand it, "hidden classes" in V8 sources are known as "maps". Every heap object in V8 has a map pointer (or bit-coded map id) that takes up 1 word of memory (see v8/src/objects.h

grep for Map, map_word).



Probably the most useful option for you is the v8 option --trace_maps

. Then, if v8 with this option does not give you enough information, you can see where in the source file it will be created and attach it to yourself.

(Disclamer: I'm not on the V8 team, so I might be wrong. I've been cracking v8 for quite some time).

+2


source







All Articles