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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 assertTrue(weakmap.delete(symbols[i])) | 206 assertTrue(weakmap.delete(symbols[i])) |
207 } | 207 } |
208 assertEquals(0, set.size) | 208 assertEquals(0, set.size) |
209 assertEquals(0, map.size) | 209 assertEquals(0, map.size) |
210 } | 210 } |
211 TestCollections() | 211 TestCollections() |
212 | 212 |
213 | 213 |
214 | 214 |
215 function TestKeySet(obj) { | 215 function TestKeySet(obj) { |
| 216 assertTrue(%HasFastProperties(obj)) |
216 // Set the even symbols via assignment. | 217 // Set the even symbols via assignment. |
217 for (var i = 0; i < symbols.length; i += 2) { | 218 for (var i = 0; i < symbols.length; i += 2) { |
218 obj[symbols[i]] = i | 219 obj[symbols[i]] = i |
| 220 // Object should remain in fast mode until too many properties were added. |
| 221 assertTrue(%HasFastProperties(obj) || i >= 30) |
219 } | 222 } |
220 } | 223 } |
221 | 224 |
222 | 225 |
223 function TestKeyDefine(obj) { | 226 function TestKeyDefine(obj) { |
224 // Set the odd symbols via defineProperty (as non-enumerable). | 227 // Set the odd symbols via defineProperty (as non-enumerable). |
225 for (var i = 1; i < symbols.length; i += 2) { | 228 for (var i = 1; i < symbols.length; i += 2) { |
226 Object.defineProperty(obj, symbols[i], {value: i, configurable: true}) | 229 Object.defineProperty(obj, symbols[i], {value: i, configurable: true}) |
227 } | 230 } |
228 } | 231 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 var obj = objs[i] | 294 var obj = objs[i] |
292 TestKeySet(obj) | 295 TestKeySet(obj) |
293 TestKeyDefine(obj) | 296 TestKeyDefine(obj) |
294 TestKeyGet(obj) | 297 TestKeyGet(obj) |
295 TestKeyHas(obj) | 298 TestKeyHas(obj) |
296 TestKeyEnum(obj) | 299 TestKeyEnum(obj) |
297 TestKeyNames(obj) | 300 TestKeyNames(obj) |
298 TestKeyDescriptor(obj) | 301 TestKeyDescriptor(obj) |
299 TestKeyDelete(obj) | 302 TestKeyDelete(obj) |
300 } | 303 } |
OLD | NEW |