Reland "move conditions for JIT into SkVM.h"
This is a reland of 166cd52cee64fb59a1c8daad379feca2e18d723a
with iOS simulator builds disabled.
Original change's description:
> move conditions for JIT into SkVM.h
>
> This makes it easier to keep in sync with the implementation in
> SkVM.cpp, and it's easier to handle here once than in each build system.
>
> Change-Id: I429f90cfc16f35a0d7e0b0fde176bc013aa7db18
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310263
> Commit-Queue: Mike Klein <mtklein@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
> Auto-Submit: Mike Klein <mtklein@google.com>
> Reviewed-by: Herb Derby <herb@google.com>
Change-Id: I82837c3d959769f26197f2402d3b911e71a35675
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310465
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 2b2e47a..64204f1 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1016,8 +1016,8 @@
}
optional("skvm_jit") {
- enabled = skia_enable_skvm_jit
- public_defines = [ "SKVM_JIT" ]
+ enabled = skia_enable_skvm_jit_when_possible
+ public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
if (skia_vtune_path != "") {
public_defines += [ "SKVM_JIT_VTUNE" ]
public_include_dirs = [ "$skia_vtune_path/include" ]
diff --git a/gn/skia.gni b/gn/skia.gni
index ec7642d..c3348b2 100644
--- a/gn/skia.gni
+++ b/gn/skia.gni
@@ -25,10 +25,7 @@
skia_enable_skottie = !(is_win && is_component_build)
skia_enable_skrive = true
skia_enable_sksl_interpreter = is_skia_dev_build
- skia_enable_skvm_jit =
- is_skia_dev_build &&
- ((target_cpu == "x64" && (is_linux || is_mac || is_win)) ||
- (target_cpu == "arm64" && is_android))
+ skia_enable_skvm_jit_when_possible = is_skia_dev_build
skia_enable_tools = is_skia_dev_build
skia_enable_gpu_debug_layers = is_skia_dev_build && is_debug
skia_generate_workarounds = false
diff --git a/src/core/SkVM.h b/src/core/SkVM.h
index 0623259..3a23580 100644
--- a/src/core/SkVM.h
+++ b/src/core/SkVM.h
@@ -19,6 +19,21 @@
class SkWStream;
+#if defined(SKVM_JIT_WHEN_POSSIBLE)
+ #if defined(__x86_64__) || defined(_M_X64)
+ #if defined(_WIN32) || defined(__linux) || defined(__APPLE__)
+ #if !defined(SK_BUILD_FOR_IOS) // Exclude iOS simulator.
+ #define SKVM_JIT
+ #endif
+ #endif
+ #endif
+ #if defined(__aarch64__)
+ #if defined(__ANDROID__)
+ #define SKVM_JIT
+ #endif
+ #endif
+#endif
+
#if 0
#define SKVM_LLVM
#endif