22// Use of this source code is governed by a BSD-style license that can be
33// found in the LICENSE file.
44
5- // Excerpt from `build/run_wasm.js` to add own task queue implementation, since
6- // `setTimeout` and `queueMicrotask` are not always available in shells.
5+ // Excerpt from `wasm_gc_benchmarks/tools/run_wasm.js` to add own task queue
6+ // implementation, since `setTimeout` and `queueMicrotask` are not always
7+ // available in shells.
8+ // TODO: Now (2025-08-14) that all shells have `setTimeout` available, can we
9+ // remove this? Talk to Dart2wasm folks.
710function addTaskQueue ( self ) {
811 "use strict" ;
912
@@ -62,8 +65,7 @@ function addTaskQueue(self) {
6265 ms = Math . max ( 0 , ms ) ;
6366 var id = timerIdCounter ++ ;
6467 // A callback can be scheduled at most once.
65- // (console.assert is only available on D8)
66- // if (isD8) console.assert(f.$timerId === undefined);
68+ console . assert ( f . $timerId === undefined ) ;
6769 f . $timerId = id ;
6870 timerIds [ id ] = f ;
6971 if ( ms == 0 && ! isNextTimerDue ( ) ) {
@@ -262,8 +264,8 @@ class Benchmark {
262264 // The generated JavaScript code from dart2wasm is an ES module, which we
263265 // can only load with a dynamic import (since this file is not a module.)
264266
265- Module . wasmBinary = await getBinary ( wasmBinary ) ;
266- this . dart2wasmJsModule = await dynamicImport ( jsModule ) ;
267+ Module . wasmBinary = await JetStream . getBinary ( JetStream . preload . wasmBinary ) ;
268+ this . dart2wasmJsModule = await JetStream . dynamicImport ( JetStream . preload . jsModule ) ;
267269 }
268270
269271 async runIteration ( ) {
@@ -283,7 +285,7 @@ class Benchmark {
283285 const framesToDraw = 100 ;
284286 const initialFramesToSkip = 0 ;
285287 const dartArgs = [
286- startTimeSinceEpochSeconds ,
288+ startTimeSinceEpochSeconds . toString ( ) ,
287289 framesToDraw . toString ( ) ,
288290 initialFramesToSkip . toString ( )
289291 ] ;
0 commit comments