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

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

Issue 641243004: Add VerifiedMemory helper for write-barrier verification. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/verified_memory.h ('k') | runtime/vm/verified_memory_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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, (kWordSize <= 4) ? 16 : 32,
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).
25 result->Commit(result->start() + offset(), size, /* executable = */ false);
26 // Truncate without unmapping, so that the returned object looks like
27 // a normal 'size' bytes reservation (but VirtualMemory will correctly
28 // unmap the entire original reservation on destruction).
29 result->Truncate(size, /* try_unmap = */ false);
30 }
31 return result;
32 }
33
34 #endif // DEBUG
35
36 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/verified_memory.h ('k') | runtime/vm/verified_memory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698