(n: number)
| 53 | |
| 54 | // Compress arbitrarily large numbers into smi hashes. |
| 55 | function hashNumber(n: number): number { |
| 56 | if (n !== n || n === Infinity) { |
| 57 | return 0; |
| 58 | } |
| 59 | let hash = n | 0; |
| 60 | if (hash !== n) { |
| 61 | hash ^= n * 0xffffffff; |
| 62 | } |
| 63 | while (n > 0xffffffff) { |
| 64 | n /= 0xffffffff; |
| 65 | hash ^= n; |
| 66 | } |
| 67 | return smi(hash); |
| 68 | } |
| 69 | |
| 70 | function cachedHashString(string: string): number { |
| 71 | let hashed = stringHashCache[string]; |