Skip to content

Commit

Permalink
Disable code page write protection in debug mode (flutter#3299)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmccutchan authored Dec 8, 2016
1 parent 0ebc19c commit 5afca37
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions runtime/dart_init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ static const char* kDartBackgroundCompilationArgs[] = {
"--background_compilation",
};

static const char* kDartWriteProtectCodeArgs[] = {
"--no_write_protect_code",
};

static const char* kDartCheckedModeArgs[] = {
// clang-format off
"--enable_asserts",
Expand Down Expand Up @@ -634,6 +638,14 @@ void InitDartVM() {
const bool use_checked_mode = !IsRunningPrecompiledCode();
#endif

#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG
// Debug mode uses the JIT, disable code page write protection to avoid
// memory page protection changes before and after every compilation.
PushBackAll(&args,
kDartWriteProtectCodeArgs,
arraysize(kDartWriteProtectCodeArgs));
#endif

if (use_checked_mode)
PushBackAll(&args, kDartCheckedModeArgs, arraysize(kDartCheckedModeArgs));

Expand Down

0 comments on commit 5afca37

Please sign in to comment.