Removal of WeakMap/WeakSet clear

Steve Fink sphink at gmail.com
Thu Dec 4 21:24:08 PST 2014


On 12/04/2014 08:00 PM, Katelyn Gadd wrote:
> I do still use WeakMap in a few other places, for example to implement
> Object.GetHashCode. This is a case where the transposed representation
> is likely optimal - though in practice, I shouldn't need any sort of
> container here, if only the hashing mechanisms clearly built into the
> VM were exposed to user JS.

If I am understanding correctly, I don't think there is any such hashing
mechanism in the Spidermonkey VM. We hash on an object's pointer
address, which can change during a moving GC. (We update any hashtables
that incorporate an object's numeric address into their hash key
computations.)

I'm a little curious what you're generating the hashcode from. Is this
mimicking a value object? If the contents of the object change, would
you want the hashcode to change? Or are the "hashcodes" just
incrementing numerical object ids?

(Sorry for the tangent to the current thread.)



More information about the es-discuss mailing list