porffor 0.55.8 → 0.55.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.
- package/compiler/builtins_precompiled.js +4 -4
- package/compiler/codegen.js +13 -10
- package/compiler/precompile.js +14 -3
- package/package.json +1 -1
- package/runner/index.js +1 -1
@@ -5174,15 +5174,15 @@ usedTypes:[33],
|
|
5174
5174
|
usesTag:1,
|
5175
5175
|
}
|
5176
5176
|
this.__ecma262_ToPrimitive_Number = {
|
5177
|
-
wasm:(_,{t,builtin,internalThrow})=>[[32,0],[33,4],[32,1],[33,5],[32,1],[33,
|
5177
|
+
wasm:(_,{t,builtin,internalThrow})=>[[32,0],[33,4],[32,1],[33,5],[32,1],[33,7],[2,124],...t([1],()=>[[32,7],[65,1],[70],[4,64],[32,4],[32,5],[16,builtin('__Number_prototype_valueOf')],[33,6],[12,1],[11]]),...t([2],()=>[[32,7],[65,2],[70],[4,64],[32,4],[32,5],[16,builtin('__Boolean_prototype_valueOf')],[33,6],[12,1],[11]]),...t([5],()=>[[32,7],[65,5],[70],[4,64],[32,4],[32,5],[16,builtin('__Symbol_prototype_valueOf')],[33,6],[12,1],[11]]),...t([7],()=>[[32,7],[65,7],[70],[4,64],[32,4],[32,5],[16,builtin('__Object_prototype_valueOf')],[33,6],[12,1],[11]]),...t([18],()=>[[32,7],[65,18],[70],[4,64],[32,4],[32,5],[16,builtin('__Date_prototype_valueOf')],[33,6],[12,1],[11]]),...t([37],()=>[[32,7],[65,37],[70],[4,64],[32,4],[32,5],[16,builtin('__Boolean_prototype_valueOf')],[33,6],[12,1],[11]]),...t([38],()=>[[32,7],[65,38],[70],[4,64],[32,4],[32,5],[16,builtin('__Number_prototype_valueOf')],[33,6],[12,1],[11]]),...t([39],()=>[[32,7],[65,39],[70],[4,64],[32,4],[252,2],[32,5],[16,builtin('__String_prototype_valueOf')],[33,6],[183],[12,1],[11]]),...t([67],()=>[[32,7],[65,195,0],[70],[4,64],[32,4],[252,2],[32,5],[16,builtin('__String_prototype_valueOf')],[33,6],[183],[12,1],[11]]),...t([80],()=>[[32,7],[65,208,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([88],()=>[[32,7],[65,216,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Uint8Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([89],()=>[[32,7],[65,217,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Int8Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([90],()=>[[32,7],[65,218,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Uint8ClampedArray_prototype_valueOf')],[33,6],[12,1],[11]]),...t([91],()=>[[32,7],[65,219,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Uint16Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([92],()=>[[32,7],[65,220,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Int16Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([93],()=>[[32,7],[65,221,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Uint32Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([94],()=>[[32,7],[65,222,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Int32Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([95],()=>[[32,7],[65,223,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Float32Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([96],()=>[[32,7],[65,224,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Float64Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([128],()=>[[32,7],[65,128,1],[70],[4,64],[68,0],[65,128,1],[33,6],[12,1],[11]]),...t([195],()=>[[32,7],[65,195,1],[70],[4,64],[32,4],[252,2],[32,5],[16,builtin('__ByteString_prototype_valueOf')],[33,6],[183],[12,1],[11]]),...t(["NaN"],()=>[[32,7],[65,0],[70],[4,64],[68,0],[65,128,1],[33,6],[12,1],[11]]),[32,4],[32,5],[16,builtin('__Object_prototype_valueOf')],[33,6],[11],[33,2],[32,6],[33,3],[32,2],[33,8],[32,3],[33,7],[2,127],...t([0,128],()=>[[32,7],[65,0],[70],[32,7],[65,128,1],[70],[114],[4,64],[65,1],[12,1],[11]]),...t([7],()=>[[32,7],[65,7],[70],[4,64],[32,8],[68,0],[97],[12,1],[11]]),[65,0],[11],[69],[184],[34,9],[252,3],[4,124],[32,2],[252,2],[32,3],[16,builtin('__Porffor_object_isObjectOrNull')],[33,6],[183],[33,8],[32,6],[33,7],[2,124],...t([67,195],()=>[[32,7],[65,195,0],[70],[32,7],[65,195,1],[70],[114],[4,64],[32,8],[252,3],[40,1,0],[69],[184],[12,1],[11]]),[32,8],[68,0],[97],[184],[11],[65,2],[33,6],[5],[32,9],[65,2],[33,6],[11],[33,8],[32,6],[33,7],[2,127],...t([67,195],()=>[[32,7],[65,195,0],[70],[32,7],[65,195,1],[70],[114],[4,64],[32,8],[252,3],[40,1,0],[12,1],[11]]),[32,8],[252,3],[11],[4,64],[32,2],[32,3],[15],[26],[11],[32,0],[33,4],[32,1],[33,5],[32,1],[33,7],[2,124],...t([1],()=>[[32,7],[65,1],[70],[4,64],[32,4],[32,5],[68,0],[65,128,1],[16,builtin('__Number_prototype_toString')],[33,6],[12,1],[11]]),...t([2],()=>[[32,7],[65,2],[70],[4,64],[32,4],[32,5],[16,builtin('__Boolean_prototype_toString')],[33,6],[12,1],[11]]),...t([5],()=>[[32,7],[65,5],[70],[4,64],[32,4],[32,5],[16,builtin('__Symbol_prototype_toString')],[33,6],[12,1],[11]]),...t([6],()=>[[32,7],[65,6],[70],[4,64],[32,4],[32,5],[16,builtin('__Function_prototype_toString')],[33,6],[12,1],[11]]),...t([7],()=>[[32,7],[65,7],[70],[4,64],[32,4],[32,5],[16,builtin('__Object_prototype_toString')],[33,6],[12,1],[11]]),...t([18],()=>[[32,7],[65,18],[70],[4,64],[32,4],[32,5],[16,builtin('__Date_prototype_toString')],[33,6],[12,1],[11]]),...t([19],()=>[[32,7],[65,19],[70],[4,64],[32,4],[32,5],[16,builtin('__Set_prototype_toString')],[33,6],[12,1],[11]]),...t([20],()=>[[32,7],[65,20],[70],[4,64],[32,4],[32,5],[16,builtin('__Map_prototype_toString')],[33,6],[12,1],[11]]),...t([33],()=>[[32,7],[65,33],[70],[4,64],[32,4],[32,5],[16,builtin('__WeakRef_prototype_toString')],[33,6],[12,1],[11]]),...t([34],()=>[[32,7],[65,34],[70],[4,64],[32,4],[32,5],[16,builtin('__WeakSet_prototype_toString')],[33,6],[12,1],[11]]),...t([35],()=>[[32,7],[65,35],[70],[4,64],[32,4],[32,5],[16,builtin('__WeakMap_prototype_toString')],[33,6],[12,1],[11]]),...t([36],()=>[[32,7],[65,36],[70],[4,64],[32,4],[32,5],[16,builtin('__Promise_prototype_toString')],[33,6],[12,1],[11]]),...t([37],()=>[[32,7],[65,37],[70],[4,64],[32,4],[32,5],[16,builtin('__Boolean_prototype_toString')],[33,6],[12,1],[11]]),...t([38],()=>[[32,7],[65,38],[70],[4,64],[32,4],[32,5],[68,0],[65,128,1],[16,builtin('__Number_prototype_toString')],[33,6],[12,1],[11]]),...t([39],()=>[[32,7],[65,39],[70],[4,64],[32,4],[252,2],[32,5],[16,builtin('__String_prototype_toString')],[33,6],[183],[12,1],[11]]),...t([40],()=>[[32,7],[65,40],[70],[4,64],[32,4],[32,5],[16,builtin('__Error_prototype_toString')],[33,6],[12,1],[11]]),...t([41],()=>[[32,7],[65,41],[70],[4,64],[32,4],[32,5],[16,builtin('__AggregateError_prototype_toString')],[33,6],[12,1],[11]]),...t([42],()=>[[32,7],[65,42],[70],[4,64],[32,4],[32,5],[16,builtin('__TypeError_prototype_toString')],[33,6],[12,1],[11]]),...t([43],()=>[[32,7],[65,43],[70],[4,64],[32,4],[32,5],[16,builtin('__ReferenceError_prototype_toString')],[33,6],[12,1],[11]]),...t([44],()=>[[32,7],[65,44],[70],[4,64],[32,4],[32,5],[16,builtin('__SyntaxError_prototype_toString')],[33,6],[12,1],[11]]),...t([45],()=>[[32,7],[65,45],[70],[4,64],[32,4],[32,5],[16,builtin('__RangeError_prototype_toString')],[33,6],[12,1],[11]]),...t([46],()=>[[32,7],[65,46],[70],[4,64],[32,4],[32,5],[16,builtin('__EvalError_prototype_toString')],[33,6],[12,1],[11]]),...t([47],()=>[[32,7],[65,47],[70],[4,64],[32,4],[32,5],[16,builtin('__URIError_prototype_toString')],[33,6],[12,1],[11]]),...t([48],()=>[[32,7],[65,48],[70],[4,64],[32,4],[32,5],[16,builtin('__Test262Error_prototype_toString')],[33,6],[12,1],[11]]),...t([49],()=>[[32,7],[65,49],[70],[4,64],[32,4],[32,5],[16,builtin('__TodoError_prototype_toString')],[33,6],[12,1],[11]]),...t([67],()=>[[32,7],[65,195,0],[70],[4,64],[32,4],[252,2],[32,5],[16,builtin('__String_prototype_toString')],[33,6],[183],[12,1],[11]]),...t([80],()=>[[32,7],[65,208,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Array_prototype_toString')],[33,6],[12,1],[11]]),...t([88],()=>[[32,7],[65,216,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Uint8Array_prototype_toString')],[33,6],[12,1],[11]]),...t([89],()=>[[32,7],[65,217,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Int8Array_prototype_toString')],[33,6],[12,1],[11]]),...t([90],()=>[[32,7],[65,218,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Uint8ClampedArray_prototype_toString')],[33,6],[12,1],[11]]),...t([91],()=>[[32,7],[65,219,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Uint16Array_prototype_toString')],[33,6],[12,1],[11]]),...t([92],()=>[[32,7],[65,220,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Int16Array_prototype_toString')],[33,6],[12,1],[11]]),...t([93],()=>[[32,7],[65,221,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Uint32Array_prototype_toString')],[33,6],[12,1],[11]]),...t([94],()=>[[32,7],[65,222,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Int32Array_prototype_toString')],[33,6],[12,1],[11]]),...t([95],()=>[[32,7],[65,223,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Float32Array_prototype_toString')],[33,6],[12,1],[11]]),...t([96],()=>[[32,7],[65,224,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Float64Array_prototype_toString')],[33,6],[12,1],[11]]),...t([128],()=>[[32,7],[65,128,1],[70],[4,64],[68,0],[65,128,1],[33,6],[12,1],[11]]),...t([195],()=>[[32,7],[65,195,1],[70],[4,64],[32,4],[252,2],[32,5],[16,builtin('__ByteString_prototype_toString')],[33,6],[183],[12,1],[11]]),...t(["NaN"],()=>[[32,7],[65,0],[70],[4,64],[68,0],[65,128,1],[33,6],[12,1],[11]]),[32,4],[32,5],[16,builtin('__Object_prototype_toString')],[33,6],[11],[33,2],[32,6],[33,3],[32,2],[33,8],[32,3],[33,7],[2,127],...t([0,128],()=>[[32,7],[65,0],[70],[32,7],[65,128,1],[70],[114],[4,64],[65,1],[12,1],[11]]),...t([7],()=>[[32,7],[65,7],[70],[4,64],[32,8],[68,0],[97],[12,1],[11]]),[65,0],[11],[69],[184],[34,9],[252,3],[4,124],[32,2],[252,2],[32,3],[16,builtin('__Porffor_object_isObjectOrNull')],[33,6],[183],[33,8],[32,6],[33,7],[2,124],...t([67,195],()=>[[32,7],[65,195,0],[70],[32,7],[65,195,1],[70],[114],[4,64],[32,8],[252,3],[40,1,0],[69],[184],[12,1],[11]]),[32,8],[68,0],[97],[184],[11],[65,2],[33,6],[5],[32,9],[65,2],[33,6],[11],[33,8],[32,6],[33,7],[2,127],...t([67,195],()=>[[32,7],[65,195,0],[70],[32,7],[65,195,1],[70],[114],[4,64],[32,8],[252,3],[40,1,0],[12,1],[11]]),[32,8],[252,3],[11],[4,64],[32,2],[32,3],[15],[26],[11],...internalThrow(_,'TypeError',`Cannot convert an object to primitive`),[26],[68,0],[65,128,1],[15]],
|
5178
5178
|
params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
|
5179
|
-
locals:[124,127,124,127,127,127,124,124],localNames:["input","input#type","value","value#type","#proto_target","#proto_target#type","#
|
5179
|
+
locals:[124,127,124,127,127,127,124,124],localNames:["input","input#type","value","value#type","#proto_target","#proto_target#type","#last_type","#typeswitch_tmp1","#logicinner_tmp","logictmp"],
|
5180
5180
|
usesTag:1,
|
5181
5181
|
}
|
5182
5182
|
this.__ecma262_ToPrimitive_String = {
|
5183
|
-
wasm:(_,{t,builtin,internalThrow})=>[[32,0],[33,4],[32,1],[33,5],[32,1],[33,
|
5183
|
+
wasm:(_,{t,builtin,internalThrow})=>[[32,0],[33,4],[32,1],[33,5],[32,1],[33,7],[2,124],...t([1],()=>[[32,7],[65,1],[70],[4,64],[32,4],[32,5],[68,0],[65,128,1],[16,builtin('__Number_prototype_toString')],[33,6],[12,1],[11]]),...t([2],()=>[[32,7],[65,2],[70],[4,64],[32,4],[32,5],[16,builtin('__Boolean_prototype_toString')],[33,6],[12,1],[11]]),...t([5],()=>[[32,7],[65,5],[70],[4,64],[32,4],[32,5],[16,builtin('__Symbol_prototype_toString')],[33,6],[12,1],[11]]),...t([6],()=>[[32,7],[65,6],[70],[4,64],[32,4],[32,5],[16,builtin('__Function_prototype_toString')],[33,6],[12,1],[11]]),...t([7],()=>[[32,7],[65,7],[70],[4,64],[32,4],[32,5],[16,builtin('__Object_prototype_toString')],[33,6],[12,1],[11]]),...t([18],()=>[[32,7],[65,18],[70],[4,64],[32,4],[32,5],[16,builtin('__Date_prototype_toString')],[33,6],[12,1],[11]]),...t([19],()=>[[32,7],[65,19],[70],[4,64],[32,4],[32,5],[16,builtin('__Set_prototype_toString')],[33,6],[12,1],[11]]),...t([20],()=>[[32,7],[65,20],[70],[4,64],[32,4],[32,5],[16,builtin('__Map_prototype_toString')],[33,6],[12,1],[11]]),...t([33],()=>[[32,7],[65,33],[70],[4,64],[32,4],[32,5],[16,builtin('__WeakRef_prototype_toString')],[33,6],[12,1],[11]]),...t([34],()=>[[32,7],[65,34],[70],[4,64],[32,4],[32,5],[16,builtin('__WeakSet_prototype_toString')],[33,6],[12,1],[11]]),...t([35],()=>[[32,7],[65,35],[70],[4,64],[32,4],[32,5],[16,builtin('__WeakMap_prototype_toString')],[33,6],[12,1],[11]]),...t([36],()=>[[32,7],[65,36],[70],[4,64],[32,4],[32,5],[16,builtin('__Promise_prototype_toString')],[33,6],[12,1],[11]]),...t([37],()=>[[32,7],[65,37],[70],[4,64],[32,4],[32,5],[16,builtin('__Boolean_prototype_toString')],[33,6],[12,1],[11]]),...t([38],()=>[[32,7],[65,38],[70],[4,64],[32,4],[32,5],[68,0],[65,128,1],[16,builtin('__Number_prototype_toString')],[33,6],[12,1],[11]]),...t([39],()=>[[32,7],[65,39],[70],[4,64],[32,4],[252,2],[32,5],[16,builtin('__String_prototype_toString')],[33,6],[183],[12,1],[11]]),...t([40],()=>[[32,7],[65,40],[70],[4,64],[32,4],[32,5],[16,builtin('__Error_prototype_toString')],[33,6],[12,1],[11]]),...t([41],()=>[[32,7],[65,41],[70],[4,64],[32,4],[32,5],[16,builtin('__AggregateError_prototype_toString')],[33,6],[12,1],[11]]),...t([42],()=>[[32,7],[65,42],[70],[4,64],[32,4],[32,5],[16,builtin('__TypeError_prototype_toString')],[33,6],[12,1],[11]]),...t([43],()=>[[32,7],[65,43],[70],[4,64],[32,4],[32,5],[16,builtin('__ReferenceError_prototype_toString')],[33,6],[12,1],[11]]),...t([44],()=>[[32,7],[65,44],[70],[4,64],[32,4],[32,5],[16,builtin('__SyntaxError_prototype_toString')],[33,6],[12,1],[11]]),...t([45],()=>[[32,7],[65,45],[70],[4,64],[32,4],[32,5],[16,builtin('__RangeError_prototype_toString')],[33,6],[12,1],[11]]),...t([46],()=>[[32,7],[65,46],[70],[4,64],[32,4],[32,5],[16,builtin('__EvalError_prototype_toString')],[33,6],[12,1],[11]]),...t([47],()=>[[32,7],[65,47],[70],[4,64],[32,4],[32,5],[16,builtin('__URIError_prototype_toString')],[33,6],[12,1],[11]]),...t([48],()=>[[32,7],[65,48],[70],[4,64],[32,4],[32,5],[16,builtin('__Test262Error_prototype_toString')],[33,6],[12,1],[11]]),...t([49],()=>[[32,7],[65,49],[70],[4,64],[32,4],[32,5],[16,builtin('__TodoError_prototype_toString')],[33,6],[12,1],[11]]),...t([67],()=>[[32,7],[65,195,0],[70],[4,64],[32,4],[252,2],[32,5],[16,builtin('__String_prototype_toString')],[33,6],[183],[12,1],[11]]),...t([80],()=>[[32,7],[65,208,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Array_prototype_toString')],[33,6],[12,1],[11]]),...t([88],()=>[[32,7],[65,216,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Uint8Array_prototype_toString')],[33,6],[12,1],[11]]),...t([89],()=>[[32,7],[65,217,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Int8Array_prototype_toString')],[33,6],[12,1],[11]]),...t([90],()=>[[32,7],[65,218,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Uint8ClampedArray_prototype_toString')],[33,6],[12,1],[11]]),...t([91],()=>[[32,7],[65,219,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Uint16Array_prototype_toString')],[33,6],[12,1],[11]]),...t([92],()=>[[32,7],[65,220,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Int16Array_prototype_toString')],[33,6],[12,1],[11]]),...t([93],()=>[[32,7],[65,221,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Uint32Array_prototype_toString')],[33,6],[12,1],[11]]),...t([94],()=>[[32,7],[65,222,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Int32Array_prototype_toString')],[33,6],[12,1],[11]]),...t([95],()=>[[32,7],[65,223,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Float32Array_prototype_toString')],[33,6],[12,1],[11]]),...t([96],()=>[[32,7],[65,224,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Float64Array_prototype_toString')],[33,6],[12,1],[11]]),...t([128],()=>[[32,7],[65,128,1],[70],[4,64],[68,0],[65,128,1],[33,6],[12,1],[11]]),...t([195],()=>[[32,7],[65,195,1],[70],[4,64],[32,4],[252,2],[32,5],[16,builtin('__ByteString_prototype_toString')],[33,6],[183],[12,1],[11]]),...t(["NaN"],()=>[[32,7],[65,0],[70],[4,64],[68,0],[65,128,1],[33,6],[12,1],[11]]),[32,4],[32,5],[16,builtin('__Object_prototype_toString')],[33,6],[11],[33,2],[32,6],[33,3],[32,2],[33,8],[32,3],[33,7],[2,127],...t([0,128],()=>[[32,7],[65,0],[70],[32,7],[65,128,1],[70],[114],[4,64],[65,1],[12,1],[11]]),...t([7],()=>[[32,7],[65,7],[70],[4,64],[32,8],[68,0],[97],[12,1],[11]]),[65,0],[11],[69],[184],[34,9],[252,3],[4,124],[32,2],[252,2],[32,3],[16,builtin('__Porffor_object_isObjectOrNull')],[33,6],[183],[33,8],[32,6],[33,7],[2,124],...t([67,195],()=>[[32,7],[65,195,0],[70],[32,7],[65,195,1],[70],[114],[4,64],[32,8],[252,3],[40,1,0],[69],[184],[12,1],[11]]),[32,8],[68,0],[97],[184],[11],[65,2],[33,6],[5],[32,9],[65,2],[33,6],[11],[33,8],[32,6],[33,7],[2,127],...t([67,195],()=>[[32,7],[65,195,0],[70],[32,7],[65,195,1],[70],[114],[4,64],[32,8],[252,3],[40,1,0],[12,1],[11]]),[32,8],[252,3],[11],[4,64],[32,2],[32,3],[15],[26],[11],[32,0],[33,4],[32,1],[33,5],[32,1],[33,7],[2,124],...t([1],()=>[[32,7],[65,1],[70],[4,64],[32,4],[32,5],[16,builtin('__Number_prototype_valueOf')],[33,6],[12,1],[11]]),...t([2],()=>[[32,7],[65,2],[70],[4,64],[32,4],[32,5],[16,builtin('__Boolean_prototype_valueOf')],[33,6],[12,1],[11]]),...t([5],()=>[[32,7],[65,5],[70],[4,64],[32,4],[32,5],[16,builtin('__Symbol_prototype_valueOf')],[33,6],[12,1],[11]]),...t([7],()=>[[32,7],[65,7],[70],[4,64],[32,4],[32,5],[16,builtin('__Object_prototype_valueOf')],[33,6],[12,1],[11]]),...t([18],()=>[[32,7],[65,18],[70],[4,64],[32,4],[32,5],[16,builtin('__Date_prototype_valueOf')],[33,6],[12,1],[11]]),...t([37],()=>[[32,7],[65,37],[70],[4,64],[32,4],[32,5],[16,builtin('__Boolean_prototype_valueOf')],[33,6],[12,1],[11]]),...t([38],()=>[[32,7],[65,38],[70],[4,64],[32,4],[32,5],[16,builtin('__Number_prototype_valueOf')],[33,6],[12,1],[11]]),...t([39],()=>[[32,7],[65,39],[70],[4,64],[32,4],[252,2],[32,5],[16,builtin('__String_prototype_valueOf')],[33,6],[183],[12,1],[11]]),...t([67],()=>[[32,7],[65,195,0],[70],[4,64],[32,4],[252,2],[32,5],[16,builtin('__String_prototype_valueOf')],[33,6],[183],[12,1],[11]]),...t([80],()=>[[32,7],[65,208,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([88],()=>[[32,7],[65,216,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Uint8Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([89],()=>[[32,7],[65,217,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Int8Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([90],()=>[[32,7],[65,218,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Uint8ClampedArray_prototype_valueOf')],[33,6],[12,1],[11]]),...t([91],()=>[[32,7],[65,219,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Uint16Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([92],()=>[[32,7],[65,220,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Int16Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([93],()=>[[32,7],[65,221,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Uint32Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([94],()=>[[32,7],[65,222,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Int32Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([95],()=>[[32,7],[65,223,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Float32Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([96],()=>[[32,7],[65,224,0],[70],[4,64],[32,4],[32,5],[16,builtin('__Float64Array_prototype_valueOf')],[33,6],[12,1],[11]]),...t([128],()=>[[32,7],[65,128,1],[70],[4,64],[68,0],[65,128,1],[33,6],[12,1],[11]]),...t([195],()=>[[32,7],[65,195,1],[70],[4,64],[32,4],[252,2],[32,5],[16,builtin('__ByteString_prototype_valueOf')],[33,6],[183],[12,1],[11]]),...t(["NaN"],()=>[[32,7],[65,0],[70],[4,64],[68,0],[65,128,1],[33,6],[12,1],[11]]),[32,4],[32,5],[16,builtin('__Object_prototype_valueOf')],[33,6],[11],[33,2],[32,6],[33,3],[32,2],[33,8],[32,3],[33,7],[2,127],...t([0,128],()=>[[32,7],[65,0],[70],[32,7],[65,128,1],[70],[114],[4,64],[65,1],[12,1],[11]]),...t([7],()=>[[32,7],[65,7],[70],[4,64],[32,8],[68,0],[97],[12,1],[11]]),[65,0],[11],[69],[184],[34,9],[252,3],[4,124],[32,2],[252,2],[32,3],[16,builtin('__Porffor_object_isObjectOrNull')],[33,6],[183],[33,8],[32,6],[33,7],[2,124],...t([67,195],()=>[[32,7],[65,195,0],[70],[32,7],[65,195,1],[70],[114],[4,64],[32,8],[252,3],[40,1,0],[69],[184],[12,1],[11]]),[32,8],[68,0],[97],[184],[11],[65,2],[33,6],[5],[32,9],[65,2],[33,6],[11],[33,8],[32,6],[33,7],[2,127],...t([67,195],()=>[[32,7],[65,195,0],[70],[32,7],[65,195,1],[70],[114],[4,64],[32,8],[252,3],[40,1,0],[12,1],[11]]),[32,8],[252,3],[11],[4,64],[32,2],[32,3],[15],[26],[11],...internalThrow(_,'TypeError',`Cannot convert an object to primitive`),[26],[68,0],[65,128,1],[15]],
|
5184
5184
|
params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
|
5185
|
-
locals:[124,127,124,127,127,127,124,124],localNames:["input","input#type","value","value#type","#proto_target","#proto_target#type","#
|
5185
|
+
locals:[124,127,124,127,127,127,124,124],localNames:["input","input#type","value","value#type","#proto_target","#proto_target#type","#last_type","#typeswitch_tmp1","#logicinner_tmp","logictmp"],
|
5186
5186
|
usesTag:1,
|
5187
5187
|
}
|
5188
5188
|
this.__ecma262_ToNumber = {
|
package/compiler/codegen.js
CHANGED
@@ -2382,24 +2382,22 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
|
|
2382
2382
|
}
|
2383
2383
|
|
2384
2384
|
if (Object.keys(protoBC).length > 0) {
|
2385
|
-
|
2385
|
+
protoBC.default = decl.optional ?
|
2386
|
+
withType(scope, [ number(UNDEFINED) ], TYPES.undefined) :
|
2387
|
+
internalThrow(scope, 'TypeError', `'${protoName}' proto func tried to be called on a type without an impl`, true);
|
2386
2388
|
|
2387
2389
|
// fallback to object prototype impl as a basic prototype chain hack
|
2388
|
-
if (protoBC[TYPES.object])
|
2390
|
+
if (protoBC[TYPES.object]) {
|
2391
|
+
protoBC[TYPES.undefined] = protoBC[TYPES.null] = protoBC.default;
|
2392
|
+
protoBC.default = protoBC[TYPES.object];
|
2393
|
+
}
|
2389
2394
|
|
2390
2395
|
// alias primitive prototype with primitive object types
|
2391
2396
|
aliasPrimObjsBC(protoBC);
|
2392
2397
|
|
2393
2398
|
return [
|
2394
2399
|
...out,
|
2395
|
-
|
2396
|
-
...typeSwitch(scope, getNodeType(scope, target), {
|
2397
|
-
...protoBC,
|
2398
|
-
|
2399
|
-
// TODO: error better
|
2400
|
-
default: decl.optional ? withType(scope, [ number(UNDEFINED) ], TYPES.undefined)
|
2401
|
-
: def
|
2402
|
-
}, valtypeBinary)
|
2400
|
+
...typeSwitch(scope, getNodeType(scope, target), protoBC, valtypeBinary)
|
2403
2401
|
];
|
2404
2402
|
}
|
2405
2403
|
}
|
@@ -6524,6 +6522,11 @@ const generateFunc = (scope, decl, forceNoExpr = false) => {
|
|
6524
6522
|
};
|
6525
6523
|
}
|
6526
6524
|
|
6525
|
+
if (globalThis.precompile) {
|
6526
|
+
globalThis.funcBodies ??= {};
|
6527
|
+
globalThis.funcBodies[name] = body;
|
6528
|
+
}
|
6529
|
+
|
6527
6530
|
// todo: enable for all block statement bodies, not just main
|
6528
6531
|
if (name === '#main') {
|
6529
6532
|
// hoist function declarations to the top of AST pre-codegen so
|
package/compiler/precompile.js
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
import { Opcodes, Valtype } from './wasmSpec.js';
|
2
2
|
import { read_signedLEB128, read_unsignedLEB128 } from './encoding.js';
|
3
3
|
import { TYPES } from './types.js';
|
4
|
+
import { log } from './log.js';
|
4
5
|
|
5
6
|
import process from 'node:process';
|
6
7
|
globalThis.process = process;
|
7
8
|
|
8
9
|
import fs from 'node:fs';
|
9
10
|
import { join } from 'node:path';
|
10
|
-
|
11
11
|
import { fileURLToPath } from 'node:url';
|
12
|
+
|
12
13
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
13
14
|
globalThis.precompileCompilerPath = __dirname;
|
14
15
|
globalThis.precompile = true;
|
@@ -73,6 +74,9 @@ const compile = async (file, _funcs) => {
|
|
73
74
|
const main = funcs.find(x => x.name === '#main');
|
74
75
|
const exports = funcs.filter(x => x.export && x.name !== '#main');
|
75
76
|
for (const x of exports) {
|
77
|
+
const body = globalThis.funcBodies[x.name];
|
78
|
+
const bodyHasTopLevelThrow = body?.body && body.body.some(x => x.type === 'ThrowStatement');
|
79
|
+
|
76
80
|
if (x.data) {
|
77
81
|
x.data = x.data.reduce((acc, x) => { acc[data[x].page] = data[x].bytes; return acc; }, {});
|
78
82
|
}
|
@@ -91,9 +95,14 @@ const compile = async (file, _funcs) => {
|
|
91
95
|
return acc;
|
92
96
|
}, {});
|
93
97
|
|
98
|
+
let depth = 0;
|
94
99
|
for (let i = 0; i < wasm.length; i++) {
|
95
100
|
const y = wasm[i];
|
96
101
|
const n = wasm[i + 1];
|
102
|
+
|
103
|
+
if (y[0] === Opcodes.block || y[0] === Opcodes.loop || y[0] === Opcodes.if || y[0] === Opcodes.try) depth++;
|
104
|
+
if (y[0] === Opcodes.end) depth--;
|
105
|
+
|
97
106
|
if (y[0] === Opcodes.call) {
|
98
107
|
const idx = y[1];
|
99
108
|
const f = funcs.find(x => x.index === idx);
|
@@ -147,6 +156,8 @@ const compile = async (file, _funcs) => {
|
|
147
156
|
}
|
148
157
|
|
149
158
|
if (n[0] === Opcodes.throw) {
|
159
|
+
if (!bodyHasTopLevelThrow && depth === 0) log.warning('codegen', `top-level throw in ${x.name}`);
|
160
|
+
|
150
161
|
x.usesTag = true;
|
151
162
|
if (y[0] === Opcodes.i32_const && n[1] === 0) {
|
152
163
|
const id = read_signedLEB128(y.slice(1));
|
@@ -190,11 +201,11 @@ const precompile = async () => {
|
|
190
201
|
try {
|
191
202
|
await compile(join(dir, file), funcs);
|
192
203
|
} catch (e) {
|
193
|
-
console.log(`\r${' '.repeat(80)}\r${' '.repeat(12)}${file}`);
|
204
|
+
console.log(`\r${' '.repeat(80)}\r${' '.repeat(12)}${file}\r`);
|
194
205
|
throw e;
|
195
206
|
}
|
196
207
|
|
197
|
-
process.stdout.write(`\r${' '.repeat(80)}\r\u001b[90m${`[${(performance.now() - t).toFixed(2)}ms]`.padEnd(12, ' ')}\u001b[0m\u001b[92m${file}\u001b[0m`);
|
208
|
+
process.stdout.write(`\r${' '.repeat(80)}\r\u001b[90m${`[${(performance.now() - t).toFixed(2)}ms]`.padEnd(12, ' ')}\u001b[0m\u001b[92m${file}\u001b[0m\r`);
|
198
209
|
}
|
199
210
|
|
200
211
|
const total = performance.now() - t;
|
package/package.json
CHANGED