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

Unified Diff: src/spaces.cc

Issue 336483002: remove this == null (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | « src/spaces.h ('k') | src/x64/assembler-x64-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/spaces.cc
diff --git a/src/spaces.cc b/src/spaces.cc
index 7966a04728c6291e83142eeeda1acf2039c68c77..ab7f41e417f1ead116ac6fa15377a27486d00eb1 100644
--- a/src/spaces.cc
+++ b/src/spaces.cc
@@ -322,9 +322,12 @@ void MemoryAllocator::FreeMemory(VirtualMemory* reservation,
size_executable_ -= size;
}
// Code which is part of the code-range does not have its own VirtualMemory.
- ASSERT(!isolate_->code_range()->contains(
- static_cast<Address>(reservation->address())));
- ASSERT(executable == NOT_EXECUTABLE || !isolate_->code_range()->exists());
+ ASSERT(isolate_->code_range() == NULL ||
+ !isolate_->code_range()->contains(
+ static_cast<Address>(reservation->address())));
+ ASSERT(executable == NOT_EXECUTABLE ||
+ isolate_->code_range() == NULL ||
+ !isolate_->code_range()->valid());
reservation->Release();
}
@@ -342,11 +345,14 @@ void MemoryAllocator::FreeMemory(Address base,
ASSERT(size_executable_ >= size);
size_executable_ -= size;
}
- if (isolate_->code_range()->contains(static_cast<Address>(base))) {
+ if (isolate_->code_range() != NULL &&
+ isolate_->code_range()->contains(static_cast<Address>(base))) {
ASSERT(executable == EXECUTABLE);
isolate_->code_range()->FreeRawMemory(base, size);
} else {
- ASSERT(executable == NOT_EXECUTABLE || !isolate_->code_range()->exists());
+ ASSERT(executable == NOT_EXECUTABLE ||
+ isolate_->code_range() == NULL ||
+ !isolate_->code_range()->valid());
bool result = VirtualMemory::ReleaseRegion(base, size);
USE(result);
ASSERT(result);
@@ -522,7 +528,8 @@ bool MemoryChunk::CommitArea(size_t requested) {
}
} else {
CodeRange* code_range = heap_->isolate()->code_range();
- ASSERT(code_range->exists() && IsFlagSet(IS_EXECUTABLE));
+ ASSERT(code_range != NULL && code_range->valid() &&
+ IsFlagSet(IS_EXECUTABLE));
if (!code_range->CommitRawMemory(start, length)) return false;
}
@@ -538,7 +545,8 @@ bool MemoryChunk::CommitArea(size_t requested) {
if (!reservation_.Uncommit(start, length)) return false;
} else {
CodeRange* code_range = heap_->isolate()->code_range();
- ASSERT(code_range->exists() && IsFlagSet(IS_EXECUTABLE));
+ ASSERT(code_range != NULL && code_range->valid() &&
+ IsFlagSet(IS_EXECUTABLE));
if (!code_range->UncommitRawMemory(start, length)) return false;
}
}
@@ -628,7 +636,7 @@ MemoryChunk* MemoryAllocator::AllocateChunk(intptr_t reserve_area_size,
OS::CommitPageSize());
// Allocate executable memory either from code range or from the
// OS.
- if (isolate_->code_range()->exists()) {
+ if (isolate_->code_range() != NULL && isolate_->code_range()->valid()) {
base = isolate_->code_range()->AllocateRawMemory(chunk_size,
commit_size,
&chunk_size);
@@ -1050,8 +1058,9 @@ intptr_t PagedSpace::SizeOfFirstPage() {
case PROPERTY_CELL_SPACE:
size = 8 * kPointerSize * KB;
break;
- case CODE_SPACE:
- if (heap()->isolate()->code_range()->exists()) {
+ case CODE_SPACE: {
+ CodeRange* code_range = heap()->isolate()->code_range();
+ if (code_range != NULL && code_range->valid()) {
// When code range exists, code pages are allocated in a special way
// (from the reserved code range). That part of the code is not yet
// upgraded to handle small pages.
@@ -1062,6 +1071,7 @@ intptr_t PagedSpace::SizeOfFirstPage() {
kPointerSize);
}
break;
+ }
default:
UNREACHABLE();
}
« no previous file with comments | « src/spaces.h ('k') | src/x64/assembler-x64-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698