porffor 0.18.18 → 0.18.20

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.
@@ -311,29 +311,6 @@ export const __Array_prototype_reverse = (_this: any[]) => {
311
311
  return _this;
312
312
  };
313
313
 
314
- // @porf-typed-array
315
- export const __Array_prototype_toReversed = (_this: any[]) => {
316
- const len: i32 = _this.length;
317
-
318
- let start: i32 = 0;
319
- let end: i32 = len - 1;
320
-
321
- let out: any[] = Porffor.allocate();
322
- out.length = len;
323
-
324
- while (start < end) {
325
- out[start] = _this[end];
326
- out[end--] = _this[start++];
327
- }
328
-
329
- return out;
330
- };
331
-
332
- // @porf-typed-array
333
- export const __Array_prototype_valueOf = (_this: any[]) => {
334
- return _this;
335
- };
336
-
337
314
 
338
315
  // @porf-typed-array
339
316
  export const __Array_prototype_forEach = (_this: any[], callbackFn: any) => {
@@ -563,4 +540,39 @@ export const __Array_prototype_join = (_this: any[], _separator: any) => {
563
540
  }
564
541
 
565
542
  return out;
566
- };
543
+ };
544
+
545
+ // @porf-typed-array
546
+ export const __Array_prototype_valueOf = (_this: any[]) => {
547
+ return _this;
548
+ };
549
+
550
+ // @porf-typed-array
551
+ export const __Array_prototype_toReversed = (_this: any[]) => {
552
+ const len: i32 = _this.length;
553
+
554
+ let start: i32 = 0;
555
+ let end: i32 = len - 1;
556
+
557
+ let out: any[] = Porffor.allocate();
558
+ out.length = len;
559
+
560
+ while (start < end) {
561
+ out[start] = _this[end];
562
+ out[end--] = _this[start++];
563
+ }
564
+
565
+ return out;
566
+ };
567
+
568
+ // @porf-typed-array
569
+ export const __Array_prototype_toSorted = (_this: any[], callbackFn: any) => {
570
+ // todo/perf: could be rewritten to be its own instead of cloning and using normal sort()
571
+
572
+ let out: any[] = Porffor.allocate();
573
+ Porffor.clone(_this, out);
574
+
575
+ return __Array_prototype_sort(out, callbackFn);
576
+ };
577
+
578
+ // todo: toSpliced
@@ -1138,9 +1138,11 @@ const asmFunc = (name, { wasm, params, locals: localTypes, globals: globalTypes
1138
1138
  }
1139
1139
 
1140
1140
  for (const x of _data) {
1141
- const copy = { ...x };
1142
- if (copy.offset != null) copy.offset += pages.size * pageSize;
1143
- data.push(copy);
1141
+ let offset = x[0];
1142
+ if (offset != null) offset += pages.size * pageSize;
1143
+
1144
+ const bytes = x[1];
1145
+ data.push({ offset, bytes });
1144
1146
  }
1145
1147
 
1146
1148
  const func = {