| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 assertEquals(array[0], at0); | 151 assertEquals(array[0], at0); |
| 152 assertEquals(array[1], undefined); | 152 assertEquals(array[1], undefined); |
| 153 assertEquals(array[2], at2); | 153 assertEquals(array[2], at2); |
| 154 })(); | 154 })(); |
| 155 | 155 |
| 156 | 156 |
| 157 // Now check the case with array of holes and some elements on prototype. | 157 // Now check the case with array of holes and some elements on prototype. |
| 158 (function() { | 158 (function() { |
| 159 var len = 9; | 159 var len = 9; |
| 160 var array = new Array(len); | 160 var array = new Array(len); |
| 161 var array_proto = [] | 161 var array_proto = []; |
| 162 array_proto[3] = "@3"; | 162 array_proto[3] = "@3"; |
| 163 array_proto[7] = "@7"; | 163 array_proto[7] = "@7"; |
| 164 array.__proto__ = array_proto; | 164 array.__proto__ = array_proto; |
| 165 | 165 |
| 166 assertEquals(len, array.length); | 166 assertEquals(len, array.length); |
| 167 for (var i = 0; i < array.length; i++) { | 167 for (var i = 0; i < array.length; i++) { |
| 168 assertEquals(array[i], array_proto[i]); | 168 assertEquals(array[i], array_proto[i]); |
| 169 } | 169 } |
| 170 | 170 |
| 171 assertEquals(len + 1, array.unshift('head')); | 171 assertEquals(len + 1, array.unshift('head')); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 } | 206 } |
| 207 })(); | 207 })(); |
| 208 | 208 |
| 209 (function() { | 209 (function() { |
| 210 for (var i = 0; i < 7; i++) { | 210 for (var i = 0; i < 7; i++) { |
| 211 var a = [6, 7, 8, 9]; | 211 var a = [6, 7, 8, 9]; |
| 212 a.unshift(1, 2, 3, 4, 5); | 212 a.unshift(1, 2, 3, 4, 5); |
| 213 assertEquals([1, 2, 3, 4, 5, 6, 7, 8, 9], a); | 213 assertEquals([1, 2, 3, 4, 5, 6, 7, 8, 9], a); |
| 214 } | 214 } |
| 215 })(); | 215 })(); |
| OLD | NEW |