Work around a bug in Clang that optimizes away a NULL check
Review URL: https://codereview.chromium.org/12090072 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13562 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
46bc919b47
commit
ddc175f244
@ -711,7 +711,7 @@ LargePage* MemoryAllocator::AllocateLargePage(intptr_t object_size,
|
||||
|
||||
void MemoryAllocator::Free(MemoryChunk* chunk) {
|
||||
LOG(isolate_, DeleteEvent("MemoryChunk", chunk));
|
||||
if (chunk->owner() != NULL) {
|
||||
if (chunk->has_owner()) {
|
||||
ObjectSpace space =
|
||||
static_cast<ObjectSpace>(1 << chunk->owner()->identity());
|
||||
PerformAllocationCallback(space, kAllocationActionFree, chunk->size());
|
||||
|
@ -333,6 +333,14 @@ class MemoryChunk {
|
||||
kFailureTag);
|
||||
}
|
||||
|
||||
// Workaround for a bug in Clang-3.3 which in some situations optimizes away
|
||||
// an "if (chunk->owner() != NULL)" check.
|
||||
bool has_owner() {
|
||||
if (owner_ == 0) return false;
|
||||
if (reinterpret_cast<intptr_t>(owner_) == kFailureTag) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
VirtualMemory* reserved_memory() {
|
||||
return &reservation_;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user