| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 */ | 130 */ |
| 131 OptTracker.prototype.DisableAsserts_ = function(func) { | 131 OptTracker.prototype.DisableAsserts_ = function(func) { |
| 132 switch(%GetOptimizationStatus(func)) { | 132 switch(%GetOptimizationStatus(func)) { |
| 133 case OptTracker.OptimizationState.YES: | 133 case OptTracker.OptimizationState.YES: |
| 134 case OptTracker.OptimizationState.NO: | 134 case OptTracker.OptimizationState.NO: |
| 135 return false; | 135 return false; |
| 136 case OptTracker.OptimizationState.ALWAYS: | 136 case OptTracker.OptimizationState.ALWAYS: |
| 137 case OptTracker.OptimizationState.NEVER: | 137 case OptTracker.OptimizationState.NEVER: |
| 138 return true; | 138 return true; |
| 139 } | 139 } |
| 140 return false; | 140 return true; |
| 141 } | 141 } |
| 142 // (End of class OptTracker.) | 142 // (End of class OptTracker.) |
| 143 | 143 |
| 144 // Example function used by the test below. | 144 // Example function used by the test below. |
| 145 function f(a) { | 145 function f(a) { |
| 146 return a+1; | 146 return a+1; |
| 147 } | 147 } |
| 148 | 148 |
| 149 var tracker = new OptTracker(); | 149 var tracker = new OptTracker(); |
| 150 tracker.CheckpointOptCount(f); | 150 tracker.CheckpointOptCount(f); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 174 // Let's trigger optimization for another type. | 174 // Let's trigger optimization for another type. |
| 175 for (var i = 0; i < 5; i++) f("a"); | 175 for (var i = 0; i < 5; i++) f("a"); |
| 176 | 176 |
| 177 %OptimizeFunctionOnNextCall(f); | 177 %OptimizeFunctionOnNextCall(f); |
| 178 f("b"); | 178 f("b"); |
| 179 | 179 |
| 180 tracker.AssertOptCount(f, 2); | 180 tracker.AssertOptCount(f, 2); |
| 181 tracker.AssertIsOptimized(f, true); | 181 tracker.AssertIsOptimized(f, true); |
| 182 tracker.AssertDeoptHappened(f, true); | 182 tracker.AssertDeoptHappened(f, true); |
| 183 tracker.AssertDeoptCount(f, 1); | 183 tracker.AssertDeoptCount(f, 1); |
| OLD | NEW |