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 stdlib = this; |
| 8 | var foreign = {}; |
| 9 | var heap = new ArrayBuffer(64 * 1024); |
| 10 | |
| 11 | |
| 12 | var m = (function(stdlib, foreign, heap) { |
| 13 | "use asm"; |
| 14 | function cd1(i, j) { |
| 15 | i = i|0; |
| 16 | j = j|0; |
| 17 | return +%_ConstructDouble(i, j); |
| 18 | } |
| 19 | function cd2(i) { |
| 20 | i = i|0; |
| 21 | return +%_ConstructDouble(0, i); |
| 22 | } |
| 23 | return { cd1: cd1, cd2: cd2 }; |
| 24 | })(stdlib, foreign, heap); |
| 25 | |
| 26 | assertEquals(0.0, m.cd1(0, 0)); |
| 27 | assertEquals(%ConstructDouble(0, 1), m.cd2(1)); |
| 28 | for (var i = -2147483648; i < 2147483648; i += 3999773) { |
| 29 | assertEquals(%ConstructDouble(0, i), m.cd2(i)); |
| 30 | for (var j = -2147483648; j < 2147483648; j += 3999773) { |
| 31 | assertEquals(%ConstructDouble(i, j), m.cd1(i, j)); |
| 32 | } |
| 33 | } |