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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 check_test_base(a, 3, false); | 98 check_test_base(a, 3, false); |
99 | 99 |
100 // Test that we deopt on failed bounds checks. | 100 // Test that we deopt on failed bounds checks. |
101 var dictionary_map_array = new Int32Array(128); | 101 var dictionary_map_array = new Int32Array(128); |
102 test_base(dictionary_map_array, 5, true); | 102 test_base(dictionary_map_array, 5, true); |
103 test_base(dictionary_map_array, 6, true); | 103 test_base(dictionary_map_array, 6, true); |
104 test_base(dictionary_map_array, 5, false); | 104 test_base(dictionary_map_array, 5, false); |
105 test_base(dictionary_map_array, 6, false); | 105 test_base(dictionary_map_array, 6, false); |
106 %OptimizeFunctionOnNextCall(test_base); | 106 %OptimizeFunctionOnNextCall(test_base); |
107 test_base(dictionary_map_array, -2, true); | 107 test_base(dictionary_map_array, -2, true); |
108 assertTrue(%GetOptimizationStatus(test_base) != 1); | 108 assertUnoptimized(test_base); |
109 | 109 |
110 // Forget about the dictionary_map_array's map. | 110 // Forget about the dictionary_map_array's map. |
111 %ClearFunctionTypeFeedback(test_base); | 111 %ClearFunctionTypeFeedback(test_base); |
112 | 112 |
113 test_base(a, 5, true); | 113 test_base(a, 5, true); |
114 test_base(a, 6, true); | 114 test_base(a, 6, true); |
115 test_base(a, 5, false); | 115 test_base(a, 5, false); |
116 test_base(a, 6, false); | 116 test_base(a, 6, false); |
117 %OptimizeFunctionOnNextCall(test_base); | 117 %OptimizeFunctionOnNextCall(test_base); |
118 test_base(a, 2048, true); | 118 test_base(a, 2048, true); |
119 assertTrue(%GetOptimizationStatus(test_base) != 1); | 119 assertUnoptimized(test_base); |
120 | 120 |
121 function test_minus(base,cond) { | 121 function test_minus(base,cond) { |
122 a[base - 1] = 1; | 122 a[base - 1] = 1; |
123 a[base - 2] = 2; | 123 a[base - 2] = 2; |
124 a[base + 4] = 3; | 124 a[base + 4] = 3; |
125 a[base] = 4; | 125 a[base] = 4; |
126 a[base + 4] = base + 4; | 126 a[base + 4] = base + 4; |
127 if (cond) { | 127 if (cond) { |
128 a[base - 4] = 1; | 128 a[base - 4] = 1; |
129 a[base + 5] = 2; | 129 a[base + 5] = 2; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 for (var i = 0; i < short_a.length; i++) short_a[i] = 0; | 166 for (var i = 0; i < short_a.length; i++) short_a[i] = 0; |
167 function short_test(a, i) { | 167 function short_test(a, i) { |
168 a[i + 9] = 0; | 168 a[i + 9] = 0; |
169 a[i - 10] = 0; | 169 a[i - 10] = 0; |
170 } | 170 } |
171 short_test(short_a, 50); | 171 short_test(short_a, 50); |
172 short_test(short_a, 50); | 172 short_test(short_a, 50); |
173 %OptimizeFunctionOnNextCall(short_test); | 173 %OptimizeFunctionOnNextCall(short_test); |
174 short_a.length = 10; | 174 short_a.length = 10; |
175 short_test(short_a, 0); | 175 short_test(short_a, 0); |
176 assertTrue(%GetOptimizationStatus(short_test) != 1); | 176 assertUnoptimized(test_base); |
177 | 177 |
178 | 178 |
179 // A test for when we would modify a phi index. | 179 // A test for when we would modify a phi index. |
180 var data_phi = [0, 1, 2, 3, 4, 5, 6, 7, 8]; | 180 var data_phi = [0, 1, 2, 3, 4, 5, 6, 7, 8]; |
181 function test_phi(a, base, check) { | 181 function test_phi(a, base, check) { |
182 var index; | 182 var index; |
183 if (check) { | 183 if (check) { |
184 index = base + 1; | 184 index = base + 1; |
185 } else { | 185 } else { |
186 index = base + 2; | 186 index = base + 2; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 result_composition = test_composition(data_composition_long, 2); | 222 result_composition = test_composition(data_composition_long, 2); |
223 assertEquals(19, result_composition); | 223 assertEquals(19, result_composition); |
224 result_composition = test_composition(data_composition_long, 2); | 224 result_composition = test_composition(data_composition_long, 2); |
225 assertEquals(19, result_composition); | 225 assertEquals(19, result_composition); |
226 %OptimizeFunctionOnNextCall(test_composition); | 226 %OptimizeFunctionOnNextCall(test_composition); |
227 result_composition = test_composition(data_composition_short, 2); | 227 result_composition = test_composition(data_composition_short, 2); |
228 assertEquals(NaN, result_composition); | 228 assertEquals(NaN, result_composition); |
229 | 229 |
230 | 230 |
231 gc(); | 231 gc(); |
OLD | NEW |