porffor 0.18.39 → 0.18.41
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/compiler/builtins/dataview.ts +54 -74
- package/compiler/codegen.js +59 -2
- package/compiler/encoding.js +14 -6
- package/compiler/generated_builtins.js +20 -8
- package/compiler/wasmSpec.js +3 -0
- package/package.json +1 -1
- package/runner/index.js +1 -1
@@ -103,59 +103,45 @@ export const __DataView_prototype_getUint16 = (_this: DataView, byteOffset: numb
|
|
103
103
|
const len: i32 = Porffor.wasm.i32.load(_this, 0, 0);
|
104
104
|
if (Porffor.fastOr(byteOffset < 0, byteOffset + 1 >= len)) throw new RangeError('Byte offset is out of bounds of the DataView');
|
105
105
|
|
106
|
-
let
|
107
|
-
Porffor.wasm`
|
106
|
+
let int: i32 = 0;
|
107
|
+
Porffor.wasm`
|
108
108
|
local.get ${_this}
|
109
109
|
i32.to_u
|
110
110
|
i32.load 0 4
|
111
111
|
local.get ${byteOffset}
|
112
112
|
i32.to_u
|
113
113
|
i32.add
|
114
|
-
local.set ptr
|
115
114
|
|
116
|
-
|
117
|
-
i32.load8_u 0 4
|
115
|
+
i32.load16_u 0 4
|
118
116
|
i32.from_u
|
119
|
-
local.set ${
|
120
|
-
local.get ptr
|
121
|
-
i32.load8_u 0 5
|
122
|
-
i32.from_u
|
123
|
-
local.set ${byte2}`;
|
117
|
+
local.set ${int}`;
|
124
118
|
|
125
|
-
if (Boolean(littleEndian)) return
|
126
|
-
return (
|
119
|
+
if (Boolean(littleEndian)) return int;
|
120
|
+
return (int >>> 8) | ((int & 0xFF) << 8);
|
127
121
|
};
|
128
122
|
|
129
123
|
export const __DataView_prototype_setUint16 = (_this: DataView, byteOffset: number, value: number, littleEndian: any) => {
|
130
124
|
const len: i32 = Porffor.wasm.i32.load(_this, 0, 0);
|
131
125
|
if (Porffor.fastOr(byteOffset < 0, byteOffset + 1 >= len)) throw new RangeError('Byte offset is out of bounds of the DataView');
|
132
126
|
|
133
|
-
let
|
134
|
-
if (littleEndian) {
|
135
|
-
|
136
|
-
byte2 = (value >>> 8) & 0xff;
|
127
|
+
let int: i32 = 0;
|
128
|
+
if (Boolean(littleEndian)) {
|
129
|
+
int = value;
|
137
130
|
} else {
|
138
|
-
|
139
|
-
byte2 = value & 0xff;
|
131
|
+
int = (value >>> 8) | ((value & 0xFF) << 8);
|
140
132
|
}
|
141
133
|
|
142
|
-
Porffor.wasm`
|
134
|
+
Porffor.wasm`
|
143
135
|
local.get ${_this}
|
144
136
|
i32.to_u
|
145
137
|
i32.load 0 4
|
146
138
|
local.get ${byteOffset}
|
147
139
|
i32.to_u
|
148
140
|
i32.add
|
149
|
-
local.set ptr
|
150
141
|
|
151
|
-
local.get
|
152
|
-
local.get ${byte1}
|
142
|
+
local.get ${int}
|
153
143
|
i32.to_u
|
154
|
-
i32.
|
155
|
-
local.get ptr
|
156
|
-
local.get ${byte2}
|
157
|
-
i32.to_u
|
158
|
-
i32.store8 0 5`;
|
144
|
+
i32.store16 0 4`;
|
159
145
|
|
160
146
|
return undefined;
|
161
147
|
};
|
@@ -174,79 +160,51 @@ export const __DataView_prototype_getUint32 = (_this: DataView, byteOffset: numb
|
|
174
160
|
const len: i32 = Porffor.wasm.i32.load(_this, 0, 0);
|
175
161
|
if (Porffor.fastOr(byteOffset < 0, byteOffset + 3 >= len)) throw new RangeError('Byte offset is out of bounds of the DataView');
|
176
162
|
|
177
|
-
let
|
178
|
-
Porffor.wasm`
|
163
|
+
let int: i32 = 0;
|
164
|
+
Porffor.wasm`
|
179
165
|
local.get ${_this}
|
180
166
|
i32.to_u
|
181
167
|
i32.load 0 4
|
182
168
|
local.get ${byteOffset}
|
183
169
|
i32.to_u
|
184
170
|
i32.add
|
185
|
-
local.set ptr
|
186
171
|
|
187
|
-
|
188
|
-
i32.load8_u 0 4
|
189
|
-
i32.from_u
|
190
|
-
local.set ${byte1}
|
191
|
-
local.get ptr
|
192
|
-
i32.load8_u 0 5
|
193
|
-
i32.from_u
|
194
|
-
local.set ${byte2}
|
195
|
-
local.get ptr
|
196
|
-
i32.load8_u 0 6
|
197
|
-
i32.from_u
|
198
|
-
local.set ${byte3}
|
199
|
-
local.get ptr
|
200
|
-
i32.load8_u 0 7
|
172
|
+
i32.load 0 4
|
201
173
|
i32.from_u
|
202
|
-
local.set ${
|
174
|
+
local.set ${int}`;
|
203
175
|
|
204
|
-
if (Boolean(littleEndian)) return
|
205
|
-
return (
|
176
|
+
if (Boolean(littleEndian)) return int;
|
177
|
+
return (int >>> 24) |
|
178
|
+
((int >>> 8) & 0x0000ff00) |
|
179
|
+
((int << 8) & 0x00ff0000) |
|
180
|
+
(int << 24);
|
206
181
|
};
|
207
182
|
|
208
183
|
export const __DataView_prototype_setUint32 = (_this: DataView, byteOffset: number, value: number, littleEndian: any) => {
|
209
184
|
const len: i32 = Porffor.wasm.i32.load(_this, 0, 0);
|
210
185
|
if (Porffor.fastOr(byteOffset < 0, byteOffset + 3 >= len)) throw new RangeError('Byte offset is out of bounds of the DataView');
|
211
186
|
|
212
|
-
let
|
213
|
-
if (littleEndian) {
|
214
|
-
|
215
|
-
byte2 = (value >>> 8) & 0xff;
|
216
|
-
byte3 = (value >>> 16) & 0xff;
|
217
|
-
byte4 = (value >>> 24) & 0xff;
|
187
|
+
let int: i32 = 0;
|
188
|
+
if (Boolean(littleEndian)) {
|
189
|
+
int = value;
|
218
190
|
} else {
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
191
|
+
int = (value >>> 24) |
|
192
|
+
((value >>> 8) & 0x0000FF00) |
|
193
|
+
((value << 8) & 0x00FF0000) |
|
194
|
+
(value << 24);
|
223
195
|
}
|
224
196
|
|
225
|
-
Porffor.wasm`
|
197
|
+
Porffor.wasm`
|
226
198
|
local.get ${_this}
|
227
199
|
i32.to_u
|
228
200
|
i32.load 0 4
|
229
201
|
local.get ${byteOffset}
|
230
202
|
i32.to_u
|
231
203
|
i32.add
|
232
|
-
local.set ptr
|
233
204
|
|
234
|
-
local.get
|
235
|
-
local.get ${byte1}
|
236
|
-
i32.to_u
|
237
|
-
i32.store8 0 4
|
238
|
-
local.get ptr
|
239
|
-
local.get ${byte2}
|
205
|
+
local.get ${int}
|
240
206
|
i32.to_u
|
241
|
-
i32.
|
242
|
-
local.get ptr
|
243
|
-
local.get ${byte3}
|
244
|
-
i32.to_u
|
245
|
-
i32.store8 0 6
|
246
|
-
local.get ptr
|
247
|
-
local.get ${byte4}
|
248
|
-
i32.to_u
|
249
|
-
i32.store8 0 7`;
|
207
|
+
i32.store 0 4`;
|
250
208
|
|
251
209
|
return undefined;
|
252
210
|
};
|
@@ -258,4 +216,26 @@ export const __DataView_prototype_getInt32 = (_this: DataView, byteOffset: numbe
|
|
258
216
|
|
259
217
|
export const __DataView_prototype_setInt32 = (_this: DataView, byteOffset: number, value: number, littleEndian: any) => {
|
260
218
|
return __DataView_prototype_setUint32(_this, byteOffset, value < 0 ? value | 0x100000000 : value, littleEndian);
|
219
|
+
};
|
220
|
+
|
221
|
+
export const __DataView_prototype_getFloat32 = (_this: DataView, byteOffset: number, littleEndian: any) => {
|
222
|
+
const int: i32 = __DataView_prototype_getUint32(_this, byteOffset, littleEndian);
|
223
|
+
Porffor.wasm`
|
224
|
+
local.get ${int}
|
225
|
+
i32.to_u
|
226
|
+
f32.reinterpret_i32
|
227
|
+
f64.promote_f32
|
228
|
+
i32.const 0
|
229
|
+
return`;
|
230
|
+
};
|
231
|
+
|
232
|
+
export const __DataView_prototype_setFloat32 = (_this: DataView, byteOffset: number, value: number, littleEndian: any) => {
|
233
|
+
let int: i32 = 0;
|
234
|
+
Porffor.wasm`
|
235
|
+
local.get ${value}
|
236
|
+
f32.demote_f64
|
237
|
+
i32.reinterpret_f32
|
238
|
+
i32.from_u
|
239
|
+
local.set ${int}`;
|
240
|
+
return __DataView_prototype_setUint32(_this, byteOffset, int, littleEndian);
|
261
241
|
};
|
package/compiler/codegen.js
CHANGED
@@ -111,6 +111,9 @@ const generate = (scope, decl, global = false, name = undefined, valueUnused = f
|
|
111
111
|
case 'ForOfStatement':
|
112
112
|
return generateForOf(scope, decl);
|
113
113
|
|
114
|
+
case 'SwitchStatement':
|
115
|
+
return generateSwitch(scope, decl);
|
116
|
+
|
114
117
|
case 'BreakStatement':
|
115
118
|
return generateBreak(scope, decl);
|
116
119
|
|
@@ -3623,10 +3626,63 @@ const generateForOf = (scope, decl) => {
|
|
3623
3626
|
return out;
|
3624
3627
|
};
|
3625
3628
|
|
3629
|
+
const generateSwitch = (scope, decl) => {
|
3630
|
+
const tmp = localTmp(scope, '#switch_disc');
|
3631
|
+
const out = [
|
3632
|
+
...generate(scope, decl.discriminant),
|
3633
|
+
[ Opcodes.local_set, tmp ],
|
3634
|
+
|
3635
|
+
[ Opcodes.block, Blocktype.void ]
|
3636
|
+
];
|
3637
|
+
|
3638
|
+
depth.push('switch');
|
3639
|
+
|
3640
|
+
const cases = decl.cases.slice();
|
3641
|
+
const defaultCase = cases.findIndex(x => x.test == null);
|
3642
|
+
if (defaultCase != -1) {
|
3643
|
+
// move default case to last
|
3644
|
+
cases.push(cases.splice(defaultCase, 1)[0]);
|
3645
|
+
}
|
3646
|
+
|
3647
|
+
for (let i = 0; i < cases.length; i++) {
|
3648
|
+
out.push([ Opcodes.block, Blocktype.void ]);
|
3649
|
+
depth.push('block');
|
3650
|
+
}
|
3651
|
+
|
3652
|
+
for (let i = 0; i < cases.length; i++) {
|
3653
|
+
const x = cases[i];
|
3654
|
+
if (x.test) {
|
3655
|
+
out.push(
|
3656
|
+
[ Opcodes.local_get, tmp ],
|
3657
|
+
...generate(scope, x.test),
|
3658
|
+
[ Opcodes.eq ],
|
3659
|
+
[ Opcodes.br_if, i ]
|
3660
|
+
);
|
3661
|
+
} else {
|
3662
|
+
out.push(
|
3663
|
+
[ Opcodes.br, i ]
|
3664
|
+
);
|
3665
|
+
}
|
3666
|
+
}
|
3667
|
+
|
3668
|
+
for (let i = 0; i < cases.length; i++) {
|
3669
|
+
depth.pop();
|
3670
|
+
out.push(
|
3671
|
+
[ Opcodes.end ],
|
3672
|
+
...generateCode(scope, { body: cases[i].consequent })
|
3673
|
+
);
|
3674
|
+
}
|
3675
|
+
|
3676
|
+
out.push([ Opcodes.end ]);
|
3677
|
+
depth.pop();
|
3678
|
+
|
3679
|
+
return out;
|
3680
|
+
};
|
3681
|
+
|
3626
3682
|
// find the nearest loop in depth map by type
|
3627
3683
|
const getNearestLoop = () => {
|
3628
3684
|
for (let i = depth.length - 1; i >= 0; i--) {
|
3629
|
-
if (['while', 'dowhile', 'for', 'forof'].includes(depth[i])) return i;
|
3685
|
+
if (['while', 'dowhile', 'for', 'forof', 'switch'].includes(depth[i])) return i;
|
3630
3686
|
}
|
3631
3687
|
|
3632
3688
|
return -1;
|
@@ -3645,7 +3701,8 @@ const generateBreak = (scope, decl) => {
|
|
3645
3701
|
while: 2, // loop > if (wanted branch) (we are here)
|
3646
3702
|
dowhile: 2, // loop > block (wanted branch) > block (we are here)
|
3647
3703
|
forof: 2, // loop > block (wanted branch) > block (we are here)
|
3648
|
-
if: 1 // break inside if, branch 0 to skip the rest of the if
|
3704
|
+
if: 1, // break inside if, branch 0 to skip the rest of the if
|
3705
|
+
switch: 1
|
3649
3706
|
})[type];
|
3650
3707
|
|
3651
3708
|
return [
|
package/compiler/encoding.js
CHANGED
@@ -142,12 +142,20 @@ export const read_unsignedLEB128 = _input => {
|
|
142
142
|
};
|
143
143
|
|
144
144
|
// ieee 754 binary64
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
//
|
150
|
-
|
145
|
+
const ieee754Buffer = new Float64Array(1);
|
146
|
+
const ieee754Cache = {};
|
147
|
+
export const ieee754_binary64 = value => {
|
148
|
+
if (value === 0) {
|
149
|
+
if (1 / value === -Infinity) return [ 0, 0, 0, 0, 0, 0, 0, 128 ]; // -0
|
150
|
+
return [ 0, 0, 0, 0, 0, 0, 0, 0 ]; // +0
|
151
|
+
}
|
152
|
+
|
153
|
+
if (ieee754Cache[value]) return ieee754Cache[value].slice();
|
154
|
+
|
155
|
+
ieee754Buffer[0] = value;
|
156
|
+
return ieee754Cache[value] = [...new Uint8Array(ieee754Buffer.buffer)];
|
157
|
+
};
|
158
|
+
|
151
159
|
export const read_ieee754_binary64 = buffer => new Float64Array(new Uint8Array(buffer).buffer)[0];
|
152
160
|
|
153
161
|
|
@@ -627,16 +627,16 @@ export const BuiltinFuncs = function() {
|
|
627
627
|
locals: [127], localNames: ["_this","_this#type","byteOffset","byteOffset#type","value","value#type","#last_type"],
|
628
628
|
};
|
629
629
|
this.__DataView_prototype_getUint16 = {
|
630
|
-
wasm: (scope, {builtin,internalThrow}) => [[32,0],[252,2],[40,0,0],[183],[33,6],[32,2],[68,0,0,0,0,0,0,0,0],[99],[32,2],[68,0,0,0,0,0,0,240,63],[160],[32,6],[102],[114],[4,64],...internalThrow(scope, 'RangeError', `Byte offset is out of bounds of the DataView`),[11],[68,0,0,0,0,0,0,0,0],[33,7],[
|
630
|
+
wasm: (scope, {builtin,internalThrow}) => [[32,0],[252,2],[40,0,0],[183],[33,6],[32,2],[68,0,0,0,0,0,0,0,0],[99],[32,2],[68,0,0,0,0,0,0,240,63],[160],[32,6],[102],[114],[4,64],...internalThrow(scope, 'RangeError', `Byte offset is out of bounds of the DataView`),[11],[68,0,0,0,0,0,0,0,0],[33,7],[32,0],[252,3],[40,0,4],[32,2],[252,3],[106],[47,0,4],[184],[33,7],[32,4],[33,8],[32,5],[33,9],[2,124],[32,9],[65,194,0],[70],[4,64,"TYPESWITCH|String"],[32,8],[252,3],[40,1,0],[184],[12,1],[11],[32,9],[65,194,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,8],[252,3],[40,1,0],[184],[12,1],[11],[32,8],[252,2],[69],[69],[183],[11,"TYPESWITCH_end"],[252,3],[4,64],[32,7],[65,0],[15],[11],[32,7],[68,0,0,0,0,0,0,32,64],[16, builtin('f64_>>>')],[32,7],[68,0,0,0,0,0,224,111,64],[16, builtin('f64_&')],[68,0,0,0,0,0,0,32,64],[16, builtin('f64_<<')],[16, builtin('f64_|')],[65,0],[15]],
|
631
631
|
params: [124,127,124,127,124,127], typedParams: 1,
|
632
632
|
returns: [124,127], typedReturns: 1,
|
633
|
-
locals: [124,124,124,127
|
633
|
+
locals: [124,124,124,127], localNames: ["_this","_this#type","byteOffset","byteOffset#type","littleEndian","littleEndian#type","len","int","#logicinner_tmp","#typeswitch_tmp"],
|
634
634
|
};
|
635
635
|
this.__DataView_prototype_setUint16 = {
|
636
|
-
wasm: (scope, {builtin,internalThrow}) => [[32,0],[252,2],[40,0,0],[183],[33,8],[32,2],[68,0,0,0,0,0,0,0,0],[99],[32,2],[68,0,0,0,0,0,0,240,63],[160],[32,8],[102],[114],[4,64],...internalThrow(scope, 'RangeError', `Byte offset is out of bounds of the DataView`),[11],[68,0,0,0,0,0,0,0,0],[33,9],[
|
636
|
+
wasm: (scope, {builtin,internalThrow}) => [[32,0],[252,2],[40,0,0],[183],[33,8],[32,2],[68,0,0,0,0,0,0,0,0],[99],[32,2],[68,0,0,0,0,0,0,240,63],[160],[32,8],[102],[114],[4,64],...internalThrow(scope, 'RangeError', `Byte offset is out of bounds of the DataView`),[11],[68,0,0,0,0,0,0,0,0],[33,9],[32,6],[33,10],[32,7],[33,11],[2,124],[32,11],[65,194,0],[70],[4,64,"TYPESWITCH|String"],[32,10],[252,3],[40,1,0],[184],[12,1],[11],[32,11],[65,194,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,10],[252,3],[40,1,0],[184],[12,1],[11],[32,10],[252,2],[69],[69],[183],[11,"TYPESWITCH_end"],[252,3],[4,64],[32,4],[33,9],[5],[32,4],[68,0,0,0,0,0,0,32,64],[16, builtin('f64_>>>')],[32,4],[68,0,0,0,0,0,224,111,64],[16, builtin('f64_&')],[68,0,0,0,0,0,0,32,64],[16, builtin('f64_<<')],[16, builtin('f64_|')],[33,9],[11],[32,0],[252,3],[40,0,4],[32,2],[252,3],[106],[32,9],[252,3],[59,0,4],[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
637
637
|
params: [124,127,124,127,124,127,124,127], typedParams: 1,
|
638
638
|
returns: [124,127], typedReturns: 1,
|
639
|
-
locals: [124,124,124,
|
639
|
+
locals: [124,124,124,127], localNames: ["_this","_this#type","byteOffset","byteOffset#type","value","value#type","littleEndian","littleEndian#type","len","int","#logicinner_tmp","#typeswitch_tmp"],
|
640
640
|
};
|
641
641
|
this.__DataView_prototype_getInt16 = {
|
642
642
|
wasm: (scope, {builtin}) => [[32,0],[65,22],[32,2],[65,0],[32,4],[32,5],[16, builtin('__DataView_prototype_getUint16')],[33,7],[34,6],[68,0,0,0,0,0,0,224,64],[16, builtin('f64_&')],[252,3],[4,124],[32,6],[68,0,0,0,0,0,0,240,192],[16, builtin('f64_^')],[65,0],[33,7],[5],[32,6],[65,0],[33,7],[11],[32,7],[15]],
|
@@ -651,16 +651,16 @@ export const BuiltinFuncs = function() {
|
|
651
651
|
locals: [127], localNames: ["_this","_this#type","byteOffset","byteOffset#type","value","value#type","littleEndian","littleEndian#type","#last_type"],
|
652
652
|
};
|
653
653
|
this.__DataView_prototype_getUint32 = {
|
654
|
-
wasm: (scope, {builtin,internalThrow}) => [[32,0],[252,2],[40,0,0],[183],[33,6],[32,2],[68,0,0,0,0,0,0,0,0],[99],[32,2],[68,0,0,0,0,0,0,8,64],[160],[32,6],[102],[114],[4,64],...internalThrow(scope, 'RangeError', `Byte offset is out of bounds of the DataView`),[11],[68,0,0,0,0,0,0,0,0],[33,7],[
|
654
|
+
wasm: (scope, {builtin,internalThrow}) => [[32,0],[252,2],[40,0,0],[183],[33,6],[32,2],[68,0,0,0,0,0,0,0,0],[99],[32,2],[68,0,0,0,0,0,0,8,64],[160],[32,6],[102],[114],[4,64],...internalThrow(scope, 'RangeError', `Byte offset is out of bounds of the DataView`),[11],[68,0,0,0,0,0,0,0,0],[33,7],[32,0],[252,3],[40,0,4],[32,2],[252,3],[106],[40,0,4],[184],[33,7],[32,4],[33,8],[32,5],[33,9],[2,124],[32,9],[65,194,0],[70],[4,64,"TYPESWITCH|String"],[32,8],[252,3],[40,1,0],[184],[12,1],[11],[32,9],[65,194,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,8],[252,3],[40,1,0],[184],[12,1],[11],[32,8],[252,2],[69],[69],[183],[11,"TYPESWITCH_end"],[252,3],[4,64],[32,7],[65,0],[15],[11],[32,7],[68,0,0,0,0,0,0,56,64],[16, builtin('f64_>>>')],[32,7],[68,0,0,0,0,0,0,32,64],[16, builtin('f64_>>>')],[68,0,0,0,0,0,224,239,64],[16, builtin('f64_&')],[16, builtin('f64_|')],[32,7],[68,0,0,0,0,0,0,32,64],[16, builtin('f64_<<')],[68,0,0,0,0,0,224,111,65],[16, builtin('f64_&')],[16, builtin('f64_|')],[32,7],[68,0,0,0,0,0,0,56,64],[16, builtin('f64_<<')],[16, builtin('f64_|')],[65,0],[15]],
|
655
655
|
params: [124,127,124,127,124,127], typedParams: 1,
|
656
656
|
returns: [124,127], typedReturns: 1,
|
657
|
-
locals: [124,124,124,
|
657
|
+
locals: [124,124,124,127], localNames: ["_this","_this#type","byteOffset","byteOffset#type","littleEndian","littleEndian#type","len","int","#logicinner_tmp","#typeswitch_tmp"],
|
658
658
|
};
|
659
659
|
this.__DataView_prototype_setUint32 = {
|
660
|
-
wasm: (scope, {builtin,internalThrow}) => [[32,0],[252,2],[40,0,0],[183],[33,8],[32,2],[68,0,0,0,0,0,0,0,0],[99],[32,2],[68,0,0,0,0,0,0,8,64],[160],[32,8],[102],[114],[4,64],...internalThrow(scope, 'RangeError', `Byte offset is out of bounds of the DataView`),[11],[68,0,0,0,0,0,0,0,0],[33,9],[
|
660
|
+
wasm: (scope, {builtin,internalThrow}) => [[32,0],[252,2],[40,0,0],[183],[33,8],[32,2],[68,0,0,0,0,0,0,0,0],[99],[32,2],[68,0,0,0,0,0,0,8,64],[160],[32,8],[102],[114],[4,64],...internalThrow(scope, 'RangeError', `Byte offset is out of bounds of the DataView`),[11],[68,0,0,0,0,0,0,0,0],[33,9],[32,6],[33,10],[32,7],[33,11],[2,124],[32,11],[65,194,0],[70],[4,64,"TYPESWITCH|String"],[32,10],[252,3],[40,1,0],[184],[12,1],[11],[32,11],[65,194,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,10],[252,3],[40,1,0],[184],[12,1],[11],[32,10],[252,2],[69],[69],[183],[11,"TYPESWITCH_end"],[252,3],[4,64],[32,4],[33,9],[5],[32,4],[68,0,0,0,0,0,0,56,64],[16, builtin('f64_>>>')],[32,4],[68,0,0,0,0,0,0,32,64],[16, builtin('f64_>>>')],[68,0,0,0,0,0,224,239,64],[16, builtin('f64_&')],[16, builtin('f64_|')],[32,4],[68,0,0,0,0,0,0,32,64],[16, builtin('f64_<<')],[68,0,0,0,0,0,224,111,65],[16, builtin('f64_&')],[16, builtin('f64_|')],[32,4],[68,0,0,0,0,0,0,56,64],[16, builtin('f64_<<')],[16, builtin('f64_|')],[33,9],[11],[32,0],[252,3],[40,0,4],[32,2],[252,3],[106],[32,9],[252,3],[54,0,4],[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
661
661
|
params: [124,127,124,127,124,127,124,127], typedParams: 1,
|
662
662
|
returns: [124,127], typedReturns: 1,
|
663
|
-
locals: [124,124,124,
|
663
|
+
locals: [124,124,124,127], localNames: ["_this","_this#type","byteOffset","byteOffset#type","value","value#type","littleEndian","littleEndian#type","len","int","#logicinner_tmp","#typeswitch_tmp"],
|
664
664
|
};
|
665
665
|
this.__DataView_prototype_getInt32 = {
|
666
666
|
wasm: (scope, {builtin}) => [[32,0],[65,22],[32,2],[65,0],[32,4],[32,5],[16, builtin('__DataView_prototype_getUint32')],[33,7],[34,6],[68,0,0,0,0,0,0,224,65],[16, builtin('f64_&')],[252,3],[4,124],[32,6],[68,0,0,0,0,0,0,240,193],[16, builtin('f64_^')],[65,0],[33,7],[5],[32,6],[65,0],[33,7],[11],[32,7],[15]],
|
@@ -674,6 +674,18 @@ export const BuiltinFuncs = function() {
|
|
674
674
|
returns: [124,127], typedReturns: 1,
|
675
675
|
locals: [127], localNames: ["_this","_this#type","byteOffset","byteOffset#type","value","value#type","littleEndian","littleEndian#type","#last_type"],
|
676
676
|
};
|
677
|
+
this.__DataView_prototype_getFloat32 = {
|
678
|
+
wasm: (scope, {builtin}) => [[32,0],[65,22],[32,2],[65,0],[32,4],[32,5],[16, builtin('__DataView_prototype_getUint32')],[33,7],[34,6],[252,3],[190],[187],[65,0],[15]],
|
679
|
+
params: [124,127,124,127,124,127], typedParams: 1,
|
680
|
+
returns: [124,127], typedReturns: 1,
|
681
|
+
locals: [124,127], localNames: ["_this","_this#type","byteOffset","byteOffset#type","littleEndian","littleEndian#type","int","#last_type"],
|
682
|
+
};
|
683
|
+
this.__DataView_prototype_setFloat32 = {
|
684
|
+
wasm: (scope, {builtin}) => [[68,0,0,0,0,0,0,0,0],[33,8],[32,4],[182],[188],[184],[33,8],[32,0],[65,22],[32,2],[65,0],[32,8],[65,0],[32,6],[32,7],[16, builtin('__DataView_prototype_setUint32')],[34,9],[15]],
|
685
|
+
params: [124,127,124,127,124,127,124,127], typedParams: 1,
|
686
|
+
returns: [124,127], typedReturns: 1,
|
687
|
+
locals: [124,127], localNames: ["_this","_this#type","byteOffset","byteOffset#type","value","value#type","littleEndian","littleEndian#type","int","#last_type"],
|
688
|
+
};
|
677
689
|
this.__ecma262_Day = {
|
678
690
|
wasm: (scope, {builtin}) => [[32,0],[68,0,0,0,0,112,153,148,65],[163],[16, builtin('__Math_floor')],[65,0],[15]],
|
679
691
|
params: [124,127], typedParams: 1,
|
package/compiler/wasmSpec.js
CHANGED
@@ -189,6 +189,9 @@ export const Opcodes = {
|
|
189
189
|
f64_convert_i64_s: 0xb9,
|
190
190
|
f64_convert_i64_u: 0xba,
|
191
191
|
|
192
|
+
i32_reinterpret_f32: 0xbc,
|
193
|
+
i64_reinterpret_f64: 0xbd,
|
194
|
+
f32_reinterpret_i32: 0xbe,
|
192
195
|
f64_reinterpret_i64: 0xbf,
|
193
196
|
|
194
197
|
i32_trunc_sat_f64_s: [ 0xfc, 0x02 ],
|
package/package.json
CHANGED