porffor 0.55.13 → 0.55.15
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 +0 -1
- package/compiler/builtins/_internal_object.ts +10 -2
- package/compiler/builtins/math.ts +86 -2
- package/compiler/builtins/number.ts +2 -0
- package/compiler/builtins/porffor.d.ts +4 -0
- package/compiler/builtins.js +40 -89
- package/compiler/builtins_objects.js +1 -1
- package/compiler/builtins_precompiled.js +361 -354
- package/compiler/codegen.js +2 -3
- package/compiler/cyclone.js +1 -2
- package/compiler/encoding.js +10 -0
- package/compiler/opt.js +1 -2
- package/compiler/pgo.js +2 -2
- package/compiler/precompile.js +1 -1
- package/compiler/prototype.js +1 -1
- package/compiler/types.js +5 -19
- package/package.json +1 -1
- package/r.cjs +2 -9
- package/rhemyn/compile.js +2 -2
- package/runner/flamegraph.js +1 -1
- package/runner/index.js +1 -1
- package/.fails.cjs +0 -20
- package/all.json +0 -1
- package/compiler/cache.js +0 -44
- package/compiler/embedding.js +0 -11
package/compiler/codegen.js
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
import { Blocktype, Opcodes, Valtype, ValtypeSize } from './wasmSpec.js';
|
2
|
-
import { ieee754_binary64, signedLEB128, unsignedLEB128, encodeVector, read_signedLEB128 } from './encoding.js';
|
2
|
+
import { number, ieee754_binary64, signedLEB128, unsignedLEB128, encodeVector, read_signedLEB128 } from './encoding.js';
|
3
3
|
import { operatorOpcode } from './expression.js';
|
4
4
|
import { BuiltinFuncs, BuiltinVars, importedFuncs, NULL, UNDEFINED } from './builtins.js';
|
5
5
|
import { PrototypeFuncs } from './prototype.js';
|
6
|
-
import { number } from './embedding.js';
|
7
6
|
import { TYPES, TYPE_FLAGS, TYPE_NAMES, typeHasFlag } from './types.js';
|
8
7
|
import * as Rhemyn from '../rhemyn/compile.js';
|
9
8
|
import parse from './parse.js';
|
10
9
|
import { log } from './log.js';
|
11
|
-
import './prefs.js';
|
12
10
|
import { allocPage, allocStr } from './allocator.js';
|
11
|
+
import './prefs.js';
|
13
12
|
|
14
13
|
let globals = {};
|
15
14
|
let tags = [];
|
package/compiler/cyclone.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
// cyclone: wasm partial constant evaluator (it is fast and dangerous hence "cyclone")
|
2
|
-
import { signedLEB128, ieee754_binary64, read_ieee754_binary64, read_signedLEB128 } from './encoding.js';
|
2
|
+
import { number, signedLEB128, ieee754_binary64, read_ieee754_binary64, read_signedLEB128 } from './encoding.js';
|
3
3
|
import { Opcodes, Valtype } from './wasmSpec.js';
|
4
|
-
import { number } from './embedding.js';
|
5
4
|
|
6
5
|
const f64ToI32Op = {
|
7
6
|
[Opcodes.f64_eq]: Opcodes.i32_eq,
|
package/compiler/encoding.js
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
import { Opcodes, Valtype } from './wasmSpec.js';
|
2
|
+
export const number = (n, valtype = valtypeBinary) => {
|
3
|
+
if (valtype === Valtype.f64) return [ Opcodes.f64_const, n ];
|
4
|
+
|
5
|
+
const out = [ valtype === Valtype.i32 ? Opcodes.i32_const : Opcodes.i64_const ];
|
6
|
+
signedLEB128_into(n, out);
|
7
|
+
|
8
|
+
return out;
|
9
|
+
};
|
10
|
+
|
1
11
|
export const codifyString = str => {
|
2
12
|
let out = [];
|
3
13
|
for (let i = 0; i < str.length; i++) {
|
package/compiler/opt.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import { Opcodes, Valtype } from './wasmSpec.js';
|
2
|
-
import { number } from './
|
3
|
-
import { read_signedLEB128, read_ieee754_binary64 } from './encoding.js';
|
2
|
+
import { number, read_signedLEB128, read_ieee754_binary64 } from './encoding.js';
|
4
3
|
import { log } from './log.js';
|
5
4
|
import './prefs.js';
|
6
5
|
|
package/compiler/pgo.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
import { Opcodes, Valtype } from './wasmSpec.js';
|
2
|
-
import { number } from './
|
2
|
+
import { number } from './encoding.js';
|
3
3
|
import { importedFuncs } from './builtins.js';
|
4
|
-
import './prefs.js';
|
5
4
|
import assemble from './assemble.js';
|
6
5
|
import wrap, { writeByteStr } from './wrap.js';
|
7
6
|
import * as Havoc from './havoc.js';
|
7
|
+
import './prefs.js';
|
8
8
|
|
9
9
|
export const setup = () => {
|
10
10
|
importedFuncs[importedFuncs.profile2].params = [ Valtype.i32, valtypeBinary ];
|
package/compiler/precompile.js
CHANGED
@@ -216,7 +216,7 @@ const precompile = async () => {
|
|
216
216
|
};
|
217
217
|
|
218
218
|
return `// autogenerated by compiler/precompile.js
|
219
|
-
import { number } from './
|
219
|
+
import { number } from './encoding.js';
|
220
220
|
|
221
221
|
export const BuiltinFuncs = function() {
|
222
222
|
${funcs.map(x => {
|
package/compiler/prototype.js
CHANGED
package/compiler/types.js
CHANGED
@@ -58,15 +58,9 @@ registerInternalType('Map');
|
|
58
58
|
registerInternalType('ArrayBuffer');
|
59
59
|
registerInternalType('SharedArrayBuffer');
|
60
60
|
registerInternalType('DataView');
|
61
|
-
|
62
|
-
|
63
|
-
registerInternalType(
|
64
|
-
registerInternalType('Uint16Array', ['iterable', 'length']);
|
65
|
-
registerInternalType('Int16Array', ['iterable', 'length']);
|
66
|
-
registerInternalType('Uint32Array', ['iterable', 'length']);
|
67
|
-
registerInternalType('Int32Array', ['iterable', 'length']);
|
68
|
-
registerInternalType('Float32Array', ['iterable', 'length']);
|
69
|
-
registerInternalType('Float64Array', ['iterable', 'length']);
|
61
|
+
|
62
|
+
for (const x of [ 'Uint8', 'Int8', 'Uint8Clamped', 'Uint16', 'Int16', 'Uint32', 'Int32', 'Float32', 'Float64' ])
|
63
|
+
registerInternalType(`${x}Array`, ['iterable', 'length']);
|
70
64
|
|
71
65
|
registerInternalType('WeakRef');
|
72
66
|
registerInternalType('WeakSet');
|
@@ -78,16 +72,8 @@ registerInternalType('BooleanObject');
|
|
78
72
|
registerInternalType('NumberObject');
|
79
73
|
registerInternalType('StringObject');
|
80
74
|
|
81
|
-
|
82
|
-
registerInternalType(
|
83
|
-
registerInternalType('TypeError');
|
84
|
-
registerInternalType('ReferenceError');
|
85
|
-
registerInternalType('SyntaxError');
|
86
|
-
registerInternalType('RangeError');
|
87
|
-
registerInternalType('EvalError');
|
88
|
-
registerInternalType('URIError');
|
89
|
-
registerInternalType('Test262Error');
|
90
|
-
registerInternalType('TodoError');
|
75
|
+
for (const x of [ '', 'Aggregate', 'Type', 'Reference', 'Syntax', 'Range', 'Eval', 'URI', 'Test262', 'Todo' ])
|
76
|
+
registerInternalType(`${x}Error`);
|
91
77
|
|
92
78
|
registerInternalType('__Porffor_Generator');
|
93
79
|
registerInternalType('__Porffor_AsyncGenerator');
|
package/package.json
CHANGED
package/r.cjs
CHANGED
@@ -1,13 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
'use strict';
|
4
|
-
console.log(this);
|
5
|
-
eval('console.log(this)');
|
6
|
-
(0, eval)('console.log(this)');
|
7
|
-
eval?.('console.log(this)');
|
8
|
-
}
|
1
|
+
const x = new Date();
|
2
|
+
console.log(x.constructor === Date);
|
9
3
|
|
10
|
-
foo();
|
11
4
|
|
12
5
|
// let o = { set foo(x) { console.log('set foo', x); }, __proto__: { set bar(x) { console.log('set bar', x); } } };
|
13
6
|
|
package/rhemyn/compile.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Blocktype, Opcodes, Valtype, ValtypeSize } from '../compiler/wasmSpec.js';
|
2
|
-
import { number } from '../compiler/
|
2
|
+
import { number } from '../compiler/encoding.js';
|
3
3
|
import parse from './parse.js';
|
4
|
-
import '../compiler/prefs.js';
|
5
4
|
import { TYPES } from '../compiler/types.js';
|
5
|
+
import '../compiler/prefs.js';
|
6
6
|
|
7
7
|
// local indexes
|
8
8
|
const BasePointer = 0; // base string pointer
|
package/runner/flamegraph.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
2
|
import { Opcodes, Valtype } from '../compiler/wasmSpec.js';
|
3
|
-
import { number } from '../compiler/
|
3
|
+
import { number } from '../compiler/encoding.js';
|
4
4
|
import { importedFuncs } from '../compiler/builtins.js';
|
5
5
|
import compile from '../compiler/wrap.js';
|
6
6
|
import fs from 'node:fs';
|
package/runner/index.js
CHANGED
package/.fails.cjs
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
const all = require('./all.json').map(x => x.slice(21));
|
2
|
-
const { passes } = require('./test262/results.json');
|
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()
|
10
|
-
{
|
11
|
-
const dirs = Object.groupBy(fails, x => x.split('/').slice(0, 3).join('/'));
|
12
|
-
const top = Object.keys(dirs).sort((a, b) => dirs[b].length - dirs[a].length);
|
13
|
-
console.log(top.slice(0, 20).map(x => `${x}: ${dirs[x].length} (${((dirs[x].length / all.length) * 100).toFixed(2)}%)`).join('\n'));
|
14
|
-
}
|
15
|
-
console.log()
|
16
|
-
{
|
17
|
-
const dirs = Object.groupBy(fails, x => x.split('/').slice(0, 4).join('/'));
|
18
|
-
const top = Object.keys(dirs).sort((a, b) => dirs[b].length - dirs[a].length);
|
19
|
-
console.log(top.slice(0, 20).map(x => `${x}: ${dirs[x].length} (${((dirs[x].length / all.length) * 100).toFixed(2)}%)`).join('\n'));
|
20
|
-
}
|