porffor 0.55.36 → 0.56.1
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 -0
- package/compiler/builtins.js +0 -55
- package/compiler/builtins_precompiled.js +112 -112
- package/compiler/codegen.js +37 -26
- package/compiler/expression.js +55 -3
- package/package.json +1 -1
- package/r.cjs +4 -4
- package/runner/index.js +1 -1
package/compiler/assemble.js
CHANGED
@@ -141,6 +141,7 @@ export default (funcs, globals, tags, pages, data, noTreeshake = false) => {
|
|
141
141
|
if (length == null) {
|
142
142
|
length = func.params.length;
|
143
143
|
if (func.constr) length -= 4;
|
144
|
+
if (func.method) length -= 2;
|
144
145
|
if (!func.internal || func.typedParams) length = Math.floor(length / 2);
|
145
146
|
|
146
147
|
// remove _this from internal prototype funcs
|
package/compiler/builtins.js
CHANGED
@@ -100,61 +100,6 @@ export const BuiltinVars = function(ctx) {
|
|
100
100
|
};
|
101
101
|
|
102
102
|
export const BuiltinFuncs = function() {
|
103
|
-
this['f64_%'] = {
|
104
|
-
params: [ valtypeBinary, valtypeBinary ],
|
105
|
-
locals: [],
|
106
|
-
returns: [ valtypeBinary ],
|
107
|
-
returnType: TYPES.number,
|
108
|
-
wasm: [ // x - truncf(x / y) * y
|
109
|
-
[ Opcodes.local_get, 0 ], // x
|
110
|
-
|
111
|
-
[ Opcodes.local_get, 0 ], // x
|
112
|
-
[ Opcodes.local_get, 1 ], // y
|
113
|
-
|
114
|
-
[ Opcodes.f64_div ],
|
115
|
-
[ Opcodes.f64_trunc ],
|
116
|
-
|
117
|
-
[ Opcodes.local_get, 1 ], // y
|
118
|
-
[ Opcodes.f64_mul ],
|
119
|
-
|
120
|
-
[ Opcodes.f64_sub ]
|
121
|
-
]
|
122
|
-
};
|
123
|
-
|
124
|
-
this['f64_**'] = this['i32_**'] = {
|
125
|
-
params: [ valtypeBinary, valtypeBinary ],
|
126
|
-
locals: [],
|
127
|
-
returns: [ valtypeBinary ],
|
128
|
-
returnType: TYPES.number,
|
129
|
-
wasm: (scope, { builtin }) => [
|
130
|
-
[ Opcodes.local_get, 0 ],
|
131
|
-
number(TYPES.number, Valtype.i32),
|
132
|
-
[ Opcodes.local_get, 1 ],
|
133
|
-
number(TYPES.number, Valtype.i32),
|
134
|
-
[ Opcodes.call, builtin('__Math_pow') ]
|
135
|
-
]
|
136
|
-
};
|
137
|
-
|
138
|
-
// add bitwise ops by converting operands to i32 first
|
139
|
-
for (const [ char, op ] of [ ['&', Opcodes.i32_and], ['|', Opcodes.i32_or], ['^', Opcodes.i32_xor], ['<<', Opcodes.i32_shl], ['>>', Opcodes.i32_shr_s], ['>>>', Opcodes.i32_shr_u] ]) {
|
140
|
-
this[`f64_${char}`] = {
|
141
|
-
params: [ Valtype.f64, Valtype.f64 ],
|
142
|
-
locals: [],
|
143
|
-
returns: [ Valtype.f64 ],
|
144
|
-
returnType: TYPES.number,
|
145
|
-
wasm: [
|
146
|
-
[ Opcodes.local_get, 0 ],
|
147
|
-
Opcodes.i32_trunc_sat_f64_s,
|
148
|
-
|
149
|
-
[ Opcodes.local_get, 1 ],
|
150
|
-
Opcodes.i32_trunc_sat_f64_s,
|
151
|
-
|
152
|
-
[ op ],
|
153
|
-
[ Opcodes.f64_convert_i32_s ]
|
154
|
-
]
|
155
|
-
};
|
156
|
-
}
|
157
|
-
|
158
103
|
this.isNaN = {
|
159
104
|
floatOnly: true,
|
160
105
|
params: [ valtypeBinary ],
|