[webkit-changes] cvs commit: JavaScriptCore/kjs object.h
scope_chain.cpp scope_chain.h
Eric
eseidel at opensource.apple.com
Sat Nov 26 17:28:31 PST 2005
eseidel 05/11/26 17:28:31
Modified: . ChangeLog
kjs object.h scope_chain.cpp scope_chain.h
Log:
Bug #: 5687
Submitted by: darin
Reviewed by: eseidel
Inline ScopeChain functions for speed.
http://bugzilla.opendarwin.org/show_bug.cgi?id=5687
* kjs/object.h:
(KJS::ScopeChain::mark):
* kjs/scope_chain.cpp:
* kjs/scope_chain.h:
(KJS::ScopeChain::ref):
(KJS::ScopeChain::operator=):
(KJS::ScopeChain::bottom):
(KJS::ScopeChain::push):
(KJS::ScopeChain::pop):
Revision Changes Path
1.884 +17 -0 JavaScriptCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
retrieving revision 1.883
retrieving revision 1.884
diff -u -r1.883 -r1.884
--- ChangeLog 23 Nov 2005 05:41:18 -0000 1.883
+++ ChangeLog 27 Nov 2005 01:28:27 -0000 1.884
@@ -1,3 +1,20 @@
+2005-11-26 Darin Adler <darin at apple.com>
+
+ Reviewed by eseidel. Committed by eseidel.
+
+ Inline ScopeChain functions for speed.
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=5687
+
+ * kjs/object.h:
+ (KJS::ScopeChain::mark):
+ * kjs/scope_chain.cpp:
+ * kjs/scope_chain.h:
+ (KJS::ScopeChain::ref):
+ (KJS::ScopeChain::operator=):
+ (KJS::ScopeChain::bottom):
+ (KJS::ScopeChain::push):
+ (KJS::ScopeChain::pop):
+
2005-11-21 Maciej Stachowiak <mjs at apple.com>
Reviewed by Geoff.
1.48 +11 -0 JavaScriptCore/kjs/object.h
Index: object.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/object.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- object.h 16 Oct 2005 00:46:22 -0000 1.47
+++ object.h 27 Nov 2005 01:28:30 -0000 1.48
@@ -606,6 +606,17 @@
return false;
}
+// FIXME: Put this function in a separate file named something like scope_chain_mark.h -- can't put it in scope_chain.h since it depends on ObjectImp.
+
+inline void ScopeChain::mark()
+{
+ for (ScopeChainNode *n = _node; n; n = n->next) {
+ ObjectImp *o = n->object;
+ if (!o->marked())
+ o->mark();
+ }
+}
+
} // namespace
#endif // KJS_OBJECT_H
1.13 +0 -63 JavaScriptCore/kjs/scope_chain.cpp
Index: scope_chain.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/scope_chain.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- scope_chain.cpp 3 Oct 2005 21:11:51 -0000 1.12
+++ scope_chain.cpp 27 Nov 2005 01:28:30 -0000 1.13
@@ -22,32 +22,8 @@
#include "config.h"
#include "scope_chain.h"
-#include "object.h"
-
namespace KJS {
-inline void ScopeChain::ref() const
-{
- for (ScopeChainNode *n = _node; n; n = n->next) {
- if (n->refCount++ != 0)
- break;
- }
-}
-
-ScopeChain &ScopeChain::operator=(const ScopeChain &c)
-{
- c.ref();
- deref();
- _node = c._node;
- return *this;
-}
-
-void ScopeChain::push(ObjectImp *o)
-{
- assert(o);
- _node = new ScopeChainNode(_node, o);
-}
-
void ScopeChain::push(const ScopeChain &c)
{
ScopeChainNode **tail = &_node;
@@ -58,21 +34,6 @@
}
}
-void ScopeChain::pop()
-{
- ScopeChainNode *oldNode = _node;
- assert(oldNode);
- ScopeChainNode *newNode = oldNode->next;
- _node = newNode;
-
- if (--oldNode->refCount != 0) {
- if (newNode)
- ++newNode->refCount;
- } else {
- delete oldNode;
- }
-}
-
void ScopeChain::release()
{
// This function is only called by deref(),
@@ -86,28 +47,4 @@
} while (n && --n->refCount == 0);
}
-void ScopeChain::mark()
-{
- for (ScopeChainNode *n = _node; n; n = n->next) {
- ObjectImp *o = n->object;
- if (!o->marked())
- o->mark();
- }
-}
-
-ObjectImp *ScopeChain::bottom() const
-{
- ScopeChainNode *last = 0;
- for (ScopeChainNode *n = _node; n; n = n->next) {
- if (!n->next) {
- last = n;
- }
- }
- if (!last) {
- return 0;
- }
-
- return last->object;
-}
-
} // namespace KJS
1.13 +49 -0 JavaScriptCore/kjs/scope_chain.h
Index: scope_chain.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/scope_chain.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- scope_chain.h 3 Oct 2005 21:11:51 -0000 1.12
+++ scope_chain.h 27 Nov 2005 01:28:30 -0000 1.13
@@ -22,6 +22,8 @@
#ifndef KJS_SCOPE_CHAIN_H
#define KJS_SCOPE_CHAIN_H
+#include <assert.h>
+
namespace KJS {
class ObjectImp;
@@ -87,6 +89,53 @@
void release();
};
+inline void ScopeChain::ref() const
+{
+ for (ScopeChainNode *n = _node; n; n = n->next) {
+ if (n->refCount++ != 0)
+ break;
+ }
+}
+
+inline ScopeChain &ScopeChain::operator=(const ScopeChain &c)
+{
+ c.ref();
+ deref();
+ _node = c._node;
+ return *this;
+}
+
+inline ObjectImp *ScopeChain::bottom() const
+{
+ ScopeChainNode *last = 0;
+ for (ScopeChainNode *n = _node; n; n = n->next)
+ last = n;
+ if (!last)
+ return 0;
+ return last->object;
+}
+
+inline void ScopeChain::push(ObjectImp *o)
+{
+ assert(o);
+ _node = new ScopeChainNode(_node, o);
+}
+
+inline void ScopeChain::pop()
+{
+ ScopeChainNode *oldNode = _node;
+ assert(oldNode);
+ ScopeChainNode *newNode = oldNode->next;
+ _node = newNode;
+
+ if (--oldNode->refCount != 0) {
+ if (newNode)
+ ++newNode->refCount;
+ } else {
+ delete oldNode;
+ }
+}
+
} // namespace KJS
#endif // KJS_SCOPE_CHAIN_H
More information about the webkit-changes
mailing list