porffor 0.17.0-0564424f4 → 0.17.0-3c2d70d66
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/array.ts +28 -0
- package/compiler/codegen.js +125 -8
- package/compiler/generated_builtins.js +267 -177
- package/compiler/opt.js +3 -0
- package/compiler/prototype.js +0 -69
- package/package.json +1 -1
package/compiler/opt.js
CHANGED
@@ -203,6 +203,9 @@ export default (funcs, globals, pages, tags, exceptions) => {
|
|
203
203
|
if (type === 'Array') missing = !pages.hasArray;
|
204
204
|
if (type === 'String') missing = !pages.hasString;
|
205
205
|
if (type === 'ByteString') missing = !pages.hasByteString;
|
206
|
+
if (['Set', 'Uint8Array', 'Int8Array', 'Uint8ClampedArray', 'Uint16Array', 'Int16Array', 'Uint32Array', 'Int32Array', 'Float32Array', 'Float64Array'].includes(type)) {
|
207
|
+
missing = funcs.find(x => x.name === type) == null;
|
208
|
+
}
|
206
209
|
|
207
210
|
if (missing) {
|
208
211
|
let j = i, depth = 0;
|
package/compiler/prototype.js
CHANGED
@@ -208,72 +208,6 @@ export const PrototypeFuncs = function() {
|
|
208
208
|
// ...number(1, Valtype.i32),
|
209
209
|
// [ Opcodes.i32_sub ]
|
210
210
|
// ]),
|
211
|
-
],
|
212
|
-
|
213
|
-
fill: (pointer, length, wElement, wType, iTmp, iTmp2) => [
|
214
|
-
...wElement,
|
215
|
-
[ Opcodes.local_set, iTmp ],
|
216
|
-
|
217
|
-
// use cached length i32 as pointer
|
218
|
-
...length.getCachedI32(),
|
219
|
-
|
220
|
-
// length - 1 for indexes
|
221
|
-
...number(1, Valtype.i32),
|
222
|
-
[ Opcodes.i32_sub ],
|
223
|
-
|
224
|
-
// * sizeof value
|
225
|
-
...number(ValtypeSize[valtype] + 1, Valtype.i32),
|
226
|
-
[ Opcodes.i32_mul ],
|
227
|
-
|
228
|
-
...length.setCachedI32(),
|
229
|
-
|
230
|
-
...(noUnlikelyChecks ? [] : [
|
231
|
-
...length.getCachedI32(),
|
232
|
-
...number(0, Valtype.i32),
|
233
|
-
[ Opcodes.i32_lt_s ],
|
234
|
-
[ Opcodes.if, Blocktype.void ],
|
235
|
-
...pointer,
|
236
|
-
Opcodes.i32_from_u,
|
237
|
-
[ Opcodes.br, 1 ],
|
238
|
-
[ Opcodes.end ]
|
239
|
-
]),
|
240
|
-
|
241
|
-
[ Opcodes.loop, Blocktype.void ],
|
242
|
-
|
243
|
-
// calculate offset
|
244
|
-
...length.getCachedI32(),
|
245
|
-
...pointer,
|
246
|
-
[ Opcodes.i32_add ],
|
247
|
-
[ Opcodes.local_set, iTmp2 ],
|
248
|
-
|
249
|
-
// store value
|
250
|
-
[ Opcodes.local_get, iTmp2 ],
|
251
|
-
[ Opcodes.local_get, iTmp ],
|
252
|
-
[ Opcodes.store, 0, ValtypeSize.i32 ],
|
253
|
-
|
254
|
-
// store type
|
255
|
-
[ Opcodes.local_get, iTmp2 ],
|
256
|
-
...wType,
|
257
|
-
[ Opcodes.i32_store8, 0, ValtypeSize.i32 + ValtypeSize[valtype] ],
|
258
|
-
|
259
|
-
// pointer - sizeof value
|
260
|
-
...length.getCachedI32(),
|
261
|
-
...number(ValtypeSize[valtype] + 1, Valtype.i32),
|
262
|
-
[ Opcodes.i32_sub ],
|
263
|
-
|
264
|
-
...length.setCachedI32(),
|
265
|
-
|
266
|
-
// if pointer >= 0, loop
|
267
|
-
...length.getCachedI32(),
|
268
|
-
...number(0, Valtype.i32),
|
269
|
-
[ Opcodes.i32_ge_s ],
|
270
|
-
[ Opcodes.br_if, 0 ],
|
271
|
-
|
272
|
-
[ Opcodes.end ],
|
273
|
-
|
274
|
-
// return this array
|
275
|
-
...pointer,
|
276
|
-
Opcodes.i32_from_u,
|
277
211
|
]
|
278
212
|
};
|
279
213
|
|
@@ -282,9 +216,6 @@ export const PrototypeFuncs = function() {
|
|
282
216
|
this[TYPES.array].push.noArgRetLength = true;
|
283
217
|
this[TYPES.array].push.local = Valtype.i32;
|
284
218
|
this[TYPES.array].pop.local = Valtype.i32;
|
285
|
-
this[TYPES.array].fill.local = valtypeBinary;
|
286
|
-
this[TYPES.array].fill.local2 = Valtype.i32;
|
287
|
-
this[TYPES.array].fill.returnType = TYPES.array;
|
288
219
|
|
289
220
|
this[TYPES.string] = {
|
290
221
|
at: (pointer, length, wIndex, wType, iTmp, _, arrayShell) => {
|
package/package.json
CHANGED