OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 | |
7 function loader(dst, src, i) { | |
8 dst[i] = src[i]; | |
9 } | |
10 | |
11 var ab = new ArrayBuffer(8); | 6 var ab = new ArrayBuffer(8); |
12 var i_view = new Int32Array(ab); | 7 var i_view = new Int32Array(ab); |
13 i_view[0] = %GetHoleNaNUpper() | 8 i_view[0] = %GetHoleNaNUpper() |
14 i_view[1] = %GetHoleNaNLower(); | 9 i_view[1] = %GetHoleNaNLower(); |
15 var f_view = new Float64Array(ab); | 10 var f_view = new Float64Array(ab); |
16 | 11 |
17 var fixed_double_elements = new Float64Array(1); | 12 var fixed_double_elements = new Float64Array(1); |
18 | 13 |
19 function opt_store() { fixed_double_elements[0] = f_view[0]; } | 14 function opt_store() { fixed_double_elements[0] = f_view[0]; } |
20 | 15 |
21 opt_store(); | 16 opt_store(); |
22 opt_store(); | 17 opt_store(); |
23 %OptimizeFunctionOnNextCall(opt_store); | 18 %OptimizeFunctionOnNextCall(opt_store); |
24 opt_store(); | 19 opt_store(); |
25 | 20 |
26 var i32 = new Int32Array(fixed_double_elements.buffer); | 21 var i32 = new Int32Array(fixed_double_elements.buffer); |
27 assertEquals(i_view[0], i32[0]); | 22 assertEquals(i_view[0], i32[0]); |
28 assertEquals(i_view[1], i32[1]); | 23 assertEquals(i_view[1], i32[1]); |
| 24 assertTrue(isNaN(f_view [0])); |
| 25 |
| 26 |
| 27 function loader(dst, src, i) { |
| 28 dst[i] = src[i]; |
| 29 } |
29 | 30 |
30 var doubles = [0.5]; | 31 var doubles = [0.5]; |
31 loader(doubles, fixed_double_elements, 0); | 32 loader(doubles, fixed_double_elements, 0); |
32 loader(doubles, fixed_double_elements, 0); | 33 loader(doubles, fixed_double_elements, 0); |
| 34 assertTrue(doubles[0] !== undefined); |
| 35 assertTrue(isNaN(doubles[0])); |
| 36 |
33 %OptimizeFunctionOnNextCall(loader); | 37 %OptimizeFunctionOnNextCall(loader); |
34 loader(doubles, fixed_double_elements, 0); | 38 loader(doubles, fixed_double_elements, 0); |
35 assertTrue(doubles[0] !== undefined); | 39 assertTrue(doubles[0] !== undefined); |
| 40 assertTrue(isNaN(doubles[0])); |
OLD | NEW |