Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Unified Diff: test/mjsunit/wasm/asm-wasm.js

Issue 1717213002: Allow negative literals in asm->wasm non-conversion operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: merge Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/typing-asm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/asm-wasm.js
diff --git a/test/mjsunit/wasm/asm-wasm.js b/test/mjsunit/wasm/asm-wasm.js
index 165a55a8fa7b579c4638e943b2e15a790c831cb8..419fdf8a7658262fff89c211dab528107b77aba9 100644
--- a/test/mjsunit/wasm/asm-wasm.js
+++ b/test/mjsunit/wasm/asm-wasm.js
@@ -1472,3 +1472,54 @@ TestForeignVariables();
_WASMEXP_.instantiateModuleFromAsm(Module.toString());
});
})();
+
+
+(function TestAndNegative() {
+ function Module() {
+ "use asm";
+ function func() {
+ var x = 1;
+ var y = 2;
+ var z = 0;
+ z = x + y & -1;
+ return z | 0;
+ }
+ return {func: func};
+ }
+
+ var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString());
+ assertEquals(3, m.func());
+})();
+
+
+(function TestNegativeDouble() {
+ function Module() {
+ "use asm";
+ function func() {
+ var x = -(34359738368.25);
+ var y = -2.5;
+ return +(x + y);
+ }
+ return {func: func};
+ }
+
+ var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString());
+ assertEquals(-34359738370.75, m.func());
+})();
+
+
+(function TestBadAndDouble() {
+ function Module() {
+ "use asm";
+ function func() {
+ var x = 1.0;
+ var y = 2.0;
+ return (x & y) | 0;
+ }
+ return {func: func};
+ }
+
+ assertThrows(function() {
+ _WASMEXP_.instantiateModuleFromAsm(Module.toString());
+ });
+})();
« no previous file with comments | « src/typing-asm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698