| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 assertEquals(0, f3()); | 237 assertEquals(0, f3()); |
| 238 | 238 |
| 239 function f4() { | 239 function f4() { |
| 240 return 'abcbc'.indexOf('bc', 2); | 240 return 'abcbc'.indexOf('bc', 2); |
| 241 } | 241 } |
| 242 assertEquals(3, f4()); | 242 assertEquals(3, f4()); |
| 243 assertEquals(3, f4()); | 243 assertEquals(3, f4()); |
| 244 assertEquals(3, f4()); | 244 assertEquals(3, f4()); |
| 245 % OptimizeFunctionOnNextCall(f4); | 245 % OptimizeFunctionOnNextCall(f4); |
| 246 assertEquals(3, f4()); | 246 assertEquals(3, f4()); |
| 247 |
| 248 function f5() { |
| 249 return 'abcbc'.indexOf('b', -1); |
| 250 } |
| 251 assertEquals(1, f5()); |
| 252 assertEquals(1, f5()); |
| 253 assertEquals(1, f5()); |
| 254 % OptimizeFunctionOnNextCall(f5); |
| 255 assertEquals(1, f5()); |
| 256 |
| 257 function f6() { |
| 258 return 'abcbc'.indexOf('b', -10737418); |
| 259 } |
| 260 assertEquals(1, f6()); |
| 261 assertEquals(1, f6()); |
| 262 assertEquals(1, f6()); |
| 263 % OptimizeFunctionOnNextCall(f6); |
| 264 assertEquals(1, f6()); |
| 247 })(); | 265 })(); |
| 248 | 266 |
| 249 (function optimizeOSR() { | 267 (function optimizeOSR() { |
| 250 function f() { | 268 function f() { |
| 251 var result; | 269 var result; |
| 252 for (var i = 0; i < 100000; i++) { | 270 for (var i = 0; i < 100000; i++) { |
| 253 result = 'abc'.indexOf('a'); | 271 result = 'abc'.indexOf('a'); |
| 254 } | 272 } |
| 255 return result; | 273 return result; |
| 256 } | 274 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 276 | 294 |
| 277 function f4() { | 295 function f4() { |
| 278 var result; | 296 var result; |
| 279 for (var i = 0; i < 100000; i++) { | 297 for (var i = 0; i < 100000; i++) { |
| 280 result = 'abcbc'.indexOf('bc', 2); | 298 result = 'abcbc'.indexOf('bc', 2); |
| 281 } | 299 } |
| 282 return result; | 300 return result; |
| 283 } | 301 } |
| 284 assertEquals(3, f4()); | 302 assertEquals(3, f4()); |
| 285 })(); | 303 })(); |
| OLD | NEW |