Utilize Binaryen's -O4

When specifying -O3 or -Oz, asc now automatically increases the optimize level to 4, then including costly non-LLVM optimizations for blocky code, in turn achieving similar results as an LLVM-based generator.
This commit is contained in:
dcodeIO
2018-06-09 14:05:33 +02:00
parent e9094bbd6f
commit c6ec5e2832
46 changed files with 14240 additions and 16223 deletions

View File

@ -14,31 +14,32 @@
(export "stringArrayArrayMethodCall" (func $std/array-access/stringArrayArrayMethodCall))
(export "memory" (memory $0))
(func $~lib/array/Array<Array<i32>>#__get (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(if (result i32)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
(tee_local $2
(i32.load
(get_local $0)
(tee_local $0
(if (result i32)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
(tee_local $0
(i32.load
(get_local $0)
)
)
)
)
(i32.const 2)
)
)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
(i32.load offset=8
(i32.add
(get_local $0)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
)
(unreachable)
)
(unreachable)
)
)
(func $std/array-access/i32ArrayArrayElementAccess (; 2 ;) (type $ii) (param $0 i32) (result i32)
@ -105,23 +106,24 @@
)
)
)
(if (result i32)
(get_local $2)
(i32.sub
(i32.load8_u
(get_local $0)
)
(i32.load8_u
(get_local $1)
(tee_local $0
(if (result i32)
(get_local $2)
(i32.sub
(i32.load8_u
(get_local $0)
)
(i32.load8_u
(get_local $1)
)
)
(i32.const 0)
)
(i32.const 0)
)
)
(func $~lib/string/String#startsWith (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(if
(i32.eqz
(get_local $0)
@ -152,33 +154,31 @@
(get_local $1)
)
)
(tee_local $2
(tee_local $3
(select
(tee_local $2
(tee_local $3
(select
(get_local $2)
(i32.const 0)
(i32.gt_s
(get_local $2)
(get_local $3)
(i32.const 0)
)
)
)
(tee_local $3
(tee_local $5
(i32.load
(get_local $0)
)
(tee_local $2
(i32.load
(get_local $0)
)
)
(i32.lt_s
(get_local $2)
(get_local $3)
(get_local $2)
)
)
)
)
(get_local $5)
(get_local $2)
)
(return
(i32.const 0)
@ -192,7 +192,7 @@
(i32.const 4)
)
(i32.shl
(get_local $2)
(get_local $3)
(i32.const 1)
)
)