Revision: 13562
Author: [email protected]
Date: Wed Jan 30 09:35:29 2013
Log: Work around a bug in Clang that optimizes away a NULL check
Review URL: https://codereview.chromium.org/12090072
http://code.google.com/p/v8/source/detail?r=13562
Modified:
/branches/bleeding_edge/src/spaces.cc
/branches/bleeding_edge/src/spaces.h
=======================================
--- /branches/bleeding_edge/src/spaces.cc Wed Jan 30 04:19:32 2013
+++ /branches/bleeding_edge/src/spaces.cc Wed Jan 30 09:35:29 2013
@@ -711,7 +711,7 @@
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());
=======================================
--- /branches/bleeding_edge/src/spaces.h Wed Jan 30 04:19:32 2013
+++ /branches/bleeding_edge/src/spaces.h Wed Jan 30 09:35:29 2013
@@ -332,6 +332,14 @@
ASSERT((reinterpret_cast<intptr_t>(owner_) & kFailureTagMask) ==
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.