Commit bccb536c authored by Camillo Bruni's avatar Camillo Bruni Committed by V8 LUCI CQ

[runtime] DHCECK terminating exception in Microtasks

Check that we don't accidentally end up entering a microtask if we have
a pending terminating exception.

Bug: chromium:1319267
Change-Id: Id1ec7e3deb39aa18f08c363e17bb8df599379d66
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3610624Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80230}
parent b1fbd0dc
......@@ -118,6 +118,7 @@ void MicrotaskQueueBuiltinsAssembler::PrepareForContext(
void MicrotaskQueueBuiltinsAssembler::RunSingleMicrotask(
TNode<Context> current_context, TNode<Microtask> microtask) {
CSA_DCHECK(this, TaggedIsNotSmi(microtask));
CSA_DCHECK(this, Word32BinaryNot(IsExecutionTerminating()));
StoreRoot(RootIndex::kCurrentMicrotask, microtask);
TNode<IntPtrT> saved_entered_context_count = GetEnteredContextCount();
......
......@@ -6170,6 +6170,12 @@ void CodeStubAssembler::SetPendingMessage(TNode<HeapObject> message) {
StoreFullTaggedNoWriteBarrier(pending_message, message);
}
TNode<BoolT> CodeStubAssembler::IsExecutionTerminating() {
TNode<HeapObject> pending_message = GetPendingMessage();
return TaggedEqual(pending_message,
LoadRoot(RootIndex::kTerminationException));
}
TNode<BoolT> CodeStubAssembler::InstanceTypeEqual(TNode<Int32T> instance_type,
int type) {
return Word32Equal(instance_type, Int32Constant(type));
......
......@@ -2522,6 +2522,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<HeapObject> GetPendingMessage();
void SetPendingMessage(TNode<HeapObject> message);
TNode<BoolT> IsExecutionTerminating();
// Type checks.
// Check whether the map is for an object with special properties, such as a
......
......@@ -179,6 +179,8 @@ int MicrotaskQueue::RunMicrotasks(Isolate* isolate) {
processed_microtask_count);
}
DCHECK_IMPLIES(isolate->has_scheduled_exception(),
maybe_result.is_null() && maybe_exception.is_null());
// If execution is terminating, clean up and propagate that to TryCatch scope.
if (maybe_result.is_null() && maybe_exception.is_null()) {
delete[] ring_buffer_;
......
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