porffor 0.60.11 → 0.60.13

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.
@@ -96,7 +96,7 @@ const funcRef = func => {
96
96
 
97
97
  func.generate?.();
98
98
 
99
- const wrapperArgc = Prefs.indirectWrapperArgc ?? 10;
99
+ const wrapperArgc = Prefs.indirectWrapperArgc ?? 16;
100
100
  if (!func.wrapperFunc) {
101
101
  const locals = {
102
102
  ['#length']: { idx: 0, type: Valtype.i32 }
@@ -191,11 +191,11 @@ const funcRef = func => {
191
191
  wasm.push(
192
192
  [ Opcodes.local_get, array ],
193
193
  [ Opcodes.local_get, 5 + i * 2 ],
194
- [ Opcodes.f64_store, 0, offset ],
194
+ [ Opcodes.f64_store, 0, ...unsignedLEB128(offset) ],
195
195
 
196
196
  [ Opcodes.local_get, array ],
197
197
  [ Opcodes.local_get, 6 + i * 2 ],
198
- [ Opcodes.i32_store8, 0, offset + 8 ],
198
+ [ Opcodes.i32_store8, 0, ...unsignedLEB128(offset + 8) ],
199
199
  );
200
200
  offset += 9;
201
201
  }
@@ -2558,7 +2558,7 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
2558
2558
  funcs.table = true;
2559
2559
  scope.table = true;
2560
2560
 
2561
- const wrapperArgc = Prefs.indirectWrapperArgc ?? 10;
2561
+ const wrapperArgc = Prefs.indirectWrapperArgc ?? 16;
2562
2562
  const underflow = wrapperArgc - args.length;
2563
2563
  for (let i = 0; i < underflow; i++) args.push(DEFAULT_VALUE());
2564
2564
  if (args.length > wrapperArgc) args = args.slice(0, wrapperArgc);
@@ -2626,14 +2626,14 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
2626
2626
 
2627
2627
  ...typeSwitch(scope, getNodeType(scope, callee), {
2628
2628
  [TYPES.function]: () => [
2629
- number(10 - underflow, Valtype.i32),
2629
+ number(wrapperArgc - underflow, Valtype.i32),
2630
2630
  ...forceDuoValtype(scope, newTargetWasm, Valtype.f64),
2631
2631
  ...forceDuoValtype(scope, thisWasm, Valtype.f64),
2632
2632
  ...out,
2633
2633
 
2634
2634
  [ Opcodes.local_get, calleeLocal ],
2635
2635
  Opcodes.i32_to_u,
2636
- [ Opcodes.call_indirect, args.length + 2, 0, ],
2636
+ [ Opcodes.call_indirect, args.length + 2, 0 ],
2637
2637
  ...setLastType(scope)
2638
2638
  ],
2639
2639
 
@@ -3630,7 +3630,7 @@ const memberTmpNames = scope => {
3630
3630
  };
3631
3631
 
3632
3632
  // todo: generate this array procedurally
3633
- const builtinPrototypeGets = ['size', 'description', 'byteLength', 'byteOffset', 'buffer', 'detached', 'resizable', 'growable', 'maxByteLength', 'name', 'message', 'constructor', 'source', 'flags', 'global', 'ignoreCase', 'multiline', 'dotAll', 'unicode', 'sticky', 'hasIndices', 'unicodeSets'];
3633
+ const builtinPrototypeGets = ['size', 'description', 'byteLength', 'byteOffset', 'buffer', 'detached', 'resizable', 'growable', 'maxByteLength', 'name', 'message', 'constructor', 'source', 'flags', 'global', 'ignoreCase', 'multiline', 'dotAll', 'unicode', 'sticky', 'hasIndices', 'unicodeSets', 'lastIndex'];
3634
3634
 
3635
3635
  const ctHash = prop => {
3636
3636
  if (!Prefs.ctHash || !prop ||
@@ -88,6 +88,7 @@ const compile = async (file, _funcs) => {
88
88
  const body = globalThis.funcBodies[x.name];
89
89
  const bodyHasTopLevelThrow = body?.body && body.body.some(x => x.type === 'ThrowStatement');
90
90
 
91
+ if (x.name === '_eval') x.name = 'eval';
91
92
  if (x.data) {
92
93
  x.data = x.data.reduce((acc, x) => { acc[data[x].page] = data[x].bytes; return acc; }, {});
93
94
  }
@@ -244,7 +245,7 @@ ${funcs.map(x => {
244
245
  if (Number.isNaN(v) || v === Infinity || v === -Infinity) return v.toString();
245
246
  return v;
246
247
  })
247
- .replace(/\["alloc","(.*?)",(.*?)\]/g, (_, reason, valtype) => `[${valtype === Valtype.i32 ? Opcodes.i32_const : Opcodes.f64_const},allocPage(_,'${reason}')]`)
248
+ .replace(/\["alloc","(.*?)",(.*?)\]/g, (_, reason, valtype) => `[${+valtype === Valtype.i32 ? Opcodes.i32_const : Opcodes.f64_const},allocPage(_,'${reason}')]`)
248
249
  .replace(/\["global",(.*?),"(.*?)",(.*?)\]/g, (_, opcode, name, valtype) => `...glbl(${opcode},'${name}',${valtype})`)
249
250
  .replace(/\"local","(.*?)",(.*?)\]/g, (_, name, valtype) => `loc('${name}',${valtype})]`)
250
251
  .replace(/\[16,"(.*?)"]/g, (_, name) => `[16,builtin('${name}')]`)
package/deno.lock ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "version": "5",
3
+ "redirects": {
4
+ "https://esm.sh/acorn": "https://esm.sh/acorn@8.14.0"
5
+ },
6
+ "remote": {
7
+ "https://esm.sh/acorn@8.14.0": "b5a42b450cfd514709a3f855bfb1d886104d9c72a01b7d111e6e26c86e5f41e2",
8
+ "https://esm.sh/acorn@8.14.0/denonext/acorn.mjs": "669c981ded732a02351d5e6b1f6d5641d71a8d5165c0fed93be7f40c676be0b8"
9
+ },
10
+ "workspace": {
11
+ "packageJson": {
12
+ "dependencies": [
13
+ "npm:acorn@^8.15.0",
14
+ "npm:node-repl-polyfill@~0.1.2"
15
+ ]
16
+ }
17
+ }
18
+ }
package/foo.js CHANGED
@@ -1,15 +1 @@
1
- let count = 0;
2
-
3
- class Class {
4
- #method() {
5
- count += 1;
6
- }
7
-
8
- static isNameIn(value) {
9
- return #method in value;
10
- }
11
- }
12
-
13
- console.log(Class.isNameIn({}), false);
14
- console.log(Class.isNameIn(new Class()), true);
15
- console.log(count, 0);
1
+ console.log([...'abc azc anc'.matchAll(/a[a-z]c/g)]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "porffor",
3
3
  "description": "An ahead-of-time JavaScript compiler",
4
- "version": "0.60.11",
4
+ "version": "0.60.13",
5
5
  "author": "Oliver Medhurst <honk@goose.icu>",
6
6
  "license": "MIT",
7
7
  "scripts": {},
package/runtime/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import fs from 'node:fs';
3
- globalThis.version = '0.60.11';
3
+ globalThis.version = '0.60.13';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {