Revision: 13181
Author:   [email protected]
Date:     Mon Dec 10 04:18:54 2012
Log:      Flush out potential leaks of Failure objects

Review URL: https://codereview.chromium.org/11475027
http://code.google.com/p/v8/source/detail?r=13181

Modified:
 /branches/bleeding_edge/src/heap.h
 /branches/bleeding_edge/src/objects-inl.h
 /branches/bleeding_edge/src/objects.h

=======================================
--- /branches/bleeding_edge/src/heap.h  Fri Dec  7 01:44:10 2012
+++ /branches/bleeding_edge/src/heap.h  Mon Dec 10 04:18:54 2012
@@ -1927,9 +1927,9 @@

   void CreateFixedStubs();

-  MaybeObject* CreateOddball(const char* to_string,
-                             Object* to_number,
-                             byte kind);
+  MUST_USE_RESULT MaybeObject* CreateOddball(const char* to_string,
+                                             Object* to_number,
+                                             byte kind);

   // Allocate a JSArray with no elements
   MUST_USE_RESULT MaybeObject* AllocateJSArray(
=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Mon Dec 10 03:09:12 2012
+++ /branches/bleeding_edge/src/objects-inl.h   Mon Dec 10 04:18:54 2012
@@ -1064,7 +1064,11 @@
   uintptr_t info =
       (static_cast<uintptr_t>(value) << kFailureTypeTagSize) | type;
   ASSERT(((info << kFailureTagSize) >> kFailureTagSize) == info);
- return reinterpret_cast<Failure*>((info << kFailureTagSize) | kFailureTag);
+  // Fill the unused bits with a pattern that's easy to recognize in crash
+  // dumps.
+  static const int kFailureMagicPattern = 0x0BAD0000;
+  return reinterpret_cast<Failure*>(
+      (info << kFailureTagSize) | kFailureTag | kFailureMagicPattern);
 }


=======================================
--- /branches/bleeding_edge/src/objects.h       Mon Dec 10 03:09:12 2012
+++ /branches/bleeding_edge/src/objects.h       Mon Dec 10 04:18:54 2012
@@ -773,7 +773,9 @@
     return reinterpret_cast<Failure*>(this);
   }
   inline Object* ToObjectUnchecked() {
-    ASSERT(!IsFailure());
+ // TODO(jkummerow): Turn this back into an ASSERT when we can be certain
+    // that it never fires in Release mode in the wild.
+    CHECK(!IsFailure());
     return reinterpret_cast<Object*>(this);
   }
   inline Object* ToObjectChecked() {

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to