Summary: | REGRESSION(225695) : com.apple.WebKit.WebContent at com.apple.JavaScriptCore: JSC::RegExp::match + 630 :: stack overflow | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Michael Saboff <msaboff> | ||||||
Component: | JavaScriptCore | Assignee: | Michael Saboff <msaboff> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | benjamin, cdumez, cmarcelo, commit-queue, dbates, ews-watchlist, keith_miller, mark.lam, saam, webkit-bug-importer | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | WebKit Nightly Build | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Michael Saboff
2018-02-12 12:54:37 PST
Created attachment 333718 [details]
Patch
Comment on attachment 333718 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=333718&action=review r=me with suggested improvements. > Source/JavaScriptCore/runtime/RegExpInlines.h:122 > + if (m_regExpJITCode.usesPatternContextBuffer()) { > + patternContextBuffer = vm.acquireRegExpPatternContexBuffer(); > + patternContextBufferSize = VM::patternContextBufferSize; > + } > #define EXTRA_JIT_PARAMS , patternContextBuffer, patternContextBufferSize This seems like a prime candidate for using the RAII pattern. How about something like this: RegExpPatternContextBuffer buffer(vm); #define EXTRA_JIT_PARAMS , buffer.buffer(), buffer.size() You can either make RegExpPatternContextBuffer an embedded class in VM, or make it a friend of VM so that it can do the real work. > Source/JavaScriptCore/runtime/RegExpInlines.h:135 > +#if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS) > + if (m_regExpJITCode.usesPatternContextBuffer()) > + vm.releaseRegExpPatternContexBuffer(); > +#endif This can be handled automatically by the RAII object. > Source/JavaScriptCore/yarr/YarrJIT.h:102 > +#endif > + > +#if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS) Why is this needed? (In reply to Mark Lam from comment #3) > Comment on attachment 333718 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=333718&action=review > > r=me with suggested improvements. > > > Source/JavaScriptCore/runtime/RegExpInlines.h:122 > > + if (m_regExpJITCode.usesPatternContextBuffer()) { > > + patternContextBuffer = vm.acquireRegExpPatternContexBuffer(); > > + patternContextBufferSize = VM::patternContextBufferSize; > > + } > > #define EXTRA_JIT_PARAMS , patternContextBuffer, patternContextBufferSize > > This seems like a prime candidate for using the RAII pattern. How about > something like this: > > RegExpPatternContextBuffer buffer(vm); > #define EXTRA_JIT_PARAMS , buffer.buffer(), buffer.size() Better yet, just pass a reference to the RAII object: #define EXTRA_JIT_PARAMS , buffer Created attachment 333813 [details]
Patch updated after reviewer's comments
(In reply to Mark Lam from comment #3) > Comment on attachment 333718 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=333718&action=review > > r=me with suggested improvements. > > > Source/JavaScriptCore/runtime/RegExpInlines.h:122 > > + if (m_regExpJITCode.usesPatternContextBuffer()) { > > + patternContextBuffer = vm.acquireRegExpPatternContexBuffer(); > > + patternContextBufferSize = VM::patternContextBufferSize; > > + } > > #define EXTRA_JIT_PARAMS , patternContextBuffer, patternContextBufferSize > > This seems like a prime candidate for using the RAII pattern. How about > something like this: > > RegExpPatternContextBuffer buffer(vm); > #define EXTRA_JIT_PARAMS , buffer.buffer(), buffer.size() > > You can either make RegExpPatternContextBuffer an embedded class in VM, or > make it a friend of VM so that it can do the real work. I added a RAII class to RegExpInlines.h. > > Source/JavaScriptCore/runtime/RegExpInlines.h:135 > > +#if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS) > > + if (m_regExpJITCode.usesPatternContextBuffer()) > > + vm.releaseRegExpPatternContexBuffer(); > > +#endif > > This can be handled automatically by the RAII object. > > > Source/JavaScriptCore/yarr/YarrJIT.h:102 > > +#endif > > + > > +#if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS) > > Why is this needed? Removed. Attachment 333813 [details] did not pass style-queue:
ERROR: Source/JavaScriptCore/runtime/RegExpInlines.h:147: This { should be at the end of the previous line [whitespace/braces] [4]
ERROR: Source/JavaScriptCore/runtime/RegExpInlines.h:257: This { should be at the end of the previous line [whitespace/braces] [4]
Total errors found: 2 in 8 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 333813 [details]
Patch updated after reviewer's comments
r=me if EWS bots show no issues.
Comment on attachment 333813 [details] Patch updated after reviewer's comments Clearing flags on attachment: 333813 Committed r228481: <https://trac.webkit.org/changeset/228481> All reviewed patches have been landed. Closing bug. |