[infra] Support Mac in pkg/dart2wasm/tool/run_benchmark
R=kustermann@google.com
Change-Id: I4f0604468402437a3361269a244f9b32dd8969f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411302
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
diff --git a/pkg/dart2wasm/tool/run_benchmark b/pkg/dart2wasm/tool/run_benchmark
index 469fe33..dffdd22 100755
--- a/pkg/dart2wasm/tool/run_benchmark
+++ b/pkg/dart2wasm/tool/run_benchmark
@@ -26,8 +26,31 @@
RUN_WASM="$SDK_DIR/pkg/dart2wasm/bin/run_wasm.js"
-# Hardcoded to x64 Linux for now.
-D8_BIN="$SDK_DIR/third_party/d8/linux/x64/d8"
+function host_arch() {
+ # Use uname to determine the host architecture.
+ case `uname -m` in
+ x86_64)
+ echo "x64"
+ ;;
+ aarch64 | arm64 | armv8*)
+ echo "arm64"
+ ;;
+ *)
+ echo "Unsupported host architecture" `uname -m` >&2
+ exit 1
+ ;;
+ esac
+}
+
+function host_os() {
+ if [[ `uname` == 'Darwin' ]]; then
+ echo 'macos'
+ else
+ echo 'linux'
+ fi
+}
+
+D8_BIN="$SDK_DIR/third_party/d8/$(host_os)/$(host_arch)/d8"
JSSHELL_BIN="$SDK_DIR/third_party/firefox_jsshell/js"
JSC_BIN="$SDK_DIR/third_party/jsc/jsc"