Changeset 144407 in webkit
- Timestamp:
- Feb 28, 2013 6:12:54 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r144405 r144407 1 2013-02-28 Adam Barth <abarth@webkit.org> 2 3 The threaded HTML parser shouldn't need to invalidate the speculation buffer on every document.write 4 https://bugs.webkit.org/show_bug.cgi?id=111130 5 6 Reviewed by Eric Seidel. 7 8 Previously, the threaded HTML parser always invalidated its speculation 9 buffer when it received a document.write. That means we performed 10 poorly on web sites that contained document.write calls early in the 11 page. 12 13 This patch teaches the HTMLDocumentParser that we don't need to discard 14 the speculation buffer in the common case of starting and ending in the 15 DataState. 16 17 * html/parser/BackgroundHTMLParser.cpp: 18 (WebCore::BackgroundHTMLParser::sendTokensToMainThread): 19 * html/parser/HTMLDocumentParser.cpp: 20 (WebCore::HTMLDocumentParser::checkForSpeculationFailure): 21 (WebCore::HTMLDocumentParser::didFailSpeculation): 22 * html/parser/HTMLDocumentParser.h: 23 (WebCore): 24 (ParsedChunk): 25 1 26 2013-02-28 Eberhard Graether <egraether@google.com> 2 27 -
trunk/Source/WebCore/html/parser/BackgroundHTMLParser.cpp
r144010 r144407 280 280 chunk->tokens = m_pendingTokens.release(); 281 281 chunk->preloads.swap(m_pendingPreloads); 282 chunk->tokenizerState = m_tokenizer->state(); 282 283 chunk->inputCheckpoint = m_input.createCheckpoint(); 283 284 chunk->preloadScannerCheckpoint = m_preloadScanner->createCheckpoint(); -
trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp
r144158 r144407 333 333 if (!m_tokenizer) 334 334 return; 335 // FIXME: If the tokenizer is in the same state as when we started this function, 336 // then we haven't necessarily failed our speculation. 335 if (!m_currentChunk) 336 return; 337 // Currently we're only smart enough to reuse the speculation buffer if the tokenizer 338 // both starts and ends in the DataState. That state is simplest because the HTMLToken 339 // is always in the Uninitialized state. We should consider whether we can reuse the 340 // speculation buffer in other states, but we'd likely need to do something more 341 // sophisticated with the HTMLToken. 342 if (m_currentChunk->tokenizerState == HTMLTokenizer::DataState && m_tokenizer->state() == HTMLTokenizer::DataState && m_input.current().isEmpty()) { 343 ASSERT(m_token->isUninitialized()); 344 m_tokenizer.clear(); 345 m_token.clear(); 346 return; 347 } 337 348 didFailSpeculation(m_token.release(), m_tokenizer.release()); 338 349 } … … 340 351 void HTMLDocumentParser::didFailSpeculation(PassOwnPtr<HTMLToken> token, PassOwnPtr<HTMLTokenizer> tokenizer) 341 352 { 342 if (!m_currentChunk)343 return;344 345 353 m_weakFactory.revokeAll(); 346 354 m_speculations.clear(); -
trunk/Source/WebCore/html/parser/HTMLDocumentParser.h
r144000 r144407 37 37 #include "HTMLSourceTracker.h" 38 38 #include "HTMLToken.h" 39 #include "HTMLTokenizer.h" 39 40 #include "ScriptableDocumentParser.h" 40 41 #include "SegmentedString.h" … … 55 56 class HTMLDocument; 56 57 class HTMLParserScheduler; 57 class HTMLTokenizer;58 58 class HTMLScriptRunner; 59 59 class HTMLTreeBuilder; … … 90 90 OwnPtr<CompactHTMLTokenStream> tokens; 91 91 PreloadRequestStream preloads; 92 HTMLTokenizer::State tokenizerState; 92 93 HTMLInputCheckpoint inputCheckpoint; 93 94 TokenPreloadScannerCheckpoint preloadScannerCheckpoint;
Note: See TracChangeset
for help on using the changeset viewer.