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

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

Issue 1832603002: Properly handle unsigned literals, fix typing issue with unary +. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: drop print Created 4 years, 9 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 | « test/cctest/test-asm-validator.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 2ceba5e6a68228b21cf84dea82dfed5bf8c08ee4..deb245e3794ae646c39cb9a46e334be481e4e7b2 100644
--- a/test/mjsunit/wasm/asm-wasm.js
+++ b/test/mjsunit/wasm/asm-wasm.js
@@ -508,7 +508,7 @@ function TestConvertF64FromInt() {
function caller() {
var a = 1;
- if ((+(a + a)) > 1.5) {
+ if ((+((a + a)|0)) > 1.5) {
return 25;
}
return 0;
@@ -527,7 +527,7 @@ function TestConvertF64FromUnsigned() {
function caller() {
var a = 0xffffffff;
if ((+(a>>>0)) > 0.0) {
- if((+a) < 0.0) {
+ if((+(a|0)) < 0.0) {
return 26;
}
}
@@ -1404,6 +1404,21 @@ TestForeignVariables();
})();
+(function TestBadCastFromInt() {
+ function Module(stdlib, foreign, heap) {
+ "use asm";
+ function func() {
+ var a = 1;
+ return +a;
+ }
+ return {func: func};
+ }
+ assertThrows(function() {
+ Wasm.instantiateModuleFromAsm(Module.toString());
+ });
+})();
+
+
(function TestAndNegative() {
function Module() {
"use asm";
@@ -1485,3 +1500,30 @@ TestForeignVariables();
var wasm = Wasm.instantiateModuleFromAsm(asmModule.toString());
assertEquals(1321347704, wasm.main());
})();
+
+(function TestUnsignedLiterals() {
+ function asmModule() {
+ "use asm";
+ function u0xffffffff() {
+ var f = 0xffffffff;
+ return +(f >>> 0);
+ }
+ function u0x80000000() {
+ var f = 0x80000000;
+ return +(f >>> 0);
+ }
+ function u0x87654321() {
+ var f = 0x87654321;
+ return +(f >>> 0);
+ }
+ return {
+ u0xffffffff: u0xffffffff,
+ u0x80000000: u0x80000000,
+ u0x87654321: u0x87654321,
+ };
+ }
+ var wasm = Wasm.instantiateModuleFromAsm(asmModule.toString());
+ assertEquals(0xffffffff, wasm.u0xffffffff());
+ assertEquals(0x80000000, wasm.u0x80000000());
+ assertEquals(0x87654321, wasm.u0x87654321());
+})();
« no previous file with comments | « test/cctest/test-asm-validator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698