Diff
Modified: trunk/Source/WebCore/ChangeLog (183666 => 183667)
--- trunk/Source/WebCore/ChangeLog 2015-05-01 04:24:40 UTC (rev 183666)
+++ trunk/Source/WebCore/ChangeLog 2015-05-01 05:01:17 UTC (rev 183667)
@@ -1,3 +1,18 @@
+2015-04-30 Alex Christensen <[email protected]>
+
+ Compile fix when using content extensions debugging code.
+
+ * contentextensions/ContentExtensionCompiler.cpp:
+ (WebCore::ContentExtensions::compileRuleList):
+ * contentextensions/ContentExtensionsDebugging.h:
+ * contentextensions/DFA.cpp:
+ (WebCore::ContentExtensions::printTransitions):
+ (WebCore::ContentExtensions::DFA::debugPrintDot):
+ * contentextensions/DFANode.h:
+ * contentextensions/NFA.cpp:
+ (WebCore::ContentExtensions::NFA::memoryUsed):
+ (WebCore::ContentExtensions::NFA::debugPrintDot):
+
2015-04-30 Dan Bernstein <[email protected]>
Fixed the build for <rdar://problem/20758514>
Modified: trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp (183666 => 183667)
--- trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp 2015-05-01 04:24:40 UTC (rev 183666)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp 2015-05-01 05:01:17 UTC (rev 183667)
@@ -214,7 +214,7 @@
#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
double dfaBuildTimeEnd = monotonicallyIncreasingTime();
- dataLogF(" Time spent building the DFA %zu: %f\n", i, (dfaBuildTimeEnd - dfaBuildTimeStart));
+ dataLogF(" Time spent building the DFA: %f\n", (dfaBuildTimeEnd - dfaBuildTimeStart));
#endif
#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
@@ -223,11 +223,11 @@
dfa.minimize();
#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
double dfaMinimizationTimeEnd = monotonicallyIncreasingTime();
- dataLogF(" Time spent miniminizing the DFA %zu: %f\n", i, (dfaMinimizationTimeEnd - dfaMinimizationTimeStart));
+ dataLogF(" Time spent miniminizing the DFA: %f\n", (dfaMinimizationTimeEnd - dfaMinimizationTimeStart));
#endif
#if CONTENT_EXTENSIONS_STATE_MACHINE_DEBUGGING
- WTFLogAlways("DFA %zu", i);
+ WTFLogAlways("DFA");
dfa.debugPrintDot();
#endif
ASSERT_WITH_MESSAGE(!dfa.nodes[dfa.root].hasActions(), "All actions on the DFA root should come from regular expressions that match everything.");
@@ -266,7 +266,6 @@
double totalNFAToByteCodeBuildTimeEnd = monotonicallyIncreasingTime();
dataLogF(" Time spent building and compiling the DFAs: %f\n", (totalNFAToByteCodeBuildTimeEnd - totalNFAToByteCodeBuildTimeStart));
dataLogF(" Bytecode size %zu\n", bytecode.size());
- dataLogF(" DFA count %zu\n", nfas.size());
#endif
LOG_LARGE_STRUCTURES(bytecode, bytecode.capacity() * sizeof(uint8_t));
Modified: trunk/Source/WebCore/contentextensions/ContentExtensionsDebugging.h (183666 => 183667)
--- trunk/Source/WebCore/contentextensions/ContentExtensionsDebugging.h 2015-05-01 04:24:40 UTC (rev 183666)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsDebugging.h 2015-05-01 05:01:17 UTC (rev 183667)
@@ -36,7 +36,7 @@
#define CONTENT_EXTENSIONS_PAGE_SIZE 16384
#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
-#define LOG_LARGE_STRUCTURES(name, size) if (size > 1000000) { WTFLogAlways("NAME: %s SIZE %d", #name, (int)(size)); };
+#define LOG_LARGE_STRUCTURES(name, size) if (size > 1000000) { dataLogF("NAME: %s SIZE %d", #name, (int)(size)); };
#else
#define LOG_LARGE_STRUCTURES(name, size)
#endif
Modified: trunk/Source/WebCore/contentextensions/DFA.cpp (183666 => 183667)
--- trunk/Source/WebCore/contentextensions/DFA.cpp 2015-05-01 04:24:40 UTC (rev 183666)
+++ trunk/Source/WebCore/contentextensions/DFA.cpp 2015-05-01 05:01:17 UTC (rev 183667)
@@ -137,22 +137,22 @@
dataLogF("\\\\%d-\\\\%d", rangeStart, rangeEnd);
}
-static void printTransitions(const Vector<DFANode>& graph, unsigned sourceNodeId)
+static void printTransitions(const DFA& dfa, unsigned sourceNodeId)
{
- const DFANode& sourceNode = graph[sourceNodeId];
- const DFANodeTransitions& transitions = sourceNode.transitions;
+ const DFANode& sourceNode = dfa.nodes[sourceNodeId];
+ auto transitions = sourceNode.transitions(dfa);
- if (transitions.isEmpty() && !sourceNode.hasFallbackTransition)
+ if (transitions.isEmpty() && !sourceNode.hasFallbackTransition())
return;
HashMap<unsigned, Vector<uint16_t>, DefaultHash<unsigned>::Hash, WTF::UnsignedWithZeroKeyHashTraits<unsigned>> transitionsPerTarget;
// First, we build the list of transitions coming to each target node.
for (const auto& transition : transitions) {
- unsigned target = transition.value;
+ unsigned target = transition.second;
transitionsPerTarget.add(target, Vector<uint16_t>());
- transitionsPerTarget.find(target)->value.append(transition.key);
+ transitionsPerTarget.find(target)->value.append(transition.first);
}
// Then we go over each one an display the ranges one by one.
@@ -180,8 +180,8 @@
dataLogF("\"];\n");
}
- if (sourceNode.hasFallbackTransition)
- dataLogF(" %d -> %d [label=\"[fallback]\"];\n", sourceNodeId, sourceNode.fallbackTransition);
+ if (sourceNode.hasFallbackTransition())
+ dataLogF(" %d -> %d [label=\"[fallback]\"];\n", sourceNodeId, sourceNode.fallbackTransitionDestination(dfa));
}
void DFA::debugPrintDot() const
@@ -190,12 +190,12 @@
dataLogF(" rankdir=LR;\n");
dataLogF(" node [shape=circle];\n");
dataLogF(" {\n");
- for (unsigned i = 0; i < m_nodes.size(); ++i) {
- if (m_nodes[i].isKilled)
+ for (unsigned i = 0; i < nodes.size(); ++i) {
+ if (nodes[i].isKilled())
continue;
dataLogF(" %d [label=<Node %d", i, i);
- const Vector<uint64_t>& actions = m_nodes[i].actions;
+ const Vector<uint64_t>& actions = nodes[i].actions(*this);
if (!actions.isEmpty()) {
dataLogF("<BR/>Actions: ");
for (unsigned actionIndex = 0; actionIndex < actions.size(); ++actionIndex) {
@@ -205,7 +205,7 @@
}
}
- Vector<unsigned> correspondingNFANodes = m_nodes[i].correspondingNFANodes;
+ Vector<unsigned> correspondingNFANodes = nodes[i].correspondingNFANodes;
ASSERT(!correspondingNFANodes.isEmpty());
dataLogF("<BR/>NFA Nodes: ");
for (unsigned correspondingDFANodeIndex = 0; correspondingDFANodeIndex < correspondingNFANodes.size(); ++correspondingDFANodeIndex) {
@@ -224,8 +224,8 @@
dataLogF(" }\n");
dataLogF(" {\n");
- for (unsigned i = 0; i < m_nodes.size(); ++i)
- printTransitions(m_nodes, i);
+ for (unsigned i = 0; i < nodes.size(); ++i)
+ printTransitions(*this, i);
dataLogF(" }\n");
dataLogF("}\n");
Modified: trunk/Source/WebCore/contentextensions/DFANode.h (183666 => 183667)
--- trunk/Source/WebCore/contentextensions/DFANode.h 2015-05-01 04:24:40 UTC (rev 183666)
+++ trunk/Source/WebCore/contentextensions/DFANode.h 2015-05-01 05:01:17 UTC (rev 183667)
@@ -102,7 +102,11 @@
// FIXME: Pack this down to 12.
// It's probably already 12 on ARMv7.
+#if CONTENT_EXTENSIONS_STATE_MACHINE_DEBUGGING
+COMPILE_ASSERT(sizeof(DFANode) <= 16 + sizeof(Vector<unsigned>), Keep the DFANodes small);
+#else
COMPILE_ASSERT(sizeof(DFANode) <= 16, Keep the DFANodes small);
+#endif
}
Modified: trunk/Source/WebCore/contentextensions/NFA.cpp (183666 => 183667)
--- trunk/Source/WebCore/contentextensions/NFA.cpp 2015-05-01 04:24:40 UTC (rev 183666)
+++ trunk/Source/WebCore/contentextensions/NFA.cpp 2015-05-01 05:01:17 UTC (rev 183667)
@@ -49,7 +49,7 @@
size_t NFA::memoryUsed() const
{
- size_t size = 0;
+ size_t size = sizeof(NFA);
for (const NFANode& node : m_nodes) {
for (const auto& transition : node.transitions)
size += transition.value.capacity() * sizeof(unsigned);
@@ -188,7 +188,7 @@
for (unsigned i = 0; i < m_nodes.size(); ++i) {
dataLogF(" %d [label=<Node %d", i, i);
- const Vector<uint64_t>& finalRules = m_nodes[i].finalRuleIds;
+ const ActionList& finalRules = m_nodes[i].finalRuleIds;
if (!finalRules.isEmpty()) {
dataLogF("<BR/>(Final: ");
for (unsigned ruleIndex = 0; ruleIndex < finalRules.size(); ++ruleIndex) {