porffor 0.18.25 → 0.18.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -606,7 +606,90 @@ export const __Array_prototype_toSorted = (_this: any[], callbackFn: any) => {
|
|
606
606
|
return __Array_prototype_sort(out, callbackFn);
|
607
607
|
};
|
608
608
|
|
609
|
-
|
609
|
+
export const __Array_prototype_toSpliced = (_this: any[], start: number, deleteCount: any, ...items: any[]) => {
|
610
|
+
let out: any[] = Porffor.allocate();
|
611
|
+
Porffor.clone(_this, out);
|
612
|
+
|
613
|
+
const len: i32 = _this.length;
|
614
|
+
|
615
|
+
start |= 0;
|
616
|
+
if (start < 0) {
|
617
|
+
start = len + start;
|
618
|
+
if (start < 0) start = 0;
|
619
|
+
}
|
620
|
+
if (start > len) start = len;
|
621
|
+
|
622
|
+
if (Porffor.rawType(deleteCount) == Porffor.TYPES.undefined) deleteCount = len - start;
|
623
|
+
deleteCount |= 0;
|
624
|
+
|
625
|
+
if (deleteCount < 0) deleteCount = 0;
|
626
|
+
if (deleteCount > len - start) deleteCount = len - start;
|
627
|
+
|
628
|
+
// update this length
|
629
|
+
const itemsLen: i32 = items.length;
|
630
|
+
out.length = len - deleteCount + itemsLen;
|
631
|
+
|
632
|
+
// remove deleted values via memory.copy shifting values in mem
|
633
|
+
Porffor.wasm`;; ptr = ptr(_this) + 4 + (start * 9)
|
634
|
+
local #splice_ptr i32
|
635
|
+
local.get ${out}
|
636
|
+
i32.to_u
|
637
|
+
i32.const 4
|
638
|
+
i32.add
|
639
|
+
local.get ${start}
|
640
|
+
i32.to_u
|
641
|
+
i32.const 9
|
642
|
+
i32.mul
|
643
|
+
i32.add
|
644
|
+
local.set #splice_ptr
|
645
|
+
|
646
|
+
;; dst = ptr + itemsLen * 9
|
647
|
+
local.get #splice_ptr
|
648
|
+
local.get ${itemsLen}
|
649
|
+
i32.to_u
|
650
|
+
i32.const 9
|
651
|
+
i32.mul
|
652
|
+
i32.add
|
653
|
+
|
654
|
+
;; src = ptr + deleteCount * 9
|
655
|
+
local.get #splice_ptr
|
656
|
+
local.get ${deleteCount}
|
657
|
+
i32.to_u
|
658
|
+
i32.const 9
|
659
|
+
i32.mul
|
660
|
+
i32.add
|
661
|
+
|
662
|
+
;; size = (len - start - deleteCount) * 9
|
663
|
+
local.get ${len}
|
664
|
+
i32.to_u
|
665
|
+
local.get ${start}
|
666
|
+
i32.to_u
|
667
|
+
local.get ${deleteCount}
|
668
|
+
i32.to_u
|
669
|
+
i32.sub
|
670
|
+
i32.sub
|
671
|
+
i32.const 9
|
672
|
+
i32.mul
|
673
|
+
|
674
|
+
memory.copy 0 0`;
|
675
|
+
|
676
|
+
if (itemsLen > 0) {
|
677
|
+
let itemsPtr: i32 = Porffor.wasm`local.get ${items}`;
|
678
|
+
let outPtr: i32 = Porffor.wasm`local.get ${out}` + start * 9;
|
679
|
+
let outPtrEnd: i32 = outPtr + itemsLen * 9;
|
680
|
+
|
681
|
+
while (outPtr < outPtrEnd) {
|
682
|
+
Porffor.wasm.f64.store(outPtr, Porffor.wasm.f64.load(itemsPtr, 0, 4), 0, 4);
|
683
|
+
Porffor.wasm.i32.store8(outPtr, Porffor.wasm.i32.load8_u(itemsPtr, 0, 12), 0, 12);
|
684
|
+
|
685
|
+
outPtr += 9;
|
686
|
+
itemsPtr += 9;
|
687
|
+
}
|
688
|
+
}
|
689
|
+
|
690
|
+
return out;
|
691
|
+
};
|
692
|
+
|
610
693
|
|
611
694
|
export const __Array_prototype_flat = (_this: any[], depth: any) => {
|
612
695
|
if (Porffor.rawType(depth) == Porffor.TYPES.undefined) depth = 1;
|
@@ -348,6 +348,13 @@ export const BuiltinFuncs = function() {
|
|
348
348
|
returns: [124,127], typedReturns: 1,
|
349
349
|
locals: [124,127], localNames: ["_this","_this#type","callbackFn","callbackFn#type","out","#last_type"],
|
350
350
|
};
|
351
|
+
this.__Array_prototype_toSpliced = {
|
352
|
+
wasm: (scope, {builtin}) => [[16, builtin('__Porffor_allocate')],[33,9],[33,8],[32,0],[32,8],[16, builtin('__Porffor_clone')],[32,0],[252,3],[40,1,0],[184],[33,10],[32,2],[68,0,0,0,0,0,0,0,0],[16, builtin('f64_|')],[34,2],[68,0,0,0,0,0,0,0,0],[99],[4,64],[32,10],[32,2],[160],[34,2],[68,0,0,0,0,0,0,0,0],[99],[4,64],[68,0,0,0,0,0,0,0,0],[33,2],[11],[11],[32,2],[32,10],[100],[4,64],[32,10],[33,2],[11],[32,4],[32,5],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[97],[4,64],[32,10],[32,2],[161],[34,4],[65,0],[33,5],[26],[11],[32,4],[68,0,0,0,0,0,0,0,0],[16, builtin('f64_|')],[34,4],[65,0],[33,5],[26],[32,4],[68,0,0,0,0,0,0,0,0],[99],[4,64],[68,0,0,0,0,0,0,0,0],[34,4],[65,0],[33,5],[26],[11],[32,4],[32,10],[32,2],[161],[100],[4,64],[32,10],[32,2],[161],[34,4],[65,0],[33,5],[26],[11],[32,6],[252,3],[40,1,0],[184],[33,11],[32,8],[252,3],[32,10],[32,4],[161],[32,11],[160],[34,12],[252,3],[54,1,0],[32,8],[252,3],[65,4],[106],[32,2],[252,3],[65,9],[108],[106],[34,13],[32,11],[252,3],[65,9],[108],[106],[32,13],[32,4],[252,3],[65,9],[108],[106],[32,10],[252,3],[32,2],[252,3],[32,4],[252,3],[107],[107],[65,9],[108],[252,10,0,0],[32,11],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,6],[33,14],[32,8],[32,2],[68,0,0,0,0,0,0,34,64],[162],[160],[34,15],[32,11],[68,0,0,0,0,0,0,34,64],[162],[160],[33,16],[3,64],[32,15],[32,16],[99],[4,64],[32,15],[252,2],[32,14],[252,2],[43,0,4],[57,0,4],[32,15],[252,2],[32,14],[252,2],[45,0,12],[58,0,12],[32,15],[68,0,0,0,0,0,0,34,64],[160],[33,15],[32,14],[68,0,0,0,0,0,0,34,64],[160],[33,14],[12,1],[11],[11],[11],[32,8],[65,208,0],[15]],
|
353
|
+
params: [124,127,124,127,124,127,124,127], typedParams: 1,
|
354
|
+
returns: [124,127], typedReturns: 1,
|
355
|
+
locals: [124,127,124,124,124,127,124,124,124], localNames: ["_this","_this#type","start","start#type","deleteCount","deleteCount#type","items","items#type","out","#last_type","len","itemsLen","__length_setter_tmp","#splice_ptr","itemsPtr","outPtr","outPtrEnd"],
|
356
|
+
hasRestArgument: 1,
|
357
|
+
};
|
351
358
|
this.__Array_prototype_flat = {
|
352
359
|
wasm: (scope, {builtin,internalThrow}) => [[32,2],[32,3],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[97],[4,64],[68,0,0,0,0,0,0,240,63],[34,2],[65,0],[33,3],[26],[11],[16, builtin('__Porffor_allocate')],[33,5],[33,4],[32,2],[68,0,0,0,0,0,0,0,0],[101],[4,64],[32,0],[32,4],[16, builtin('__Porffor_clone')],[32,4],[65,208,0],[15],[11],[32,0],[252,3],[40,1,0],[184],[33,6],[68,0,0,0,0,0,0,0,0],[33,7],[68,0,0,0,0,0,0,0,0],[33,8],[3,64],[32,7],[32,6],[99],[4,64],[32,7],[32,7],[68,0,0,0,0,0,0,240,63],[160],[33,7],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,11],[43,0,4],[32,11],[45,0,12],[33,5],[33,9],[32,5],[33,10],[32,9],[32,10],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,84,64],[97],[4,64],[32,2],[68,0,0,0,0,0,0,240,63],[100],[4,64],[32,9],[32,10],[32,2],[68,0,0,0,0,0,0,240,63],[161],[65,0],[16, builtin('__Array_prototype_flat')],[33,10],[26],[11],[32,9],[252,3],[33,12],[65,0],[33,14],[32,12],[40,1,0],[33,13],[32,10],[33,19],[2,64],[32,19],[65,19],[70],[4,64,"TYPESWITCH|Set"],[3,64],[32,12],[43,0,4],[32,12],[45,0,12],[33,16],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,12],[65,9],[106],[33,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,194,0],[70],[4,64,"TYPESWITCH|String"],[65,194,0],[33,16],[65,128,128,8],[65,1],[54,0,0],[3,64],[65,128,128,8],[32,12],[47,0,4],[59,0,4],[68,0,0,0,0,0,0,0,65],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,12],[65,2],[106],[33,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[3,64],[32,12],[43,0,4],[32,12],[45,0,12],[33,16],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,12],[65,9],[106],[33,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,215,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[106],[45,0,4],[184],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,216,0],[70],[4,64,"TYPESWITCH|Int8Array"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[106],[44,0,4],[183],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,217,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[106],[45,0,4],[184],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,218,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[65,2],[108],[106],[47,0,4],[184],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,219,0],[70],[4,64,"TYPESWITCH|Int16Array"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[65,2],[108],[106],[46,0,4],[183],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,220,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[65,4],[108],[106],[40,0,4],[184],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,221,0],[70],[4,64,"TYPESWITCH|Int32Array"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[65,4],[108],[106],[40,0,4],[183],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,222,0],[70],[4,64,"TYPESWITCH|Float32Array"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[65,4],[108],[106],[42,0,4],[187],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,223,0],[70],[4,64,"TYPESWITCH|Float64Array"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[65,8],[108],[106],[43,0,4],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,194,1],[70],[4,64,"TYPESWITCH|ByteString"],[65,194,1],[33,16],[65,128,128,8],[65,1],[54,0,0],[3,64],[65,128,128,8],[32,12],[32,14],[106],[45,0,4],[58,0,4],[68,0,0,0,0,0,0,0,65],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `Tried for..of on non-iterable type`),[11,"TYPESWITCH_end"],[5],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,9],[34,17],[57,0,4],[32,18],[32,10],[58,0,12],[11],[12,1],[11],[11],[32,4],[252,3],[32,8],[34,20],[252,3],[54,1,0],[32,4],[65,208,0],[15]],
|
353
360
|
params: [124,127,124,127], typedParams: 1,
|
package/package.json
CHANGED