Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(980)

Side by Side Diff: runtime/vm/pages.cc

Issue 1635343002: Stop initializing code pages with RWX permissions (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Stop initializing code pages with RWX permissions Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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;
siva 2016/01/28 00:10:16 Shouldn't this be bool create_executable = !FLAG_
Todd Eisenberger 2016/01/28 00:21:05 Good catch; got caught up with finding the RWX lea
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698