| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 %OptimizeFunctionOnNextCall(toarr); | 151 %OptimizeFunctionOnNextCall(toarr); |
| 152 assertArrayEquals([3, 2, 1], toarr(marker, 2, 4, 6)); | 152 assertArrayEquals([3, 2, 1], toarr(marker, 2, 4, 6)); |
| 153 delete marker.x; | 153 delete marker.x; |
| 154 assertArrayEquals([3, 2, 1], toarr(marker, 2, 4, 6)); | 154 assertArrayEquals([3, 2, 1], toarr(marker, 2, 4, 6)); |
| 155 } | 155 } |
| 156 | 156 |
| 157 test_toarr(toarr1); | 157 test_toarr(toarr1); |
| 158 test_toarr(toarr2); | 158 test_toarr(toarr2); |
| 159 | 159 |
| 160 // Test that arguments access from inlined function uses correct values. | 160 // Test that arguments access from inlined function uses correct values. |
| 161 // TODO(mstarzinger): Tests disabled, see bug 2261 |
| 162 /* |
| 161 (function () { | 163 (function () { |
| 162 function inner(x, y) { | 164 function inner(x, y) { |
| 163 "use strict"; | 165 "use strict"; |
| 166 x = 10; |
| 167 y = 20; |
| 168 for (var i = 0; i < 1; i++) { |
| 169 for (var j = 1; j <= arguments.length; j++) { |
| 170 return arguments[arguments.length - j]; |
| 171 } |
| 172 } |
| 173 } |
| 174 |
| 175 function outer(x, y) { |
| 176 return inner(x, y); |
| 177 } |
| 178 |
| 179 %OptimizeFunctionOnNextCall(outer); |
| 180 %OptimizeFunctionOnNextCall(inner); |
| 181 assertEquals(2, outer(1, 2)); |
| 182 })(); |
| 183 |
| 184 |
| 185 (function () { |
| 186 function inner(x, y) { |
| 187 "use strict"; |
| 164 x = 10; | 188 x = 10; |
| 165 y = 20; | 189 y = 20; |
| 166 for (var i = 0; i < 1; i++) { | 190 for (var i = 0; i < 1; i++) { |
| 167 for (var j = 1; j <= arguments.length; j++) { | 191 for (var j = 1; j <= arguments.length; j++) { |
| 168 return arguments[arguments.length - j]; | 192 return arguments[arguments.length - j]; |
| 169 } | 193 } |
| 170 } | 194 } |
| 171 } | 195 } |
| 172 | 196 |
| 173 function outer(x, y) { | 197 function outer(x, y) { |
| 174 return inner(x, y); | 198 return inner(x, y); |
| 175 } | 199 } |
| 176 | 200 |
| 177 assertEquals(2, outer(1, 2)); | 201 assertEquals(2, outer(1, 2)); |
| 178 assertEquals(2, outer(1, 2)); | 202 assertEquals(2, outer(1, 2)); |
| 179 assertEquals(2, outer(1, 2)); | 203 assertEquals(2, outer(1, 2)); |
| 180 %OptimizeFunctionOnNextCall(outer); | 204 %OptimizeFunctionOnNextCall(outer); |
| 181 assertEquals(2, outer(1, 2)); | 205 assertEquals(2, outer(1, 2)); |
| 182 })(); | 206 })(); |
| 207 */ |
| OLD | NEW |