Reviewers: Jakob,

Description:
Merged r13562 into trunk branch.

Work around a bug in Clang that optimizes away a NULL check

[email protected]


Please review this at https://codereview.chromium.org/12089074/

SVN Base: https://v8.googlecode.com/svn/trunk

Affected files:
  M src/spaces.h
  M src/spaces.cc
  M src/version.cc


Index: src/spaces.cc
diff --git a/src/spaces.cc b/src/spaces.cc
index bf1a74e5d1c0909d3b786c8cc9b2f519d0b0667e..8195e7c3e834f686ce7baa02cac42f19ca21717a 100644
--- a/src/spaces.cc
+++ b/src/spaces.cc
@@ -710,7 +710,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 9df1d9e96b0cd111a2b3d62061e17ce06c6748aa..ddf9dfe21fec928d4643f3c88a1767c1ef7f30ad 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_;
   }
Index: src/version.cc
diff --git a/src/version.cc b/src/version.cc
index 655c0d79a8d0ef31a4749af8219029930240981c..364aed7fd1cac93ee6d68b39b42cdcca1baa092d 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     16
 #define BUILD_NUMBER      11
-#define PATCH_LEVEL       0
+#define PATCH_LEVEL       1
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0


--
--
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.


Reply via email to