OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --allow-natives-syntax | 5 // Flags: --allow-natives-syntax |
6 | 6 |
7 var f32 = new Float32Array(20); | 7 var f32 = new Float32Array(40); |
8 | 8 |
9 function foo(f32, deopt) { | 9 function foo(f32, deopt) { |
10 var f0 = f32[0]; | 10 var v0 = f32[0]; |
11 var f1 = f32[1]; | 11 var v1 = f32[1]; |
12 var f2 = f32[2]; | 12 var v2 = f32[2]; |
13 var f3 = f32[3]; | 13 var v3 = f32[3]; |
14 var f4 = f32[4]; | 14 var v4 = f32[4]; |
15 var f5 = f32[5]; | 15 var v5 = f32[5]; |
16 var f6 = f32[6]; | 16 var v6 = f32[6]; |
17 var f7 = f32[7]; | 17 var v7 = f32[7]; |
18 var f8 = f32[8]; | 18 var v8 = f32[8]; |
19 var f9 = f32[9]; | 19 var v9 = f32[9]; |
20 var f10 = f32[10]; | 20 var v10 = f32[10]; |
21 var f11 = f32[11]; | 21 var v11 = f32[11]; |
22 var f12 = f32[12]; | 22 var v12 = f32[12]; |
23 var f13 = f32[13]; | 23 var v13 = f32[13]; |
24 var f14 = f32[14]; | 24 var v14 = f32[14]; |
25 var f15 = f32[15]; | 25 var v15 = f32[15]; |
26 var f16 = f32[16]; | 26 var v16 = f32[16]; |
27 var f17 = f32[17]; | 27 var v17 = f32[17]; |
28 var f18 = f32[18]; | 28 var v18 = f32[18]; |
29 var f19 = f32[19]; | 29 var v19 = f32[19]; |
| 30 var v20 = f32[20]; |
| 31 var v21 = f32[21]; |
| 32 var v22 = f32[22]; |
| 33 var v23 = f32[23]; |
| 34 var v24 = f32[24]; |
| 35 var v25 = f32[25]; |
| 36 var v26 = f32[26]; |
| 37 var v27 = f32[27]; |
| 38 var v28 = f32[28]; |
| 39 var v29 = f32[29]; |
| 40 var v30 = f32[30]; |
| 41 var v31 = f32[31]; |
| 42 var v32 = f32[32]; |
| 43 var v33 = f32[33]; |
| 44 var v34 = f32[34]; |
| 45 var v35 = f32[35]; |
| 46 var v36 = f32[36]; |
| 47 var v37 = f32[37]; |
| 48 var v38 = f32[38]; |
| 49 var v39 = f32[39]; |
30 // Side effect to force the deopt after the store. | 50 // Side effect to force the deopt after the store. |
31 f32[0] = f1 - 1; | 51 f32[0] = v1 - 1; |
32 // Here we deopt once we warm up with numbers, but then we | 52 // Here we deopt once we warm up with numbers, but then we |
33 // pass a string as {deopt}. | 53 // pass a string as {deopt}. |
34 return deopt + f0 + f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10 + f11 + | 54 return deopt + v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + |
35 f12 + f13 + f14 + f15 + f16 + f17 + f18 + f19; | 55 v12 + v13 + v14 + v15 + v16 + v17 + v18 + v19 + v20 + v21 + v22 + v23 + |
| 56 v24 + v25 + v26 + v27 + v28 + v29 + v30 + v31 + v32 + v33 + v34 + v35 + |
| 57 v36 + v37 + v38 + v39; |
36 } | 58 } |
37 | 59 |
38 var s = ""; | 60 var s = ""; |
39 for (var i = 0; i < f32.length; i++) { | 61 for (var i = 0; i < f32.length; i++) { |
40 f32[i] = i; | 62 f32[i] = i; |
41 s += i; | 63 s += i; |
42 } | 64 } |
43 | 65 |
44 foo(f32, 0); | 66 foo(f32, 0); |
45 foo(f32, 0); | 67 foo(f32, 0); |
46 %OptimizeFunctionOnNextCall(foo); | 68 %OptimizeFunctionOnNextCall(foo); |
47 assertEquals("x" + s, foo(f32, "x")); | 69 assertEquals("x" + s, foo(f32, "x")); |
OLD | NEW |