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

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

Issue 2251433002: [wasm] asm.js - Check stdlib.NaN is valid, prepare for the rest. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 4 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
Index: test/mjsunit/wasm/asm-wasm-stdlib.js
diff --git a/test/mjsunit/wasm/asm-wasm-stdlib.js b/test/mjsunit/wasm/asm-wasm-stdlib.js
index f49f3028bcafbfc0aac32b6d083afbcd2abeca85..55a244b58d7f999751b02b2fa9ccd48540be8521 100644
--- a/test/mjsunit/wasm/asm-wasm-stdlib.js
+++ b/test/mjsunit/wasm/asm-wasm-stdlib.js
@@ -4,6 +4,8 @@
// Flags: --expose-wasm
+var stdlib = this;
+
(function TestStdlibConstants() {
function Module(stdlib) {
"use asm";
@@ -39,12 +41,38 @@
return {caller:caller, nanCheck:nanCheck};
}
- var m =Wasm.instantiateModuleFromAsm(Module.toString());
+ var m = Wasm.instantiateModuleFromAsm(Module.toString(), stdlib);
assertEquals(1, m.caller());
assertTrue(isNaN(m.nanCheck()));
})();
+(function TestBadNaNStdlib() {
+ function Module(stdlib) {
+ "use asm";
+ var StdlibNaN = stdlib.NaN;
+ function foo() { return +StdlibNaN; }
+ return {};
+ }
+ assertThrows(function() {
+ Wasm.instantiateModuleFromAsm(Module.toString(), { NaN: 0 });
+ });
+})();
+
+
+(function TestMissingNaNStdlib() {
+ function Module(stdlib) {
+ "use asm";
+ var StdlibNaN = stdlib.NaN;
+ function foo() { return +StdlibNaN; }
+ return {};
+ }
+ assertThrows(function() {
+ Wasm.instantiateModuleFromAsm(Module.toString(), {});
+ });
+})();
+
+
(function TestStdlibFunctionsInside() {
function Module(stdlib) {
"use asm";
@@ -120,7 +148,7 @@
return {caller:caller};
}
- var m = Wasm.instantiateModuleFromAsm(Module.toString());
+ var m = Wasm.instantiateModuleFromAsm(Module.toString(), stdlib);
assertEquals(1, m.caller());
})();
@@ -264,7 +292,7 @@
max_f64: max_f64,
};
}
- var m = Wasm.instantiateModuleFromAsm(Module.toString());
+ var m = Wasm.instantiateModuleFromAsm(Module.toString(), stdlib);
var values = {
i32: [
0, 1, -1, 123, 456, -123, -456,

Powered by Google App Engine
This is Rietveld 408576698