Chromium Code Reviews| Index: test/mjsunit/asm/construct-double.js |
| diff --git a/test/mjsunit/asm/construct-double.js b/test/mjsunit/asm/construct-double.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..efac8bd6305d5da271f7597a0a2fa125c2e81fb4 |
| --- /dev/null |
| +++ b/test/mjsunit/asm/construct-double.js |
| @@ -0,0 +1,33 @@ |
| +// Copyright 2015 the V8 project authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// Flags: --allow-natives-syntax |
| + |
| +var stdlib = this; |
| +var foreign = {}; |
| +var heap = new ArrayBuffer(64 * 1024); |
| + |
| + |
| +var m = (function(stdlib, foreign, heap) { |
| + "use asm"; |
| + function cd1(i, j) { |
| + i = i|0; |
| + j = j|0; |
| + return +%_ConstructDouble(i, j); |
| + } |
| + function cd2(i) { |
| + i = i|0; |
| + return +%_ConstructDouble(0, i); |
| + } |
| + return { cd1: cd1, cd2: cd2 }; |
| +})(stdlib, foreign, heap); |
| + |
| +assertEquals(0.0, m.cd1(0, 0)); |
| +assertEquals(%_ConstructDouble(0, 1), m.cd2(1)); |
|
Yang
2015/03/05 07:36:45
Probably better to use %ConstructDouble instead of
Benedikt Meurer
2015/03/05 08:51:46
Done.
|
| +for (var i = -2147483648; i < 2147483648; i += 3999773) { |
| + assertEquals(%_ConstructDouble(0, i), m.cd2(i)); |
| + for (var j = -2147483648; j < 2147483648; j += 3999773) { |
| + assertEquals(%_ConstructDouble(i, j), m.cd1(i, j)); |
| + } |
| +} |