Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PRO-901] Add DG adoptedPromise edge #264

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Domiii
Copy link

@Domiii Domiii commented Nov 19, 2024

@Domiii Domiii self-assigned this Nov 19, 2024
@Domiii Domiii changed the title [PRO-901] Add DG nested_persistent_id [PRO-901] Add DG adoptedPromise edge Nov 19, 2024
Comment on lines +5557 to +5559
if (RecordReplayShouldCallOnPromiseHook() && reason->IsJSReceiver()) {
AddPromiseDependencyGraphAdoption(isolate, Handle<Object>::cast(promise), reason);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? I'm not sure if my initial conclusion that it would be holds true 😅

@@ -4261,6 +4261,17 @@ GetOrCreatePromiseDependencyGraphData(Isolate* isolate, Handle<Object> promise)
return iter->second;
}

void AddPromiseDependencyGraphAdoption(Isolate* isolate, Handle<Object> promise, Handle<Object> adopted) {
PromiseDependencyGraphData& data = GetOrCreatePromiseDependencyGraphData(isolate, promise);
PromiseDependencyGraphData& adopted_data = GetOrCreatePromiseDependencyGraphData(isolate, adopted);
Copy link
Member

@Andarist Andarist Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might, slightly, dilute what GetOrCreatePromiseDependencyGraphData is about. By reading this code I'd think it would contain only promise IDs but that's not quite true as other objects could potentially be "registered" in it, right?

I also wonder if this whole thing can now generate a sensible graph when thenables are involved

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with these concerns, GetOrCreatePromiseDependencyGraphData should only be used with promises. Things won't break if it's used with other objects, but the edges being created here seem fairly meaningless. I'd like a more detailed explanation of how this PR helps to be able to review it.

@@ -4261,6 +4261,17 @@ GetOrCreatePromiseDependencyGraphData(Isolate* isolate, Handle<Object> promise)
return iter->second;
}

void AddPromiseDependencyGraphAdoption(Isolate* isolate, Handle<Object> promise, Handle<Object> adopted) {
PromiseDependencyGraphData& data = GetOrCreatePromiseDependencyGraphData(isolate, promise);
PromiseDependencyGraphData& adopted_data = GetOrCreatePromiseDependencyGraphData(isolate, adopted);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with these concerns, GetOrCreatePromiseDependencyGraphData should only be used with promises. Things won't break if it's used with other objects, but the edges being created here seem fairly meaningless. I'd like a more detailed explanation of how this PR helps to be able to review it.

@bhackett1024 bhackett1024 self-requested a review November 19, 2024 15:18
Copy link

@bhackett1024 bhackett1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, I didn't see the more detailed explanation in the linear issue and discord.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants