diff --git a/runtime/tools/entitlements/gen_snapshot.plist b/runtime/tools/entitlements/gen_snapshot.plist
index e4d040d3c73..694b88bfa7e 100644
--- a/runtime/tools/entitlements/gen_snapshot.plist
+++ b/runtime/tools/entitlements/gen_snapshot.plist
@@ -2,5 +2,7 @@
+ com.apple.security.cs.allow-jit
+
\ No newline at end of file
diff --git a/runtime/tools/entitlements/gen_snapshot_product.plist b/runtime/tools/entitlements/gen_snapshot_product.plist
index e4d040d3c73..694b88bfa7e 100644
--- a/runtime/tools/entitlements/gen_snapshot_product.plist
+++ b/runtime/tools/entitlements/gen_snapshot_product.plist
@@ -2,5 +2,7 @@
+ com.apple.security.cs.allow-jit
+
\ No newline at end of file
diff --git a/runtime/vm/heap/page.cc b/runtime/vm/heap/page.cc
index b353bd5ea8c..d1c507b2aa1 100644
--- a/runtime/vm/heap/page.cc
+++ b/runtime/vm/heap/page.cc
@@ -68,19 +68,13 @@ static intptr_t CacheIndex(uword flags) {
return (flags & Page::kExecutable) != 0 ? 1 : 0;
}
-static bool ExecutesGeneratedCode() {
-#if defined(DART_PRECOMPILER) && !defined(TESTING)
- return false;
-#elif defined(DART_INCLUDE_SIMULATOR)
- return !FLAG_use_simulator;
-#else
- return true;
-#endif
-}
-
Page* Page::Allocate(intptr_t size, uword flags) {
- const bool executable =
- (flags & Page::kExecutable) != 0 && ExecutesGeneratedCode();
+#if defined(DART_INCLUDE_SIMULATOR)
+ const bool using_simulator = FLAG_use_simulator;
+#else
+ const bool using_simulator = false;
+#endif
+ const bool executable = (flags & Page::kExecutable) != 0 && !using_simulator;
const bool compressed = !executable;
const char* name = executable ? "dart-code" : "dart-heap";
@@ -322,7 +316,12 @@ void Page::ResetProgressBar() {
void Page::WriteProtect(bool read_only) {
ASSERT(!is_image());
- if (is_executable() && read_only && ExecutesGeneratedCode()) {
+#if defined(DART_INCLUDE_SIMULATOR)
+ const bool using_simulator = FLAG_use_simulator;
+#else
+ const bool using_simulator = false;
+#endif
+ if (is_executable() && read_only && !using_simulator) {
// Handle making code executable in a special way.
memory_->WriteProtectCode();
} else {