OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --expose-wasm | 5 // Flags: --expose-wasm |
6 | 6 |
7 function RunThreeWayTest(asmfunc, expect) { | 7 function RunThreeWayTest(asmfunc, expect) { |
8 var asm_source = asmfunc.toString(); | 8 var asm_source = asmfunc.toString(); |
9 var nonasm_source = asm_source.replace(new RegExp("use asm"), ""); | 9 var nonasm_source = asm_source.replace(new RegExp("use asm"), ""); |
10 var stdlib = {Math: Math}; | 10 var stdlib = {Math: Math}; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return +(x >>> 0); | 124 return +(x >>> 0); |
125 } | 125 } |
126 function e() { | 126 function e() { |
127 var x = 0xffffffff; | 127 var x = 0xffffffff; |
128 return +(x >>> 0); | 128 return +(x >>> 0); |
129 } | 129 } |
130 return {a: a, b: b, c: c, d: d, e: e}; | 130 return {a: a, b: b, c: c, d: d, e: e}; |
131 } | 131 } |
132 | 132 |
133 RunThreeWayTest(LargeUnsignedLiterals, function(module) { | 133 RunThreeWayTest(LargeUnsignedLiterals, function(module) { |
134 return; // TODO(bradnelson): unsigned literals are broken! | |
135 assertEquals(2147483648, module.a()); | 134 assertEquals(2147483648, module.a()); |
136 assertEquals(2147483649, module.b()); | 135 assertEquals(2147483649, module.b()); |
137 assertEquals(0x80000000, module.c()); | 136 assertEquals(0x80000000, module.c()); |
138 assertEquals(0x80000001, module.d()); | 137 assertEquals(0x80000001, module.d()); |
139 assertEquals(0xffffffff, module.e()); | 138 assertEquals(0xffffffff, module.e()); |
140 }); | 139 }); |
141 | 140 |
142 function ManyI32() { | 141 function ManyI32() { |
143 "use asm"; | 142 "use asm"; |
144 function main() { | 143 function main() { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 // TODO(bradnelson): fails validation of F32 literals somehow. | 252 // TODO(bradnelson): fails validation of F32 literals somehow. |
254 RunThreeWayTest(ManyF32a, function(module) { | 253 RunThreeWayTest(ManyF32a, function(module) { |
255 assertEquals(2.0999999917333043e-24, module.k1()); | 254 assertEquals(2.0999999917333043e-24, module.k1()); |
256 assertEquals(2.099999868734112e-19, module.k2()); | 255 assertEquals(2.099999868734112e-19, module.k2()); |
257 assertEquals(2.099999997029825e-14, module.k3()); | 256 assertEquals(2.099999997029825e-14, module.k3()); |
258 assertEquals(2.099999951710174e-9, module.k4()); | 257 assertEquals(2.099999951710174e-9, module.k4()); |
259 assertEquals(0.0002099999983329326, module.k5()); | 258 assertEquals(0.0002099999983329326, module.k5()); |
260 assertEquals(21.399999618530273, module.k6()); | 259 assertEquals(21.399999618530273, module.k6()); |
261 }); | 260 }); |
262 } | 261 } |
OLD | NEW |