porffor 0.28.11 → 0.28.13
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/CONTRIBUTING.md +1 -1
- package/compiler/builtins/array.ts +8 -7
- package/compiler/builtins/boolean.ts +7 -0
- package/compiler/builtins/console.ts +132 -133
- package/compiler/builtins/dataview.ts +4 -4
- package/compiler/builtins/object.ts +3 -3
- package/compiler/builtins/porffor.d.ts +1 -1
- package/compiler/builtins_precompiled.js +34 -27
- package/compiler/codegen.js +32 -20
- package/compiler/opt.js +3 -0
- package/package.json +1 -1
- package/runner/index.js +1 -1
@@ -116,7 +116,7 @@ i32.load16_u 0 4
|
|
116
116
|
i32.from_u
|
117
117
|
local.set ${int}`;
|
118
118
|
|
119
|
-
if (
|
119
|
+
if (!!littleEndian) return int;
|
120
120
|
return (int >>> 8) | ((int & 0xFF) << 8);
|
121
121
|
};
|
122
122
|
|
@@ -125,7 +125,7 @@ export const __DataView_prototype_setUint16 = (_this: DataView, byteOffset: numb
|
|
125
125
|
if (Porffor.fastOr(byteOffset < 0, byteOffset + 1 >= len)) throw new RangeError('Byte offset is out of bounds of the DataView');
|
126
126
|
|
127
127
|
let int: i32 = 0;
|
128
|
-
if (
|
128
|
+
if (!!littleEndian) {
|
129
129
|
int = value;
|
130
130
|
} else {
|
131
131
|
int = (value >>> 8) | ((value & 0xFF) << 8);
|
@@ -173,7 +173,7 @@ i32.load 0 4
|
|
173
173
|
i32.from_u
|
174
174
|
local.set ${int}`;
|
175
175
|
|
176
|
-
if (
|
176
|
+
if (!!littleEndian) return int;
|
177
177
|
return (int >>> 24) |
|
178
178
|
((int >>> 8) & 0x0000ff00) |
|
179
179
|
((int << 8) & 0x00ff0000) |
|
@@ -185,7 +185,7 @@ export const __DataView_prototype_setUint32 = (_this: DataView, byteOffset: numb
|
|
185
185
|
if (Porffor.fastOr(byteOffset < 0, byteOffset + 3 >= len)) throw new RangeError('Byte offset is out of bounds of the DataView');
|
186
186
|
|
187
187
|
let int: i32 = 0;
|
188
|
-
if (
|
188
|
+
if (!!littleEndian) {
|
189
189
|
int = value;
|
190
190
|
} else {
|
191
191
|
int = (value >>> 24) |
|
@@ -369,8 +369,8 @@ export const __Object_getOwnPropertyDescriptor = (obj: any, prop: any): any => {
|
|
369
369
|
const out: object = {};
|
370
370
|
|
371
371
|
const tail: i32 = Porffor.wasm.i32.load16_u(entryPtr, 0, 12);
|
372
|
-
out.configurable =
|
373
|
-
out.enumerable =
|
372
|
+
out.configurable = !!(tail & 0b0010);
|
373
|
+
out.enumerable = !!(tail & 0b0100);
|
374
374
|
|
375
375
|
if (tail & 0b0001) {
|
376
376
|
out.get = Porffor.object.accessorGet(entryPtr);
|
@@ -388,7 +388,7 @@ i32.const 8
|
|
388
388
|
i32.shr_u
|
389
389
|
local.set ${value+1}`;
|
390
390
|
|
391
|
-
out.writable =
|
391
|
+
out.writable = !!(tail & 0b1000);
|
392
392
|
out.value = value;
|
393
393
|
|
394
394
|
return out;
|
@@ -115,6 +115,7 @@ type PorfforGlobal = {
|
|
115
115
|
s(...args: any): string;
|
116
116
|
bs(...args: any): bytestring;
|
117
117
|
|
118
|
+
printStatic(str: string): void;
|
118
119
|
readArgv(index: i32, out: bytestring): i32;
|
119
120
|
readFile(path: bytestring, out: bytestring): i32;
|
120
121
|
};
|
@@ -133,7 +134,6 @@ declare global {
|
|
133
134
|
|
134
135
|
const print: (arg: any) => void;
|
135
136
|
const printChar: (char: number) => void;
|
136
|
-
const printStatic: (str: string) => void;
|
137
137
|
|
138
138
|
type i32 = number;
|
139
139
|
type i64 = number;
|