Index: src/isolate.h |
diff --git a/src/isolate.h b/src/isolate.h |
index 8f4915cefd55bbab5f0f19b70a41ad7a08a8e734..fdf2c61c24f652373ed49aace35f1155639a3132 100644 |
--- a/src/isolate.h |
+++ b/src/isolate.h |
@@ -164,6 +164,31 @@ typedef ZoneList<Handle<Object> > ZoneObjectList; |
RETURN_ON_EXCEPTION_VALUE(isolate, call, MaybeHandle<T>()) |
+// Macros for Maybe. |
+ |
+#define ASSIGN_OR_RETURN_EXCEPTION(isolate, T, dst, call) \ |
+ T dst; \ |
rossberg
2015/10/19 14:33:08
I'm afraid you can't do that, this breaks the macr
neis
2015/10/20 07:58:35
Done.
|
+ do { \ |
+ Maybe<T> result_of_the_call = (call); \ |
+ if (result_of_the_call.IsNothing()) { \ |
+ DCHECK((isolate)->has_pending_exception()); \ |
+ return isolate->heap()->exception(); \ |
+ } \ |
+ dst = result_of_the_call.FromJust(); \ |
+ } while (false) |
+ |
+ |
+#define ASSIGN_OR_RETURN(T, dst, call, value) \ |
+ T dst; \ |
+ do { \ |
+ Maybe<T> result_of_the_call = (call); \ |
+ if (result_of_the_call.IsNothing()) { \ |
+ return value; \ |
+ } \ |
+ dst = result_of_the_call.FromJust(); \ |
+ } while (false) |
+ |
+ |
#define FOR_EACH_ISOLATE_ADDRESS_NAME(C) \ |
C(Handler, handler) \ |
C(CEntryFP, c_entry_fp) \ |