Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 1 | // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | var global = this; |
| 6 | |
| 7 | assertEquals("object", typeof global); // Global object. |
| 8 | |
| 9 | var s = new Set(); |
| 10 | s.add(global); // Puts a hash code on the global object. |
| 11 | assertTrue(s.has(global)); |
| 12 | for (var i = 0; i < 100; i++) { |
| 13 | // Force rehash. Global object is placed according to the hash code that it |
| 14 | // gets in the C++ runtime. |
| 15 | s.add(i); |
| 16 | } |
| 17 | |
| 18 | // Hopefully still findable using the JS hash code. |
| 19 | assertTrue(s.has(global)); |