> What is the difference internally between SetInternalField(), which is > a bit annoying because you need to do SetInternalFieldSize() on the > function template, and the simpler SetHiddenField()? Would it make > sense to remove SetInteralField() and only have SetHiddenField() > (modulo compatibility problems)?
Hidden fields are more flexible and general but also fairly expensive, more expensive than ordinary object properties. If you can live with the overhead you're probably best off using hidden fields; conversely, if your application spends a lot of time reading these fields (as chromium does) you're probably better off using the internal variant. Implementation wise, room is allocated for the required number of internal fields directly in every object created from a function template and getting/setting them is more or less as simple as getting/setting elements in a C++ array. An object's hidden fields are stored as normal properties on a separate object that is created and associated with the original object the first time you set a hidden property. This means that getting/setting a hidden property takes two lookups: first find the hidden property object, then get/set the property on it. -- Christian -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
