| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 symbols[i][62] = 0 | 189 symbols[i][62] = 0 |
| 190 assertEquals(undefined, symbols[i][62]) | 190 assertEquals(undefined, symbols[i][62]) |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 TestSet() | 193 TestSet() |
| 194 | 194 |
| 195 | 195 |
| 196 function TestCollections() { | 196 function TestCollections() { |
| 197 var set = new Set | 197 var set = new Set |
| 198 var map = new Map | 198 var map = new Map |
| 199 var weakmap = new WeakMap | |
| 200 for (var i in symbols) { | 199 for (var i in symbols) { |
| 201 set.add(symbols[i]) | 200 set.add(symbols[i]) |
| 202 map.set(symbols[i], i) | 201 map.set(symbols[i], i) |
| 203 weakmap.set(symbols[i], i) | |
| 204 } | 202 } |
| 205 assertEquals(symbols.length, set.size) | 203 assertEquals(symbols.length, set.size) |
| 206 assertEquals(symbols.length, map.size) | 204 assertEquals(symbols.length, map.size) |
| 207 for (var i in symbols) { | 205 for (var i in symbols) { |
| 208 assertTrue(set.has(symbols[i])) | 206 assertTrue(set.has(symbols[i])) |
| 209 assertTrue(map.has(symbols[i])) | 207 assertTrue(map.has(symbols[i])) |
| 210 assertTrue(weakmap.has(symbols[i])) | |
| 211 assertEquals(i, map.get(symbols[i])) | 208 assertEquals(i, map.get(symbols[i])) |
| 212 assertEquals(i, weakmap.get(symbols[i])) | |
| 213 } | 209 } |
| 214 for (var i in symbols) { | 210 for (var i in symbols) { |
| 215 assertTrue(set.delete(symbols[i])) | 211 assertTrue(set.delete(symbols[i])) |
| 216 assertTrue(map.delete(symbols[i])) | 212 assertTrue(map.delete(symbols[i])) |
| 217 assertTrue(weakmap.delete(symbols[i])) | |
| 218 } | 213 } |
| 219 assertEquals(0, set.size) | 214 assertEquals(0, set.size) |
| 220 assertEquals(0, map.size) | 215 assertEquals(0, map.size) |
| 221 } | 216 } |
| 222 TestCollections() | 217 TestCollections() |
| 223 | 218 |
| 224 | 219 |
| 225 | 220 |
| 226 function TestKeySet(obj) { | 221 function TestKeySet(obj) { |
| 227 assertTrue(%HasFastProperties(obj)) | 222 assertTrue(%HasFastProperties(obj)) |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 obj[sym] = 1 | 345 obj[sym] = 1 |
| 351 freeze(obj) | 346 freeze(obj) |
| 352 obj[sym] = 2 | 347 obj[sym] = 2 |
| 353 assertEquals(2, obj[sym]) | 348 assertEquals(2, obj[sym]) |
| 354 assertTrue(delete obj[sym]) | 349 assertTrue(delete obj[sym]) |
| 355 assertEquals(undefined, obj[sym]) | 350 assertEquals(undefined, obj[sym]) |
| 356 } | 351 } |
| 357 TestSealAndFreeze(Object.seal) | 352 TestSealAndFreeze(Object.seal) |
| 358 TestSealAndFreeze(Object.freeze) | 353 TestSealAndFreeze(Object.freeze) |
| 359 TestSealAndFreeze(Object.preventExtensions) | 354 TestSealAndFreeze(Object.preventExtensions) |
| OLD | NEW |