Changeset 20051 in webkit


Ignore:
Timestamp:
Mar 7, 2007 7:47:34 PM (17 years ago)
Author:
weinig
Message:

LayoutTests:

Reviewed by Darin.

http://bugs.webkit.org/show_bug.cgi?id=13004
Repeatedly calling XPathExpression.evaluate() causes crashes or memory leaks

  • fast/xpath/evaluate-twice-expected.txt: Added.
  • fast/xpath/evaluate-twice.html: Added.

WebCore:

Reviewed by Darin.

http://bugs.webkit.org/show_bug.cgi?id=13004
Repeatedly calling XPathExpression.evaluate() causes crashes or memory leaks

Removed XPath::Expression::optimize() and related methods, since they were buggy and almost useless.
Merged doEvaluate() into evaluate(), since this was all evaluate() was doing after the above changes.

Test: fast/xpath/evaluate-twice.html

  • xml/XPathExpression.cpp: (WebCore::XPathExpression::evaluate):
  • xml/XPathExpressionNode.cpp: (WebCore::XPath::Expression::Expression): (WebCore::XPath::Expression::~Expression):
  • xml/XPathExpressionNode.h:
  • xml/XPathFunctions.cpp: (WebCore::XPath::FunLast::evaluate): (WebCore::XPath::FunPosition::evaluate): (WebCore::XPath::FunId::evaluate): (WebCore::XPath::FunLocalName::evaluate): (WebCore::XPath::FunNamespaceURI::evaluate): (WebCore::XPath::FunName::evaluate): (WebCore::XPath::FunCount::evaluate): (WebCore::XPath::FunString::evaluate): (WebCore::XPath::FunConcat::evaluate): (WebCore::XPath::FunStartsWith::evaluate): (WebCore::XPath::FunContains::evaluate): (WebCore::XPath::FunSubstringBefore::evaluate): (WebCore::XPath::FunSubstringAfter::evaluate): (WebCore::XPath::FunSubstring::evaluate): (WebCore::XPath::FunStringLength::evaluate): (WebCore::XPath::FunNormalizeSpace::evaluate): (WebCore::XPath::FunTranslate::evaluate): (WebCore::XPath::FunBoolean::evaluate): (WebCore::XPath::FunNot::evaluate): (WebCore::XPath::FunTrue::evaluate): (WebCore::XPath::FunLang::evaluate): (WebCore::XPath::FunFalse::evaluate): (WebCore::XPath::FunNumber::evaluate): (WebCore::XPath::FunSum::evaluate): (WebCore::XPath::FunFloor::evaluate): (WebCore::XPath::FunCeiling::evaluate): (WebCore::XPath::FunRound::evaluate):
  • xml/XPathPath.cpp: (WebCore::XPath::Filter::evaluate): (WebCore::XPath::LocationPath::evaluate): (WebCore::XPath::Path::evaluate):
  • xml/XPathPath.h:
  • xml/XPathPredicate.cpp: (WebCore::XPath::Number::evaluate): (WebCore::XPath::StringExpression::evaluate): (WebCore::XPath::Negative::evaluate): (WebCore::XPath::NumericOp::evaluate): (WebCore::XPath::EqTestOp::evaluate): (WebCore::XPath::LogicalOp::evaluate): (WebCore::XPath::Union::evaluate):
  • xml/XPathPredicate.h:
  • xml/XPathStep.cpp:
  • xml/XPathStep.h:
  • xml/XPathVariableReference.cpp: (WebCore::XPath::VariableReference::evaluate):
  • xml/XPathVariableReference.h:
Location:
trunk
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r20041 r20051  
     12007-03-07  Alexey Proskuryakov  <ap@webkit.org>
     2
     3        Reviewed by Darin.
     4
     5        http://bugs.webkit.org/show_bug.cgi?id=13004
     6        Repeatedly calling XPathExpression.evaluate() causes crashes or memory leaks
     7
     8        * fast/xpath/evaluate-twice-expected.txt: Added.
     9        * fast/xpath/evaluate-twice.html: Added.
     10
    1112007-03-07  Mitz Pettel  <mitz@webkit.org>
    212
  • trunk/WebCore/ChangeLog

    r20048 r20051  
     12007-03-07  Alexey Proskuryakov  <ap@webkit.org>
     2
     3        Reviewed by Darin.
     4
     5        http://bugs.webkit.org/show_bug.cgi?id=13004
     6        Repeatedly calling XPathExpression.evaluate() causes crashes or memory leaks
     7
     8        Removed XPath::Expression::optimize() and related methods, since they were buggy and almost useless.
     9        Merged doEvaluate() into evaluate(), since this was all evaluate() was doing after the above changes.
     10
     11        Test: fast/xpath/evaluate-twice.html
     12
     13        * xml/XPathExpression.cpp:
     14        (WebCore::XPathExpression::evaluate):
     15        * xml/XPathExpressionNode.cpp:
     16        (WebCore::XPath::Expression::Expression):
     17        (WebCore::XPath::Expression::~Expression):
     18        * xml/XPathExpressionNode.h:
     19        * xml/XPathFunctions.cpp:
     20        (WebCore::XPath::FunLast::evaluate):
     21        (WebCore::XPath::FunPosition::evaluate):
     22        (WebCore::XPath::FunId::evaluate):
     23        (WebCore::XPath::FunLocalName::evaluate):
     24        (WebCore::XPath::FunNamespaceURI::evaluate):
     25        (WebCore::XPath::FunName::evaluate):
     26        (WebCore::XPath::FunCount::evaluate):
     27        (WebCore::XPath::FunString::evaluate):
     28        (WebCore::XPath::FunConcat::evaluate):
     29        (WebCore::XPath::FunStartsWith::evaluate):
     30        (WebCore::XPath::FunContains::evaluate):
     31        (WebCore::XPath::FunSubstringBefore::evaluate):
     32        (WebCore::XPath::FunSubstringAfter::evaluate):
     33        (WebCore::XPath::FunSubstring::evaluate):
     34        (WebCore::XPath::FunStringLength::evaluate):
     35        (WebCore::XPath::FunNormalizeSpace::evaluate):
     36        (WebCore::XPath::FunTranslate::evaluate):
     37        (WebCore::XPath::FunBoolean::evaluate):
     38        (WebCore::XPath::FunNot::evaluate):
     39        (WebCore::XPath::FunTrue::evaluate):
     40        (WebCore::XPath::FunLang::evaluate):
     41        (WebCore::XPath::FunFalse::evaluate):
     42        (WebCore::XPath::FunNumber::evaluate):
     43        (WebCore::XPath::FunSum::evaluate):
     44        (WebCore::XPath::FunFloor::evaluate):
     45        (WebCore::XPath::FunCeiling::evaluate):
     46        (WebCore::XPath::FunRound::evaluate):
     47        * xml/XPathPath.cpp:
     48        (WebCore::XPath::Filter::evaluate):
     49        (WebCore::XPath::LocationPath::evaluate):
     50        (WebCore::XPath::Path::evaluate):
     51        * xml/XPathPath.h:
     52        * xml/XPathPredicate.cpp:
     53        (WebCore::XPath::Number::evaluate):
     54        (WebCore::XPath::StringExpression::evaluate):
     55        (WebCore::XPath::Negative::evaluate):
     56        (WebCore::XPath::NumericOp::evaluate):
     57        (WebCore::XPath::EqTestOp::evaluate):
     58        (WebCore::XPath::LogicalOp::evaluate):
     59        (WebCore::XPath::Union::evaluate):
     60        * xml/XPathPredicate.h:
     61        * xml/XPathStep.cpp:
     62        * xml/XPathStep.h:
     63        * xml/XPathVariableReference.cpp:
     64        (WebCore::XPath::VariableReference::evaluate):
     65        * xml/XPathVariableReference.h:
     66
    1672007-03-07  Sam Weinig  <sam@webkit.org>
    268
  • trunk/WebCore/xml/XPathExpression.cpp

    r19968 r20051  
    7575    Expression::evaluationContext().size = 1;
    7676    Expression::evaluationContext().position = 1;
    77     m_topExpression->optimize();
    7877    RefPtr<XPathResult> result = new XPathResult(eventTarget, m_topExpression->evaluate());
    7978
  • trunk/WebCore/xml/XPathExpressionNode.cpp

    r19855 r20051  
    4343
    4444Expression::Expression()
    45     : m_constantValue(0)
    4645{
    4746}
     
    5049{
    5150    deleteAllValues(m_subExpressions);
    52     delete m_constantValue;
    53 }
    54 
    55 Value Expression::evaluate() const
    56 {
    57     if (m_constantValue)
    58         return *m_constantValue;
    59     return doEvaluate();
    6051}
    6152
     
    6354{
    6455    m_subExpressions.append(expr);
    65 }
    66 
    67 void Expression::optimize()
    68 {
    69     bool allSubExpressionsConstant = true;
    70    
    71     for (unsigned i = 0; i < m_subExpressions.size(); i++) {
    72         if (m_subExpressions[i]->isConstant())
    73             m_subExpressions[i]->optimize();
    74         else
    75             allSubExpressionsConstant = false;
    76     }
    77 
    78     if (allSubExpressionsConstant) {
    79         ASSERT (!m_constantValue);
    80         m_constantValue = new Value(doEvaluate());
    81         deleteAllValues(m_subExpressions);
    82         m_subExpressions.clear();
    83     }
    8456}
    8557
     
    10173}
    10274
    103 bool Expression::isConstant() const
    104 {
    105     for (unsigned i = 0; i < m_subExpressions.size(); i++)
    106         if (!m_subExpressions[i]->isConstant())
    107             return false;
    108     return true;
    109 }
    110 
    11175}
    11276}
  • trunk/WebCore/xml/XPathExpressionNode.h

    r19855 r20051  
    6464            virtual ~Expression();
    6565
    66             virtual Value evaluate() const;
     66            virtual Value evaluate() const = 0;
    6767
    6868            void addSubExpression(Expression*);
    69             void optimize();
    70             virtual bool isConstant() const;
    7169
    7270        protected:
     
    7674
    7775        private:
    78             virtual Value doEvaluate() const = 0;
    79 
    8076            Vector<Expression*> m_subExpressions;
    81             Value* m_constantValue;
    8277        };
    8378
  • trunk/WebCore/xml/XPathFunctions.cpp

    r19968 r20051  
    7272
    7373class FunLast : public Function {
    74     virtual bool isConstant() const;
    75     virtual Value doEvaluate() const;
     74    virtual Value evaluate() const;
    7675};
    7776
    7877class FunPosition : public Function {
    79     virtual bool isConstant() const;
    80     virtual Value doEvaluate() const;
     78    virtual Value evaluate() const;
    8179};
    8280
    8381class FunCount : public Function {
    84     virtual bool isConstant() const;
    85     virtual Value doEvaluate() const;
     82    virtual Value evaluate() const;
    8683};
    8784
    8885class FunId : public Function {
    89     virtual bool isConstant() const;
    90     virtual Value doEvaluate() const;
     86    virtual Value evaluate() const;
    9187};
    9288
    9389class FunLocalName : public Function {
    94     virtual bool isConstant() const;
    95     virtual Value doEvaluate() const;
     90    virtual Value evaluate() const;
    9691};
    9792
    9893class FunNamespaceURI : public Function {
    99     virtual bool isConstant() const;
    100     virtual Value doEvaluate() const;
     94    virtual Value evaluate() const;
    10195};
    10296
    10397class FunName : public Function {
    104     virtual bool isConstant() const;
    105     virtual Value doEvaluate() const;
     98    virtual Value evaluate() const;
    10699};
    107100
    108101class FunString : public Function {
    109     virtual Value doEvaluate() const;
     102    virtual Value evaluate() const;
    110103};
    111104
    112105class FunConcat : public Function {
    113     virtual Value doEvaluate() const;
     106    virtual Value evaluate() const;
    114107};
    115108
    116109class FunStartsWith : public Function {
    117     virtual Value doEvaluate() const;
     110    virtual Value evaluate() const;
    118111};
    119112
    120113class FunContains : public Function {
    121     virtual Value doEvaluate() const;
     114    virtual Value evaluate() const;
    122115};
    123116
    124117class FunSubstringBefore : public Function {
    125     virtual Value doEvaluate() const;
     118    virtual Value evaluate() const;
    126119};
    127120
    128121class FunSubstringAfter : public Function {
    129     virtual Value doEvaluate() const;
     122    virtual Value evaluate() const;
    130123};
    131124
    132125class FunSubstring : public Function {
    133     virtual Value doEvaluate() const;
     126    virtual Value evaluate() const;
    134127};
    135128
    136129class FunStringLength : public Function {
    137     virtual Value doEvaluate() const;
     130    virtual Value evaluate() const;
    138131};
    139132
    140133class FunNormalizeSpace : public Function {
    141     virtual Value doEvaluate() const;
     134    virtual Value evaluate() const;
    142135};
    143136
    144137class FunTranslate : public Function {
    145     virtual Value doEvaluate() const;
     138    virtual Value evaluate() const;
    146139};
    147140
    148141class FunBoolean : public Function {
    149     virtual Value doEvaluate() const;
     142    virtual Value evaluate() const;
    150143};
    151144
    152145class FunNot : public Function {
    153     virtual Value doEvaluate() const;
     146    virtual Value evaluate() const;
    154147};
    155148
    156149class FunTrue : public Function {
    157     virtual bool isConstant() const;
    158     virtual Value doEvaluate() const;
     150    virtual Value evaluate() const;
    159151};
    160152
    161153class FunFalse : public Function {
    162     virtual bool isConstant() const;
    163     virtual Value doEvaluate() const;
     154    virtual Value evaluate() const;
    164155};
    165156
    166157class FunLang : public Function {
    167     virtual bool isConstant() const;
    168     virtual Value doEvaluate() const;
     158    virtual Value evaluate() const;
    169159};
    170160
    171161class FunNumber : public Function {
    172     virtual Value doEvaluate() const;
     162    virtual Value evaluate() const;
    173163};
    174164
    175165class FunSum : public Function {
    176     virtual Value doEvaluate() const;
     166    virtual Value evaluate() const;
    177167};
    178168
    179169class FunFloor : public Function {
    180     virtual Value doEvaluate() const;
     170    virtual Value evaluate() const;
    181171};
    182172
    183173class FunCeiling : public Function {
    184     virtual Value doEvaluate() const;
     174    virtual Value evaluate() const;
    185175};
    186176
    187177class FunRound : public Function {
    188     virtual Value doEvaluate() const;
     178    virtual Value evaluate() const;
    189179public:
    190180    static double round(double);
     
    286276}
    287277
    288 Value FunLast::doEvaluate() const
     278Value FunLast::evaluate() const
    289279{
    290280    return Expression::evaluationContext().size;
    291281}
    292282
    293 bool FunLast::isConstant() const
    294 {
    295     return false;
    296 }
    297 
    298 Value FunPosition::doEvaluate() const
     283Value FunPosition::evaluate() const
    299284{
    300285    return Expression::evaluationContext().position;
    301286}
    302287
    303 bool FunPosition::isConstant() const
    304 {
    305     return false;
    306 }
    307 
    308 bool FunId::isConstant() const
    309 {
    310     return false;
    311 }
    312 
    313 Value FunId::doEvaluate() const
     288Value FunId::evaluate() const
    314289{
    315290    // FIXME: this algorithm does not produce an ordered node-set, as it should.
     
    359334}
    360335
    361 bool FunLocalName::isConstant() const
    362 {
    363     return false;
    364 }
    365 
    366 Value FunLocalName::doEvaluate() const
     336Value FunLocalName::evaluate() const
    367337{
    368338    Node* node = 0;
     
    381351}
    382352
    383 bool FunNamespaceURI::isConstant() const
    384 {
    385     return false;
    386 }
    387 
    388 Value FunNamespaceURI::doEvaluate() const
     353Value FunNamespaceURI::evaluate() const
    389354{
    390355    Node* node = 0;
     
    403368}
    404369
    405 bool FunName::isConstant() const
    406 {
    407     return false;
    408 }
    409 
    410 Value FunName::doEvaluate() const
     370Value FunName::evaluate() const
    411371{
    412372    Node* node = 0;
     
    426386}
    427387
    428 Value FunCount::doEvaluate() const
     388Value FunCount::evaluate() const
    429389{
    430390    Value a = arg(0)->evaluate();
     
    436396}
    437397
    438 bool FunCount::isConstant() const
    439 {
    440     return false;
    441 }
    442 
    443 Value FunString::doEvaluate() const
     398Value FunString::evaluate() const
    444399{
    445400    if (!argCount())
     
    448403}
    449404
    450 Value FunConcat::doEvaluate() const
     405Value FunConcat::evaluate() const
    451406{
    452407    String str = "";
     
    458413}
    459414
    460 Value FunStartsWith::doEvaluate() const
     415Value FunStartsWith::evaluate() const
    461416{
    462417    String s1 = arg(0)->evaluate().toString();
     
    469424}
    470425
    471 Value FunContains::doEvaluate() const
     426Value FunContains::evaluate() const
    472427{
    473428    String s1 = arg(0)->evaluate().toString();
     
    480435}
    481436
    482 Value FunSubstringBefore::doEvaluate() const
     437Value FunSubstringBefore::evaluate() const
    483438{
    484439    String s1 = arg(0)->evaluate().toString();
     
    496451}
    497452
    498 Value FunSubstringAfter::doEvaluate() const
     453Value FunSubstringAfter::evaluate() const
    499454{
    500455    String s1 = arg(0)->evaluate().toString();
     
    511466}
    512467
    513 Value FunSubstring::doEvaluate() const
     468Value FunSubstring::evaluate() const
    514469{
    515470    String s = arg(0)->evaluate().toString();
     
    537492}
    538493
    539 Value FunStringLength::doEvaluate() const
     494Value FunStringLength::evaluate() const
    540495{
    541496    if (!argCount())
     
    544499}
    545500
    546 Value FunNormalizeSpace::doEvaluate() const
     501Value FunNormalizeSpace::evaluate() const
    547502{
    548503    if (!argCount()) {
     
    555510}
    556511
    557 Value FunTranslate::doEvaluate() const
     512Value FunTranslate::evaluate() const
    558513{
    559514    String s1 = arg(0)->evaluate().toString();
     
    578533}
    579534
    580 Value FunBoolean::doEvaluate() const
     535Value FunBoolean::evaluate() const
    581536{
    582537    return arg(0)->evaluate().toBoolean();
    583538}
    584539
    585 Value FunNot::doEvaluate() const
     540Value FunNot::evaluate() const
    586541{
    587542    return !arg(0)->evaluate().toBoolean();
    588543}
    589544
    590 Value FunTrue::doEvaluate() const
     545Value FunTrue::evaluate() const
    591546{
    592547    return true;
    593548}
    594549
    595 bool FunTrue::isConstant() const
    596 {
    597     return true;
    598 }
    599 
    600 Value FunLang::doEvaluate() const
     550Value FunLang::evaluate() const
    601551{
    602552    String lang = arg(0)->evaluate().toString();
     
    631581}
    632582
    633 bool FunLang::isConstant() const
     583Value FunFalse::evaluate() const
    634584{
    635585    return false;
    636586}
    637587
    638 Value FunFalse::doEvaluate() const
    639 {
    640     return false;
    641 }
    642 
    643 bool FunFalse::isConstant() const
    644 {
    645     return true;
    646 }
    647 
    648 Value FunNumber::doEvaluate() const
     588Value FunNumber::evaluate() const
    649589{
    650590    if (!argCount())
     
    653593}
    654594
    655 Value FunSum::doEvaluate() const
     595Value FunSum::evaluate() const
    656596{
    657597    Value a = arg(0)->evaluate();
     
    668608}
    669609
    670 Value FunFloor::doEvaluate() const
     610Value FunFloor::evaluate() const
    671611{
    672612    return floor(arg(0)->evaluate().toNumber());
    673613}
    674614
    675 Value FunCeiling::doEvaluate() const
     615Value FunCeiling::evaluate() const
    676616{
    677617    return ceil(arg(0)->evaluate().toNumber());
     
    689629}
    690630
    691 Value FunRound::doEvaluate() const
     631Value FunRound::evaluate() const
    692632{
    693633    return round(arg(0)->evaluate().toNumber());
  • trunk/WebCore/xml/XPathPath.cpp

    r19855 r20051  
    4949}
    5050
    51 Value Filter::doEvaluate() const
     51Value Filter::evaluate() const
    5252{
    5353    Value v = m_expr->evaluate();
     
    8787}
    8888
    89 void LocationPath::optimize()
    90 {
    91     for (unsigned i = 0; i < m_steps.size(); i++)
    92         m_steps[i]->optimize();
    93 }
    94 
    95 Value LocationPath::doEvaluate() const
     89Value LocationPath::evaluate() const
    9690{
    9791    /* For absolute location paths, the context node is ignored - the
     
    145139}
    146140
    147 Value Path::doEvaluate() const
     141Value Path::evaluate() const
    148142{
    149143    return m_path->evaluate(m_filter->evaluate().toNodeVector());
  • trunk/WebCore/xml/XPathPath.h

    r19855 r20051  
    4747            virtual ~Filter();
    4848
     49            virtual Value evaluate() const;
     50
    4951        private:
    50             virtual Value doEvaluate() const;
    51 
    5252            Expression* m_expr;
    5353            Vector<Predicate*> m_predicates;
     
    5959            virtual ~LocationPath();
    6060
    61             using Expression::evaluate;
     61            virtual Value evaluate() const;
    6262            Value evaluate(const NodeVector& startNodes) const;
    6363
    64             void optimize();
    65 
    6664        private:
    67             virtual Value doEvaluate() const;
    68 
    6965            Vector<Step*> m_steps;
    7066            bool m_absolute;
     
    7975            virtual ~Path();
    8076
     77            virtual Value evaluate() const;
     78
    8179        private:
    82             virtual Value doEvaluate() const;
    83 
    8480            Filter* m_filter;
    8581            LocationPath* m_path;
  • trunk/WebCore/xml/XPathPredicate.cpp

    r20008 r20051  
    4848}
    4949
    50 bool Number::isConstant() const
    51 {
    52     return true;
    53 }
    54 
    55 Value Number::doEvaluate() const
     50Value Number::evaluate() const
    5651{
    5752    return m_value;
     
    6358}
    6459
    65 bool StringExpression::isConstant() const
    66 {
    67     return true;
    68 }
    69 
    70 Value StringExpression::doEvaluate() const
     60Value StringExpression::evaluate() const
    7161{
    7262    return m_value;
    7363}
    7464
    75 Value Negative::doEvaluate() const
     65Value Negative::evaluate() const
    7666{
    7767    Value p(subExpr(0)->evaluate());
     
    8676}
    8777
    88 Value NumericOp::doEvaluate() const
     78Value NumericOp::evaluate() const
    8979{
    9080    Value lhs(subExpr(0)->evaluate());
     
    205195}
    206196
    207 Value EqTestOp::doEvaluate() const
     197Value EqTestOp::evaluate() const
    208198{
    209199    Value lhs(subExpr(0)->evaluate());
     
    228218}
    229219
    230 bool LogicalOp::isConstant() const
    231 {
    232     return subExpr(0)->isConstant() &&
    233            subExpr(0)->evaluate().toBoolean() == shortCircuitOn();
    234 }
    235 
    236 Value LogicalOp::doEvaluate() const
     220Value LogicalOp::evaluate() const
    237221{
    238222    Value lhs(subExpr(0)->evaluate());
     
    247231}
    248232
    249 Value Union::doEvaluate() const
     233Value Union::evaluate() const
    250234{
    251235    // FIXME: This algorithm doesn't return nodes in document order, as it should.
     
    295279}
    296280
    297 void Predicate::optimize()
    298 {
    299     m_expr->optimize();
    300 }
    301 
    302281}
    303282}
  • trunk/WebCore/xml/XPathPredicate.h

    r19963 r20051  
    3939        public:
    4040            Number(double);
    41             bool isConstant() const;
    4241        private:
    43             virtual Value doEvaluate() const;
     42            virtual Value evaluate() const;
    4443            double m_value;
    4544        };
     
    4847        public:
    4948            StringExpression(const String&);
    50             bool isConstant() const;
    5149        private:
    52             virtual Value doEvaluate() const;
     50            virtual Value evaluate() const;
    5351            String m_value;
    5452        };
     
    5654        class Negative : public Expression {
    5755        private:
    58             virtual Value doEvaluate() const;
     56            virtual Value evaluate() const;
    5957        };
    6058
     
    6664            NumericOp(Opcode, Expression* lhs, Expression* rhs);
    6765        private:
    68             virtual Value doEvaluate() const;
     66            virtual Value evaluate() const;
    6967            Opcode m_opcode;
    7068        };
     
    7472            enum Opcode { OP_EQ, OP_NE, OP_GT, OP_LT, OP_GE, OP_LE };
    7573            EqTestOp(Opcode, Expression* lhs, Expression* rhs);
     74            virtual Value evaluate() const;
    7675        private:
    77             virtual Value doEvaluate() const;
    7876            bool compare(const Value&, const Value&) const;
    7977            Opcode m_opcode;
     
    8482            enum Opcode { OP_And, OP_Or };
    8583            LogicalOp(Opcode, Expression* lhs, Expression* rhs);
    86             virtual bool isConstant() const;
    8784        private:
    8885            bool shortCircuitOn() const;
    89             virtual Value doEvaluate() const;
     86            virtual Value evaluate() const;
    9087            Opcode m_opcode;
    9188        };
     
    9390        class Union : public Expression {
    9491        private:
    95             virtual Value doEvaluate() const;
     92            virtual Value evaluate() const;
    9693        };
    9794
     
    10198            ~Predicate();
    10299            bool evaluate() const;
    103             void optimize();
    104100        private:
    105101            Expression* m_expr;
  • trunk/WebCore/xml/XPathStep.cpp

    r20008 r20051  
    265265}
    266266
    267 void Step::optimize()
    268 {
    269     for (unsigned i = 0; i < m_predicates.size(); i++)
    270         m_predicates[i]->optimize();
    271 }
    272 
    273267Node::NodeType Step::primaryNodeType(Axis axis) const
    274268{
  • trunk/WebCore/xml/XPathStep.h

    r19855 r20051  
    5656            NodeVector evaluate(Node* context) const;
    5757
    58             void optimize();
    59 
    6058        private:
    6159            NodeVector nodesInAxis(Node* context) const;
  • trunk/WebCore/xml/XPathVariableReference.cpp

    r19855 r20051  
    4141}
    4242
    43 bool VariableReference::isConstant() const
    44 {
    45     return false;
    46 }
    47 
    48 Value VariableReference::doEvaluate() const
     43Value VariableReference::evaluate() const
    4944{
    5045    HashMap<String, String>& bindings = evaluationContext().variableBindings;
  • trunk/WebCore/xml/XPathVariableReference.h

    r19855 r20051  
    3838        public:
    3939            VariableReference(const String& name);
    40             virtual bool isConstant() const;
    4140        private:
    42             virtual Value doEvaluate() const;
     41            virtual Value evaluate() const;
    4342            String m_name;
    4443        };
Note: See TracChangeset for help on using the changeset viewer.