Ignore:
Timestamp:
Dec 29, 2005, 3:16:11 AM (19 years ago)
Author:
ggaren
Message:

Reviewed by mjs.

This patch does four things:
(1) Standardizes all our linked list nodes to use "next" as their next
pointers.
(2) Creates the ListRefPtr<T> class, a subclass of RefPtr<T> specialized
to iteratively deref "next" pointers.
(3) Standardizes our linked list nodes to use ListRefPtr<T> and
implement the releaseNext() function used by ~ListRefPtr<T>().
(4) Adds to RefPtr<T> the release() method used by releaseNext().

  • Modified existing mozilla test to ensure it would make deployment builds crash as well.
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • kjs/nodes.cpp: (ElementNode::evaluate): (PropertyListNode::evaluate): (ArgumentListNode::evaluateList): (StatListNode::StatListNode): (StatListNode::execute): (StatListNode::processVarDecls): (VarDeclListNode::evaluate): (VarDeclListNode::processVarDecls): (VarStatementNode::execute): (VarStatementNode::processVarDecls): (BlockNode::BlockNode): (CaseClauseNode::evalStatements): (CaseClauseNode::processVarDecls): (ClauseListNode::processVarDecls): (CaseBlockNode::CaseBlockNode): (CaseBlockNode::evalBlock): (SourceElementsNode::SourceElementsNode): (SourceElementsNode::execute): (SourceElementsNode::processFuncDecl): (SourceElementsNode::processVarDecls):
  • kjs/nodes.h: (KJS::ElementNode::ElementNode): (KJS::ElementNode::releaseNext): (KJS::ArrayNode::ArrayNode): (KJS::PropertyListNode::PropertyListNode): (KJS::PropertyListNode::releaseNext): (KJS::ObjectLiteralNode::ObjectLiteralNode): (KJS::ArgumentListNode::ArgumentListNode): (KJS::ArgumentListNode::releaseNext): (KJS::ArgumentsNode::ArgumentsNode): (KJS::StatListNode::releaseNext): (KJS::VarDeclListNode::VarDeclListNode): (KJS::VarDeclListNode::releaseNext): (KJS::VarStatementNode::VarStatementNode): (KJS::ForNode::ForNode): (KJS::CaseClauseNode::CaseClauseNode): (KJS::ClauseListNode::ClauseListNode): (KJS::ClauseListNode::getClause): (KJS::ClauseListNode::getNext): (KJS::ClauseListNode::releaseNext): (KJS::ParameterNode::ParameterNode): (KJS::ParameterNode::releaseNext): (KJS::SourceElementsNode::releaseNext):
  • kjs/nodes2string.cpp: (ElementNode::streamTo): (PropertyListNode::streamTo): (ArgumentListNode::streamTo): (StatListNode::streamTo): (VarDeclListNode::streamTo): (VarStatementNode::streamTo): (CaseClauseNode::streamTo): (ClauseListNode::streamTo): (CaseBlockNode::streamTo): (SourceElementsNode::streamTo):
  • kxmlcore/ListRefPtr.h: Added. (KXMLCore::ListRefPtr::ListRefPtr): (KXMLCore::ListRefPtr::~ListRefPtr): (KXMLCore::ListRefPtr::operator=):
  • kxmlcore/RefPtr.h: (KXMLCore::RefPtr::release):
File:
1 edited

Legend:

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

    r11566 r11802  
    133133void ElementNode::streamTo(SourceStream &s) const
    134134{
    135   for (const ElementNode *n = this; n; n = n->list.get()) {
     135  for (const ElementNode *n = this; n; n = n->next.get()) {
    136136    for (int i = 0; i < n->elision; i++)
    137137      s << ",";
     
    160160  s << node;
    161161 
    162   for (const PropertyListNode *n = list.get(); n; n = n->list.get())
     162  for (const PropertyListNode *n = next.get(); n; n = n->next.get())
    163163    s << ", " << n->node;
    164164}
     
    205205{
    206206  s << expr;
    207   for (ArgumentListNode *n = list.get(); n; n = n->list.get())
     207  for (ArgumentListNode *n = next.get(); n; n = n->next.get())
    208208    s << ", " << n->expr;
    209209}
     
    526526void StatListNode::streamTo(SourceStream &s) const
    527527{
    528   for (const StatListNode *n = this; n; n = n->list.get())
     528  for (const StatListNode *n = this; n; n = n->next.get())
    529529    s << n->statement;
    530530}
     
    543543{
    544544  s << var;
    545   for (VarDeclListNode *n = list.get(); n; n = n->list.get())
     545  for (VarDeclListNode *n = next.get(); n; n = n->next.get())
    546546    s << ", " << n->var;
    547547}
     
    549549void VarStatementNode::streamTo(SourceStream &s) const
    550550{
    551   s << SourceStream::Endl << "var " << list << ";";
     551  s << SourceStream::Endl << "var " << next << ";";
    552552}
    553553
     
    651651    s << "default";
    652652  s << ":" << SourceStream::Indent;
    653   if (list)
    654     s << list;
     653  if (next)
     654    s << next;
    655655  s << SourceStream::Unindent;
    656656}
     
    658658void ClauseListNode::streamTo(SourceStream &s) const
    659659{
    660   for (const ClauseListNode *n = this; n; n = n->next())
    661     s << n->clause();
     660  for (const ClauseListNode *n = this; n; n = n->getNext())
     661    s << n->getClause();
    662662}
    663663
    664664void CaseBlockNode::streamTo(SourceStream &s) const
    665665{
    666   for (const ClauseListNode *n = list1.get(); n; n = n->next())
    667     s << n->clause();
     666  for (const ClauseListNode *n = list1.get(); n; n = n->getNext())
     667    s << n->getClause();
    668668  if (def)
    669669    s << def;
    670   for (const ClauseListNode *n = list2.get(); n; n = n->next())
    671     s << n->clause();
     670  for (const ClauseListNode *n = list2.get(); n; n = n->getNext())
     671    s << n->getClause();
    672672}
    673673
     
    718718void SourceElementsNode::streamTo(SourceStream &s) const
    719719{
    720   for (const SourceElementsNode *n = this; n; n = n->elements.get())
    721     s << n->element;
    722 }
     720  for (const SourceElementsNode *n = this; n; n = n->next.get())
     721    s << n->node;
     722}
Note: See TracChangeset for help on using the changeset viewer.