mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-12 14:31:28 +00:00
Implement asc in js for dist
This commit is contained in:
@ -8,12 +8,10 @@
|
||||
(func $do/loopDo (; 0 ;) (type $iv) (param $0 i32)
|
||||
(block $break$1.1
|
||||
(loop $continue$1.1
|
||||
(block
|
||||
(set_local $0
|
||||
(i32.sub
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $0
|
||||
(i32.sub
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br_if $continue$1.1
|
||||
@ -34,12 +32,10 @@
|
||||
)
|
||||
(block $break$1.2
|
||||
(loop $continue$1.2
|
||||
(block
|
||||
(set_local $0
|
||||
(i32.sub
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $0
|
||||
(i32.sub
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br_if $continue$1.2
|
||||
|
37
tests/compiler/for.optimized.wast
Normal file
37
tests/compiler/for.optimized.wast
Normal file
@ -0,0 +1,37 @@
|
||||
(module
|
||||
(type $v (func))
|
||||
(global $for/i (mut i32) (i32.const 0))
|
||||
(memory $0 1)
|
||||
(data (i32.const 4) "\08")
|
||||
(export "memory" (memory $0))
|
||||
(start $start)
|
||||
(func $start (; 0 ;) (type $v)
|
||||
(set_global $for/i
|
||||
(i32.const 0)
|
||||
)
|
||||
(loop $continue$1.1
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_global $for/i)
|
||||
(i32.const 10)
|
||||
)
|
||||
(block
|
||||
(set_global $for/i
|
||||
(i32.add
|
||||
(get_global $for/i)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $continue$1.1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(get_global $for/i)
|
||||
(i32.const 10)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
)
|
6
tests/compiler/for.ts
Normal file
6
tests/compiler/for.ts
Normal file
@ -0,0 +1,6 @@
|
||||
let i: i32;
|
||||
for (i = 0; i < 10; ++i) {
|
||||
;
|
||||
}
|
||||
if (i != 10)
|
||||
unreachable();
|
71
tests/compiler/for.wast
Normal file
71
tests/compiler/for.wast
Normal file
@ -0,0 +1,71 @@
|
||||
(module
|
||||
(type $v (func))
|
||||
(global $for/i (mut i32) (i32.const 0))
|
||||
(memory $0 1)
|
||||
(data (i32.const 4) "\08\00\00\00")
|
||||
(export "memory" (memory $0))
|
||||
(start $start)
|
||||
(func $start (; 0 ;) (type $v)
|
||||
(block $break$1.1
|
||||
(set_global $for/i
|
||||
(i32.const 0)
|
||||
)
|
||||
(loop $continue$1.1
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_global $for/i)
|
||||
(i32.const 10)
|
||||
)
|
||||
(block
|
||||
(nop)
|
||||
(set_global $for/i
|
||||
(i32.add
|
||||
(get_global $for/i)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $continue$1.1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(get_global $for/i)
|
||||
(i32.const 10)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
)
|
||||
(;
|
||||
[program.elements]
|
||||
clz
|
||||
ctz
|
||||
popcnt
|
||||
rotl
|
||||
rotr
|
||||
abs
|
||||
ceil
|
||||
copysign
|
||||
floor
|
||||
max
|
||||
min
|
||||
nearest
|
||||
sqrt
|
||||
trunc
|
||||
current_memory
|
||||
grow_memory
|
||||
unreachable
|
||||
load
|
||||
store
|
||||
reinterpret
|
||||
select
|
||||
sizeof
|
||||
isNaN
|
||||
isFinite
|
||||
assert
|
||||
for/i
|
||||
[program.exports]
|
||||
|
||||
;)
|
@ -11,12 +11,10 @@
|
||||
(if
|
||||
(get_local $0)
|
||||
(block
|
||||
(block
|
||||
(set_local $0
|
||||
(i32.sub
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $0
|
||||
(i32.sub
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $continue$1.1)
|
||||
@ -43,12 +41,10 @@
|
||||
(if
|
||||
(get_local $0)
|
||||
(block
|
||||
(block
|
||||
(set_local $0
|
||||
(i32.sub
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $0
|
||||
(i32.sub
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $continue$1.2)
|
||||
|
Reference in New Issue
Block a user