porffor 0.2.0-b9abe0d → 0.2.0-c1ed50d
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 +2 -1
- package/compiler/builtins/date.ts +728 -3
- package/compiler/builtins.js +0 -13
- package/compiler/codegen.js +20 -19
- package/compiler/generated_builtins.js +259 -7
- package/compiler/index.js +2 -1
- package/compiler/precompile.js +1 -1
- package/compiler/wasmSpec.js +1 -0
- package/compiler/wrap.js +7 -4
- package/package.json +1 -1
- package/.vscode/launch.json +0 -18
- package/test262_changes_from_1afe9b87d2_to_04-09.md +0 -270
package/compiler/builtins.js
CHANGED
@@ -1058,19 +1058,6 @@ export const BuiltinFuncs = function() {
|
|
1058
1058
|
};
|
1059
1059
|
|
1060
1060
|
|
1061
|
-
// this.__Date_now = {
|
1062
|
-
// params: [],
|
1063
|
-
// locals: [],
|
1064
|
-
// returns: [ valtypeBinary ],
|
1065
|
-
// wasm: [
|
1066
|
-
// [ Opcodes.call, importedFuncs.timeOrigin ],
|
1067
|
-
// [ Opcodes.call, importedFuncs.time ],
|
1068
|
-
// [ Opcodes.f64_add ],
|
1069
|
-
// [ Opcodes.f64_trunc ]
|
1070
|
-
// ]
|
1071
|
-
// };
|
1072
|
-
|
1073
|
-
|
1074
1061
|
this.__Porffor_type = {
|
1075
1062
|
params: [ valtypeBinary, Valtype.i32 ],
|
1076
1063
|
typedParams: true,
|
package/compiler/codegen.js
CHANGED
@@ -210,7 +210,7 @@ const generate = (scope, decl, global = false, name = undefined, valueUnused = f
|
|
210
210
|
return int;
|
211
211
|
});
|
212
212
|
|
213
|
-
out.push([ ...inst, ...immediates ]);
|
213
|
+
out.push([ ...inst, ...immediates.flatMap(x => signedLEB128(x)) ]);
|
214
214
|
}
|
215
215
|
|
216
216
|
return out;
|
@@ -1472,7 +1472,7 @@ const countLeftover = wasm => {
|
|
1472
1472
|
if (depth === 0)
|
1473
1473
|
if ([Opcodes.throw, Opcodes.drop, Opcodes.local_set, Opcodes.global_set].includes(inst[0])) count--;
|
1474
1474
|
else if ([null, Opcodes.i32_eqz, Opcodes.i64_eqz, Opcodes.f64_ceil, Opcodes.f64_floor, Opcodes.f64_trunc, Opcodes.f64_nearest, Opcodes.f64_sqrt, Opcodes.local_tee, Opcodes.i32_wrap_i64, Opcodes.i64_extend_i32_s, Opcodes.i64_extend_i32_u, Opcodes.f32_demote_f64, Opcodes.f64_promote_f32, Opcodes.f64_convert_i32_s, Opcodes.f64_convert_i32_u, Opcodes.i32_clz, Opcodes.i32_ctz, Opcodes.i32_popcnt, Opcodes.f64_neg, Opcodes.end, Opcodes.i32_trunc_sat_f64_s[0], Opcodes.i32x4_extract_lane, Opcodes.i16x8_extract_lane, Opcodes.i32_load, Opcodes.i64_load, Opcodes.f64_load, Opcodes.v128_load, Opcodes.i32_load16_u, Opcodes.i32_load16_s, Opcodes.i32_load8_u, Opcodes.i32_load8_s, Opcodes.memory_grow].includes(inst[0]) && (inst[0] !== 0xfc || inst[1] < 0x0a)) {}
|
1475
|
-
else if ([Opcodes.local_get, Opcodes.global_get, Opcodes.f64_const, Opcodes.i32_const, Opcodes.i64_const, Opcodes.v128_const].includes(inst[0])) count++;
|
1475
|
+
else if ([Opcodes.local_get, Opcodes.global_get, Opcodes.f64_const, Opcodes.i32_const, Opcodes.i64_const, Opcodes.v128_const, Opcodes.memory_size].includes(inst[0])) count++;
|
1476
1476
|
else if ([Opcodes.i32_store, Opcodes.i64_store, Opcodes.f64_store, Opcodes.i32_store16, Opcodes.i32_store8].includes(inst[0])) count -= 2;
|
1477
1477
|
else if (Opcodes.memory_copy[0] === inst[0] && Opcodes.memory_copy[1] === inst[1]) count -= 3;
|
1478
1478
|
else if (inst[0] === Opcodes.return) count = 0;
|
@@ -1845,31 +1845,28 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
|
|
1845
1845
|
if (idx === undefined && name.startsWith('__Porffor_wasm_')) {
|
1846
1846
|
const wasmOps = {
|
1847
1847
|
// pointer, align, offset
|
1848
|
-
i32_load: { imms: 2, args:
|
1848
|
+
i32_load: { imms: 2, args: [ true ], returns: 1 },
|
1849
1849
|
// pointer, value, align, offset
|
1850
|
-
i32_store: { imms: 2, args:
|
1850
|
+
i32_store: { imms: 2, args: [ true, true ], returns: 0 },
|
1851
1851
|
// pointer, align, offset
|
1852
|
-
i32_load8_u: { imms: 2, args:
|
1852
|
+
i32_load8_u: { imms: 2, args: [ true ], returns: 1 },
|
1853
1853
|
// pointer, value, align, offset
|
1854
|
-
i32_store8: { imms: 2, args:
|
1854
|
+
i32_store8: { imms: 2, args: [ true, true ], returns: 0 },
|
1855
1855
|
// pointer, align, offset
|
1856
|
-
i32_load16_u: { imms: 2, args:
|
1856
|
+
i32_load16_u: { imms: 2, args: [ true ], returns: 1 },
|
1857
1857
|
// pointer, value, align, offset
|
1858
|
-
i32_store16: { imms: 2, args:
|
1858
|
+
i32_store16: { imms: 2, args: [ true, true ], returns: 0 },
|
1859
1859
|
|
1860
1860
|
// pointer, align, offset
|
1861
|
-
f64_load: { imms: 2, args:
|
1861
|
+
f64_load: { imms: 2, args: [ true ], returns: 0 }, // 0 due to not i32
|
1862
1862
|
// pointer, value, align, offset
|
1863
|
-
f64_store: { imms: 2, args:
|
1863
|
+
f64_store: { imms: 2, args: [ true, false ], returns: 0 },
|
1864
1864
|
|
1865
1865
|
// value
|
1866
|
-
i32_const: { imms: 1, args:
|
1866
|
+
i32_const: { imms: 1, args: [], returns: 1 },
|
1867
1867
|
|
1868
1868
|
// a, b
|
1869
|
-
i32_or: { imms: 0, args:
|
1870
|
-
|
1871
|
-
add: { imms: 0, args: 2, returns: 1 },
|
1872
|
-
i32_to_u: { imms: 0, args: 1, returns: 1 }
|
1869
|
+
i32_or: { imms: 0, args: [ true, true ], returns: 1 },
|
1873
1870
|
};
|
1874
1871
|
|
1875
1872
|
const opName = name.slice('__Porffor_wasm_'.length);
|
@@ -1878,13 +1875,13 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
|
|
1878
1875
|
const op = wasmOps[opName];
|
1879
1876
|
|
1880
1877
|
const argOut = [];
|
1881
|
-
for (let i = 0; i < op.args; i++) argOut.push(
|
1878
|
+
for (let i = 0; i < op.args.length; i++) argOut.push(
|
1882
1879
|
...generate(scope, decl.arguments[i]),
|
1883
|
-
Opcodes.i32_to
|
1880
|
+
...(op.args[i] ? [ Opcodes.i32_to ] : [])
|
1884
1881
|
);
|
1885
1882
|
|
1886
1883
|
// literals only
|
1887
|
-
const imms = decl.arguments.slice(op.args).map(x => x.value);
|
1884
|
+
const imms = decl.arguments.slice(op.args.length).map(x => x.value);
|
1888
1885
|
|
1889
1886
|
return [
|
1890
1887
|
...argOut,
|
@@ -2229,7 +2226,7 @@ const generateVar = (scope, decl) => {
|
|
2229
2226
|
}
|
2230
2227
|
|
2231
2228
|
const typed = typedInput && x.id.typeAnnotation;
|
2232
|
-
let idx = allocVar(scope, name, global, !typed);
|
2229
|
+
let idx = allocVar(scope, name, global, !(typed && extractTypeAnnotation(x.id).type != null));
|
2233
2230
|
|
2234
2231
|
if (typed) {
|
2235
2232
|
addVarMetadata(scope, name, global, extractTypeAnnotation(x.id));
|
@@ -3508,6 +3505,8 @@ const internalConstrs = {
|
|
3508
3505
|
);
|
3509
3506
|
}
|
3510
3507
|
|
3508
|
+
out.push(Opcodes.i32_from_u);
|
3509
|
+
|
3511
3510
|
return out;
|
3512
3511
|
},
|
3513
3512
|
type: TYPES.boolean,
|
@@ -3526,6 +3525,8 @@ const internalConstrs = {
|
|
3526
3525
|
);
|
3527
3526
|
}
|
3528
3527
|
|
3528
|
+
out.push(Opcodes.i32_from_u);
|
3529
|
+
|
3529
3530
|
return out;
|
3530
3531
|
},
|
3531
3532
|
type: TYPES.boolean,
|
@@ -317,17 +317,215 @@ export const BuiltinFuncs = function() {
|
|
317
317
|
localNames: ["bytes","bytesPtr","a","aEndPtr","output","i","j","endPtr","byte","lower","upper"],
|
318
318
|
data: [{"offset":0,"bytes":[16,0,0,0,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46]},{"offset":65536,"bytes":[36,0,0,0,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45]}],
|
319
319
|
};
|
320
|
-
this.
|
321
|
-
wasm: (scope, { allocPage, builtin }) => [[
|
322
|
-
params: [],
|
320
|
+
this.__ecma262_Day = {
|
321
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[68,0,0,0,0,112,153,148,65],[163],[16, builtin('__Math_floor')],[15]],
|
322
|
+
params: [124,127],
|
323
323
|
typedParams: true,
|
324
324
|
returns: [124],
|
325
325
|
returnType: 0,
|
326
326
|
locals: [],
|
327
|
-
localNames: [],
|
327
|
+
localNames: ["t","t#type"],
|
328
|
+
};
|
329
|
+
this.__ecma262_TimeWithinDay = {
|
330
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[68,0,0,0,0,112,153,148,65],[16, builtin('f64_%')],[15]],
|
331
|
+
params: [124,127],
|
332
|
+
typedParams: true,
|
333
|
+
returns: [124],
|
334
|
+
returnType: 0,
|
335
|
+
locals: [],
|
336
|
+
localNames: ["t","t#type"],
|
337
|
+
};
|
338
|
+
this.__ecma262_DaysInYear = {
|
339
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[68,0,0,0,0,0,0,121,64],[16, builtin('f64_%')],[68,0,0,0,0,0,0,0,0],[97],[4,64],[68,0,0,0,0,0,224,118,64],[15],[11],[32,0],[68,0,0,0,0,0,0,89,64],[16, builtin('f64_%')],[68,0,0,0,0,0,0,0,0],[97],[4,64],[68,0,0,0,0,0,208,118,64],[15],[11],[32,0],[68,0,0,0,0,0,0,16,64],[16, builtin('f64_%')],[68,0,0,0,0,0,0,0,0],[97],[4,64],[68,0,0,0,0,0,224,118,64],[15],[11],[68,0,0,0,0,0,208,118,64],[15]],
|
340
|
+
params: [124,127],
|
341
|
+
typedParams: true,
|
342
|
+
returns: [124],
|
343
|
+
returnType: 0,
|
344
|
+
locals: [],
|
345
|
+
localNames: ["y","y#type"],
|
346
|
+
};
|
347
|
+
this.__ecma262_DayFromYear = {
|
348
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[68,0,0,0,0,0,200,158,64],[161],[33,2],[32,0],[68,0,0,0,0,0,196,158,64],[161],[68,0,0,0,0,0,0,16,64],[163],[16, builtin('__Math_floor')],[33,3],[32,0],[68,0,0,0,0,0,180,157,64],[161],[68,0,0,0,0,0,0,89,64],[163],[16, builtin('__Math_floor')],[33,4],[32,0],[68,0,0,0,0,0,4,153,64],[161],[68,0,0,0,0,0,0,121,64],[163],[16, builtin('__Math_floor')],[33,5],[68,0,0,0,0,0,208,118,64],[32,2],[162],[32,3],[160],[32,4],[161],[32,5],[160],[15]],
|
349
|
+
params: [124,127],
|
350
|
+
typedParams: true,
|
351
|
+
returns: [124],
|
352
|
+
returnType: 0,
|
353
|
+
locals: [124,124,124,124],
|
354
|
+
localNames: ["y","y#type","numYears1","numYears4","numYears100","numYears400"],
|
355
|
+
};
|
356
|
+
this.__ecma262_TimeFromYear = {
|
357
|
+
wasm: (scope, { allocPage, builtin }) => [[68,0,0,0,0,112,153,148,65],[32,0],[65,0],[16, builtin('__ecma262_DayFromYear')],[162],[15]],
|
358
|
+
params: [124,127],
|
359
|
+
typedParams: true,
|
360
|
+
returns: [124],
|
361
|
+
returnType: 0,
|
362
|
+
locals: [],
|
363
|
+
localNames: ["y","y#type"],
|
364
|
+
};
|
365
|
+
this.__ecma262_YearFromTime = {
|
366
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[68,0,0,0,127,195,99,29,66],[163],[16, builtin('__Math_floor')],[68,0,0,0,0,0,200,158,64],[160],[34,2],[65,0],[16, builtin('__ecma262_TimeFromYear')],[34,3],[32,0],[100],[4,64],[32,2],[68,0,0,0,0,0,0,240,63],[161],[15],[11],[32,3],[32,2],[65,0],[16, builtin('__ecma262_DaysInYear')],[68,0,0,0,0,112,153,148,65],[162],[160],[32,0],[101],[4,64],[32,2],[68,0,0,0,0,0,0,240,63],[160],[15],[11],[32,2],[15]],
|
367
|
+
params: [124,127],
|
368
|
+
typedParams: true,
|
369
|
+
returns: [124],
|
370
|
+
returnType: 0,
|
371
|
+
locals: [124,124],
|
372
|
+
localNames: ["t","t#type","y","t2"],
|
373
|
+
};
|
374
|
+
this.__ecma262_DayWithinYear = {
|
375
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[65,0],[16, builtin('__ecma262_Day')],[32,0],[65,0],[16, builtin('__ecma262_YearFromTime')],[65,0],[16, builtin('__ecma262_DayFromYear')],[161],[15]],
|
376
|
+
params: [124,127],
|
377
|
+
typedParams: true,
|
378
|
+
returns: [124],
|
379
|
+
returnType: 0,
|
380
|
+
locals: [],
|
381
|
+
localNames: ["t","t#type"],
|
382
|
+
};
|
383
|
+
this.__ecma262_InLeapYear = {
|
384
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[65,0],[16, builtin('__ecma262_YearFromTime')],[65,0],[16, builtin('__ecma262_DaysInYear')],[68,0,0,0,0,0,224,118,64],[97],[4,124],[68,0,0,0,0,0,0,240,63],[5],[68,0,0,0,0,0,0,0,0],[11],[15]],
|
385
|
+
params: [124,127],
|
386
|
+
typedParams: true,
|
387
|
+
returns: [124],
|
388
|
+
returnType: 0,
|
389
|
+
locals: [127],
|
390
|
+
localNames: ["t","t#type","#last_type"],
|
391
|
+
};
|
392
|
+
this.__ecma262_MonthFromTime = {
|
393
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[65,0],[16, builtin('__ecma262_InLeapYear')],[33,2],[32,0],[65,0],[16, builtin('__ecma262_DayWithinYear')],[34,3],[68,0,0,0,0,0,0,63,64],[99],[4,64],[68,0,0,0,0,0,0,0,0],[15],[11],[32,3],[68,0,0,0,0,0,128,77,64],[32,2],[160],[99],[4,64],[68,0,0,0,0,0,0,240,63],[15],[11],[32,3],[68,0,0,0,0,0,128,86,64],[32,2],[160],[99],[4,64],[68,0,0,0,0,0,0,0,64],[15],[11],[32,3],[68,0,0,0,0,0,0,94,64],[32,2],[160],[99],[4,64],[68,0,0,0,0,0,0,8,64],[15],[11],[32,3],[68,0,0,0,0,0,224,98,64],[32,2],[160],[99],[4,64],[68,0,0,0,0,0,0,16,64],[15],[11],[32,3],[68,0,0,0,0,0,160,102,64],[32,2],[160],[99],[4,64],[68,0,0,0,0,0,0,20,64],[15],[11],[32,3],[68,0,0,0,0,0,128,106,64],[32,2],[160],[99],[4,64],[68,0,0,0,0,0,0,24,64],[15],[11],[32,3],[68,0,0,0,0,0,96,110,64],[32,2],[160],[99],[4,64],[68,0,0,0,0,0,0,28,64],[15],[11],[32,3],[68,0,0,0,0,0,16,113,64],[32,2],[160],[99],[4,64],[68,0,0,0,0,0,0,32,64],[15],[11],[32,3],[68,0,0,0,0,0,0,115,64],[32,2],[160],[99],[4,64],[68,0,0,0,0,0,0,34,64],[15],[11],[32,3],[68,0,0,0,0,0,224,116,64],[32,2],[160],[99],[4,64],[68,0,0,0,0,0,0,36,64],[15],[11],[68,0,0,0,0,0,0,38,64],[15]],
|
394
|
+
params: [124,127],
|
395
|
+
typedParams: true,
|
396
|
+
returns: [124],
|
397
|
+
returnType: 0,
|
398
|
+
locals: [124,124],
|
399
|
+
localNames: ["t","t#type","inLeapYear","dayWithinYear"],
|
400
|
+
};
|
401
|
+
this.__ecma262_DateFromTime = {
|
402
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[65,0],[16, builtin('__ecma262_InLeapYear')],[33,2],[32,0],[65,0],[16, builtin('__ecma262_DayWithinYear')],[33,3],[32,0],[65,0],[16, builtin('__ecma262_MonthFromTime')],[33,4],[65,0],[33,5],[32,4],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,3],[68,0,0,0,0,0,0,240,63],[160],[15],[11],[32,4],[68,0,0,0,0,0,0,240,63],[97],[4,64],[32,3],[68,0,0,0,0,0,0,62,64],[161],[15],[11],[32,4],[68,0,0,0,0,0,0,0,64],[97],[4,64],[32,3],[68,0,0,0,0,0,0,77,64],[161],[32,2],[161],[15],[11],[32,4],[68,0,0,0,0,0,0,8,64],[97],[4,64],[32,3],[68,0,0,0,0,0,64,86,64],[161],[32,2],[161],[15],[11],[32,4],[68,0,0,0,0,0,0,16,64],[97],[4,64],[32,3],[68,0,0,0,0,0,192,93,64],[161],[32,2],[161],[15],[11],[32,4],[68,0,0,0,0,0,0,20,64],[97],[4,64],[32,3],[68,0,0,0,0,0,192,98,64],[161],[32,2],[161],[15],[11],[32,4],[68,0,0,0,0,0,0,24,64],[97],[4,64],[32,3],[68,0,0,0,0,0,128,102,64],[161],[32,2],[161],[15],[11],[32,4],[68,0,0,0,0,0,0,28,64],[97],[4,64],[32,3],[68,0,0,0,0,0,96,106,64],[161],[32,2],[161],[15],[11],[32,4],[68,0,0,0,0,0,0,32,64],[97],[4,64],[32,3],[68,0,0,0,0,0,64,110,64],[161],[32,2],[161],[15],[11],[32,4],[68,0,0,0,0,0,0,34,64],[97],[4,64],[32,3],[68,0,0,0,0,0,0,113,64],[161],[32,2],[161],[15],[11],[32,4],[68,0,0,0,0,0,0,36,64],[97],[4,64],[32,3],[68,0,0,0,0,0,240,114,64],[161],[32,2],[161],[15],[11],[32,3],[68,0,0,0,0,0,208,116,64],[161],[32,2],[161],[15]],
|
403
|
+
params: [124,127],
|
404
|
+
typedParams: true,
|
405
|
+
returns: [124],
|
406
|
+
returnType: 0,
|
407
|
+
locals: [124,124,124,127],
|
408
|
+
localNames: ["t","t#type","inLeapYear","dayWithinYear","month","month#type"],
|
409
|
+
};
|
410
|
+
this.__ecma262_WeekDay = {
|
411
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[65,0],[16, builtin('__ecma262_Day')],[68,0,0,0,0,0,0,16,64],[160],[68,0,0,0,0,0,0,28,64],[16, builtin('f64_%')],[15]],
|
412
|
+
params: [124,127],
|
413
|
+
typedParams: true,
|
414
|
+
returns: [124],
|
415
|
+
returnType: 0,
|
416
|
+
locals: [],
|
417
|
+
localNames: ["t","t#type"],
|
418
|
+
};
|
419
|
+
this.__ecma262_HourFromTime = {
|
420
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[68,0,0,0,0,64,119,75,65],[163],[16, builtin('__Math_floor')],[68,0,0,0,0,0,0,56,64],[16, builtin('f64_%')],[15]],
|
421
|
+
params: [124,127],
|
422
|
+
typedParams: true,
|
423
|
+
returns: [124],
|
424
|
+
returnType: 0,
|
425
|
+
locals: [],
|
426
|
+
localNames: ["t","t#type"],
|
427
|
+
};
|
428
|
+
this.__ecma262_MinFromTime = {
|
429
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[68,0,0,0,0,0,76,237,64],[163],[16, builtin('__Math_floor')],[68,0,0,0,0,0,0,78,64],[16, builtin('f64_%')],[15]],
|
430
|
+
params: [124,127],
|
431
|
+
typedParams: true,
|
432
|
+
returns: [124],
|
433
|
+
returnType: 0,
|
434
|
+
locals: [],
|
435
|
+
localNames: ["t","t#type"],
|
436
|
+
};
|
437
|
+
this.__ecma262_SecFromTime = {
|
438
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[68,0,0,0,0,0,64,143,64],[163],[16, builtin('__Math_floor')],[68,0,0,0,0,0,0,78,64],[16, builtin('f64_%')],[15]],
|
439
|
+
params: [124,127],
|
440
|
+
typedParams: true,
|
441
|
+
returns: [124],
|
442
|
+
returnType: 0,
|
443
|
+
locals: [],
|
444
|
+
localNames: ["t","t#type"],
|
445
|
+
};
|
446
|
+
this.__ecma262_msFromTime = {
|
447
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[68,0,0,0,0,0,64,143,64],[16, builtin('f64_%')],[15]],
|
448
|
+
params: [124,127],
|
449
|
+
typedParams: true,
|
450
|
+
returns: [124],
|
451
|
+
returnType: 0,
|
452
|
+
locals: [],
|
453
|
+
localNames: ["t","t#type"],
|
454
|
+
};
|
455
|
+
this.__ecma262_LocalTime = {
|
456
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[15]],
|
457
|
+
params: [124,127],
|
458
|
+
typedParams: true,
|
459
|
+
returns: [124],
|
460
|
+
returnType: 0,
|
461
|
+
locals: [],
|
462
|
+
localNames: ["t","t#type"],
|
463
|
+
};
|
464
|
+
this.__ecma262_UTC = {
|
465
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[16, builtin('__Number_isFinite')],[68,0,0,0,0,0,0,0,0],[97],[4,64],[68,0,0,0,0,0,0,248,127],[15],[11],[32,0],[15]],
|
466
|
+
params: [124,127],
|
467
|
+
typedParams: true,
|
468
|
+
returns: [124],
|
469
|
+
returnType: 0,
|
470
|
+
locals: [],
|
471
|
+
localNames: ["t","t#type"],
|
472
|
+
};
|
473
|
+
this.__ecma262_ToIntegerOrInfinity = {
|
474
|
+
wasm: (scope, { allocPage, 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('__Math_trunc')],[15]],
|
475
|
+
params: [124,127],
|
476
|
+
typedParams: true,
|
477
|
+
returns: [124],
|
478
|
+
returnType: 0,
|
479
|
+
locals: [124],
|
480
|
+
localNames: ["argument","argument#type","number"],
|
481
|
+
};
|
482
|
+
this.__ecma262_MakeTime = {
|
483
|
+
wasm: (scope, { allocPage, 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]],
|
484
|
+
params: [124,127,124,127,124,127,124,127],
|
485
|
+
typedParams: true,
|
486
|
+
returns: [124],
|
487
|
+
returnType: 0,
|
488
|
+
locals: [124,124,124,124],
|
489
|
+
localNames: ["hour","hour#type","min","min#type","sec","sec#type","ms","ms#type","h","m","s","milli"],
|
490
|
+
};
|
491
|
+
this.__ecma262_MakeDay = {
|
492
|
+
wasm: (scope, { allocPage, 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],[4,64],[68,0,0,0,0,0,0,248,127],[15],[11],[32,0],[65,0],[16, builtin('__ecma262_ToIntegerOrInfinity')],[33,6],[32,2],[65,0],[16, builtin('__ecma262_ToIntegerOrInfinity')],[33,7],[32,4],[65,0],[16, builtin('__ecma262_ToIntegerOrInfinity')],[33,8],[32,6],[32,7],[68,0,0,0,0,0,0,40,64],[163],[16, builtin('__Math_floor')],[160],[34,9],[16, builtin('__Number_isFinite')],[68,0,0,0,0,0,0,0,0],[97],[4,64],[68,0,0,0,0,0,0,248,127],[15],[11],[32,7],[68,0,0,0,0,0,0,40,64],[16, builtin('f64_%')],[34,10],[68,0,0,0,0,0,0,240,63],[101],[4,64],[32,9],[68,0,0,0,0,0,0,240,63],[161],[33,9],[11],[32,9],[68,0,0,0,0,0,0,0,0],[102],[4,124],[32,9],[65,0],[33,12],[5],[32,9],[68,0,0,0,0,0,240,120,64],[161],[65,0],[33,12],[11],[68,0,0,0,0,0,0,121,64],[163],[16, builtin('__Math_trunc')],[33,11],[32,9],[32,11],[68,0,0,0,0,0,0,121,64],[162],[161],[33,13],[68,0,0,0,0,0,32,99,64],[32,10],[32,10],[68,0,0,0,0,0,0,240,63],[100],[4,124],[68,0,0,0,0,0,0,0,192],[65,0],[33,12],[5],[68,0,0,0,0,0,0,36,64],[65,0],[33,12],[11],[160],[162],[68,0,0,0,0,0,0,0,64],[160],[68,0,0,0,0,0,0,20,64],[163],[16, builtin('__Math_trunc')],[33,14],[32,13],[68,0,0,0,0,0,208,118,64],[162],[32,13],[68,0,0,0,0,0,0,16,64],[163],[16, builtin('__Math_trunc')],[160],[32,13],[68,0,0,0,0,0,0,89,64],[163],[16, builtin('__Math_trunc')],[161],[32,14],[160],[33,15],[32,11],[68,0,0,0,0,136,213,1,65],[162],[32,15],[160],[68,0,0,0,0,216,244,37,65],[161],[34,16],[32,8],[160],[68,0,0,0,0,0,0,240,63],[161],[15]],
|
493
|
+
params: [124,127,124,127,124,127],
|
494
|
+
typedParams: true,
|
495
|
+
returns: [124],
|
496
|
+
returnType: 0,
|
497
|
+
locals: [124,124,124,124,124,124,127,124,124,124,124],
|
498
|
+
localNames: ["year","year#type","month","month#type","date","date#type","y","m","dt","ym","mn","era","#last_type","yoe","doy","doe","day"],
|
499
|
+
};
|
500
|
+
this.__ecma262_MakeDate = {
|
501
|
+
wasm: (scope, { allocPage, 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],[4,64],[68,0,0,0,0,0,0,248,127],[15],[11],[32,0],[68,0,0,0,0,112,153,148,65],[162],[32,2],[160],[34,4],[16, builtin('__Number_isFinite')],[68,0,0,0,0,0,0,0,0],[97],[4,64],[68,0,0,0,0,0,0,248,127],[15],[11],[32,4],[15]],
|
502
|
+
params: [124,127,124,127],
|
503
|
+
typedParams: true,
|
504
|
+
returns: [124],
|
505
|
+
returnType: 0,
|
506
|
+
locals: [124],
|
507
|
+
localNames: ["day","day#type","time","time#type","tv"],
|
508
|
+
};
|
509
|
+
this.__ecma262_MakeFullYear = {
|
510
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[16, builtin('__Number_isNaN')],[252,3],[4,64],[68,0,0,0,0,0,0,248,127],[15],[11],[32,0],[65,0],[16, builtin('__ecma262_ToIntegerOrInfinity')],[34,2],[68,0,0,0,0,0,0,0,0],[102],[34,3],[4,127],[32,2],[68,0,0,0,0,0,192,88,64],[101],[65,1],[33,4],[5],[32,3],[65,1],[33,4],[11],[4,64],[68,0,0,0,0,0,176,157,64],[32,2],[160],[15],[11],[32,2],[15]],
|
511
|
+
params: [124,127],
|
512
|
+
typedParams: true,
|
513
|
+
returns: [124],
|
514
|
+
returnType: 0,
|
515
|
+
locals: [124,127,127],
|
516
|
+
localNames: ["year","year#type","truncated","logictmpi","#last_type"],
|
517
|
+
};
|
518
|
+
this.__ecma262_TimeClip = {
|
519
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[16, builtin('__Number_isFinite')],[68,0,0,0,0,0,0,0,0],[97],[4,64],[68,0,0,0,0,0,0,248,127],[15],[11],[32,0],[16, builtin('__Math_abs')],[68,0,0,220,194,8,178,62,67],[100],[4,64],[68,0,0,0,0,0,0,248,127],[15],[11],[32,0],[65,0],[16, builtin('__ecma262_ToIntegerOrInfinity')],[15]],
|
520
|
+
params: [124,127],
|
521
|
+
typedParams: true,
|
522
|
+
returns: [124],
|
523
|
+
returnType: 0,
|
524
|
+
locals: [],
|
525
|
+
localNames: ["time","time#type"],
|
328
526
|
};
|
329
527
|
this.Date = {
|
330
|
-
wasm: (scope, { allocPage, builtin }) => [[68,0,0,0,0,0,0,0,0],[
|
528
|
+
wasm: (scope, { allocPage, builtin }) => [[68,0,0,0,0,0,0,0,0],[15]],
|
331
529
|
params: [],
|
332
530
|
typedParams: true,
|
333
531
|
returns: [124],
|
@@ -335,15 +533,69 @@ export const BuiltinFuncs = function() {
|
|
335
533
|
locals: [],
|
336
534
|
localNames: [],
|
337
535
|
};
|
338
|
-
this.
|
339
|
-
wasm: (scope, { allocPage, builtin }) => [
|
536
|
+
this.__Porffor_date_allocate = {
|
537
|
+
wasm: (scope, { allocPage, builtin }) => [...number(allocPage(scope, '__Porffor_date_allocate | bytestring: 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],[26],[63,0],[65,1],[107],[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]],
|
340
538
|
params: [],
|
341
539
|
typedParams: true,
|
342
540
|
returns: [124],
|
343
541
|
returnType: 19,
|
542
|
+
locals: [124,124,124],
|
543
|
+
localNames: ["hack","__length_setter_tmp","ptr"],
|
544
|
+
};
|
545
|
+
this.__Porffor_date_read = {
|
546
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[252,2],[43,0,0],[15]],
|
547
|
+
params: [124,127],
|
548
|
+
typedParams: true,
|
549
|
+
returns: [124],
|
550
|
+
returnType: 0,
|
551
|
+
locals: [],
|
552
|
+
localNames: ["ptr","ptr#type"],
|
553
|
+
};
|
554
|
+
this.__Porffor_date_write = {
|
555
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[252,2],[32,2],[57,0,0],[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
556
|
+
params: [124,127,124,127],
|
557
|
+
typedParams: true,
|
558
|
+
returns: [124,127],
|
559
|
+
typedReturns: true,
|
560
|
+
locals: [],
|
561
|
+
localNames: ["ptr","ptr#type","val","val#type"],
|
562
|
+
};
|
563
|
+
this.Date$constructor = {
|
564
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[32,1],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[32,2],[32,3],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[32,4],[32,5],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[32,6],[32,7],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[32,8],[32,9],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[32,10],[32,11],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[32,12],[32,13],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[33,14],[68,0,0,0,0,0,0,0,0],[33,15],[32,14],[68,0,0,0,0,0,0,0,0],[97],[4,64],[16, builtin('__Date_now')],[33,15],[5],[32,14],[68,0,0,0,0,0,0,240,63],[97],[4,64],[32,0],[33,16],[32,1],[33,17],[32,0],[32,1],[16, builtin('__Porffor_rawType')],[33,18],[68,0,0,0,0,0,0,0,0],[33,19],[32,18],[68,0,0,0,0,0,0,51,64],[97],[4,64],[32,16],[32,17],[16, builtin('__Porffor_date_read')],[33,19],[5],[32,18],[68,0,0,0,0,0,0,0,64],[97],[34,20],[69],[4,127],[32,18],[68,0,0,0,0,0,0,50,64],[97],[65,1],[33,21],[5],[32,20],[65,1],[33,21],[11],[4,64],[5],[32,16],[16, builtin('Number')],[33,19],[11],[11],[32,19],[65,0],[16, builtin('__ecma262_TimeClip')],[33,15],[5],[32,0],[16, builtin('Number')],[33,22],[32,2],[16, builtin('Number')],[33,23],[68,0,0,0,0,0,0,240,63],[33,24],[32,14],[68,0,0,0,0,0,0,0,64],[100],[4,64],[32,4],[16, builtin('Number')],[33,24],[11],[68,0,0,0,0,0,0,0,0],[33,25],[32,14],[68,0,0,0,0,0,0,8,64],[100],[4,64],[32,6],[16, builtin('Number')],[33,25],[11],[68,0,0,0,0,0,0,0,0],[33,26],[32,14],[68,0,0,0,0,0,0,16,64],[100],[4,64],[32,8],[16, builtin('Number')],[33,26],[11],[68,0,0,0,0,0,0,0,0],[33,27],[32,14],[68,0,0,0,0,0,0,20,64],[100],[4,64],[32,10],[16, builtin('Number')],[33,27],[11],[68,0,0,0,0,0,0,0,0],[33,28],[32,14],[68,0,0,0,0,0,0,24,64],[100],[4,64],[32,12],[16, builtin('Number')],[33,28],[11],[32,22],[65,0],[16, builtin('__ecma262_MakeFullYear')],[34,29],[65,0],[32,23],[65,0],[32,24],[65,0],[16, builtin('__ecma262_MakeDay')],[65,0],[32,25],[65,0],[32,26],[65,0],[32,27],[65,0],[32,28],[65,0],[16, builtin('__ecma262_MakeTime')],[65,0],[16, builtin('__ecma262_MakeDate')],[34,30],[65,0],[16, builtin('__ecma262_UTC')],[65,0],[16, builtin('__ecma262_TimeClip')],[33,15],[11],[11],[16, builtin('__Porffor_date_allocate')],[34,31],[65,19],[32,15],[65,0],[16, builtin('__Porffor_date_write')],[33,21],[26],[32,31],[15]],
|
565
|
+
params: [124,127,124,127,124,127,124,127,124,127,124,127,124,127],
|
566
|
+
typedParams: true,
|
567
|
+
returns: [124],
|
568
|
+
returnType: 19,
|
569
|
+
locals: [124,124,124,127,124,124,127,127,124,124,124,124,124,124,124,124,124,124],
|
570
|
+
localNames: ["v0","v0#type","v1","v1#type","v2","v2#type","v3","v3#type","v4","v4#type","v5","v5#type","v6","v6#type","numberOfArgs","dv","value","value#type","valueType","tv","logictmpi","#last_type","y","m","dt","h","min","s","milli","yr","finalDate","O"],
|
571
|
+
};
|
572
|
+
this.__Date_now = {
|
573
|
+
wasm: (scope, { allocPage, builtin }) => [[16,3],[16, builtin('__performance_now')],[160],[16, builtin('__Math_trunc')],[15]],
|
574
|
+
params: [],
|
575
|
+
typedParams: true,
|
576
|
+
returns: [124],
|
577
|
+
returnType: 0,
|
344
578
|
locals: [],
|
345
579
|
localNames: [],
|
346
580
|
};
|
581
|
+
this.__Date_UTC = {
|
582
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[16, builtin('Number')],[33,14],[68,0,0,0,0,0,0,0,0],[33,15],[32,2],[32,3],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[4,64],[32,2],[16, builtin('Number')],[33,15],[11],[68,0,0,0,0,0,0,240,63],[33,16],[32,4],[32,5],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[4,64],[32,4],[16, builtin('Number')],[33,16],[11],[68,0,0,0,0,0,0,0,0],[33,17],[32,6],[32,7],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[4,64],[32,6],[16, builtin('Number')],[33,17],[11],[68,0,0,0,0,0,0,0,0],[33,18],[32,8],[32,9],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[4,64],[32,8],[16, builtin('Number')],[33,18],[11],[68,0,0,0,0,0,0,0,0],[33,19],[32,10],[32,11],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[4,64],[32,10],[16, builtin('Number')],[33,19],[11],[68,0,0,0,0,0,0,0,0],[33,20],[32,12],[32,13],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[4,64],[32,12],[16, builtin('Number')],[33,17],[11],[32,14],[65,0],[16, builtin('__ecma262_MakeFullYear')],[34,21],[65,0],[32,15],[65,0],[32,16],[65,0],[16, builtin('__ecma262_MakeDay')],[65,0],[32,17],[65,0],[32,18],[65,0],[32,19],[65,0],[32,20],[65,0],[16, builtin('__ecma262_MakeTime')],[65,0],[16, builtin('__ecma262_MakeDate')],[65,0],[16, builtin('__ecma262_TimeClip')],[15]],
|
583
|
+
params: [124,127,124,127,124,127,124,127,124,127,124,127,124,127],
|
584
|
+
typedParams: true,
|
585
|
+
returns: [124],
|
586
|
+
returnType: 0,
|
587
|
+
locals: [124,124,124,124,124,124,124,124],
|
588
|
+
localNames: ["year","year#type","month","month#type","date","date#type","hours","hours#type","minutes","minutes#type","seconds","seconds#type","ms","ms#type","y","m","dt","h","min","s","milli","yr"],
|
589
|
+
};
|
590
|
+
this.___date_prototype_getDate = {
|
591
|
+
wasm: (scope, { allocPage, builtin }) => [[32,0],[65,19],[16, builtin('__Porffor_date_read')],[34,2],[16, builtin('__Number_isNaN')],[252,3],[4,64],[68,0,0,0,0,0,0,248,127],[65,0],[15],[11],[32,2],[65,0],[16, builtin('__ecma262_LocalTime')],[65,0],[16, builtin('__ecma262_DateFromTime')],[65,0],[15]],
|
592
|
+
params: [124,127],
|
593
|
+
typedParams: true,
|
594
|
+
returns: [124,127],
|
595
|
+
typedReturns: true,
|
596
|
+
locals: [124],
|
597
|
+
localNames: ["_this","_this#type","t"],
|
598
|
+
};
|
347
599
|
this.escape = {
|
348
600
|
wasm: (scope, { allocPage, builtin }) => [...number(allocPage(scope, 'escape | bytestring: lut', 'i8') * pageSize, 127),[33,2],[32,0],[40,1,0],[34,3],[33,4],[32,0],[33,5],[32,1],[65,18],[70],[4,64],[32,5],[32,3],[106],[33,6],[3,64],[32,5],[32,6],[72],[4,64],[32,5],[32,5],[65,1],[106],[33,5],[45,0,4],[34,7],[65,128,1],[72],[4,64],[32,2],[32,7],[106],[45,0,4],[4,64],[12,3],[11],[11],[32,4],[65,2],[106],[33,4],[12,1],[11],[11],[32,4],[32,3],[70],[4,64],[32,0],[15],[11],...number(allocPage(scope, 'escape | bytestring: output', 'i8') * pageSize, 127),[34,8],[32,4],[34,9],[54,1,0],[32,0],[33,5],[32,8],[33,10],[3,64],[32,5],[32,6],[72],[4,64],[32,5],[32,5],[65,1],[106],[33,5],[45,0,4],[34,7],[65,128,1],[72],[4,64],[32,2],[32,7],[106],[45,0,4],[4,64],[32,10],[32,10],[65,1],[106],[33,10],[32,7],[58,0,4],[12,3],[11],[11],[32,10],[32,10],[65,1],[106],[33,10],[65,37],[58,0,4],[32,7],[65,15],[113],[65,48],[106],[34,11],[65,57],[74],[4,64],[32,11],[65,7],[106],[33,11],[11],[32,7],[65,4],[117],[65,48],[106],[34,12],[65,57],[74],[4,64],[32,12],[65,7],[106],[33,12],[11],[32,10],[32,10],[65,1],[106],[33,10],[32,12],[58,0,4],[32,10],[32,10],[65,1],[106],[33,10],[32,11],[58,0,4],[12,1],[11],[11],[32,8],[15],[11],[32,5],[32,3],[65,2],[108],[106],[33,6],[3,64],[32,5],[32,6],[72],[4,64],[32,5],[47,0,4],[33,7],[32,5],[65,2],[106],[33,5],[32,7],[65,128,1],[72],[4,64],[32,2],[32,7],[106],[45,0,4],[4,64],[12,3],[11],[11],[32,7],[65,128,2],[72],[4,64],[32,4],[65,2],[106],[33,4],[5],[32,4],[65,5],[106],[33,4],[11],[12,1],[11],[11],[32,4],[32,3],[70],[4,64],[32,0],[15],[11],[65,0],[65,0],[54,1,128,128,4],[65,128,128,4],[34,8],[32,4],[34,9],[54,1,0],[32,0],[33,5],[32,8],[33,10],[3,64],[32,5],[32,6],[72],[4,64],[32,5],[47,0,4],[33,7],[32,5],[65,2],[106],[33,5],[32,7],[65,128,1],[72],[4,64],[32,2],[32,7],[106],[45,0,4],[4,64],[32,10],[32,10],[65,1],[106],[33,10],[32,7],[58,0,4],[12,3],[11],[11],[32,7],[65,128,2],[72],[4,64],[32,10],[32,10],[65,1],[106],[33,10],[65,37],[58,0,4],[32,7],[65,15],[113],[65,48],[106],[34,11],[65,57],[74],[4,64],[32,11],[65,7],[106],[33,11],[11],[32,7],[65,4],[117],[65,48],[106],[34,12],[65,57],[74],[4,64],[32,12],[65,7],[106],[33,12],[11],[32,10],[32,10],[65,1],[106],[33,10],[32,12],[58,0,4],[32,10],[32,10],[65,1],[106],[33,10],[32,11],[58,0,4],[5],[32,10],[65,165,234,1],[59,0,4],[32,10],[65,2],[106],[33,10],[32,7],[65,12],[117],[65,15],[113],[65,48],[106],[34,13],[65,57],[74],[4,64],[32,13],[65,7],[106],[33,13],[11],[32,10],[32,10],[65,1],[106],[33,10],[32,13],[58,0,4],[32,7],[65,8],[117],[65,15],[113],[65,48],[106],[34,13],[65,57],[74],[4,64],[32,13],[65,7],[106],[33,13],[11],[32,10],[32,10],[65,1],[106],[33,10],[32,13],[58,0,4],[32,7],[65,4],[117],[65,15],[113],[65,48],[106],[34,13],[65,57],[74],[4,64],[32,13],[65,7],[106],[33,13],[11],[32,10],[32,10],[65,1],[106],[33,10],[32,13],[58,0,4],[32,7],[65,15],[113],[65,48],[106],[34,13],[65,57],[74],[4,64],[32,13],[65,7],[106],[33,13],[11],[32,10],[32,10],[65,1],[106],[33,10],[32,13],[58,0,4],[11],[12,1],[11],[11],[32,8],[15]],
|
349
601
|
params: [127,127],
|
package/compiler/index.js
CHANGED
@@ -14,7 +14,8 @@ const logFuncs = (funcs, globals, exceptions) => {
|
|
14
14
|
|
15
15
|
const startIndex = funcs.sort((a, b) => a.index - b.index)[0].index;
|
16
16
|
for (const f of funcs) {
|
17
|
-
console.log(`${underline(f.name)} (${f.index - startIndex})`);
|
17
|
+
// console.log(`${underline(f.name)} (${f.index - startIndex})`);
|
18
|
+
console.log(`${underline(f.name)} (${f.index})`);
|
18
19
|
|
19
20
|
console.log(`params: ${f.params.map((_, i) => Object.keys(f.locals)[Object.values(f.locals).indexOf(Object.values(f.locals).find(x => x.idx === i))]).join(', ')}`);
|
20
21
|
console.log(`returns: ${f.returns.length > 0 ? true : false}`);
|
package/compiler/precompile.js
CHANGED
@@ -38,7 +38,7 @@ const compile = async (file, [ _funcs, _globals ]) => {
|
|
38
38
|
|
39
39
|
const allocated = new Set();
|
40
40
|
|
41
|
-
const exports = funcs.filter(x => x.export);
|
41
|
+
const exports = funcs.filter(x => x.export && x.name !== 'main');
|
42
42
|
for (const x of exports) {
|
43
43
|
if (x.data) {
|
44
44
|
x.data = x.data.map(x => data[x]);
|
package/compiler/wasmSpec.js
CHANGED
package/compiler/wrap.js
CHANGED
@@ -163,7 +163,7 @@ export default async (source, flags = [ 'module' ], customImports = {}, print =
|
|
163
163
|
|
164
164
|
case TYPES.string: {
|
165
165
|
const pointer = ret;
|
166
|
-
const length = new Int32Array(memory.buffer, pointer, 1);
|
166
|
+
const length = (new Int32Array(memory.buffer, pointer, 1))[0];
|
167
167
|
|
168
168
|
return Array.from(new Uint16Array(memory.buffer, pointer + 4, length)).map(x => String.fromCharCode(x)).join('');
|
169
169
|
}
|
@@ -180,7 +180,7 @@ export default async (source, flags = [ 'module' ], customImports = {}, print =
|
|
180
180
|
|
181
181
|
case TYPES._array: {
|
182
182
|
const pointer = ret;
|
183
|
-
const length = new Int32Array(memory.buffer, pointer, 1);
|
183
|
+
const length = (new Int32Array(memory.buffer, pointer, 1))[0];
|
184
184
|
|
185
185
|
// have to slice because of memory alignment
|
186
186
|
const buf = memory.buffer.slice(pointer + 4, pointer + 4 + 8 * length);
|
@@ -190,13 +190,16 @@ export default async (source, flags = [ 'module' ], customImports = {}, print =
|
|
190
190
|
|
191
191
|
case TYPES._bytestring: {
|
192
192
|
const pointer = ret;
|
193
|
-
const length = new Int32Array(memory.buffer, pointer, 1);
|
193
|
+
const length = (new Int32Array(memory.buffer, pointer, 1))[0];
|
194
194
|
|
195
195
|
return Array.from(new Uint8Array(memory.buffer, pointer + 4, length)).map(x => String.fromCharCode(x)).join('');
|
196
196
|
}
|
197
197
|
|
198
198
|
case TYPES._date: {
|
199
|
-
|
199
|
+
const pointer = ret;
|
200
|
+
const value = (new Float64Array(memory.buffer, pointer, 1))[0];
|
201
|
+
|
202
|
+
return new Date(value);
|
200
203
|
}
|
201
204
|
|
202
205
|
default: return ret;
|
package/package.json
CHANGED
package/.vscode/launch.json
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
{
|
2
|
-
// Use IntelliSense to learn about possible attributes.
|
3
|
-
// Hover to view descriptions of existing attributes.
|
4
|
-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
5
|
-
"version": "0.2.0",
|
6
|
-
"configurations": [
|
7
|
-
{
|
8
|
-
"type": "node",
|
9
|
-
"request": "launch",
|
10
|
-
"name": "Launch Program",
|
11
|
-
"skipFiles": [
|
12
|
-
"<node_internals>/**"
|
13
|
-
],
|
14
|
-
"program": "${workspaceFolder}/runner/index.js",
|
15
|
-
"args": ["bench/bf.js", "-no-run"]
|
16
|
-
}
|
17
|
-
]
|
18
|
-
}
|