porffor 0.22.8 → 0.22.9

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.
@@ -62,8 +62,7 @@ export const __Porffor_object_checkAllFlags = (_this: object, dataAnd: i32, acce
62
62
  return true;
63
63
  };
64
64
 
65
-
66
- export const __Porffor_object_packAccessor = (get: i32, set: i32): f64 => {
65
+ export const __Porffor_object_packAccessor = (get: any, set: any): f64 => {
67
66
  // pack i32s get & set into a single f64 (i64)
68
67
  Porffor.wasm`
69
68
  local.get ${set}
@@ -81,11 +80,23 @@ return`;
81
80
 
82
81
  export const __Porffor_object_accessorGet = (entryPtr: i32): Function => {
83
82
  const out: Function = Porffor.wasm.i32.load(entryPtr, 0, 4);
83
+
84
+ // no get accessor, return undefined
85
+ if (Porffor.wasm`local.get ${out}` == 0) {
86
+ return undefined;
87
+ }
88
+
84
89
  return out;
85
90
  };
86
91
 
87
92
  export const __Porffor_object_accessorSet = (entryPtr: i32): Function => {
88
93
  const out: Function = Porffor.wasm.i32.load(entryPtr, 0, 8);
94
+
95
+ // no set accessor, return undefined
96
+ if (Porffor.wasm`local.get ${out}` == 0) {
97
+ return undefined;
98
+ }
99
+
89
100
  return out;
90
101
  };
91
102
 
@@ -148,6 +159,15 @@ return`;
148
159
  if (tail & 0b0001) {
149
160
  // accessor descriptor
150
161
  const get: Function = __Porffor_object_accessorGet(entryPtr);
162
+
163
+ // no get accessor, return undefined
164
+ if (Porffor.wasm`local.get ${get}` == 0) {
165
+ Porffor.wasm`
166
+ f64.const 0
167
+ i32.const 128
168
+ return`;
169
+ }
170
+
151
171
  Porffor.wasm`
152
172
  local.get ${get}
153
173
  call_indirect 0 0
@@ -205,7 +225,13 @@ export const __Porffor_object_set = (_this: object, key: any, value: any): any =
205
225
  if (tail & 0b0001) {
206
226
  // accessor descriptor
207
227
  const set: Function = __Porffor_object_accessorSet(entryPtr);
208
- Porffor.wasm`
228
+
229
+ // no get accessor, return early
230
+ if (Porffor.wasm`local.get ${set}` == 0) {
231
+ return value;
232
+ }
233
+
234
+ Porffor.wasm`
209
235
  local.get ${value}
210
236
  local.get ${value+1}
211
237
  local.get ${set}
@@ -33,13 +33,13 @@ export const BuiltinFuncs = function() {
33
33
  locals: [], localNames: ["get","get#type","set","set#type"],
34
34
  };
35
35
  this.__Porffor_object_accessorGet = {
36
- wasm: (scope, {}) => [[32,0],[40,0,4],[34,2],[65,6],[15]],
36
+ wasm: (scope, {}) => [[32,0],[40,0,4],[34,2],[69],[4,64],[65,0],[65,128,1],[15],[11],[32,2],[65,6],[15]],
37
37
  params: [127,127], typedParams: 1,
38
38
  returns: [127,127], typedReturns: 1,
39
39
  locals: [127], localNames: ["entryPtr","entryPtr#type","out"],
40
40
  };
41
41
  this.__Porffor_object_accessorSet = {
42
- wasm: (scope, {}) => [[32,0],[40,0,8],[34,2],[65,6],[15]],
42
+ wasm: (scope, {}) => [[32,0],[40,0,8],[34,2],[69],[4,64],[65,0],[65,128,1],[15],[11],[32,2],[65,6],[15]],
43
43
  params: [127,127], typedParams: 1,
44
44
  returns: [127,127], typedReturns: 1,
45
45
  locals: [127], localNames: ["entryPtr","entryPtr#type","out"],
@@ -51,7 +51,7 @@ export const BuiltinFuncs = function() {
51
51
  locals: [127,127,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","targetSym","keySym"],
52
52
  };
53
53
  this.__Porffor_object_get = {
54
- wasm: (scope, {builtin}) => [[32,0],[65,7],[32,2],[32,3],[16, ...builtin('__Porffor_object_lookup')],[26],[34,4],[65,127],[70],[4,64],[68,0,0,0,0,0,0,0,0],[65,128,1],[15],[11],[32,4],[47,0,12],[34,6],[65,1],[113],[4,64],[32,4],[65,1],[16, ...builtin('__Porffor_object_accessorGet')],[26],[34,7],[17,0,0],[15],[11],[32,4],[43,0,4],[32,6],[65,8],[118],[15]],
54
+ wasm: (scope, {builtin}) => [[32,0],[65,7],[32,2],[32,3],[16, ...builtin('__Porffor_object_lookup')],[26],[34,4],[65,127],[70],[4,64],[68,0,0,0,0,0,0,0,0],[65,128,1],[15],[11],[32,4],[47,0,12],[34,6],[65,1],[113],[4,64],[32,4],[65,1],[16, ...builtin('__Porffor_object_accessorGet')],[26],[34,7],[69],[4,64],[68,0,0,0,0,0,0,0,0],[65,128,1],[15],[11],[32,7],[17,0,0],[15],[11],[32,4],[43,0,4],[32,6],[65,8],[118],[15]],
55
55
  params: [127,127,127,127], typedParams: 1,
56
56
  returns: [124,127], typedReturns: 1,
57
57
  locals: [127,127,127,127], localNames: ["_this","_this#type","key","key#type","entryPtr","#last_type","tail","get"],
@@ -63,7 +63,7 @@ export const BuiltinFuncs = function() {
63
63
  locals: [127], localNames: ["ptr","ptr#type","key","key#type","keyEnc"],
64
64
  };
65
65
  this.__Porffor_object_set = {
66
- 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],[34,6],[65,1],[32,2],[32,3],[16, ...builtin('__Porffor_object_writeKey')],[33,7],[26],[65,14],[33,8],[5],[32,6],[47,0,12],[34,12],[65,1],[113],[4,64],[32,6],[65,1],[16, ...builtin('__Porffor_object_accessorSet')],[26],[33,13],[32,4],[32,5],[32,13],[17,1,0],[26],[26],[32,4],[32,5],[15],[11],[32,12],[65,8],[113],[69],[4,64],[32,4],[32,5],[15],[11],[32,12],[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]],
66
+ 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],[34,6],[65,1],[32,2],[32,3],[16, ...builtin('__Porffor_object_writeKey')],[33,7],[26],[65,14],[33,8],[5],[32,6],[47,0,12],[34,12],[65,1],[113],[4,64],[32,6],[65,1],[16, ...builtin('__Porffor_object_accessorSet')],[26],[34,13],[69],[4,64],[32,4],[32,5],[15],[11],[32,4],[32,5],[32,13],[17,1,0],[26],[26],[32,4],[32,5],[15],[11],[32,12],[65,8],[113],[69],[4,64],[32,4],[32,5],[15],[11],[32,12],[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]],
67
67
  params: [127,127,127,127,124,127], typedParams: 1,
68
68
  returns: [124,127], typedReturns: 1,
69
69
  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","tail","set"],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "porffor",
3
3
  "description": "a basic experimental wip aot optimizing js -> wasm engine/compiler/runtime in js",
4
- "version": "0.22.8+ad11daa09",
4
+ "version": "0.22.9+1e07b1dd2",
5
5
  "author": "CanadaHonk",
6
6
  "license": "MIT",
7
7
  "scripts": {},
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.22.8+ad11daa09';
3
+ globalThis.version = '0.22.9+1e07b1dd2';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {