Index: runtime/vm/verified_memory.cc |
=================================================================== |
--- runtime/vm/verified_memory.cc (revision 0) |
+++ runtime/vm/verified_memory.cc (revision 0) |
@@ -0,0 +1,33 @@ |
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+#include "vm/verified_memory.h" |
+ |
+namespace dart { |
+ |
+#if defined(DEBUG) |
+ |
+DEFINE_FLAG(bool, verified_mem, false, |
+ "Enable write-barrier verification mode (slow, DEBUG only)."); |
+DEFINE_FLAG(int, verified_mem_max_reserve_mb, 16, |
+ "When verified_mem is true, largest supported reservation (MB)."); |
+ |
+ |
+VirtualMemory* VerifiedMemory::ReserveInternal(intptr_t size) { |
+ if (size > offset()) { |
+ FATAL1("Requested reservation of %" Pd " bytes exceeds the limit. " |
+ "Use --verified_mem_max_reserve_mb to increase it.", size); |
+ } |
+ VirtualMemory* result = VirtualMemory::Reserve(size + offset()); |
+ if (result != NULL) { |
+ // 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
|
+ result->Commit(result->start() + offset(), size, /* executable = */ false); |
+ result->Truncate(size, false); |
+ } |
+ return result; |
+} |
+ |
+#endif // DEBUG |
+ |
+} // namespace dart |