Changeset 10182 in webkit for trunk/JavaScriptCore/kjs/internal.h


Ignore:
Timestamp:
Aug 14, 2005, 9:41:47 AM (20 years ago)
Author:
darin
Message:

Reviewed by Maciej.

  • kjs/internal.h: Removed the copy constructor and assignment operator for LabelStack. They were unused, and the implementations had bugs; I removed them rather than fixing them. Also removed the clear function, since that was only needed to help the assignment operator share code with the destructor, and was not efficient enough for the destructor. (KJS::LabelStack::~LabelStack): Made this inline. Also used an efficient implementation that's nice and fast when the stack is empty, better than the old clear() function which used to keep updating and refetching "tos" each time through the loop. (KJS::LabelStack::pop): Made this inline.
  • kjs/internal.cpp: Deleted the now-inline functions and the obsolete functions. Also deleted a commented-out line of code.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/internal.h

    r10178 r10182  
    140140    ~LabelStack();
    141141
    142     LabelStack(const LabelStack &other);
    143     LabelStack &operator=(const LabelStack &other);
    144 
    145142    /**
    146143     * If id is not empty and is not in the stack already, puts it on top of
     
    166163   
    167164  private:
     165    LabelStack(const LabelStack &other);
     166    LabelStack &operator=(const LabelStack &other);
     167
    168168    struct StackElem {
    169169      Identifier id;
     
    172172
    173173    StackElem *tos;
    174     void clear();
    175174    int iterationDepth;
    176175    int switchDepth;
     
    409408#endif
    410409
     410inline LabelStack::~LabelStack()
     411{
     412    StackElem *prev;
     413    for (StackElem *e = tos; e; e = prev) {
     414        prev = e->prev;
     415        delete e;
     416    }
     417}
     418
     419inline void LabelStack::pop()
     420{
     421    if (StackElem *e = tos) {
     422        tos = e->prev;
     423        delete e;
     424    }
     425}
     426
    411427} // namespace
    412428
Note: See TracChangeset for help on using the changeset viewer.