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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 var a = [1,2,3]; | 139 var a = [1,2,3]; |
140 a.f = function() { return 10; } | 140 a.f = function() { return 10; } |
141 f(a, 4); | 141 f(a, 4); |
142 f(a, 5); | 142 f(a, 5); |
143 f(a, 6); | 143 f(a, 6); |
144 %OptimizeFunctionOnNextCall(f); | 144 %OptimizeFunctionOnNextCall(f); |
145 f(a, 7); | 145 f(a, 7); |
146 f(a, {}); | 146 f(a, {}); |
147 assertEquals(10, a.f()); | 147 assertEquals(10, a.f()); |
148 })(); | 148 })(); |
| 149 |
| 150 |
| 151 (function testDoubleArrayPush() { |
| 152 var a = []; |
| 153 var max = 1000; |
| 154 for (var i = 0; i < max; i++) { |
| 155 a.push(i + 0.1); |
| 156 } |
| 157 assertEquals(max, a.length); |
| 158 for (var i = 0; i < max; i++) { |
| 159 assertEquals(i+0.1, a[i]); |
| 160 } |
| 161 })(); |
OLD | NEW |