<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[181935] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/181935">181935</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-03-25 00:40:01 -0700 (Wed, 25 Mar 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/181932">r181932</a>.
https://bugs.webkit.org/show_bug.cgi?id=143041
The test fails most of the time on bots (Requested by ap on
#webkit).
Reverted changeset:
"[Content Extensions] Add multi-DFA compiling and
interpreting."
https://bugs.webkit.org/show_bug.cgi?id=143010
http://trac.webkit.org/changeset/181932</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionCompilercpp">trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionsBackendcpp">trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsDFABytecodeCompilercpp">trunk/Source/WebCore/contentextensions/DFABytecodeCompiler.cpp</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsDFABytecodeInterpretercpp">trunk/Source/WebCore/contentextensions/DFABytecodeInterpreter.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebCoreContentExtensionscpp">trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (181934 => 181935)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-25 06:06:15 UTC (rev 181934)
+++ trunk/Source/WebCore/ChangeLog        2015-03-25 07:40:01 UTC (rev 181935)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-03-25 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed, rolling out r181932.
+ https://bugs.webkit.org/show_bug.cgi?id=143041
+
+ The test fails most of the time on bots (Requested by ap on
+ #webkit).
+
+ Reverted changeset:
+
+ "[Content Extensions] Add multi-DFA compiling and
+ interpreting."
+ https://bugs.webkit.org/show_bug.cgi?id=143010
+ http://trac.webkit.org/changeset/181932
+
</ins><span class="cx"> 2015-03-24 Dean Jackson <dino@apple.com>
</span><span class="cx">
</span><span class="cx"> Source/WebCore/rendering/RenderThemeMac.mm:2181:118: error: null passed to a callee that requires a non-null argument [-Werror,-Wnonnull]
</span></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionCompilercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp (181934 => 181935)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp        2015-03-25 06:06:15 UTC (rev 181934)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp        2015-03-25 07:40:01 UTC (rev 181935)
</span><span class="lines">@@ -111,23 +111,16 @@
</span><span class="cx"> Vector<unsigned> actionLocations = serializeActions(parsedRuleList, actions);
</span><span class="cx"> Vector<uint64_t> universalActionLocations;
</span><span class="cx">
</span><del>- Vector<NFA> nfas;
- nfas.append(NFA());
</del><ins>+ NFA nfa;
+ URLFilterParser urlFilterParser(nfa);
</ins><span class="cx"> bool nonUniversalActionSeen = false;
</span><span class="cx"> for (unsigned ruleIndex = 0; ruleIndex < parsedRuleList.size(); ++ruleIndex) {
</span><del>-
- // FIXME: Tune this better and adjust ContentExtensionTest.MultiDFA accordingly.
- if (nfas[nfas.size() - 1].graphSize() > 500)
- nfas.append(NFA());
-
- NFA& lastNFA = nfas[nfas.size() - 1];
- URLFilterParser urlFilterParser(lastNFA);
</del><span class="cx"> const ContentExtensionRule& contentExtensionRule = parsedRuleList[ruleIndex];
</span><span class="cx"> const Trigger& trigger = contentExtensionRule.trigger();
</span><span class="cx"> ASSERT(trigger.urlFilter.length());
</span><span class="cx">
</span><span class="cx"> // High bits are used for flags. This should match how they are used in DFABytecodeCompiler::compileNode.
</span><del>- uint64_t actionLocationAndFlags = (static_cast<uint64_t>(trigger.flags) << 32) | static_cast<uint64_t>(actionLocations[ruleIndex]);
</del><ins>+ uint64_t actionLocationAndFlags =(static_cast<uint64_t>(trigger.flags) << 32) | static_cast<uint64_t>(actionLocations[ruleIndex]);
</ins><span class="cx"> URLFilterParser::ParseStatus status = urlFilterParser.addPattern(trigger.urlFilter, trigger.urlFilterIsCaseSensitive, actionLocationAndFlags);
</span><span class="cx">
</span><span class="cx"> if (status == URLFilterParser::MatchesEverything) {
</span><span class="lines">@@ -156,17 +149,9 @@
</span><span class="cx"> double dfaBuildTimeStart = monotonicallyIncreasingTime();
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- Vector<DFABytecode> bytecode;
- for (size_t i = 0; i < nfas.size(); ++i) {
- DFA dfa = NFAToDFA::convert(nfas[i]);
- if (!i) {
- // Put all the universal actions on the first DFA.
- for (uint64_t actionLocation : universalActionLocations)
- dfa.nodeAt(dfa.root()).actions.append(actionLocation);
- }
- DFABytecodeCompiler compiler(dfa, bytecode);
- compiler.compile();
- }
</del><ins>+ DFA dfa = NFAToDFA::convert(nfa);
+ for (uint64_t actionLocation : universalActionLocations)
+ dfa.nodeAt(dfa.root()).actions.append(actionLocation);
</ins><span class="cx">
</span><span class="cx"> #if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
</span><span class="cx"> double dfaBuildTimeEnd = monotonicallyIncreasingTime();
</span><span class="lines">@@ -179,6 +164,10 @@
</span><span class="cx"> dfa.debugPrintDot();
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ Vector<DFABytecode> bytecode;
+ DFABytecodeCompiler compiler(dfa, bytecode);
+ compiler.compile();
+
</ins><span class="cx"> return { WTF::move(bytecode), WTF::move(actions) };
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionsBackendcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp (181934 => 181935)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp        2015-03-25 06:06:15 UTC (rev 181934)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp        2015-03-25 07:40:01 UTC (rev 181935)
</span><span class="lines">@@ -80,7 +80,6 @@
</span><span class="cx"> const SerializedActionByte* actions = compiledExtension.actions();
</span><span class="cx"> const unsigned actionsLength = compiledExtension.actionsLength();
</span><span class="cx">
</span><del>- bool sawIgnorePreviousRules = false;
</del><span class="cx"> if (!triggeredActions.isEmpty()) {
</span><span class="cx"> Vector<unsigned> actionLocations;
</span><span class="cx"> actionLocations.reserveInitialCapacity(triggeredActions.size());
</span><span class="lines">@@ -88,6 +87,8 @@
</span><span class="cx"> actionLocations.append(static_cast<unsigned>(actionLocation));
</span><span class="cx"> std::sort(actionLocations.begin(), actionLocations.end());
</span><span class="cx">
</span><ins>+ bool sawIgnorePreviousRules = false;
+
</ins><span class="cx"> // Add actions in reverse order to properly deal with IgnorePreviousRules.
</span><span class="cx"> for (unsigned i = actionLocations.size(); i; i--) {
</span><span class="cx"> Action action = Action::deserialize(actions, actionsLength, actionLocations[i - 1]);
</span><span class="lines">@@ -97,9 +98,10 @@
</span><span class="cx"> }
</span><span class="cx"> finalActions.append(action);
</span><span class="cx"> }
</span><ins>+
+ if (!sawIgnorePreviousRules)
+ finalActions.append(Action(ActionType::CSSDisplayNoneStyleSheet, contentExtension->identifier()));
</ins><span class="cx"> }
</span><del>- if (!sawIgnorePreviousRules)
- finalActions.append(Action(ActionType::CSSDisplayNoneStyleSheet, contentExtension->identifier()));
</del><span class="cx"> }
</span><span class="cx"> return finalActions;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsDFABytecodeCompilercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/contentextensions/DFABytecodeCompiler.cpp (181934 => 181935)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/DFABytecodeCompiler.cpp        2015-03-25 06:06:15 UTC (rev 181934)
+++ trunk/Source/WebCore/contentextensions/DFABytecodeCompiler.cpp        2015-03-25 07:40:01 UTC (rev 181935)
</span><span class="lines">@@ -167,9 +167,7 @@
</span><span class="cx">
</span><span class="cx"> void DFABytecodeCompiler::compile()
</span><span class="cx"> {
</span><del>- // DFA header.
- unsigned startLocation = m_bytecode.size();
- append<unsigned>(m_bytecode, 0);
</del><ins>+ ASSERT(!m_bytecode.size());
</ins><span class="cx"> m_nodeStartOffsets.resize(m_dfa.size());
</span><span class="cx">
</span><span class="cx"> // Make sure the root is always at the beginning of the bytecode.
</span><span class="lines">@@ -182,9 +180,6 @@
</span><span class="cx"> // Link.
</span><span class="cx"> for (const auto& linkRecord : m_linkRecords)
</span><span class="cx"> set32Bits(m_bytecode, linkRecord.first, m_nodeStartOffsets[linkRecord.second]);
</span><del>-
- // Set size header.
- set32Bits(m_bytecode, startLocation, m_bytecode.size() - startLocation);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace ContentExtensions
</span></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsDFABytecodeInterpretercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/contentextensions/DFABytecodeInterpreter.cpp (181934 => 181935)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/DFABytecodeInterpreter.cpp        2015-03-25 06:06:15 UTC (rev 181934)
+++ trunk/Source/WebCore/contentextensions/DFABytecodeInterpreter.cpp        2015-03-25 07:40:01 UTC (rev 181935)
</span><span class="lines">@@ -43,15 +43,13 @@
</span><span class="cx">
</span><span class="cx"> DFABytecodeInterpreter::Actions DFABytecodeInterpreter::actionsFromDFARoot()
</span><span class="cx"> {
</span><del>- DFABytecodeInterpreter::Actions universalActionLocations;
-
- // Skip first DFA header. All universal actions are in the first DFA root.
- unsigned programCounter = sizeof(unsigned);
</del><ins>+ unsigned programCounter = 0;
+ DFABytecodeInterpreter::Actions globalActionLocations;
</ins><span class="cx"> while (static_cast<DFABytecodeInstruction>(m_bytecode[programCounter]) == DFABytecodeInstruction::AppendAction) {
</span><del>- universalActionLocations.add(static_cast<uint64_t>(getBits<unsigned>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode))));
</del><ins>+ globalActionLocations.add(static_cast<uint64_t>(getBits<unsigned>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode))));
</ins><span class="cx"> programCounter += instructionSizeWithArguments(DFABytecodeInstruction::AppendAction);
</span><span class="cx"> }
</span><del>- return universalActionLocations;
</del><ins>+ return globalActionLocations;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> DFABytecodeInterpreter::Actions DFABytecodeInterpreter::interpret(const CString& urlCString, uint16_t flags)
</span><span class="lines">@@ -59,92 +57,78 @@
</span><span class="cx"> const char* url = urlCString.data();
</span><span class="cx"> ASSERT(url);
</span><span class="cx">
</span><ins>+ unsigned programCounter = 0;
+ unsigned urlIndex = 0;
+ bool urlIndexIsAfterEndOfString = false;
</ins><span class="cx"> Actions actions;
</span><span class="cx">
</span><del>- unsigned programCounter = 0;
- while (programCounter < m_bytecodeLength) {
</del><ins>+ while (static_cast<DFABytecodeInstruction>(m_bytecode[programCounter]) == DFABytecodeInstruction::AppendAction)
+ programCounter += instructionSizeWithArguments(DFABytecodeInstruction::AppendAction);
</ins><span class="cx">
</span><del>- // DFA header.
- unsigned dfaStart = programCounter;
- unsigned dfaBytecodeLength = getBits<unsigned>(m_bytecode, m_bytecodeLength, programCounter);
- programCounter += sizeof(unsigned);
</del><ins>+ // This should always terminate if interpreting correctly compiled bytecode.
+ while (true) {
+ ASSERT(programCounter <= m_bytecodeLength);
+ switch (static_cast<DFABytecodeInstruction>(m_bytecode[programCounter])) {
</ins><span class="cx">
</span><del>- // Skip the universal actions.
- // FIXME: Replace AppendAction with AppendActions to make this just one jump and make sure there aren't universal actions with flags.
- while (static_cast<DFABytecodeInstruction>(m_bytecode[programCounter]) == DFABytecodeInstruction::AppendAction)
- programCounter += instructionSizeWithArguments(DFABytecodeInstruction::AppendAction);
-
- // Interpret the bytecode from this DFA.
- // This should always terminate if interpreting correctly compiled bytecode.
- unsigned urlIndex = 0;
- bool urlIndexIsAfterEndOfString = false;
- while (true) {
- ASSERT(programCounter <= m_bytecodeLength);
- switch (static_cast<DFABytecodeInstruction>(m_bytecode[programCounter])) {
</del><ins>+ case DFABytecodeInstruction::Terminate:
+ return actions;
</ins><span class="cx">
</span><del>- case DFABytecodeInstruction::Terminate:
- goto nextDFA;
-
- case DFABytecodeInstruction::CheckValue:
- if (urlIndexIsAfterEndOfString)
- goto nextDFA;
</del><ins>+ case DFABytecodeInstruction::CheckValue:
+ if (urlIndexIsAfterEndOfString)
+ return actions;
</ins><span class="cx">
</span><del>- // Check to see if the next character in the url is the value stored with the bytecode.
- if (url[urlIndex] == getBits<uint8_t>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode))) {
- programCounter = getBits<unsigned>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode) + sizeof(uint8_t));
- if (!url[urlIndex])
- urlIndexIsAfterEndOfString = true;
- urlIndex++; // This represents an edge in the DFA.
- } else
- programCounter += instructionSizeWithArguments(DFABytecodeInstruction::CheckValue);
- break;
-
- case DFABytecodeInstruction::CheckValueRange: {
- if (urlIndexIsAfterEndOfString)
- goto nextDFA;
-
- char character = url[urlIndex];
- if (character >= getBits<uint8_t>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode))
- && character <= getBits<uint8_t>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode) + sizeof(uint8_t))) {
- programCounter = getBits<unsigned>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode) + sizeof(uint8_t) + sizeof(uint8_t));
- if (!character)
- urlIndexIsAfterEndOfString = true;
- urlIndex++; // This represents an edge in the DFA.
- } else
- programCounter += instructionSizeWithArguments(DFABytecodeInstruction::CheckValueRange);
- break;
- }
</del><ins>+ // Check to see if the next character in the url is the value stored with the bytecode.
+ if (url[urlIndex] == getBits<uint8_t>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode))) {
+ programCounter = getBits<unsigned>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode) + sizeof(uint8_t));
+ if (!url[urlIndex])
+ urlIndexIsAfterEndOfString = true;
+ urlIndex++; // This represents an edge in the DFA.
+ } else
+ programCounter += instructionSizeWithArguments(DFABytecodeInstruction::CheckValue);
+ break;
</ins><span class="cx">
</span><del>- case DFABytecodeInstruction::Jump:
- if (!url[urlIndex] || urlIndexIsAfterEndOfString)
- goto nextDFA;
-
- programCounter = getBits<unsigned>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode));
</del><ins>+ case DFABytecodeInstruction::CheckValueRange: {
+ if (urlIndexIsAfterEndOfString)
+ return actions;
+
+ char character = url[urlIndex];
+ if (character >= getBits<uint8_t>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode))
+ && character <= getBits<uint8_t>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode) + sizeof(uint8_t))) {
+ programCounter = getBits<unsigned>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode) + sizeof(uint8_t) + sizeof(uint8_t));
+ if (!character)
+ urlIndexIsAfterEndOfString = true;
</ins><span class="cx"> urlIndex++; // This represents an edge in the DFA.
</span><del>- break;
-
- case DFABytecodeInstruction::AppendAction:
- actions.add(static_cast<uint64_t>(getBits<unsigned>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode))));
- programCounter += instructionSizeWithArguments(DFABytecodeInstruction::AppendAction);
- break;
-
- case DFABytecodeInstruction::TestFlagsAndAppendAction:
- if (flags & getBits<uint16_t>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode)))
- actions.add(static_cast<uint64_t>(getBits<unsigned>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode) + sizeof(uint16_t))));
- programCounter += instructionSizeWithArguments(DFABytecodeInstruction::TestFlagsAndAppendAction);
- break;
-
- default:
- RELEASE_ASSERT_NOT_REACHED(); // Invalid bytecode.
- }
- // We should always terminate before or at a null character at the end of a String.
- ASSERT(urlIndex <= urlCString.length() || (urlIndexIsAfterEndOfString && urlIndex <= urlCString.length() + 1));
</del><ins>+ } else
+ programCounter += instructionSizeWithArguments(DFABytecodeInstruction::CheckValueRange);
+ break;
</ins><span class="cx"> }
</span><del>- nextDFA:
- ASSERT(dfaBytecodeLength);
- programCounter = dfaStart + dfaBytecodeLength;
</del><ins>+
+ case DFABytecodeInstruction::Jump:
+ if (!url[urlIndex] || urlIndexIsAfterEndOfString)
+ return actions;
+
+ programCounter = getBits<unsigned>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode));
+ urlIndex++; // This represents an edge in the DFA.
+ break;
+
+ case DFABytecodeInstruction::AppendAction:
+ actions.add(static_cast<uint64_t>(getBits<unsigned>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode))));
+ programCounter += instructionSizeWithArguments(DFABytecodeInstruction::AppendAction);
+ break;
+
+ case DFABytecodeInstruction::TestFlagsAndAppendAction:
+ if (flags & getBits<uint16_t>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode)))
+ actions.add(static_cast<uint64_t>(getBits<unsigned>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecode) + sizeof(uint16_t))));
+ programCounter += instructionSizeWithArguments(DFABytecodeInstruction::TestFlagsAndAppendAction);
+ break;
+
+ default:
+ RELEASE_ASSERT_NOT_REACHED(); // Invalid bytecode.
+ }
+ // We should always terminate before or at a null character at the end of a String.
+ ASSERT(urlIndex <= urlCString.length() || (urlIndexIsAfterEndOfString && urlIndex <= urlCString.length() + 1));
</ins><span class="cx"> }
</span><del>- return actions;
</del><ins>+ RELEASE_ASSERT_NOT_REACHED();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace ContentExtensions
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (181934 => 181935)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-03-25 06:06:15 UTC (rev 181934)
+++ trunk/Tools/ChangeLog        2015-03-25 07:40:01 UTC (rev 181935)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-03-25 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed, rolling out r181932.
+ https://bugs.webkit.org/show_bug.cgi?id=143041
+
+ The test fails most of the time on bots (Requested by ap on
+ #webkit).
+
+ Reverted changeset:
+
+ "[Content Extensions] Add multi-DFA compiling and
+ interpreting."
+ https://bugs.webkit.org/show_bug.cgi?id=143010
+ http://trac.webkit.org/changeset/181932
+
</ins><span class="cx"> 2015-03-24 Alex Christensen <achristensen@webkit.org>
</span><span class="cx">
</span><span class="cx"> [Content Extensions] Add multi-DFA compiling and interpreting.
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebCoreContentExtensionscpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp (181934 => 181935)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp        2015-03-25 06:06:15 UTC (rev 181934)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp        2015-03-25 07:40:01 UTC (rev 181935)
</span><span class="lines">@@ -36,7 +36,6 @@
</span><span class="cx"> #include <wtf/MainThread.h>
</span><span class="cx"> #include <wtf/RunLoop.h>
</span><span class="cx"> #include <wtf/text/CString.h>
</span><del>-#include <wtf/text/StringBuilder.h>
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace ContentExtensions {
</span><span class="lines">@@ -99,22 +98,16 @@
</span><span class="cx"> ContentExtensions::CompiledContentExtensionData m_data;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-void static testRequest(ContentExtensions::ContentExtensionsBackend contentExtensionsBackend, const ResourceLoadInfo& resourceLoadInfo, Vector<ContentExtensions::ActionType> expectedActions, bool ignorePreviousRules = false)
</del><ins>+void static testRequest(ContentExtensions::ContentExtensionsBackend contentExtensionsBackend, const ResourceLoadInfo& resourceLoadInfo, Vector<ContentExtensions::ActionType> expectedActions)
</ins><span class="cx"> {
</span><span class="cx"> auto actions = contentExtensionsBackend.actionsForResourceLoad(resourceLoadInfo);
</span><del>-
- unsigned expectedSize = actions.size();
- if (actions.size() && !ignorePreviousRules)
- expectedSize--; // The last action is applying the compiled stylesheet.
-
- EXPECT_EQ(expectedActions.size(), expectedSize);
- if (expectedActions.size() != expectedSize)
</del><ins>+ // The last action is applying the compiled stylesheet.
+ EXPECT_EQ(expectedActions.size(), actions.size() ? actions.size() - 1 : 0);
+ if (expectedActions.size() != (actions.size() ? actions.size() - 1 : 0))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> for (unsigned i = 0; i < expectedActions.size(); ++i)
</span><span class="cx"> EXPECT_EQ(expectedActions[i], actions[i].type());
</span><del>- if (!ignorePreviousRules)
- EXPECT_EQ(actions[actions.size() - 1].type(), ContentExtensions::ActionType::CSSDisplayNoneStyleSheet);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ResourceLoadInfo mainDocumentRequest(const char* url, ResourceType resourceType = ResourceType::Document)
</span><span class="lines">@@ -517,47 +510,6 @@
</span><span class="cx"> testRequest(backend, mainDocumentRequest("http://block_only_images.org", ResourceType::Document), { });
</span><span class="cx"> }
</span><span class="cx">
</span><del>-TEST_F(ContentExtensionTest, MultiDFA)
-{
- // Make an NFA with about 2000 nodes.
- StringBuilder ruleList;
- ruleList.append('[');
- for (char c1 = 'A'; c1 <= 'Z'; ++c1) {
- for (char c2 = 'A'; c2 <= 'Z'; ++c2) {
- for (char c3 = 'A'; c3 <= 'C'; ++c3) {
- if (c1 != 'A' || c2 != 'A' || c3 != 'A')
- ruleList.append(',');
- ruleList.append("{\"action\":{\"type\":\"");
-
- // Put an ignore-previous-rules near the middle.
- if (c1 == 'L' && c2 == 'L' && c3 == 'A')
- ruleList.append("ignore-previous-rules");
- else
- ruleList.append("block");
-
- ruleList.append("\"},\"trigger\":{\"url-filter\":\".*");
- ruleList.append(c1);
- ruleList.append(c2);
- ruleList.append(c3);
- ruleList.append("\", \"url-filter-is-case-sensitive\":true}}");
- }
- }
- }
- ruleList.append(']');
-
- auto extensionData = ContentExtensions::compileRuleList(ruleList.toString());
- auto extension = InMemoryCompiledContentExtension::create(WTF::move(extensionData));
-
- ContentExtensions::ContentExtensionsBackend backend;
- backend.addContentExtension("ResourceTypeFilter", extension);
-
- testRequest(backend, mainDocumentRequest("http://webkit.org/AAA"), { ContentExtensions::ActionType::BlockLoad });
- testRequest(backend, mainDocumentRequest("http://webkit.org/ZZC"), { ContentExtensions::ActionType::BlockLoad });
- testRequest(backend, mainDocumentRequest("http://webkit.org/LLA/AAA"), { }, true);
- testRequest(backend, mainDocumentRequest("http://webkit.org/LLA/MMC"), { ContentExtensions::ActionType::BlockLoad }, true);
- testRequest(backend, mainDocumentRequest("http://webkit.org/"), { });
-}
-
</del><span class="cx"> static void testPatternStatus(String pattern, ContentExtensions::URLFilterParser::ParseStatus status)
</span><span class="cx"> {
</span><span class="cx"> ContentExtensions::NFA nfa;
</span></span></pre>
</div>
</div>
</body>
</html>