| Index: src/isolate.h
|
| diff --git a/src/isolate.h b/src/isolate.h
|
| index b4713786abb0feaedf6598d6686694fcb579c243..2d7995ca08e253c2574f4e9b273d32a7e20f5be6 100644
|
| --- a/src/isolate.h
|
| +++ b/src/isolate.h
|
| @@ -134,12 +134,12 @@ typedef ZoneList<Handle<Object> > ZoneObjectList;
|
| } \
|
| } while (false)
|
|
|
| -#define RETURN_IF_EMPTY_HANDLE_VALUE(isolate, call, value) \
|
| - do { \
|
| - if ((call).is_null()) { \
|
| - ASSERT((isolate)->has_pending_exception()); \
|
| - return (value); \
|
| - } \
|
| +#define RETURN_IF_EMPTY_HANDLE_VALUE(isolate, call, value) \
|
| + do { \
|
| + if ((call).is_null()) { \
|
| + ASSERT((isolate)->has_pending_exception()); \
|
| + return (value); \
|
| + } \
|
| } while (false)
|
|
|
| #define CHECK_NOT_EMPTY_HANDLE(isolate, call) \
|
| @@ -148,9 +148,51 @@ typedef ZoneList<Handle<Object> > ZoneObjectList;
|
| CHECK(!(call).is_null()); \
|
| } while (false)
|
|
|
| -#define RETURN_IF_EMPTY_HANDLE(isolate, call) \
|
| +#define RETURN_IF_EMPTY_HANDLE(isolate, call) \
|
| RETURN_IF_EMPTY_HANDLE_VALUE(isolate, call, Failure::Exception())
|
|
|
| +
|
| +// Macros for MaybeHandle.
|
| +
|
| +#define RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, T) \
|
| + do { \
|
| + Isolate* __isolate__ = (isolate); \
|
| + if (__isolate__->has_scheduled_exception()) { \
|
| + __isolate__->PromoteScheduledException(); \
|
| + return MaybeHandle<T>(); \
|
| + } \
|
| + } while (false)
|
| +
|
| +#define ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, value) \
|
| + do { \
|
| + if (!(call).ToHandle(&dst)) { \
|
| + ASSERT((isolate)->has_pending_exception()); \
|
| + return value; \
|
| + } \
|
| + } while (false)
|
| +
|
| +#define ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call) \
|
| + ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, Failure::Exception())
|
| +
|
| +#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call, T) \
|
| + ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, MaybeHandle<T>())
|
| +
|
| +#define RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, value) \
|
| + do { \
|
| + if (call.is_null()) { \
|
| + ASSERT((isolate)->has_pending_exception()); \
|
| + return value; \
|
| + } \
|
| + } while (false)
|
| +
|
| +#define RETURN_FAILURE_ON_EXCEPTION(isolate, call) \
|
| + RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, Failure::Exception())
|
| +
|
| +#define RETURN_ON_EXCEPTION(isolate, call, T) \
|
| + RETURN_ON_EXCEPTION_VALUE( \
|
| + isolate, dst, call, MaybeHandle<T>::Exception())
|
| +
|
| +
|
| #define FOR_EACH_ISOLATE_ADDRESS_NAME(C) \
|
| C(Handler, handler) \
|
| C(CEntryFP, c_entry_fp) \
|
| @@ -767,6 +809,14 @@ class Isolate {
|
| // Exception throwing support. The caller should use the result
|
| // of Throw() as its return value.
|
| Failure* Throw(Object* exception, MessageLocation* location = NULL);
|
| +
|
| + template <typename T>
|
| + MUST_USE_RESULT MaybeHandle<T> Throw(Handle<Object> exception,
|
| + MessageLocation* location = NULL) {
|
| + Throw(*exception, location);
|
| + return MaybeHandle<T>();
|
| + }
|
| +
|
| // Re-throw an exception. This involves no error reporting since
|
| // error reporting was handled when the exception was thrown
|
| // originally.
|
|
|