Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: test/mjsunit/harmony/private.js

Issue 203243004: Implement ES6 symbol registry and predefined symbols (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed bug Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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()
OLDNEW
« src/symbol.js ('K') | « src/symbol.js ('k') | test/mjsunit/harmony/symbols.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698