| 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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 } | 493 } |
| 494 | 494 |
| 495 assertUnoptimized = function assertUnoptimized(fun, sync_opt, name_opt) { | 495 assertUnoptimized = function assertUnoptimized(fun, sync_opt, name_opt) { |
| 496 if (sync_opt === undefined) sync_opt = ""; | 496 if (sync_opt === undefined) sync_opt = ""; |
| 497 var opt_status = OptimizationStatus(fun, sync_opt); | 497 var opt_status = OptimizationStatus(fun, sync_opt); |
| 498 // Tests that use assertOptimized() do not make sense if --always-opt | 498 // Tests that use assertOptimized() do not make sense if --always-opt |
| 499 // option is provided. Such tests must add --no-always-opt to flags comment. | 499 // option is provided. Such tests must add --no-always-opt to flags comment. |
| 500 assertFalse((opt_status & V8OptimizationStatus.kAlwaysOptimize) !== 0, | 500 assertFalse((opt_status & V8OptimizationStatus.kAlwaysOptimize) !== 0, |
| 501 "test does not make sense with --always-opt"); | 501 "test does not make sense with --always-opt"); |
| 502 assertTrue((opt_status & V8OptimizationStatus.kIsFunction) !== 0, name_opt); | 502 assertTrue((opt_status & V8OptimizationStatus.kIsFunction) !== 0, name_opt); |
| 503 if ((opt_status & V8OptimizationStatus.kMaybeDeopted) !== 0) { |
| 504 // When --deopt-every-n-times flag is specified it's no longer guaranteed |
| 505 // that particular function is still deoptimized, so keep running the test |
| 506 // to stress test the deoptimizer. |
| 507 return; |
| 508 } |
| 503 assertFalse((opt_status & V8OptimizationStatus.kOptimized) !== 0, name_opt); | 509 assertFalse((opt_status & V8OptimizationStatus.kOptimized) !== 0, name_opt); |
| 504 } | 510 } |
| 505 | 511 |
| 506 assertOptimized = function assertOptimized(fun, sync_opt, name_opt) { | 512 assertOptimized = function assertOptimized(fun, sync_opt, name_opt) { |
| 507 if (sync_opt === undefined) sync_opt = ""; | 513 if (sync_opt === undefined) sync_opt = ""; |
| 508 var opt_status = OptimizationStatus(fun, sync_opt); | 514 var opt_status = OptimizationStatus(fun, sync_opt); |
| 509 // Tests that use assertOptimized() do not make sense if --no-crankshaft | 515 // Tests that use assertOptimized() do not make sense if --no-crankshaft |
| 510 // option is provided. Such tests must add --crankshaft to flags comment. | 516 // option is provided. Such tests must add --crankshaft to flags comment. |
| 511 assertFalse((opt_status & V8OptimizationStatus.kNeverOptimize) !== 0, | 517 assertFalse((opt_status & V8OptimizationStatus.kNeverOptimize) !== 0, |
| 512 "test does not make sense with --no-crankshaft"); | 518 "test does not make sense with --no-crankshaft"); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 | 571 |
| 566 isTurboFanned = function isTurboFanned(fun) { | 572 isTurboFanned = function isTurboFanned(fun) { |
| 567 var opt_status = OptimizationStatus(fun, ""); | 573 var opt_status = OptimizationStatus(fun, ""); |
| 568 assertTrue((opt_status & V8OptimizationStatus.kIsFunction) !== 0, | 574 assertTrue((opt_status & V8OptimizationStatus.kIsFunction) !== 0, |
| 569 "not a function"); | 575 "not a function"); |
| 570 return (opt_status & V8OptimizationStatus.kOptimized) !== 0 && | 576 return (opt_status & V8OptimizationStatus.kOptimized) !== 0 && |
| 571 (opt_status & V8OptimizationStatus.kTurboFanned) !== 0; | 577 (opt_status & V8OptimizationStatus.kTurboFanned) !== 0; |
| 572 } | 578 } |
| 573 | 579 |
| 574 })(); | 580 })(); |
| OLD | NEW |