| 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 11 matching lines...) Expand all Loading... |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 // Flags: --allow-natives-syntax --expose-gc | 28 // Flags: --allow-natives-syntax --expose-gc |
| 29 | 29 |
| 30 var a = new Int32Array(1024); | 30 var a = new Int32Array(1024); |
| 31 | 31 |
| 32 // Test that we do not assert if the accessed index has not an int32 rep. | |
| 33 var v = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; | |
| 34 function test_do_not_assert_on_non_int32(vector, base) { | |
| 35 var r = 0; | |
| 36 var a1 = base + 1; | |
| 37 var a2 = base + 2; | |
| 38 var a3 = base + 3; | |
| 39 var a4 = base + 4; | |
| 40 if (a1 == 2) { | |
| 41 r += vector[a1]; | |
| 42 r += vector[a4]; | |
| 43 r += vector[a2]; | |
| 44 r += vector[a3]; | |
| 45 } | |
| 46 return r; | |
| 47 } | |
| 48 test_do_not_assert_on_non_int32(v,1); | |
| 49 test_do_not_assert_on_non_int32(v,1); | |
| 50 test_do_not_assert_on_non_int32(v,"a"); | |
| 51 test_do_not_assert_on_non_int32(v,"a"); | |
| 52 %OptimizeFunctionOnNextCall(test_do_not_assert_on_non_int32); | |
| 53 test_do_not_assert_on_non_int32(v,0); | |
| 54 | |
| 55 function test_base(base,cond) { | 32 function test_base(base,cond) { |
| 56 a[base + 1] = 1; | 33 a[base + 1] = 1; |
| 57 a[base + 4] = 2; | 34 a[base + 4] = 2; |
| 58 a[base + 3] = 3; | 35 a[base + 3] = 3; |
| 59 a[base + 2] = 4; | 36 a[base + 2] = 4; |
| 60 a[base + 4] = base + 4; | 37 a[base + 4] = base + 4; |
| 61 if (cond) { | 38 if (cond) { |
| 62 a[base + 1] = 1; | 39 a[base + 1] = 1; |
| 63 a[base + 2] = 2; | 40 a[base + 2] = 2; |
| 64 a[base + 2] = 3; | 41 a[base + 2] = 3; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 short_test(short_a, 50); | 150 short_test(short_a, 50); |
| 174 short_test(short_a, 50); | 151 short_test(short_a, 50); |
| 175 %OptimizeFunctionOnNextCall(short_test); | 152 %OptimizeFunctionOnNextCall(short_test); |
| 176 short_a.length = 10; | 153 short_a.length = 10; |
| 177 short_test(a, 0); | 154 short_test(a, 0); |
| 178 assertTrue(%GetOptimizationStatus(short_test) != 1); | 155 assertTrue(%GetOptimizationStatus(short_test) != 1); |
| 179 | 156 |
| 180 | 157 |
| 181 gc(); | 158 gc(); |
| 182 | 159 |
| OLD | NEW |