Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: src/isolate.h

Issue 2006673002: Reduce boilerplace for common pattern to return MaybeHandle. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase and fix Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ic/ic.cc ('k') | src/runtime/runtime-array.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.h
diff --git a/src/isolate.h b/src/isolate.h
index 40f0c0ea5c93e3ae13bacfa9b832273c0e1d0133..da803d6d866defcd8b0453b69faa7a3bbe8283c6 100644
--- a/src/isolate.h
+++ b/src/isolate.h
@@ -124,6 +124,17 @@ typedef ZoneList<Handle<Object> > ZoneObjectList;
#define RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, T) \
RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, MaybeHandle<T>())
+#define RETURN_RESULT_OR_FAILURE(isolate, call) \
+ do { \
+ Handle<Object> __result__; \
+ Isolate* __isolate__ = (isolate); \
+ if (!(call).ToHandle(&__result__)) { \
+ DCHECK(__isolate__->has_pending_exception()); \
+ return __isolate__->heap()->exception(); \
+ } \
+ return *__result__; \
+ } while (false)
+
#define ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, value) \
do { \
if (!(call).ToHandle(&dst)) { \
@@ -132,21 +143,26 @@ typedef ZoneList<Handle<Object> > ZoneObjectList;
} \
} while (false)
-#define ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call) \
- ASSIGN_RETURN_ON_EXCEPTION_VALUE( \
- isolate, dst, call, isolate->heap()->exception())
+#define ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call) \
+ do { \
+ Isolate* __isolate__ = (isolate); \
+ ASSIGN_RETURN_ON_EXCEPTION_VALUE(__isolate__, dst, call, \
+ __isolate__->heap()->exception()); \
+ } while (false)
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call, T) \
ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, MaybeHandle<T>())
-#define THROW_NEW_ERROR(isolate, call, T) \
- do { \
- return isolate->Throw<T>(isolate->factory()->call); \
+#define THROW_NEW_ERROR(isolate, call, T) \
+ do { \
+ Isolate* __isolate__ = (isolate); \
+ return __isolate__->Throw<T>(__isolate__->factory()->call); \
} while (false)
-#define THROW_NEW_ERROR_RETURN_FAILURE(isolate, call) \
- do { \
- return isolate->Throw(*isolate->factory()->call); \
+#define THROW_NEW_ERROR_RETURN_FAILURE(isolate, call) \
+ do { \
+ Isolate* __isolate__ = (isolate); \
+ return __isolate__->Throw(*__isolate__->factory()->call); \
} while (false)
#define RETURN_ON_EXCEPTION_VALUE(isolate, call, value) \
@@ -157,8 +173,12 @@ typedef ZoneList<Handle<Object> > ZoneObjectList;
} \
} while (false)
-#define RETURN_FAILURE_ON_EXCEPTION(isolate, call) \
- RETURN_ON_EXCEPTION_VALUE(isolate, call, isolate->heap()->exception())
+#define RETURN_FAILURE_ON_EXCEPTION(isolate, call) \
+ do { \
+ Isolate* __isolate__ = (isolate); \
+ RETURN_ON_EXCEPTION_VALUE(__isolate__, call, \
+ __isolate__->heap()->exception()); \
+ } while (false);
#define RETURN_ON_EXCEPTION(isolate, call, T) \
RETURN_ON_EXCEPTION_VALUE(isolate, call, MaybeHandle<T>())
« no previous file with comments | « src/ic/ic.cc ('k') | src/runtime/runtime-array.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698