Reduce the size of tokens. b=113657, r=heikki, sr=jst

This commit is contained in:
harishd%netscape.com 2002-01-11 19:39:57 +00:00
Родитель 6f2a5a0699
Коммит 8cd8ea8a25
8 изменённых файлов: 72 добавлений и 98 удалений

Просмотреть файл

@ -126,8 +126,6 @@ class CStartToken: public CHTMLToken {
virtual const char* GetClassName(void); virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void); virtual PRInt32 GetTokenType(void);
PRBool IsAttributed(void);
void SetAttributed(PRBool aValue);
PRBool IsEmpty(void); PRBool IsEmpty(void);
void SetEmpty(PRBool aValue); void SetEmpty(PRBool aValue);
#ifdef DEBUG #ifdef DEBUG
@ -154,13 +152,13 @@ class CStartToken: public CHTMLToken {
nsString mTextValue; nsString mTextValue;
nsString mTrailingContent; nsString mTrailingContent;
PRInt32 mOrigin; protected:
protected:
PRBool mAttributed;
PRBool mEmpty;
eContainerInfo mContainerInfo; eContainerInfo mContainerInfo;
nsCOMPtr<nsIAtom> mIDAttributeAtom; nsCOMPtr<nsIAtom> mIDAttributeAtom;
PRPackedBool mEmpty;
#ifdef DEBUG
PRPackedBool mAttributed;
#endif
}; };
@ -379,12 +377,14 @@ class CAttributeToken: public CHTMLToken {
#ifdef DEBUG #ifdef DEBUG
virtual void DebugDumpSource(nsOutputStream& out); virtual void DebugDumpSource(nsOutputStream& out);
#endif #endif
PRBool mLastAttribute;
PRPackedBool mHasEqualWithoutValue;
PRBool mHasEqualWithoutValue;
protected: protected:
nsAutoString mTextValue; nsAutoString mTextValue;
nsSlidingSubstring mTextKey; nsSlidingSubstring mTextKey;
#ifdef DEBUG
PRPackedBool mLastAttribute;
#endif
}; };

Просмотреть файл

@ -278,7 +278,6 @@ class CToken {
static int GetTokenCount(); static int GetTokenCount();
eTokenOrigin mOrigin;
PRInt32 mNewlineCount; PRInt32 mNewlineCount;
protected: protected:
@ -287,9 +286,9 @@ protected:
*/ */
virtual size_t SizeOf() const = 0; virtual size_t SizeOf() const = 0;
PRInt32 mTypeID; PRInt32 mTypeID;
PRInt16 mAttrCount; PRInt32 mUseCount;
PRInt32 mUseCount; PRInt16 mAttrCount;
}; };

Просмотреть файл

@ -90,26 +90,29 @@ CHTMLToken::~CHTMLToken() {
* @return * @return
*/ */
CStartToken::CStartToken(eHTMLTags aTag) : CHTMLToken(aTag) { CStartToken::CStartToken(eHTMLTags aTag) : CHTMLToken(aTag) {
mAttributed=PR_FALSE;
mEmpty=PR_FALSE; mEmpty=PR_FALSE;
mOrigin=-1;
mContainerInfo=eFormUnknown; mContainerInfo=eFormUnknown;
#ifdef DEBUG
mAttributed = PR_FALSE;
#endif
} }
CStartToken::CStartToken(const nsAReadableString& aName) : CHTMLToken(eHTMLTag_unknown) { CStartToken::CStartToken(const nsAReadableString& aName) : CHTMLToken(eHTMLTag_unknown) {
mAttributed=PR_FALSE;
mEmpty=PR_FALSE; mEmpty=PR_FALSE;
mOrigin=-1;
mContainerInfo=eFormUnknown; mContainerInfo=eFormUnknown;
mTextValue.Assign(aName); mTextValue.Assign(aName);
#ifdef DEBUG
mAttributed = PR_FALSE;
#endif
} }
CStartToken::CStartToken(const nsAReadableString& aName,eHTMLTags aTag) : CHTMLToken(aTag) { CStartToken::CStartToken(const nsAReadableString& aName,eHTMLTags aTag) : CHTMLToken(aTag) {
mAttributed=PR_FALSE;
mEmpty=PR_FALSE; mEmpty=PR_FALSE;
mOrigin=-1;
mContainerInfo=eFormUnknown; mContainerInfo=eFormUnknown;
mTextValue.Assign(aName); mTextValue.Assign(aName);
#ifdef DEBUG
mAttributed = PR_FALSE;
#endif
} }
nsresult CStartToken::GetIDAttributeAtom(nsIAtom** aResult) nsresult CStartToken::GetIDAttributeAtom(nsIAtom** aResult)
@ -167,28 +170,6 @@ PRInt32 CStartToken::GetTokenType(void) {
return eToken_start; return eToken_start;
} }
/*
*
*
* @update gess 3/25/98
* @param
* @return
*/
void CStartToken::SetAttributed(PRBool aValue) {
mAttributed=aValue;
}
/*
*
*
* @update gess 3/25/98
* @param
* @return
*/
PRBool CStartToken::IsAttributed(void) {
return mAttributed;
}
/* /*
* *
* *
@ -1350,8 +1331,10 @@ nsresult CNewlineToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aFl
* @return * @return
*/ */
CAttributeToken::CAttributeToken() : CHTMLToken(eHTMLTag_unknown) { CAttributeToken::CAttributeToken() : CHTMLToken(eHTMLTag_unknown) {
mLastAttribute=PR_FALSE;
mHasEqualWithoutValue=PR_FALSE; mHasEqualWithoutValue=PR_FALSE;
#ifdef DEBUG
mLastAttribute = PR_FALSE;
#endif
} }
/* /*
@ -1363,8 +1346,10 @@ CAttributeToken::CAttributeToken() : CHTMLToken(eHTMLTag_unknown) {
*/ */
CAttributeToken::CAttributeToken(const nsAReadableString& aName) : CHTMLToken(eHTMLTag_unknown) { CAttributeToken::CAttributeToken(const nsAReadableString& aName) : CHTMLToken(eHTMLTag_unknown) {
mTextValue.Assign(aName); mTextValue.Assign(aName);
mLastAttribute=PR_FALSE;
mHasEqualWithoutValue=PR_FALSE; mHasEqualWithoutValue=PR_FALSE;
#ifdef DEBUG
mLastAttribute = PR_FALSE;
#endif
} }
/* /*
@ -1378,8 +1363,10 @@ CAttributeToken::CAttributeToken(const nsAReadableString& aName) : CHTMLToken(eH
CAttributeToken::CAttributeToken(const nsAReadableString& aKey, const nsAReadableString& aName) : CHTMLToken(eHTMLTag_unknown) { CAttributeToken::CAttributeToken(const nsAReadableString& aKey, const nsAReadableString& aName) : CHTMLToken(eHTMLTag_unknown) {
mTextValue.Assign(aName); mTextValue.Assign(aName);
mTextKey.Rebind(aKey); mTextKey.Rebind(aKey);
mLastAttribute=PR_FALSE;
mHasEqualWithoutValue=PR_FALSE; mHasEqualWithoutValue=PR_FALSE;
#ifdef DEBUG
mLastAttribute = PR_FALSE;
#endif
} }
/* /*
@ -1771,7 +1758,9 @@ nsresult CAttributeToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 a
if (NS_OK==result) { if (NS_OK==result) {
result=aScanner.Peek(aChar); result=aScanner.Peek(aChar);
mLastAttribute= PRBool((kGreaterThan==aChar) || (kEOF==result)); #ifdef DEBUG
mLastAttribute = (kGreaterThan == aChar || kEOF == result);
#endif
} }
}//if }//if
return result; return result;

Просмотреть файл

@ -68,7 +68,6 @@ CToken::CToken(PRInt32 aTag) {
mAttrCount=0; mAttrCount=0;
mNewlineCount=0; mNewlineCount=0;
mTypeID=aTag; mTypeID=aTag;
mOrigin=eSource;
// Note that the use count starts with 1 instead of 0. This // Note that the use count starts with 1 instead of 0. This
// is because of the assumption that any token created is in // is because of the assumption that any token created is in
// use and therefore does not require an explicit addref, or // use and therefore does not require an explicit addref, or

Просмотреть файл

@ -126,8 +126,6 @@ class CStartToken: public CHTMLToken {
virtual const char* GetClassName(void); virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void); virtual PRInt32 GetTokenType(void);
PRBool IsAttributed(void);
void SetAttributed(PRBool aValue);
PRBool IsEmpty(void); PRBool IsEmpty(void);
void SetEmpty(PRBool aValue); void SetEmpty(PRBool aValue);
#ifdef DEBUG #ifdef DEBUG
@ -154,13 +152,13 @@ class CStartToken: public CHTMLToken {
nsString mTextValue; nsString mTextValue;
nsString mTrailingContent; nsString mTrailingContent;
PRInt32 mOrigin; protected:
protected:
PRBool mAttributed;
PRBool mEmpty;
eContainerInfo mContainerInfo; eContainerInfo mContainerInfo;
nsCOMPtr<nsIAtom> mIDAttributeAtom; nsCOMPtr<nsIAtom> mIDAttributeAtom;
PRPackedBool mEmpty;
#ifdef DEBUG
PRPackedBool mAttributed;
#endif
}; };
@ -379,12 +377,14 @@ class CAttributeToken: public CHTMLToken {
#ifdef DEBUG #ifdef DEBUG
virtual void DebugDumpSource(nsOutputStream& out); virtual void DebugDumpSource(nsOutputStream& out);
#endif #endif
PRBool mLastAttribute;
PRPackedBool mHasEqualWithoutValue;
PRBool mHasEqualWithoutValue;
protected: protected:
nsAutoString mTextValue; nsAutoString mTextValue;
nsSlidingSubstring mTextKey; nsSlidingSubstring mTextKey;
#ifdef DEBUG
PRPackedBool mLastAttribute;
#endif
}; };

Просмотреть файл

@ -278,7 +278,6 @@ class CToken {
static int GetTokenCount(); static int GetTokenCount();
eTokenOrigin mOrigin;
PRInt32 mNewlineCount; PRInt32 mNewlineCount;
protected: protected:
@ -287,9 +286,9 @@ protected:
*/ */
virtual size_t SizeOf() const = 0; virtual size_t SizeOf() const = 0;
PRInt32 mTypeID; PRInt32 mTypeID;
PRInt16 mAttrCount; PRInt32 mUseCount;
PRInt32 mUseCount; PRInt16 mAttrCount;
}; };

Просмотреть файл

@ -90,26 +90,29 @@ CHTMLToken::~CHTMLToken() {
* @return * @return
*/ */
CStartToken::CStartToken(eHTMLTags aTag) : CHTMLToken(aTag) { CStartToken::CStartToken(eHTMLTags aTag) : CHTMLToken(aTag) {
mAttributed=PR_FALSE;
mEmpty=PR_FALSE; mEmpty=PR_FALSE;
mOrigin=-1;
mContainerInfo=eFormUnknown; mContainerInfo=eFormUnknown;
#ifdef DEBUG
mAttributed = PR_FALSE;
#endif
} }
CStartToken::CStartToken(const nsAReadableString& aName) : CHTMLToken(eHTMLTag_unknown) { CStartToken::CStartToken(const nsAReadableString& aName) : CHTMLToken(eHTMLTag_unknown) {
mAttributed=PR_FALSE;
mEmpty=PR_FALSE; mEmpty=PR_FALSE;
mOrigin=-1;
mContainerInfo=eFormUnknown; mContainerInfo=eFormUnknown;
mTextValue.Assign(aName); mTextValue.Assign(aName);
#ifdef DEBUG
mAttributed = PR_FALSE;
#endif
} }
CStartToken::CStartToken(const nsAReadableString& aName,eHTMLTags aTag) : CHTMLToken(aTag) { CStartToken::CStartToken(const nsAReadableString& aName,eHTMLTags aTag) : CHTMLToken(aTag) {
mAttributed=PR_FALSE;
mEmpty=PR_FALSE; mEmpty=PR_FALSE;
mOrigin=-1;
mContainerInfo=eFormUnknown; mContainerInfo=eFormUnknown;
mTextValue.Assign(aName); mTextValue.Assign(aName);
#ifdef DEBUG
mAttributed = PR_FALSE;
#endif
} }
nsresult CStartToken::GetIDAttributeAtom(nsIAtom** aResult) nsresult CStartToken::GetIDAttributeAtom(nsIAtom** aResult)
@ -167,28 +170,6 @@ PRInt32 CStartToken::GetTokenType(void) {
return eToken_start; return eToken_start;
} }
/*
*
*
* @update gess 3/25/98
* @param
* @return
*/
void CStartToken::SetAttributed(PRBool aValue) {
mAttributed=aValue;
}
/*
*
*
* @update gess 3/25/98
* @param
* @return
*/
PRBool CStartToken::IsAttributed(void) {
return mAttributed;
}
/* /*
* *
* *
@ -1350,8 +1331,10 @@ nsresult CNewlineToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aFl
* @return * @return
*/ */
CAttributeToken::CAttributeToken() : CHTMLToken(eHTMLTag_unknown) { CAttributeToken::CAttributeToken() : CHTMLToken(eHTMLTag_unknown) {
mLastAttribute=PR_FALSE;
mHasEqualWithoutValue=PR_FALSE; mHasEqualWithoutValue=PR_FALSE;
#ifdef DEBUG
mLastAttribute = PR_FALSE;
#endif
} }
/* /*
@ -1363,8 +1346,10 @@ CAttributeToken::CAttributeToken() : CHTMLToken(eHTMLTag_unknown) {
*/ */
CAttributeToken::CAttributeToken(const nsAReadableString& aName) : CHTMLToken(eHTMLTag_unknown) { CAttributeToken::CAttributeToken(const nsAReadableString& aName) : CHTMLToken(eHTMLTag_unknown) {
mTextValue.Assign(aName); mTextValue.Assign(aName);
mLastAttribute=PR_FALSE;
mHasEqualWithoutValue=PR_FALSE; mHasEqualWithoutValue=PR_FALSE;
#ifdef DEBUG
mLastAttribute = PR_FALSE;
#endif
} }
/* /*
@ -1378,8 +1363,10 @@ CAttributeToken::CAttributeToken(const nsAReadableString& aName) : CHTMLToken(eH
CAttributeToken::CAttributeToken(const nsAReadableString& aKey, const nsAReadableString& aName) : CHTMLToken(eHTMLTag_unknown) { CAttributeToken::CAttributeToken(const nsAReadableString& aKey, const nsAReadableString& aName) : CHTMLToken(eHTMLTag_unknown) {
mTextValue.Assign(aName); mTextValue.Assign(aName);
mTextKey.Rebind(aKey); mTextKey.Rebind(aKey);
mLastAttribute=PR_FALSE;
mHasEqualWithoutValue=PR_FALSE; mHasEqualWithoutValue=PR_FALSE;
#ifdef DEBUG
mLastAttribute = PR_FALSE;
#endif
} }
/* /*
@ -1771,7 +1758,9 @@ nsresult CAttributeToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 a
if (NS_OK==result) { if (NS_OK==result) {
result=aScanner.Peek(aChar); result=aScanner.Peek(aChar);
mLastAttribute= PRBool((kGreaterThan==aChar) || (kEOF==result)); #ifdef DEBUG
mLastAttribute = (kGreaterThan == aChar || kEOF == result);
#endif
} }
}//if }//if
return result; return result;

Просмотреть файл

@ -68,7 +68,6 @@ CToken::CToken(PRInt32 aTag) {
mAttrCount=0; mAttrCount=0;
mNewlineCount=0; mNewlineCount=0;
mTypeID=aTag; mTypeID=aTag;
mOrigin=eSource;
// Note that the use count starts with 1 instead of 0. This // Note that the use count starts with 1 instead of 0. This
// is because of the assumption that any token created is in // is because of the assumption that any token created is in
// use and therefore does not require an explicit addref, or // use and therefore does not require an explicit addref, or