porffor 0.55.3 → 0.55.4

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/.fails.cjs CHANGED
@@ -1,14 +1,20 @@
1
1
  const all = require('./all.json').map(x => x.slice(21));
2
2
  const { passes } = require('./test262/results.json');
3
3
  const fails = all.filter(x => !passes.includes(x));
4
+ {
5
+ const dirs = Object.groupBy(fails, x => x.split('/').slice(0, 2).join('/'));
6
+ const top = Object.keys(dirs).sort((a, b) => dirs[b].length - dirs[a].length);
7
+ console.log(top.slice(0, 20).map(x => `${x}: ${dirs[x].length} (${((dirs[x].length / all.length) * 100).toFixed(2)}%)`).join('\n'));
8
+ }
9
+ console.log()
4
10
  {
5
11
  const dirs = Object.groupBy(fails, x => x.split('/').slice(0, 3).join('/'));
6
12
  const top = Object.keys(dirs).sort((a, b) => dirs[b].length - dirs[a].length);
7
- console.log(top.slice(0, 40).map(x => `${x}: ${dirs[x].length} (${((dirs[x].length / all.length) * 100).toFixed(2)}%)`).join('\n'));
13
+ console.log(top.slice(0, 20).map(x => `${x}: ${dirs[x].length} (${((dirs[x].length / all.length) * 100).toFixed(2)}%)`).join('\n'));
8
14
  }
9
15
  console.log()
10
16
  {
11
17
  const dirs = Object.groupBy(fails, x => x.split('/').slice(0, 4).join('/'));
12
18
  const top = Object.keys(dirs).sort((a, b) => dirs[b].length - dirs[a].length);
13
- console.log(top.slice(0, 40).map(x => `${x}: ${dirs[x].length} (${((dirs[x].length / all.length) * 100).toFixed(2)}%)`).join('\n'));
19
+ console.log(top.slice(0, 20).map(x => `${x}: ${dirs[x].length} (${((dirs[x].length / all.length) * 100).toFixed(2)}%)`).join('\n'));
14
20
  }
@@ -474,9 +474,8 @@ const lookup = (scope, name, failEarly = false) => {
474
474
 
475
475
  // no local var with name
476
476
  if (Object.hasOwn(globals, name)) return [ [ Opcodes.global_get, globals[name].idx ] ];
477
-
478
- if (Object.hasOwn(importedFuncs, name)) return [ number(importedFuncs[name] - importedFuncs.length) ];
479
477
  if (Object.hasOwn(funcIndex, name)) return funcRef(funcByName(name));
478
+ if (Object.hasOwn(importedFuncs, name)) return [ number(importedFuncs[name] - importedFuncs.length) ];
480
479
 
481
480
  if (name.startsWith('__')) {
482
481
  // return undefined if unknown key in already known var
@@ -2705,7 +2704,7 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
2705
2704
  }
2706
2705
 
2707
2706
  if ((builtinFuncs[name] && builtinFuncs[name].returns?.length === 0) ||
2708
- (importedFuncs[name] != null && importedFuncs[importedFuncs[name]]?.returns === 0)) {
2707
+ (idx === importedFuncs[name] && importedFuncs[importedFuncs[name]]?.returns === 0)) {
2709
2708
  out.push(number(UNDEFINED));
2710
2709
  }
2711
2710
 
package/compiler/wrap.js CHANGED
@@ -366,10 +366,10 @@ export default (source, module = undefined, customImports = {}, print = str => p
366
366
  const disasm = disassemble(func.wasm.slice(min, max), func.name, 0, func.locals, func.params, func.returns, funcs, globals, exceptions)
367
367
  .slice(0, -1).split('\n').filter(x => !x.startsWith('\x1B[90m;;'));
368
368
 
369
- const noAnsi = s => s.replace(/\u001b\[[0-9]+m/g, '');
369
+ const noAnsi = s => s && s.replace(/\u001b\[[0-9]+m/g, '');
370
370
  let longest = 0;
371
371
  for (let j = 0; j < disassemble.length; j++) {
372
- longest = Math.max(longest, noAnsi(disassemble[j]).length);
372
+ longest = Math.max(longest, noAnsi(disassemble[j])?.length ?? 0);
373
373
  }
374
374
 
375
375
  if (middleIndex != -1) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "porffor",
3
3
  "description": "a basic experimental wip aot optimizing js -> wasm engine/compiler/runtime in js",
4
- "version": "0.55.3",
4
+ "version": "0.55.4",
5
5
  "author": "CanadaHonk",
6
6
  "license": "MIT",
7
7
  "scripts": {},
package/r.js ADDED
@@ -0,0 +1,2 @@
1
+ function print() {}
2
+ print();
package/runner/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import fs from 'node:fs';
3
- globalThis.version = '0.55.3';
3
+ globalThis.version = '0.55.4';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {