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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 assertSame(Symbol.prototype, (new Symbol()).__proto__) | 75 assertSame(Symbol.prototype, (new Symbol()).__proto__) |
76 assertSame(Symbol.prototype, (new Symbol(Symbol())).__proto__) | 76 assertSame(Symbol.prototype, (new Symbol(Symbol())).__proto__) |
77 assertSame(Symbol.prototype, Object(Symbol()).__proto__) | 77 assertSame(Symbol.prototype, Object(Symbol()).__proto__) |
78 for (var i in symbols) { | 78 for (var i in symbols) { |
79 assertSame(Symbol.prototype, symbols[i].__proto__) | 79 assertSame(Symbol.prototype, symbols[i].__proto__) |
80 } | 80 } |
81 } | 81 } |
82 TestPrototype() | 82 TestPrototype() |
83 | 83 |
84 | 84 |
| 85 function TestConstructor() { |
| 86 assertFalse(Object === Symbol.prototype.constructor) |
| 87 assertFalse(Symbol === Object.prototype.constructor) |
| 88 assertSame(Symbol, Symbol.prototype.constructor) |
| 89 assertSame(Symbol, Symbol().__proto__.constructor) |
| 90 assertSame(Symbol, Symbol(Symbol()).__proto__.constructor) |
| 91 assertSame(Symbol, (new Symbol).__proto__.constructor) |
| 92 assertSame(Symbol, (new Symbol()).__proto__.constructor) |
| 93 assertSame(Symbol, (new Symbol(Symbol())).__proto__.constructor) |
| 94 assertSame(Symbol, Object(Symbol()).__proto__.constructor) |
| 95 for (var i in symbols) { |
| 96 assertSame(Symbol, symbols[i].__proto__.constructor) |
| 97 } |
| 98 } |
| 99 TestConstructor() |
| 100 |
| 101 |
85 function TestName() { | 102 function TestName() { |
86 for (var i in symbols) { | 103 for (var i in symbols) { |
87 var name = symbols[i].name | 104 var name = symbols[i].name |
88 assertTrue(name === undefined || name === "66") | 105 assertTrue(name === undefined || name === "66") |
89 } | 106 } |
90 } | 107 } |
91 TestName() | 108 TestName() |
92 | 109 |
93 | 110 |
94 function TestToString() { | 111 function TestToString() { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 // but not between scavenges. This must also apply for symbol keys. | 342 // but not between scavenges. This must also apply for symbol keys. |
326 var key = Symbol("key"); | 343 var key = Symbol("key"); |
327 var a = {}; | 344 var a = {}; |
328 a[key] = "abc"; | 345 a[key] = "abc"; |
329 | 346 |
330 for (var i = 0; i < 1000000; i++) { | 347 for (var i = 0; i < 1000000; i++) { |
331 a[key] += "a"; // Allocations cause a scavenge. | 348 a[key] += "a"; // Allocations cause a scavenge. |
332 } | 349 } |
333 } | 350 } |
334 TestCachedKeyAfterScavenge(); | 351 TestCachedKeyAfterScavenge(); |
OLD | NEW |