Index: test/mjsunit/harmony/private.js |
diff --git a/test/mjsunit/harmony/private.js b/test/mjsunit/harmony/private.js |
index c08daf105055cfcc9ac8ea940c4372bf0b8e0803..0adbb13b21a38f70730cc691416f0b8e31b10f36 100644 |
--- a/test/mjsunit/harmony/private.js |
+++ b/test/mjsunit/harmony/private.js |
@@ -241,7 +241,8 @@ function TestKeyGet(obj) { |
var obj2 = Object.create(obj) |
for (var i in symbols) { |
assertEquals(i|0, obj[symbols[i]]) |
- assertEquals(i|0, obj2[symbols[i]]) |
+ // Private symbols key own-properties. |
+ assertEquals(undefined, obj2[symbols[i]]) |
} |
} |
@@ -352,3 +353,52 @@ function TestSealAndFreeze(freeze) { |
TestSealAndFreeze(Object.seal) |
TestSealAndFreeze(Object.freeze) |
TestSealAndFreeze(Object.preventExtensions) |
+ |
+ |
+var s = %CreatePrivateSymbol("s"); |
+var s1 = %CreatePrivateSymbol("s1"); |
+ |
+function TestSimple() { |
+ var p = {} |
+ p[s] = "moo"; |
+ |
+ var o = Object.create(p); |
+ |
+ assertEquals(undefined, o[s]); |
+ assertEquals("moo", p[s]); |
+ |
+ o[s] = "bow-wow"; |
+ assertEquals("bow-wow", o[s]); |
+ assertEquals("moo", p[s]); |
+} |
+TestSimple(); |
+ |
+ |
+function TestICs() { |
+ var p = {} |
+ p[s] = "moo"; |
+ |
+ |
+ var o = Object.create(p); |
+ o[s1] = "bow-wow"; |
+ function checkNonOwn(o) { |
+ assertEquals(undefined, o[s]); |
+ assertEquals("bow-wow", o[s1]); |
+ } |
+ |
+ checkNonOwn(o); |
+ |
+ // Test monomorphic/optimized. |
+ for (var i = 0; i < 1000; i++) { |
+ checkNonOwn(o); |
+ } |
+ |
+ // Test non-monomorphic. |
+ for (var i = 0; i < 1000; i++) { |
+ var oNew = Object.create(p); |
+ oNew["s" + i] = i; |
+ oNew[s1] = "bow-wow"; |
+ checkNonOwn(oNew); |
+ } |
+} |
+TestICs(); |