porffor 0.47.7 → 0.47.8
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/boolean.ts +2 -5
- package/compiler/builtins/object.ts +10 -12
- package/compiler/builtins/z_ecma262.ts +4 -6
- package/compiler/builtins_precompiled.js +74 -74
- package/compiler/codegen.js +12 -5
- package/compiler/prototype.js +4 -4
- package/package.json +1 -1
- package/runner/index.js +1 -1
package/compiler/codegen.js
CHANGED
@@ -2202,7 +2202,10 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
|
|
2202
2202
|
generate(scope, decl.arguments[0] ?? DEFAULT_VALUE()),
|
2203
2203
|
getNodeType(scope, decl.arguments[0] ?? DEFAULT_VALUE()),
|
2204
2204
|
protoLocal, protoLocal2,
|
2205
|
-
|
2205
|
+
bytes => [
|
2206
|
+
...number(bytes, Valtype.i32),
|
2207
|
+
[ Opcodes.call, includeBuiltin(scope, '__Porffor_allocateBytes').index ]
|
2208
|
+
],
|
2206
2209
|
() => {
|
2207
2210
|
optUnused = true;
|
2208
2211
|
return unusedValue;
|
@@ -4188,7 +4191,8 @@ const generateForOf = (scope, decl) => {
|
|
4188
4191
|
...setType(scope, tmpName, TYPES.string),
|
4189
4192
|
|
4190
4193
|
// allocate out string
|
4191
|
-
|
4194
|
+
...number(8, Valtype.i32),
|
4195
|
+
[ Opcodes.call, includeBuiltin(scope, '__Porffor_allocateBytes').index ],
|
4192
4196
|
[ Opcodes.local_tee, localTmp(scope, '#forof_allocd', Valtype.i32) ],
|
4193
4197
|
|
4194
4198
|
// set length to 1
|
@@ -4243,7 +4247,8 @@ const generateForOf = (scope, decl) => {
|
|
4243
4247
|
...setType(scope, tmpName, TYPES.bytestring),
|
4244
4248
|
|
4245
4249
|
// allocate out string
|
4246
|
-
|
4250
|
+
...number(8, Valtype.i32),
|
4251
|
+
[ Opcodes.call, includeBuiltin(scope, '__Porffor_allocateBytes').index ],
|
4247
4252
|
[ Opcodes.local_tee, localTmp(scope, '#forof_allocd', Valtype.i32) ],
|
4248
4253
|
|
4249
4254
|
// set length to 1
|
@@ -5442,7 +5447,8 @@ const generateMember = (scope, decl, _global, _name, _objectWasm = undefined) =>
|
|
5442
5447
|
|
5443
5448
|
[TYPES.string]: () => [
|
5444
5449
|
// allocate out string
|
5445
|
-
|
5450
|
+
...number(8, Valtype.i32),
|
5451
|
+
[ Opcodes.call, includeBuiltin(scope, '__Porffor_allocateBytes').index ],
|
5446
5452
|
[ Opcodes.local_tee, localTmp(scope, '#member_allocd', Valtype.i32) ],
|
5447
5453
|
|
5448
5454
|
// set length to 1
|
@@ -5476,7 +5482,8 @@ const generateMember = (scope, decl, _global, _name, _objectWasm = undefined) =>
|
|
5476
5482
|
|
5477
5483
|
[TYPES.bytestring]: () => [
|
5478
5484
|
// allocate out string
|
5479
|
-
|
5485
|
+
...number(8, Valtype.i32),
|
5486
|
+
[ Opcodes.call, includeBuiltin(scope, '__Porffor_allocateBytes').index ],
|
5480
5487
|
[ Opcodes.local_tee, localTmp(scope, '#member_allocd', Valtype.i32) ],
|
5481
5488
|
|
5482
5489
|
// set length to 1
|
package/compiler/prototype.js
CHANGED
@@ -177,7 +177,7 @@ export const PrototypeFuncs = function() {
|
|
177
177
|
this[TYPES.string] = {
|
178
178
|
at: (pointer, length, wIndex, wType, iTmp, iOut, alloc) => [
|
179
179
|
// setup new/out array and use pointer for store
|
180
|
-
...alloc(),
|
180
|
+
...alloc(8),
|
181
181
|
[ Opcodes.local_tee, iOut ],
|
182
182
|
|
183
183
|
// out.length = 1
|
@@ -235,7 +235,7 @@ export const PrototypeFuncs = function() {
|
|
235
235
|
// todo: out of bounds properly
|
236
236
|
charAt: (pointer, length, wIndex, wType, iTmp, _, alloc) => [
|
237
237
|
// setup new/out array and use as pointer for store
|
238
|
-
...alloc(),
|
238
|
+
...alloc(8),
|
239
239
|
[ Opcodes.local_tee, iTmp ],
|
240
240
|
|
241
241
|
// out.length = 1
|
@@ -315,7 +315,7 @@ export const PrototypeFuncs = function() {
|
|
315
315
|
this[TYPES.bytestring] = {
|
316
316
|
at: (pointer, length, wIndex, wType, iTmp, iOut, alloc) => [
|
317
317
|
// setup new/out array and use pointer for store
|
318
|
-
...alloc(),
|
318
|
+
...alloc(8),
|
319
319
|
[ Opcodes.local_tee, iOut ],
|
320
320
|
|
321
321
|
// out.length = 1
|
@@ -371,7 +371,7 @@ export const PrototypeFuncs = function() {
|
|
371
371
|
// todo: out of bounds properly
|
372
372
|
charAt: (pointer, length, wIndex, wType, iTmp, _, alloc) => [
|
373
373
|
// setup new/out array and use as pointer for store
|
374
|
-
...alloc(),
|
374
|
+
...alloc(8),
|
375
375
|
[ Opcodes.local_tee, iTmp ],
|
376
376
|
|
377
377
|
// out.length = 1
|
package/package.json
CHANGED