]> git.kaiwu.me - quickjs.git/commitdiff
fixed microbench with d8
authorFabrice Bellard <fabrice@bellard.org>
Thu, 4 Jun 2026 09:03:10 +0000 (11:03 +0200)
committerFabrice Bellard <fabrice@bellard.org>
Thu, 4 Jun 2026 09:03:10 +0000 (11:03 +0200)
tests/microbench.js

index a9fc5f17aa1455c0580ad7885cf094c1fdbca0ac..37e6a279f6071b33a55fcb836226b83f78ca833a 100644 (file)
@@ -1577,8 +1577,14 @@ function main(argc, argv, g)
 }
 
 if (typeof scriptArgs === "undefined") {
-    scriptArgs = [];
-    if (typeof process.argv === "object")
+    if (typeof process !== "undefined" && typeof process.argv === "object") {
+        /* node case */
         scriptArgs = process.argv.slice(1);
+    } else if (typeof arguments !== "undefined") {
+        /* d8 case */
+        scriptArgs = arguments;
+    } else {
+        scriptArgs = [];
+    }
 }
 main(scriptArgs.length, scriptArgs, this);