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 55a244b58d7f999751b02b2fa9ccd48540be8521..de482579a0f2c1751fbd0be547aa9eff72967d4f 100644 |
--- a/test/mjsunit/wasm/asm-wasm-stdlib.js |
+++ b/test/mjsunit/wasm/asm-wasm-stdlib.js |
@@ -2,10 +2,15 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-// Flags: --expose-wasm |
+// Flags: --validate-asm --allow-natives-syntax |
var stdlib = this; |
+function assertValidAsm(func) { |
+ assertTrue(%IsAsmWasmCode(func) || |
+ %GetOptimizationStatus(func) === 3); |
+} |
+ |
(function TestStdlibConstants() { |
function Module(stdlib) { |
"use asm"; |
@@ -41,7 +46,8 @@ var stdlib = this; |
return {caller:caller, nanCheck:nanCheck}; |
} |
- var m = Wasm.instantiateModuleFromAsm(Module.toString(), stdlib); |
+ var m = Module(stdlib); |
+ assertValidAsm(Module); |
assertEquals(1, m.caller()); |
assertTrue(isNaN(m.nanCheck())); |
})(); |
@@ -54,9 +60,8 @@ var stdlib = this; |
function foo() { return +StdlibNaN; } |
return {}; |
} |
- assertThrows(function() { |
- Wasm.instantiateModuleFromAsm(Module.toString(), { NaN: 0 }); |
- }); |
+ Module({ NaN: 0 }); |
+ assertFalse(%IsAsmWasmCode(Module)); |
})(); |
@@ -67,9 +72,8 @@ var stdlib = this; |
function foo() { return +StdlibNaN; } |
return {}; |
} |
- assertThrows(function() { |
- Wasm.instantiateModuleFromAsm(Module.toString(), {}); |
- }); |
+ Module({}); |
+ assertFalse(%IsAsmWasmCode(Module)); |
})(); |
@@ -148,7 +152,8 @@ var stdlib = this; |
return {caller:caller}; |
} |
- var m = Wasm.instantiateModuleFromAsm(Module.toString(), stdlib); |
+ var m = Module(stdlib); |
+ assertValidAsm(Module); |
assertEquals(1, m.caller()); |
})(); |
@@ -292,7 +297,8 @@ var stdlib = this; |
max_f64: max_f64, |
}; |
} |
- var m = Wasm.instantiateModuleFromAsm(Module.toString(), stdlib); |
+ var m = Module(stdlib); |
+ assertValidAsm(Module); |
var values = { |
i32: [ |
0, 1, -1, 123, 456, -123, -456, |