OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 (function StoreHoleBitPattern() { |
| 8 function g(src, dst, i) { |
| 9 dst[i] = src[i]; |
| 10 } |
| 11 |
| 12 var b = new ArrayBuffer(16); |
| 13 var i32 = new Int32Array(b); |
| 14 i32[0] = 0xFFF7FFFF; |
| 15 i32[1] = 0xFFF7FFFF; |
| 16 i32[3] = 0xFFF7FFFF; |
| 17 i32[4] = 0xFFF7FFFF; |
| 18 var f64 = new Float64Array(b); |
| 19 |
| 20 var a = [,0.1]; |
| 21 |
| 22 g(f64, a, 1); |
| 23 g(f64, a, 1); |
| 24 %OptimizeFunctionOnNextCall(g); |
| 25 g(f64, a, 0); |
| 26 |
| 27 assertTrue(Number.isNaN(a[0])); |
| 28 })(); |
| 29 |
| 30 |
| 31 (function ConvertHoleToNumberAndStore() { |
| 32 function g(a, i) { |
| 33 var x = a[i]; |
| 34 a[i] = +x; |
| 35 } |
| 36 |
| 37 var a=[,0.1]; |
| 38 g(a, 1); |
| 39 g(a, 1); |
| 40 %OptimizeFunctionOnNextCall(g); |
| 41 g(a, 0); |
| 42 assertTrue(Number.isNaN(a[0])); |
| 43 })(); |
OLD | NEW |