Bug 1155211: Part 3.3 - New tests; r=h4writer

--HG--
extra : rebase_source : 775222e2baec8c144fc4f984bb52abab80e04a31
extra : histedit_source : 83a0651277a325eec7153c96caeae4c12faa3e0e
This commit is contained in:
Benjamin Bouvier 2015-07-09 21:09:27 +02:00
Родитель 0a5c92d745
Коммит dc18ab1de6
2 изменённых файлов: 48 добавлений и 1 удалений

Просмотреть файл

@ -138,7 +138,7 @@ assertEqX4(asmLink(asmCompile('glob', 'ffi', 'heap', USE_ASM + F32 + CF32 + FROU
assertEqX4(asmLink(asmCompile('glob', USE_ASM + F32 + CF32 + FROUND + "function f(i) {i=i|0; return cf4(f4(f32(1) + f32(2), f32(2), f32(3), f32(4)))} return f"), this, {}, new ArrayBuffer(0x10000))(0x20000), [3, 2, 3, 4]);
assertEqX4(asmLink(asmCompile('glob', USE_ASM + F32 + CF32 + FROUND + "function f(i) {i=i|0; return cf4(f4(f32(1) + f32(2), 2.0, 3.0, 4.0))} return f"), this, {}, new ArrayBuffer(0x10000))(0x20000), [3, 2, 3, 4]);
// 1.3.2 Reading values out of lanes
// 1.3.2 Getters - Reading values out of lanes
assertAsmTypeFail('glob', USE_ASM + I32 + EXTI4 + "function f() {var x=1; return e(x,1) | 0;} return f");
assertAsmTypeFail('glob', USE_ASM + I32 + EXTI4 + "function f() {var x=1; return e(x + x, 1) | 0;} return f");
assertAsmTypeFail('glob', USE_ASM + I32 + EXTI4 + "function f() {var x=1.; return e(x, 1) | 0;} return f");
@ -148,6 +148,13 @@ assertAsmTypeFail('glob', USE_ASM + I32 + EXTI4 + "function f() {var x=i4(1,2,3,
assertAsmTypeFail('glob', USE_ASM + I32 + EXTI4 + "function f() {var x=e(i4(1,2,3,4),1); return x|0;} return f");
assertAsmTypeFail('glob', USE_ASM + I32 + EXTI4 + "function f() {var x=i4(1,2,3,4); return (e(x,0) > (1>>>0)) | 0;} return f");
assertAsmTypeFail('glob', USE_ASM + I32 + EXTI4 + "function f() {var x=i4(1,2,3,4); return e(x,-1) | 0;} return f");
assertAsmTypeFail('glob', USE_ASM + I32 + EXTI4 + "function f() {var x=i4(1,2,3,4); return e(x,4) | 0;} return f");
assertAsmTypeFail('glob', USE_ASM + I32 + EXTI4 + "function f() {var x=i4(1,2,3,4); return e(x,.5) | 0;} return f");
assertAsmTypeFail('glob', USE_ASM + I32 + EXTI4 + "function f() {var x=i4(1,2,3,4); return e(x,x) | 0;} return f");
assertAsmTypeFail('glob', USE_ASM + I32 + EXTF4 + "function f() {var x=i4(1,2,3,4); return e(x,0) | 0;} return f");
assertAsmTypeFail('glob', USE_ASM + I32 + EXTI4 + "function f() {var x=i4(1,2,3,4); var i=0; return e(x,i) | 0;} return f");
// signMask
function CheckSignMask(innerBody, type, expected) {
var coerceBefore, coerceAfter, extractLane;

Просмотреть файл

@ -24,6 +24,14 @@ function testFloat32x4Getters() {
assertEq(Float32x4.extractLane(f, 1), 22);
assertEq(Float32x4.extractLane(f, 2), 33);
assertEq(Float32x4.extractLane(f, 3), 44);
assertThrowsInstanceOf(() => Float32x4.extractLane(f, 4), TypeError);
assertThrowsInstanceOf(() => Float32x4.extractLane(f, -1), TypeError);
assertThrowsInstanceOf(() => Float32x4.extractLane(f, 0.5), TypeError);
assertThrowsInstanceOf(() => Float32x4.extractLane(f, {}), TypeError);
assertThrowsInstanceOf(() => Float32x4.extractLane(Int32x4(1,2,3,4), 0), TypeError);
assertThrowsInstanceOf(() => Float32x4.extractLane(1, 0), TypeError);
assertThrowsInstanceOf(() => Float32x4.extractLane(f, f), TypeError);
}
function testFloat32x4Handles() {
@ -102,6 +110,14 @@ function testFloat64x2Getters() {
var f = Float64x2(11, 22);
assertEq(Float64x2.extractLane(f, 0), 11);
assertEq(Float64x2.extractLane(f, 1), 22);
assertThrowsInstanceOf(() => Float64x2.extractLane(f, 2), TypeError);
assertThrowsInstanceOf(() => Float64x2.extractLane(f, -1), TypeError);
assertThrowsInstanceOf(() => Float64x2.extractLane(f, 0.5), TypeError);
assertThrowsInstanceOf(() => Float64x2.extractLane(f, {}), TypeError);
assertThrowsInstanceOf(() => Float64x2.extractLane(Float32x4(1,2,3,4), 0), TypeError);
assertThrowsInstanceOf(() => Float64x2.extractLane(1, 0), TypeError);
assertThrowsInstanceOf(() => Float64x2.extractLane(f, f), TypeError);
}
function testFloat64x2Handles() {
@ -194,6 +210,14 @@ function testInt8x16Getters() {
assertEq(Int8x16.extractLane(f, 13), 50);
assertEq(Int8x16.extractLane(f, 14), 60);
assertEq(Int8x16.extractLane(f, 15), 70);
assertThrowsInstanceOf(() => Int8x16.extractLane(f, 16), TypeError);
assertThrowsInstanceOf(() => Int8x16.extractLane(f, -1), TypeError);
assertThrowsInstanceOf(() => Int8x16.extractLane(f, 0.5), TypeError);
assertThrowsInstanceOf(() => Int8x16.extractLane(f, {}), TypeError);
assertThrowsInstanceOf(() => Int8x16.extractLane(Int32x4(1,2,3,4), 0), TypeError);
assertThrowsInstanceOf(() => Int8x16.extractLane(1, 0), TypeError);
assertThrowsInstanceOf(() => Int8x16.extractLane(f, f), TypeError);
}
function testInt8x16Handles() {
@ -279,6 +303,14 @@ function testInt16x8Getters() {
assertEq(Int16x8.extractLane(f, 5), 66);
assertEq(Int16x8.extractLane(f, 6), 77);
assertEq(Int16x8.extractLane(f, 7), 88);
assertThrowsInstanceOf(() => Int16x8.extractLane(f, 8), TypeError);
assertThrowsInstanceOf(() => Int16x8.extractLane(f, -1), TypeError);
assertThrowsInstanceOf(() => Int16x8.extractLane(f, 0.5), TypeError);
assertThrowsInstanceOf(() => Int16x8.extractLane(f, {}), TypeError);
assertThrowsInstanceOf(() => Int16x8.extractLane(Int32x4(1,2,3,4), 0), TypeError);
assertThrowsInstanceOf(() => Int16x8.extractLane(1, 0), TypeError);
assertThrowsInstanceOf(() => Int16x8.extractLane(f, f), TypeError);
}
function testInt16x8Handles() {
@ -359,6 +391,14 @@ function testInt32x4Getters() {
assertEq(Int32x4.extractLane(f, 1), 22);
assertEq(Int32x4.extractLane(f, 2), 33);
assertEq(Int32x4.extractLane(f, 3), 44);
assertThrowsInstanceOf(() => Int32x4.extractLane(f, 4), TypeError);
assertThrowsInstanceOf(() => Int32x4.extractLane(f, -1), TypeError);
assertThrowsInstanceOf(() => Int32x4.extractLane(f, 0.5), TypeError);
assertThrowsInstanceOf(() => Int32x4.extractLane(f, {}), TypeError);
assertThrowsInstanceOf(() => Int32x4.extractLane(Float32x4(1,2,3,4), 0), TypeError);
assertThrowsInstanceOf(() => Int32x4.extractLane(1, 0), TypeError);
assertThrowsInstanceOf(() => Int32x4.extractLane(f, f), TypeError);
}
function testInt32x4Handles() {