Remove the dependency on WeakHashMap.

Because it won't work in Scala.js.