[Content Extensions] Process NFAs individually to avoid having all NFAs live at the...
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Apr 2015 00:22:33 +0000 (00:22 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Apr 2015 00:22:33 +0000 (00:22 +0000)
commitb03990777e28f7a9b2da57adff113fc6f2f98c70
treea7e66dd14fbc6c6db18e12d707bc1580c7ca6da9
parent672a7d2c9901478a98228e81096fa1b684e8809b
[Content Extensions] Process NFAs individually to avoid having all NFAs live at the same time
https://bugs.webkit.org/show_bug.cgi?id=144363

Reviewed by Alex Christensen.

Source/WebCore:

This brings dirty memory use when compiling our test content extension down from ~300MB to ~100MB.

* contentextensions/CombinedURLFilters.cpp:
(WebCore::ContentExtensions::CombinedURLFilters::processNFAs):
(WebCore::ContentExtensions::CombinedURLFilters::createNFAs): Deleted.
* contentextensions/CombinedURLFilters.h:
Replace function that creates a Vector of all the NFAs with one that allows incremental processing
as they are created.

* contentextensions/ContentExtensionCompiler.cpp:
(WebCore::ContentExtensions::addUniversalActionsToDFA):
Extract code to add universal actions into a helper, since we need to call it in two places now.

(WebCore::ContentExtensions::compileRuleList):
Adopt CombinedURLFilters::processNFAs. Now that we don't have a Vector of NFAs, we need to keep track
of whether or not any NFAs were processed and if we are currently processing the first NFA so we can
ensure that we have some bytecode generated event for empty rule sets, and that universal actions are
placed on the first DFA.

Tools:

* TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:
(TestWebKitAPI::createNFAs):
(TestWebKitAPI::TEST_F):
* TestWebKitAPI/Tests/WebCore/DFAMinimizer.cpp:
(TestWebKitAPI::countLiveNodes):
(TestWebKitAPI::createNFAs):
(TestWebKitAPI::buildDFAFromPatterns):
Update tests to use a hand rolled createNFAs function on top of CombinedURLFilters::processNFAs.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183518 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/contentextensions/CombinedURLFilters.cpp
Source/WebCore/contentextensions/CombinedURLFilters.h
Source/WebCore/contentextensions/ContentExtensionCompiler.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp
Tools/TestWebKitAPI/Tests/WebCore/DFAMinimizer.cpp