WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
234628
Make DeferredWorkTimer::addPendingWork() return a Ticket.
https://bugs.webkit.org/show_bug.cgi?id=234628
Summary
Make DeferredWorkTimer::addPendingWork() return a Ticket.
Mark Lam
Reported
2021-12-22 20:16:52 PST
This is so that we can use the compiler to enforce that we always call DeferredWorkTimer::addPendingWork() before calling DeferredWorkTimer::scheduleWorkSoon().
rdar://84260429
Attachments
proposed patch.
(29.91 KB, patch)
2021-12-22 20:19 PST
,
Mark Lam
ysuzuki
: review+
Details
Formatted Diff
Diff
patch for landing.
(30.30 KB, patch)
2021-12-23 12:23 PST
,
Mark Lam
no flags
Details
Formatted Diff
Diff
[fast-cq] patch for landing.
(30.93 KB, patch)
2021-12-23 13:58 PST
,
Mark Lam
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Mark Lam
Comment 1
2021-12-22 20:19:54 PST
Created
attachment 447855
[details]
proposed patch.
Yusuke Suzuki
Comment 2
2021-12-22 20:35:32 PST
Comment on
attachment 447855
[details]
proposed patch. View in context:
https://bugs.webkit.org/attachment.cgi?id=447855&action=review
r=me
> Source/JavaScriptCore/runtime/DeferredWorkTimer.cpp:142 > + Vector<Ticket, 16> cancelledTickets; > + for (auto& it : m_pendingTickets) { > + if (it.value->isCancelled()) > + cancelledTickets.append(it.key); > + } > + for (auto& ticket : cancelledTickets) > + m_pendingTickets.remove(ticket);
You can use `HashMap::removeIf` / `HashSet::removeIf`, which is more efficient.
> Source/JavaScriptCore/runtime/DeferredWorkTimer.h:58 > Vector<Strong<JSCell>> dependencies;
It is good if we can use FixedVector<Strong<JSCell>> here, which allocates exact size, and it only has one pointer size.
> Source/JavaScriptCore/runtime/DeferredWorkTimer.h:92 > + HashMap<Ticket, std::unique_ptr<TicketData>> m_pendingTickets;
Why not using `HashSet<std::unique_ptr<TicketData>>`? I think, because of GetPtr abstraction, we can still look up from it via TicketData*, a.k.a. Ticket. And HashSet is 2x more space efficient.
> Source/JavaScriptCore/wasm/WasmStreamingCompiler.cpp:210 > + // The pending work TicketData was keeping the promise alive. We need to
Remove one space between We and need.
Mark Lam
Comment 3
2021-12-23 12:02:12 PST
Thanks for the review. (In reply to Yusuke Suzuki from
comment #2
)
> You can use `HashMap::removeIf` / `HashSet::removeIf`, which is more > efficient.
Fixed.
> > Source/JavaScriptCore/runtime/DeferredWorkTimer.h:58 > > Vector<Strong<JSCell>> dependencies; > > It is good if we can use FixedVector<Strong<JSCell>> here, which allocates > exact size, and it only has one pointer size.
I can't do this yet. Will need to add 2 APIs: FixedVector::clear() and FixedVector::contains(). It's not difficult to add these, but I'll do that in a separate patch, and make this change after that.
> > Source/JavaScriptCore/runtime/DeferredWorkTimer.h:92 > > + HashMap<Ticket, std::unique_ptr<TicketData>> m_pendingTickets; > > Why not using `HashSet<std::unique_ptr<TicketData>>`? I think, because of > GetPtr abstraction, we can still look up from it via TicketData*, a.k.a. > Ticket. > And HashSet is 2x more space efficient.
Fixed.
> > Source/JavaScriptCore/wasm/WasmStreamingCompiler.cpp:210 > > + // The pending work TicketData was keeping the promise alive. We need to > > Remove one space between We and need.
Fixed.
Mark Lam
Comment 4
2021-12-23 12:23:51 PST
Created
attachment 447899
[details]
patch for landing.
Mark Lam
Comment 5
2021-12-23 13:58:57 PST
Created
attachment 447905
[details]
[fast-cq] patch for landing.
Mark Lam
Comment 6
2021-12-23 21:56:52 PST
Comment on
attachment 447905
[details]
[fast-cq] patch for landing. Landing now.
EWS
Comment 7
2021-12-23 22:00:09 PST
Committed
r287421
(
245556@main
): <
https://commits.webkit.org/245556@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 447905
[details]
.
Mark Lam
Comment 8
2022-01-04 11:59:32 PST
(In reply to Mark Lam from
comment #3
)
> (In reply to Yusuke Suzuki from
comment #2
) > > > Source/JavaScriptCore/runtime/DeferredWorkTimer.h:58 > > > Vector<Strong<JSCell>> dependencies; > > > > It is good if we can use FixedVector<Strong<JSCell>> here, which allocates > > exact size, and it only has one pointer size. > > I can't do this yet. Will need to add 2 APIs: FixedVector::clear() and > FixedVector::contains(). It's not difficult to add these, but I'll do that > in a separate patch, and make this change after that.
Fixing this in
https://bugs.webkit.org/show_bug.cgi?id=234855
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug