porffor 0.21.4 → 0.21.6
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 +72 -11
- package/compiler/builtins/object.ts +63 -2
- package/compiler/codegen.js +3 -3
- package/compiler/generated_builtins.js +57 -9
- package/compiler/wrap.js +1 -1
- package/package.json +1 -1
- package/runner/index.js +11 -5
@@ -1,22 +1,72 @@
|
|
1
1
|
// @porf --valtype=i32
|
2
2
|
import type {} from './porffor.d.ts';
|
3
3
|
|
4
|
+
// todo: padding for memory alignment?
|
4
5
|
// memory layout:
|
5
|
-
// size (
|
6
|
+
// size (u32, 4)
|
7
|
+
// root flags (u32, 1):
|
8
|
+
// inextensible - 0b0001
|
6
9
|
// per entry (14):
|
7
10
|
// key - value, type MSB encoded (u32, 4)
|
8
11
|
// value - value (f64, 8)
|
9
12
|
// value - type + obj flag (u16, 2)
|
10
|
-
//
|
11
|
-
//
|
12
|
-
//
|
13
|
-
//
|
14
|
-
//
|
13
|
+
// flags:
|
14
|
+
// accessor - 0b0001
|
15
|
+
// configurable - 0b0010
|
16
|
+
// enumerable - 0b0100
|
17
|
+
// writable - 0b1000
|
18
|
+
|
19
|
+
export const __Porffor_object_preventExtensions = (ptr: object) => {
|
20
|
+
let rootFlags: i32 = Porffor.wasm.i32.load8_u(ptr, 0, 4);
|
21
|
+
rootFlags |= 0b0001;
|
22
|
+
Porffor.wasm.i32.store8(ptr, rootFlags, 0, 4);
|
23
|
+
};
|
24
|
+
|
25
|
+
export const __Porffor_object_isInextensible = (ptr: object): boolean => {
|
26
|
+
const out: boolean = Porffor.wasm.i32.load8_u(ptr, 0, 4) & 0b0001;
|
27
|
+
return out;
|
28
|
+
};
|
29
|
+
|
30
|
+
|
31
|
+
export const __Porffor_object_overrideAllFlags = (_this: object, overrideOr: i32, overrideAnd: i32) => {
|
32
|
+
let ptr: i32 = Porffor.wasm`local.get ${_this}` + 5;
|
33
|
+
|
34
|
+
const size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
|
35
|
+
const endPtr: i32 = ptr + size * 14;
|
36
|
+
|
37
|
+
for (; ptr < endPtr; ptr += 14) {
|
38
|
+
let flags: i32 = Porffor.wasm.i32.load8_u(ptr, 0, 12);
|
39
|
+
flags = (flags | overrideOr) & overrideAnd;
|
40
|
+
Porffor.wasm.i32.store8(ptr, flags, 0, 12);
|
41
|
+
}
|
42
|
+
};
|
43
|
+
|
44
|
+
export const __Porffor_object_checkAllFlags = (_this: object, dataAnd: i32, accessorAnd: i32, dataExpected: i32, accessorExpected: i32): boolean => {
|
45
|
+
let ptr: i32 = Porffor.wasm`local.get ${_this}` + 5;
|
46
|
+
|
47
|
+
const size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
|
48
|
+
const endPtr: i32 = ptr + size * 14;
|
49
|
+
|
50
|
+
for (; ptr < endPtr; ptr += 14) {
|
51
|
+
const flags: i32 = Porffor.wasm.i32.load8_u(ptr, 0, 12);
|
52
|
+
if (flags & 0b0001) {
|
53
|
+
// accessor
|
54
|
+
if ((flags & accessorAnd) != accessorExpected) return false;
|
55
|
+
} else {
|
56
|
+
// data
|
57
|
+
if ((flags & dataAnd) != dataExpected) return false;
|
58
|
+
}
|
59
|
+
|
60
|
+
}
|
61
|
+
|
62
|
+
return true;
|
63
|
+
};
|
64
|
+
|
15
65
|
|
16
66
|
export const __Porffor_object_lookup = (_this: object, target: any): i32 => {
|
17
67
|
const targetType: i32 = Porffor.wasm`local.get ${target+1}`;
|
18
68
|
|
19
|
-
let ptr: i32 = Porffor.wasm`local.get ${_this}` +
|
69
|
+
let ptr: i32 = Porffor.wasm`local.get ${_this}` + 5;
|
20
70
|
|
21
71
|
const size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
|
22
72
|
const endPtr: i32 = ptr + size * 14;
|
@@ -82,12 +132,17 @@ export const __Porffor_object_set = (_this: object, key: any, value: any): any =
|
|
82
132
|
let flags: i32;
|
83
133
|
if (entryPtr == -1) {
|
84
134
|
// add new entry
|
135
|
+
// check if object is inextensible
|
136
|
+
if (__Porffor_object_isInextensible(_this)) {
|
137
|
+
return value;
|
138
|
+
}
|
139
|
+
|
85
140
|
// bump size +1
|
86
141
|
const size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
|
87
142
|
Porffor.wasm.i32.store(_this, size + 1, 0, 0);
|
88
143
|
|
89
144
|
// entryPtr = current end of object
|
90
|
-
entryPtr = Porffor.wasm`local.get ${_this}` +
|
145
|
+
entryPtr = Porffor.wasm`local.get ${_this}` + 5 + size * 14;
|
91
146
|
|
92
147
|
// encode key type, set MSB if regular string
|
93
148
|
let keyEnc: i32 = Porffor.wasm`local.get ${key}`;
|
@@ -134,12 +189,17 @@ export const __Porffor_object_define = (_this: object, key: any, value: any, fla
|
|
134
189
|
let entryPtr: i32 = __Porffor_object_lookup(_this, key);
|
135
190
|
if (entryPtr == -1) {
|
136
191
|
// add new entry
|
192
|
+
// check if object is inextensible
|
193
|
+
if (__Porffor_object_isInextensible(_this)) {
|
194
|
+
throw new TypeError('Cannot define property, object is inextensible');
|
195
|
+
}
|
196
|
+
|
137
197
|
// bump size +1
|
138
198
|
const size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
|
139
199
|
Porffor.wasm.i32.store(_this, size + 1, 0, 0);
|
140
200
|
|
141
201
|
// entryPtr = current end of object
|
142
|
-
entryPtr = Porffor.wasm`local.get ${_this}` +
|
202
|
+
entryPtr = Porffor.wasm`local.get ${_this}` + 5 + size * 14;
|
143
203
|
|
144
204
|
// encode key type, set MSB if regular string
|
145
205
|
let keyEnc: i32 = Porffor.wasm`local.get ${key}`;
|
@@ -195,11 +255,12 @@ local.set ${err}`;
|
|
195
255
|
0, 12);
|
196
256
|
};
|
197
257
|
|
198
|
-
export const __Porffor_object_isEnumerable = (
|
199
|
-
const out: boolean = Porffor.wasm.i32.load8_u(
|
258
|
+
export const __Porffor_object_isEnumerable = (entryPtr: i32): boolean => {
|
259
|
+
const out: boolean = Porffor.wasm.i32.load8_u(entryPtr, 0, 12) & 0b0100;
|
200
260
|
return out;
|
201
261
|
};
|
202
262
|
|
263
|
+
|
203
264
|
export const __Porffor_object_isObject = (arg: any): boolean => {
|
204
265
|
const t: i32 = Porffor.wasm`local.get ${arg+1}`;
|
205
266
|
return Porffor.fastAnd(
|
@@ -21,7 +21,7 @@ export const __Object_keys = (obj: any): any[] => {
|
|
21
21
|
|
22
22
|
const t: i32 = Porffor.rawType(obj);
|
23
23
|
if (t == Porffor.TYPES.object) {
|
24
|
-
let ptr: i32 = Porffor.wasm`local.get ${obj}` +
|
24
|
+
let ptr: i32 = Porffor.wasm`local.get ${obj}` + 5;
|
25
25
|
const endPtr: i32 = ptr + Porffor.wasm.i32.load(obj, 0, 0) * 14;
|
26
26
|
|
27
27
|
let i: i32 = 0;
|
@@ -81,7 +81,7 @@ export const __Object_values = (obj: any): any[] => {
|
|
81
81
|
|
82
82
|
const t: i32 = Porffor.rawType(obj);
|
83
83
|
if (t == Porffor.TYPES.object) {
|
84
|
-
let ptr: i32 = Porffor.wasm`local.get ${obj}` +
|
84
|
+
let ptr: i32 = Porffor.wasm`local.get ${obj}` + 5;
|
85
85
|
const endPtr: i32 = ptr + Porffor.wasm.i32.load(obj, 0, 0) * 14;
|
86
86
|
|
87
87
|
let i: i32 = 0;
|
@@ -178,6 +178,7 @@ export const __Object_assign = (target: any, ...sources: any[]) => {
|
|
178
178
|
if (target == null) throw new TypeError('Argument is nullish, expected object');
|
179
179
|
|
180
180
|
for (const x of sources) {
|
181
|
+
// todo: switch to for..in once it supports non-pure-object
|
181
182
|
const keys: any[] = __Object_keys(x);
|
182
183
|
const vals: any[] = __Object_values(x);
|
183
184
|
|
@@ -294,6 +295,66 @@ export const __Object_create = (proto: any, props: any) => {
|
|
294
295
|
};
|
295
296
|
|
296
297
|
|
298
|
+
export const __Object_preventExtensions = (obj: any): any => {
|
299
|
+
// todo: support non-pure-objects
|
300
|
+
if (Porffor.rawType(obj) != Porffor.TYPES.object) {
|
301
|
+
return obj;
|
302
|
+
}
|
303
|
+
|
304
|
+
Porffor.object.preventExtensions(obj);
|
305
|
+
|
306
|
+
return obj;
|
307
|
+
};
|
308
|
+
|
309
|
+
export const __Object_isExtensible = (obj: any): any => {
|
310
|
+
if (!Porffor.object.isObject(obj)) {
|
311
|
+
return false;
|
312
|
+
}
|
313
|
+
|
314
|
+
// todo: support non-pure-objects
|
315
|
+
if (Porffor.rawType(obj) != Porffor.TYPES.object) {
|
316
|
+
return true;
|
317
|
+
}
|
318
|
+
|
319
|
+
return !Porffor.object.isInextensible(obj);
|
320
|
+
};
|
321
|
+
|
322
|
+
|
323
|
+
export const __Object_freeze = (obj: any): any => {
|
324
|
+
// todo: support non-pure-objects
|
325
|
+
if (Porffor.rawType(obj) != Porffor.TYPES.object) {
|
326
|
+
return obj;
|
327
|
+
}
|
328
|
+
|
329
|
+
// make inextensible
|
330
|
+
Porffor.object.preventExtensions(obj);
|
331
|
+
|
332
|
+
// make all properties non-configurable and non-writable (if data descriptor)
|
333
|
+
Porffor.object.overrideAllFlags(obj, 0b0000, 0b0101);
|
334
|
+
|
335
|
+
return obj;
|
336
|
+
};
|
337
|
+
|
338
|
+
export const __Object_isFrozen = (obj: any): any => {
|
339
|
+
if (!Porffor.object.isObject(obj)) {
|
340
|
+
return true;
|
341
|
+
}
|
342
|
+
|
343
|
+
// todo: support non-pure-objects
|
344
|
+
if (Porffor.rawType(obj) != Porffor.TYPES.object) {
|
345
|
+
return false;
|
346
|
+
}
|
347
|
+
|
348
|
+
// check obj is inextensible
|
349
|
+
if (!Porffor.object.isInextensible(obj)) {
|
350
|
+
return false;
|
351
|
+
}
|
352
|
+
|
353
|
+
// check all properties are non-configurable and non-writable (if data descriptor)
|
354
|
+
return Porffor.object.checkAllFlags(obj, 0b1010, 0b0010, 0, 0);
|
355
|
+
};
|
356
|
+
|
357
|
+
|
297
358
|
export const __Object_prototype_toString = (_this: object) => {
|
298
359
|
let out: bytestring = '[object Object]';
|
299
360
|
return out;
|
package/compiler/codegen.js
CHANGED
@@ -310,7 +310,7 @@ const generateIdent = (scope, decl) => {
|
|
310
310
|
if (builtinVars[name].floatOnly && valtype[0] === 'i') throw new Error(`Cannot use ${unhackName(name)} with integer valtype`);
|
311
311
|
|
312
312
|
let wasm = builtinVars[name];
|
313
|
-
if (typeof wasm === 'function') wasm = asmFuncToAsm(
|
313
|
+
if (typeof wasm === 'function') wasm = asmFuncToAsm(scope, wasm);
|
314
314
|
return wasm.slice();
|
315
315
|
}
|
316
316
|
|
@@ -3837,7 +3837,7 @@ const generateForIn = (scope, decl) => {
|
|
3837
3837
|
[ Opcodes.loop, Blocktype.void ],
|
3838
3838
|
|
3839
3839
|
[ Opcodes.local_get, pointer ],
|
3840
|
-
[ Opcodes.i32_load, 0,
|
3840
|
+
[ Opcodes.i32_load, 0, 5 ],
|
3841
3841
|
[ Opcodes.local_tee, localTmp(scope, '#forin_tmp', Valtype.i32) ],
|
3842
3842
|
|
3843
3843
|
...setType(scope, leftName, [
|
@@ -4326,7 +4326,7 @@ const makeArray = (scope, decl, global = false, name = '$undeclared', initEmpty
|
|
4326
4326
|
const firstAssign = !scope.arrays.has(uniqueName);
|
4327
4327
|
if (firstAssign) scope.arrays.set(uniqueName, rawPtr);
|
4328
4328
|
|
4329
|
-
const local = global ? globals[name] : scope.locals[name];
|
4329
|
+
const local = global ? globals[name] : scope.locals?.[name];
|
4330
4330
|
if (
|
4331
4331
|
Prefs.data && firstAssign && useRawElements &&
|
4332
4332
|
name !== '#member_prop' &&
|
@@ -2,8 +2,32 @@
|
|
2
2
|
import { number } from './embedding.js';
|
3
3
|
|
4
4
|
export const BuiltinFuncs = function() {
|
5
|
+
this.__Porffor_object_preventExtensions = {
|
6
|
+
wasm: (scope, {}) => [[32,0],[45,0,4],[34,2],[65,1],[114],[33,2],[32,0],[32,2],[58,0,4],[65,0],[65,128,1],[15]],
|
7
|
+
params: [127,127], typedParams: 1,
|
8
|
+
returns: [127,127], typedReturns: 1,
|
9
|
+
locals: [127], localNames: ["ptr","ptr#type","rootFlags"],
|
10
|
+
};
|
11
|
+
this.__Porffor_object_isInextensible = {
|
12
|
+
wasm: (scope, {}) => [[32,0],[45,0,4],[65,1],[113],[34,2],[65,2],[15]],
|
13
|
+
params: [127,127], typedParams: 1,
|
14
|
+
returns: [127,127], typedReturns: 1,
|
15
|
+
locals: [127], localNames: ["ptr","ptr#type","out"],
|
16
|
+
};
|
17
|
+
this.__Porffor_object_overrideAllFlags = {
|
18
|
+
wasm: (scope, {}) => [[32,0],[65,5],[106],[33,6],[32,0],[40,0,0],[33,7],[32,6],[32,7],[65,14],[108],[106],[33,8],[3,64],[32,6],[32,8],[72],[4,64],[32,6],[45,0,12],[34,9],[32,2],[114],[32,4],[113],[33,9],[32,6],[32,9],[58,0,12],[32,6],[65,14],[106],[34,6],[12,1],[11],[11],[65,0],[65,128,1],[15]],
|
19
|
+
params: [127,127,127,127,127,127], typedParams: 1,
|
20
|
+
returns: [127,127], typedReturns: 1,
|
21
|
+
locals: [127,127,127,127], localNames: ["_this","_this#type","overrideOr","overrideOr#type","overrideAnd","overrideAnd#type","ptr","size","endPtr","flags"],
|
22
|
+
};
|
23
|
+
this.__Porffor_object_checkAllFlags = {
|
24
|
+
wasm: (scope, {}) => [[32,0],[65,5],[106],[33,10],[32,0],[40,0,0],[33,11],[32,10],[32,11],[65,14],[108],[106],[33,12],[3,64],[32,10],[32,12],[72],[4,64],[32,10],[45,0,12],[34,13],[65,1],[113],[4,64],[32,13],[32,4],[113],[32,8],[71],[4,64],[65,0],[65,2],[15],[11],[5],[32,13],[32,2],[113],[32,6],[71],[4,64],[65,0],[65,2],[15],[11],[11],[32,10],[65,14],[106],[34,10],[12,1],[11],[11],[65,1],[65,2],[15]],
|
25
|
+
params: [127,127,127,127,127,127,127,127,127,127], typedParams: 1,
|
26
|
+
returns: [127,127], typedReturns: 1,
|
27
|
+
locals: [127,127,127,127], localNames: ["_this","_this#type","dataAnd","dataAnd#type","accessorAnd","accessorAnd#type","dataExpected","dataExpected#type","accessorExpected","accessorExpected#type","ptr","size","endPtr","flags"],
|
28
|
+
};
|
5
29
|
this.__Porffor_object_lookup = {
|
6
|
-
wasm: (scope, {}) => [[32,3],[33,4],[32,0],[65,
|
30
|
+
wasm: (scope, {}) => [[32,3],[33,4],[32,0],[65,5],[106],[33,5],[32,0],[40,0,0],[33,6],[32,5],[32,6],[65,14],[108],[106],[33,7],[32,4],[65,195,1],[70],[4,64],[32,2],[33,8],[3,64],[32,5],[32,7],[72],[4,64],[2,64],[32,5],[40,0,0],[34,9],[69],[4,64],[12,2],[11],[32,9],[65,31],[118],[4,64],[12,1],[11],[32,9],[34,10],[32,8],[33,13],[34,11],[32,13],[71],[4,127],[32,11],[40,0,0],[34,12],[32,13],[40,0,0],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,14],[32,12],[33,15],[3,64],[32,14],[32,11],[106],[45,0,4],[32,14],[32,13],[106],[45,0,4],[71],[4,64],[65,0],[12,2],[11],[32,14],[65,1],[106],[34,14],[32,15],[72],[13,0],[11],[65,1],[5],[65,1],[11],[4,64],[32,5],[65,1],[15],[11],[11],[32,5],[65,14],[106],[34,5],[12,1],[11],[11],[5],[32,2],[33,8],[3,64],[32,5],[32,7],[72],[4,64],[2,64],[32,5],[40,0,0],[34,9],[69],[4,64],[12,2],[11],[32,9],[65,31],[118],[4,64],[32,9],[65,255,255,255,255,7],[113],[34,10],[32,8],[33,13],[34,11],[32,13],[71],[4,127],[32,11],[40,0,0],[34,12],[32,13],[40,0,0],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,14],[32,12],[65,2],[108],[33,15],[3,64],[32,14],[32,11],[106],[47,0,4],[32,14],[32,13],[106],[47,0,4],[71],[4,64],[65,0],[12,2],[11],[32,14],[65,2],[106],[34,14],[32,15],[72],[13,0],[11],[65,1],[5],[65,1],[11],[4,64],[32,5],[65,1],[15],[11],[11],[11],[32,5],[65,14],[106],[34,5],[12,1],[11],[11],[11],[65,127],[65,1],[15]],
|
7
31
|
params: [127,127,127,127], typedParams: 1,
|
8
32
|
returns: [127,127], typedReturns: 1,
|
9
33
|
locals: [127,127,127,127,127,127,127,127,127,127,127,127], localNames: ["_this","_this#type","target","target#type","targetType","ptr","size","endPtr","targetStr","keyRaw","keyStr","compare_left_pointer","compare_left_length","compare_right_pointer","compare_index","compare_index_end"],
|
@@ -15,22 +39,22 @@ export const BuiltinFuncs = function() {
|
|
15
39
|
locals: [127,127,127], localNames: ["_this","_this#type","key","key#type","entryPtr","#last_type","tail"],
|
16
40
|
};
|
17
41
|
this.__Porffor_object_set = {
|
18
|
-
wasm: (scope, {builtin}) => [[32,0],[65,7],[32,2],[32,3],[16, ...builtin('__Porffor_object_lookup')],[26],[34,6],[65,127],[70],[4,64],[32,0],[40,0,0],[
|
42
|
+
wasm: (scope, {builtin}) => [[32,0],[65,7],[32,2],[32,3],[16, ...builtin('__Porffor_object_lookup')],[26],[34,6],[65,127],[70],[4,64],[32,0],[65,7],[16, ...builtin('__Porffor_object_isInextensible')],[33,7],[33,9],[32,7],[33,10],[2,127],[32,10],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,9],[40,1,0],[12,1],[11],[32,10],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,9],[40,1,0],[12,1],[11],[32,9],[11,"TYPESWITCH_end"],[4,64],[32,4],[32,5],[15],[11],[32,0],[40,0,0],[33,11],[32,0],[32,11],[65,1],[106],[54,0,0],[32,0],[65,5],[106],[32,11],[65,14],[108],[106],[33,6],[32,2],[33,12],[32,3],[65,195,0],[70],[4,64],[32,12],[65,128,128,128,128,120],[114],[33,12],[11],[32,6],[32,12],[54,0,0],[65,14],[33,8],[5],[32,6],[47,0,12],[34,13],[65,1],[113],[4,64],[32,4],[32,5],[15],[11],[32,13],[65,8],[113],[69],[4,64],[32,4],[32,5],[15],[11],[32,13],[65,255,1],[113],[33,8],[11],[32,6],[32,4],[57,0,4],[32,6],[32,8],[32,5],[65,8],[116],[106],[59,0,12],[32,4],[32,5],[15]],
|
19
43
|
params: [127,127,127,127,124,127], typedParams: 1,
|
20
44
|
returns: [124,127], typedReturns: 1,
|
21
|
-
locals: [127,127,127,127,127,127], localNames: ["_this","_this#type","key","key#type","value","value#type","entryPtr","#last_type","flags","size","keyEnc","tail"],
|
45
|
+
locals: [127,127,127,127,127,127,127,127], localNames: ["_this","_this#type","key","key#type","value","value#type","entryPtr","#last_type","flags","#logicinner_tmp","#typeswitch_tmp","size","keyEnc","tail"],
|
22
46
|
};
|
23
47
|
this.__Porffor_object_define = {
|
24
|
-
wasm: (scope, {builtin,internalThrow}) => [[32,0],[65,7],[32,2],[32,3],[16, ...builtin('__Porffor_object_lookup')],[26],[34,8],[65,127],[70],[4,64],[32,0],[40,0,0],[
|
48
|
+
wasm: (scope, {builtin,internalThrow}) => [[32,0],[65,7],[32,2],[32,3],[16, ...builtin('__Porffor_object_lookup')],[26],[34,8],[65,127],[70],[4,64],[32,0],[65,7],[16, ...builtin('__Porffor_object_isInextensible')],[33,9],[33,10],[32,9],[33,11],[2,127],[32,11],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,10],[40,1,0],[12,1],[11],[32,11],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,10],[40,1,0],[12,1],[11],[32,10],[11,"TYPESWITCH_end"],[4,64],...internalThrow(scope, 'TypeError', `Cannot define property, object is inextensible`),[11],[32,0],[40,0,0],[33,12],[32,0],[32,12],[65,1],[106],[54,0,0],[32,0],[65,5],[106],[32,12],[65,14],[108],[106],[33,8],[32,2],[33,13],[32,3],[65,195,0],[70],[4,64],[32,13],[65,128,128,128,128,120],[114],[33,13],[11],[32,8],[32,13],[54,0,0],[5],[32,8],[47,0,12],[34,14],[65,2],[113],[69],[4,64],[32,14],[65,15],[113],[32,6],[71],[4,64],[65,0],[33,15],[32,14],[65,7],[113],[32,6],[71],[4,64],[65,1],[33,15],[5],[32,14],[65,1],[113],[69],[34,16],[4,127],[32,14],[65,8],[113],[69],[65,2],[33,9],[5],[32,16],[65,2],[33,9],[11],[33,10],[32,9],[33,11],[2,127],[32,11],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,10],[40,1,0],[12,1],[11],[32,11],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,10],[40,1,0],[12,1],[11],[32,10],[11,"TYPESWITCH_end"],[4,64],[32,6],[65,8],[113],[4,64],[65,1],[33,15],[5],[32,8],[43,0,4],[32,4],[98],[32,8],[45,0,13],[32,5],[71],[114],[33,15],[11],[11],[11],[32,15],[4,64],...internalThrow(scope, 'TypeError', `Cannot redefine property`),[11],[11],[11],[11],[32,8],[32,4],[57,0,4],[32,8],[32,6],[32,5],[65,8],[116],[106],[59,0,12],[65,0],[65,128,1],[15]],
|
25
49
|
params: [127,127,127,127,124,127,127,127], typedParams: 1,
|
26
50
|
returns: [127,127], typedReturns: 1,
|
27
|
-
locals: [127,127,127,127,127,127,127,127,127], localNames: ["_this","_this#type","key","key#type","value","value#type","flags","flags#type","entryPtr","#last_type","
|
51
|
+
locals: [127,127,127,127,127,127,127,127,127], localNames: ["_this","_this#type","key","key#type","value","value#type","flags","flags#type","entryPtr","#last_type","#logicinner_tmp","#typeswitch_tmp","size","keyEnc","tail","err","logictmp"],
|
28
52
|
};
|
29
53
|
this.__Porffor_object_isEnumerable = {
|
30
54
|
wasm: (scope, {}) => [[32,0],[45,0,12],[65,4],[113],[34,2],[65,2],[15]],
|
31
55
|
params: [127,127], typedParams: 1,
|
32
56
|
returns: [127,127], typedReturns: 1,
|
33
|
-
locals: [127], localNames: ["
|
57
|
+
locals: [127], localNames: ["entryPtr","entryPtr#type","out"],
|
34
58
|
};
|
35
59
|
this.__Porffor_object_isObject = {
|
36
60
|
wasm: (scope, {}) => [[32,1],[33,2],[32,0],[65,0],[71],[32,2],[65,5],[74],[113],[32,2],[65,128,1],[71],[113],[32,2],[65,195,0],[71],[113],[32,2],[65,195,1],[71],[113],[65,2],[15]],
|
@@ -1647,13 +1671,13 @@ export const BuiltinFuncs = function() {
|
|
1647
1671
|
constr: 1,
|
1648
1672
|
};
|
1649
1673
|
this.__Object_keys = {
|
1650
|
-
wasm: (scope, {builtin,internalThrow}) => [[32,0],[33,2],[32,1],[33,3],[2,127],[32,3],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,2],[68,0,0,0,0,0,0,0,0],[97],[12,1],[11],[32,3],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],[65,1],[12,1],[11],[65,0],[11,"TYPESWITCH_end"],[4,64],...internalThrow(scope, 'TypeError', `Argument is nullish, expected object`),[11],[16, ...builtin('__Porffor_allocate')],[183],[33,4],[32,0],[32,1],[16, ...builtin('__Porffor_rawType')],[34,5],[68,0,0,0,0,0,0,28,64],[97],[4,64],[32,0],[68,0,0,0,0,0,0,
|
1674
|
+
wasm: (scope, {builtin,internalThrow}) => [[32,0],[33,2],[32,1],[33,3],[2,127],[32,3],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,2],[68,0,0,0,0,0,0,0,0],[97],[12,1],[11],[32,3],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],[65,1],[12,1],[11],[65,0],[11,"TYPESWITCH_end"],[4,64],...internalThrow(scope, 'TypeError', `Argument is nullish, expected object`),[11],[16, ...builtin('__Porffor_allocate')],[183],[33,4],[32,0],[32,1],[16, ...builtin('__Porffor_rawType')],[34,5],[68,0,0,0,0,0,0,28,64],[97],[4,64],[32,0],[68,0,0,0,0,0,0,20,64],[160],[34,6],[32,0],[252,2],[40,0,0],[183],[68,0,0,0,0,0,0,44,64],[162],[160],[33,7],[68,0,0,0,0,0,0,0,0],[33,8],[3,64],[32,6],[32,7],[99],[4,64],[2,64],[32,6],[252,2],[65,1],[16, ...builtin('__Porffor_object_isEnumerable')],[33,9],[183],[33,2],[32,9],[33,3],[2,124],[32,3],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,2],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,3],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,2],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,2],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],[12,1],[11],[32,6],[252,3],[40,0,0],[34,12],[65,31],[118],[4,127],[65,195,0],[33,11],[32,12],[65,255,255,255,255,7],[113],[5],[65,195,1],[33,11],[32,12],[11],[184],[33,10],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,14],[32,10],[34,13],[57,0,4],[32,14],[32,11],[58,0,12],[11],[32,6],[68,0,0,0,0,0,0,44,64],[160],[34,6],[12,1],[11],[11],[32,4],[252,3],[32,8],[34,16],[252,3],[54,1,0],[5],[32,5],[68,0,0,0,0,0,0,84,64],[97],[32,5],[68,0,0,0,0,0,96,104,64],[97],[114],[32,5],[68,0,0,0,0,0,192,80,64],[97],[114],[4,64],[32,0],[252,3],[40,1,0],[184],[33,17],[32,4],[252,3],[32,17],[34,16],[252,3],[54,1,0],[68,0,0,0,0,0,0,0,0],[33,8],[3,64],[32,8],[32,17],[99],[4,64],[32,4],[252,3],[32,8],[252,3],[65,9],[108],[106],[34,14],[32,8],[65,1],[68,0,0,0,0,0,0,0,0],[65,128,1],[16, ...builtin('__Number_prototype_toString')],[33,9],[34,13],[57,0,4],[32,14],[32,9],[58,0,12],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[12,1],[11],[11],[11],[11],[32,4],[65,208,0],[15]],
|
1651
1675
|
params: [124,127], typedParams: 1,
|
1652
1676
|
returns: [124,127], typedReturns: 1,
|
1653
1677
|
locals: [124,127,124,124,124,124,124,127,124,127,127,124,127,127,124,124], localNames: ["obj","obj#type","#logicinner_tmp","#typeswitch_tmp","out","t","ptr","endPtr","i","#last_type","key","key#type","raw","#member_setter_val_tmp","#member_setter_ptr_tmp","#swap","__length_setter_tmp","len"],
|
1654
1678
|
};
|
1655
1679
|
this.__Object_values = {
|
1656
|
-
wasm: (scope, {builtin,internalThrow}) => [[32,0],[33,2],[32,1],[33,3],[2,127],[32,3],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,2],[68,0,0,0,0,0,0,0,0],[97],[12,1],[11],[32,3],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],[65,1],[12,1],[11],[65,0],[11,"TYPESWITCH_end"],[4,64],...internalThrow(scope, 'TypeError', `Argument is nullish, expected object`),[11],[16, ...builtin('__Porffor_allocate')],[183],[33,4],[32,0],[32,1],[16, ...builtin('__Porffor_rawType')],[34,5],[68,0,0,0,0,0,0,28,64],[97],[4,64],[32,0],[68,0,0,0,0,0,0,
|
1680
|
+
wasm: (scope, {builtin,internalThrow}) => [[32,0],[33,2],[32,1],[33,3],[2,127],[32,3],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,2],[68,0,0,0,0,0,0,0,0],[97],[12,1],[11],[32,3],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],[65,1],[12,1],[11],[65,0],[11,"TYPESWITCH_end"],[4,64],...internalThrow(scope, 'TypeError', `Argument is nullish, expected object`),[11],[16, ...builtin('__Porffor_allocate')],[183],[33,4],[32,0],[32,1],[16, ...builtin('__Porffor_rawType')],[34,5],[68,0,0,0,0,0,0,28,64],[97],[4,64],[32,0],[68,0,0,0,0,0,0,20,64],[160],[34,6],[32,0],[252,2],[40,0,0],[183],[68,0,0,0,0,0,0,44,64],[162],[160],[33,7],[68,0,0,0,0,0,0,0,0],[33,8],[3,64],[32,6],[32,7],[99],[4,64],[2,64],[32,6],[252,2],[65,1],[16, ...builtin('__Porffor_object_isEnumerable')],[33,9],[183],[33,2],[32,9],[33,3],[2,124],[32,3],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,2],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,3],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,2],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,2],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],[12,1],[11],[32,6],[252,3],[34,12],[43,0,4],[33,10],[32,12],[45,0,13],[33,11],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,14],[32,10],[34,13],[57,0,4],[32,14],[32,11],[58,0,12],[11],[32,6],[68,0,0,0,0,0,0,44,64],[160],[34,6],[12,1],[11],[11],[32,4],[252,3],[32,8],[34,16],[252,3],[54,1,0],[5],[32,5],[68,0,0,0,0,0,0,84,64],[97],[32,5],[68,0,0,0,0,0,96,104,64],[97],[114],[32,5],[68,0,0,0,0,0,192,80,64],[97],[114],[4,64],[32,0],[252,3],[40,1,0],[184],[33,17],[32,4],[252,3],[32,17],[34,16],[252,3],[54,1,0],[68,0,0,0,0,0,0,0,0],[33,8],[3,64],[32,8],[32,17],[99],[4,64],[2,64],[32,4],[252,3],[32,8],[252,3],[65,9],[108],[106],[34,14],[32,0],[33,18],[32,8],[33,19],[32,1],[33,3],[2,124],[32,3],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,18],[252,3],[32,1],[32,19],[65,1],[16, ...builtin('__ecma262_ToPropertyKey')],[33,15],[252,3],[32,15],[16, ...builtin('__Porffor_object_get')],[33,9],[12,1],[11],[32,3],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[65,0],[65,1],[54,0,0],[65,0],[32,19],[252,3],[65,2],[108],[32,18],[252,3],[106],[47,0,4],[59,0,4],[68,0,0,0,0,0,0,0,0],[65,195,0],[33,9],[12,1],[11],[32,3],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,19],[252,3],[65,9],[108],[32,18],[252,3],[106],[34,20],[43,0,4],[32,20],[45,0,12],[33,9],[12,1],[11],[32,3],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,18],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,9],[12,1],[11],[32,3],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,18],[252,3],[40,0,4],[32,19],[252,3],[106],[44,0,4],[183],[65,1],[33,9],[12,1],[11],[32,3],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,18],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,9],[12,1],[11],[32,3],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,18],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,9],[12,1],[11],[32,3],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,18],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,9],[12,1],[11],[32,3],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,18],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,9],[12,1],[11],[32,3],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,18],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,9],[12,1],[11],[32,3],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,18],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,9],[12,1],[11],[32,3],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,18],[252,3],[40,0,4],[32,19],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,9],[12,1],[11],[32,3],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[65,0],[65,1],[54,0,0],[65,0],[32,19],[252,3],[32,18],[252,3],[106],[45,0,4],[58,0,4],[68,0,0,0,0,0,0,0,0],[65,195,1],[33,9],[12,1],[11],...internalThrow(scope, 'TypeError', `Unsupported member expression object`),[68,0,0,0,0,0,0,0,0],[11,"TYPESWITCH_end"],[34,13],[57,0,4],[32,14],[32,9],[58,0,12],[11],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[12,1],[11],[11],[11],[11],[32,4],[65,208,0],[15]],
|
1657
1681
|
params: [124,127], typedParams: 1,
|
1658
1682
|
returns: [124,127], typedReturns: 1,
|
1659
1683
|
locals: [124,127,124,124,124,124,124,127,124,127,127,124,127,127,124,124,124,124,127], localNames: ["obj","obj#type","#logicinner_tmp","#typeswitch_tmp","out","t","ptr","endPtr","i","#last_type","val","val#type","ptr32","#member_setter_val_tmp","#member_setter_ptr_tmp","#swap","__length_setter_tmp","len","#member_obj","#member_prop","#loadArray_offset"],
|
@@ -1696,7 +1720,7 @@ export const BuiltinFuncs = function() {
|
|
1696
1720
|
locals: [127,124,127,124,127,124,124,127,124,124,127,127,127,124,127,124,127,124,127,124,127,124,127,124,127,124], localNames: ["target","target#type","prop","prop#type","descriptor","descriptor#type","#last_type","#logicinner_tmp","#typeswitch_tmp","p","p#type","desc","configurable","configurable#type","#member_obj","#member_prop","#loadArray_offset","#swap","#makearray_pointer_tmp","enumerable","enumerable#type","value","value#type","writable","writable#type","get","get#type","set","set#type","accessor","logictmpi","flags"],
|
1697
1721
|
};
|
1698
1722
|
this.__Object_defineProperties = {
|
1699
|
-
wasm: (scope, {builtin,internalThrow}) => [[32,0],[252,2],[32,1],[16, ...builtin('__Porffor_object_isObject')],[33,4],[183],[33,5],[32,4],[33,6],[2,124],[32,6],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,5],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,6],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,5],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,5],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],...internalThrow(scope, 'TypeError', `Target is a non-object`),[11],[32,2],[252,2],[32,3],[16, ...builtin('__Porffor_object_isObjectOrSymbol')],[33,4],[183],[33,5],[32,4],[33,6],[2,124],[32,6],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,5],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,6],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,5],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,5],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],...internalThrow(scope, 'TypeError', `Props needs to be an object or symbol`),[11],[32,2],[252,3],[33,7],[65,0],[33,9],[32,7],[40,1,0],[34,8],[4,64],[32,3],[33,6],[2,64],[32,6],[65,7],[70],[4,64,"TYPESWITCH|Object"],[3,64],[32,7],[40,0,
|
1723
|
+
wasm: (scope, {builtin,internalThrow}) => [[32,0],[252,2],[32,1],[16, ...builtin('__Porffor_object_isObject')],[33,4],[183],[33,5],[32,4],[33,6],[2,124],[32,6],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,5],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,6],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,5],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,5],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],...internalThrow(scope, 'TypeError', `Target is a non-object`),[11],[32,2],[252,2],[32,3],[16, ...builtin('__Porffor_object_isObjectOrSymbol')],[33,4],[183],[33,5],[32,4],[33,6],[2,124],[32,6],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,5],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,6],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,5],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,5],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],...internalThrow(scope, 'TypeError', `Props needs to be an object or symbol`),[11],[32,2],[252,3],[33,7],[65,0],[33,9],[32,7],[40,1,0],[34,8],[4,64],[32,3],[33,6],[2,64],[32,6],[65,7],[70],[4,64,"TYPESWITCH|Object"],[3,64],[32,7],[40,0,5],[34,12],[65,31],[118],[4,127],[32,12],[65,255,255,255,255,7],[113],[33,12],[65,67],[5],[65,195,1],[11],[33,11],[32,12],[184],[33,10],[2,64],[2,64],[32,0],[32,1],[32,10],[32,11],[32,2],[33,13],[32,10],[33,14],[32,3],[33,6],[2,124],[32,6],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,13],[252,3],[32,3],[32,14],[32,11],[16, ...builtin('__ecma262_ToPropertyKey')],[33,16],[252,3],[32,16],[16, ...builtin('__Porffor_object_get')],[33,4],[12,1],[11],[32,6],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[65,128,128,4],[65,1],[54,0,0],[65,128,128,4],[32,14],[252,3],[65,2],[108],[32,13],[252,3],[106],[47,0,4],[59,0,4],[68,0,0,0,0,0,0,240,64],[65,195,0],[33,4],[12,1],[11],[32,6],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,14],[252,3],[65,9],[108],[32,13],[252,3],[106],[34,15],[43,0,4],[32,15],[45,0,12],[33,4],[12,1],[11],[32,6],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[106],[45,0,4],[184],[65,1],[33,4],[12,1],[11],[32,6],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[106],[44,0,4],[183],[65,1],[33,4],[12,1],[11],[32,6],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[106],[45,0,4],[184],[65,1],[33,4],[12,1],[11],[32,6],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,4],[12,1],[11],[32,6],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,4],[12,1],[11],[32,6],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,4],[12,1],[11],[32,6],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,4],[12,1],[11],[32,6],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,4],[12,1],[11],[32,6],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,4],[12,1],[11],[32,6],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[65,128,128,4],[65,1],[54,0,0],[65,128,128,4],[32,14],[252,3],[32,13],[252,3],[106],[45,0,4],[58,0,4],[68,0,0,0,0,0,0,240,64],[65,195,1],[33,4],[12,1],[11],...internalThrow(scope, 'TypeError', `Unsupported member expression object`),[68,0,0,0,0,0,0,0,0],[11,"TYPESWITCH_end"],[32,4],[16, ...builtin('__Object_defineProperty')],[33,4],[26],[11],[32,7],[65,14],[106],[33,7],[32,9],[65,1],[106],[34,9],[32,8],[71],[13,1],[11],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `Tried for..in on unsupported type`),[11,"TYPESWITCH_end"],[11],[32,0],[32,1],[15]],
|
1700
1724
|
params: [124,127,124,127], typedParams: 1,
|
1701
1725
|
returns: [124,127], typedReturns: 1,
|
1702
1726
|
locals: [127,124,127,127,127,127,124,127,127,124,124,127,127], localNames: ["target","target#type","props","props#type","#last_type","#logicinner_tmp","#typeswitch_tmp","#forin_base_pointer","#forin_length","#forin_counter","x","x#type","#forin_tmp","#member_obj","#member_prop","#loadArray_offset","#swap"],
|
@@ -1719,6 +1743,30 @@ export const BuiltinFuncs = function() {
|
|
1719
1743
|
returns: [124,127], typedReturns: 1,
|
1720
1744
|
locals: [127,124,127,124], localNames: ["proto","proto#type","props","props#type","#last_type","#logicinner_tmp","#typeswitch_tmp","out"],
|
1721
1745
|
};
|
1746
|
+
this.__Object_preventExtensions = {
|
1747
|
+
wasm: (scope, {builtin}) => [[32,0],[32,1],[16, ...builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,28,64],[98],[4,64],[32,0],[32,1],[15],[11],[32,0],[252,2],[32,1],[16, ...builtin('__Porffor_object_preventExtensions')],[26],[183],[26],[32,0],[32,1],[15]],
|
1748
|
+
params: [124,127], typedParams: 1,
|
1749
|
+
returns: [124,127], typedReturns: 1,
|
1750
|
+
locals: [127], localNames: ["obj","obj#type","#last_type"],
|
1751
|
+
};
|
1752
|
+
this.__Object_isExtensible = {
|
1753
|
+
wasm: (scope, {builtin}) => [[32,0],[252,2],[32,1],[16, ...builtin('__Porffor_object_isObject')],[33,2],[183],[33,3],[32,2],[33,4],[2,124],[32,4],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,3],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,4],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,3],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,3],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[65,2],[15],[11],[32,0],[32,1],[16, ...builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,28,64],[98],[4,64],[68,0,0,0,0,0,0,240,63],[65,2],[15],[11],[32,0],[252,2],[32,1],[16, ...builtin('__Porffor_object_isInextensible')],[33,2],[183],[33,3],[32,2],[33,4],[2,124],[32,4],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,3],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,4],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,3],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,3],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[65,2],[15]],
|
1754
|
+
params: [124,127], typedParams: 1,
|
1755
|
+
returns: [124,127], typedReturns: 1,
|
1756
|
+
locals: [127,124,127], localNames: ["obj","obj#type","#last_type","#logicinner_tmp","#typeswitch_tmp"],
|
1757
|
+
};
|
1758
|
+
this.__Object_freeze = {
|
1759
|
+
wasm: (scope, {builtin}) => [[32,0],[32,1],[16, ...builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,28,64],[98],[4,64],[32,0],[32,1],[15],[11],[32,0],[252,2],[32,1],[16, ...builtin('__Porffor_object_preventExtensions')],[26],[183],[26],[32,0],[252,2],[32,1],[65,0],[65,1],[65,5],[65,1],[16, ...builtin('__Porffor_object_overrideAllFlags')],[26],[183],[26],[32,0],[32,1],[15]],
|
1760
|
+
params: [124,127], typedParams: 1,
|
1761
|
+
returns: [124,127], typedReturns: 1,
|
1762
|
+
locals: [127], localNames: ["obj","obj#type","#last_type"],
|
1763
|
+
};
|
1764
|
+
this.__Object_isFrozen = {
|
1765
|
+
wasm: (scope, {builtin}) => [[32,0],[252,2],[32,1],[16, ...builtin('__Porffor_object_isObject')],[33,2],[183],[33,3],[32,2],[33,4],[2,124],[32,4],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,3],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,4],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,3],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,3],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],[68,0,0,0,0,0,0,240,63],[65,2],[15],[11],[32,0],[32,1],[16, ...builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,28,64],[98],[4,64],[68,0,0,0,0,0,0,0,0],[65,2],[15],[11],[32,0],[252,2],[32,1],[16, ...builtin('__Porffor_object_isInextensible')],[33,2],[183],[33,3],[32,2],[33,4],[2,124],[32,4],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,3],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,4],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,3],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,3],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[65,2],[15],[11],[32,0],[252,2],[32,1],[65,10],[65,1],[65,2],[65,1],[65,0],[65,1],[65,0],[65,1],[16, ...builtin('__Porffor_object_checkAllFlags')],[33,2],[183],[32,2],[15]],
|
1766
|
+
params: [124,127], typedParams: 1,
|
1767
|
+
returns: [124,127], typedReturns: 1,
|
1768
|
+
locals: [127,124,127], localNames: ["obj","obj#type","#last_type","#logicinner_tmp","#typeswitch_tmp"],
|
1769
|
+
};
|
1722
1770
|
this.__Object_prototype_toString = {
|
1723
1771
|
wasm: (scope, {allocPage}) => [...number(allocPage(scope, 'bytestring: __Object_prototype_toString/out', 'i8') * pageSize, 124),[34,2],[65,195,1],[15]],
|
1724
1772
|
params: [124,127], typedParams: 1,
|
package/compiler/wrap.js
CHANGED
@@ -49,7 +49,7 @@ const porfToJSValue = ({ memory, funcs, pages }, value, type) => {
|
|
49
49
|
|
50
50
|
const out = {};
|
51
51
|
for (let i = 0; i < size; i++) {
|
52
|
-
const offset =
|
52
|
+
const offset = 5 + (i * 14);
|
53
53
|
|
54
54
|
const kRaw = read(Uint32Array, memory, value + offset, 1)[0];
|
55
55
|
const kType = kRaw >>> 31 ? TYPES.string : TYPES.bytestring;
|
package/package.json
CHANGED
package/runner/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
2
|
import fs from 'node:fs';
|
3
|
-
globalThis.version = '0.21.
|
3
|
+
globalThis.version = '0.21.6+e77e4f0cb';
|
4
4
|
|
5
5
|
// deno compat
|
6
6
|
if (typeof process === 'undefined' && typeof Deno !== 'undefined') {
|
@@ -62,6 +62,12 @@ if (process.argv.includes('--help')) {
|
|
62
62
|
process.exit(0);
|
63
63
|
}
|
64
64
|
|
65
|
+
const done = async () => {
|
66
|
+
// do nothing for the rest of this file
|
67
|
+
await new Promise(res => process.on('beforeExit', res));
|
68
|
+
process.exit();
|
69
|
+
};
|
70
|
+
|
65
71
|
let file = process.argv.slice(2).find(x => x[0] !== '-');
|
66
72
|
if (['precompile', 'run', 'wasm', 'native', 'c', 'profile', 'debug', 'debug-wasm'].includes(file)) {
|
67
73
|
// remove this arg
|
@@ -69,17 +75,17 @@ if (['precompile', 'run', 'wasm', 'native', 'c', 'profile', 'debug', 'debug-wasm
|
|
69
75
|
|
70
76
|
if (file === 'precompile') {
|
71
77
|
await import('../compiler/precompile.js');
|
72
|
-
await
|
78
|
+
await done();
|
73
79
|
}
|
74
80
|
|
75
81
|
if (file === 'profile') {
|
76
82
|
await import('./profile.js');
|
77
|
-
await
|
83
|
+
await done();
|
78
84
|
}
|
79
85
|
|
80
86
|
if (file === 'debug') {
|
81
87
|
await import('./debug.js');
|
82
|
-
await
|
88
|
+
await done();
|
83
89
|
}
|
84
90
|
|
85
91
|
if (['wasm', 'native', 'c'].includes(file)) {
|
@@ -109,7 +115,7 @@ if (!file) {
|
|
109
115
|
|
110
116
|
// run repl if no file given
|
111
117
|
await import('./repl.js');
|
112
|
-
await
|
118
|
+
await done();
|
113
119
|
}
|
114
120
|
|
115
121
|
const source = fs.readFileSync(file, 'utf8');
|