Commit a34e69ca authored by mjs's avatar mjs

Change ArgumentListNode operations to be iterative instead of

	recursive. This probably fixes 3095446 (Crash in
	KJS::ArgumentListNode::ref()) but I can't reproduce it myself so
	I'm not 100% sure. I think the original bug was a stack overflow
	and this change would remove that possibility.

        * kjs/nodes.cpp:
        (ArgumentListNode::ref): Make iterative.
        (ArgumentListNode::deref): Make iterative.
        (ArgumentListNode::evaluateList): Make iterative.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2735 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e01e824b
2002-11-18 Maciej Stachowiak <mjs@apple.com>
Change ArgumentListNode operations to be iterative instead of
recursive. This probably fixes 3095446 (Crash in
KJS::ArgumentListNode::ref()) but I can't reproduce it myself so
I'm not 100% sure. I think the original bug was a stack overflow
and this change would remove that possibility.
* kjs/nodes.cpp:
(ArgumentListNode::ref): Make iterative.
(ArgumentListNode::deref): Make iterative.
(ArgumentListNode::evaluateList): Make iterative.
=== Alexander-32 ===
2002-11-14 Darin Adler <darin@apple.com>
......
2002-11-18 Maciej Stachowiak <mjs@apple.com>
Change ArgumentListNode operations to be iterative instead of
recursive. This probably fixes 3095446 (Crash in
KJS::ArgumentListNode::ref()) but I can't reproduce it myself so
I'm not 100% sure. I think the original bug was a stack overflow
and this change would remove that possibility.
* kjs/nodes.cpp:
(ArgumentListNode::ref): Make iterative.
(ArgumentListNode::deref): Make iterative.
(ArgumentListNode::evaluateList): Make iterative.
=== Alexander-32 ===
2002-11-14 Darin Adler <darin@apple.com>
......
2002-11-18 Maciej Stachowiak <mjs@apple.com>
Change ArgumentListNode operations to be iterative instead of
recursive. This probably fixes 3095446 (Crash in
KJS::ArgumentListNode::ref()) but I can't reproduce it myself so
I'm not 100% sure. I think the original bug was a stack overflow
and this change would remove that possibility.
* kjs/nodes.cpp:
(ArgumentListNode::ref): Make iterative.
(ArgumentListNode::deref): Make iterative.
(ArgumentListNode::evaluateList): Make iterative.
=== Alexander-32 ===
2002-11-14 Darin Adler <darin@apple.com>
......
This diff is collapsed.
......@@ -246,7 +246,11 @@ Arguments:
ArgumentList:
AssignmentExpr { $$ = new ArgumentListNode($1); }
| ArgumentList ',' AssignmentExpr { $$ = new ArgumentListNode($1, $3); }
/* #ifdef APPLE_CHANGES (not using an actual ifdef because this is yacc) */
| AssignmentExpr ',' ArgumentList { $$ = new ArgumentListNode($3, $1); }
/* #else */
/* | ArgumentList ',' AssignmentExpr { $$ = new ArgumentListNode($1, $3); } */
/* #endif */
;
LeftHandSideExpr:
......
......@@ -550,19 +550,37 @@ ArgumentListNode::ArgumentListNode(ArgumentListNode *l, Node *e)
void ArgumentListNode::ref()
{
Node::ref();
if ( expr )
expr->ref();
if ( list )
list->ref();
ArgumentListNode *l = this;
while (l != NULL) {
l->Node::ref();
if ( l->expr )
l->expr->ref();
l = l->list;
}
}
bool ArgumentListNode::deref()
{
if ( expr && expr->deref() )
delete expr;
if ( list && list->deref() )
delete list;
ArgumentListNode *l = this->list;
while (l != NULL) {
if ( l->expr && l->expr->deref() )
delete l->expr;
ArgumentListNode *next = l->list;
if (l->Node::deref()) {
l->list = NULL;
delete l;
}
l = next;
}
return Node::deref();
}
......@@ -576,15 +594,17 @@ Value ArgumentListNode::evaluate(ExecState */*exec*/)
List ArgumentListNode::evaluateList(ExecState *exec)
{
List l;
if (list) {
l = list->evaluateList(exec);
ArgumentListNode *n = this;
while (n != NULL) {
Value v = n->expr->evaluate(exec);
KJS_CHECKEXCEPTIONLIST
}
Value v = expr->evaluate(exec);
KJS_CHECKEXCEPTIONLIST
l.append(v);
l.append(v);
n = n->list;
}
return l;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment