Diff
Modified: branches/safari-603-branch/JSTests/ChangeLog (210415 => 210416)
--- branches/safari-603-branch/JSTests/ChangeLog 2017-01-06 01:48:48 UTC (rev 210415)
+++ branches/safari-603-branch/JSTests/ChangeLog 2017-01-06 01:48:52 UTC (rev 210416)
@@ -1,5 +1,19 @@
2017-01-05 Matthew Hanson <matthew_han...@apple.com>
+ Merge r210228. rdar://problem/29841541
+
+ 2017-01-02 Saam Barati <sbar...@apple.com>
+
+ WebAssembly: Some loads don't take into account the offset
+ https://bugs.webkit.org/show_bug.cgi?id=166616
+ <rdar://problem/29841541>
+
+ Reviewed by Keith Miller.
+
+ * wasm/function-tests/load-offset.js: Added.
+
+2017-01-05 Matthew Hanson <matthew_han...@apple.com>
+
Merge r210204. rdar://problem/29814999
2016-12-29 Saam Barati <sbar...@apple.com>
Added: branches/safari-603-branch/JSTests/wasm/function-tests/load-offset.js (0 => 210416)
--- branches/safari-603-branch/JSTests/wasm/function-tests/load-offset.js (rev 0)
+++ branches/safari-603-branch/JSTests/wasm/function-tests/load-offset.js 2017-01-06 01:48:52 UTC (rev 210416)
@@ -0,0 +1,165 @@
+import Builder from '../Builder.js'
+import * as assert from '../assert.js'
+
+{
+ const builder = (new Builder())
+ .Type().End()
+ .Import()
+ .Memory("imp", "mem", {initial: 1})
+ .End()
+ .Function().End()
+ .Export().Function("foo").End()
+ .Code()
+ .Function("foo", {params: ["i32"], ret: "i32"})
+ .GetLocal(0)
+ .I32Load(2, 4)
+ .Return()
+ .End()
+ .End();
+
+ const bin = builder.WebAssembly().get();
+ const module = new WebAssembly.Module(bin);
+ const memory = new WebAssembly.Memory({initial: 1});
+ const instance = new WebAssembly.Instance(module, {imp: {mem: memory}});
+
+ const number = 0x0abbccdd;
+ (new Uint32Array(memory.buffer))[1] = number;
+ assert.eq(instance.exports.foo(0), number);
+}
+
+{
+ const builder = (new Builder())
+ .Type().End()
+ .Import()
+ .Memory("imp", "mem", {initial: 1})
+ .End()
+ .Function().End()
+ .Export().Function("foo").End()
+ .Code()
+ .Function("foo", {params: ["i32"], ret: "i32"})
+ .GetLocal(0)
+ .I64Load32U(2, 4)
+ .I64Popcnt()
+ .I32WrapI64()
+ .Return()
+ .End()
+ .End();
+
+ const bin = builder.WebAssembly().get();
+ const module = new WebAssembly.Module(bin);
+ const memory = new WebAssembly.Memory({initial: 1});
+ const instance = new WebAssembly.Instance(module, {imp: {mem: memory}});
+
+ const number = 2**32 - 1;
+ (new Uint32Array(memory.buffer))[1] = number;
+ assert.eq(instance.exports.foo(0), 32);
+}
+
+{
+ const builder = (new Builder())
+ .Type().End()
+ .Import()
+ .Memory("imp", "mem", {initial: 1})
+ .End()
+ .Function().End()
+ .Export().Function("foo").End()
+ .Code()
+ .Function("foo", {params: ["i32"], ret: "i32"})
+ .GetLocal(0)
+ .I64Load32S(2, 4)
+ .I64Popcnt()
+ .I32WrapI64()
+ .Return()
+ .End()
+ .End();
+
+ const bin = builder.WebAssembly().get();
+ const module = new WebAssembly.Module(bin);
+ const memory = new WebAssembly.Memory({initial: 1});
+ const instance = new WebAssembly.Instance(module, {imp: {mem: memory}});
+
+ const number = 2**32 - 1;
+ (new Uint32Array(memory.buffer))[1] = number;
+ assert.eq(instance.exports.foo(0), 64);
+}
+
+{
+ const builder = (new Builder())
+ .Type().End()
+ .Import()
+ .Memory("imp", "mem", {initial: 1})
+ .End()
+ .Function().End()
+ .Export().Function("foo").End()
+ .Code()
+ .Function("foo", {params: ["i32"], ret: "i32"})
+ .GetLocal(0)
+ .I64Load(2, 4)
+ .I64Popcnt()
+ .I32WrapI64()
+ .Return()
+ .End()
+ .End();
+
+ const bin = builder.WebAssembly().get();
+ const module = new WebAssembly.Module(bin);
+ const memory = new WebAssembly.Memory({initial: 1});
+ const instance = new WebAssembly.Instance(module, {imp: {mem: memory}});
+
+ const number = 2**32 - 1;
+ (new Uint32Array(memory.buffer))[1] = number;
+ (new Uint32Array(memory.buffer))[2] = 0xff00ff00;
+ assert.eq(instance.exports.foo(0), 32 + 16);
+}
+
+{
+ const builder = (new Builder())
+ .Type().End()
+ .Import()
+ .Memory("imp", "mem", {initial: 1})
+ .End()
+ .Function().End()
+ .Export().Function("foo").End()
+ .Code()
+ .Function("foo", {params: ["i32"], ret: "f32"})
+ .GetLocal(0)
+ .F32Load(2, 4)
+ .Return()
+ .End()
+ .End();
+
+ const bin = builder.WebAssembly().get();
+ const module = new WebAssembly.Module(bin);
+ const memory = new WebAssembly.Memory({initial: 1});
+ const instance = new WebAssembly.Instance(module, {imp: {mem: memory}});
+
+ const number = Math.PI;
+ (new Float32Array(memory.buffer))[1] = number;
+ assert.eq(instance.exports.foo(0), Math.fround(number));
+}
+
+{
+ const builder = (new Builder())
+ .Type().End()
+ .Import()
+ .Memory("imp", "mem", {initial: 1})
+ .End()
+ .Function().End()
+ .Export().Function("foo").End()
+ .Code()
+ .Function("foo", {params: ["i32"], ret: "f64"})
+ .GetLocal(0)
+ .F64Load(2, 8)
+ .Return()
+ .End()
+ .End();
+
+ const bin = builder.WebAssembly().get();
+ const module = new WebAssembly.Module(bin);
+ const memory = new WebAssembly.Memory({initial: 1});
+ const instance = new WebAssembly.Instance(module, {imp: {mem: memory}});
+
+ const number = Math.PI;
+ (new Float64Array(memory.buffer))[1] = number;
+ assert.eq(instance.exports.foo(0), number);
+}
Modified: branches/safari-603-branch/JSTests/wasm.yaml (210415 => 210416)
--- branches/safari-603-branch/JSTests/wasm.yaml 2017-01-06 01:48:48 UTC (rev 210415)
+++ branches/safari-603-branch/JSTests/wasm.yaml 2017-01-06 01:48:52 UTC (rev 210416)
@@ -149,10 +149,10 @@
cmd: runWebAssemblySpecTest :skip
- path: wasm/spec-tests/nop.wast.js
- cmd: runWebAssemblySpecTest :skip
+ cmd: runWebAssemblySpecTest :normal
- path: wasm/spec-tests/resizing.wast.js
- cmd: runWebAssemblySpecTest :skip
+ cmd: runWebAssemblySpecTest :normal
- path: wasm/spec-tests/return.wast.js
cmd: runWebAssemblySpecTest :normal
Modified: branches/safari-603-branch/Source/_javascript_Core/ChangeLog (210415 => 210416)
--- branches/safari-603-branch/Source/_javascript_Core/ChangeLog 2017-01-06 01:48:48 UTC (rev 210415)
+++ branches/safari-603-branch/Source/_javascript_Core/ChangeLog 2017-01-06 01:48:52 UTC (rev 210416)
@@ -1,5 +1,20 @@
2017-01-05 Matthew Hanson <matthew_han...@apple.com>
+ Merge r210228. rdar://problem/29841541
+
+ 2017-01-02 Saam Barati <sbar...@apple.com>
+
+ WebAssembly: Some loads don't take into account the offset
+ https://bugs.webkit.org/show_bug.cgi?id=166616
+ <rdar://problem/29841541>
+
+ Reviewed by Keith Miller.
+
+ * wasm/WasmB3IRGenerator.cpp:
+ (JSC::Wasm::B3IRGenerator::emitLoadOp):
+
+2017-01-05 Matthew Hanson <matthew_han...@apple.com>
+
Merge r210203. rdar://problem/29815000
2016-12-28 Saam Barati <sbar...@apple.com>
Modified: branches/safari-603-branch/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp (210415 => 210416)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp 2017-01-06 01:48:48 UTC (rev 210415)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp 2017-01-06 01:48:52 UTC (rev 210416)
@@ -420,29 +420,29 @@
}
case LoadOpType::I32Load: {
- return m_currentBlock->appendNew<MemoryValue>(m_proc, Load, Int32, origin, pointer);
+ return m_currentBlock->appendNew<MemoryValue>(m_proc, Load, Int32, origin, pointer, offset);
}
case LoadOpType::I64Load32U: {
- Value* value = m_currentBlock->appendNew<MemoryValue>(m_proc, Load, Int32, origin, pointer);
+ Value* value = m_currentBlock->appendNew<MemoryValue>(m_proc, Load, Int32, origin, pointer, offset);
return m_currentBlock->appendNew<Value>(m_proc, ZExt32, origin, value);
}
case LoadOpType::I64Load32S: {
- Value* value = m_currentBlock->appendNew<MemoryValue>(m_proc, Load, Int32, origin, pointer);
+ Value* value = m_currentBlock->appendNew<MemoryValue>(m_proc, Load, Int32, origin, pointer, offset);
return m_currentBlock->appendNew<Value>(m_proc, SExt32, origin, value);
}
case LoadOpType::I64Load: {
- return m_currentBlock->appendNew<MemoryValue>(m_proc, Load, Int64, origin, pointer);
+ return m_currentBlock->appendNew<MemoryValue>(m_proc, Load, Int64, origin, pointer, offset);
}
case LoadOpType::F32Load: {
- return m_currentBlock->appendNew<MemoryValue>(m_proc, Load, Float, origin, pointer);
+ return m_currentBlock->appendNew<MemoryValue>(m_proc, Load, Float, origin, pointer, offset);
}
case LoadOpType::F64Load: {
- return m_currentBlock->appendNew<MemoryValue>(m_proc, Load, Double, origin, pointer);
+ return m_currentBlock->appendNew<MemoryValue>(m_proc, Load, Double, origin, pointer, offset);
}
// FIXME: B3 doesn't support Load16Z yet. We should lower to that value when