| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/pages.h" | 5 #include "vm/pages.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/compiler_stats.h" | 8 #include "vm/compiler_stats.h" |
| 9 #include "vm/gc_marker.h" | 9 #include "vm/gc_marker.h" |
| 10 #include "vm/gc_sweeper.h" | 10 #include "vm/gc_sweeper.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #else // TARGET_ARCH_MIPS || TARGET_ARCH_ARM64 | 43 #else // TARGET_ARCH_MIPS || TARGET_ARCH_ARM64 |
| 44 DEFINE_FLAG(bool, concurrent_sweep, true, | 44 DEFINE_FLAG(bool, concurrent_sweep, true, |
| 45 "Concurrent sweep for old generation."); | 45 "Concurrent sweep for old generation."); |
| 46 #endif // TARGET_ARCH_MIPS || TARGET_ARCH_ARM64 | 46 #endif // TARGET_ARCH_MIPS || TARGET_ARCH_ARM64 |
| 47 DEFINE_FLAG(bool, log_growth, false, "Log PageSpace growth policy decisions."); | 47 DEFINE_FLAG(bool, log_growth, false, "Log PageSpace growth policy decisions."); |
| 48 | 48 |
| 49 HeapPage* HeapPage::Initialize(VirtualMemory* memory, PageType type) { | 49 HeapPage* HeapPage::Initialize(VirtualMemory* memory, PageType type) { |
| 50 ASSERT(memory != NULL); | 50 ASSERT(memory != NULL); |
| 51 ASSERT(memory->size() > VirtualMemory::PageSize()); | 51 ASSERT(memory->size() > VirtualMemory::PageSize()); |
| 52 bool is_executable = (type == kExecutable); | 52 bool is_executable = (type == kExecutable); |
| 53 if (!memory->Commit(is_executable)) { | 53 // Create the new page executable (RWX) only if we're not in W^X mode |
| 54 bool create_executable = !FLAG_write_protect_code && is_executable; |
| 55 if (!memory->Commit(create_executable)) { |
| 54 return NULL; | 56 return NULL; |
| 55 } | 57 } |
| 56 HeapPage* result = reinterpret_cast<HeapPage*>(memory->address()); | 58 HeapPage* result = reinterpret_cast<HeapPage*>(memory->address()); |
| 57 ASSERT(result != NULL); | 59 ASSERT(result != NULL); |
| 58 result->memory_ = memory; | 60 result->memory_ = memory; |
| 59 result->next_ = NULL; | 61 result->next_ = NULL; |
| 60 result->executable_ = is_executable; | 62 result->executable_ = is_executable; |
| 61 return result; | 63 return result; |
| 62 } | 64 } |
| 63 | 65 |
| (...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 return 0; | 1217 return 0; |
| 1216 } else { | 1218 } else { |
| 1217 ASSERT(total_time >= gc_time); | 1219 ASSERT(total_time >= gc_time); |
| 1218 int result = static_cast<int>((static_cast<double>(gc_time) / | 1220 int result = static_cast<int>((static_cast<double>(gc_time) / |
| 1219 static_cast<double>(total_time)) * 100); | 1221 static_cast<double>(total_time)) * 100); |
| 1220 return result; | 1222 return result; |
| 1221 } | 1223 } |
| 1222 } | 1224 } |
| 1223 | 1225 |
| 1224 } // namespace dart | 1226 } // namespace dart |
| OLD | NEW |