Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 assertTrue(typeof(global) === "object"); // Global object. | |
|
Toon Verwaest
2015/05/26 09:06:27
assertEquals("object", typeof global);
Erik Corry Chromium.org
2015/05/26 09:51:32
Done.
| |
| 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)); | |
| OLD | NEW |