Bug 158142 - Bogus uses of regexp matching should realize that they will OOM before they start swapping
Summary: Bogus uses of regexp matching should realize that they will OOM before they s...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-26 19:20 PDT by Filip Pizlo
Modified: 2016-05-27 07:58 PDT (History)
4 users (show)

See Also:


Attachments
it does something (13.65 KB, patch)
2016-05-26 19:22 PDT, Filip Pizlo
no flags Details | Formatted Diff | Diff
the patch (16.92 KB, patch)
2016-05-26 20:53 PDT, Filip Pizlo
msaboff: review+
Details | Formatted Diff | Diff
performance (77.39 KB, text/plain)
2016-05-27 07:25 PDT, Filip Pizlo
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2016-05-26 19:20:59 PDT
Patch forthcoming.
Comment 1 Filip Pizlo 2016-05-26 19:22:45 PDT
Created attachment 279936 [details]
it does something

The intuition is that the individual regexp matches are not really observable, so if we detect trouble, we can just do a dry run to see how bad things get before we start allocating tons of memory.

On my test case (from jsfunfuzz), this reduces the runtime by >10x and reduces memory usage by ~8x and eliminates swapping. Hooray.
Comment 2 Filip Pizlo 2016-05-26 20:53:25 PDT
Created attachment 279943 [details]
the patch
Comment 3 WebKit Commit Bot 2016-05-26 20:56:11 PDT
Attachment 279943 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/runtime/RegExpObject.cpp:183:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Source/JavaScriptCore/runtime/RegExpObject.cpp:220:  Semicolon defining empty statement for this loop. Use { } instead.  [whitespace/semicolon] [5]
Total errors found: 2 in 8 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Filip Pizlo 2016-05-27 07:25:13 PDT
Created attachment 279958 [details]
performance

Looks neutral on the major benchmarks.
Comment 5 Michael Saboff 2016-05-27 07:42:53 PDT
Comment on attachment 279943 [details]
the patch

r=me
Please add a test that goes into the dry run code but still succeeds.
Comment 6 Filip Pizlo 2016-05-27 07:58:57 PDT
Landed in http://trac.webkit.org/changeset/201451