js/src/jit-test/tests/ion/bug860838-3.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1
michael@0 2 var buf = new ArrayBuffer(4096);
michael@0 3 var f64 = new Float64Array(buf);
michael@0 4 var i32 = new Int32Array(buf);
michael@0 5 var u32 = new Uint32Array(buf);
michael@0 6
michael@0 7 function ffi(d) {
michael@0 8 str = String(d);
michael@0 9 }
michael@0 10
michael@0 11
michael@0 12 function FFI1(glob, imp, b) {
michael@0 13 "use asm";
michael@0 14
michael@0 15 var i8=new glob.Int8Array(b);var u8=new glob.Uint8Array(b);
michael@0 16 var i16=new glob.Int16Array(b);var u16=new glob.Uint16Array(b);
michael@0 17 var i32=new glob.Int32Array(b);var u32=new glob.Uint32Array(b);
michael@0 18 var f32=new glob.Float32Array(b);var f64=new glob.Float64Array(b);
michael@0 19
michael@0 20 var ffi=imp.ffi;
michael@0 21
michael@0 22 function g() {
michael@0 23 ffi(+f64[0])
michael@0 24 }
michael@0 25 return g
michael@0 26 }
michael@0 27
michael@0 28 g = FFI1(this, {ffi:ffi}, buf);
michael@0 29
michael@0 30
michael@0 31 // that sounds dangerous!
michael@0 32 var a = [0,1,0xffff0000,0x7fff0000,0xfff80000,0x7ff80000,0xfffc0000,0x7ffc0000,0xffffffff,0x0000ffff,0x00008fff7];
michael@0 33 for (i of a) {
michael@0 34 for (j of a) {
michael@0 35 u32[0] = i;
michael@0 36 u32[1] = j;
michael@0 37
michael@0 38 print(f64[0]+" (input)");
michael@0 39 //assertEq(f(), f64[0]);
michael@0 40
michael@0 41 g();
michael@0 42 assertEq(str, String(f64[0]));
michael@0 43 }
michael@0 44 }

mercurial