Changeset 28855 in webkit for trunk/JavaScriptCore/kjs/nodes.cpp


Ignore:
Timestamp:
Dec 18, 2007, 11:42:49 PM (17 years ago)
Author:
[email protected]
Message:

Remove dead code due to removal of post-parse declaration discovery.

RS=Geoff.

Due to the removal of the declaration discovery pass after parsing we
no longer need any of the logic used for that discovery.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/nodes.cpp

    r28854 r28855  
    210210
    211211Node::Node()
    212     : m_mayHaveDeclarations(false)
    213     , m_expectedReturnType(ObjectType)
     212    : m_expectedReturnType(ObjectType)
    214213{
    215214  m_line = lexer().lineNo();
     
    217216
    218217Node::Node(JSType expectedReturn)
    219     : m_mayHaveDeclarations(false)
    220     , m_expectedReturnType(expectedReturn)
     218    : m_expectedReturnType(expectedReturn)
    221219{
    222220    m_line = lexer().lineNo();
     
    34513449    , init(in)
    34523450{
    3453     m_mayHaveDeclarations = true;
    34543451}
    34553452
     
    34603457    if (init)
    34613458        nodeStack.append(init.get());
    3462 }
    3463 
    3464 void VarDeclNode::getDeclarations(DeclarationStacks& stacks)
    3465 {
    3466     if (next) {
    3467         ASSERT(next->mayHaveDeclarations());
    3468         stacks.nodeStack.append(next.get());
    3469     }
    3470 
    3471     // The normal check to avoid overwriting pre-existing values with variable
    3472     // declarations doesn't work for the "arguments" property because we
    3473     // instantiate it lazily. So we need to check here instead.
    3474     if (ident == stacks.exec->propertyNames().arguments)
    3475         return;
    3476 
    3477     stacks.varStack.append(this);
    34783459}
    34793460
     
    35763557}
    35773558
    3578 void VarStatementNode::getDeclarations(DeclarationStacks& stacks)
    3579 {
    3580     ASSERT(next->mayHaveDeclarations());
    3581     stacks.nodeStack.append(next.get());
    3582 }
    3583 
    35843559// ------------------------------ Helper functions for handling Vectors of StatementNode -------------------------------
    35853560
     
    35923567        stack.append((*it).get());
    35933568    }
    3594 }
    3595 
    3596 static inline void statementListGetDeclarations(SourceElements& statements, DeclarationStacks& stacks)
    3597 {
    3598     SourceElements::iterator it = statements.end();
    3599     SourceElements::iterator begin = statements.begin();
    3600     while (it != begin) {
    3601         --it;
    3602         if ((*it)->mayHaveDeclarations())
    3603             stacks.nodeStack.append((*it).get());
    3604     }
    3605 }
    3606 
    3607 static inline Node* statementListInitializeDeclarationStack(SourceElements& statements, DeclarationStacks::NodeStack& stack)
    3608 {
    3609     ASSERT(!stack.size()); // Otherwise, the removeLast() call might remove someone else's node.
    3610    
    3611     SourceElements::iterator it = statements.end();
    3612     SourceElements::iterator begin = statements.begin();
    3613    
    3614     while (it != begin) {
    3615         --it;
    3616         if ((*it)->mayHaveDeclarations())
    3617              stack.append((*it).get());
    3618     }
    3619 
    3620     if (!stack.size())
    3621         return 0;
    3622 
    3623     Node* n = stack.last();
    3624     stack.removeLast();
    3625     return n;
    36263569}
    36273570
     
    36673610{
    36683611    ASSERT(m_children);
    3669     m_mayHaveDeclarations = true;
    36703612}
    36713613
     
    36733615{
    36743616    statementListPushFIFO(*m_children, nodeStack);
    3675 }
    3676 
    3677 void BlockNode::getDeclarations(DeclarationStacks& stacks)
    3678 {
    3679     statementListGetDeclarations(*m_children, stacks);
    36803617}
    36813618
     
    37453682}
    37463683
    3747 void IfNode::getDeclarations(DeclarationStacks& stacks)
    3748 {
    3749     if (statement2 && statement2->mayHaveDeclarations())
    3750         stacks.nodeStack.append(statement2.get());
    3751     if (statement1->mayHaveDeclarations())
    3752         stacks.nodeStack.append(statement1.get());
    3753 }
    3754 
    37553684// ------------------------------ DoWhileNode ----------------------------------
    37563685
     
    37933722
    37943723    return Completion(); // work around gcc 4.0 bug
    3795 }
    3796 
    3797 void DoWhileNode::getDeclarations(DeclarationStacks& stacks)
    3798 {
    3799     if (statement->mayHaveDeclarations())
    3800         stacks.nodeStack.append(statement.get());
    38013724}
    38023725
     
    38413764
    38423765    return Completion(); // work around gcc 4.0 bug
    3843 }
    3844 
    3845 void WhileNode::getDeclarations(DeclarationStacks& stacks)
    3846 {
    3847     if (statement->mayHaveDeclarations())
    3848         stacks.nodeStack.append(statement.get());
    38493766}
    38503767
     
    39043821}
    39053822
    3906 void ForNode::getDeclarations(DeclarationStacks& stacks)
    3907 {
    3908     if (statement->mayHaveDeclarations())
    3909         stacks.nodeStack.append(statement.get());
    3910     if (expr1 && expr1->mayHaveDeclarations())
    3911         stacks.nodeStack.append(expr1.get());
    3912 }
    3913 
    39143823// ------------------------------ ForInNode ------------------------------------
    39153824
     
    39173826  : init(0L), lexpr(l), expr(e), varDecl(0L), statement(s)
    39183827{
    3919     m_mayHaveDeclarations = true;
    39203828}
    39213829
     
    39233831  : ident(i), init(in), expr(e), statement(s)
    39243832{
    3925   m_mayHaveDeclarations = true;
    3926 
    39273833  // for( var foo = bar in baz )
    39283834  varDecl = new VarDeclNode(ident, init.get(), VarDeclNode::Variable);
     
    39373843    if (varDecl)
    39383844        nodeStack.append(varDecl.get());
    3939 }
    3940 
    3941 void ForInNode::getDeclarations(DeclarationStacks& stacks)
    3942 {
    3943     if (statement->mayHaveDeclarations())
    3944         stacks.nodeStack.append(statement.get());
    3945     if (varDecl && varDecl->mayHaveDeclarations())
    3946         stacks.nodeStack.append(varDecl.get());
    39473845}
    39483846
     
    41034001// ------------------------------ WithNode -------------------------------------
    41044002
    4105 void WithNode::getDeclarations(DeclarationStacks& stacks)
    4106 {
    4107     if (statement->mayHaveDeclarations())
    4108         stacks.nodeStack.append(statement.get());
    4109 }
    4110 
    41114003void WithNode::optimizeVariableAccess(SymbolTable&, DeclarationStacks::NodeStack& nodeStack)
    41124004{
     
    41414033}
    41424034
    4143 void CaseClauseNode::getDeclarations(DeclarationStacks& stacks)
    4144 {
    4145     if (m_children)
    4146         statementListGetDeclarations(*m_children, stacks);
    4147 }
    4148 
    41494035// ECMA 12.11
    41504036JSValue *CaseClauseNode::evaluate(ExecState *exec)
     
    41744060}
    41754061
    4176 void ClauseListNode::getDeclarations(DeclarationStacks& stacks)
    4177 {
    4178     if (next && next->mayHaveDeclarations())
    4179         stacks.nodeStack.append(next.get());
    4180     if (clause->mayHaveDeclarations())
    4181         stacks.nodeStack.append(clause.get());
    4182 }
    4183 
    41844062// ------------------------------ CaseBlockNode --------------------------------
    41854063
     
    41894067    , list2(l2)
    41904068{
    4191     m_mayHaveDeclarations = true;
    41924069}
    41934070 
     
    42004077    if (list1)
    42014078        nodeStack.append(list1.get());
    4202 }
    4203 
    4204 void CaseBlockNode::getDeclarations(DeclarationStacks& stacks)
    4205 {
    4206     if (list2 && list2->mayHaveDeclarations())
    4207         stacks.nodeStack.append(list2.get());
    4208     if (def && def->mayHaveDeclarations())
    4209         stacks.nodeStack.append(def.get());
    4210     if (list1 && list1->mayHaveDeclarations())
    4211         stacks.nodeStack.append(list1.get());
    42124079}
    42134080
     
    42834150}
    42844151
    4285 void SwitchNode::getDeclarations(DeclarationStacks& stacks)
    4286 {
    4287     if (block->mayHaveDeclarations())
    4288         stacks.nodeStack.append(block.get());
    4289 }
    4290 
    42914152// ECMA 12.11
    42924153Completion SwitchNode::execute(ExecState *exec)
     
    43114172{
    43124173    nodeStack.append(statement.get());
    4313 }
    4314 
    4315 void LabelNode::getDeclarations(DeclarationStacks& stacks)
    4316 {
    4317     if (statement->mayHaveDeclarations())
    4318         stacks.nodeStack.append(statement.get());
    43194174}
    43204175
     
    43594214        nodeStack.append(finallyBlock.get());
    43604215    nodeStack.append(tryBlock.get());
    4361 }
    4362 
    4363 void TryNode::getDeclarations(DeclarationStacks& stacks)
    4364 {
    4365     if (finallyBlock && finallyBlock->mayHaveDeclarations())
    4366         stacks.nodeStack.append(finallyBlock.get());
    4367     if (catchBlock && catchBlock->mayHaveDeclarations())
    4368         stacks.nodeStack.append(catchBlock.get());
    4369     if (tryBlock->mayHaveDeclarations())
    4370         stacks.nodeStack.append(tryBlock.get());
    43714216}
    43724217
     
    46124457}
    46134458
    4614 void FuncDeclNode::getDeclarations(DeclarationStacks& stacks)
    4615 {
    4616     stacks.functionStack.append(this);
    4617 }
    4618 
    46194459FunctionImp* FuncDeclNode::makeFunction(ExecState* exec)
    46204460{
Note: See TracChangeset for help on using the changeset viewer.