@@ -14,14 +14,7 @@ export async function instantiate(imports={}, runInitializer=true) {
14
14
const _ref_QGpzLWpvZGEvY29yZQ_ = imports [ '@js-joda/core' ] ;
15
15
16
16
const js_code = {
17
- 'kotlin.captureStackTrace' : ( ) => new Error ( ) . stack ,
18
- 'kotlin.wasm.internal.throwJsError' : ( message , wasmTypeName , stack ) => {
19
- const error = new Error ( ) ;
20
- error . message = message ;
21
- error . name = wasmTypeName ;
22
- error . stack = stack ;
23
- throw error ;
24
- } ,
17
+ 'kotlin.createJsError' : ( message , cause ) => new Error ( message , { cause } ) ,
25
18
'kotlin.wasm.internal.stringLength' : ( x ) => x . length ,
26
19
'kotlin.wasm.internal.jsExportStringToWasm' : ( src , srcOffset , srcLength , dstAddr ) => {
27
20
const mem16 = new Uint16Array ( wasmExports . memory . buffer , dstAddr , srcLength ) ;
@@ -38,8 +31,8 @@ export async function instantiate(imports={}, runInitializer=true) {
38
31
const str = String . fromCharCode . apply ( null , mem16 ) ;
39
32
return ( prefix == null ) ? str : prefix + str ;
40
33
} ,
41
- 'kotlin.wasm.internal.intToExternref' : ( x ) => x ,
42
34
'kotlin.wasm.internal.externrefToBoolean' : ( ref ) => Boolean ( ref ) ,
35
+ 'kotlin.wasm.internal.intToExternref' : ( x ) => x ,
43
36
'kotlin.wasm.internal.getJsEmptyString' : ( ) => '' ,
44
37
'kotlin.wasm.internal.externrefToString' : ( ref ) => String ( ref ) ,
45
38
'kotlin.wasm.internal.externrefEquals' : ( lhs , rhs ) => lhs === rhs ,
@@ -111,17 +104,23 @@ export async function instantiate(imports={}, runInitializer=true) {
111
104
} ,
112
105
'kotlin.js.__convertKotlinClosureToJsClosure_(()->Unit)' : ( f ) => getCachedJsObject ( f , ( ) => wasmExports [ '__callFunction_(()->Unit)' ] ( f , ) ) ,
113
106
'kotlin.js.jsThrow' : ( e ) => { throw e ; } ,
114
- 'kotlin.io.printError' : ( error ) => printErr ( error ) ,
115
107
'kotlin.io.printlnImpl' : ( message ) => print ( message ) ,
108
+ 'kotlin.io.printError' : ( error ) => printErr ( error ) ,
116
109
'kotlin.js.jsArrayGet' : ( array , index ) => array [ index ] ,
117
110
'kotlin.js.jsArraySet' : ( array , index , value ) => { array [ index ] = value } ,
118
111
'kotlin.js.JsArray_$external_fun' : ( ) => new Array ( ) ,
119
112
'kotlin.js.length_$external_prop_getter' : ( _this ) => _this . length ,
120
113
'kotlin.js.JsArray_$external_class_instanceof' : ( x ) => x instanceof Array ,
114
+ 'kotlin.js.JsArray_$external_class_get' : ( ) => Array ,
121
115
'kotlin.js.stackPlaceHolder_js_code' : ( ) => ( '' ) ,
122
116
'kotlin.js.message_$external_prop_getter' : ( _this ) => _this . message ,
117
+ 'kotlin.js.name_$external_prop_setter' : ( _this , v ) => _this . name = v ,
123
118
'kotlin.js.stack_$external_prop_getter' : ( _this ) => _this . stack ,
119
+ 'kotlin.js.kotlinException_$external_prop_getter' : ( _this ) => _this . kotlinException ,
120
+ 'kotlin.js.kotlinException_$external_prop_setter' : ( _this , v ) => _this . kotlinException = v ,
124
121
'kotlin.js.JsError_$external_class_instanceof' : ( x ) => x instanceof Error ,
122
+ 'kotlin.js.JsString_$external_class_instanceof' : ( x ) => typeof x === 'string' ,
123
+ 'kotlin.js.JsString_$external_class_get' : ( ) => JsString ,
125
124
'kotlin.js.Promise_$external_fun' : ( p0 ) => new Promise ( p0 ) ,
126
125
'kotlin.js.__callJsClosure_((Js?)->Unit)' : ( f , p0 ) => f ( p0 ) ,
127
126
'kotlin.js.__callJsClosure_((Js)->Unit)' : ( f , p0 ) => f ( p0 ) ,
@@ -131,34 +130,15 @@ export async function instantiate(imports={}, runInitializer=true) {
131
130
'kotlin.js.then_$external_fun_1' : ( _this , p0 , p1 ) => _this . then ( p0 , p1 ) ,
132
131
'kotlin.js.__convertKotlinClosureToJsClosure_((Js)->Js?)' : ( f ) => getCachedJsObject ( f , ( p0 ) => wasmExports [ '__callFunction_((Js)->Js?)' ] ( f , p0 ) ) ,
133
132
'kotlin.js.catch_$external_fun' : ( _this , p0 ) => _this . catch ( p0 ) ,
133
+ 'kotlin.js.Promise_$external_class_instanceof' : ( x ) => x instanceof Promise ,
134
+ 'kotlin.js.Promise_$external_class_get' : ( ) => Promise ,
134
135
'kotlin.random.initialSeed' : ( ) => ( ( Math . random ( ) * Math . pow ( 2 , 32 ) ) | 0 ) ,
135
136
'kotlin.wasm.internal.getJsClassName' : ( jsKlass ) => jsKlass . name ,
136
137
'kotlin.wasm.internal.instanceOf' : ( ref , jsKlass ) => ref instanceof jsKlass ,
137
138
'kotlin.wasm.internal.getConstructor' : ( obj ) => obj . constructor ,
138
139
'kotlin.time.tryGetPerformance' : ( ) => typeof globalThis !== 'undefined' && typeof globalThis . performance !== 'undefined' ? globalThis . performance : null ,
139
140
'kotlin.time.getPerformanceNow' : ( performance ) => performance . now ( ) ,
140
141
'kotlin.time.dateNow' : ( ) => Date . now ( ) ,
141
- 'kotlinx.coroutines.tryGetProcess' : ( ) => ( typeof ( process ) !== 'undefined' && typeof ( process . nextTick ) === 'function' ) ? process : null ,
142
- 'kotlinx.coroutines.tryGetWindow' : ( ) => ( typeof ( window ) !== 'undefined' && window != null && typeof ( window . addEventListener ) === 'function' ) ? window : null ,
143
- 'kotlinx.coroutines.nextTick_$external_fun' : ( _this , p0 ) => _this . nextTick ( p0 ) ,
144
- 'kotlinx.coroutines.error_$external_fun' : ( _this , p0 ) => _this . error ( p0 ) ,
145
- 'kotlinx.coroutines.console_$external_prop_getter' : ( ) => console ,
146
- 'kotlinx.coroutines.createScheduleMessagePoster' : ( process ) => ( ) => Promise . resolve ( 0 ) . then ( process ) ,
147
- 'kotlinx.coroutines.__callJsClosure_(()->Unit)' : ( f , ) => f ( ) ,
148
- 'kotlinx.coroutines.createRescheduleMessagePoster' : ( window ) => ( ) => window . postMessage ( 'dispatchCoroutine' , '*' ) ,
149
- 'kotlinx.coroutines.subscribeToWindowMessages' : ( window , process ) => {
150
- const handler = ( event ) => {
151
- if ( event . source == window && event . data == 'dispatchCoroutine' ) {
152
- event . stopPropagation ( ) ;
153
- process ( ) ;
154
- }
155
- }
156
- window . addEventListener ( 'message' , handler , true ) ;
157
- } ,
158
- 'kotlinx.coroutines.setTimeout' : ( window , handler , timeout ) => window . setTimeout ( handler , timeout ) ,
159
- 'kotlinx.coroutines.clearTimeout' : ( handle ) => { if ( typeof clearTimeout !== 'undefined' ) clearTimeout ( handle ) ; } ,
160
- 'kotlinx.coroutines.setTimeout_$external_fun' : ( p0 , p1 ) => setTimeout ( p0 , p1 ) ,
161
- 'kotlinx.coroutines.promiseSetDeferred' : ( promise , deferred ) => promise . deferred = deferred ,
162
142
'kotlinx.browser.window_$external_prop_getter' : ( ) => window ,
163
143
'kotlinx.browser.document_$external_prop_getter' : ( ) => document ,
164
144
'org.w3c.dom.length_$external_prop_getter' : ( _this ) => _this . length ,
@@ -182,32 +162,33 @@ export async function instantiate(imports={}, runInitializer=true) {
182
162
'org.w3c.dom.events.type_$external_prop_getter' : ( _this ) => _this . type ,
183
163
'org.w3c.dom.events.preventDefault_$external_fun' : ( _this , ) => _this . preventDefault ( ) ,
184
164
'org.w3c.dom.events.Event_$external_class_instanceof' : ( x ) => x instanceof Event ,
165
+ 'org.w3c.dom.events.Event_$external_class_get' : ( ) => Event ,
185
166
'org.w3c.dom.events.key_$external_prop_getter' : ( _this ) => _this . key ,
186
167
'org.w3c.dom.events.KeyboardEvent_$external_class_instanceof' : ( x ) => x instanceof KeyboardEvent ,
187
168
'org.w3c.dom.location_$external_prop_getter' : ( _this ) => _this . location ,
188
169
'org.w3c.dom.navigator_$external_prop_getter' : ( _this ) => _this . navigator ,
189
170
'org.w3c.dom.devicePixelRatio_$external_prop_getter' : ( _this ) => _this . devicePixelRatio ,
190
171
'org.w3c.dom.matchMedia_$external_fun' : ( _this , p0 ) => _this . matchMedia ( p0 ) ,
191
- 'org.w3c.dom.clearTimeout_$external_fun' : ( _this , p0 , isDefault0 ) => _this . clearTimeout ( isDefault0 ? undefined : p0 , ) ,
192
- 'org.w3c.dom.fetch_$external_fun' : ( _this , p0 , p1 , isDefault0 ) => _this . fetch ( p0 , isDefault0 ? undefined : p1 , ) ,
193
- 'org.w3c.dom.documentElement_$external_prop_getter' : ( _this ) => _this . documentElement ,
172
+ 'org.w3c.dom.matches_$external_prop_getter' : ( _this ) => _this . matches ,
194
173
'org.w3c.dom.protocol_$external_prop_getter' : ( _this ) => _this . protocol ,
195
174
'org.w3c.dom.hostname_$external_prop_getter' : ( _this ) => _this . hostname ,
196
175
'org.w3c.dom.search_$external_prop_getter' : ( _this ) => _this . search ,
176
+ 'org.w3c.dom.getData_$external_fun' : ( _this , p0 ) => _this . getData ( p0 ) ,
177
+ 'org.w3c.dom.setData_$external_fun' : ( _this , p0 , p1 ) => _this . setData ( p0 , p1 ) ,
178
+ 'org.w3c.dom.language_$external_prop_getter' : ( _this ) => _this . language ,
179
+ 'org.w3c.dom.clearTimeout_$external_fun' : ( _this , p0 , isDefault0 ) => _this . clearTimeout ( isDefault0 ? undefined : p0 , ) ,
180
+ 'org.w3c.dom.fetch_$external_fun' : ( _this , p0 , p1 , isDefault0 ) => _this . fetch ( p0 , isDefault0 ? undefined : p1 , ) ,
181
+ 'org.w3c.dom.documentElement_$external_prop_getter' : ( _this ) => _this . documentElement ,
197
182
'org.w3c.dom.namespaceURI_$external_prop_getter' : ( _this ) => _this . namespaceURI ,
198
183
'org.w3c.dom.localName_$external_prop_getter' : ( _this ) => _this . localName ,
199
184
'org.w3c.dom.getAttribute_$external_fun' : ( _this , p0 ) => _this . getAttribute ( p0 ) ,
200
185
'org.w3c.dom.getAttributeNS_$external_fun' : ( _this , p0 , p1 ) => _this . getAttributeNS ( p0 , p1 ) ,
201
186
'org.w3c.dom.Element_$external_class_instanceof' : ( x ) => x instanceof Element ,
202
- 'org.w3c.dom.matches_$external_prop_getter' : ( _this ) => _this . matches ,
203
187
'org.w3c.dom.data_$external_prop_getter' : ( _this ) => _this . data ,
204
188
'org.w3c.dom.nodeName_$external_prop_getter' : ( _this ) => _this . nodeName ,
205
189
'org.w3c.dom.childNodes_$external_prop_getter' : ( _this ) => _this . childNodes ,
206
190
'org.w3c.dom.lookupPrefix_$external_fun' : ( _this , p0 ) => _this . lookupPrefix ( p0 ) ,
207
191
'org.w3c.dom.item_$external_fun' : ( _this , p0 ) => _this . item ( p0 ) ,
208
- 'org.w3c.dom.language_$external_prop_getter' : ( _this ) => _this . language ,
209
- 'org.w3c.dom.getData_$external_fun' : ( _this , p0 ) => _this . getData ( p0 ) ,
210
- 'org.w3c.dom.setData_$external_fun' : ( _this , p0 , p1 ) => _this . setData ( p0 , p1 ) ,
211
192
'org.w3c.dom.binaryType_$external_prop_setter' : ( _this , v ) => _this . binaryType = v ,
212
193
'org.w3c.dom.close_$external_fun' : ( _this , p0 , p1 , isDefault0 , isDefault1 ) => _this . close ( isDefault0 ? undefined : p0 , isDefault1 ? undefined : p1 , ) ,
213
194
'org.w3c.dom.send_$external_fun' : ( _this , p0 ) => _this . send ( p0 ) ,
@@ -226,13 +207,34 @@ export async function instantiate(imports={}, runInitializer=true) {
226
207
'org.w3c.fetch.body_$external_prop_getter' : ( _this ) => _this . body ,
227
208
'org.w3c.fetch.blob_$external_fun' : ( _this , ) => _this . blob ( ) ,
228
209
'org.w3c.fetch.get_$external_fun' : ( _this , p0 ) => _this . get ( p0 ) ,
229
- 'org.w3c.performance.performance_$external_prop_getter' : ( _this ) => _this . performance ,
230
210
'org.w3c.performance.now_$external_fun' : ( _this , ) => _this . now ( ) ,
211
+ 'org.w3c.performance.performance_$external_prop_getter' : ( _this ) => _this . performance ,
231
212
'org.w3c.xhr.XMLHttpRequest_$external_fun' : ( ) => new XMLHttpRequest ( ) ,
232
213
'org.w3c.xhr.status_$external_prop_getter' : ( _this ) => _this . status ,
233
214
'org.w3c.xhr.open_$external_fun' : ( _this , p0 , p1 , p2 , p3 , p4 , isDefault0 , isDefault1 ) => _this . open ( p0 , p1 , p2 , isDefault0 ? undefined : p3 , isDefault1 ? undefined : p4 , ) ,
234
215
'org.w3c.xhr.send_$external_fun' : ( _this , ) => _this . send ( ) ,
235
216
'org.w3c.xhr.overrideMimeType_$external_fun' : ( _this , p0 ) => _this . overrideMimeType ( p0 ) ,
217
+ 'kotlinx.coroutines.tryGetProcess' : ( ) => ( typeof ( process ) !== 'undefined' && typeof ( process . nextTick ) === 'function' ) ? process : null ,
218
+ 'kotlinx.coroutines.tryGetWindow' : ( ) => ( typeof ( window ) !== 'undefined' && window != null && typeof ( window . addEventListener ) === 'function' ) ? window : null ,
219
+ 'kotlinx.coroutines.nextTick_$external_fun' : ( _this , p0 ) => _this . nextTick ( p0 ) ,
220
+ 'kotlinx.coroutines.error_$external_fun' : ( _this , p0 ) => _this . error ( p0 ) ,
221
+ 'kotlinx.coroutines.console_$external_prop_getter' : ( ) => console ,
222
+ 'kotlinx.coroutines.createScheduleMessagePoster' : ( process ) => ( ) => Promise . resolve ( 0 ) . then ( process ) ,
223
+ 'kotlinx.coroutines.__callJsClosure_(()->Unit)' : ( f , ) => f ( ) ,
224
+ 'kotlinx.coroutines.createRescheduleMessagePoster' : ( window ) => ( ) => window . postMessage ( 'dispatchCoroutine' , '*' ) ,
225
+ 'kotlinx.coroutines.subscribeToWindowMessages' : ( window , process ) => {
226
+ const handler = ( event ) => {
227
+ if ( event . source == window && event . data == 'dispatchCoroutine' ) {
228
+ event . stopPropagation ( ) ;
229
+ process ( ) ;
230
+ }
231
+ }
232
+ window . addEventListener ( 'message' , handler , true ) ;
233
+ } ,
234
+ 'kotlinx.coroutines.setTimeout' : ( window , handler , timeout ) => window . setTimeout ( handler , timeout ) ,
235
+ 'kotlinx.coroutines.clearTimeout' : ( handle ) => { if ( typeof clearTimeout !== 'undefined' ) clearTimeout ( handle ) ; } ,
236
+ 'kotlinx.coroutines.setTimeout_$external_fun' : ( p0 , p1 ) => setTimeout ( p0 , p1 ) ,
237
+ 'kotlinx.coroutines.promiseSetDeferred' : ( promise , deferred ) => promise . deferred = deferred ,
236
238
'androidx.compose.runtime.internal.weakMap_js_code' : ( ) => ( new WeakMap ( ) ) ,
237
239
'androidx.compose.runtime.internal.set_$external_fun' : ( _this , p0 , p1 ) => _this . set ( p0 , p1 ) ,
238
240
'androidx.compose.runtime.internal.get_$external_fun' : ( _this , p0 ) => _this . get ( p0 ) ,
@@ -244,7 +246,7 @@ export async function instantiate(imports={}, runInitializer=true) {
244
246
'org.jetbrains.skiko.w3c.window_$external_object_getInstance' : ( ) => window ,
245
247
'org.jetbrains.skiko.w3c.now_$external_fun' : ( _this , ) => _this . now ( ) ,
246
248
'org.jetbrains.skia.impl.FinalizationRegistry_$external_fun' : ( p0 ) => new FinalizationRegistry ( p0 ) ,
247
- 'org.jetbrains.skia.impl.register_$external_fun' : ( _this , p0 , p1 ) => _this . register ( p0 , p1 ) ,
249
+ 'org.jetbrains.skia.impl.register_$external_fun' : ( _this , p0 , p1 , p2 ) => _this . register ( p0 , p1 , p2 ) ,
248
250
'org.jetbrains.skia.impl.unregister_$external_fun' : ( _this , p0 ) => _this . unregister ( p0 ) ,
249
251
'org.jetbrains.skia.impl._releaseLocalCallbackScope_$external_fun' : ( ) => _ref_Li9za2lrby5tanM_ . _releaseLocalCallbackScope ( ) ,
250
252
'org.jetbrains.skiko.getNavigatorInfo' : ( ) => navigator . userAgentData ? navigator . userAgentData . platform : navigator . platform ,
@@ -263,6 +265,8 @@ export async function instantiate(imports={}, runInitializer=true) {
263
265
'androidx.compose.ui.platform.emptyClipboardItems' : ( ) => [ new ClipboardItem ( { 'text/plain' : new Blob ( [ '' ] , { type : 'text/plain' } ) } ) ] ,
264
266
'androidx.compose.ui.platform.read_$external_fun' : ( _this , ) => _this . read ( ) ,
265
267
'androidx.compose.ui.platform.write_$external_fun' : ( _this , p0 ) => _this . write ( p0 ) ,
268
+ 'androidx.compose.ui.platform.W3CTemporaryClipboard_$external_class_instanceof' : ( x ) => x instanceof Clipboard ,
269
+ 'androidx.compose.ui.platform.W3CTemporaryClipboard_$external_class_get' : ( ) => Clipboard ,
266
270
'androidx.compose.ui.platform.types_$external_prop_getter' : ( _this ) => _this . types ,
267
271
'androidx.compose.ui.platform.getType_$external_fun' : ( _this , p0 ) => _this . getType ( p0 ) ,
268
272
'androidx.compose.foundation.internal.doesJsArrayContainValue' : ( jsArray , value ) => jsArray . includes ( value ) ,
@@ -376,12 +380,15 @@ export async function instantiate(imports={}, runInitializer=true) {
376
380
if ( ! isNodeJs && ! isDeno && ! isStandaloneJsVM && ! isBrowser ) {
377
381
throw "Supported JS engine not detected" ;
378
382
}
379
-
383
+
380
384
const wasmFilePath = './compose-benchmarks-benchmarks.wasm' ;
385
+
386
+ const wasmTag = WebAssembly . JSTag ?? new WebAssembly . Tag ( { parameters : [ 'externref' ] } ) ;
387
+
381
388
const importObject = {
382
389
js_code,
383
390
intrinsics : {
384
- js_error_tag : WebAssembly . JSTag
391
+ tag : wasmTag
385
392
} ,
386
393
'./skiko.mjs' : imports [ './skiko.mjs' ] ,
387
394
0 commit comments