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

Side by Side Diff: test/mjsunit/es6/symbols.js

Issue 394443002: Revert "Include symbol properties in Object.{create,defineProperties}" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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
« no previous file with comments | « src/v8natives.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 TestKeyGet(obj) 360 TestKeyGet(obj)
361 TestKeyHas(obj) 361 TestKeyHas(obj)
362 TestKeyEnum(obj) 362 TestKeyEnum(obj)
363 TestKeyNames(obj) 363 TestKeyNames(obj)
364 TestGetOwnPropertySymbols(obj) 364 TestGetOwnPropertySymbols(obj)
365 TestKeyDescriptor(obj) 365 TestKeyDescriptor(obj)
366 TestKeyDelete(obj) 366 TestKeyDelete(obj)
367 } 367 }
368 368
369 369
370 function TestDefineProperties() {
371 var properties = {}
372 for (var i in symbols) {
373 Object.defineProperty(
374 properties, symbols[i], {value: {value: i}, enumerable: i % 2 === 0})
375 }
376 var o = Object.defineProperties({}, properties)
377 for (var i in symbols) {
378 assertEquals(i % 2 === 0, symbols[i] in o)
379 }
380 }
381 TestDefineProperties()
382
383
384 function TestCreate() {
385 var properties = {}
386 for (var i in symbols) {
387 Object.defineProperty(
388 properties, symbols[i], {value: {value: i}, enumerable: i % 2 === 0})
389 }
390 var o = Object.create(Object.prototype, properties)
391 for (var i in symbols) {
392 assertEquals(i % 2 === 0, symbols[i] in o)
393 }
394 }
395 TestCreate()
396
397
398 function TestCachedKeyAfterScavenge() { 370 function TestCachedKeyAfterScavenge() {
399 gc(); 371 gc();
400 // Keyed property lookup are cached. Hereby we assume that the keys are 372 // Keyed property lookup are cached. Hereby we assume that the keys are
401 // tenured, so that we only have to clear the cache between mark compacts, 373 // tenured, so that we only have to clear the cache between mark compacts,
402 // but not between scavenges. This must also apply for symbol keys. 374 // but not between scavenges. This must also apply for symbol keys.
403 var key = Symbol("key"); 375 var key = Symbol("key");
404 var a = {}; 376 var a = {};
405 a[key] = "abc"; 377 a[key] = "abc";
406 378
407 for (var i = 0; i < 100000; i++) { 379 for (var i = 0; i < 100000; i++) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 Realm.shared = symbol1 459 Realm.shared = symbol1
488 assertSame("x1", Realm.eval(realm, "Symbol.keyFor(Realm.shared)")) 460 assertSame("x1", Realm.eval(realm, "Symbol.keyFor(Realm.shared)"))
489 461
490 var symbol3 = Realm.eval(realm, "Symbol.for('x3')") 462 var symbol3 = Realm.eval(realm, "Symbol.for('x3')")
491 assertFalse(symbol1 === symbol3) 463 assertFalse(symbol1 === symbol3)
492 assertFalse(symbol2 === symbol3) 464 assertFalse(symbol2 === symbol3)
493 assertSame(symbol3, Symbol.for("x3")) 465 assertSame(symbol3, Symbol.for("x3"))
494 assertSame("x3", Symbol.keyFor(symbol3)) 466 assertSame("x3", Symbol.keyFor(symbol3))
495 } 467 }
496 TestRegistry() 468 TestRegistry()
OLDNEW
« no previous file with comments | « src/v8natives.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698