blob: 8bb50000824075d56649f417a5dff5183e39808e [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// 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
7var stdlib = this;
8var foreign = {};
9var heap = new ArrayBuffer(64 * 1024);
10
11
12var 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
26assertEquals(0.0, m.cd1(0, 0));
27assertEquals(%ConstructDouble(0, 1), m.cd2(1));
28for (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}