porffor 0.55.32 → 0.55.33
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 +317 -237
- package/compiler/builtins/_internal_string.ts +4 -4
- package/compiler/builtins/annexb_string.js +12 -11
- package/compiler/builtins/array.ts +21 -22
- package/compiler/builtins/arraybuffer.ts +4 -4
- package/compiler/builtins/bigint.ts +4 -4
- package/compiler/builtins/console.ts +9 -9
- package/compiler/builtins/dataview.ts +3 -3
- package/compiler/builtins/date.ts +46 -52
- package/compiler/builtins/error.js +1 -1
- package/compiler/builtins/json.ts +6 -6
- package/compiler/builtins/math.ts +1 -1
- package/compiler/builtins/number.ts +9 -9
- package/compiler/builtins/object.ts +32 -32
- package/compiler/builtins/object_prototypeWithHidden.js +1 -1
- package/compiler/builtins/porffor.d.ts +4 -3
- package/compiler/builtins/promise.ts +6 -6
- package/compiler/builtins/reflect.ts +1 -1
- package/compiler/builtins/set.ts +7 -7
- package/compiler/builtins/string_f64.ts +2 -2
- package/compiler/builtins/symbol.ts +2 -2
- package/compiler/builtins/typedarray.js +7 -7
- package/compiler/builtins/z_ecma262.ts +7 -7
- package/compiler/builtins.js +5 -6
- package/compiler/builtins_objects.js +27 -5
- package/compiler/builtins_precompiled.js +519 -520
- package/compiler/codegen.js +29 -39
- package/compiler/precompile.js +4 -3
- package/package.json +1 -1
- package/r.cjs +2 -9
- package/runner/index.js +1 -1
- package/compiler/builtins/__internal_object.ts +0 -83
package/compiler/builtins.js
CHANGED
@@ -735,19 +735,18 @@ export const BuiltinFuncs = function() {
|
|
735
735
|
this.__performance_now.usesImports = true;
|
736
736
|
|
737
737
|
|
738
|
-
this.
|
739
|
-
params: [
|
740
|
-
|
741
|
-
locals: [ Valtype.i32, Valtype.i32 ],
|
738
|
+
this.__Porffor_typeName = {
|
739
|
+
params: [ Valtype.i32 ],
|
740
|
+
locals: [],
|
742
741
|
returns: [ valtypeBinary ],
|
743
742
|
returnType: TYPES.bytestring,
|
744
743
|
wasm: (scope, { typeSwitch, makeString }) => {
|
745
744
|
const bc = {};
|
746
745
|
for (const x in TYPE_NAMES) {
|
747
|
-
bc[x] = makeString(scope, TYPE_NAMES[x]);
|
746
|
+
bc[x] = () => makeString(scope, TYPE_NAMES[x]);
|
748
747
|
}
|
749
748
|
|
750
|
-
return typeSwitch(scope, [ [ Opcodes.local_get,
|
749
|
+
return typeSwitch(scope, [ [ Opcodes.local_get, 0 ] ], bc);
|
751
750
|
}
|
752
751
|
};
|
753
752
|
|
@@ -15,7 +15,7 @@ export default function({ builtinFuncs }, Prefs) {
|
|
15
15
|
|
16
16
|
builtinFuncs['#get_' + name] = {
|
17
17
|
params: [],
|
18
|
-
locals: [],
|
18
|
+
locals: [ Valtype.i32 ],
|
19
19
|
returns: [ Valtype.i32 ],
|
20
20
|
returnType: TYPES.object,
|
21
21
|
wasm: (scope, { allocPage, makeString, generate, getNodeType, builtin, funcRef, glbl }) => {
|
@@ -41,7 +41,15 @@ export default function({ builtinFuncs }, Prefs) {
|
|
41
41
|
|
42
42
|
// set cache & ptr for use
|
43
43
|
number(ptr, Valtype.i32),
|
44
|
-
|
44
|
+
[ Opcodes.local_tee, 0 ],
|
45
|
+
glbl(Opcodes.global_set, `getptr_${name}`, Valtype.i32)[0],
|
46
|
+
|
47
|
+
[ Opcodes.local_get, 0 ],
|
48
|
+
Opcodes.i32_from_u,
|
49
|
+
number(existingFunc ? TYPES.function : TYPES.object, Valtype.i32),
|
50
|
+
[ Opcodes.call, builtin('__Porffor_object_underlying') ],
|
51
|
+
[ Opcodes.drop ],
|
52
|
+
[ Opcodes.local_set, 0 ]
|
45
53
|
];
|
46
54
|
|
47
55
|
for (const x in props) {
|
@@ -50,6 +58,20 @@ export default function({ builtinFuncs }, Prefs) {
|
|
50
58
|
name: prefix + x
|
51
59
|
};
|
52
60
|
|
61
|
+
if (x === '__proto__') {
|
62
|
+
out.push(
|
63
|
+
[ Opcodes.local_get, 0 ],
|
64
|
+
number(TYPES.object, Valtype.i32),
|
65
|
+
|
66
|
+
...generate(scope, value),
|
67
|
+
Opcodes.i32_to_u,
|
68
|
+
...getNodeType(scope, value),
|
69
|
+
|
70
|
+
[ Opcodes.call, builtin('__Porffor_object_setPrototype') ]
|
71
|
+
);
|
72
|
+
continue;
|
73
|
+
}
|
74
|
+
|
53
75
|
let flags = 0b0000;
|
54
76
|
|
55
77
|
const d = props[x];
|
@@ -61,8 +83,8 @@ export default function({ builtinFuncs }, Prefs) {
|
|
61
83
|
if (this[prefix + x]?.type === TYPES.object && this[prefix + x] !== this.null) value = { type: 'ObjectExpression', properties: [] };
|
62
84
|
|
63
85
|
out.push(
|
64
|
-
|
65
|
-
number(
|
86
|
+
[ Opcodes.local_get, 0 ],
|
87
|
+
number(TYPES.object, Valtype.i32),
|
66
88
|
|
67
89
|
...makeString(scope, x),
|
68
90
|
Opcodes.i32_to_u,
|
@@ -74,7 +96,7 @@ export default function({ builtinFuncs }, Prefs) {
|
|
74
96
|
number(flags, Valtype.i32),
|
75
97
|
number(TYPES.number, Valtype.i32),
|
76
98
|
|
77
|
-
[ Opcodes.call, builtin('
|
99
|
+
[ Opcodes.call, builtin('__Porffor_object_fastAdd') ]
|
78
100
|
);
|
79
101
|
}
|
80
102
|
|