Changeset 11296 in webkit for trunk/JavaScriptCore/kjs/scope_chain.cpp
- Timestamp:
- Nov 26, 2005, 5:28:30 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/scope_chain.cpp
r10701 r11296 23 23 #include "scope_chain.h" 24 24 25 #include "object.h"26 27 25 namespace KJS { 28 29 inline void ScopeChain::ref() const30 {31 for (ScopeChainNode *n = _node; n; n = n->next) {32 if (n->refCount++ != 0)33 break;34 }35 }36 37 ScopeChain &ScopeChain::operator=(const ScopeChain &c)38 {39 c.ref();40 deref();41 _node = c._node;42 return *this;43 }44 45 void ScopeChain::push(ObjectImp *o)46 {47 assert(o);48 _node = new ScopeChainNode(_node, o);49 }50 26 51 27 void ScopeChain::push(const ScopeChain &c) … … 56 32 *tail = newNode; 57 33 tail = &newNode->next; 58 }59 }60 61 void ScopeChain::pop()62 {63 ScopeChainNode *oldNode = _node;64 assert(oldNode);65 ScopeChainNode *newNode = oldNode->next;66 _node = newNode;67 68 if (--oldNode->refCount != 0) {69 if (newNode)70 ++newNode->refCount;71 } else {72 delete oldNode;73 34 } 74 35 } … … 87 48 } 88 49 89 void ScopeChain::mark()90 {91 for (ScopeChainNode *n = _node; n; n = n->next) {92 ObjectImp *o = n->object;93 if (!o->marked())94 o->mark();95 }96 }97 98 ObjectImp *ScopeChain::bottom() const99 {100 ScopeChainNode *last = 0;101 for (ScopeChainNode *n = _node; n; n = n->next) {102 if (!n->next) {103 last = n;104 }105 }106 if (!last) {107 return 0;108 }109 110 return last->object;111 }112 113 50 } // namespace KJS
Note:
See TracChangeset
for help on using the changeset viewer.