porffor 0.55.32 → 0.55.33

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.
@@ -735,19 +735,18 @@ export const BuiltinFuncs = function() {
735
735
  this.__performance_now.usesImports = true;
736
736
 
737
737
 
738
- this.__Porffor_type = {
739
- params: [ valtypeBinary, Valtype.i32 ],
740
- typedParams: true,
741
- locals: [ Valtype.i32, Valtype.i32 ],
738
+ this.__Porffor_typeName = {
739
+ params: [ Valtype.i32 ],
740
+ locals: [],
742
741
  returns: [ valtypeBinary ],
743
742
  returnType: TYPES.bytestring,
744
743
  wasm: (scope, { typeSwitch, makeString }) => {
745
744
  const bc = {};
746
745
  for (const x in TYPE_NAMES) {
747
- bc[x] = makeString(scope, TYPE_NAMES[x]);
746
+ bc[x] = () => makeString(scope, TYPE_NAMES[x]);
748
747
  }
749
748
 
750
- return typeSwitch(scope, [ [ Opcodes.local_get, 1 ] ], bc);
749
+ return typeSwitch(scope, [ [ Opcodes.local_get, 0 ] ], bc);
751
750
  }
752
751
  };
753
752
 
@@ -15,7 +15,7 @@ export default function({ builtinFuncs }, Prefs) {
15
15
 
16
16
  builtinFuncs['#get_' + name] = {
17
17
  params: [],
18
- locals: [],
18
+ locals: [ Valtype.i32 ],
19
19
  returns: [ Valtype.i32 ],
20
20
  returnType: TYPES.object,
21
21
  wasm: (scope, { allocPage, makeString, generate, getNodeType, builtin, funcRef, glbl }) => {
@@ -41,7 +41,15 @@ export default function({ builtinFuncs }, Prefs) {
41
41
 
42
42
  // set cache & ptr for use
43
43
  number(ptr, Valtype.i32),
44
- glbl(Opcodes.global_set, `getptr_${name}`, Valtype.i32)[0]
44
+ [ Opcodes.local_tee, 0 ],
45
+ glbl(Opcodes.global_set, `getptr_${name}`, Valtype.i32)[0],
46
+
47
+ [ Opcodes.local_get, 0 ],
48
+ Opcodes.i32_from_u,
49
+ number(existingFunc ? TYPES.function : TYPES.object, Valtype.i32),
50
+ [ Opcodes.call, builtin('__Porffor_object_underlying') ],
51
+ [ Opcodes.drop ],
52
+ [ Opcodes.local_set, 0 ]
45
53
  ];
46
54
 
47
55
  for (const x in props) {
@@ -50,6 +58,20 @@ export default function({ builtinFuncs }, Prefs) {
50
58
  name: prefix + x
51
59
  };
52
60
 
61
+ if (x === '__proto__') {
62
+ out.push(
63
+ [ Opcodes.local_get, 0 ],
64
+ number(TYPES.object, Valtype.i32),
65
+
66
+ ...generate(scope, value),
67
+ Opcodes.i32_to_u,
68
+ ...getNodeType(scope, value),
69
+
70
+ [ Opcodes.call, builtin('__Porffor_object_setPrototype') ]
71
+ );
72
+ continue;
73
+ }
74
+
53
75
  let flags = 0b0000;
54
76
 
55
77
  const d = props[x];
@@ -61,8 +83,8 @@ export default function({ builtinFuncs }, Prefs) {
61
83
  if (this[prefix + x]?.type === TYPES.object && this[prefix + x] !== this.null) value = { type: 'ObjectExpression', properties: [] };
62
84
 
63
85
  out.push(
64
- getPtr,
65
- number(existingFunc ? TYPES.function : TYPES.object, Valtype.i32),
86
+ [ Opcodes.local_get, 0 ],
87
+ number(TYPES.object, Valtype.i32),
66
88
 
67
89
  ...makeString(scope, x),
68
90
  Opcodes.i32_to_u,
@@ -74,7 +96,7 @@ export default function({ builtinFuncs }, Prefs) {
74
96
  number(flags, Valtype.i32),
75
97
  number(TYPES.number, Valtype.i32),
76
98
 
77
- [ Opcodes.call, builtin('__Porffor_object_expr_initWithFlags') ]
99
+ [ Opcodes.call, builtin('__Porffor_object_fastAdd') ]
78
100
  );
79
101
  }
80
102