OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 assertEquals({}, a4.shift()); | 267 assertEquals({}, a4.shift()); |
268 assertTrue(%HasFastObjectElements(a4)); | 268 assertTrue(%HasFastObjectElements(a4)); |
269 | 269 |
270 // Unshift | 270 // Unshift |
271 var a4 = [1,2,3]; | 271 var a4 = [1,2,3]; |
272 a4.unshift(1); | 272 a4.unshift(1); |
273 assertTrue(%HasFastSmiElements(a4)); | 273 assertTrue(%HasFastSmiElements(a4)); |
274 assertEquals([1,1,2,3], a4); | 274 assertEquals([1,1,2,3], a4); |
275 a4 = [1,2,3]; | 275 a4 = [1,2,3]; |
276 a4.unshift(1.1); | 276 a4.unshift(1.1); |
277 // TODO(verwaest): We'll want to support double unshifting as well. | 277 assertTrue(%HasFastDoubleElements(a4)); |
278 // assertTrue(%HasFastDoubleElements(a4)); | |
279 assertTrue(%HasFastObjectElements(a4)); | |
280 assertEquals([1.1,1,2,3], a4); | 278 assertEquals([1.1,1,2,3], a4); |
281 a4 = [1.1,2,3]; | 279 a4 = [1.1,2,3]; |
282 a4.unshift(1); | 280 a4.unshift(1); |
283 assertTrue(%HasFastDoubleElements(a4)); | 281 assertTrue(%HasFastDoubleElements(a4)); |
284 assertEquals([1,1.1,2,3], a4); | 282 assertEquals([1,1.1,2,3], a4); |
285 a4 = [{},2,3]; | 283 a4 = [{},2,3]; |
286 a4.unshift(1); | 284 a4.unshift(1); |
287 assertTrue(%HasFastObjectElements(a4)); | 285 assertTrue(%HasFastObjectElements(a4)); |
288 assertEquals([1,{},2,3], a4); | 286 assertEquals([1,{},2,3], a4); |
289 a4 = [{},2,3]; | 287 a4 = [{},2,3]; |
290 a4.unshift(1.1); | 288 a4.unshift(1.1); |
291 assertTrue(%HasFastObjectElements(a4)); | 289 assertTrue(%HasFastObjectElements(a4)); |
292 assertEquals([1.1,{},2,3], a4); | 290 assertEquals([1.1,{},2,3], a4); |
293 } | 291 } |
294 | 292 |
295 for (var i = 0; i < 3; i++) { | 293 for (var i = 0; i < 3; i++) { |
296 array_natives_test(); | 294 array_natives_test(); |
297 } | 295 } |
298 %OptimizeFunctionOnNextCall(array_natives_test); | 296 %OptimizeFunctionOnNextCall(array_natives_test); |
299 array_natives_test(); | 297 array_natives_test(); |
OLD | NEW |