add script engine SpiderMonkeyWatGC

This commit is contained in:
Volker Berlin 2019-09-12 21:54:35 +02:00
parent 5437ed54ed
commit 88b925fbde
3 changed files with 37 additions and 21 deletions

View File

@ -28,6 +28,7 @@ public enum ScriptEngine {
SpiderMonkeyWat, SpiderMonkeyWat,
Wat2Wasm, Wat2Wasm,
SpiderMonkeyGC, SpiderMonkeyGC,
SpiderMonkeyWatGC,
; ;
public static ScriptEngine[] testEngines() { public static ScriptEngine[] testEngines() {

View File

@ -1,5 +1,5 @@
load( "spiderMonkey.wasm.js" ); load( "{test}.wasm.js" );
var wasm = wasmTextToBinary( read( "spiderMonkey.wat" ) ); var wasm = wasmTextToBinary( read( "{test}.wat" ) );
var testData = JSON.parse( read( "testdata.json" ) ); var testData = JSON.parse( read( "testdata.json" ) );
function callExport(instance) { function callExport(instance) {

View File

@ -70,6 +70,8 @@ public class WasmRule extends TemporaryFolder {
private File spiderMonkeyScriptGC; private File spiderMonkeyScriptGC;
private File spiderMonkeyScriptWatGC;
private File nodeWatScript; private File nodeWatScript;
private File spiderMonkeyWatScript; private File spiderMonkeyWatScript;
@ -405,6 +407,8 @@ public class WasmRule extends TemporaryFolder {
return spiderMonkeyCommand( false, false ); return spiderMonkeyCommand( false, false );
case SpiderMonkeyGC: case SpiderMonkeyGC:
return spiderMonkeyCommand( true, true ); return spiderMonkeyCommand( true, true );
case SpiderMonkeyWatGC:
return spiderMonkeyCommand( false, true );
case NodeJS: case NodeJS:
return nodeJsCommand( nodeScript ); return nodeJsCommand( nodeScript );
case NodeWat: case NodeWat:
@ -495,28 +499,39 @@ public class WasmRule extends TemporaryFolder {
try { try {
System.setProperty( "SpiderMonkey", "true" ); System.setProperty( "SpiderMonkey", "true" );
if( gc ) { if( gc ) {
if( spiderMonkeyScriptGC == null ) { if( binary ) {
File file = newFile( "spiderMonkeyGC.wasm" ); if( spiderMonkeyScriptGC == null ) {
compiler.setProperty( JWebAssembly.WASM_USE_GC, "true" ); File file = newFile( "spiderMonkeyGC.wasm" );
compiler.compileToBinary( file ); compiler.setProperty( JWebAssembly.WASM_USE_GC, "true" );
spiderMonkeyScriptGC = createScript( "SpiderMonkeyTest.js", "{test.wasm}", file.getName() ); compiler.compileToBinary( file );
spiderMonkeyScriptGC = createScript( "SpiderMonkeyTest.js", "{test.wasm}", file.getName() );
}
script = spiderMonkeyScriptGC;
} else {
if( spiderMonkeyScriptWatGC == null ) {
File file = newFile( "spiderMonkeyGC.wat" );
compiler.setProperty( JWebAssembly.WASM_USE_GC, "true" );
compiler.compileToText( file );
spiderMonkeyScriptWatGC = createScript( "SpiderMonkeyWatTest.js", "{test}", "spiderMonkeyGC" );
}
script = spiderMonkeyScriptWatGC;
} }
script = spiderMonkeyScriptGC;
} else if( binary ) {
if( spiderMonkeyScript == null ) {
File file = newFile( "spiderMonkey.wasm" );
compiler.compileToBinary( file );
spiderMonkeyScript = createScript( "SpiderMonkeyTest.js", "{test.wasm}", file.getName() );
}
script = spiderMonkeyScript;
} else { } else {
if( spiderMonkeyWatScript == null ) { if( binary ) {
File file = newFile( "spiderMonkey.wat" ); if( spiderMonkeyScript == null ) {
compiler.compileToText( file ); File file = newFile( "spiderMonkey.wasm" );
spiderMonkeyWatScript = createScript( "SpiderMonkeyWatTest.js", "{test.wat}", file.getName() ); compiler.compileToBinary( file );
spiderMonkeyScript = createScript( "SpiderMonkeyTest.js", "{test.wasm}", file.getName() );
}
script = spiderMonkeyScript;
} else {
if( spiderMonkeyWatScript == null ) {
File file = newFile( "spiderMonkey.wat" );
compiler.compileToText( file );
spiderMonkeyWatScript = createScript( "SpiderMonkeyWatTest.js", "{test}", "spiderMonkey" );
}
script = spiderMonkeyWatScript;
} }
script = spiderMonkeyWatScript;
} }
} finally { } finally {
compiler.setProperty( JWebAssembly.WASM_USE_GC, null ); compiler.setProperty( JWebAssembly.WASM_USE_GC, null );