porffor 0.57.15 → 0.57.16
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/_internal_object.ts +10 -113
- package/compiler/builtins_precompiled.js +21 -21
- package/compiler/codegen.js +1 -1
- package/compiler/disassemble.js +3 -2
- package/compiler/pgo.js +2 -2
- package/compiler/precompile.js +8 -2
- package/foo.js +26 -0
- package/package.json +1 -1
- package/runtime/flamegraph.js +441 -158
- package/runtime/hotlines.js +3 -3
- package/runtime/index.js +1 -1
package/compiler/pgo.js
CHANGED
@@ -35,10 +35,10 @@ export const run = obj => {
|
|
35
35
|
time(0, `injecting PGO logging...`);
|
36
36
|
|
37
37
|
let activeFunc = null, abort = false;
|
38
|
-
createImport('profile1',
|
38
|
+
createImport('profile1', [ Valtype.i32 ], 0, n => {
|
39
39
|
activeFunc = n;
|
40
40
|
});
|
41
|
-
createImport('profile2',
|
41
|
+
createImport('profile2', [ Valtype.i32, Valtype.f64 ], 0, (i, n) => {
|
42
42
|
if (activeFunc == null) throw 'fail';
|
43
43
|
localData[activeFunc][i].push(n);
|
44
44
|
});
|
package/compiler/precompile.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Opcodes, Valtype } from './wasmSpec.js';
|
2
2
|
import { read_signedLEB128 } from './encoding.js';
|
3
3
|
import { TYPES, TYPE_NAMES } from './types.js';
|
4
|
-
import { createImport } from './builtins.js';
|
4
|
+
import { createImport, importedFuncs } from './builtins.js';
|
5
5
|
import { log } from './log.js';
|
6
6
|
|
7
7
|
createImport('print', 1, 0);
|
@@ -112,7 +112,13 @@ const compile = async (file, _funcs) => {
|
|
112
112
|
if (y[0] === Opcodes.call) {
|
113
113
|
const idx = y[1];
|
114
114
|
const f = funcs.find(x => x.index === idx);
|
115
|
-
if (!f)
|
115
|
+
if (!f) {
|
116
|
+
if (idx < importedFuncs.length) {
|
117
|
+
y.splice(1, 10, importedFuncs[idx].name);
|
118
|
+
}
|
119
|
+
|
120
|
+
continue;
|
121
|
+
}
|
116
122
|
|
117
123
|
y.splice(1, 10, f.name);
|
118
124
|
}
|
package/foo.js
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
function buildString(args) {
|
2
|
+
// Use member expressions rather than destructuring `args` for improved
|
3
|
+
// compatibility with engines that only implement assignment patterns
|
4
|
+
// partially or not at all.
|
5
|
+
const loneCodePoints = args.loneCodePoints;
|
6
|
+
const ranges = args.ranges;
|
7
|
+
const CHUNK_SIZE = 10000;
|
8
|
+
let result = String.fromCodePoint.apply(null, loneCodePoints);
|
9
|
+
for (let i = 0; i < ranges.length; i++) {
|
10
|
+
let range = ranges[i];
|
11
|
+
let start = range[0];
|
12
|
+
let end = range[1];
|
13
|
+
let codePoints = [];
|
14
|
+
for (let length = 0, codePoint = start; codePoint <= end; codePoint++) {
|
15
|
+
codePoints[length++] = codePoint;
|
16
|
+
if (length === CHUNK_SIZE) {
|
17
|
+
result += String.fromCodePoint.apply(null, codePoints);
|
18
|
+
codePoints.length = length = 0;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
result += String.fromCodePoint.apply(null, codePoints);
|
22
|
+
}
|
23
|
+
return result;
|
24
|
+
}
|
25
|
+
|
26
|
+
console.log(buildString({ loneCodePoints: [1337], ranges: [] }));
|