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

Unified Diff: runtime/vm/virtual_memory_test.cc

Issue 792163003: Deletion barrier preparation: validate overwritten references. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/virtual_memory.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/virtual_memory_test.cc
===================================================================
--- runtime/vm/virtual_memory_test.cc (revision 42583)
+++ runtime/vm/virtual_memory_test.cc (working copy)
@@ -8,6 +8,16 @@
namespace dart {
+bool IsZero(char* begin, char* end) {
+ for (char* current = begin; current < end; ++current) {
+ if (*current != 0) {
+ return false;
+ }
+ }
+ return true;
+}
+
+
UNIT_TEST_CASE(AllocateVirtualMemory) {
const intptr_t kVirtualMemoryBlockSize = 64 * KB;
VirtualMemory* vm = VirtualMemory::Reserve(kVirtualMemoryBlockSize);
@@ -27,7 +37,9 @@
EXPECT(!vm->Contains(static_cast<uword>(-1)));
vm->Commit(false);
+
char* buf = reinterpret_cast<char*>(vm->address());
+ EXPECT(IsZero(buf, buf + vm->size()));
buf[0] = 'a';
buf[1] = 'c';
buf[2] = '/';
@@ -86,6 +98,7 @@
const intptr_t kCommitSize = 1 * MB;
vm->Commit(commit_start, kCommitSize, false);
char* buf = reinterpret_cast<char*>(commit_start);
+ EXPECT(IsZero(buf, buf + kCommitSize));
buf[0] = 'f';
buf[1] = 'o';
buf[2] = 'o';
« no previous file with comments | « runtime/vm/virtual_memory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698