Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // Flags: --allow-natives-syntax |
| 6 | |
| 7 | var ab = new ArrayBuffer(8); |
| 8 | var i_view = new Int32Array(ab); |
| 9 | i_view[0] = %GetHoleNaNUpper() |
| 10 | i_view[1] = %GetHoleNaNLower(); |
| 11 | var f_view = new Float64Array(ab); |
| 12 | |
| 13 | var fixed_double_elements = new Float64Array(1); |
| 14 | fixed_double_elements[0] = f_view[0]; |
| 15 | |
| 16 | function A(src) { this.x = src[0]; } |
| 17 | |
| 18 | new A(fixed_double_elements); |
| 19 | new A(fixed_double_elements); |
| 20 | |
| 21 | %OptimizeFunctionOnNextCall(A); |
| 22 | |
| 23 | var obj = new A(fixed_double_elements); |
| 24 | |
| 25 | function move_x(dst, obj) { dst[0] = obj.x; } |
| 26 | |
| 27 | var doubles = [0.5]; |
| 28 | move_x(doubles, obj); |
| 29 | move_x(doubles, obj); |
| 30 | %OptimizeFunctionOnNextCall(move_x); |
| 31 | move_x(doubles, obj); |
| 32 | assertTrue(doubles[0] !== undefined); |