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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 check_test_minus(7,true); | 116 check_test_minus(7,true); |
117 test_minus(7,false); | 117 test_minus(7,false); |
118 check_test_minus(7,false); | 118 check_test_minus(7,false); |
119 | 119 |
120 // Optimization status: | 120 // Optimization status: |
121 // YES: 1 | 121 // YES: 1 |
122 // NO: 2 | 122 // NO: 2 |
123 // ALWAYS: 3 | 123 // ALWAYS: 3 |
124 // NEVER: 4 | 124 // NEVER: 4 |
125 | 125 |
126 if (false) { | 126 // Test that we still deopt on failed bound checks |
127 test_base(5,true); | 127 test_base(5,true); |
128 test_base(6,true); | 128 test_base(6,true); |
129 test_base(5,false); | 129 test_base(5,false); |
130 test_base(6,false); | 130 test_base(6,false); |
131 %OptimizeFunctionOnNextCall(test_base); | 131 %OptimizeFunctionOnNextCall(test_base); |
132 test_base(-2,true); | 132 test_base(-2,true); |
133 assertTrue(%GetOptimizationStatus(test_base) != 1); | 133 assertTrue(%GetOptimizationStatus(test_base) != 1); |
134 | 134 |
135 test_base(5,true); | 135 test_base(5,true); |
136 test_base(6,true); | 136 test_base(6,true); |
137 test_base(5,false); | 137 test_base(5,false); |
138 test_base(6,false); | 138 test_base(6,false); |
139 %OptimizeFunctionOnNextCall(test_base); | 139 %OptimizeFunctionOnNextCall(test_base); |
140 test_base(2048,true); | 140 test_base(2048,true); |
141 assertTrue(%GetOptimizationStatus(test_base) != 1); | 141 assertTrue(%GetOptimizationStatus(test_base) != 1); |
| 142 |
| 143 // Specific test on negative offsets |
| 144 var short_a = new Array(100); |
| 145 for (var i = 0; i < short_a.length; i++) short_a[i] = 0; |
| 146 function short_test(a, i) { |
| 147 a[i + 9] = 0; |
| 148 a[i - 10] = 0; |
142 } | 149 } |
| 150 short_test(short_a, 50); |
| 151 short_test(short_a, 50); |
| 152 %OptimizeFunctionOnNextCall(short_test); |
| 153 short_a.length = 10; |
| 154 short_test(a, 0); |
| 155 assertTrue(%GetOptimizationStatus(short_test) != 1); |
| 156 |
143 | 157 |
144 gc(); | 158 gc(); |
145 | 159 |
OLD | NEW |