diff options
Diffstat (limited to 'js/src/jit-test/tests/wasm/spec/start.wast')
-rw-r--r-- | js/src/jit-test/tests/wasm/spec/start.wast | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/wasm/spec/start.wast b/js/src/jit-test/tests/wasm/spec/start.wast new file mode 100644 index 000000000..513f7b9ba --- /dev/null +++ b/js/src/jit-test/tests/wasm/spec/start.wast @@ -0,0 +1,93 @@ +(assert_invalid + (module (func) (start 1)) + "unknown function" +) +(assert_invalid + (module + (func $main (result i32) (return (i32.const 0))) + (start $main) + ) + "start function" +) +(assert_invalid + (module + (func $main (param $a i32)) + (start $main) + ) + "start function" +) +(module + (memory (data "A")) + (func $inc + (i32.store8 + (i32.const 0) + (i32.add + (i32.load8_u (i32.const 0)) + (i32.const 1) + ) + ) + ) + (func $get (result i32) + (return (i32.load8_u (i32.const 0))) + ) + (func $main + (call $inc) + (call $inc) + (call $inc) + ) + + (start $main) + (export "inc" (func $inc)) + (export "get" (func $get)) +) +(assert_return (invoke "get") (i32.const 68)) +(invoke "inc") +(assert_return (invoke "get") (i32.const 69)) +(invoke "inc") +(assert_return (invoke "get") (i32.const 70)) + +(module + (memory (data "A")) + (func $inc + (i32.store8 + (i32.const 0) + (i32.add + (i32.load8_u (i32.const 0)) + (i32.const 1) + ) + ) + ) + (func $get (result i32) + (return (i32.load8_u (i32.const 0))) + ) + (func $main + (call $inc) + (call $inc) + (call $inc) + ) + (start 2) + (export "inc" (func $inc)) + (export "get" (func $get)) +) +(assert_return (invoke "get") (i32.const 68)) +(invoke "inc") +(assert_return (invoke "get") (i32.const 69)) +(invoke "inc") +(assert_return (invoke "get") (i32.const 70)) + +(module + (func $print_i32 (import "spectest" "print") (param i32)) + (func $main (call $print_i32 (i32.const 1))) + (start 1) +) + +(module + (func $print_i32 (import "spectest" "print") (param i32)) + (func $main (call $print_i32 (i32.const 2))) + (start $main) +) + +(assert_trap + (module (func $main (unreachable)) (start $main)) + "unreachable" +) |