Reviewers: Michael Starzinger,
Message:
Michael: PTAL.
Danno: Just FYI.
Description:
Work around a bug in Clang that optimizes away a NULL check
Please review this at https://codereview.chromium.org/12090072/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/spaces.h
M src/spaces.cc
Index: src/spaces.cc
diff --git a/src/spaces.cc b/src/spaces.cc
index
711cde1c662c0c6c59d7148c2e6dec21f8f878f4..f3c5a08c5e1cc29d2a9590d194f5120789a5a44b
100644
--- a/src/spaces.cc
+++ b/src/spaces.cc
@@ -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());
Index: src/spaces.h
diff --git a/src/spaces.h b/src/spaces.h
index
25f907ebd8a1653247d564bf49a2aa0fb29420ad..9cab8beef26ae9411ca5da87f7c6d320fd7c738f
100644
--- a/src/spaces.h
+++ b/src/spaces.h
@@ -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_;
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.