Flush out potential leaks of Failure objects

Review URL: https://codereview.chromium.org/11475027

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13181 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
jkummerow@chromium.org 2012-12-10 12:18:54 +00:00
parent 35cd58365d
commit d1cbd1a98c
3 changed files with 11 additions and 5 deletions

View File

@ -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(

View File

@ -1064,7 +1064,11 @@ 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);
// 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);
}

View File

@ -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() {