Bug 1250955: Guard against unimplemented i64 opcodes; r=jandem
authorBenjamin Bouvier <benj@benj.me>
Wed, 24 Feb 2016 20:28:36 +0100
changeset 321955 583d2cb7c78a5fe912c222aeb693eaf054e3db80
parent 321954 3eb7e82deef8c70722397416bba1d0e9882e37e8
child 321956 ac848037025ee39218bc95099dcc384ca095b052
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1250955
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1250955: Guard against unimplemented i64 opcodes; r=jandem MozReview-Commit-ID: FB7roTSWhem
js/src/asmjs/Wasm.cpp
js/src/jit-test/tests/wasm/basic-memory.js
--- a/js/src/asmjs/Wasm.cpp
+++ b/js/src/asmjs/Wasm.cpp
@@ -593,17 +593,18 @@ DecodeExpr(FunctionDecoder& f, ExprType 
         return DecodeLoad(f, expected, ExprType::I32);
       case Expr::I64LoadMem:
       case Expr::I64LoadMem8S:
       case Expr::I64LoadMem8U:
       case Expr::I64LoadMem16S:
       case Expr::I64LoadMem16U:
       case Expr::I64LoadMem32S:
       case Expr::I64LoadMem32U:
-        return DecodeLoad(f, expected, ExprType::I64);
+        return f.fail("NYI: i64") &&
+               DecodeLoad(f, expected, ExprType::I64);
       case Expr::F32LoadMem:
         return DecodeLoad(f, expected, ExprType::F32);
       case Expr::F64LoadMem:
         return DecodeLoad(f, expected, ExprType::F64);
       case Expr::I32StoreMem:
       case Expr::I32StoreMem8:
       case Expr::I32StoreMem16:
         return DecodeStore(f, expected, ExprType::I32);
--- a/js/src/jit-test/tests/wasm/basic-memory.js
+++ b/js/src/jit-test/tests/wasm/basic-memory.js
@@ -89,45 +89,66 @@ testLoad('f64', '', 0, 0, 0, 7.949928895
 //testLoad('f64', '', 1, 0, 0, 5.447603722011605e-270); // TODO: unaligned NYI
 //testLoad('f64', '', 0, 1, 0, 0x01020304); // TODO: offsets NYI
 //testLoad('f64', '', 1, 1, 4, 0x02030405); // TODO: offsets NYI
 
 testLoad('i32', '8_s', 16, 0, 0, -0x10);
 testLoad('i32', '8_u', 16, 0, 0, 0xf0);
 testLoad('i32', '16_s', 16, 0, 0, -0xe10);
 testLoad('i32', '16_u', 16, 0, 0, 0xf1f0);
+
+// When these tests fail, uncomment the load/store tests below.
+function testLoadNYI(ext) {
+    assertErrorMessage(() => wasmEvalText(`(module (memory 0x10000) (func (i64.load${ext} (i32.const 0))))`), TypeError, /NYI/);
+}
+testLoadNYI('');
+testLoadNYI('8_s');
+testLoadNYI('8_u');
+testLoadNYI('16_s');
+testLoadNYI('16_u');
+testLoadNYI('32_s');
+testLoadNYI('32_u');
 //testLoad('i64', '8_s', 16, 0, 0, -0x8); // TODO: i64 NYI
 //testLoad('i64', '8_u', 16, 0, 0, 0x8); // TODO: i64 NYI
 //testLoad('i64', '16_s', 16, 0, 0, -0x707); // TODO: i64 NYI
 //testLoad('i64', '16_u', 16, 0, 0, 0x8f9); // TODO: i64 NYI
 //testLoad('i64', '32_s', 16, 0, 0, -0x7060505); // TODO: i64 NYI
 //testLoad('i64', '32_u', 16, 0, 0, 0x8f9fafb); // TODO: i64 NYI
 
 testStore('i32', '', 0, 0, 0, -0x3f3e2c2c);
 //testStore('i32', '', 1, 0, 0, -0x3f3e2c2c); // TODO: unaligned NYI
 //testStore('i32', '', 0, 1, 0, 0xc0c1d3d4); // TODO: offset NYI
 //testStore('i32', '', 1, 1, 4, 0xc0c1d3d4); // TODO: offset NYI
+
+function testStoreNYI(ext) {
+    assertErrorMessage(() => wasmEvalText(`(module (memory 0x10000) (func (i64.store${ext} (i32.const 0) (i32.const 0))))`), TypeError, /NYI/);
+}
+testStoreNYI('');
+testStoreNYI('8');
+testStoreNYI('16');
+testStoreNYI('32');
 //testStore('i64', '', 0, 0, 0, 0xc0c1d3d4e6e7090a); // TODO: i64 NYI
 //testStore('i64', '', 1, 0, 0, 0xc0c1d3d4e6e7090a); // TODO: i64 NYI
 //testStore('i64', '', 0, 1, 0, 0xc0c1d3d4e6e7090a); // TODO: i64 NYI
 //testStore('i64', '', 1, 1, 4, 0xc0c1d3d4e6e7090a); // TODO: i64 NYI
+//testStore('i64', '8', 0, 0, 0, 0x23); // TODO: i64 NYI
+//testStore('i64', '16', 0, 0, 0, 0x23); // TODO: i64 NYI
+//testStore('i64', '32', 0, 0, 0, 0x23); // TODO: i64 NYI
+
 testStore('f32', '', 0, 0, 0, 0.01234566979110241);
 //testStore('f32', '', 1, 0, 0, 0.01234566979110241); // TODO: unaligned NYI
 //testStore('f32', '', 0, 1, 0, 0.01234567); // TODO: offsets NYI
 //testStore('f32', '', 1, 1, 4, 0.01234567); // TODO: offsets NYI
 testStore('f64', '', 0, 0, 0, 0.89012345);
 //testStore('f64', '', 1, 0, 0, 0.89012345); // TODO: unaligned NYI
 //testStore('f64', '', 0, 1, 0, 0.89012345); // TODO: offsets NYI
 //testStore('f64', '', 1, 1, 4, 0.89012345); // TODO: offsets NYI
 
 testStore('i32', '8', 0, 0, 0, 0x23);
 testStore('i32', '16', 0, 0, 0, 0x2345);
-//testStore('i64', '8', 0, 0, 0, 0x23); // TODO: i64 NYI
-//testStore('i64', '16', 0, 0, 0, 0x23); // TODO: i64 NYI
-//testStore('i64', '32', 0, 0, 0, 0x23); // TODO: i64 NYI
 
 testLoadError('i32', '', 0, 0, 3, /memory access alignment must be a power of two/);
 testStoreError('i32', '', 0, 0, 3, /memory access alignment must be a power of two/);
 
 assertErrorMessage(() => wasmEvalText('(module (memory 0x10000) (func (f64.store offset=0 (i32.const 0) (i32.const 0))))'), TypeError, mismatchError("i32", "f64"));
 assertErrorMessage(() => wasmEvalText('(module (memory 0x10000) (func (f64.store offset=0 (i32.const 0) (f32.const 0))))'), TypeError, mismatchError("f32", "f64"));
 
 assertErrorMessage(() => wasmEvalText('(module (memory 0x10000) (func (f32.store offset=0 (i32.const 0) (i32.const 0))))'), TypeError, mismatchError("i32", "f32"));