Changeset 60738 in webkit for trunk/JavaScriptCore/wtf/Vector.h


Ignore:
Timestamp:
Jun 4, 2010, 11:25:50 PM (15 years ago)
Author:
[email protected]
Message:

2010-06-04 Adam Barth <[email protected]>

Reviewed by Darin Adler.

HTML5 parser should be within 1% of old parser performance
https://bugs.webkit.org/show_bug.cgi?id=40172

Fix cast in this operator= to allow for assignment between vectors with
different inline capacities (as clearly intended by its author).

  • wtf/Vector.h: (WTF::::operator):

2010-06-04 Adam Barth <[email protected]>

Reviewed by Darin Adler.

HTML5 parser should be within 1% of old parser performance
https://bugs.webkit.org/show_bug.cgi?id=40172

Stop using adopt(). I think this function is cause us to do extra
mallocs that are hurting performance. Instead of caching AtomicString
on HTML5Token, just use the AtomicString on the old token. Also,
reserve inline capacity for 10 attributes.

  • html/HTML5Lexer.cpp: (WebCore::HTML5Lexer::isAppropriateEndTag):
  • html/HTML5Lexer.h:
  • html/HTML5Token.h: (WebCore::HTML5Token::beginStartTag): (WebCore::HTML5Token::beginEndTag): (WebCore::HTML5Token::beginCharacter): (WebCore::HTML5Token::beginComment): (WebCore::HTML5Token::beginDOCTYPE): (WebCore::HTML5Token::name): (WebCore::HTML5Token::characters): (WebCore::HTML5Token::comment):
  • html/HTML5TreeBuilder.cpp: (WebCore::convertToOldStyle): (WebCore::HTML5TreeBuilder::passTokenToLegacyParser):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/Vector.h

    r59463 r60738  
    700700    }
    701701
     702    inline bool typelessPointersAreEqual(const void* a, const void* b) { return a == b; }
     703
    702704    template<typename T, size_t inlineCapacity>
    703705    template<size_t otherCapacity>
    704706    Vector<T, inlineCapacity>& Vector<T, inlineCapacity>::operator=(const Vector<T, otherCapacity>& other)
    705707    {
    706         if (&other == this)
    707             return *this;
    708        
     708        // If the inline capacities match, we should call the more specific
     709        // template.  If the inline capacities don't match, the two objects
     710        // shouldn't be allocated the same address.
     711        ASSERT(!typelessPointersAreEqual(&other, this));
     712
    709713        if (size() > other.size())
    710714            shrink(other.size());
Note: See TracChangeset for help on using the changeset viewer.