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

Unified Diff: test/mjsunit/asm/b5528-comma.js

Issue 2426473007: [V8][asm.js] Fixes a bug in comma-expression validation. (Closed)
Patch Set: expands the tests. Created 4 years, 2 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/asmjs/asm-typer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/asm/b5528-comma.js
diff --git a/test/mjsunit/asm/b5528-comma.js b/test/mjsunit/asm/b5528-comma.js
new file mode 100644
index 0000000000000000000000000000000000000000..a6eab6d2eafda99a01942e5c6b3c8cc1b94c53a8
--- /dev/null
+++ b/test/mjsunit/asm/b5528-comma.js
@@ -0,0 +1,31 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function Module(stdlib, env, heap) {
+ "use asm";
+
+ var a = new stdlib.Int32Array(heap);
+ var b = new stdlib.Float32Array(heap);
+ var fround = stdlib.Math.fround;
+ var value = env.value|0;
+
+ function foo() {
+ var x = fround(0.0);
+ x = (a[0]=value|0,fround(b[0]));
+ return fround(x);
+ }
+
+ return { foo: foo };
+}
+
+var buffer = new ArrayBuffer(32);
+assertEquals(0.0, Module(this, {value: 0x00000000}, buffer).foo());
+assertEquals(-0.0, Module(this, {value: 0x80000000}, buffer).foo());
+assertEquals(5.0, Module(this, {value: 0x40a00000}, buffer).foo());
+assertEquals(-5.0, Module(this, {value: 0xc0a00000}, buffer).foo());
+assertEquals(129.375, Module(this, {value: 0x43016000}, buffer).foo());
+assertEquals(-129.375, Module(this, {value: 0xc3016000}, buffer).foo());
+assertEquals(Infinity, Module(this, {value: 0x7f800000}, buffer).foo());
+assertEquals(-Infinity, Module(this, {value: 0xff800000}, buffer).foo());
+assertEquals(NaN, Module(this, {value: 0x7fffffff}, buffer).foo());
« no previous file with comments | « src/asmjs/asm-typer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698