porffor 0.21.2 → 0.21.4

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.
@@ -261,6 +261,39 @@ export const __Object_prototype_propertyIsEnumerable = (_this: any, prop: any) =
261
261
  };
262
262
 
263
263
 
264
+ export const __Object_is = (x: any, y: any): boolean => {
265
+ if (x === y) {
266
+ if (x == 0) {
267
+ // check +0 vs -0
268
+ return 1 / x == 1 / y;
269
+ }
270
+
271
+ return true;
272
+ }
273
+
274
+ // check NaN
275
+ if (Porffor.rawType(x) == Porffor.TYPES.number && Number.isNaN(x)) {
276
+ return Number.isNaN(y);
277
+ }
278
+
279
+ return false;
280
+ };
281
+
282
+ export const __Object_create = (proto: any, props: any) => {
283
+ if (!Porffor.object.isObject(proto)) {
284
+ if (proto !== null) throw new TypeError('Prototype should be an object or null');
285
+ }
286
+
287
+ const out: object = {};
288
+
289
+ // todo: set prototype when supported
290
+
291
+ if (props !== undefined) __Object_defineProperties(out, props);
292
+
293
+ return out;
294
+ };
295
+
296
+
264
297
  export const __Object_prototype_toString = (_this: object) => {
265
298
  let out: bytestring = '[object Object]';
266
299
  return out;
@@ -1707,6 +1707,18 @@ export const BuiltinFuncs = function() {
1707
1707
  returns: [124,127], typedReturns: 1,
1708
1708
  locals: [124,127,127,124,124,124], localNames: ["_this","_this#type","prop","prop#type","p","p#type","#last_type","t","entryPtr","keys"],
1709
1709
  };
1710
+ this.__Object_is = {
1711
+ wasm: (scope, {builtin}) => [[2,127,"string_only"],[32,0],[34,4,"string_only"],[32,2],[34,5,"string_only"],[32,1,"string_only|start"],[65,195,1],[70],[32,3],[65,195,1],[70],[113],[4,64],[32,4],[252,3],[34,6],[32,5],[252,3],[34,8],[71],[4,127],[32,6],[40,0,0],[34,7],[32,8],[40,0,0],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,9],[32,7],[33,10],[3,64],[32,9],[32,6],[106],[45,0,4],[32,9],[32,8],[106],[45,0,4],[71],[4,64],[65,0],[12,2],[11],[32,9],[65,1],[106],[34,9],[32,10],[72],[13,0],[11],[65,1],[5],[65,1],[11],[12,1],[11],[32,1],[65,195,0],[70],[32,1],[65,195,1],[70],[114],[32,3],[65,195,0],[70],[32,3],[65,195,1],[70],[114],[114],[4,64],[32,4],[252,3],[34,6],[32,5],[252,3],[34,8],[71],[4,127],[32,6],[40,0,0],[34,7],[32,8],[40,0,0],[32,1],[65,195,1],[70],[4,64],[32,6],[32,7],[16, ...builtin('__Porffor_bytestringToString')],[33,6],[11],[32,3],[65,195,1],[70],[4,64],[32,8],[32,8],[40,0,0],[16, ...builtin('__Porffor_bytestringToString')],[33,8],[11],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,9],[32,7],[65,2],[108],[33,10],[3,64],[32,9],[32,6],[106],[47,0,4],[32,9],[32,8],[106],[47,0,4],[71],[4,64],[65,0],[12,2],[11],[32,9],[65,2],[106],[34,9],[32,10],[72],[13,0],[11],[65,1],[5],[65,1],[11],[12,1],[11,"string_only|end"],[97],[11,"string_only"],[32,1],[65,128,1],[114],[32,3],[65,128,1],[114],[70],[113],[4,64],[32,0],[68,0,0,0,0,0,0,0,0],[97],[4,64],[68,0,0,0,0,0,0,240,63],[32,0],[163],[68,0,0,0,0,0,0,240,63],[32,2],[163],[97],[184],[65,2],[15],[11],[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,240,63],[97],[184],[34,11],[252,3],[4,124],[32,0],[16, ...builtin('__Number_isNaN')],[65,2],[33,12],[5],[32,11],[65,2],[33,12],[11],[33,13],[32,12],[33,14],[2,127],[32,14],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,13],[252,3],[40,1,0],[12,1],[11],[32,14],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,13],[252,3],[40,1,0],[12,1],[11],[32,13],[252,3],[11,"TYPESWITCH_end"],[4,64],[32,2],[16, ...builtin('__Number_isNaN')],[65,2],[15],[11],[68,0,0,0,0,0,0,0,0],[65,2],[15]],
1712
+ params: [124,127,124,127], typedParams: 1,
1713
+ returns: [124,127], typedReturns: 1,
1714
+ locals: [124,124,127,127,127,127,127,124,127,124,127], localNames: ["x","x#type","y","y#type","__tmpop_left","__tmpop_right","compare_left_pointer","compare_left_length","compare_right_pointer","compare_index","compare_index_end","logictmp","#last_type","#logicinner_tmp","#typeswitch_tmp"],
1715
+ };
1716
+ this.__Object_create = {
1717
+ 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],[32,0],[68,0,0,0,0,0,0,0,0],[98],[32,1],[65,128,1],[114],[65,7],[65,128,1],[114],[71],[114],[4,64],...internalThrow(scope, 'TypeError', `Prototype should be an object or null`),[11],[11],[16, ...builtin('__Porffor_allocate')],[184],[33,7],[32,2],[68,0,0,0,0,0,0,0,0],[98],[32,3],[65,128,1],[114],[65,128,1],[65,128,1],[114],[71],[114],[4,64],[32,7],[65,7],[32,2],[32,3],[16, ...builtin('__Object_defineProperties')],[33,4],[26],[11],[32,7],[65,7],[15]],
1718
+ params: [124,127,124,127], typedParams: 1,
1719
+ returns: [124,127], typedReturns: 1,
1720
+ locals: [127,124,127,124], localNames: ["proto","proto#type","props","props#type","#last_type","#logicinner_tmp","#typeswitch_tmp","out"],
1721
+ };
1710
1722
  this.__Object_prototype_toString = {
1711
1723
  wasm: (scope, {allocPage}) => [...number(allocPage(scope, 'bytestring: __Object_prototype_toString/out', 'i8') * pageSize, 124),[34,2],[65,195,1],[15]],
1712
1724
  params: [124,127], typedParams: 1,
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.21.2+856c111a5",
4
+ "version": "0.21.4+335ba1199",
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.21.2+856c111a5';
3
+ globalThis.version = '0.21.4+335ba1199';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {