OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --allow-natives-syntax |
| 6 |
| 7 var f32 = new Float32Array(20); |
| 8 |
| 9 function foo(f32, deopt) { |
| 10 var f0 = f32[0]; |
| 11 var f1 = f32[1]; |
| 12 var f2 = f32[2]; |
| 13 var f3 = f32[3]; |
| 14 var f4 = f32[4]; |
| 15 var f5 = f32[5]; |
| 16 var f6 = f32[6]; |
| 17 var f7 = f32[7]; |
| 18 var f8 = f32[8]; |
| 19 var f9 = f32[9]; |
| 20 var f10 = f32[10]; |
| 21 var f11 = f32[11]; |
| 22 var f12 = f32[12]; |
| 23 var f13 = f32[13]; |
| 24 var f14 = f32[14]; |
| 25 var f15 = f32[15]; |
| 26 var f16 = f32[16]; |
| 27 var f17 = f32[17]; |
| 28 var f18 = f32[18]; |
| 29 var f19 = f32[19]; |
| 30 // Side effect to force the deopt after the store. |
| 31 f32[0] = f1 - 1; |
| 32 // Here we deopt once we warm up with numbers, but then we |
| 33 // pass a string as {deopt}. |
| 34 return deopt + f0 + f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10 + f11 + |
| 35 f12 + f13 + f14 + f15 + f16 + f17 + f18 + f19; |
| 36 } |
| 37 |
| 38 var s = ""; |
| 39 for (var i = 0; i < f32.length; i++) { |
| 40 f32[i] = i; |
| 41 s += i; |
| 42 } |
| 43 |
| 44 foo(f32, 0); |
| 45 foo(f32, 0); |
| 46 %OptimizeFunctionOnNextCall(foo); |
| 47 assertEquals("x" + s, foo(f32, "x")); |
OLD | NEW |