Skip to content

Commit

Permalink
chore: update revert_api_dcheck-fail_when_we_reenter_v8_while_termina…
Browse files Browse the repository at this point in the history
…ting.patch

Xref: https://chromium-review.googlesource.com/c/v8/v8/+/5076902
Xref: https://chromium-review.googlesource.com/c/v8/v8/+/5096253

The `bailout_value` variable, which allowed us to fail gracefully in
these macros, has been removed upstream. This raises the temperature
on #40741 ...

Since we don't have a bailout value, return a default-constructed
instance of whatever the return type is of the function that invokes
the macro.
  • Loading branch information
ckerr committed Dec 12, 2023
1 parent 456c92e commit 3509378
Showing 1 changed file with 13 additions and 19 deletions.
Expand Up @@ -14,28 +14,22 @@ Xref: https://chromium-review.googlesource.com/c/v8/v8/+/5075293
Xref: https://github.com/electron/electron/issues/40741

diff --git a/src/api/api-macros.h b/src/api/api-macros.h
index fa272148c4553a2cbfe2438b2770d2fe5cde9a38..08fa9f799b217eb1565d28aa4f86eb5e0001422e 100644
index a300e2fd324..8ab1520a20d 100644
--- a/src/api/api-macros.h
+++ b/src/api/api-macros.h
@@ -48,7 +48,9 @@
#define ENTER_V8_HELPER_INTERNAL(i_isolate, context, class_name, \
function_name, bailout_value, \
HandleScopeClass, do_callback) \
- DCHECK(!i_isolate->is_execution_terminating()); \
+ if (i_isolate->is_execution_terminating()) { \
+ return bailout_value; \
+ } \
HandleScopeClass handle_scope(i_isolate); \
CallDepthScope<do_callback> call_depth_scope(i_isolate, context); \
API_RCS_SCOPE(i_isolate, class_name, function_name); \
@@ -56,7 +58,9 @@
bool has_pending_exception = false
@@ -41,7 +41,6 @@

#define PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(i_isolate, T) \
#define ENTER_V8_HELPER_INTERNAL(i_isolate, context, class_name, \
function_name, HandleScopeClass, do_callback) \
- DCHECK(!i_isolate->is_execution_terminating()); \
HandleScopeClass handle_scope(i_isolate); \
CallDepthScope<do_callback> call_depth_scope(i_isolate, context); \
API_RCS_SCOPE(i_isolate, class_name, function_name); \
@@ -50,7 +49,6 @@

#define PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(i_isolate, context, \
T) \
- DCHECK(!i_isolate->is_execution_terminating()); \
+ if (i_isolate->is_execution_terminating()) { \
+ return MaybeLocal<T>(); \
+ } \
InternalEscapableScope handle_scope(i_isolate); \
CallDepthScope<false> call_depth_scope(i_isolate, v8::Local<v8::Context>()); \
CallDepthScope<false> call_depth_scope(i_isolate, context); \
i::VMState<v8::OTHER> __state__((i_isolate)); \

0 comments on commit 3509378

Please sign in to comment.