porffor 0.60.11 → 0.60.12
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/builtins/_internal_object.ts +6 -0
- package/compiler/builtins/function.ts +9 -0
- package/compiler/builtins/object_hiddenPrototype.js +1 -1
- package/compiler/builtins/regexp.ts +15 -15
- package/compiler/builtins_precompiled.js +219 -202
- package/compiler/codegen.js +7 -7
- package/compiler/precompile.js +1 -0
- package/deno.lock +18 -0
- package/foo.js +37 -12
- package/package.json +1 -1
- package/runtime/index.js +1 -1
package/compiler/codegen.js
CHANGED
@@ -96,7 +96,7 @@ const funcRef = func => {
|
|
96
96
|
|
97
97
|
func.generate?.();
|
98
98
|
|
99
|
-
const wrapperArgc = Prefs.indirectWrapperArgc ??
|
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 ??
|
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(
|
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 ||
|
package/compiler/precompile.js
CHANGED
@@ -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
|
}
|
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,40 @@
|
|
1
|
-
|
1
|
+
// Function.prototype;
|
2
|
+
// // Object.defineProperty(Function.prototype, "prop", {
|
3
|
+
// // value: 1001,
|
4
|
+
// // writable: false,
|
5
|
+
// // enumerable: false,
|
6
|
+
// // configurable: true
|
7
|
+
// // });
|
8
|
+
// var funObj = function() {};
|
9
|
+
// // console.log(Function.prototype.hasOwnProperty);
|
10
|
+
// // console.log(Function.prototype.hasOwnProperty === Object.prototype.hasOwnProperty);
|
11
|
+
// // console.log(Object.getPrototypeOf(funObj) === Function.prototype);
|
12
|
+
// // console.log(Object.getPrototypeOf(Object.getPrototypeOf(funObj)) === Object.prototype);
|
13
|
+
// console.log(funObj.hasOwnProperty);
|
2
14
|
|
3
|
-
|
4
|
-
#method() {
|
5
|
-
count += 1;
|
6
|
-
}
|
15
|
+
// // console.log(funObj.hasOwnProperty("prop"), false, 'funObj.hasOwnProperty("prop")');
|
7
16
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
}
|
17
|
+
var FACTORY = function() {
|
18
|
+
this.aproperty = 1;
|
19
|
+
};
|
12
20
|
|
13
|
-
|
14
|
-
|
15
|
-
console.log(
|
21
|
+
var instance = new FACTORY;
|
22
|
+
|
23
|
+
console.log(instance.__proto__ == FACTORY.prototype);
|
24
|
+
console.log(instance.__proto__.__proto__ == Object.prototype);
|
25
|
+
console.log(instance.hasOwnProperty);
|
26
|
+
console.log(instance.__proto__.hasOwnProperty);
|
27
|
+
console.log(instance.__proto__.__proto__.hasOwnProperty);
|
28
|
+
console.log()
|
29
|
+
|
30
|
+
console.log(
|
31
|
+
typeof Object.prototype.hasOwnProperty,
|
32
|
+
"function",
|
33
|
+
'The value of `typeof Object.prototype.hasOwnProperty` is expected to be "function"'
|
34
|
+
);
|
35
|
+
|
36
|
+
console.log(
|
37
|
+
typeof instance.hasOwnProperty,
|
38
|
+
"function",
|
39
|
+
'The value of `typeof instance.hasOwnProperty` is expected to be "function"'
|
40
|
+
);
|
package/package.json
CHANGED