porffor 0.21.4 → 0.21.5
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.
@@ -1,22 +1,37 @@
|
|
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
|
+
|
15
30
|
|
16
31
|
export const __Porffor_object_lookup = (_this: object, target: any): i32 => {
|
17
32
|
const targetType: i32 = Porffor.wasm`local.get ${target+1}`;
|
18
33
|
|
19
|
-
let ptr: i32 = Porffor.wasm`local.get ${_this}` +
|
34
|
+
let ptr: i32 = Porffor.wasm`local.get ${_this}` + 5;
|
20
35
|
|
21
36
|
const size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
|
22
37
|
const endPtr: i32 = ptr + size * 14;
|
@@ -82,12 +97,17 @@ export const __Porffor_object_set = (_this: object, key: any, value: any): any =
|
|
82
97
|
let flags: i32;
|
83
98
|
if (entryPtr == -1) {
|
84
99
|
// add new entry
|
100
|
+
// check if object is inextensible
|
101
|
+
if (__Porffor_object_isInextensible(_this)) {
|
102
|
+
return value;
|
103
|
+
}
|
104
|
+
|
85
105
|
// bump size +1
|
86
106
|
const size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
|
87
107
|
Porffor.wasm.i32.store(_this, size + 1, 0, 0);
|
88
108
|
|
89
109
|
// entryPtr = current end of object
|
90
|
-
entryPtr = Porffor.wasm`local.get ${_this}` +
|
110
|
+
entryPtr = Porffor.wasm`local.get ${_this}` + 5 + size * 14;
|
91
111
|
|
92
112
|
// encode key type, set MSB if regular string
|
93
113
|
let keyEnc: i32 = Porffor.wasm`local.get ${key}`;
|
@@ -134,12 +154,17 @@ export const __Porffor_object_define = (_this: object, key: any, value: any, fla
|
|
134
154
|
let entryPtr: i32 = __Porffor_object_lookup(_this, key);
|
135
155
|
if (entryPtr == -1) {
|
136
156
|
// add new entry
|
157
|
+
// check if object is inextensible
|
158
|
+
if (__Porffor_object_isInextensible(_this)) {
|
159
|
+
throw new TypeError('Cannot define property, object is inextensible');
|
160
|
+
}
|
161
|
+
|
137
162
|
// bump size +1
|
138
163
|
const size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
|
139
164
|
Porffor.wasm.i32.store(_this, size + 1, 0, 0);
|
140
165
|
|
141
166
|
// entryPtr = current end of object
|
142
|
-
entryPtr = Porffor.wasm`local.get ${_this}` +
|
167
|
+
entryPtr = Porffor.wasm`local.get ${_this}` + 5 + size * 14;
|
143
168
|
|
144
169
|
// encode key type, set MSB if regular string
|
145
170
|
let keyEnc: i32 = Porffor.wasm`local.get ${key}`;
|
@@ -195,11 +220,12 @@ local.set ${err}`;
|
|
195
220
|
0, 12);
|
196
221
|
};
|
197
222
|
|
198
|
-
export const __Porffor_object_isEnumerable = (
|
199
|
-
const out: boolean = Porffor.wasm.i32.load8_u(
|
223
|
+
export const __Porffor_object_isEnumerable = (entryPtr: i32): boolean => {
|
224
|
+
const out: boolean = Porffor.wasm.i32.load8_u(entryPtr, 0, 12) & 0b0100;
|
200
225
|
return out;
|
201
226
|
};
|
202
227
|
|
228
|
+
|
203
229
|
export const __Porffor_object_isObject = (arg: any): boolean => {
|
204
230
|
const t: i32 = Porffor.wasm`local.get ${arg+1}`;
|
205
231
|
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,30 @@ 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
|
+
|
297
322
|
export const __Object_prototype_toString = (_this: object) => {
|
298
323
|
let out: bytestring = '[object Object]';
|
299
324
|
return out;
|
package/compiler/codegen.js
CHANGED
@@ -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, [
|
@@ -2,8 +2,20 @@
|
|
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
|
+
};
|
5
17
|
this.__Porffor_object_lookup = {
|
6
|
-
wasm: (scope, {}) => [[32,3],[33,4],[32,0],[65,
|
18
|
+
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
19
|
params: [127,127,127,127], typedParams: 1,
|
8
20
|
returns: [127,127], typedReturns: 1,
|
9
21
|
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 +27,22 @@ export const BuiltinFuncs = function() {
|
|
15
27
|
locals: [127,127,127], localNames: ["_this","_this#type","key","key#type","entryPtr","#last_type","tail"],
|
16
28
|
};
|
17
29
|
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],[
|
30
|
+
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
31
|
params: [127,127,127,127,124,127], typedParams: 1,
|
20
32
|
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"],
|
33
|
+
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
34
|
};
|
23
35
|
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],[
|
36
|
+
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
37
|
params: [127,127,127,127,124,127,127,127], typedParams: 1,
|
26
38
|
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","
|
39
|
+
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
40
|
};
|
29
41
|
this.__Porffor_object_isEnumerable = {
|
30
42
|
wasm: (scope, {}) => [[32,0],[45,0,12],[65,4],[113],[34,2],[65,2],[15]],
|
31
43
|
params: [127,127], typedParams: 1,
|
32
44
|
returns: [127,127], typedReturns: 1,
|
33
|
-
locals: [127], localNames: ["
|
45
|
+
locals: [127], localNames: ["entryPtr","entryPtr#type","out"],
|
34
46
|
};
|
35
47
|
this.__Porffor_object_isObject = {
|
36
48
|
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 +1659,13 @@ export const BuiltinFuncs = function() {
|
|
1647
1659
|
constr: 1,
|
1648
1660
|
};
|
1649
1661
|
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,
|
1662
|
+
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
1663
|
params: [124,127], typedParams: 1,
|
1652
1664
|
returns: [124,127], typedReturns: 1,
|
1653
1665
|
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
1666
|
};
|
1655
1667
|
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,
|
1668
|
+
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
1669
|
params: [124,127], typedParams: 1,
|
1658
1670
|
returns: [124,127], typedReturns: 1,
|
1659
1671
|
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 +1708,7 @@ export const BuiltinFuncs = function() {
|
|
1696
1708
|
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
1709
|
};
|
1698
1710
|
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,
|
1711
|
+
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
1712
|
params: [124,127,124,127], typedParams: 1,
|
1701
1713
|
returns: [124,127], typedReturns: 1,
|
1702
1714
|
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 +1731,18 @@ export const BuiltinFuncs = function() {
|
|
1719
1731
|
returns: [124,127], typedReturns: 1,
|
1720
1732
|
locals: [127,124,127,124], localNames: ["proto","proto#type","props","props#type","#last_type","#logicinner_tmp","#typeswitch_tmp","out"],
|
1721
1733
|
};
|
1734
|
+
this.__Object_preventExtensions = {
|
1735
|
+
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]],
|
1736
|
+
params: [124,127], typedParams: 1,
|
1737
|
+
returns: [124,127], typedReturns: 1,
|
1738
|
+
locals: [127], localNames: ["obj","obj#type","#last_type"],
|
1739
|
+
};
|
1740
|
+
this.__Object_isExtensible = {
|
1741
|
+
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]],
|
1742
|
+
params: [124,127], typedParams: 1,
|
1743
|
+
returns: [124,127], typedReturns: 1,
|
1744
|
+
locals: [127,124,127], localNames: ["obj","obj#type","#last_type","#logicinner_tmp","#typeswitch_tmp"],
|
1745
|
+
};
|
1722
1746
|
this.__Object_prototype_toString = {
|
1723
1747
|
wasm: (scope, {allocPage}) => [...number(allocPage(scope, 'bytestring: __Object_prototype_toString/out', 'i8') * pageSize, 124),[34,2],[65,195,1],[15]],
|
1724
1748
|
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