Changeset 62678 in webkit
- Timestamp:
- Jul 7, 2010 10:11:28 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r62677 r62678 1 2010-07-07 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 HTMLTreeBuilder is way too slow 6 https://bugs.webkit.org/show_bug.cgi?id=41754 7 8 This takes us from 14s to 7s on our parsing benchmark. 9 That's still much slower than the old tree builder, but there 10 is a huge amount of fat left to trim. 11 12 Vector<T> wasn't able to inline all the Entry functions when 13 they were buried in the cpp. Turns out the active formatting elements 14 list is very hot. 15 16 I'm not sure Vector<T> is going to be the right data structure for us 17 in the end, but it has done alright for bring-up. 18 19 * html/HTMLFormattingElementList.cpp: 20 * html/HTMLFormattingElementList.h: 21 (WebCore::HTMLFormattingElementList::Entry::Entry): 22 (WebCore::HTMLFormattingElementList::Entry::~Entry): 23 (WebCore::HTMLFormattingElementList::Entry::isMarker): 24 (WebCore::HTMLFormattingElementList::Entry::element): 25 (WebCore::HTMLFormattingElementList::Entry::replaceElement): 26 (WebCore::HTMLFormattingElementList::Entry::operator==): 27 (WebCore::HTMLFormattingElementList::Entry::operator!=): 28 1 29 2010-07-06 Darin Adler <darin@apple.com> 2 30 -
trunk/WebCore/html/HTMLFormattingElementList.cpp
r62642 r62678 31 31 32 32 namespace WebCore { 33 34 HTMLFormattingElementList::Entry::Entry(Element* element)35 : m_element(element)36 {37 ASSERT(element);38 }39 40 HTMLFormattingElementList::Entry::Entry(MarkerEntryType)41 {42 }43 44 HTMLFormattingElementList::Entry::~Entry()45 {46 }47 48 bool HTMLFormattingElementList::Entry::isMarker() const49 {50 return !m_element;51 }52 53 Element* HTMLFormattingElementList::Entry::element() const54 {55 // The fact that !m_element == isMarker() is an implementation detail56 // callers should check isMarker() before calling element().57 ASSERT(m_element);58 return m_element.get();59 }60 61 void HTMLFormattingElementList::Entry::replaceElement(PassRefPtr<Element> element)62 {63 ASSERT(m_element); // Once a marker, always a marker.64 m_element = element;65 }66 67 bool HTMLFormattingElementList::Entry::operator==(const Entry& other) const68 {69 return m_element == other.m_element;70 }71 72 bool HTMLFormattingElementList::Entry::operator!=(const Entry& other) const73 {74 return m_element != other.m_element;75 }76 33 77 34 HTMLFormattingElementList::HTMLFormattingElementList() -
trunk/WebCore/html/HTMLFormattingElementList.h
r62642 r62678 47 47 class Entry { 48 48 public: 49 Entry(Element*); 49 // Inline because they're hot and Vector<T> uses them. 50 Entry(Element* element) 51 : m_element(element) 52 { 53 ASSERT(element); 54 } 50 55 enum MarkerEntryType { MarkerEntry }; 51 Entry(MarkerEntryType); 52 ~Entry(); 56 Entry(MarkerEntryType) 57 : m_element(0) 58 { 59 } 60 ~Entry() {} 53 61 54 bool isMarker() const ;62 bool isMarker() const { return !m_element; } 55 63 56 Element* element() const; 57 void replaceElement(PassRefPtr<Element>); 64 Element* element() const 65 { 66 // The fact that !m_element == isMarker() is an implementation detail 67 // callers should check isMarker() before calling element(). 68 ASSERT(m_element); 69 return m_element.get(); 70 } 71 void replaceElement(PassRefPtr<Element> element) { m_element = element; } 58 72 59 // Needed for use with Vector. 60 bool operator==(const Entry& ) const;61 bool operator!=(const Entry& ) const;73 // Needed for use with Vector. These are super-hot and must be inline. 74 bool operator==(const Entry& other) const { return m_element == other.m_element; } 75 bool operator!=(const Entry& other) const { return m_element != other.m_element; } 62 76 63 77 private:
Note: See TracChangeset
for help on using the changeset viewer.