Binary expression operator overloads for +/==; Check allocation flow in ternary expressions; Cache empty array buffers; Sealed decorator for non-derivable internals

This commit is contained in:
dcodeIO
2018-03-23 12:45:29 +01:00
parent 9cc0fcd611
commit 4adb69f73a
18 changed files with 5074 additions and 267 deletions

View File

@ -10,6 +10,7 @@
(global "$(lib)/allocator/arena/startOffset" (mut i32) (i32.const 0))
(global "$(lib)/allocator/arena/offset" (mut i32) (i32.const 0))
(global $std/arraybuffer/buffer (mut i32) (i32.const 0))
(global "$(lib)/arraybuffer/ArrayBuffer.EMPTY" (mut i32) (i32.const 0))
(global $std/arraybuffer/sliced (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 44))
(memory $0 1)
@ -2028,82 +2029,105 @@
)
)
)
(i32.store
(tee_local $3
(call "$(lib)/allocator/arena/allocate_memory"
(i32.add
(tee_local $2
(select
(tee_local $3
(i32.sub
(tee_local $2
(if (result i32)
(i32.lt_s
(get_local $2)
(i32.const 0)
)
(select
(tee_local $3
(i32.add
(get_local $5)
(get_local $2)
)
)
(tee_local $4
(i32.const 0)
)
(i32.gt_s
(get_local $3)
(get_local $4)
)
)
(select
(tee_local $3
(get_local $2)
)
(tee_local $4
(get_local $5)
)
(i32.lt_s
(get_local $3)
(get_local $4)
)
)
(if (result i32)
(tee_local $2
(select
(tee_local $3
(i32.sub
(tee_local $2
(if (result i32)
(i32.lt_s
(get_local $2)
(i32.const 0)
)
(select
(tee_local $3
(i32.add
(get_local $5)
(get_local $2)
)
)
(get_local $1)
(tee_local $4
(i32.const 0)
)
(i32.gt_s
(get_local $3)
(get_local $4)
)
)
(select
(tee_local $3
(get_local $2)
)
(tee_local $4
(get_local $5)
)
(i32.lt_s
(get_local $3)
(get_local $4)
)
)
)
(tee_local $4
(i32.const 0)
)
(i32.gt_s
(get_local $3)
(get_local $4)
)
)
(get_local $1)
)
(i32.const 4)
)
(tee_local $4
(i32.const 0)
)
(i32.gt_s
(get_local $3)
(get_local $4)
)
)
)
(get_local $2)
)
(call "$(lib)/memory/move_memory"
(i32.add
(get_local $3)
(i32.const 4)
)
(i32.add
(i32.add
(get_local $0)
(i32.const 4)
(block (result i32)
(i32.store
(tee_local $3
(call "$(lib)/allocator/arena/allocate_memory"
(i32.add
(get_local $2)
(i32.const 4)
)
)
)
(get_local $2)
)
(call "$(lib)/memory/move_memory"
(i32.add
(get_local $3)
(i32.const 4)
)
(i32.add
(i32.add
(get_local $0)
(i32.const 4)
)
(get_local $1)
)
(get_local $2)
)
(get_local $3)
)
(if (result i32)
(get_global "$(lib)/arraybuffer/ArrayBuffer.EMPTY")
(get_global "$(lib)/arraybuffer/ArrayBuffer.EMPTY")
(block (result i32)
(i32.store
(tee_local $3
(call "$(lib)/allocator/arena/allocate_memory"
(i32.const 4)
)
)
(i32.const 0)
)
(set_global "$(lib)/arraybuffer/ArrayBuffer.EMPTY"
(get_local $3)
)
(get_local $3)
)
(get_local $1)
)
(get_local $2)
)
(get_local $3)
)
(func "$(lib)/arraybuffer/ArrayBuffer#slice|trampoline" (; 6 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
(block $N=2

View File

@ -15,6 +15,7 @@
(global "$(lib)/allocator/arena/offset" (mut i32) (i32.const 0))
(global "$(lib)/arraybuffer/HEADER_SIZE" i32 (i32.const 4))
(global $std/arraybuffer/buffer (mut i32) (i32.const 0))
(global "$(lib)/arraybuffer/ArrayBuffer.EMPTY" (mut i32) (i32.const 0))
(global $std/arraybuffer/sliced (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 44))
(memory $0 1)
@ -2280,7 +2281,6 @@
(local $4 i32)
(local $5 i32)
(local $6 i32)
(local $7 i32)
(set_local $3
(i32.load
(get_local $0)
@ -2377,34 +2377,62 @@
)
)
)
(set_local $7
(call "$(lib)/allocator/arena/allocate_memory"
(i32.add
(i32.const 4)
(if
(get_local $6)
(block
(set_local $4
(call "$(lib)/allocator/arena/allocate_memory"
(i32.add
(i32.const 4)
(get_local $6)
)
)
)
(i32.store
(get_local $4)
(get_local $6)
)
)
)
(i32.store
(get_local $7)
(get_local $6)
)
(call "$(lib)/memory/move_memory"
(i32.add
(get_local $7)
(i32.const 4)
)
(i32.add
(i32.add
(get_local $0)
(i32.const 4)
(call "$(lib)/memory/move_memory"
(i32.add
(get_local $4)
(i32.const 4)
)
(i32.add
(i32.add
(get_local $0)
(i32.const 4)
)
(get_local $1)
)
(get_local $6)
)
(return
(get_local $4)
)
)
(if
(get_global "$(lib)/arraybuffer/ArrayBuffer.EMPTY")
(return
(get_global "$(lib)/arraybuffer/ArrayBuffer.EMPTY")
)
(block
(set_local $4
(call "$(lib)/allocator/arena/allocate_memory"
(i32.const 4)
)
)
(i32.store
(get_local $4)
(i32.const 0)
)
(set_global "$(lib)/arraybuffer/ArrayBuffer.EMPTY"
(get_local $4)
)
(return
(get_local $4)
)
)
(get_local $1)
)
(get_local $6)
)
(return
(get_local $7)
)
)
(func "$(lib)/arraybuffer/ArrayBuffer#slice|trampoline" (; 6 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,5 @@
import "allocator/arena";
// preliminary
var str: string = "hi, I'm a string";
@ -31,3 +33,6 @@ assert(parseFloat("1") == 1);
assert(parseFloat("0.1") == 0.1);
assert(parseFloat(".25") == 0.25);
assert(parseFloat(".1foobar") == 0.1);
var c = "a" + "b";
assert(c == "ab");

File diff suppressed because it is too large Load Diff