Title: [156230] trunk/Source/WebCore
Revision
156230
Author
[email protected]
Date
2013-09-21 10:47:12 -0700 (Sat, 21 Sep 2013)

Log Message

Don't store the "processing-instruction" string for PI tokens in the XPath parser
https://bugs.webkit.org/show_bug.cgi?id=121746

Reviewed by Antti Koivisto.

For PI tokens, the string is always going to be "processing-instruction", and it's never used so we don't need to save it.

* xml/XPathGrammar.y:
* xml/XPathParser.cpp:
(Parser::nextTokenInternal):
(Parser::lex):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (156229 => 156230)


--- trunk/Source/WebCore/ChangeLog	2013-09-21 17:40:35 UTC (rev 156229)
+++ trunk/Source/WebCore/ChangeLog	2013-09-21 17:47:12 UTC (rev 156230)
@@ -1,3 +1,17 @@
+2013-09-21  Anders Carlsson  <[email protected]>
+
+        Don't store the "processing-instruction" string for PI tokens in the XPath parser
+        https://bugs.webkit.org/show_bug.cgi?id=121746
+
+        Reviewed by Antti Koivisto.
+
+        For PI tokens, the string is always going to be "processing-instruction", and it's never used so we don't need to save it.
+
+        * xml/XPathGrammar.y:
+        * xml/XPathParser.cpp:
+        (Parser::nextTokenInternal):
+        (Parser::lex):
+
 2013-09-21  Patrick Gansterer  <[email protected]>
 
         Handle windows lineendings in makeprop.pl after r155511

Modified: trunk/Source/WebCore/xml/XPathGrammar.y (156229 => 156230)


--- trunk/Source/WebCore/xml/XPathGrammar.y	2013-09-21 17:40:35 UTC (rev 156229)
+++ trunk/Source/WebCore/xml/XPathGrammar.y	2013-09-21 17:47:12 UTC (rev 156230)
@@ -266,14 +266,12 @@
     PI '(' ')'
     {
         $$ = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest);
-        parser->deleteString($1);
         parser->registerNodeTest($$);
     }
     |
     PI '(' LITERAL ')'
     {
         $$ = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest, $3->stripWhiteSpace());
-        parser->deleteString($1);
         parser->deleteString($3);
         parser->registerNodeTest($$);
     }

Modified: trunk/Source/WebCore/xml/XPathParser.cpp (156229 => 156230)


--- trunk/Source/WebCore/xml/XPathParser.cpp	2013-09-21 17:40:35 UTC (rev 156229)
+++ trunk/Source/WebCore/xml/XPathParser.cpp	2013-09-21 17:47:12 UTC (rev 156230)
@@ -109,14 +109,7 @@
 
 static bool isNodeTypeName(const String& name)
 {
-    DEFINE_STATIC_LOCAL(HashSet<String>, nodeTypeNames, ());
-    if (nodeTypeNames.isEmpty()) {
-        nodeTypeNames.add("comment");
-        nodeTypeNames.add("text");
-        nodeTypeNames.add("processing-instruction");
-        nodeTypeNames.add("node");
-    }
-    return nodeTypeNames.contains(name);
+    return name == "comment" || name == "text" || name == "processing-instruction" || name == "node";
 }
 
 // Returns whether the current token can possibly be a binary operator, given
@@ -373,17 +366,18 @@
     }
 
     skipWS();
+
     if (peekCurHelper() == '(') {
-        //note: we don't swallow the (here!
-        
-        //either node type of function name
+        // note: we don't swallow the '(' here!
+
+        // either node type of function name
         if (isNodeTypeName(name)) {
             if (name == "processing-instruction")
-                return Token(PI, name);
+                return Token(PI);
 
             return Token(NODETYPE, name);
         }
-        //must be a function name.
+
         return Token(FUNCTIONNAME, name);
     }
 
@@ -434,7 +428,6 @@
         yylval->eqop = tok.eqop;
         break;
     case NODETYPE:
-    case PI:
     case FUNCTIONNAME:
     case LITERAL:
     case VARIABLEREFERENCE:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to