porffor 0.20.5 → 0.20.7
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/compiler/assemble.js +1 -1
- package/compiler/builtins/array.ts +7 -0
- package/compiler/builtins/object.ts +136 -1
- package/compiler/builtins/porffor.d.ts +1 -0
- package/compiler/builtins/set.ts +2 -5
- package/compiler/builtins/symbol.ts +1 -6
- package/compiler/builtins/weakref.ts +1 -1
- package/compiler/builtins/z_ecma262.ts +16 -0
- package/compiler/builtins/z_map.ts +8 -9
- package/compiler/builtins/z_weakmap.ts +3 -5
- package/compiler/builtins/z_weakset.ts +2 -5
- package/compiler/codegen.js +59 -32
- package/compiler/generated_builtins.js +181 -120
- package/compiler/precompile.js +1 -1
- package/compiler/types.js +10 -16
- package/compiler/wrap.js +3 -3
- package/package.json +1 -1
- package/runner/index.js +2 -2
package/compiler/precompile.js
CHANGED
@@ -24,7 +24,7 @@ const compile = async (file, _funcs) => {
|
|
24
24
|
first = source.slice(0, source.indexOf('\n'));
|
25
25
|
}
|
26
26
|
|
27
|
-
let args = ['--bytestring', '--todo-time=compile', '--truthy=no_nan_negative', '--no-treeshake-wasm-imports', '--no-rm-unused-types', '--scoped-page-names', '--funsafe-no-unlikely-proto-checks', '--fast-length', '--parse-types', '--opt-types'];
|
27
|
+
let args = ['--bytestring', '--todo-time=compile', '--truthy=no_nan_negative', '--no-treeshake-wasm-imports', '--no-rm-unused-types', '--scoped-page-names', '--funsafe-no-unlikely-proto-checks', '--fast-length', '--fast-object', '--parse-types', '--opt-types'];
|
28
28
|
if (first.startsWith('// @porf')) {
|
29
29
|
args = first.slice('// @porf '.length).split(' ').concat(args);
|
30
30
|
}
|
package/compiler/types.js
CHANGED
@@ -1,27 +1,21 @@
|
|
1
|
+
export const TYPE_FLAGS = {
|
2
|
+
parity: 0b10000000,
|
3
|
+
length: 0b01000000,
|
4
|
+
};
|
5
|
+
|
1
6
|
export const TYPES = {
|
2
7
|
empty: 0x00,
|
3
8
|
number: 0x01,
|
4
9
|
boolean: 0x02,
|
5
|
-
string: 0x03,
|
6
|
-
|
7
|
-
|
10
|
+
string: 0x03 | TYPE_FLAGS.length,
|
11
|
+
bigint: 0x04,
|
12
|
+
symbol: 0x05,
|
8
13
|
function: 0x06,
|
9
|
-
|
10
|
-
bigint: 0x08
|
11
|
-
};
|
14
|
+
object: 0x07,
|
12
15
|
|
13
|
-
|
14
|
-
export const TYPE_FLAGS = {
|
15
|
-
// iterable: 0b10000000,
|
16
|
-
parity: 0b10000000,
|
17
|
-
length: 0b01000000,
|
16
|
+
undefined: 0x00 | TYPE_FLAGS.parity,
|
18
17
|
};
|
19
18
|
|
20
|
-
// TYPES.string |= TYPE_FLAGS.iterable;
|
21
|
-
TYPES.string |= TYPE_FLAGS.length;
|
22
|
-
|
23
|
-
TYPES.undefined = TYPES.empty | TYPE_FLAGS.parity;
|
24
|
-
|
25
19
|
export const TYPE_NAMES = {
|
26
20
|
[TYPES.empty]: 'empty',
|
27
21
|
[TYPES.number]: 'Number',
|
package/compiler/wrap.js
CHANGED
@@ -379,7 +379,7 @@ export default (source, flags = [ 'module' ], customImports = {}, print = str =>
|
|
379
379
|
}
|
380
380
|
});
|
381
381
|
} catch (e) {
|
382
|
-
if (!
|
382
|
+
if (!Prefs.d) throw e;
|
383
383
|
if (!(e instanceof WebAssembly.CompileError)) throw e;
|
384
384
|
|
385
385
|
const funcInd = parseInt(e.message.match(/function #([0-9]+)/)?.[1]);
|
@@ -393,7 +393,7 @@ export default (source, flags = [ 'module' ], customImports = {}, print = str =>
|
|
393
393
|
if (Prefs.profileCompiler) console.log(`instantiated in ${times[1].toFixed(2)}ms`);
|
394
394
|
|
395
395
|
const exports = {};
|
396
|
-
const rawValues =
|
396
|
+
const rawValues = Prefs.d;
|
397
397
|
|
398
398
|
const exceptTag = instance.exports['0'], memory = instance.exports['$'];
|
399
399
|
for (const x in instance.exports) {
|
@@ -474,7 +474,7 @@ export default (source, flags = [ 'module' ], customImports = {}, print = str =>
|
|
474
474
|
}
|
475
475
|
|
476
476
|
if (e instanceof WebAssembly.RuntimeError) {
|
477
|
-
if (!
|
477
|
+
if (!Prefs.d) throw e;
|
478
478
|
|
479
479
|
const match = e.stack.match(/wasm-function\[([0-9]+)\]:([0-9a-z]+)/) ?? [];
|
480
480
|
const funcInd = parseInt(match[1]);
|
package/package.json
CHANGED
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.20.
|
3
|
+
globalThis.version = '0.20.7+2834584b7';
|
4
4
|
|
5
5
|
// deno compat
|
6
6
|
if (typeof process === 'undefined' && typeof Deno !== 'undefined') {
|
@@ -147,7 +147,7 @@ try {
|
|
147
147
|
} catch (e) {
|
148
148
|
// if (cache) process.stdout.write(cache);
|
149
149
|
let out = e;
|
150
|
-
if (!process.argv.includes('-
|
150
|
+
if (!process.argv.includes('-d') && Object.getPrototypeOf(e).message != null) out = `${e.constructor.name}${e.message != null ? `: ${e.message}` : ''}`;
|
151
151
|
console.error(out);
|
152
152
|
}
|
153
153
|
|