summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/spec/resizing.wast
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/wasm/spec/resizing.wast
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/wasm/spec/resizing.wast')
-rw-r--r--js/src/jit-test/tests/wasm/spec/resizing.wast58
1 files changed, 58 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/wasm/spec/resizing.wast b/js/src/jit-test/tests/wasm/spec/resizing.wast
new file mode 100644
index 000000000..937e6cab1
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/spec/resizing.wast
@@ -0,0 +1,58 @@
+(module
+ (memory 0)
+
+ (func (export "load_at_zero") (result i32) (i32.load (i32.const 0)))
+ (func (export "store_at_zero") (i32.store (i32.const 0) (i32.const 2)))
+
+ (func (export "load_at_page_size") (result i32) (i32.load (i32.const 0x10000)))
+ (func (export "store_at_page_size") (i32.store (i32.const 0x10000) (i32.const 3)))
+
+ (func (export "grow") (param $sz i32) (result i32) (grow_memory (get_local $sz)))
+ (func (export "size") (result i32) (current_memory))
+)
+
+(assert_return (invoke "size") (i32.const 0))
+(assert_trap (invoke "store_at_zero") "out of bounds memory access")
+(assert_trap (invoke "load_at_zero") "out of bounds memory access")
+(assert_trap (invoke "store_at_page_size") "out of bounds memory access")
+(assert_trap (invoke "load_at_page_size") "out of bounds memory access")
+(assert_return (invoke "grow" (i32.const 1)) (i32.const 0))
+(assert_return (invoke "size") (i32.const 1))
+(assert_return (invoke "load_at_zero") (i32.const 0))
+(assert_return (invoke "store_at_zero"))
+(assert_return (invoke "load_at_zero") (i32.const 2))
+(assert_trap (invoke "store_at_page_size") "out of bounds memory access")
+(assert_trap (invoke "load_at_page_size") "out of bounds memory access")
+(assert_return (invoke "grow" (i32.const 4)) (i32.const 1))
+(assert_return (invoke "size") (i32.const 5))
+(assert_return (invoke "load_at_zero") (i32.const 2))
+(assert_return (invoke "store_at_zero"))
+(assert_return (invoke "load_at_zero") (i32.const 2))
+(assert_return (invoke "load_at_page_size") (i32.const 0))
+(assert_return (invoke "store_at_page_size"))
+(assert_return (invoke "load_at_page_size") (i32.const 3))
+
+
+(module
+ (memory 0)
+ (func (export "grow") (param i32) (result i32) (grow_memory (get_local 0)))
+)
+
+(assert_return (invoke "grow" (i32.const 0)) (i32.const 0))
+(assert_return (invoke "grow" (i32.const 1)) (i32.const 0))
+(assert_return (invoke "grow" (i32.const 0)) (i32.const 1))
+(assert_return (invoke "grow" (i32.const 2)) (i32.const 1))
+(assert_return (invoke "grow" (i32.const 800)) (i32.const 3))
+
+(module
+ (memory 0 10)
+ (func (export "grow") (param i32) (result i32) (grow_memory (get_local 0)))
+)
+
+(assert_return (invoke "grow" (i32.const 0)) (i32.const 0))
+(assert_return (invoke "grow" (i32.const 1)) (i32.const 0))
+(assert_return (invoke "grow" (i32.const 1)) (i32.const 1))
+(assert_return (invoke "grow" (i32.const 2)) (i32.const 2))
+(assert_return (invoke "grow" (i32.const 6)) (i32.const 4))
+(assert_return (invoke "grow" (i32.const 0)) (i32.const 10))
+(assert_return (invoke "grow" (i32.const 1)) (i32.const -1))