mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-19 09:51:33 +00:00
Implement String#padStart/padEnd; Refactor internal string copy, compare and repeat (#171)
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
(type $Iv (func (param i64)))
|
||||
(type $II (func (param i64) (result i64)))
|
||||
(type $iv (func (param i32)))
|
||||
(type $iiiiii (func (param i32 i32 i32 i32 i32) (result i32)))
|
||||
(type $v (func))
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(import "JSMath" "random" (func $~lib/math/JSMath.random (result f64)))
|
||||
@ -5473,36 +5474,50 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/internal/string/compareUTF16 (; 90 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
||||
(local $3 i32)
|
||||
(func $~lib/internal/string/compareUnsafe (; 90 ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32)
|
||||
(local $5 i32)
|
||||
(set_local $1
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.shl
|
||||
(get_local $3)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
(if (result i32)
|
||||
(get_local $2)
|
||||
(i32.eqz
|
||||
(tee_local $3
|
||||
(i32.sub
|
||||
(i32.load16_u offset=4
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.load16_u offset=4
|
||||
(get_local $1)
|
||||
(tee_local $0
|
||||
(if (result i32)
|
||||
(get_local $4)
|
||||
(i32.eqz
|
||||
(tee_local $5
|
||||
(i32.sub
|
||||
(i32.load16_u offset=4
|
||||
(get_local $1)
|
||||
)
|
||||
(i32.load16_u offset=4
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(get_local $4)
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
(block
|
||||
(set_local $2
|
||||
(set_local $4
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
(get_local $4)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
@ -5512,11 +5527,17 @@
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(get_local $3)
|
||||
(get_local $5)
|
||||
)
|
||||
(func $~lib/string/String.__gt (; 91 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
@ -5578,9 +5599,11 @@
|
||||
)
|
||||
)
|
||||
(i32.gt_s
|
||||
(call $~lib/internal/string/compareUTF16
|
||||
(call $~lib/internal/string/compareUnsafe
|
||||
(get_local $0)
|
||||
(i32.const 0)
|
||||
(get_local $1)
|
||||
(i32.const 0)
|
||||
(select
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
@ -5653,9 +5676,11 @@
|
||||
)
|
||||
)
|
||||
(i32.lt_s
|
||||
(call $~lib/internal/string/compareUTF16
|
||||
(call $~lib/internal/string/compareUnsafe
|
||||
(get_local $0)
|
||||
(i32.const 0)
|
||||
(get_local $1)
|
||||
(i32.const 0)
|
||||
(select
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
@ -5727,9 +5752,11 @@
|
||||
)
|
||||
)
|
||||
(i32.eqz
|
||||
(call $~lib/internal/string/compareUTF16
|
||||
(call $~lib/internal/string/compareUnsafe
|
||||
(get_local $0)
|
||||
(i32.const 0)
|
||||
(get_local $1)
|
||||
(i32.const 0)
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
@ -5861,7 +5888,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 696)
|
||||
(i32.const 56)
|
||||
(i32.const 58)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
@ -5956,20 +5983,21 @@
|
||||
(get_local $0)
|
||||
(i32.const 4)
|
||||
)
|
||||
(tee_local $0
|
||||
(i32.shl
|
||||
(get_local $3)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.shl
|
||||
(get_local $3)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(call $~lib/memory/memory.copy
|
||||
(i32.add
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.const 4)
|
||||
(i32.shl
|
||||
(get_local $3)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(get_local $0)
|
||||
(i32.const 4)
|
||||
)
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
|
Reference in New Issue
Block a user