porffor 0.17.0-c2af76d41 → 0.17.0-c2dd8f88f

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.
package/README.md CHANGED
@@ -148,27 +148,29 @@ These include some early (stage 1/0) and/or dead (last commit years ago) proposa
148
148
  - Array constructor (`Array(5)`, `new Array(1, 2, 3)`)
149
149
  - Labelled statements (`foo: while (...)`)
150
150
  - `do...while` loops
151
+ - Optional parameters (`(foo = 'bar') => { ... }`)
151
152
 
152
153
  ### Built-ins
153
154
 
154
155
  - `NaN` and `Infinity`
155
156
  - `isNaN()` and `isFinite()`
156
157
  - Most of `Number` (`MAX_VALUE`, `MIN_VALUE`, `MAX_SAFE_INTEGER`, `MIN_SAFE_INTEGER`, `POSITIVE_INFINITY`, `NEGATIVE_INFINITY`, `EPSILON`, `NaN`, `isNaN`, `isFinite`, `isInteger`, `isSafeInteger`)
157
- - Some `Math` funcs (`sqrt`, `abs`, `floor`, `sign`, `round`, `trunc`, `clz32`, `fround`, `random`)
158
+ - Most `Math` funcs (`sqrt`, `abs`, `floor`, `sign`, `round`, `trunc`, `clz32`, `fround`, `random`, `exp`, `log`, `log2`, `log10`, `pow`, `expm1`, `log1p`, `sqrt`, `cbrt`, `hypot`, `sin`, `cos`, `tan`, `sinh`, `cosh`, `tanh`, `asinh`, `acosh`, `atanh`, `asin`, `acos`, `atan`, `atan2`)
158
159
  - Basic `globalThis` support
159
160
  - Basic `Boolean` and `Number`
160
161
  - Basic `eval` for literals
161
162
  - `Math.random()` using self-made xorshift128+ PRNG
162
163
  - Some of `performance` (`now()`, `timeOrigin`)
163
- - Some of `Array.prototype` (`at`, `push`, `pop`, `shift`, `fill`, `slice`, `indexOf`, `lastIndexOf`, `includes`, `with`, `reverse`, `toReversed`)
164
- - Some of `Array` (`of`, `isArray`)
165
- - Most of `String.prototype` (`at`, `charAt`, `charCodeAt`, `toUpperCase`, `toLowerCase`, `startsWith`, `endsWith`, `indexOf`, `lastIndexOf`, `includes`, `padStart`, `padEnd`, `substring`, `substr`, `slice`, `trimStart`, `trimEnd`, `trim`, `toString`, `big`, `blink`, `bold`, `fixed`, `italics`, `small`, `strike`, `sub`, `sup`, `trimLeft`, `trimRight`, )
164
+ - Most of `Array.prototype` (`at`, `push`, `pop`, `shift`, `fill`, `slice`, `indexOf`, `lastIndexOf`, `includes`, `with`, `reverse`, `toReversed`, `forEach`, `filter`, `map`, `find`, `findLast`, `findIndex`, `findLastIndex`, `every`, `some`, `reduce`, `reduceRight`, `join`, `toString`)
165
+ - Most of `Array` (`of`, `isArray`)
166
+ - Most of `String.prototype` (`at`, `charAt`, `charCodeAt`, `toUpperCase`, `toLowerCase`, `startsWith`, `endsWith`, `indexOf`, `lastIndexOf`, `includes`, `padStart`, `padEnd`, `substring`, `substr`, `slice`, `trimStart`, `trimEnd`, `trim`, `toString`, `big`, `blink`, `bold`, `fixed`, `italics`, `small`, `strike`, `sub`, `sup`, `trimLeft`, `trimRight`, `trim`)
166
167
  - Some of `crypto` (`randomUUID`)
167
168
  - `escape`
168
169
  - `btoa`
169
170
  - Most of `Number.prototype` (`toString`, `toFixed`, `toExponential`)
170
171
  - `parseInt`
171
172
  - Spec-compliant `Date`
173
+ - WIP typed arrays (`Uint8Array`, `Int32Array`, etc)
172
174
 
173
175
  ### Custom
174
176
 
@@ -82,7 +82,17 @@ export default (funcs, globals, tags, pages, data, flags, noTreeshake = false) =
82
82
  params.push(valtypeBinary, Valtype.i32);
83
83
  }
84
84
 
85
- const returns = [ valtypeBinary, Valtype.i32 ];
85
+ if (inst.at(-1) === 'constr') {
86
+ inst.pop();
87
+ params.unshift(Valtype.i32);
88
+ }
89
+
90
+ let returns = [ valtypeBinary, Valtype.i32 ];
91
+ if (inst.at(-1) === 'no_type_return') {
92
+ inst.pop();
93
+ returns = [ valtypeBinary ];
94
+ }
95
+
86
96
  inst[1] = getType(params, returns);
87
97
  }
88
98
  }
@@ -116,16 +126,21 @@ export default (funcs, globals, tags, pages, data, flags, noTreeshake = false) =
116
126
  ] ])
117
127
  );
118
128
 
119
- if (pages.has('func argc lut') && !data.addedFuncArgcLut) {
120
- // generate func argc lut data
129
+ if (pages.has('func lut') && !data.addedFuncArgcLut) {
130
+ // generate func lut data
121
131
  const bytes = [];
122
132
  for (let i = 0; i < funcs.length; i++) {
123
133
  const argc = Math.floor(funcs[i].params.length / 2);
124
134
  bytes.push(argc % 256, (argc / 256 | 0) % 256);
135
+
136
+ let flags = 0b00000000; // 8 flag bits
137
+ if (funcs[i].returnType != null) flags |= 0b1;
138
+ if (funcs[i].constr) flags |= 0b10;
139
+ bytes.push(flags);
125
140
  }
126
141
 
127
142
  data.push({
128
- offset: pages.get('func argc lut').ind * pageSize,
143
+ offset: pages.get('func lut').ind * pageSize,
129
144
  bytes
130
145
  });
131
146
  data.addedFuncArgcLut = true;
@@ -46,6 +46,34 @@ export const __Array_prototype_slice = (_this: any[], start: number, end: number
46
46
  return out;
47
47
  };
48
48
 
49
+ // @porf-typed-array
50
+ export const __Array_prototype_fill = (_this: any[], value: any, start: any, end: any) => {
51
+ const len: i32 = _this.length;
52
+
53
+ if (Porffor.rawType(start) == Porffor.TYPES.undefined) start = 0;
54
+ if (Porffor.rawType(end) == Porffor.TYPES.undefined) end = len;
55
+
56
+ start |= 0;
57
+ end |= 0;
58
+
59
+ if (start < 0) {
60
+ start = len + start;
61
+ if (start < 0) start = 0;
62
+ }
63
+ if (start > len) start = len;
64
+ if (end < 0) {
65
+ end = len + end;
66
+ if (end < 0) end = 0;
67
+ }
68
+ if (end > len) end = len;
69
+
70
+ for (let i: i32 = start; i < end; i++) {
71
+ _this[i] = value;
72
+ }
73
+
74
+ return _this;
75
+ };
76
+
49
77
  // @porf-typed-array
50
78
  export const __Array_prototype_indexOf = (_this: any[], searchElement: any, position: number) => {
51
79
  const len: i32 = _this.length;
@@ -718,108 +718,6 @@ export const __Porffor_date_write = (ptr: Date, val: number) => {
718
718
  Porffor.wasm.f64.store(ptr, val, 0, 0);
719
719
  };
720
720
 
721
- // 21.4.2.1 Date (...values)
722
- // https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-date
723
- export const Date$constructor = (v0: unknown, v1: unknown, v2: unknown, v3: unknown, v4: unknown, v5: unknown, v6: unknown): Date => {
724
- // todo: passing undefined to params should not act like no arg was passed
725
-
726
- // 2. Let numberOfArgs be the number of elements in values.
727
- // sorry.
728
- const numberOfArgs: i32 =
729
- (Porffor.rawType(v0) != Porffor.TYPES.undefined) +
730
- (Porffor.rawType(v1) != Porffor.TYPES.undefined) +
731
- (Porffor.rawType(v2) != Porffor.TYPES.undefined) +
732
- (Porffor.rawType(v3) != Porffor.TYPES.undefined) +
733
- (Porffor.rawType(v4) != Porffor.TYPES.undefined) +
734
- (Porffor.rawType(v5) != Porffor.TYPES.undefined) +
735
- (Porffor.rawType(v6) != Porffor.TYPES.undefined);
736
-
737
- let dv: number = 0;
738
-
739
- // 3. If numberOfArgs = 0, then
740
- if (numberOfArgs == 0) {
741
- // a. Let dv be the time value (UTC) identifying the current time.
742
- dv = __Date_now();
743
- } else if (numberOfArgs == 1) {
744
- // 4. Else if numberOfArgs = 1, the n
745
- // a. Let value be values[0].
746
- const value: any = v0;
747
-
748
- const valueType: i32 = Porffor.rawType(v0);
749
-
750
- let tv: number = 0;
751
-
752
- // b. If value is an Object and value has a [[DateValue]] internal slot, then
753
- if (valueType == Porffor.TYPES.date) {
754
- // i. Let tv be value.[[DateValue]].
755
- tv = __Porffor_date_read(value);
756
- } else {
757
- // c. Else,
758
- // ii. If v is a String, then
759
- if (Porffor.fastOr(valueType == Porffor.TYPES.string, valueType == Porffor.TYPES.bytestring)) {
760
- // 1. Assert: The next step never returns an abrupt completion because v is a String.
761
-
762
- // 2. Let tv be the result of parsing v as a date, in exactly the same manner as for the parse method (21.4.3.2).
763
- tv = __Date_parse(value);
764
- } else {
765
- // iii. Else,
766
- // 1. Let tv be ? ToNumber(v).
767
- tv = Number(value);
768
- }
769
- }
770
-
771
- // d. Let dv be TimeClip(tv).
772
- dv = __ecma262_TimeClip(tv);
773
- } else {
774
- // 5. Else,
775
- // a. Assert: numberOfArgs ≥ 2.
776
-
777
- // b. Let y be ? ToNumber(values[0]).
778
- const y: number = Number(v0);
779
-
780
- // c. Let m be ? ToNumber(values[1]).
781
- const m: number = Number(v1);
782
-
783
- // d. If numberOfArgs > 2, let dt be ? ToNumber(values[2]); else let dt be 1𝔽.
784
- let dt: number = 1;
785
- if (numberOfArgs > 2) dt = Number(v2);
786
-
787
- // e. If numberOfArgs > 3, let h be ? ToNumber(values[3]); else let h be +0𝔽.
788
- let h: number = 0;
789
- if (numberOfArgs > 3) h = Number(v3);
790
-
791
- // f. If numberOfArgs > 4, let min be ? ToNumber(values[4]); else let min be +0𝔽.
792
- let min: number = 0;
793
- if (numberOfArgs > 4) min = Number(v4);
794
-
795
- // g. If numberOfArgs > 5, let s be ? ToNumber(values[5]); else let s be +0𝔽.
796
- let s: number = 0;
797
- if (numberOfArgs > 5) s = Number(v5);
798
-
799
- // h. If numberOfArgs > 6, let milli be ? ToNumber(values[6]); else let milli be +0𝔽.
800
- let milli: number = 0;
801
- if (numberOfArgs > 6) milli = Number(v6);
802
-
803
- // i. Let yr be MakeFullYear(y).
804
- const yr: number = __ecma262_MakeFullYear(y);
805
-
806
- // j. Let finalDate be MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli)).
807
- const finalDate: number = __ecma262_MakeDate(__ecma262_MakeDay(yr, m, dt), __ecma262_MakeTime(h, min, s, milli));
808
-
809
- // k. Let dv be TimeClip(UTC(finalDate)).
810
- dv = __ecma262_TimeClip(__ecma262_UTC(finalDate));
811
- }
812
-
813
- // 6. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%Date.prototype%", « [[DateValue]] »).
814
- const O: Date = __Porffor_date_allocate();
815
-
816
- // 7. Set O.[[DateValue]] to dv.
817
- __Porffor_date_write(O, dv);
818
-
819
- // 8. Return O.
820
- return O;
821
- };
822
-
823
721
 
824
722
  // 21.4.4 Properties of the Date Prototype Object
825
723
  // https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-properties-of-the-date-prototype-object
@@ -2034,9 +1932,109 @@ export const __Date_prototype_valueOf = (_this: Date) => {
2034
1932
 
2035
1933
  // 21.4.2.1 Date (...values)
2036
1934
  // https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-date
2037
- export const Date = (): bytestring => {
1935
+ export const Date = function (v0: unknown, v1: unknown, v2: unknown, v3: unknown, v4: unknown, v5: unknown, v6: unknown): bytestring|Date {
2038
1936
  // 1. If NewTarget is undefined, then
2039
- // a. Let now be the time value (UTC) identifying the current time.
2040
- // b. Return ToDateString(now).
2041
- return __ecma262_ToDateString(__Date_now());
1937
+ if (!new.target) {
1938
+ // a. Let now be the time value (UTC) identifying the current time.
1939
+ // b. Return ToDateString(now).
1940
+ return __ecma262_ToDateString(__Date_now());
1941
+ }
1942
+
1943
+ // todo: passing undefined to params should not act like no arg was passed
1944
+
1945
+ // 2. Let numberOfArgs be the number of elements in values.
1946
+ // sorry.
1947
+ const numberOfArgs: i32 =
1948
+ (Porffor.rawType(v0) != Porffor.TYPES.undefined) +
1949
+ (Porffor.rawType(v1) != Porffor.TYPES.undefined) +
1950
+ (Porffor.rawType(v2) != Porffor.TYPES.undefined) +
1951
+ (Porffor.rawType(v3) != Porffor.TYPES.undefined) +
1952
+ (Porffor.rawType(v4) != Porffor.TYPES.undefined) +
1953
+ (Porffor.rawType(v5) != Porffor.TYPES.undefined) +
1954
+ (Porffor.rawType(v6) != Porffor.TYPES.undefined);
1955
+
1956
+ let dv: number = 0;
1957
+
1958
+ // 3. If numberOfArgs = 0, then
1959
+ if (numberOfArgs == 0) {
1960
+ // a. Let dv be the time value (UTC) identifying the current time.
1961
+ dv = __Date_now();
1962
+ } else if (numberOfArgs == 1) {
1963
+ // 4. Else if numberOfArgs = 1, the n
1964
+ // a. Let value be values[0].
1965
+ const value: any = v0;
1966
+
1967
+ const valueType: i32 = Porffor.rawType(v0);
1968
+
1969
+ let tv: number = 0;
1970
+
1971
+ // b. If value is an Object and value has a [[DateValue]] internal slot, then
1972
+ if (valueType == Porffor.TYPES.date) {
1973
+ // i. Let tv be value.[[DateValue]].
1974
+ tv = __Porffor_date_read(value);
1975
+ } else {
1976
+ // c. Else,
1977
+ // ii. If v is a String, then
1978
+ if (Porffor.fastOr(valueType == Porffor.TYPES.string, valueType == Porffor.TYPES.bytestring)) {
1979
+ // 1. Assert: The next step never returns an abrupt completion because v is a String.
1980
+
1981
+ // 2. Let tv be the result of parsing v as a date, in exactly the same manner as for the parse method (21.4.3.2).
1982
+ tv = __Date_parse(value);
1983
+ } else {
1984
+ // iii. Else,
1985
+ // 1. Let tv be ? ToNumber(v).
1986
+ tv = Number(value);
1987
+ }
1988
+ }
1989
+
1990
+ // d. Let dv be TimeClip(tv).
1991
+ dv = __ecma262_TimeClip(tv);
1992
+ } else {
1993
+ // 5. Else,
1994
+ // a. Assert: numberOfArgs ≥ 2.
1995
+
1996
+ // b. Let y be ? ToNumber(values[0]).
1997
+ const y: number = Number(v0);
1998
+
1999
+ // c. Let m be ? ToNumber(values[1]).
2000
+ const m: number = Number(v1);
2001
+
2002
+ // d. If numberOfArgs > 2, let dt be ? ToNumber(values[2]); else let dt be 1𝔽.
2003
+ let dt: number = 1;
2004
+ if (numberOfArgs > 2) dt = Number(v2);
2005
+
2006
+ // e. If numberOfArgs > 3, let h be ? ToNumber(values[3]); else let h be +0𝔽.
2007
+ let h: number = 0;
2008
+ if (numberOfArgs > 3) h = Number(v3);
2009
+
2010
+ // f. If numberOfArgs > 4, let min be ? ToNumber(values[4]); else let min be +0𝔽.
2011
+ let min: number = 0;
2012
+ if (numberOfArgs > 4) min = Number(v4);
2013
+
2014
+ // g. If numberOfArgs > 5, let s be ? ToNumber(values[5]); else let s be +0𝔽.
2015
+ let s: number = 0;
2016
+ if (numberOfArgs > 5) s = Number(v5);
2017
+
2018
+ // h. If numberOfArgs > 6, let milli be ? ToNumber(values[6]); else let milli be +0𝔽.
2019
+ let milli: number = 0;
2020
+ if (numberOfArgs > 6) milli = Number(v6);
2021
+
2022
+ // i. Let yr be MakeFullYear(y).
2023
+ const yr: number = __ecma262_MakeFullYear(y);
2024
+
2025
+ // j. Let finalDate be MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli)).
2026
+ const finalDate: number = __ecma262_MakeDate(__ecma262_MakeDay(yr, m, dt), __ecma262_MakeTime(h, min, s, milli));
2027
+
2028
+ // k. Let dv be TimeClip(UTC(finalDate)).
2029
+ dv = __ecma262_TimeClip(__ecma262_UTC(finalDate));
2030
+ }
2031
+
2032
+ // 6. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%Date.prototype%", « [[DateValue]] »).
2033
+ const O: Date = __Porffor_date_allocate();
2034
+
2035
+ // 7. Set O.[[DateValue]] to dv.
2036
+ __Porffor_date_write(O, dv);
2037
+
2038
+ // 8. Return O.
2039
+ return O;
2042
2040
  };
@@ -1,11 +1,8 @@
1
1
  export default () => {
2
2
  let out = '';
3
3
 
4
- const error = name => out += `export const ${name} = (message: bytestring) => {
5
- return {};
6
- };
7
-
8
- export const ${name}$constructor = (message: bytestring) => {
4
+ const error = name => out += `export const ${name} = function (message: bytestring) {
5
+ new.target;
9
6
  return {};
10
7
  };`;
11
8
 
@@ -8,6 +8,7 @@ memory.grow 0
8
8
  i32.const 65536
9
9
  i32.mul
10
10
  i32.from_u
11
+ i32.const 0
11
12
  return`;
12
13
  };
13
14
 
@@ -163,11 +164,9 @@ export const __Set_prototype_clear = (_this: Set) => {
163
164
  Porffor.wasm.i32.store(_this, 0, 0, 0);
164
165
  };
165
166
 
166
- export const Set = () => {
167
- throw new TypeError("Constructor Set requires 'new'");
168
- };
167
+ export const Set = function (iterable: any): any {
168
+ if (!new.target) throw new TypeError("Constructor Set requires 'new'");
169
169
 
170
- export const Set$constructor = (iterable: any): Set => {
171
170
  const out: Set = __Porffor_allocate();
172
171
 
173
172
  if (Porffor.rawType(iterable) != Porffor.TYPES.undefined) for (const x of iterable) {
@@ -182,7 +181,7 @@ export const __Set_prototype_union = (_this: Set, other: any) => {
182
181
  throw new TypeError("Set.prototype.union\'s \'other\' argument must be a Set");
183
182
  }
184
183
 
185
- const out: Set = Set$constructor(_this);
184
+ const out: Set = new Set(_this);
186
185
  for (const x of other) {
187
186
  out.add(x);
188
187
  }
@@ -1,10 +1,8 @@
1
- // todo: support non-bytestring properly
2
- export const String = (value: any): bytestring => {
3
- if (Porffor.rawType(value) == Porffor.TYPES.symbol) return __Symbol_prototype_toString(value);
4
- return __ecma262_ToString(value);
5
- };
1
+ import type {} from './porffor.d.ts';
6
2
 
3
+ // todo: support non-bytestring properly
7
4
  // todo: support constructor/string objects properly
8
- export const String$constructor = (value: any): bytestring => {
5
+ export const String = function (value: any): bytestring {
6
+ if (!new.target && Porffor.rawType(value) == Porffor.TYPES.symbol) return __Symbol_prototype_toString(value);
9
7
  return __ecma262_ToString(value);
10
8
  };
@@ -17,7 +17,8 @@ export const __Porffor_symbol_descStore = (op: boolean, value: any): any => {
17
17
 
18
18
  export const Symbol = (description: any): Symbol => {
19
19
  // 1-based so always truthy as numeric value
20
- return __Porffor_symbol_descStore(true, description) + 1;
20
+ const ptr: Symbol = __Porffor_symbol_descStore(true, description) + 1;
21
+ return ptr;
21
22
  };
22
23
 
23
24
  export const __Symbol_prototype_description$get = (_this: Symbol) => {
@@ -4,11 +4,9 @@ export default async () => {
4
4
  const arrayCode = (await import('node:fs')).readFileSync(globalThis.precompileCompilerPath + '/builtins/array.ts', 'utf8');
5
5
  const typedArrayFuncs = [...arrayCode.matchAll(/\/\/ @porf-typed-array[\s\S]+?^};$/gm)].map(x => x[0]);
6
6
 
7
- const constr = name => out += `export const ${name} = () => {
8
- throw new TypeError("Constructor ${name} requires 'new'");
9
- };
7
+ const constr = name => out += `export const ${name} = function (arg: any): ${name} {
8
+ if (!new.target) throw new TypeError("Constructor ${name} requires 'new'");
10
9
 
11
- export const ${name}$constructor = (arg: any): ${name} => {
12
10
  const out: ${name} = Porffor.allocate();
13
11
  let len: i32 = 0;
14
12
 
@@ -35,6 +33,50 @@ export const __${name}_prototype_byteLength$get = (_this: ${name}) => {
35
33
  return _this.length * ${name}.BYTES_PER_ELEMENT;
36
34
  };
37
35
 
36
+ export const __${name}_prototype_at = (_this: ${name}, index: number) => {
37
+ const len: i32 = _this.length;
38
+ index |= 0;
39
+ if (index < 0) {
40
+ index = len + index;
41
+ if (index < 0) return undefined;
42
+ }
43
+ if (index >= len) return undefined;
44
+
45
+ return _this[index];
46
+ };
47
+
48
+ export const __${name}_prototype_slice = (_this: ${name}, start: number, end: number) => {
49
+ const len: i32 = _this.length;
50
+ if (Porffor.rawType(end) == Porffor.TYPES.undefined) end = len;
51
+
52
+ start |= 0;
53
+ end |= 0;
54
+
55
+ if (start < 0) {
56
+ start = len + start;
57
+ if (start < 0) start = 0;
58
+ }
59
+ if (start > len) start = len;
60
+ if (end < 0) {
61
+ end = len + end;
62
+ if (end < 0) end = 0;
63
+ }
64
+ if (end > len) end = len;
65
+
66
+ let out: ${name} = Porffor.allocate();
67
+
68
+ if (start > end) return out;
69
+
70
+ let i: i32 = start;
71
+ let j: i32 = 0;
72
+ while (i < end) {
73
+ out[j++] = _this[i++];
74
+ }
75
+
76
+ out.length = end - start;
77
+ return out;
78
+ };
79
+
38
80
  ${typedArrayFuncs.reduce((acc, x) => acc + x.replace('// @porf-typed-array\n', '').replaceAll('Array', name).replaceAll('any[]', name) + '\n\n', '')}
39
81
  `;
40
82
 
@@ -1,4 +1,5 @@
1
1
  // general widely used ecma262/spec functions
2
+ import type {} from './porffor.d.ts';
2
3
 
3
4
  // 7.1.5 ToIntegerOrInfinity (argument)
4
5
  // https://tc39.es/ecma262/#sec-tointegerorinfinity
@@ -161,7 +161,6 @@ export const BuiltinVars = function() {
161
161
  [ Opcodes.call, importedFuncs.timeOrigin ]
162
162
  ];
163
163
 
164
-
165
164
  this.__Uint8Array_BYTES_PER_ELEMENT = number(1);
166
165
  this.__Int8Array_BYTES_PER_ELEMENT = number(1);
167
166
  this.__Uint8ClampedArray_BYTES_PER_ELEMENT = number(1);
@@ -205,7 +204,8 @@ export const BuiltinFuncs = function() {
205
204
  ...number(TYPES.number, Valtype.i32),
206
205
  [ Opcodes.local_get, 1 ],
207
206
  ...number(TYPES.number, Valtype.i32),
208
- [ Opcodes.call, builtin('__Math_pow') ]
207
+ [ Opcodes.call, builtin('__Math_pow') ],
208
+ [ Opcodes.drop ],
209
209
  ]
210
210
  };
211
211