Reviewers: Michael Starzinger,
Message:
PTAL.
Description:
Flush out potential leaks of Failure objects
Please review this at https://codereview.chromium.org/11475027/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/heap.h
M src/objects-inl.h
M src/objects.h
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index
06d479ff0a180a7fccc2a33b8b8e3911d2d6cf74..72035cadcf3f262955682709c69cb89c712529fa
100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -1927,9 +1927,9 @@ class Heap {
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(
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index
9ff35efbcf90aac117d2f1001fed87d705a8741e..abf99862719c61d0b37a96067ef858e986e8613e
100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1064,7 +1064,9 @@ Failure* Failure::Construct(Type type, intptr_t
value) {
uintptr_t info =
(static_cast<uintptr_t>(value) << kFailureTypeTagSize) | type;
ASSERT(((info << kFailureTagSize) >> kFailureTagSize) == info);
- return reinterpret_cast<Failure*>((info << kFailureTagSize) |
kFailureTag);
+ static const int kFailureMagicPattern = 0x0BAD0000;
+ return reinterpret_cast<Failure*>(
+ (info << kFailureTagSize) | kFailureTag | kFailureMagicPattern);
}
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
e3a0c7ff1eeb4e36c8fcba8d5882136eff3d8096..f8ec5fa8bc0f22e77dbc7ee0381ec3831fc2e496
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -773,7 +773,9 @@ class MaybeObject BASE_EMBEDDED {
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