porffor 0.2.0-08a272e → 0.2.0-15592d6

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/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.2.0-08a272e",
4
+ "version": "0.2.0-15592d6",
5
5
  "author": "CanadaHonk",
6
6
  "license": "MIT",
7
7
  "dependencies": {
package/porf ADDED
@@ -0,0 +1,2 @@
1
+ #!/bin/sh
2
+ node runner/index.js "$@"
package/runner/index.js CHANGED
@@ -3,6 +3,8 @@
3
3
  import compile from '../compiler/wrap.js';
4
4
  import fs from 'node:fs';
5
5
 
6
+ const start = performance.now();
7
+
6
8
  if (process.argv.includes('-compile-hints')) {
7
9
  const v8 = await import('node:v8');
8
10
  v8.setFlagsFromString(`--experimental-wasm-compilation-hints`);
@@ -15,9 +17,22 @@ if (process.argv.includes('-compile-hints')) {
15
17
  // --experimental-wasm-return-call (on by default)
16
18
  }
17
19
 
18
- const file = process.argv.slice(2).find(x => x[0] !== '-');
20
+ let file = process.argv.slice(2).find(x => x[0] !== '-');
21
+ if (['run', 'wasm', 'native', 'c'].includes(file)) {
22
+ if (['wasm', 'native', 'c'].includes(file)) {
23
+ process.argv.push(`-target=${file}`);
24
+ }
25
+
26
+ file = process.argv.slice(process.argv.indexOf(file) + 1).find(x => x[0] !== '-');
27
+
28
+ const nonOptOutFile = process.argv.slice(process.argv.indexOf(file) + 1).find(x => x[0] !== '-');
29
+ if (nonOptOutFile) {
30
+ process.argv.push(`-o=${nonOptOutFile}`);
31
+ }
32
+ }
33
+
19
34
  if (!file) {
20
- if (process.argv.includes('-v')) {
35
+ if (process.argv.includes('-v') || process.argv.includes('--version')) {
21
36
  // just print version
22
37
  console.log((await import('./version.js')).default);
23
38
  process.exit(0);
@@ -52,4 +67,6 @@ try {
52
67
  } catch (e) {
53
68
  if (cache) process.stdout.write(cache);
54
69
  console.error(process.argv.includes('-i') ? e : `${e.constructor.name}: ${e.message}`);
55
- }
70
+ }
71
+
72
+ if (process.argv.includes('-t')) console.log(performance.now() - start);