OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 #include "vm/verified_memory.h" | |
6 | |
7 namespace dart { | |
8 | |
9 #if defined(DEBUG) | |
10 | |
11 DEFINE_FLAG(bool, verified_mem, false, | |
12 "Enable write-barrier verification mode (slow, DEBUG only)."); | |
13 DEFINE_FLAG(int, verified_mem_max_reserve_mb, 16, | |
14 "When verified_mem is true, largest supported reservation (MB)."); | |
15 | |
16 | |
17 VirtualMemory* VerifiedMemory::ReserveInternal(intptr_t size) { | |
18 if (size > offset()) { | |
19 FATAL1("Requested reservation of %" Pd " bytes exceeds the limit. " | |
20 "Use --verified_mem_max_reserve_mb to increase it.", size); | |
21 } | |
22 VirtualMemory* result = VirtualMemory::Reserve(size + offset()); | |
23 if (result != NULL) { | |
24 // Commit the offset part of the reservation (writable, not executable). | |
Ivan Posva
2014/10/29 05:06:07
This is a little light on comments given what is g
koda
2014/10/29 19:47:31
Commented here, and also documented Truncate's 'tr
| |
25 result->Commit(result->start() + offset(), size, /* executable = */ false); | |
26 result->Truncate(size, false); | |
27 } | |
28 return result; | |
29 } | |
30 | |
31 #endif // DEBUG | |
32 | |
33 } // namespace dart | |
OLD | NEW |