porffor 0.16.0-5c5338783 → 0.16.0-61ae4fd8d
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 +5 -17
- package/compiler/2c.js +75 -15
- package/compiler/allocators.js +3 -4
- package/compiler/builtins/array.ts +73 -5
- package/compiler/builtins/date.ts +1 -25
- package/compiler/builtins/number.ts +10 -21
- package/compiler/builtins/porffor.d.ts +7 -0
- package/compiler/builtins/string_f64.ts +10 -0
- package/compiler/builtins/z_ecma262.ts +62 -0
- package/compiler/codegen.js +64 -43
- package/compiler/generated_builtins.js +90 -34
- package/compiler/opt.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -29,7 +29,7 @@ Expect nothing to work! Only very limited JS is currently supported. See files i
|
|
29
29
|
> [!WARNING]
|
30
30
|
> Compiling to native binaries uses [2c](#2c), Porffor's own Wasm -> C compiler, which is experimental.
|
31
31
|
|
32
|
-
**`porf native path/to/script.js out(.exe)`**. You can specify the compiler with `--compiler=clang
|
32
|
+
**`porf native path/to/script.js out(.exe)`**. You can specify the compiler with `--compiler=clang|gcc|zig` (`clang` by default), and which optimization level to use with `--cO=Ofast|O3|O2|O1|O0` (`Ofast` by default). Output binaries are also stripped by default.
|
33
33
|
|
34
34
|
### Compiling to C
|
35
35
|
> [!WARNING]
|
@@ -49,7 +49,7 @@ Expect nothing to work! Only very limited JS is currently supported. See files i
|
|
49
49
|
|
50
50
|
**`porf debug path/to/script.js`**
|
51
51
|
|
52
|
-
###
|
52
|
+
### Debugging the compiled Wasm of a JS file
|
53
53
|
> [!WARNING]
|
54
54
|
> Very experimental WIP feature!
|
55
55
|
|
@@ -63,26 +63,14 @@ Expect nothing to work! Only very limited JS is currently supported. See files i
|
|
63
63
|
- `--valtype=i32|i64|f64` (default: `f64`) to set valtype
|
64
64
|
- `-O0` to disable opt
|
65
65
|
- `-O1` (default) to enable basic opt (simplify insts, treeshake wasm imports)
|
66
|
-
- `-O2` to enable advanced opt (inlining). unstable
|
67
|
-
- `-O3` to enable advanceder opt (precompute const math). unstable
|
68
|
-
- `--no-run` to not run wasm output, just compile
|
69
|
-
- `--opt-log` to log some opts
|
70
|
-
- `--code-log` to log some codegen (you probably want `-funcs`)
|
71
|
-
- `--regex-log` to log some regex
|
72
|
-
- `--funcs` to log funcs
|
73
|
-
- `--ast-log` to log AST
|
74
|
-
- `--opt-funcs` to log funcs after opt
|
75
|
-
- `--sections` to log sections as hex
|
76
|
-
- `--opt-no-inline` to not inline any funcs
|
77
|
-
- `--tail-call` to enable tail calls (experimental + not widely implemented)
|
78
|
-
- `--compile-hints` to enable V8 compilation hints (experimental + doesn't seem to do much?)
|
66
|
+
- `-O2` to enable advanced opt (inlining). unstable!
|
67
|
+
- `-O3` to enable advanceder opt (precompute const math). unstable!
|
79
68
|
|
80
69
|
## Limitations
|
81
70
|
- No full object support yet
|
82
71
|
- Little built-ins/prototype
|
83
72
|
- No async/promise/await
|
84
73
|
- No variables between scopes (except args and globals)
|
85
|
-
- Literal callees only in calls (eg `print()` works, `a = print; a()` does not)
|
86
74
|
- No `eval()` etc (since it is AOT)
|
87
75
|
|
88
76
|
## Sub-engines
|
@@ -112,7 +100,7 @@ These include some early (stage 1/0) and/or dead (last commit years ago) proposa
|
|
112
100
|
|
113
101
|
- Number literals
|
114
102
|
- Declaring functions
|
115
|
-
- Calling functions
|
103
|
+
- Calling functions
|
116
104
|
- `return`
|
117
105
|
- `let`/`const`/`var` basic declarations
|
118
106
|
- Some basic integer operators (`+-/*%`)
|
package/compiler/2c.js
CHANGED
@@ -2,10 +2,11 @@ import { read_ieee754_binary64, read_signedLEB128, read_unsignedLEB128 } from '.
|
|
2
2
|
import { Blocktype, Opcodes, Valtype } from './wasmSpec.js';
|
3
3
|
import { operatorOpcode } from './expression.js';
|
4
4
|
import { log } from './log.js';
|
5
|
+
import Prefs from './prefs.js';
|
5
6
|
|
6
7
|
const CValtype = {
|
7
|
-
i8: '
|
8
|
-
i16: '
|
8
|
+
i8: 'u8',
|
9
|
+
i16: 'u16',
|
9
10
|
i32: 'i32',
|
10
11
|
u32: 'u32',
|
11
12
|
i64: 'i64',
|
@@ -17,8 +18,8 @@ const CValtype = {
|
|
17
18
|
undefined: 'void'
|
18
19
|
};
|
19
20
|
|
20
|
-
const alwaysPreface = `typedef uint8_t
|
21
|
-
typedef uint16_t
|
21
|
+
const alwaysPreface = `typedef uint8_t u8;
|
22
|
+
typedef uint16_t u16;
|
22
23
|
typedef int32_t i32;
|
23
24
|
typedef uint32_t u32;
|
24
25
|
typedef int64_t i64;
|
@@ -33,11 +34,11 @@ struct ReturnValue {
|
|
33
34
|
i32 type;
|
34
35
|
};\n\n`;
|
35
36
|
|
36
|
-
// todo:
|
37
|
+
// todo: review whether 2cMemcpy should be default or not
|
37
38
|
|
38
39
|
// all:
|
39
40
|
// immediates: ['align', 'offset']
|
40
|
-
const CMemFuncs = {
|
41
|
+
const CMemFuncs = Prefs['2cMemcpy'] ? {
|
41
42
|
[Opcodes.i32_store]: {
|
42
43
|
c: `memcpy(_memory + offset + pointer, &value, sizeof(value));`,
|
43
44
|
args: ['pointer', 'value'],
|
@@ -47,13 +48,13 @@ const CMemFuncs = {
|
|
47
48
|
[Opcodes.i32_store16]: {
|
48
49
|
c: `memcpy(_memory + offset + pointer, &value, sizeof(value));`,
|
49
50
|
args: ['pointer', 'value'],
|
50
|
-
argTypes: ['i32', '
|
51
|
+
argTypes: ['i32', 'u16'],
|
51
52
|
returns: false
|
52
53
|
},
|
53
54
|
[Opcodes.i32_store8]: {
|
54
55
|
c: `memcpy(_memory + offset + pointer, &value, sizeof(value));`,
|
55
56
|
args: ['pointer', 'value'],
|
56
|
-
argTypes: ['i32', '
|
57
|
+
argTypes: ['i32', 'u8'],
|
57
58
|
returns: false
|
58
59
|
},
|
59
60
|
|
@@ -66,7 +67,7 @@ return out;`,
|
|
66
67
|
returns: 'i32'
|
67
68
|
},
|
68
69
|
[Opcodes.i32_load16_u]: {
|
69
|
-
c: `
|
70
|
+
c: `u16 out;
|
70
71
|
memcpy(&out, _memory + offset + pointer, sizeof(out));
|
71
72
|
return out;`,
|
72
73
|
args: ['pointer'],
|
@@ -74,7 +75,7 @@ return out;`,
|
|
74
75
|
returns: 'i32'
|
75
76
|
},
|
76
77
|
[Opcodes.i32_load8_u]: {
|
77
|
-
c: `
|
78
|
+
c: `u8 out;
|
78
79
|
memcpy(&out, _memory + offset + pointer, sizeof(out));
|
79
80
|
return out;`,
|
80
81
|
args: ['pointer'],
|
@@ -96,6 +97,57 @@ return out;`,
|
|
96
97
|
argTypes: ['i32'],
|
97
98
|
returns: 'f64'
|
98
99
|
},
|
100
|
+
} : {
|
101
|
+
[Opcodes.i32_store]: {
|
102
|
+
c: `*((i32*)(_memory + offset + pointer)) = value;`,
|
103
|
+
args: ['pointer', 'value'],
|
104
|
+
argTypes: ['i32', 'i32'],
|
105
|
+
returns: false
|
106
|
+
},
|
107
|
+
[Opcodes.i32_store16]: {
|
108
|
+
c: `*((u16*)(_memory + offset + pointer)) = value;`,
|
109
|
+
args: ['pointer', 'value'],
|
110
|
+
argTypes: ['i32', 'u16'],
|
111
|
+
returns: false
|
112
|
+
},
|
113
|
+
[Opcodes.i32_store8]: {
|
114
|
+
c: `*((u8*)(_memory + offset + pointer)) = value;`,
|
115
|
+
args: ['pointer', 'value'],
|
116
|
+
argTypes: ['i32', 'u8'],
|
117
|
+
returns: false
|
118
|
+
},
|
119
|
+
|
120
|
+
[Opcodes.i32_load]: {
|
121
|
+
c: `return *((i32*)(_memory + offset + pointer));`,
|
122
|
+
args: ['pointer'],
|
123
|
+
argTypes: ['i32'],
|
124
|
+
returns: 'i32'
|
125
|
+
},
|
126
|
+
[Opcodes.i32_load16_u]: {
|
127
|
+
c: `return *((u16*)(_memory + offset + pointer));`,
|
128
|
+
args: ['pointer'],
|
129
|
+
argTypes: ['i32'],
|
130
|
+
returns: 'i32'
|
131
|
+
},
|
132
|
+
[Opcodes.i32_load8_u]: {
|
133
|
+
c: `return *((u8*)(_memory + offset + pointer));`,
|
134
|
+
args: ['pointer'],
|
135
|
+
argTypes: ['i32'],
|
136
|
+
returns: 'i32'
|
137
|
+
},
|
138
|
+
|
139
|
+
[Opcodes.f64_store]: {
|
140
|
+
c: `*((f64*)(_memory + offset + pointer)) = value;`,
|
141
|
+
args: ['pointer', 'value'],
|
142
|
+
argTypes: ['i32', 'f64'],
|
143
|
+
returns: false
|
144
|
+
},
|
145
|
+
[Opcodes.f64_load]: {
|
146
|
+
c: `return *((f64*)(_memory + offset + pointer));`,
|
147
|
+
args: ['pointer'],
|
148
|
+
argTypes: ['i32'],
|
149
|
+
returns: 'f64'
|
150
|
+
},
|
99
151
|
};
|
100
152
|
|
101
153
|
const inv = (obj, keyMap = x => x) => Object.keys(obj).reduce((acc, x) => { acc[keyMap(obj[x])] = x; return acc; }, {});
|
@@ -152,11 +204,16 @@ export default ({ funcs, globals, tags, data, exceptions, pages }) => {
|
|
152
204
|
|
153
205
|
if (pages.size > 0) {
|
154
206
|
prepend.set('_memory', `char _memory[${pages.size * pageSize}];\n`);
|
155
|
-
includes.set('string.h', true);
|
207
|
+
if (Prefs['2cMemcpy']) includes.set('string.h', true);
|
156
208
|
}
|
157
209
|
|
158
210
|
if (data.length > 0) {
|
159
|
-
|
211
|
+
if (Prefs['2cMemcpy']) {
|
212
|
+
prependMain.set('_data', data.map(x => `memcpy(_memory + ${x.offset}, (unsigned char[]){${x.bytes.join(',')}}, ${x.bytes.length});`).join('\n '));
|
213
|
+
includes.set('string.h', true);
|
214
|
+
} else {
|
215
|
+
prependMain.set('_data', data.map(x => x.bytes.reduce((acc, y, i) => acc + `_memory[${x.offset + i}]=(u8)${y};`, '')).join('\n '));
|
216
|
+
}
|
160
217
|
}
|
161
218
|
|
162
219
|
if (importFuncs.find(x => x.name === '__Porffor_readArgv')) {
|
@@ -362,7 +419,10 @@ export default ({ funcs, globals, tags, data, exceptions, pages }) => {
|
|
362
419
|
|
363
420
|
case Opcodes.return:
|
364
421
|
// line(`return${returns ? ` ${removeBrackets(vals.pop())}` : ''}`);
|
365
|
-
|
422
|
+
const b = vals.pop();
|
423
|
+
const a = vals.pop();
|
424
|
+
line(`return${returns ? ` (struct ReturnValue){ ${removeBrackets(a)}, ${removeBrackets(b)} }` : ''}`);
|
425
|
+
// line(`return${returns ? ` (struct ReturnValue){ ${removeBrackets(vals.pop())}, ${removeBrackets(vals.pop())} }` : ''}`);
|
366
426
|
break;
|
367
427
|
|
368
428
|
case Opcodes.if: {
|
@@ -474,7 +534,7 @@ _time_out = _time.tv_nsec / 1000000. + _time.tv_sec * 1000.;`);
|
|
474
534
|
out[read++] = ch;
|
475
535
|
}
|
476
536
|
|
477
|
-
|
537
|
+
*((i32*)(_memory + outPtr)) = (i32)read;
|
478
538
|
return read;
|
479
539
|
}`);
|
480
540
|
|
@@ -504,7 +564,7 @@ _time_out = _time.tv_nsec / 1000000. + _time.tv_sec * 1000.;`);
|
|
504
564
|
|
505
565
|
fclose(fp);
|
506
566
|
|
507
|
-
|
567
|
+
*((i32*)(_memory + outPtr)) = (i32)read;
|
508
568
|
return read;
|
509
569
|
}`);
|
510
570
|
const outPtr = vals.pop();
|
package/compiler/allocators.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { Opcodes, PageSize, Valtype } from './wasmSpec.js';
|
2
2
|
import { number } from './embedding.js';
|
3
3
|
import Prefs from './prefs.js';
|
4
4
|
|
@@ -76,13 +76,12 @@ export class ChunkAllocator {
|
|
76
76
|
constructor(chunkSize) {
|
77
77
|
Prefs.rmUnusedTypes = false;
|
78
78
|
|
79
|
-
// todo: what should be the default
|
80
|
-
// 16: 1MiB chunks
|
81
79
|
// 64KiB * chunk size each growth
|
80
|
+
// 16: 1MiB chunks
|
82
81
|
this.chunkSize = chunkSize ?? Prefs.chunkAllocatorSize ?? 16;
|
83
82
|
}
|
84
83
|
|
85
|
-
alloc({ asmFunc, funcIndex
|
84
|
+
alloc({ asmFunc, funcIndex }) {
|
86
85
|
const func = funcIndex['#chunkallocator_alloc'] ?? asmFunc('#chunkallocator_alloc', {
|
87
86
|
wasm: [
|
88
87
|
[ Opcodes.global_get, 0 ],
|
@@ -54,7 +54,7 @@ export const __Array_prototype_indexOf = (_this: any[], searchElement: any, posi
|
|
54
54
|
} else position = 0;
|
55
55
|
|
56
56
|
for (let i: i32 = position; i < len; i++) {
|
57
|
-
if (_this[i]
|
57
|
+
if (_this[i] === searchElement) return i;
|
58
58
|
}
|
59
59
|
|
60
60
|
return -1;
|
@@ -68,7 +68,7 @@ export const __Array_prototype_lastIndexOf = (_this: any[], searchElement: any,
|
|
68
68
|
} else position = 0;
|
69
69
|
|
70
70
|
for (let i: i32 = len - 1; i >= position; i--) {
|
71
|
-
if (_this[i]
|
71
|
+
if (_this[i] === searchElement) return i;
|
72
72
|
}
|
73
73
|
|
74
74
|
return -1;
|
@@ -82,7 +82,7 @@ export const __Array_prototype_includes = (_this: any[], searchElement: any, pos
|
|
82
82
|
} else position = 0;
|
83
83
|
|
84
84
|
for (let i: i32 = position; i < len; i++) {
|
85
|
-
if (_this[i]
|
85
|
+
if (_this[i] === searchElement) return true;
|
86
86
|
}
|
87
87
|
|
88
88
|
return false;
|
@@ -171,9 +171,11 @@ export const __Array_prototype_filter = (_this: any[], callbackFn: any) => {
|
|
171
171
|
};
|
172
172
|
|
173
173
|
export const __Array_prototype_map = (_this: any[], callbackFn: any) => {
|
174
|
-
let i: i32 = 0;
|
175
174
|
const len: i32 = _this.length;
|
176
|
-
const out: any[] =
|
175
|
+
const out: any[] = [];
|
176
|
+
out.length = len;
|
177
|
+
|
178
|
+
let i: i32 = 0;
|
177
179
|
while (i < len) {
|
178
180
|
out[i] = callbackFn(_this[i], i++, _this);
|
179
181
|
}
|
@@ -221,4 +223,70 @@ export const __Array_prototype_every = (_this: any[], callbackFn: any) => {
|
|
221
223
|
}
|
222
224
|
|
223
225
|
return true;
|
226
|
+
};
|
227
|
+
|
228
|
+
export const __Array_prototype_reduce = (_this: any[], callbackFn: any, initialValue: any) => {
|
229
|
+
let acc: any = initialValue ?? _this[0];
|
230
|
+
|
231
|
+
const len: i32 = _this.length;
|
232
|
+
let i: i32 = 0;
|
233
|
+
while (i < len) {
|
234
|
+
acc = callbackFn(acc, _this[i], i++, _this);
|
235
|
+
}
|
236
|
+
|
237
|
+
return acc;
|
238
|
+
};
|
239
|
+
|
240
|
+
export const __Array_prototype_toString = (_this: any[]) => {
|
241
|
+
// todo: this is bytestring only!
|
242
|
+
|
243
|
+
let out: bytestring = '';
|
244
|
+
out.length = 0;
|
245
|
+
|
246
|
+
const len: i32 = _this.length;
|
247
|
+
let i: i32 = 0;
|
248
|
+
while (i < len) {
|
249
|
+
if (i > 0) Porffor.bytestring.appendChar(out, 44);
|
250
|
+
|
251
|
+
const element: any = _this[i++];
|
252
|
+
const type: i32 = Porffor.rawType(element);
|
253
|
+
if (element != 0 || Porffor.fastAnd(
|
254
|
+
type != Porffor.TYPES.undefined, // undefined
|
255
|
+
type != Porffor.TYPES.object // null
|
256
|
+
)) {
|
257
|
+
Porffor.bytestring.appendStr(out, ecma262.ToString(element));
|
258
|
+
}
|
259
|
+
}
|
260
|
+
|
261
|
+
return out;
|
262
|
+
};
|
263
|
+
|
264
|
+
export const __Array_prototype_join = (_this: any[], _separator: any) => {
|
265
|
+
// todo: this is bytestring only!
|
266
|
+
// todo/perf: optimize single char separators
|
267
|
+
// todo/perf: optimize default separator (?)
|
268
|
+
|
269
|
+
let separator: bytestring = ',';
|
270
|
+
if (Porffor.rawType(_separator) != Porffor.TYPES.undefined)
|
271
|
+
separator = ecma262.ToString(_separator);
|
272
|
+
|
273
|
+
let out: bytestring = '';
|
274
|
+
out.length = 0;
|
275
|
+
|
276
|
+
const len: i32 = _this.length;
|
277
|
+
let i: i32 = 0;
|
278
|
+
while (i < len) {
|
279
|
+
if (i > 0) Porffor.bytestring.appendStr(out, separator);
|
280
|
+
|
281
|
+
const element: any = _this[i++];
|
282
|
+
const type: i32 = Porffor.rawType(element);
|
283
|
+
if (element != 0 || Porffor.fastAnd(
|
284
|
+
type != Porffor.TYPES.undefined, // undefined
|
285
|
+
type != Porffor.TYPES.object // null
|
286
|
+
)) {
|
287
|
+
Porffor.bytestring.appendStr(out, ecma262.ToString(element));
|
288
|
+
}
|
289
|
+
}
|
290
|
+
|
291
|
+
return out;
|
224
292
|
};
|
@@ -253,29 +253,6 @@ export const __ecma262_UTC = (t: number): number => {
|
|
253
253
|
return t;
|
254
254
|
};
|
255
255
|
|
256
|
-
|
257
|
-
// todo: move this somewhere generic?
|
258
|
-
// 7.1.5 ToIntegerOrInfinity (argument)
|
259
|
-
// https://tc39.es/ecma262/multipage/abstract-operations.html#sec-tointegerorinfinity
|
260
|
-
export const __ecma262_ToIntegerOrInfinity = (argument: unknown): number => {
|
261
|
-
// 1. Let number be ? ToNumber(argument).
|
262
|
-
let number: number = Number(argument);
|
263
|
-
|
264
|
-
// 2. If number is one of NaN, +0𝔽, or -0𝔽, return 0.
|
265
|
-
if (Number.isNaN(number)) return 0;
|
266
|
-
|
267
|
-
// 3. If number is +∞𝔽, return +∞.
|
268
|
-
// 4. If number is -∞𝔽, return -∞.
|
269
|
-
if (!Number.isFinite(number)) return number;
|
270
|
-
|
271
|
-
// 5. Return truncate(ℝ(number)).
|
272
|
-
number = Math.trunc(number);
|
273
|
-
|
274
|
-
// return 0 for -0
|
275
|
-
if (number == 0) return 0;
|
276
|
-
return number;
|
277
|
-
};
|
278
|
-
|
279
256
|
// 21.4.1.27 MakeTime (hour, min, sec, ms)
|
280
257
|
// https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-maketime
|
281
258
|
export const __ecma262_MakeTime = (hour: number, min: number, sec: number, ms: number): number => {
|
@@ -1891,8 +1868,7 @@ export const __ecma262_ToDateString = (tv: number) => {
|
|
1891
1868
|
|
1892
1869
|
// 1. If tv is NaN, return "Invalid Date".
|
1893
1870
|
if (Number.isNaN(tv)) {
|
1894
|
-
out = 'Invalid Date';
|
1895
|
-
return out;
|
1871
|
+
return out = 'Invalid Date';
|
1896
1872
|
}
|
1897
1873
|
|
1898
1874
|
// 2. Let t be LocalTime(tv).
|
@@ -6,11 +6,9 @@ export const __Number_prototype_toString = (_this: number, radix: number|any) =>
|
|
6
6
|
let outPtr: i32 = Porffor.wasm`local.get ${out}`;
|
7
7
|
|
8
8
|
if (!Number.isFinite(_this)) {
|
9
|
-
if (Number.isNaN(_this)) out = 'NaN';
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
return out;
|
9
|
+
if (Number.isNaN(_this)) return out = 'NaN';
|
10
|
+
if (_this == Infinity) return out = 'Infinity';
|
11
|
+
return out = '-Infinity';
|
14
12
|
}
|
15
13
|
|
16
14
|
if (Porffor.rawType(radix) != Porffor.TYPES.number) {
|
@@ -24,8 +22,7 @@ export const __Number_prototype_toString = (_this: number, radix: number|any) =>
|
|
24
22
|
}
|
25
23
|
|
26
24
|
if (_this == 0) {
|
27
|
-
out = '0';
|
28
|
-
return out;
|
25
|
+
return out = '0';
|
29
26
|
}
|
30
27
|
|
31
28
|
// if negative value
|
@@ -99,7 +96,6 @@ export const __Number_prototype_toString = (_this: number, radix: number|any) =>
|
|
99
96
|
}
|
100
97
|
|
101
98
|
out.length = outPtr - Porffor.wasm`local.get ${out}`;
|
102
|
-
|
103
99
|
return out;
|
104
100
|
}
|
105
101
|
|
@@ -235,7 +231,6 @@ export const __Number_prototype_toString = (_this: number, radix: number|any) =>
|
|
235
231
|
}
|
236
232
|
|
237
233
|
out.length = outPtr - Porffor.wasm`local.get ${out}`;
|
238
|
-
|
239
234
|
return out;
|
240
235
|
};
|
241
236
|
|
@@ -244,11 +239,9 @@ export const __Number_prototype_toFixed = (_this: number, fractionDigits: number
|
|
244
239
|
let outPtr: i32 = Porffor.wasm`local.get ${out}`;
|
245
240
|
|
246
241
|
if (!Number.isFinite(_this)) {
|
247
|
-
if (Number.isNaN(_this)) out = 'NaN';
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
return out;
|
242
|
+
if (Number.isNaN(_this)) return out = 'NaN';
|
243
|
+
if (_this == Infinity) return out = 'Infinity';
|
244
|
+
return out = '-Infinity';
|
252
245
|
}
|
253
246
|
|
254
247
|
fractionDigits |= 0;
|
@@ -324,7 +317,6 @@ export const __Number_prototype_toFixed = (_this: number, fractionDigits: number
|
|
324
317
|
}
|
325
318
|
|
326
319
|
out.length = outPtr - Porffor.wasm`local.get ${out}`;
|
327
|
-
|
328
320
|
return out;
|
329
321
|
};
|
330
322
|
|
@@ -334,11 +326,9 @@ export const __Number_prototype_toExponential = (_this: number, fractionDigits:
|
|
334
326
|
let outPtr: i32 = Porffor.wasm`local.get ${out}`;
|
335
327
|
|
336
328
|
if (!Number.isFinite(_this)) {
|
337
|
-
if (Number.isNaN(_this)) out = 'NaN';
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
return out;
|
329
|
+
if (Number.isNaN(_this)) return out = 'NaN';
|
330
|
+
if (_this == Infinity) return out = 'Infinity';
|
331
|
+
return out = '-Infinity';
|
342
332
|
}
|
343
333
|
|
344
334
|
if (Porffor.rawType(fractionDigits) != Porffor.TYPES.number) {
|
@@ -519,7 +509,6 @@ export const __Number_prototype_toExponential = (_this: number, fractionDigits:
|
|
519
509
|
}
|
520
510
|
|
521
511
|
out.length = outPtr - Porffor.wasm`local.get ${out}`;
|
522
|
-
|
523
512
|
return out;
|
524
513
|
};
|
525
514
|
|
@@ -28,6 +28,13 @@ type PorfforGlobal = {
|
|
28
28
|
write(_this: any, index: number, value: any): boolean;
|
29
29
|
}
|
30
30
|
|
31
|
+
bytestring: {
|
32
|
+
// defined in date.ts
|
33
|
+
appendStr(str: bytestring, appendage: bytestring): i32;
|
34
|
+
appendChar(str: bytestring, char: i32): i32;
|
35
|
+
appendPadNum(str: bytestring, num: number, len: number): i32;
|
36
|
+
}
|
37
|
+
|
31
38
|
print(x: any): i32;
|
32
39
|
|
33
40
|
randomByte(): i32;
|
@@ -0,0 +1,10 @@
|
|
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
|
+
};
|
6
|
+
|
7
|
+
// todo: support constructor/string objects properly
|
8
|
+
export const String$constructor = (value: any): bytestring => {
|
9
|
+
return __ecma262_ToString(value);
|
10
|
+
};
|
@@ -0,0 +1,62 @@
|
|
1
|
+
// general widely used ecma262/spec functions
|
2
|
+
|
3
|
+
// 7.1.5 ToIntegerOrInfinity (argument)
|
4
|
+
// https://tc39.es/ecma262/#sec-tointegerorinfinity
|
5
|
+
export const __ecma262_ToIntegerOrInfinity = (argument: unknown): number => {
|
6
|
+
// 1. Let number be ? ToNumber(argument).
|
7
|
+
let number: number = Number(argument);
|
8
|
+
|
9
|
+
// 2. If number is one of NaN, +0𝔽, or -0𝔽, return 0.
|
10
|
+
if (Number.isNaN(number)) return 0;
|
11
|
+
|
12
|
+
// 3. If number is +∞𝔽, return +∞.
|
13
|
+
// 4. If number is -∞𝔽, return -∞.
|
14
|
+
if (!Number.isFinite(number)) return number;
|
15
|
+
|
16
|
+
// 5. Return truncate(ℝ(number)).
|
17
|
+
number = Math.trunc(number);
|
18
|
+
|
19
|
+
// return 0 for -0
|
20
|
+
if (number == 0) return 0;
|
21
|
+
return number;
|
22
|
+
};
|
23
|
+
|
24
|
+
// todo: support non-bytestring properly
|
25
|
+
// 7.1.17 ToString (argument)
|
26
|
+
// https://tc39.es/ecma262/#sec-tostring
|
27
|
+
export const __ecma262_ToString = (argument: unknown): bytestring => {
|
28
|
+
let out: bytestring = '';
|
29
|
+
const type: i32 = Porffor.rawType(argument);
|
30
|
+
|
31
|
+
// 1. If argument is a String, return argument.
|
32
|
+
if (Porffor.fastOr(
|
33
|
+
type == Porffor.TYPES.string,
|
34
|
+
type == Porffor.TYPES.bytestring)) return argument;
|
35
|
+
|
36
|
+
// 2. If argument is a Symbol, throw a TypeError exception.
|
37
|
+
if (type == Porffor.TYPES.symbol) throw new TypeError('Cannot convert a Symbol value to a string');
|
38
|
+
|
39
|
+
// 3. If argument is undefined, return "undefined".
|
40
|
+
if (type == Porffor.TYPES.undefined) return out = 'undefined';
|
41
|
+
|
42
|
+
// 4. If argument is null, return "null".
|
43
|
+
if (Porffor.fastAnd(
|
44
|
+
type == Porffor.TYPES.object,
|
45
|
+
argument == 0)) return out = 'null';
|
46
|
+
|
47
|
+
if (type == Porffor.TYPES.boolean) {
|
48
|
+
// 5. If argument is true, return "true".
|
49
|
+
if (argument == true) return out = 'true';
|
50
|
+
|
51
|
+
// 6. If argument is false, return "false".
|
52
|
+
return out = 'false';
|
53
|
+
}
|
54
|
+
|
55
|
+
// 7. If argument is a Number, return Number::toString(argument, 10).
|
56
|
+
// 8. If argument is a BigInt, return BigInt::toString(argument, 10).
|
57
|
+
// 9. Assert: argument is an Object.
|
58
|
+
// 10. Let primValue be ? ToPrimitive(argument, string).
|
59
|
+
// 11. Assert: primValue is not an Object.
|
60
|
+
// 12. Return ? ToString(primValue).
|
61
|
+
return argument.toString();
|
62
|
+
};
|
package/compiler/codegen.js
CHANGED
@@ -428,7 +428,7 @@ const concatStrings = (scope, left, right, global, name, assign = false, bytestr
|
|
428
428
|
// alloc/assign array
|
429
429
|
const [ out, pointer ] = makeArray(scope, {
|
430
430
|
rawElements: new Array(0)
|
431
|
-
}, global, name, true, 'i16', true);
|
431
|
+
}, assign ? false : global, assign ? undefined : name, true, 'i16', true);
|
432
432
|
|
433
433
|
return [
|
434
434
|
// setup left
|
@@ -958,12 +958,9 @@ const performOp = (scope, op, left, right, leftType, rightType, _global = false,
|
|
958
958
|
[ Opcodes.end ],
|
959
959
|
]));
|
960
960
|
|
961
|
-
//
|
962
|
-
|
963
|
-
|
964
|
-
// endOut.push(stringOnly([ Opcodes.end ]));
|
965
|
-
endOut.unshift(stringOnly([ Opcodes.end ]));
|
966
|
-
// }
|
961
|
+
// add a surrounding block
|
962
|
+
startOut.push(stringOnly([ Opcodes.block, Valtype.i32 ]));
|
963
|
+
endOut.unshift(stringOnly([ Opcodes.end ]));
|
967
964
|
}
|
968
965
|
|
969
966
|
return finalize([
|
@@ -1266,7 +1263,15 @@ const getNodeType = (scope, node) => {
|
|
1266
1263
|
}
|
1267
1264
|
|
1268
1265
|
if (node.type === 'AssignmentExpression') {
|
1269
|
-
|
1266
|
+
const op = node.operator.slice(0, -1) || '=';
|
1267
|
+
if (op === '=') return getNodeType(scope, node.right);
|
1268
|
+
|
1269
|
+
return getNodeType(scope, {
|
1270
|
+
type: ['||', '&&', '??'].includes(op) ? 'LogicalExpression' : 'BinaryExpression',
|
1271
|
+
left: node.left,
|
1272
|
+
right: node.right,
|
1273
|
+
operator: op
|
1274
|
+
});
|
1270
1275
|
}
|
1271
1276
|
|
1272
1277
|
if (node.type === 'ArrayExpression') {
|
@@ -1285,23 +1290,6 @@ const getNodeType = (scope, node) => {
|
|
1285
1290
|
if (knownLeft === TYPES.bytestring || knownRight === TYPES.bytestring) return TYPES.bytestring;
|
1286
1291
|
|
1287
1292
|
return TYPES.number;
|
1288
|
-
|
1289
|
-
// todo: string concat types
|
1290
|
-
// if (node.operator !== '+') return TYPES.number;
|
1291
|
-
// else return [
|
1292
|
-
// // if left is string
|
1293
|
-
// ...getNodeType(scope, node.left),
|
1294
|
-
// ...number(TYPES.string, Valtype.i32),
|
1295
|
-
// [ Opcodes.i32_eq ],
|
1296
|
-
|
1297
|
-
// // if right is string
|
1298
|
-
// ...getNodeType(scope, node.right),
|
1299
|
-
// ...number(TYPES.string, Valtype.i32),
|
1300
|
-
// [ Opcodes.i32_eq ],
|
1301
|
-
|
1302
|
-
// // if either are true
|
1303
|
-
// [ Opcodes.i32_or ],
|
1304
|
-
// ];
|
1305
1293
|
}
|
1306
1294
|
|
1307
1295
|
if (node.type === 'UnaryExpression') {
|
@@ -1321,7 +1309,6 @@ const getNodeType = (scope, node) => {
|
|
1321
1309
|
if (Prefs.fastLength) return TYPES.number;
|
1322
1310
|
}
|
1323
1311
|
|
1324
|
-
|
1325
1312
|
const objectKnownType = knownType(scope, getNodeType(scope, node.object));
|
1326
1313
|
if (objectKnownType != null) {
|
1327
1314
|
if (name === 'length') {
|
@@ -1332,7 +1319,6 @@ const getNodeType = (scope, node) => {
|
|
1332
1319
|
if (node.computed) {
|
1333
1320
|
if (objectKnownType === TYPES.string) return TYPES.string;
|
1334
1321
|
if (objectKnownType === TYPES.bytestring) return TYPES.bytestring;
|
1335
|
-
if (objectKnownType === TYPES.array) return TYPES.number;
|
1336
1322
|
}
|
1337
1323
|
}
|
1338
1324
|
|
@@ -1946,13 +1932,18 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
|
|
1946
1932
|
continue;
|
1947
1933
|
}
|
1948
1934
|
|
1949
|
-
if (valtypeBinary !== Valtype.i32 &&
|
1950
|
-
(
|
1951
|
-
|
1952
|
-
)) {
|
1935
|
+
if (valtypeBinary !== Valtype.i32 &&
|
1936
|
+
(func && func.params[i * (typedParams ? 2 : 1)] === Valtype.i32)
|
1937
|
+
) {
|
1953
1938
|
out.push(Opcodes.i32_to);
|
1954
1939
|
}
|
1955
1940
|
|
1941
|
+
if (valtypeBinary === Valtype.i32 &&
|
1942
|
+
(func && func.params[i * (typedParams ? 2 : 1)] === Valtype.f64)
|
1943
|
+
) {
|
1944
|
+
out.push([ Opcodes.f64_convert_i32_s ]);
|
1945
|
+
}
|
1946
|
+
|
1956
1947
|
if (typedParams) out = out.concat(getNodeType(scope, arg));
|
1957
1948
|
}
|
1958
1949
|
|
@@ -1974,6 +1965,10 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
|
|
1974
1965
|
out.push(Opcodes.i32_from);
|
1975
1966
|
}
|
1976
1967
|
|
1968
|
+
if (builtinFuncs[name] && builtinFuncs[name].returns?.[0] === Valtype.f64 && valtypeBinary === Valtype.i32) {
|
1969
|
+
out.push(Opcodes.i32_trunc_sat_f64_s);
|
1970
|
+
}
|
1971
|
+
|
1977
1972
|
return out;
|
1978
1973
|
};
|
1979
1974
|
|
@@ -1997,9 +1992,9 @@ const generateNew = (scope, decl, _global, _name) => {
|
|
1997
1992
|
if (
|
1998
1993
|
(builtinFuncs[name] && !builtinFuncs[name].constr) ||
|
1999
1994
|
(internalConstrs[name] && builtinFuncs[name].notConstr)
|
2000
|
-
) return internalThrow(scope, 'TypeError', `${name} is not a constructor
|
1995
|
+
) return internalThrow(scope, 'TypeError', `${name} is not a constructor`, true);
|
2001
1996
|
|
2002
|
-
if (!builtinFuncs[name]) return todo(scope, `new statement is not supported yet
|
1997
|
+
if (!builtinFuncs[name]) return todo(scope, `new statement is not supported yet`, true); // return todo(scope, `new statement is not supported yet (new ${unhackName(name)})`);
|
2003
1998
|
|
2004
1999
|
return generateCall(scope, decl, _global, _name);
|
2005
2000
|
};
|
@@ -2447,9 +2442,7 @@ const generateAssign = (scope, decl, _global, _name, valueUnused = false) => {
|
|
2447
2442
|
[ isGlobal ? Opcodes.global_set : Opcodes.local_set, local.idx ],
|
2448
2443
|
[ isGlobal ? Opcodes.global_get : Opcodes.local_get, local.idx ],
|
2449
2444
|
|
2450
|
-
|
2451
|
-
|
2452
|
-
...setType(scope, name, TYPES.number)
|
2445
|
+
...setType(scope, name, getNodeType(scope, decl))
|
2453
2446
|
];
|
2454
2447
|
};
|
2455
2448
|
|
@@ -3528,7 +3521,7 @@ const generateMember = (scope, decl, _global, _name) => {
|
|
3528
3521
|
// // todo: we should only do this for strings but we don't know at compile-time :(
|
3529
3522
|
// hack: this is naughty and will break things!
|
3530
3523
|
let newOut = number(0, Valtype.i32), newPointer = number(0, Valtype.i32);
|
3531
|
-
if (pages.hasAnyString) {
|
3524
|
+
if (pages.hasAnyString && knownType(scope, getNodeType(scope, decl.object)) !== TYPES.array) {
|
3532
3525
|
// todo: we use i16 even for bytestrings which should not make a bad thing happen, just be confusing for debugging?
|
3533
3526
|
0, [ newOut, newPointer ] = makeArray(scope, {
|
3534
3527
|
rawElements: new Array(0)
|
@@ -3672,6 +3665,9 @@ const generateFunc = (scope, decl) => {
|
|
3672
3665
|
index: currentFuncIndex++
|
3673
3666
|
};
|
3674
3667
|
|
3668
|
+
funcIndex[name] = func.index;
|
3669
|
+
funcs.push(func);
|
3670
|
+
|
3675
3671
|
if (typedInput && decl.returnType) {
|
3676
3672
|
const { type } = extractTypeAnnotation(decl.returnType);
|
3677
3673
|
// if (type != null && !Prefs.indirectCalls) {
|
@@ -3681,12 +3677,26 @@ const generateFunc = (scope, decl) => {
|
|
3681
3677
|
}
|
3682
3678
|
}
|
3683
3679
|
|
3680
|
+
const defaultValues = {};
|
3684
3681
|
for (let i = 0; i < params.length; i++) {
|
3685
|
-
|
3682
|
+
let name;
|
3683
|
+
const x = params[i];
|
3684
|
+
switch (x.type) {
|
3685
|
+
case 'Identifier': {
|
3686
|
+
name = x.name;
|
3687
|
+
break;
|
3688
|
+
}
|
3689
|
+
|
3690
|
+
case 'AssignmentPattern': {
|
3691
|
+
name = x.left.name;
|
3692
|
+
defaultValues[name] = x.right;
|
3693
|
+
break;
|
3694
|
+
}
|
3695
|
+
}
|
3696
|
+
|
3686
3697
|
// if (name == null) return todo('non-identifier args are not supported');
|
3687
3698
|
|
3688
3699
|
allocVar(func, name, false);
|
3689
|
-
|
3690
3700
|
if (typedInput && params[i].typeAnnotation) {
|
3691
3701
|
addVarMetadata(func, name, false, extractTypeAnnotation(params[i]));
|
3692
3702
|
}
|
@@ -3703,11 +3713,22 @@ const generateFunc = (scope, decl) => {
|
|
3703
3713
|
};
|
3704
3714
|
}
|
3705
3715
|
|
3706
|
-
|
3707
|
-
|
3716
|
+
const prelude = [];
|
3717
|
+
for (const x in defaultValues) {
|
3718
|
+
prelude.push(
|
3719
|
+
...getType(func, x),
|
3720
|
+
...number(TYPES.undefined, Valtype.i32),
|
3721
|
+
[ Opcodes.i32_eq ],
|
3722
|
+
[ Opcodes.if, Blocktype.void ],
|
3723
|
+
...generate(func, defaultValues[x], false, x),
|
3724
|
+
[ Opcodes.local_set, func.locals[x].idx ],
|
3708
3725
|
|
3709
|
-
|
3710
|
-
|
3726
|
+
...setType(func, x, getNodeType(scope, defaultValues[x])),
|
3727
|
+
[ Opcodes.end ]
|
3728
|
+
);
|
3729
|
+
}
|
3730
|
+
|
3731
|
+
const wasm = func.wasm = prelude.concat(generate(func, body));
|
3711
3732
|
|
3712
3733
|
if (name === 'main') func.gotLastType = true;
|
3713
3734
|
|
@@ -237,31 +237,31 @@ export const BuiltinFuncs = function() {
|
|
237
237
|
localNames: ["_this","_this#type","start","start#type","end","end#type","len","out","#makearray_pointer_tmp","outPtr","thisPtr","thisPtrEnd","__length_setter_tmp"],
|
238
238
|
};
|
239
239
|
this.__Array_prototype_indexOf = {
|
240
|
-
wasm: (scope, {builtin,}) => [[32,0],[252,3],[40,1,0],[184],[33,6],[32,4],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,4],[32,6],[100],[4,64],[32,6],[33,4],[5],[32,4],[68,0,0,0,0,0,0,0,0],[16, builtin('f64_|')],[33,4],[11],[5],[68,0,0,0,0,0,0,0,0],[33,4],[11],[32,4],[33,7],[3,64],[32,7],[32,6],[99],[4,64],[32,7],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,8],[43,0,4],[32,8],[45,0,12],[
|
240
|
+
wasm: (scope, {builtin,}) => [[32,0],[252,3],[40,1,0],[184],[33,6],[32,4],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,4],[32,6],[100],[4,64],[32,6],[33,4],[5],[32,4],[68,0,0,0,0,0,0,0,0],[16, builtin('f64_|')],[33,4],[11],[5],[68,0,0,0,0,0,0,0,0],[33,4],[11],[32,4],[33,7],[3,64],[32,7],[32,6],[99],[4,64],[2,64],[2,127,"string_only"],[32,7],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,8],[43,0,4],[32,8],[45,0,12],[33,9],[34,10,"string_only"],[32,2],[34,11,"string_only"],[32,9,"string_only|start"],[65,2],[70],[32,3],[65,2],[70],[113],[4,64],[32,10],[252,3],[34,12],[32,11],[252,3],[34,14],[71],[4,127],[32,12],[40,0,0],[34,13],[32,14],[40,0,0],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,15],[32,13],[65,2],[108],[33,16],[3,64],[32,15],[32,12],[106],[47,0,4],[32,15],[32,14],[106],[47,0,4],[71],[4,64],[65,0],[12,2],[11],[32,15],[65,2],[106],[34,15],[32,16],[72],[13,0],[11],[65,1],[5],[65,1],[11],[12,1],[11],[32,9],[65,18],[70],[32,3],[65,18],[70],[113],[4,64],[32,10],[252,3],[34,12],[32,11],[252,3],[34,14],[71],[4,127],[32,12],[40,0,0],[34,13],[32,14],[40,0,0],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,15],[32,13],[33,16],[3,64],[32,15],[32,12],[106],[45,0,4],[32,15],[32,14],[106],[45,0,4],[71],[4,64],[65,0],[12,2],[11],[32,15],[65,1],[106],[34,15],[32,16],[72],[13,0],[11],[65,1],[5],[65,1],[11],[12,1],[11,"string_only|end"],[97],[11,"string_only"],[32,9],[32,3],[70],[113],[4,64],[32,7],[65,0],[15],[11],[11],[32,7],[68,0,0,0,0,0,0,240,63],[160],[33,7],[12,1],[11],[11],[68,0,0,0,0,0,0,240,191],[65,0],[15]],
|
241
241
|
params: [124,127,124,127,124,127],
|
242
242
|
typedParams: true,
|
243
243
|
returns: [124,127],
|
244
244
|
typedReturns: true,
|
245
|
-
locals: [124,124,127,127],
|
246
|
-
localNames: ["_this","_this#type","searchElement","searchElement#type","position","position#type","len","i","#loadArray_offset","#last_type"],
|
245
|
+
locals: [124,124,127,127,124,124,127,127,127,127,127],
|
246
|
+
localNames: ["_this","_this#type","searchElement","searchElement#type","position","position#type","len","i","#loadArray_offset","#last_type","__tmpop_left","__tmpop_right","compare_left_pointer","compare_left_length","compare_right_pointer","compare_index","compare_index_end"],
|
247
247
|
};
|
248
248
|
this.__Array_prototype_lastIndexOf = {
|
249
|
-
wasm: (scope, {builtin,}) => [[32,0],[252,3],[40,1,0],[184],[33,6],[32,4],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,4],[32,6],[100],[4,64],[32,6],[33,4],[5],[32,4],[68,0,0,0,0,0,0,0,0],[16, builtin('f64_|')],[33,4],[11],[5],[68,0,0,0,0,0,0,0,0],[33,4],[11],[32,6],[68,0,0,0,0,0,0,240,63],[161],[33,7],[3,64],[32,7],[32,4],[102],[4,64],[32,7],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,8],[43,0,4],[32,8],[45,0,12],[
|
249
|
+
wasm: (scope, {builtin,}) => [[32,0],[252,3],[40,1,0],[184],[33,6],[32,4],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,4],[32,6],[100],[4,64],[32,6],[33,4],[5],[32,4],[68,0,0,0,0,0,0,0,0],[16, builtin('f64_|')],[33,4],[11],[5],[68,0,0,0,0,0,0,0,0],[33,4],[11],[32,6],[68,0,0,0,0,0,0,240,63],[161],[33,7],[3,64],[32,7],[32,4],[102],[4,64],[2,64],[2,127,"string_only"],[32,7],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,8],[43,0,4],[32,8],[45,0,12],[33,9],[34,10,"string_only"],[32,2],[34,11,"string_only"],[32,9,"string_only|start"],[65,2],[70],[32,3],[65,2],[70],[113],[4,64],[32,10],[252,3],[34,12],[32,11],[252,3],[34,14],[71],[4,127],[32,12],[40,0,0],[34,13],[32,14],[40,0,0],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,15],[32,13],[65,2],[108],[33,16],[3,64],[32,15],[32,12],[106],[47,0,4],[32,15],[32,14],[106],[47,0,4],[71],[4,64],[65,0],[12,2],[11],[32,15],[65,2],[106],[34,15],[32,16],[72],[13,0],[11],[65,1],[5],[65,1],[11],[12,1],[11],[32,9],[65,18],[70],[32,3],[65,18],[70],[113],[4,64],[32,10],[252,3],[34,12],[32,11],[252,3],[34,14],[71],[4,127],[32,12],[40,0,0],[34,13],[32,14],[40,0,0],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,15],[32,13],[33,16],[3,64],[32,15],[32,12],[106],[45,0,4],[32,15],[32,14],[106],[45,0,4],[71],[4,64],[65,0],[12,2],[11],[32,15],[65,1],[106],[34,15],[32,16],[72],[13,0],[11],[65,1],[5],[65,1],[11],[12,1],[11,"string_only|end"],[97],[11,"string_only"],[32,9],[32,3],[70],[113],[4,64],[32,7],[65,0],[15],[11],[11],[32,7],[68,0,0,0,0,0,0,240,63],[161],[33,7],[12,1],[11],[11],[68,0,0,0,0,0,0,240,191],[65,0],[15]],
|
250
250
|
params: [124,127,124,127,124,127],
|
251
251
|
typedParams: true,
|
252
252
|
returns: [124,127],
|
253
253
|
typedReturns: true,
|
254
|
-
locals: [124,124,127,127],
|
255
|
-
localNames: ["_this","_this#type","searchElement","searchElement#type","position","position#type","len","i","#loadArray_offset","#last_type"],
|
254
|
+
locals: [124,124,127,127,124,124,127,127,127,127,127],
|
255
|
+
localNames: ["_this","_this#type","searchElement","searchElement#type","position","position#type","len","i","#loadArray_offset","#last_type","__tmpop_left","__tmpop_right","compare_left_pointer","compare_left_length","compare_right_pointer","compare_index","compare_index_end"],
|
256
256
|
};
|
257
257
|
this.__Array_prototype_includes = {
|
258
|
-
wasm: (scope, {builtin,}) => [[32,0],[252,3],[40,1,0],[184],[33,6],[32,4],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,4],[32,6],[100],[4,64],[32,6],[33,4],[5],[32,4],[68,0,0,0,0,0,0,0,0],[16, builtin('f64_|')],[33,4],[11],[5],[68,0,0,0,0,0,0,0,0],[33,4],[11],[32,4],[33,7],[3,64],[32,7],[32,6],[99],[4,64],[32,7],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,8],[43,0,4],[32,8],[45,0,12],[
|
258
|
+
wasm: (scope, {builtin,}) => [[32,0],[252,3],[40,1,0],[184],[33,6],[32,4],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,4],[32,6],[100],[4,64],[32,6],[33,4],[5],[32,4],[68,0,0,0,0,0,0,0,0],[16, builtin('f64_|')],[33,4],[11],[5],[68,0,0,0,0,0,0,0,0],[33,4],[11],[32,4],[33,7],[3,64],[32,7],[32,6],[99],[4,64],[2,64],[2,127,"string_only"],[32,7],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,8],[43,0,4],[32,8],[45,0,12],[33,9],[34,10,"string_only"],[32,2],[34,11,"string_only"],[32,9,"string_only|start"],[65,2],[70],[32,3],[65,2],[70],[113],[4,64],[32,10],[252,3],[34,12],[32,11],[252,3],[34,14],[71],[4,127],[32,12],[40,0,0],[34,13],[32,14],[40,0,0],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,15],[32,13],[65,2],[108],[33,16],[3,64],[32,15],[32,12],[106],[47,0,4],[32,15],[32,14],[106],[47,0,4],[71],[4,64],[65,0],[12,2],[11],[32,15],[65,2],[106],[34,15],[32,16],[72],[13,0],[11],[65,1],[5],[65,1],[11],[12,1],[11],[32,9],[65,18],[70],[32,3],[65,18],[70],[113],[4,64],[32,10],[252,3],[34,12],[32,11],[252,3],[34,14],[71],[4,127],[32,12],[40,0,0],[34,13],[32,14],[40,0,0],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,15],[32,13],[33,16],[3,64],[32,15],[32,12],[106],[45,0,4],[32,15],[32,14],[106],[45,0,4],[71],[4,64],[65,0],[12,2],[11],[32,15],[65,1],[106],[34,15],[32,16],[72],[13,0],[11],[65,1],[5],[65,1],[11],[12,1],[11,"string_only|end"],[97],[11,"string_only"],[32,9],[32,3],[70],[113],[4,64],[68,0,0,0,0,0,0,240,63],[65,1],[15],[11],[11],[32,7],[68,0,0,0,0,0,0,240,63],[160],[33,7],[12,1],[11],[11],[68,0,0,0,0,0,0,0,0],[65,1],[15]],
|
259
259
|
params: [124,127,124,127,124,127],
|
260
260
|
typedParams: true,
|
261
261
|
returns: [124,127],
|
262
262
|
typedReturns: true,
|
263
|
-
locals: [124,124,127,127],
|
264
|
-
localNames: ["_this","_this#type","searchElement","searchElement#type","position","position#type","len","i","#loadArray_offset","#last_type"],
|
263
|
+
locals: [124,124,127,127,124,124,127,127,127,127,127],
|
264
|
+
localNames: ["_this","_this#type","searchElement","searchElement#type","position","position#type","len","i","#loadArray_offset","#last_type","__tmpop_left","__tmpop_right","compare_left_pointer","compare_left_length","compare_right_pointer","compare_index","compare_index_end"],
|
265
265
|
};
|
266
266
|
this.__Array_prototype_with = {
|
267
267
|
wasm: (scope, {allocPage,builtin,internalThrow,}) => [[32,0],[252,3],[40,1,0],[184],[33,6],[32,2],[68,0,0,0,0,0,0,0,0],[99],[4,64],[32,6],[32,2],[160],[34,2],[68,0,0,0,0,0,0,0,0],[99],[4,64],...internalThrow(scope, 'RangeError', `Invalid index`),[11],[11],[32,2],[32,6],[100],[4,64],...internalThrow(scope, 'RangeError', `Invalid index`),[11],...number(allocPage(scope, 'array: __Array_prototype_with/out', 'f64') * pageSize, 124),[34,7],[252,3],[34,8],[65,0],[54,1,0],[32,0],[32,7],[16, builtin('__Porffor_clone')],[32,7],[252,3],[32,2],[252,3],[65,9],[108],[106],[32,4],[34,9],[57,0,4],[32,7],[65,16],[15]],
|
@@ -273,7 +273,7 @@ export const BuiltinFuncs = function() {
|
|
273
273
|
localNames: ["_this","_this#type","index","index#type","value","value#type","len","out","#makearray_pointer_tmp","__member_setter_val_tmp"],
|
274
274
|
};
|
275
275
|
this.__Array_prototype_reverse = {
|
276
|
-
wasm: (scope, {}) => [[32,0],[252,3],[40,1,0],[184],[33,2],[68,0,0,0,0,0,0,0,0],[33,3],[32,2],[68,0,0,0,0,0,0,240,63],[161],[33,4],[3,64],[32,3],[32,4],[99],[4,64],[32,3],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,6],[43,0,4],[32,6],[45,0,12],[
|
276
|
+
wasm: (scope, {}) => [[32,0],[252,3],[40,1,0],[184],[33,2],[68,0,0,0,0,0,0,0,0],[33,3],[32,2],[68,0,0,0,0,0,0,240,63],[161],[33,4],[3,64],[32,3],[32,4],[99],[4,64],[32,3],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,6],[43,0,4],[32,6],[45,0,12],[33,7],[33,5],[32,0],[252,3],[32,3],[32,3],[68,0,0,0,0,0,0,240,63],[160],[33,3],[252,3],[65,9],[108],[106],[32,4],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,6],[43,0,4],[32,6],[45,0,12],[33,7],[34,8],[57,0,4],[32,0],[252,3],[32,4],[32,4],[68,0,0,0,0,0,0,240,63],[161],[33,4],[252,3],[65,9],[108],[106],[32,5],[34,8],[57,0,4],[12,1],[11],[11],[32,0],[65,16],[15]],
|
277
277
|
params: [124,127],
|
278
278
|
typedParams: true,
|
279
279
|
returns: [124,127],
|
@@ -300,7 +300,7 @@ export const BuiltinFuncs = function() {
|
|
300
300
|
localNames: ["_this","_this#type"],
|
301
301
|
};
|
302
302
|
this.__Array_prototype_forEach = {
|
303
|
-
wasm: (scope, {internalThrow,}) => [[32,0],[252,3],[40,1,0],[184],[33,4],[68,0,0,0,0,0,0,0,0],[33,5],[3,64],[32,5],[32,4],[99],[4,64],[32,3],[33,15],[2,124],[32,15],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,5],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,6],[43,0,4],[32,6],[45,0,12],[
|
303
|
+
wasm: (scope, {internalThrow,}) => [[32,0],[252,3],[40,1,0],[184],[33,4],[68,0,0,0,0,0,0,0,0],[33,5],[3,64],[32,5],[32,4],[99],[4,64],[32,3],[33,15],[2,124],[32,15],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,5],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,6],[43,0,4],[32,6],[45,0,12],[34,7],[33,8],[33,9],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[32,7],[33,10],[33,11],[32,0],[65,16],[33,12],[33,13],[32,2],[252,3],[33,14],[2,124],[2,64],[2,64],[2,64],[2,64],[32,14],[65,2],[108],[47,0,128,128,12,"read_argc"],[14,4,0,1,2,3,0],[11],[32,14],[17,0,0],[33,7],[12,3],[11],[32,9],[32,8],[32,14],[17,1,0],[33,7],[12,2],[11],[32,9],[32,8],[32,11],[32,10],[32,14],[17,2,0],[33,7],[12,1],[11],[32,9],[32,8],[32,11],[32,10],[32,13],[32,12],[32,14],[17,3,0],[33,7],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `callbackFn is not a function`),[68,0,0,0,0,0,0,0,0],[11,"TYPESWITCH_end"],[26],[12,1],[11],[11],[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
304
304
|
params: [124,127,124,127],
|
305
305
|
typedParams: true,
|
306
306
|
returns: [124,127],
|
@@ -310,7 +310,7 @@ export const BuiltinFuncs = function() {
|
|
310
310
|
table: true
|
311
311
|
};
|
312
312
|
this.__Array_prototype_filter = {
|
313
|
-
wasm: (scope, {allocPage,internalThrow,}) => [...number(allocPage(scope, 'array: __Array_prototype_filter/out', 'f64') * pageSize, 124),[34,4],[252,3],[34,5],[65,0],[54,1,0],[32,0],[252,3],[40,1,0],[184],[33,6],[68,0,0,0,0,0,0,0,0],[33,7],[3,64],[32,7],[32,6],[99],[4,64],[32,7],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,10],[43,0,4],[32,10],[45,0,12],[33,11],[33,8],[
|
313
|
+
wasm: (scope, {allocPage,internalThrow,}) => [...number(allocPage(scope, 'array: __Array_prototype_filter/out', 'f64') * pageSize, 124),[34,4],[252,3],[34,5],[65,0],[54,1,0],[32,0],[252,3],[40,1,0],[184],[33,6],[68,0,0,0,0,0,0,0,0],[33,7],[3,64],[32,7],[32,6],[99],[4,64],[32,7],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,10],[43,0,4],[32,10],[45,0,12],[33,11],[33,8],[32,11],[33,9],[32,3],[33,19],[2,124],[32,19],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,8],[32,9],[33,12],[33,13],[32,7],[32,7],[68,0,0,0,0,0,0,240,63],[160],[33,7],[32,11],[33,14],[33,15],[32,0],[65,16],[33,16],[33,17],[32,2],[252,3],[33,18],[2,124],[2,64],[2,64],[2,64],[2,64],[32,18],[65,2],[108],[47,0,128,128,12,"read_argc"],[14,4,0,1,2,3,0],[11],[32,18],[17,0,0],[33,11],[12,3],[11],[32,13],[32,12],[32,18],[17,1,0],[33,11],[12,2],[11],[32,13],[32,12],[32,15],[32,14],[32,18],[17,2,0],[33,11],[12,1],[11],[32,13],[32,12],[32,15],[32,14],[32,17],[32,16],[32,18],[17,3,0],[33,11],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `callbackFn is not a function`),[68,0,0,0,0,0,0,0,0],[11,"TYPESWITCH_end"],[33,20],[32,11],[33,19],[2,124],[32,19],[65,2],[70],[4,64,"TYPESWITCH|String"],[32,20],[252,3],[40,1,0],[184],[12,1],[11],[32,19],[65,18],[70],[4,64,"TYPESWITCH|ByteString"],[32,20],[252,3],[40,1,0],[184],[12,1],[11],[32,20],[252,2],[69],[69],[183],[11,"TYPESWITCH_end"],[252,3],[4,64],[32,4],[252,3],[34,22],[40,1,0],[34,21],[65,9],[108],[32,22],[106],[34,23],[32,8],[57,0,4],[32,23],[32,9],[58,0,12],[32,22],[32,21],[65,1],[106],[54,1,0],[11],[12,1],[11],[11],[32,4],[65,16],[15]],
|
314
314
|
params: [124,127,124,127],
|
315
315
|
typedParams: true,
|
316
316
|
returns: [124,127],
|
@@ -320,17 +320,17 @@ export const BuiltinFuncs = function() {
|
|
320
320
|
table: true
|
321
321
|
};
|
322
322
|
this.__Array_prototype_map = {
|
323
|
-
wasm: (scope, {allocPage,internalThrow,}) => [
|
323
|
+
wasm: (scope, {allocPage,internalThrow,}) => [[32,0],[252,3],[40,1,0],[184],[33,4],...number(allocPage(scope, 'array: __Array_prototype_map/out', 'f64') * pageSize, 124),[34,5],[252,3],[34,6],[65,0],[54,1,0],[32,5],[252,3],[32,4],[34,7],[252,3],[54,1,0],[68,0,0,0,0,0,0,0,0],[33,8],[3,64],[32,8],[32,4],[99],[4,64],[32,5],[252,3],[32,8],[252,3],[65,9],[108],[106],[32,3],[33,19],[2,124],[32,19],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,8],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,10],[43,0,4],[32,10],[45,0,12],[34,11],[33,12],[33,13],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[32,11],[33,14],[33,15],[32,0],[65,16],[33,16],[33,17],[32,2],[252,3],[33,18],[2,124],[2,64],[2,64],[2,64],[2,64],[32,18],[65,2],[108],[47,0,128,128,12,"read_argc"],[14,4,0,1,2,3,0],[11],[32,18],[17,0,0],[33,11],[12,3],[11],[32,13],[32,12],[32,18],[17,1,0],[33,11],[12,2],[11],[32,13],[32,12],[32,15],[32,14],[32,18],[17,2,0],[33,11],[12,1],[11],[32,13],[32,12],[32,15],[32,14],[32,17],[32,16],[32,18],[17,3,0],[33,11],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `callbackFn is not a function`),[68,0,0,0,0,0,0,0,0],[11,"TYPESWITCH_end"],[34,9],[57,0,4],[12,1],[11],[11],[32,5],[65,16],[15]],
|
324
324
|
params: [124,127,124,127],
|
325
325
|
typedParams: true,
|
326
326
|
returns: [124,127],
|
327
327
|
typedReturns: true,
|
328
|
-
locals: [124,127,124,124,
|
329
|
-
localNames: ["_this","_this#type","callbackFn","callbackFn#type","out","#makearray_pointer_tmp","
|
328
|
+
locals: [124,124,127,124,124,124,127,127,127,124,127,124,127,124,127,127],
|
329
|
+
localNames: ["_this","_this#type","callbackFn","callbackFn#type","len","out","#makearray_pointer_tmp","__length_setter_tmp","i","__member_setter_val_tmp","#loadArray_offset","#last_type","#indirect_arg0_type","#indirect_arg0_val","#indirect_arg1_type","#indirect_arg1_val","#indirect_arg2_type","#indirect_arg2_val","#indirect_func","#typeswitch_tmp"],
|
330
330
|
table: true
|
331
331
|
};
|
332
332
|
this.__Array_prototype_find = {
|
333
|
-
wasm: (scope, {internalThrow,}) => [[32,0],[252,3],[40,1,0],[184],[33,4],[68,0,0,0,0,0,0,0,0],[33,5],[3,64],[32,5],[32,4],[99],[4,64],[32,5],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,8],[43,0,4],[32,8],[45,0,12],[33,9],[33,6],[
|
333
|
+
wasm: (scope, {internalThrow,}) => [[32,0],[252,3],[40,1,0],[184],[33,4],[68,0,0,0,0,0,0,0,0],[33,5],[3,64],[32,5],[32,4],[99],[4,64],[32,5],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,8],[43,0,4],[32,8],[45,0,12],[33,9],[33,6],[32,9],[33,7],[32,3],[33,17],[2,124],[32,17],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,6],[32,7],[33,10],[33,11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[32,9],[33,12],[33,13],[32,0],[65,16],[33,14],[33,15],[32,2],[252,3],[33,16],[2,124],[2,64],[2,64],[2,64],[2,64],[32,16],[65,2],[108],[47,0,128,128,12,"read_argc"],[14,4,0,1,2,3,0],[11],[32,16],[17,0,0],[33,9],[12,3],[11],[32,11],[32,10],[32,16],[17,1,0],[33,9],[12,2],[11],[32,11],[32,10],[32,13],[32,12],[32,16],[17,2,0],[33,9],[12,1],[11],[32,11],[32,10],[32,13],[32,12],[32,15],[32,14],[32,16],[17,3,0],[33,9],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `callbackFn is not a function`),[68,0,0,0,0,0,0,0,0],[11,"TYPESWITCH_end"],[33,18],[32,9],[33,17],[2,124],[32,17],[65,2],[70],[4,64,"TYPESWITCH|String"],[32,18],[252,3],[40,1,0],[184],[12,1],[11],[32,17],[65,18],[70],[4,64,"TYPESWITCH|ByteString"],[32,18],[252,3],[40,1,0],[184],[12,1],[11],[32,18],[252,2],[69],[69],[183],[11,"TYPESWITCH_end"],[252,3],[4,64],[32,6],[32,7],[15],[11],[12,1],[11],[11],[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
334
334
|
params: [124,127,124,127],
|
335
335
|
typedParams: true,
|
336
336
|
returns: [124,127],
|
@@ -340,7 +340,7 @@ export const BuiltinFuncs = function() {
|
|
340
340
|
table: true
|
341
341
|
};
|
342
342
|
this.__Array_prototype_findLast = {
|
343
|
-
wasm: (scope, {internalThrow,}) => [[32,0],[252,3],[40,1,0],[184],[33,4],[3,64],[32,4],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,4],[68,0,0,0,0,0,0,240,63],[161],[34,4],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,7],[43,0,4],[32,7],[45,0,12],[33,8],[33,5],[
|
343
|
+
wasm: (scope, {internalThrow,}) => [[32,0],[252,3],[40,1,0],[184],[33,4],[3,64],[32,4],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,4],[68,0,0,0,0,0,0,240,63],[161],[34,4],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,7],[43,0,4],[32,7],[45,0,12],[33,8],[33,5],[32,8],[33,6],[32,3],[33,16],[2,124],[32,16],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,5],[32,6],[33,9],[33,10],[32,4],[65,0],[33,11],[33,12],[32,0],[65,16],[33,13],[33,14],[32,2],[252,3],[33,15],[2,124],[2,64],[2,64],[2,64],[2,64],[32,15],[65,2],[108],[47,0,128,128,12,"read_argc"],[14,4,0,1,2,3,0],[11],[32,15],[17,0,0],[33,8],[12,3],[11],[32,10],[32,9],[32,15],[17,1,0],[33,8],[12,2],[11],[32,10],[32,9],[32,12],[32,11],[32,15],[17,2,0],[33,8],[12,1],[11],[32,10],[32,9],[32,12],[32,11],[32,14],[32,13],[32,15],[17,3,0],[33,8],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `callbackFn is not a function`),[68,0,0,0,0,0,0,0,0],[11,"TYPESWITCH_end"],[33,17],[32,8],[33,16],[2,124],[32,16],[65,2],[70],[4,64,"TYPESWITCH|String"],[32,17],[252,3],[40,1,0],[184],[12,1],[11],[32,16],[65,18],[70],[4,64,"TYPESWITCH|ByteString"],[32,17],[252,3],[40,1,0],[184],[12,1],[11],[32,17],[252,2],[69],[69],[183],[11,"TYPESWITCH_end"],[252,3],[4,64],[32,5],[32,6],[15],[11],[12,1],[11],[11],[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
344
344
|
params: [124,127,124,127],
|
345
345
|
typedParams: true,
|
346
346
|
returns: [124,127],
|
@@ -350,7 +350,7 @@ export const BuiltinFuncs = function() {
|
|
350
350
|
table: true
|
351
351
|
};
|
352
352
|
this.__Array_prototype_findIndex = {
|
353
|
-
wasm: (scope, {internalThrow,}) => [[32,0],[252,3],[40,1,0],[184],[33,4],[68,0,0,0,0,0,0,0,0],[33,5],[3,64],[32,5],[32,4],[99],[4,64],[32,3],[33,15],[2,124],[32,15],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,5],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,6],[43,0,4],[32,6],[45,0,12],[
|
353
|
+
wasm: (scope, {internalThrow,}) => [[32,0],[252,3],[40,1,0],[184],[33,4],[68,0,0,0,0,0,0,0,0],[33,5],[3,64],[32,5],[32,4],[99],[4,64],[32,3],[33,15],[2,124],[32,15],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,5],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,6],[43,0,4],[32,6],[45,0,12],[34,7],[33,8],[33,9],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[32,7],[33,10],[33,11],[32,0],[65,16],[33,12],[33,13],[32,2],[252,3],[33,14],[2,124],[2,64],[2,64],[2,64],[2,64],[32,14],[65,2],[108],[47,0,128,128,12,"read_argc"],[14,4,0,1,2,3,0],[11],[32,14],[17,0,0],[33,7],[12,3],[11],[32,9],[32,8],[32,14],[17,1,0],[33,7],[12,2],[11],[32,9],[32,8],[32,11],[32,10],[32,14],[17,2,0],[33,7],[12,1],[11],[32,9],[32,8],[32,11],[32,10],[32,13],[32,12],[32,14],[17,3,0],[33,7],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `callbackFn is not a function`),[68,0,0,0,0,0,0,0,0],[11,"TYPESWITCH_end"],[33,16],[32,7],[33,15],[2,124],[32,15],[65,2],[70],[4,64,"TYPESWITCH|String"],[32,16],[252,3],[40,1,0],[184],[12,1],[11],[32,15],[65,18],[70],[4,64,"TYPESWITCH|ByteString"],[32,16],[252,3],[40,1,0],[184],[12,1],[11],[32,16],[252,2],[69],[69],[183],[11,"TYPESWITCH_end"],[252,3],[4,64],[32,5],[65,0],[15],[11],[12,1],[11],[11],[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
354
354
|
params: [124,127,124,127],
|
355
355
|
typedParams: true,
|
356
356
|
returns: [124,127],
|
@@ -360,7 +360,7 @@ export const BuiltinFuncs = function() {
|
|
360
360
|
table: true
|
361
361
|
};
|
362
362
|
this.__Array_prototype_findLastIndex = {
|
363
|
-
wasm: (scope, {internalThrow,}) => [[32,0],[252,3],[40,1,0],[184],[33,4],[3,64],[32,4],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,3],[33,14],[2,124],[32,14],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,4],[68,0,0,0,0,0,0,240,63],[161],[34,4],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,5],[43,0,4],[32,5],[45,0,12],[
|
363
|
+
wasm: (scope, {internalThrow,}) => [[32,0],[252,3],[40,1,0],[184],[33,4],[3,64],[32,4],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,3],[33,14],[2,124],[32,14],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,4],[68,0,0,0,0,0,0,240,63],[161],[34,4],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,5],[43,0,4],[32,5],[45,0,12],[34,6],[33,7],[33,8],[32,4],[65,0],[33,9],[33,10],[32,0],[65,16],[33,11],[33,12],[32,2],[252,3],[33,13],[2,124],[2,64],[2,64],[2,64],[2,64],[32,13],[65,2],[108],[47,0,128,128,12,"read_argc"],[14,4,0,1,2,3,0],[11],[32,13],[17,0,0],[33,6],[12,3],[11],[32,8],[32,7],[32,13],[17,1,0],[33,6],[12,2],[11],[32,8],[32,7],[32,10],[32,9],[32,13],[17,2,0],[33,6],[12,1],[11],[32,8],[32,7],[32,10],[32,9],[32,12],[32,11],[32,13],[17,3,0],[33,6],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `callbackFn is not a function`),[68,0,0,0,0,0,0,0,0],[11,"TYPESWITCH_end"],[33,15],[32,6],[33,14],[2,124],[32,14],[65,2],[70],[4,64,"TYPESWITCH|String"],[32,15],[252,3],[40,1,0],[184],[12,1],[11],[32,14],[65,18],[70],[4,64,"TYPESWITCH|ByteString"],[32,15],[252,3],[40,1,0],[184],[12,1],[11],[32,15],[252,2],[69],[69],[183],[11,"TYPESWITCH_end"],[252,3],[4,64],[32,4],[65,0],[15],[11],[12,1],[11],[11],[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
364
364
|
params: [124,127,124,127],
|
365
365
|
typedParams: true,
|
366
366
|
returns: [124,127],
|
@@ -370,7 +370,7 @@ export const BuiltinFuncs = function() {
|
|
370
370
|
table: true
|
371
371
|
};
|
372
372
|
this.__Array_prototype_every = {
|
373
|
-
wasm: (scope, {internalThrow,}) => [[32,0],[252,3],[40,1,0],[184],[33,4],[68,0,0,0,0,0,0,0,0],[33,5],[3,64],[32,5],[32,4],[99],[4,64],[32,3],[33,15],[2,124],[32,15],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,5],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,6],[43,0,4],[32,6],[45,0,12],[
|
373
|
+
wasm: (scope, {internalThrow,}) => [[32,0],[252,3],[40,1,0],[184],[33,4],[68,0,0,0,0,0,0,0,0],[33,5],[3,64],[32,5],[32,4],[99],[4,64],[32,3],[33,15],[2,124],[32,15],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,5],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,6],[43,0,4],[32,6],[45,0,12],[34,7],[33,8],[33,9],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[32,7],[33,10],[33,11],[32,0],[65,16],[33,12],[33,13],[32,2],[252,3],[33,14],[2,124],[2,64],[2,64],[2,64],[2,64],[32,14],[65,2],[108],[47,0,128,128,12,"read_argc"],[14,4,0,1,2,3,0],[11],[32,14],[17,0,0],[33,7],[12,3],[11],[32,9],[32,8],[32,14],[17,1,0],[33,7],[12,2],[11],[32,9],[32,8],[32,11],[32,10],[32,14],[17,2,0],[33,7],[12,1],[11],[32,9],[32,8],[32,11],[32,10],[32,13],[32,12],[32,14],[17,3,0],[33,7],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `callbackFn is not a function`),[68,0,0,0,0,0,0,0,0],[11,"TYPESWITCH_end"],[33,16],[32,7],[33,15],[2,124],[32,15],[65,2],[70],[4,64,"TYPESWITCH|String"],[32,16],[252,3],[40,1,0],[184],[12,1],[11],[32,15],[65,18],[70],[4,64,"TYPESWITCH|ByteString"],[32,16],[252,3],[40,1,0],[184],[12,1],[11],[32,16],[252,2],[69],[69],[183],[11,"TYPESWITCH_end"],[68,0,0,0,0,0,0,0,0],[97],[4,64],[68,0,0,0,0,0,0,0,0],[65,1],[15],[11],[12,1],[11],[11],[68,0,0,0,0,0,0,240,63],[65,1],[15]],
|
374
374
|
params: [124,127,124,127],
|
375
375
|
typedParams: true,
|
376
376
|
returns: [124,127],
|
@@ -379,6 +379,35 @@ export const BuiltinFuncs = function() {
|
|
379
379
|
localNames: ["_this","_this#type","callbackFn","callbackFn#type","len","i","#loadArray_offset","#last_type","#indirect_arg0_type","#indirect_arg0_val","#indirect_arg1_type","#indirect_arg1_val","#indirect_arg2_type","#indirect_arg2_val","#indirect_func","#typeswitch_tmp","#logicinner_tmp"],
|
380
380
|
table: true
|
381
381
|
};
|
382
|
+
this.__Array_prototype_reduce = {
|
383
|
+
wasm: (scope, {internalThrow,}) => [[32,4],[34,10],[33,11],[32,5],[33,12],[2,127],[32,12],[65,3],[70],[4,64,"TYPESWITCH|undefined"],[65,1],[12,1],[11],[32,12],[65,4],[70],[4,64,"TYPESWITCH|Object"],[32,11],[68,0,0,0,0,0,0,0,0],[97],[12,1],[11],[65,0],[11,"TYPESWITCH_end"],[4,124],[65,0],[65,9],[108],[32,0],[252,3],[106],[34,8],[43,0,4],[32,8],[45,0,12],[34,9],[33,9],[5],[32,10],[32,5],[33,9],[11],[33,6],[32,9],[33,7],[32,0],[252,3],[40,1,0],[184],[33,13],[68,0,0,0,0,0,0,0,0],[33,14],[3,64],[32,14],[32,13],[99],[4,64],[32,3],[33,12],[2,124],[32,12],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,6],[32,7],[33,15],[33,16],[32,14],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,8],[43,0,4],[32,8],[45,0,12],[34,9],[33,17],[33,18],[32,14],[32,14],[68,0,0,0,0,0,0,240,63],[160],[33,14],[32,9],[33,19],[33,20],[32,0],[65,16],[33,21],[33,22],[32,2],[252,3],[33,23],[2,124],[2,64],[2,64],[2,64],[2,64],[2,64],[32,23],[65,2],[108],[47,0,128,128,12,"read_argc"],[14,5,0,1,2,3,4,0],[11],[32,23],[17,0,0],[33,9],[12,4],[11],[32,16],[32,15],[32,23],[17,1,0],[33,9],[12,3],[11],[32,16],[32,15],[32,18],[32,17],[32,23],[17,2,0],[33,9],[12,2],[11],[32,16],[32,15],[32,18],[32,17],[32,20],[32,19],[32,23],[17,3,0],[33,9],[12,1],[11],[32,16],[32,15],[32,18],[32,17],[32,20],[32,19],[32,22],[32,21],[32,23],[17,4,0],[33,9],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `callbackFn is not a function`),[68,0,0,0,0,0,0,0,0],[11,"TYPESWITCH_end"],[34,6],[32,9],[33,7],[26],[12,1],[11],[11],[32,6],[32,7],[15]],
|
384
|
+
params: [124,127,124,127,124,127],
|
385
|
+
typedParams: true,
|
386
|
+
returns: [124,127],
|
387
|
+
typedReturns: true,
|
388
|
+
locals: [124,127,127,127,124,124,127,124,124,127,124,127,124,127,124,127,124,127],
|
389
|
+
localNames: ["_this","_this#type","callbackFn","callbackFn#type","initialValue","initialValue#type","acc","acc#type","#loadArray_offset","#last_type","logictmp","#logicinner_tmp","#typeswitch_tmp","len","i","#indirect_arg0_type","#indirect_arg0_val","#indirect_arg1_type","#indirect_arg1_val","#indirect_arg2_type","#indirect_arg2_val","#indirect_arg3_type","#indirect_arg3_val","#indirect_func"],
|
390
|
+
table: true
|
391
|
+
};
|
392
|
+
this.__Array_prototype_toString = {
|
393
|
+
wasm: (scope, {allocPage,builtin,}) => [...number(allocPage(scope, 'bytestring: __Array_prototype_toString/out', 'i8') * pageSize, 124),[34,2],[252,3],[68,0,0,0,0,0,0,0,0],[34,3],[252,3],[54,1,0],[32,0],[252,3],[40,1,0],[184],[33,4],[68,0,0,0,0,0,0,0,0],[33,5],[3,64],[32,5],[32,4],[99],[4,64],[32,5],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,2],[65,18],[68,0,0,0,0,0,0,70,64],[65,0],[16, builtin('__Porffor_bytestring_appendChar')],[26],[11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,8],[43,0,4],[32,8],[45,0,12],[33,9],[33,6],[32,9],[33,7],[32,6],[32,7],[16, builtin('__Porffor_rawType')],[33,10],[32,6],[68,0,0,0,0,0,0,0,0],[98],[34,11],[69],[4,127],[32,10],[68,0,0,0,0,0,0,8,64],[98],[32,10],[68,0,0,0,0,0,0,16,64],[98],[113],[65,1],[33,9],[5],[32,11],[65,1],[33,9],[11],[183],[33,12],[32,9],[33,13],[2,127],[32,13],[65,2],[70],[4,64,"TYPESWITCH|String"],[32,12],[252,3],[40,1,0],[12,1],[11],[32,13],[65,18],[70],[4,64,"TYPESWITCH|ByteString"],[32,12],[252,3],[40,1,0],[12,1],[11],[32,12],[252,3],[11,"TYPESWITCH_end"],[4,64],[32,2],[65,18],[32,6],[32,7],[16, builtin('__ecma262_ToString')],[65,18],[16, builtin('__Porffor_bytestring_appendStr')],[26],[11],[12,1],[11],[11],[32,2],[65,18],[15]],
|
394
|
+
params: [124,127],
|
395
|
+
typedParams: true,
|
396
|
+
returns: [124,127],
|
397
|
+
typedReturns: true,
|
398
|
+
locals: [124,124,124,124,124,127,127,127,124,127,124,127],
|
399
|
+
localNames: ["_this","_this#type","out","__length_setter_tmp","len","i","element","element#type","#loadArray_offset","#last_type","type","logictmpi","#logicinner_tmp","#typeswitch_tmp"],
|
400
|
+
};
|
401
|
+
this.__Array_prototype_join = {
|
402
|
+
wasm: (scope, {allocPage,builtin,}) => [...number(allocPage(scope, 'bytestring: __Array_prototype_join/separator', 'i8') * pageSize, 124),[33,4],[32,2],[32,3],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[4,64],[32,2],[32,3],[16, builtin('__ecma262_ToString')],[33,4],[11],...number(allocPage(scope, 'bytestring: __Array_prototype_join/out', 'i8') * pageSize, 124),[34,5],[252,3],[68,0,0,0,0,0,0,0,0],[34,6],[252,3],[54,1,0],[32,0],[252,3],[40,1,0],[184],[33,7],[68,0,0,0,0,0,0,0,0],[33,8],[3,64],[32,8],[32,7],[99],[4,64],[32,8],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,5],[65,18],[32,4],[65,18],[16, builtin('__Porffor_bytestring_appendStr')],[26],[11],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,11],[43,0,4],[32,11],[45,0,12],[33,12],[33,9],[32,12],[33,10],[32,9],[32,10],[16, builtin('__Porffor_rawType')],[33,13],[32,9],[68,0,0,0,0,0,0,0,0],[98],[34,14],[69],[4,127],[32,13],[68,0,0,0,0,0,0,8,64],[98],[32,13],[68,0,0,0,0,0,0,16,64],[98],[113],[65,1],[33,12],[5],[32,14],[65,1],[33,12],[11],[183],[33,15],[32,12],[33,16],[2,127],[32,16],[65,2],[70],[4,64,"TYPESWITCH|String"],[32,15],[252,3],[40,1,0],[12,1],[11],[32,16],[65,18],[70],[4,64,"TYPESWITCH|ByteString"],[32,15],[252,3],[40,1,0],[12,1],[11],[32,15],[252,3],[11,"TYPESWITCH_end"],[4,64],[32,5],[65,18],[32,9],[32,10],[16, builtin('__ecma262_ToString')],[65,18],[16, builtin('__Porffor_bytestring_appendStr')],[26],[11],[12,1],[11],[11],[32,5],[65,18],[15]],
|
403
|
+
params: [124,127,124,127],
|
404
|
+
typedParams: true,
|
405
|
+
returns: [124,127],
|
406
|
+
typedReturns: true,
|
407
|
+
locals: [124,124,124,124,124,124,127,127,127,124,127,124,127],
|
408
|
+
localNames: ["_this","_this#type","_separator","_separator#type","separator","out","__length_setter_tmp","len","i","element","element#type","#loadArray_offset","#last_type","type","logictmpi","#logicinner_tmp","#typeswitch_tmp"],
|
409
|
+
data: [{"bytes":[1,0,0,0,44],"offset":0}],
|
410
|
+
};
|
382
411
|
this.btoa = {
|
383
412
|
wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'bytestring: btoa/keyStr', 'i8') * pageSize, 127),[34,2],[33,3],[32,0],[40,1,0],[33,4],...number(allocPage(scope, 'bytestring: btoa/output', 'i8') * pageSize, 127),[34,5],[65,4],[32,4],[65,3],[109],[32,4],[65,3],[111],[106],[108],[34,6],[54,1,0],[32,0],[33,7],[32,5],[33,8],[32,7],[32,4],[106],[33,9],[65,0],[33,10],[3,64],[32,7],[32,9],[72],[4,64],[32,7],[32,7],[65,1],[106],[33,7],[45,0,4],[33,11],[32,7],[32,9],[72],[4,127],[32,7],[32,7],[65,1],[106],[33,7],[45,0,4],[65,0],[33,13],[5],[65,127],[65,0],[33,13],[11],[33,12],[32,7],[32,9],[72],[4,127],[32,7],[32,7],[65,1],[106],[33,7],[45,0,4],[65,0],[33,13],[5],[65,127],[65,0],[33,13],[11],[33,14],[32,11],[65,2],[117],[33,15],[32,11],[65,3],[113],[65,4],[116],[32,12],[65,127],[70],[4,127],[65,0],[65,0],[33,13],[5],[32,12],[65,4],[117],[65,0],[33,13],[11],[114],[33,16],[32,12],[65,15],[113],[65,2],[116],[32,14],[65,127],[70],[4,127],[65,0],[65,0],[33,13],[5],[32,14],[65,6],[117],[65,0],[33,13],[11],[114],[33,17],[32,14],[65,63],[113],[33,18],[32,12],[65,127],[70],[4,64],[65,192,0],[33,17],[65,192,0],[33,18],[5],[32,14],[65,127],[70],[4,64],[65,192,0],[33,18],[11],[11],[32,8],[32,8],[65,1],[106],[33,8],[32,3],[32,15],[106],[45,0,4],[58,0,4],[32,8],[32,8],[65,1],[106],[33,8],[32,3],[32,16],[106],[45,0,4],[58,0,4],[32,8],[32,8],[65,1],[106],[33,8],[32,3],[32,17],[106],[45,0,4],[58,0,4],[32,8],[32,8],[65,1],[106],[33,8],[32,3],[32,18],[106],[45,0,4],[58,0,4],[12,1],[11],[11],[32,5],[15]],
|
384
413
|
params: [127,127],
|
@@ -580,15 +609,6 @@ export const BuiltinFuncs = function() {
|
|
580
609
|
locals: [],
|
581
610
|
localNames: ["t","t#type"],
|
582
611
|
};
|
583
|
-
this.__ecma262_ToIntegerOrInfinity = {
|
584
|
-
wasm: (scope, {builtin,}) => [[32,0],[16, builtin('Number')],[34,2],[16, builtin('__Number_isNaN')],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[15],[11],[32,2],[16, builtin('__Number_isFinite')],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,2],[15],[11],[32,2],[16, builtin('__Math_trunc')],[34,2],[68,0,0,0,0,0,0,0,0],[97],[4,64],[68,0,0,0,0,0,0,0,0],[15],[11],[32,2],[15]],
|
585
|
-
params: [124,127],
|
586
|
-
typedParams: true,
|
587
|
-
returns: [124],
|
588
|
-
returnType: 0,
|
589
|
-
locals: [124],
|
590
|
-
localNames: ["argument","argument#type","number"],
|
591
|
-
};
|
592
612
|
this.__ecma262_MakeTime = {
|
593
613
|
wasm: (scope, {builtin,}) => [[32,0],[16, builtin('__Number_isFinite')],[68,0,0,0,0,0,0,0,0],[97],[32,2],[16, builtin('__Number_isFinite')],[68,0,0,0,0,0,0,0,0],[97],[114],[32,4],[16, builtin('__Number_isFinite')],[68,0,0,0,0,0,0,0,0],[97],[114],[32,6],[16, builtin('__Number_isFinite')],[68,0,0,0,0,0,0,0,0],[97],[114],[4,64],[68,0,0,0,0,0,0,248,127],[15],[11],[32,0],[65,0],[16, builtin('__ecma262_ToIntegerOrInfinity')],[33,8],[32,2],[65,0],[16, builtin('__ecma262_ToIntegerOrInfinity')],[33,9],[32,4],[65,0],[16, builtin('__ecma262_ToIntegerOrInfinity')],[33,10],[32,6],[65,0],[16, builtin('__ecma262_ToIntegerOrInfinity')],[33,11],[32,8],[68,0,0,0,0,64,119,75,65],[162],[32,9],[68,0,0,0,0,0,76,237,64],[162],[160],[32,10],[68,0,0,0,0,0,64,143,64],[162],[160],[32,11],[160],[15]],
|
594
614
|
params: [124,127,124,127,124,127,124,127],
|
@@ -709,7 +729,7 @@ export const BuiltinFuncs = function() {
|
|
709
729
|
localNames: ["string","string#type","chr"],
|
710
730
|
};
|
711
731
|
this.__Porffor_date_allocate = {
|
712
|
-
wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'bytestring: __Porffor_date_allocate/hack', 'i8') * pageSize, 124),[34,0],[252,3],[40,1,0],[184],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,0],[252,3],[
|
732
|
+
wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'bytestring: __Porffor_date_allocate/hack', 'i8') * pageSize, 124),[34,0],[252,3],[40,1,0],[184],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,0],[252,3],[65,1],[64,0],[65,128,128,4],[108],[184],[34,1],[252,3],[54,1,0],[11],[32,0],[252,3],[40,1,0],[184],[33,2],[32,0],[252,3],[32,2],[68,0,0,0,0,0,0,32,64],[160],[34,1],[252,3],[54,1,0],[32,2],[15]],
|
713
733
|
params: [],
|
714
734
|
typedParams: true,
|
715
735
|
returns: [124],
|
@@ -1594,7 +1614,7 @@ export const BuiltinFuncs = function() {
|
|
1594
1614
|
localNames: ["y","y#type","x","x#type","ratio","ratio#type"],
|
1595
1615
|
};
|
1596
1616
|
this.__Number_prototype_toString = {
|
1597
|
-
wasm: (scope, {allocPage,builtin,internalThrow,}) => [...number(allocPage(scope, 'bytestring: __Number_prototype_toString/out', 'i8') * pageSize, 124),[34,4],[33,5],[32,0],[16, builtin('__Number_isFinite')],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,0],[16, builtin('__Number_isNaN')],[252,3],[4,64],[32,4],[252,3],[34,6],[65,3],[54,1,0],[32,6],[65,206,0],[58,0,4],[32,6],[65,225,0],[58,0,5],[32,6],[65,206,0],[58,0,6],[32,6],[184],[
|
1617
|
+
wasm: (scope, {allocPage,builtin,internalThrow,}) => [...number(allocPage(scope, 'bytestring: __Number_prototype_toString/out', 'i8') * pageSize, 124),[34,4],[33,5],[32,0],[16, builtin('__Number_isFinite')],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,0],[16, builtin('__Number_isNaN')],[252,3],[4,64],[32,4],[252,3],[34,6],[65,3],[54,1,0],[32,6],[65,206,0],[58,0,4],[32,6],[65,225,0],[58,0,5],[32,6],[65,206,0],[58,0,6],[32,6],[184],[34,4],[65,18],[15],[11],[32,0],[68,0,0,0,0,0,0,240,127],[97],[4,64],[32,4],[252,3],[34,6],[65,8],[54,1,0],[32,6],[65,201,0],[58,0,4],[32,6],[65,238,0],[58,0,5],[32,6],[65,230,0],[58,0,6],[32,6],[65,233,0],[58,0,7],[32,6],[65,238,0],[58,0,8],[32,6],[65,233,0],[58,0,9],[32,6],[65,244,0],[58,0,10],[32,6],[65,249,0],[58,0,11],[32,6],[184],[34,4],[65,18],[15],[11],[32,4],[252,3],[34,6],[65,9],[54,1,0],[32,6],[65,45],[58,0,4],[32,6],[65,201,0],[58,0,5],[32,6],[65,238,0],[58,0,6],[32,6],[65,230,0],[58,0,7],[32,6],[65,233,0],[58,0,8],[32,6],[65,238,0],[58,0,9],[32,6],[65,233,0],[58,0,10],[32,6],[65,244,0],[58,0,11],[32,6],[65,249,0],[58,0,12],[32,6],[184],[34,4],[65,18],[15],[11],[32,2],[32,3],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,0,0],[98],[4,64],[68,0,0,0,0,0,0,36,64],[34,2],[65,0],[33,3],[26],[11],[32,2],[68,0,0,0,0,0,0,0,0],[16, builtin('f64_|')],[34,2],[65,0],[33,3],[26],[32,2],[68,0,0,0,0,0,0,0,64],[99],[34,7],[69],[4,127],[32,2],[68,0,0,0,0,0,0,66,64],[100],[65,1],[33,8],[5],[32,7],[65,1],[33,8],[11],[183],[33,9],[32,8],[33,10],[2,127],[32,10],[65,2],[70],[4,64,"TYPESWITCH|String"],[32,9],[252,3],[40,1,0],[12,1],[11],[32,10],[65,18],[70],[4,64,"TYPESWITCH|ByteString"],[32,9],[252,3],[40,1,0],[12,1],[11],[32,9],[252,3],[11,"TYPESWITCH_end"],[4,64],...internalThrow(scope, 'RangeError', `toString() radix argument must be between 2 and 36`),[11],[32,0],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,4],[252,3],[34,6],[65,1],[54,1,0],[32,6],[65,48],[58,0,4],[32,6],[184],[34,4],[65,18],[15],[11],[32,0],[68,0,0,0,0,0,0,0,0],[99],[4,64],[32,0],[154],[33,0],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,45],[58,0,4],[11],[32,0],[16, builtin('__Math_trunc')],[33,11],...number(allocPage(scope, 'bytestring: __Number_prototype_toString/digits', 'i8') * pageSize, 124),[33,12],[68,0,0,0,0,0,0,0,0],[33,13],[32,2],[68,0,0,0,0,0,0,36,64],[97],[4,64],[32,11],[68,80,239,226,214,228,26,75,68],[102],[4,64],[68,0,0,0,0,0,0,240,63],[33,14],[68,0,0,0,0,0,0,240,191],[33,15],[3,64],[32,11],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,11],[32,2],[16, builtin('f64_%')],[33,16],[32,11],[32,2],[163],[16, builtin('__Math_trunc')],[33,11],[32,15],[68,0,0,0,0,0,0,240,63],[160],[33,15],[32,14],[252,3],[4,64],[32,16],[68,0,0,0,0,0,0,0,0],[97],[4,64],[12,3],[11],[68,0,0,0,0,0,0,0,0],[33,14],[11],[32,12],[32,13],[160],[252,2],[32,16],[252,2],[58,0,4],[32,13],[68,0,0,0,0,0,0,240,63],[160],[33,13],[12,1],[11],[11],[32,12],[32,13],[160],[33,17],[32,5],[32,13],[160],[33,18],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,19],[3,64],[32,5],[32,18],[99],[4,64],[32,5],[32,19],[97],[4,64],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,46],[58,0,4],[32,18],[68,0,0,0,0,0,0,240,63],[160],[33,18],[11],[32,17],[68,0,0,0,0,0,0,240,63],[161],[34,17],[252,2],[45,0,4],[183],[34,16],[68,0,0,0,0,0,0,36,64],[99],[4,64],[32,16],[68,0,0,0,0,0,0,72,64],[160],[33,16],[5],[32,16],[68,0,0,0,0,0,192,85,64],[160],[33,16],[11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[32,16],[252,2],[58,0,4],[12,1],[11],[11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,229,0],[58,0,4],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,43],[58,0,4],[68,0,0,0,0,0,0,0,0],[33,13],[3,64],[32,15],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,12],[32,13],[160],[252,2],[32,15],[32,2],[16, builtin('f64_%')],[252,2],[58,0,4],[32,15],[32,2],[163],[16, builtin('__Math_trunc')],[33,15],[32,13],[68,0,0,0,0,0,0,240,63],[160],[33,13],[12,1],[11],[11],[32,12],[32,13],[160],[33,17],[32,5],[32,13],[160],[33,18],[3,64],[32,5],[32,18],[99],[4,64],[32,17],[68,0,0,0,0,0,0,240,63],[161],[34,17],[252,2],[45,0,4],[183],[34,16],[68,0,0,0,0,0,0,36,64],[99],[4,64],[32,16],[68,0,0,0,0,0,0,72,64],[160],[33,16],[5],[32,16],[68,0,0,0,0,0,192,85,64],[160],[33,16],[11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[32,16],[252,2],[58,0,4],[12,1],[11],[11],[32,4],[252,3],[32,5],[32,4],[161],[34,20],[252,3],[54,1,0],[32,4],[65,18],[15],[11],[32,0],[68,141,237,181,160,247,198,176,62],[99],[4,64],[32,0],[33,21],[68,0,0,0,0,0,0,240,63],[33,15],[3,64],[65,1],[4,64],[32,21],[32,2],[162],[34,21],[16, builtin('__Math_trunc')],[34,22],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,21],[32,22],[161],[68,187,189,215,217,223,124,219,61],[99],[4,64],[12,2],[11],[5],[32,15],[68,0,0,0,0,0,0,240,63],[160],[33,15],[11],[12,1],[11],[11],[3,64],[32,21],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,21],[32,2],[16, builtin('f64_%')],[33,16],[32,21],[32,2],[163],[16, builtin('__Math_trunc')],[33,21],[32,12],[32,13],[160],[252,2],[32,16],[252,2],[58,0,4],[32,13],[68,0,0,0,0,0,0,240,63],[160],[33,13],[12,1],[11],[11],[32,12],[32,13],[160],[33,17],[32,5],[32,13],[160],[33,18],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,19],[3,64],[32,5],[32,18],[99],[4,64],[32,17],[68,0,0,0,0,0,0,240,63],[161],[34,17],[252,2],[45,0,4],[183],[33,16],[32,5],[32,19],[97],[4,64],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,46],[58,0,4],[32,18],[68,0,0,0,0,0,0,240,63],[160],[33,18],[11],[32,16],[68,0,0,0,0,0,0,36,64],[99],[4,64],[32,16],[68,0,0,0,0,0,0,72,64],[160],[33,16],[5],[32,16],[68,0,0,0,0,0,192,85,64],[160],[33,16],[11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[32,16],[252,2],[58,0,4],[12,1],[11],[11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,229,0],[58,0,4],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,45],[58,0,4],[68,0,0,0,0,0,0,0,0],[33,13],[3,64],[32,15],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,12],[32,13],[160],[252,2],[32,15],[32,2],[16, builtin('f64_%')],[252,2],[58,0,4],[32,15],[32,2],[163],[16, builtin('__Math_trunc')],[33,15],[32,13],[68,0,0,0,0,0,0,240,63],[160],[33,13],[12,1],[11],[11],[32,12],[32,13],[160],[33,17],[32,5],[32,13],[160],[33,18],[3,64],[32,5],[32,18],[99],[4,64],[32,17],[68,0,0,0,0,0,0,240,63],[161],[34,17],[252,2],[45,0,4],[183],[34,16],[68,0,0,0,0,0,0,36,64],[99],[4,64],[32,16],[68,0,0,0,0,0,0,72,64],[160],[33,16],[5],[32,16],[68,0,0,0,0,0,192,85,64],[160],[33,16],[11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[32,16],[252,2],[58,0,4],[12,1],[11],[11],[32,4],[252,3],[32,5],[32,4],[161],[34,20],[252,3],[54,1,0],[32,4],[65,18],[15],[11],[11],[32,11],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,12],[252,2],[65,0],[58,0,4],[68,0,0,0,0,0,0,240,63],[33,13],[5],[3,64],[32,11],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,12],[32,13],[160],[252,2],[32,11],[32,2],[16, builtin('f64_%')],[252,2],[58,0,4],[32,11],[32,2],[163],[16, builtin('__Math_trunc')],[33,11],[32,13],[68,0,0,0,0,0,0,240,63],[160],[33,13],[12,1],[11],[11],[11],[32,12],[32,13],[160],[33,17],[32,5],[32,13],[160],[33,18],[3,64],[32,5],[32,18],[99],[4,64],[32,17],[68,0,0,0,0,0,0,240,63],[161],[34,17],[252,2],[45,0,4],[183],[34,16],[68,0,0,0,0,0,0,36,64],[99],[4,64],[32,16],[68,0,0,0,0,0,0,72,64],[160],[33,16],[5],[32,16],[68,0,0,0,0,0,192,85,64],[160],[33,16],[11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[32,16],[252,2],[58,0,4],[12,1],[11],[11],[32,0],[32,0],[16, builtin('__Math_trunc')],[161],[34,21],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,46],[58,0,4],[32,21],[68,0,0,0,0,0,0,240,63],[160],[33,21],[68,0,0,0,0,0,0,48,64],[32,13],[161],[33,23],[68,0,0,0,0,0,0,0,0],[33,24],[3,64],[32,24],[32,23],[99],[4,64],[32,21],[32,2],[162],[33,21],[32,24],[68,0,0,0,0,0,0,240,63],[160],[33,24],[12,1],[11],[11],[32,21],[16, builtin('__Math_round')],[33,21],[68,0,0,0,0,0,0,0,0],[33,13],[68,0,0,0,0,0,0,240,63],[33,14],[3,64],[32,21],[68,0,0,0,0,0,0,240,63],[100],[4,64],[32,21],[32,2],[16, builtin('f64_%')],[33,16],[32,21],[32,2],[163],[16, builtin('__Math_trunc')],[33,21],[32,14],[252,3],[4,64],[32,16],[68,0,0,0,0,0,0,0,0],[97],[4,64],[12,3],[11],[68,0,0,0,0,0,0,0,0],[33,14],[11],[32,12],[32,13],[160],[252,2],[32,16],[252,2],[58,0,4],[32,13],[68,0,0,0,0,0,0,240,63],[160],[33,13],[12,1],[11],[11],[32,12],[32,13],[160],[33,17],[32,5],[32,13],[160],[33,18],[3,64],[32,5],[32,18],[99],[4,64],[32,17],[68,0,0,0,0,0,0,240,63],[161],[34,17],[252,2],[45,0,4],[183],[34,16],[68,0,0,0,0,0,0,36,64],[99],[4,64],[32,16],[68,0,0,0,0,0,0,72,64],[160],[33,16],[5],[32,16],[68,0,0,0,0,0,192,85,64],[160],[33,16],[11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[32,16],[252,2],[58,0,4],[12,1],[11],[11],[11],[32,4],[252,3],[32,5],[32,4],[161],[34,20],[252,3],[54,1,0],[32,4],[65,18],[15]],
|
1598
1618
|
params: [124,127,124,127],
|
1599
1619
|
typedParams: true,
|
1600
1620
|
returns: [124,127],
|
@@ -1603,7 +1623,7 @@ export const BuiltinFuncs = function() {
|
|
1603
1623
|
localNames: ["_this","_this#type","radix","radix#type","out","outPtr","#makearray_pointer_tmp","logictmpi","#last_type","#logicinner_tmp","#typeswitch_tmp","i","digits","l","trailing","e","digit","digitsPtr","endPtr","dotPlace","__length_setter_tmp","decimal","intPart","decimalDigits","j"],
|
1604
1624
|
};
|
1605
1625
|
this.__Number_prototype_toFixed = {
|
1606
|
-
wasm: (scope, {allocPage,builtin,internalThrow,}) => [...number(allocPage(scope, 'bytestring: __Number_prototype_toFixed/out', 'i8') * pageSize, 124),[34,4],[33,5],[32,0],[16, builtin('__Number_isFinite')],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,0],[16, builtin('__Number_isNaN')],[252,3],[4,64],[32,4],[252,3],[34,6],[65,3],[54,1,0],[32,6],[65,206,0],[58,0,4],[32,6],[65,225,0],[58,0,5],[32,6],[65,206,0],[58,0,6],[32,6],[184],[
|
1626
|
+
wasm: (scope, {allocPage,builtin,internalThrow,}) => [...number(allocPage(scope, 'bytestring: __Number_prototype_toFixed/out', 'i8') * pageSize, 124),[34,4],[33,5],[32,0],[16, builtin('__Number_isFinite')],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,0],[16, builtin('__Number_isNaN')],[252,3],[4,64],[32,4],[252,3],[34,6],[65,3],[54,1,0],[32,6],[65,206,0],[58,0,4],[32,6],[65,225,0],[58,0,5],[32,6],[65,206,0],[58,0,6],[32,6],[184],[34,4],[65,18],[15],[11],[32,0],[68,0,0,0,0,0,0,240,127],[97],[4,64],[32,4],[252,3],[34,6],[65,8],[54,1,0],[32,6],[65,201,0],[58,0,4],[32,6],[65,238,0],[58,0,5],[32,6],[65,230,0],[58,0,6],[32,6],[65,233,0],[58,0,7],[32,6],[65,238,0],[58,0,8],[32,6],[65,233,0],[58,0,9],[32,6],[65,244,0],[58,0,10],[32,6],[65,249,0],[58,0,11],[32,6],[184],[34,4],[65,18],[15],[11],[32,4],[252,3],[34,6],[65,9],[54,1,0],[32,6],[65,45],[58,0,4],[32,6],[65,201,0],[58,0,5],[32,6],[65,238,0],[58,0,6],[32,6],[65,230,0],[58,0,7],[32,6],[65,233,0],[58,0,8],[32,6],[65,238,0],[58,0,9],[32,6],[65,233,0],[58,0,10],[32,6],[65,244,0],[58,0,11],[32,6],[65,249,0],[58,0,12],[32,6],[184],[34,4],[65,18],[15],[11],[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],[34,7],[69],[4,127],[32,2],[68,0,0,0,0,0,0,89,64],[100],[65,1],[33,8],[5],[32,7],[65,1],[33,8],[11],[183],[33,9],[32,8],[33,10],[2,127],[32,10],[65,2],[70],[4,64,"TYPESWITCH|String"],[32,9],[252,3],[40,1,0],[12,1],[11],[32,10],[65,18],[70],[4,64,"TYPESWITCH|ByteString"],[32,9],[252,3],[40,1,0],[12,1],[11],[32,9],[252,3],[11,"TYPESWITCH_end"],[4,64],...internalThrow(scope, 'RangeError', `toFixed() fractionDigits argument must be between 0 and 100`),[11],[32,0],[68,0,0,0,0,0,0,0,0],[99],[4,64],[32,0],[154],[33,0],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,45],[58,0,4],[11],[32,0],[16, builtin('__Math_trunc')],[33,11],...number(allocPage(scope, 'bytestring: __Number_prototype_toFixed/digits', 'i8') * pageSize, 124),[33,12],[68,0,0,0,0,0,0,0,0],[33,13],[32,11],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,12],[252,2],[65,0],[58,0,4],[68,0,0,0,0,0,0,240,63],[33,13],[5],[3,64],[32,11],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,12],[32,13],[160],[252,2],[32,11],[68,0,0,0,0,0,0,36,64],[16, builtin('f64_%')],[252,2],[58,0,4],[32,11],[68,0,0,0,0,0,0,36,64],[163],[16, builtin('__Math_trunc')],[33,11],[32,13],[68,0,0,0,0,0,0,240,63],[160],[33,13],[12,1],[11],[11],[11],[32,12],[32,13],[160],[33,14],[32,5],[32,13],[160],[33,15],[3,64],[32,5],[32,15],[99],[4,64],[32,14],[68,0,0,0,0,0,0,240,63],[161],[34,14],[252,2],[45,0,4],[183],[34,16],[68,0,0,0,0,0,0,36,64],[99],[4,64],[32,16],[68,0,0,0,0,0,0,72,64],[160],[33,16],[5],[32,16],[68,0,0,0,0,0,192,85,64],[160],[33,16],[11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[32,16],[252,2],[58,0,4],[12,1],[11],[11],[32,0],[32,0],[16, builtin('__Math_trunc')],[161],[33,17],[32,2],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,46],[58,0,4],[32,17],[68,0,0,0,0,0,0,240,63],[160],[33,17],[68,0,0,0,0,0,0,0,0],[33,18],[3,64],[32,18],[32,2],[99],[4,64],[32,17],[68,0,0,0,0,0,0,36,64],[162],[33,17],[32,18],[68,0,0,0,0,0,0,240,63],[160],[33,18],[12,1],[11],[11],[32,17],[16, builtin('__Math_round')],[33,17],[68,0,0,0,0,0,0,0,0],[33,13],[3,64],[32,17],[68,0,0,0,0,0,0,240,63],[100],[4,64],[32,17],[68,0,0,0,0,0,0,36,64],[16, builtin('f64_%')],[33,16],[32,17],[68,0,0,0,0,0,0,36,64],[163],[16, builtin('__Math_trunc')],[33,17],[32,12],[32,13],[160],[252,2],[32,16],[252,2],[58,0,4],[32,13],[68,0,0,0,0,0,0,240,63],[160],[33,13],[12,1],[11],[11],[32,12],[32,13],[160],[33,14],[32,5],[32,13],[160],[33,15],[3,64],[32,5],[32,15],[99],[4,64],[32,14],[68,0,0,0,0,0,0,240,63],[161],[34,14],[252,2],[45,0,4],[183],[34,16],[68,0,0,0,0,0,0,36,64],[99],[4,64],[32,16],[68,0,0,0,0,0,0,72,64],[160],[33,16],[5],[32,16],[68,0,0,0,0,0,192,85,64],[160],[33,16],[11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[32,16],[252,2],[58,0,4],[12,1],[11],[11],[11],[32,4],[252,3],[32,5],[32,4],[161],[34,19],[252,3],[54,1,0],[32,4],[65,18],[15]],
|
1607
1627
|
params: [124,127,124,127],
|
1608
1628
|
typedParams: true,
|
1609
1629
|
returns: [124,127],
|
@@ -1612,7 +1632,7 @@ export const BuiltinFuncs = function() {
|
|
1612
1632
|
localNames: ["_this","_this#type","fractionDigits","fractionDigits#type","out","outPtr","#makearray_pointer_tmp","logictmpi","#last_type","#logicinner_tmp","#typeswitch_tmp","i","digits","l","digitsPtr","endPtr","digit","decimal","j","__length_setter_tmp"],
|
1613
1633
|
};
|
1614
1634
|
this.__Number_prototype_toExponential = {
|
1615
|
-
wasm: (scope, {allocPage,builtin,internalThrow,}) => [...number(allocPage(scope, 'bytestring: __Number_prototype_toExponential/out', 'i8') * pageSize, 124),[34,4],[33,5],[32,0],[16, builtin('__Number_isFinite')],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,0],[16, builtin('__Number_isNaN')],[252,3],[4,64],[32,4],[252,3],[34,6],[65,3],[54,1,0],[32,6],[65,206,0],[58,0,4],[32,6],[65,225,0],[58,0,5],[32,6],[65,206,0],[58,0,6],[32,6],[184],[
|
1635
|
+
wasm: (scope, {allocPage,builtin,internalThrow,}) => [...number(allocPage(scope, 'bytestring: __Number_prototype_toExponential/out', 'i8') * pageSize, 124),[34,4],[33,5],[32,0],[16, builtin('__Number_isFinite')],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,0],[16, builtin('__Number_isNaN')],[252,3],[4,64],[32,4],[252,3],[34,6],[65,3],[54,1,0],[32,6],[65,206,0],[58,0,4],[32,6],[65,225,0],[58,0,5],[32,6],[65,206,0],[58,0,6],[32,6],[184],[34,4],[65,18],[15],[11],[32,0],[68,0,0,0,0,0,0,240,127],[97],[4,64],[32,4],[252,3],[34,6],[65,8],[54,1,0],[32,6],[65,201,0],[58,0,4],[32,6],[65,238,0],[58,0,5],[32,6],[65,230,0],[58,0,6],[32,6],[65,233,0],[58,0,7],[32,6],[65,238,0],[58,0,8],[32,6],[65,233,0],[58,0,9],[32,6],[65,244,0],[58,0,10],[32,6],[65,249,0],[58,0,11],[32,6],[184],[34,4],[65,18],[15],[11],[32,4],[252,3],[34,6],[65,9],[54,1,0],[32,6],[65,45],[58,0,4],[32,6],[65,201,0],[58,0,5],[32,6],[65,238,0],[58,0,6],[32,6],[65,230,0],[58,0,7],[32,6],[65,233,0],[58,0,8],[32,6],[65,238,0],[58,0,9],[32,6],[65,233,0],[58,0,10],[32,6],[65,244,0],[58,0,11],[32,6],[65,249,0],[58,0,12],[32,6],[184],[34,4],[65,18],[15],[11],[32,2],[32,3],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,0,0],[98],[4,64],[68,0,0,0,0,0,0,0,0],[34,2],[65,3],[33,3],[26],[5],[32,2],[68,0,0,0,0,0,0,0,0],[16, builtin('f64_|')],[34,2],[65,0],[33,3],[26],[32,2],[68,0,0,0,0,0,0,0,0],[99],[34,7],[69],[4,127],[32,2],[68,0,0,0,0,0,0,89,64],[100],[65,1],[33,8],[5],[32,7],[65,1],[33,8],[11],[183],[33,9],[32,8],[33,10],[2,127],[32,10],[65,2],[70],[4,64,"TYPESWITCH|String"],[32,9],[252,3],[40,1,0],[12,1],[11],[32,10],[65,18],[70],[4,64,"TYPESWITCH|ByteString"],[32,9],[252,3],[40,1,0],[12,1],[11],[32,9],[252,3],[11,"TYPESWITCH_end"],[4,64],...internalThrow(scope, 'RangeError', `toExponential() fractionDigits argument must be between 0 and 100`),[11],[11],[32,0],[68,0,0,0,0,0,0,0,0],[99],[4,64],[32,0],[154],[33,0],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,45],[58,0,4],[11],[32,0],[33,11],...number(allocPage(scope, 'bytestring: __Number_prototype_toExponential/digits', 'i8') * pageSize, 124),[33,12],[68,0,0,0,0,0,0,0,0],[33,13],[68,0,0,0,0,0,0,0,0],[33,14],[32,0],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,48],[58,0,4],[32,2],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,46],[58,0,4],[68,0,0,0,0,0,0,0,0],[33,17],[3,64],[32,17],[32,2],[99],[4,64],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,48],[58,0,4],[32,17],[68,0,0,0,0,0,0,240,63],[160],[33,17],[12,1],[11],[11],[11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,229,0],[58,0,4],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,43],[58,0,4],[5],[32,0],[68,0,0,0,0,0,0,240,63],[99],[4,64],[32,2],[32,3],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,0,0],[98],[4,64],[68,0,0,0,0,0,0,240,63],[33,14],[3,64],[65,1],[4,64],[32,11],[68,0,0,0,0,0,0,36,64],[162],[34,11],[16, builtin('__Math_trunc')],[34,18],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,11],[32,18],[161],[68,187,189,215,217,223,124,219,61],[99],[4,64],[12,2],[11],[5],[32,14],[68,0,0,0,0,0,0,240,63],[160],[33,14],[11],[12,1],[11],[11],[5],[68,0,0,0,0,0,0,240,63],[33,14],[68,0,0,0,0,0,0,0,0],[33,17],[3,64],[32,17],[32,2],[101],[4,64],[32,11],[68,0,0,0,0,0,0,36,64],[162],[34,11],[16, builtin('__Math_trunc')],[34,18],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,14],[68,0,0,0,0,0,0,240,63],[160],[33,14],[5],[32,17],[68,0,0,0,0,0,0,240,63],[160],[33,17],[11],[12,1],[11],[11],[11],[3,64],[32,11],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,11],[68,0,0,0,0,0,0,36,64],[16, builtin('f64_%')],[33,19],[32,11],[68,0,0,0,0,0,0,36,64],[163],[16, builtin('__Math_trunc')],[33,11],[32,12],[32,13],[160],[252,2],[32,19],[252,2],[58,0,4],[32,13],[68,0,0,0,0,0,0,240,63],[160],[33,13],[12,1],[11],[11],[32,12],[32,13],[160],[33,15],[32,5],[32,13],[160],[33,16],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,20],[3,64],[32,5],[32,16],[99],[4,64],[32,15],[68,0,0,0,0,0,0,240,63],[161],[34,15],[252,2],[45,0,4],[183],[33,19],[32,5],[32,20],[97],[4,64],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,46],[58,0,4],[32,16],[68,0,0,0,0,0,0,240,63],[160],[33,16],[11],[32,19],[68,0,0,0,0,0,0,36,64],[99],[4,64],[32,19],[68,0,0,0,0,0,0,72,64],[160],[33,19],[5],[32,19],[68,0,0,0,0,0,192,85,64],[160],[33,19],[11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[32,19],[252,2],[58,0,4],[12,1],[11],[11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,229,0],[58,0,4],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,45],[58,0,4],[5],[68,0,0,0,0,0,0,240,191],[33,14],[3,64],[32,11],[68,0,0,0,0,0,0,240,63],[102],[4,64],[32,11],[68,0,0,0,0,0,0,36,64],[163],[33,11],[32,14],[68,0,0,0,0,0,0,240,63],[160],[33,14],[12,1],[11],[11],[32,2],[32,3],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,0,0],[98],[4,64],[3,64],[65,1],[4,64],[32,11],[68,0,0,0,0,0,0,36,64],[162],[34,11],[16, builtin('__Math_trunc')],[34,18],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,11],[32,18],[161],[68,187,189,215,217,223,124,219,61],[99],[4,64],[12,2],[11],[5],[32,14],[68,0,0,0,0,0,0,240,63],[160],[33,14],[11],[12,1],[11],[11],[5],[68,0,0,0,0,0,0,0,0],[33,17],[3,64],[32,17],[32,2],[101],[4,64],[32,11],[68,0,0,0,0,0,0,36,64],[162],[33,11],[32,17],[68,0,0,0,0,0,0,240,63],[160],[33,17],[12,1],[11],[11],[11],[32,11],[16, builtin('__Math_round')],[33,11],[3,64],[32,11],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,11],[68,0,0,0,0,0,0,36,64],[16, builtin('f64_%')],[33,19],[32,11],[68,0,0,0,0,0,0,36,64],[163],[16, builtin('__Math_trunc')],[33,11],[32,12],[32,13],[160],[252,2],[32,19],[252,2],[58,0,4],[32,13],[68,0,0,0,0,0,0,240,63],[160],[33,13],[12,1],[11],[11],[32,12],[32,13],[160],[33,15],[32,5],[32,13],[160],[33,16],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,20],[3,64],[32,5],[32,16],[99],[4,64],[32,5],[32,20],[97],[4,64],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,46],[58,0,4],[32,16],[68,0,0,0,0,0,0,240,63],[160],[33,16],[11],[32,15],[68,0,0,0,0,0,0,240,63],[161],[34,15],[252,2],[45,0,4],[183],[34,19],[68,0,0,0,0,0,0,36,64],[99],[4,64],[32,19],[68,0,0,0,0,0,0,72,64],[160],[33,19],[5],[32,19],[68,0,0,0,0,0,192,85,64],[160],[33,19],[11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[32,19],[252,2],[58,0,4],[12,1],[11],[11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,229,0],[58,0,4],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[65,43],[58,0,4],[11],[11],[32,14],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,12],[252,2],[65,0],[58,0,4],[68,0,0,0,0,0,0,240,63],[33,13],[5],[68,0,0,0,0,0,0,0,0],[33,13],[3,64],[32,14],[68,0,0,0,0,0,0,0,0],[100],[4,64],[32,12],[32,13],[160],[252,2],[32,14],[68,0,0,0,0,0,0,36,64],[16, builtin('f64_%')],[252,2],[58,0,4],[32,14],[68,0,0,0,0,0,0,36,64],[163],[16, builtin('__Math_trunc')],[33,14],[32,13],[68,0,0,0,0,0,0,240,63],[160],[33,13],[12,1],[11],[11],[11],[32,12],[32,13],[160],[33,15],[32,5],[32,13],[160],[33,16],[3,64],[32,5],[32,16],[99],[4,64],[32,15],[68,0,0,0,0,0,0,240,63],[161],[34,15],[252,2],[45,0,4],[183],[34,19],[68,0,0,0,0,0,0,36,64],[99],[4,64],[32,19],[68,0,0,0,0,0,0,72,64],[160],[33,19],[5],[32,19],[68,0,0,0,0,0,192,85,64],[160],[33,19],[11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[252,2],[32,19],[252,2],[58,0,4],[12,1],[11],[11],[32,4],[252,3],[32,5],[32,4],[161],[34,21],[252,3],[54,1,0],[32,4],[65,18],[15]],
|
1616
1636
|
params: [124,127,124,127],
|
1617
1637
|
typedParams: true,
|
1618
1638
|
returns: [124,127],
|
@@ -1640,7 +1660,7 @@ export const BuiltinFuncs = function() {
|
|
1640
1660
|
data: [{"bytes":[15,0,0,0,91,111,98,106,101,99,116,32,79,98,106,101,99,116,93],"offset":0}],
|
1641
1661
|
};
|
1642
1662
|
this.__Porffor_allocate = {
|
1643
|
-
wasm: (scope, {}) => [[
|
1663
|
+
wasm: (scope, {}) => [[65,1],[64,0],[65,128,128,4],[108],[184],[15]],
|
1644
1664
|
params: [],
|
1645
1665
|
typedParams: true,
|
1646
1666
|
returns: [124],
|
@@ -2072,6 +2092,24 @@ export const BuiltinFuncs = function() {
|
|
2072
2092
|
locals: [],
|
2073
2093
|
localNames: ["_this","_this#type"],
|
2074
2094
|
};
|
2095
|
+
this.String = {
|
2096
|
+
wasm: (scope, {builtin,}) => [[32,0],[32,1],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,24,64],[97],[4,64],[32,0],[32,1],[16, builtin('__Symbol_prototype_toString')],[26],[15],[11],[32,0],[32,1],[16, builtin('__ecma262_ToString')],[15]],
|
2097
|
+
params: [124,127],
|
2098
|
+
typedParams: true,
|
2099
|
+
returns: [124],
|
2100
|
+
returnType: 18,
|
2101
|
+
locals: [127],
|
2102
|
+
localNames: ["value","value#type","#last_type"],
|
2103
|
+
};
|
2104
|
+
this.String$constructor = {
|
2105
|
+
wasm: (scope, {builtin,}) => [[32,0],[32,1],[16, builtin('__ecma262_ToString')],[15]],
|
2106
|
+
params: [124,127],
|
2107
|
+
typedParams: true,
|
2108
|
+
returns: [124],
|
2109
|
+
returnType: 18,
|
2110
|
+
locals: [],
|
2111
|
+
localNames: ["value","value#type"],
|
2112
|
+
};
|
2075
2113
|
this.__Porffor_symbol_descStore = {
|
2076
2114
|
wasm: (scope, {allocPage,builtin,}) => [...number(allocPage(scope, 'bytestring: __Porffor_symbol_descStore/ptr', 'i8') * pageSize, 124),[33,4],[32,0],[252,3],[4,64],[32,4],[252,2],[40,0,0],[183],[33,5],[32,4],[252,2],[32,5],[68,0,0,0,0,0,0,240,63],[160],[252,2],[54,0,0],[32,4],[65,18],[32,5],[65,0],[32,2],[32,3],[16, builtin('__Porffor_set_write')],[26],[32,5],[65,0],[15],[5],[32,4],[65,18],[32,2],[32,3],[16, builtin('__Porffor_set_read')],[34,6],[15],[11],[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
2077
2115
|
params: [124,127,124,127],
|
@@ -2117,4 +2155,22 @@ export const BuiltinFuncs = function() {
|
|
2117
2155
|
locals: [],
|
2118
2156
|
localNames: ["_this","_this#type"],
|
2119
2157
|
};
|
2158
|
+
this.__ecma262_ToIntegerOrInfinity = {
|
2159
|
+
wasm: (scope, {builtin,}) => [[32,0],[16, builtin('Number')],[34,2],[16, builtin('__Number_isNaN')],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[15],[11],[32,2],[16, builtin('__Number_isFinite')],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,2],[15],[11],[32,2],[16, builtin('__Math_trunc')],[34,2],[68,0,0,0,0,0,0,0,0],[97],[4,64],[68,0,0,0,0,0,0,0,0],[15],[11],[32,2],[15]],
|
2160
|
+
params: [124,127],
|
2161
|
+
typedParams: true,
|
2162
|
+
returns: [124],
|
2163
|
+
returnType: 0,
|
2164
|
+
locals: [124],
|
2165
|
+
localNames: ["argument","argument#type","number"],
|
2166
|
+
};
|
2167
|
+
this.__ecma262_ToString = {
|
2168
|
+
wasm: (scope, {allocPage,builtin,internalThrow,}) => [...number(allocPage(scope, 'bytestring: __ecma262_ToString/out', 'i8') * pageSize, 124),[33,2],[32,0],[32,1],[16, builtin('__Porffor_rawType')],[34,3],[68,0,0,0,0,0,0,0,64],[97],[32,3],[68,0,0,0,0,0,0,50,64],[97],[114],[4,64],[32,0],[15],[11],[32,3],[68,0,0,0,0,0,0,24,64],[97],[4,64],...internalThrow(scope, 'TypeError', `Cannot convert a Symbol value to a string`),[11],[32,3],[68,0,0,0,0,0,0,8,64],[97],[4,64],[32,2],[252,3],[34,4],[65,9],[54,1,0],[32,4],[65,245,0],[58,0,4],[32,4],[65,238,0],[58,0,5],[32,4],[65,228,0],[58,0,6],[32,4],[65,229,0],[58,0,7],[32,4],[65,230,0],[58,0,8],[32,4],[65,233,0],[58,0,9],[32,4],[65,238,0],[58,0,10],[32,4],[65,229,0],[58,0,11],[32,4],[65,228,0],[58,0,12],[32,4],[184],[34,2],[15],[11],[32,3],[68,0,0,0,0,0,0,16,64],[97],[32,0],[68,0,0,0,0,0,0,0,0],[97],[113],[4,64],[32,2],[252,3],[34,4],[65,4],[54,1,0],[32,4],[65,238,0],[58,0,4],[32,4],[65,245,0],[58,0,5],[32,4],[65,236,0],[58,0,6],[32,4],[65,236,0],[58,0,7],[32,4],[184],[34,2],[15],[11],[32,3],[68,0,0,0,0,0,0,240,63],[97],[4,64],[32,0],[68,0,0,0,0,0,0,240,63],[97],[4,64],[32,2],[252,3],[34,4],[65,4],[54,1,0],[32,4],[65,244,0],[58,0,4],[32,4],[65,242,0],[58,0,5],[32,4],[65,245,0],[58,0,6],[32,4],[65,229,0],[58,0,7],[32,4],[184],[34,2],[15],[11],[32,2],[252,3],[34,4],[65,5],[54,1,0],[32,4],[65,230,0],[58,0,4],[32,4],[65,225,0],[58,0,5],[32,4],[65,236,0],[58,0,6],[32,4],[65,243,0],[58,0,7],[32,4],[65,229,0],[58,0,8],[32,4],[184],[34,2],[15],[11],[32,1],[33,6],[2,124],[32,6],[65,0],[70],[4,64,"TYPESWITCH|Number"],[32,0],[32,1],[68,0,0,0,0,0,0,0,0],[65,3],[16, builtin('__Number_prototype_toString')],[26],[12,1],[11],[32,6],[65,1],[70],[4,64,"TYPESWITCH|Boolean"],[32,0],[32,1],[16, builtin('__Boolean_prototype_toString')],[26],[12,1],[11],[32,6],[65,2],[70],[4,64,"TYPESWITCH|String"],[32,0],[252,2],[32,1],[16, builtin('__String_prototype_toString')],[26],[183],[12,1],[11],[32,6],[65,4],[70],[4,64,"TYPESWITCH|Object"],[32,0],[32,1],[16, builtin('__Object_prototype_toString')],[26],[12,1],[11],[32,6],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,0],[32,1],[16, builtin('__Function_prototype_toString')],[26],[12,1],[11],[32,6],[65,6],[70],[4,64,"TYPESWITCH|Symbol"],[32,0],[32,1],[16, builtin('__Symbol_prototype_toString')],[26],[12,1],[11],[32,6],[65,16],[70],[4,64,"TYPESWITCH|Array"],[32,0],[32,1],[16, builtin('__Array_prototype_toString')],[26],[12,1],[11],[32,6],[65,18],[70],[4,64,"TYPESWITCH|ByteString"],[32,0],[252,2],[32,1],[16, builtin('__ByteString_prototype_toString')],[26],[183],[12,1],[11],[32,6],[65,19],[70],[4,64,"TYPESWITCH|Date"],[32,0],[32,1],[16, builtin('__Date_prototype_toString')],[26],[12,1],[11],...internalThrow(scope, 'TypeError', `'toString' proto func tried to be called on a type without an impl`),[11,"TYPESWITCH_end"],[15]],
|
2169
|
+
params: [124,127],
|
2170
|
+
typedParams: true,
|
2171
|
+
returns: [124],
|
2172
|
+
returnType: 18,
|
2173
|
+
locals: [124,124,127,127,127],
|
2174
|
+
localNames: ["argument","argument#type","out","type","#makearray_pointer_tmp","#last_type","#typeswitch_tmp"],
|
2175
|
+
};
|
2120
2176
|
};
|
package/compiler/opt.js
CHANGED
@@ -250,7 +250,7 @@ export default (funcs, globals, pages, tags, exceptions) => {
|
|
250
250
|
}
|
251
251
|
|
252
252
|
// remove setting last type if it is never gotten
|
253
|
-
if (!f.gotLastType && inst[0] === Opcodes.local_set && inst[1] === lastType) {
|
253
|
+
if (!f.internal && !f.gotLastType && inst[0] === Opcodes.local_set && inst[1] === lastType) {
|
254
254
|
// replace this inst with drop
|
255
255
|
wasm.splice(i, 1, [ Opcodes.drop ]); // remove this and last inst
|
256
256
|
if (i > 0) i--;
|
package/package.json
CHANGED