Fix incorrect coercion of other failures to Failure::Exception in ReThrow.

TEST=cctest/test-api/OutOfMemoryNested

Review URL: http://codereview.chromium.org/7029028

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7930 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
lrn@chromium.org 2011-05-18 12:22:19 +00:00
parent f40c463526
commit 9307ce2fcf
3 changed files with 10 additions and 2 deletions

View File

@ -896,13 +896,15 @@ Failure* Isolate::Throw(Object* exception, MessageLocation* location) {
Failure* Isolate::ReThrow(MaybeObject* exception, MessageLocation* location) {
bool can_be_caught_externally = false;
ShouldReportException(&can_be_caught_externally,
is_catchable_by_javascript(exception));
bool catchable_by_javascript = is_catchable_by_javascript(exception);
ShouldReportException(&can_be_caught_externally, catchable_by_javascript);
thread_local_top()->catcher_ = can_be_caught_externally ?
try_catch_handler() : NULL;
// Set the exception being re-thrown.
set_pending_exception(exception);
if (exception->IsFailure()) return exception->ToFailureUnchecked();
return Failure::Exception();
}

View File

@ -628,6 +628,7 @@ struct ValueInfo : public Malloced {
// A template-ized version of the IsXXX functions.
template <class C> static inline bool Is(Object* obj);
class Failure;
class MaybeObject BASE_EMBEDDED {
public:
@ -641,6 +642,10 @@ class MaybeObject BASE_EMBEDDED {
*obj = reinterpret_cast<Object*>(this);
return true;
}
inline Failure* ToFailureUnchecked() {
ASSERT(IsFailure());
return reinterpret_cast<Failure*>(this);
}
inline Object* ToObjectUnchecked() {
ASSERT(!IsFailure());
return reinterpret_cast<Object*>(this);

View File

@ -603,6 +603,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateCatchExtensionObject) {
ASSERT(args.length() == 2);
CONVERT_CHECKED(String, key, args[0]);
Object* value = args[1];
ASSERT(!value->IsFailure());
// Create a catch context extension object.
JSFunction* constructor =
isolate->context()->global_context()->