Repository navigation
Commit 1edc620
committed
[JSC] Baseline JIT should not construct
https://bugs.webkit.org/show_bug.cgi?id=323102
Reviewed by Yusuke Suzuki.
Heap::m_topGCOwnedDataScope is a debug-only, unsynchronized field that says
whether a GCOwnedDataScope is live on the mutator's stack, and
Heap::clearConcurrentRetainedDataIfPossible asserts it is null before dropping
the old StringImpls it keeps alive for such scopes. Compiler and GC threads are
covered by separate checks there. But JIT::emit_compareImpl and
LOLJIT::emitCompareImpl read a single-character string constant through
JSString::tryGetValue(), which returns a GCOwnedDataScope, so the JITWorker
thread writes the field too. If the IncrementalSweeper timer fires while the
JIT thread is inside that scope, the assertion aborts even though the
ongoing-compilation check would have kept the strings alive.
Read the constant through tryGetValueImpl() and StringImpl::at(0), as the DFG
already does, and assert in setTopGCOwnedDataScopeIfNeeded and
clearTopGCOwnedDataScopeIfNeeded that they never run on a compiler thread.
GC threads still construct such scopes, since
ErrorInstance::reconcileWeakReferencesAtGCEnd materializes stack traces into
strings on the collector thread, so the field keeps ignoring them.
This assertion fired in an ASan build in Bun's CI. Release builds are not
affected.
* Source/JavaScriptCore/heap/GCOwnedDataScope.cpp:
(JSC::setTopGCOwnedDataScopeIfNeeded):
(JSC::clearTopGCOwnedDataScopeIfNeeded):
* Source/JavaScriptCore/jit/JITArithmetic.cpp:
(JSC::JIT::emit_compareImpl):
* Source/JavaScriptCore/lol/LOLJIT.cpp:
(JSC::LOL::LOLJIT::emitCompareImpl):
Canonical link: https://commits.webkit.org/320348@mainGCOwnedDataScope on the compiler thread1 parent d3e5e15 commit 1edc620
3 files changed
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
237 | 236 | | |
238 | 237 | | |
239 | 238 | | |
| 239 | + | |
| 240 | + | |
240 | 241 | | |
241 | 242 | | |
242 | 243 | | |
243 | 244 | | |
244 | 245 | | |
245 | 246 | | |
246 | | - | |
| 247 | + | |
247 | 248 | | |
248 | 249 | | |
249 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
961 | 961 | | |
962 | 962 | | |
963 | 963 | | |
964 | | - | |
965 | 964 | | |
966 | 965 | | |
967 | 966 | | |
| 967 | + | |
| 968 | + | |
968 | 969 | | |
969 | 970 | | |
970 | 971 | | |
971 | 972 | | |
972 | 973 | | |
973 | 974 | | |
974 | | - | |
| 975 | + | |
975 | 976 | | |
976 | 977 | | |
977 | 978 | | |
| |||
0 commit comments