Commit 9307ce2f authored by lrn@chromium.org's avatar lrn@chromium.org

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
parent f40c4635
...@@ -896,13 +896,15 @@ Failure* Isolate::Throw(Object* exception, MessageLocation* location) { ...@@ -896,13 +896,15 @@ Failure* Isolate::Throw(Object* exception, MessageLocation* location) {
Failure* Isolate::ReThrow(MaybeObject* exception, MessageLocation* location) { Failure* Isolate::ReThrow(MaybeObject* exception, MessageLocation* location) {
bool can_be_caught_externally = false; bool can_be_caught_externally = false;
ShouldReportException(&can_be_caught_externally, bool catchable_by_javascript = is_catchable_by_javascript(exception);
is_catchable_by_javascript(exception)); ShouldReportException(&can_be_caught_externally, catchable_by_javascript);
thread_local_top()->catcher_ = can_be_caught_externally ? thread_local_top()->catcher_ = can_be_caught_externally ?
try_catch_handler() : NULL; try_catch_handler() : NULL;
// Set the exception being re-thrown. // Set the exception being re-thrown.
set_pending_exception(exception); set_pending_exception(exception);
if (exception->IsFailure()) return exception->ToFailureUnchecked();
return Failure::Exception(); return Failure::Exception();
} }
......
...@@ -628,6 +628,7 @@ struct ValueInfo : public Malloced { ...@@ -628,6 +628,7 @@ struct ValueInfo : public Malloced {
// A template-ized version of the IsXXX functions. // A template-ized version of the IsXXX functions.
template <class C> static inline bool Is(Object* obj); template <class C> static inline bool Is(Object* obj);
class Failure;
class MaybeObject BASE_EMBEDDED { class MaybeObject BASE_EMBEDDED {
public: public:
...@@ -641,6 +642,10 @@ class MaybeObject BASE_EMBEDDED { ...@@ -641,6 +642,10 @@ class MaybeObject BASE_EMBEDDED {
*obj = reinterpret_cast<Object*>(this); *obj = reinterpret_cast<Object*>(this);
return true; return true;
} }
inline Failure* ToFailureUnchecked() {
ASSERT(IsFailure());
return reinterpret_cast<Failure*>(this);
}
inline Object* ToObjectUnchecked() { inline Object* ToObjectUnchecked() {
ASSERT(!IsFailure()); ASSERT(!IsFailure());
return reinterpret_cast<Object*>(this); return reinterpret_cast<Object*>(this);
......
...@@ -603,6 +603,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateCatchExtensionObject) { ...@@ -603,6 +603,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateCatchExtensionObject) {
ASSERT(args.length() == 2); ASSERT(args.length() == 2);
CONVERT_CHECKED(String, key, args[0]); CONVERT_CHECKED(String, key, args[0]);
Object* value = args[1]; Object* value = args[1];
ASSERT(!value->IsFailure());
// Create a catch context extension object. // Create a catch context extension object.
JSFunction* constructor = JSFunction* constructor =
isolate->context()->global_context()-> isolate->context()->global_context()->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment