OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 // but not between scavenges. This must also apply for symbol keys. | 321 // but not between scavenges. This must also apply for symbol keys. |
322 var key = Symbol("key"); | 322 var key = Symbol("key"); |
323 var a = {}; | 323 var a = {}; |
324 a[key] = "abc"; | 324 a[key] = "abc"; |
325 | 325 |
326 for (var i = 0; i < 100000; i++) { | 326 for (var i = 0; i < 100000; i++) { |
327 a[key] += "a"; // Allocations cause a scavenge. | 327 a[key] += "a"; // Allocations cause a scavenge. |
328 } | 328 } |
329 } | 329 } |
330 TestCachedKeyAfterScavenge(); | 330 TestCachedKeyAfterScavenge(); |
331 | |
332 | |
333 function TestGetOwnPropertySymbols() { | |
334 var privateSymbol = %CreatePrivateSymbol("private") | |
335 var publicSymbol = Symbol() | |
336 var publicSymbol2 = Symbol() | |
337 var obj = {} | |
338 obj[publicSymbol] = 1 | |
339 obj[privateSymbol] = 2 | |
340 obj[publicSymbol2] = 3 | |
341 var syms = Object.getOwnPropertySymbols(obj) | |
342 assertEquals(syms, [publicSymbol, publicSymbol2]) | |
343 } | |
344 TestGetOwnPropertySymbols() | |
OLD | NEW |