Changeset 143845 in webkit
- Timestamp:
- Feb 23, 2013 10:37:50 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r143844 r143845 1 2013-02-23 Adam Barth <abarth@webkit.org> 2 3 Threaded HTML parser should pass fast/parser/parser-yield-timing.html 4 https://bugs.webkit.org/show_bug.cgi?id=110647 5 6 Reviewed by Eric Seidel. 7 8 Previously, the threaded HTML parser would run for an arbitrary amount 9 of time without yielding after speculation succeeded. This might be the 10 cause of the good DOMContentLoaded numbers. 11 12 Note: This patch also demonstrates that the ParseHTML_max numbers 13 aren't correct currently because they're measuring the interior of this 14 loop instead of all the time spent in the loop. We should move the 15 instrumentation in a followup patch. 16 17 * html/parser/HTMLDocumentParser.cpp: 18 (WebCore::HTMLDocumentParser::resumeParsingAfterYield): 19 (WebCore::HTMLDocumentParser::pumpPendingSpeculations): 20 (WebCore): 21 (WebCore::HTMLDocumentParser::resumeParsingAfterScriptExecution): 22 * html/parser/HTMLDocumentParser.h: 23 (HTMLDocumentParser): 24 * html/parser/HTMLParserScheduler.cpp: 25 1 26 2013-02-23 Martin Robinson <mrobinson@igalia.com> 2 27 -
trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp
r143828 r143845 241 241 void HTMLDocumentParser::resumeParsingAfterYield() 242 242 { 243 ASSERT(!m_haveBackgroundParser);244 245 243 // pumpTokenizer can cause this parser to be detached from the Document, 246 244 // but we need to ensure it isn't deleted yet. 247 245 RefPtr<HTMLDocumentParser> protect(this); 246 247 #if ENABLE(THREADED_HTML_PARSER) 248 if (m_haveBackgroundParser) { 249 pumpPendingSpeculations(); 250 return; 251 } 252 #endif 248 253 249 254 // We should never be here unless we can pump immediately. Call pumpTokenizer() … … 356 361 void HTMLDocumentParser::processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk> chunk) 357 362 { 363 // ASSERT that this object is both attached to the Document and protected. 364 ASSERT(refCount() >= 2); 358 365 ASSERT(shouldUseThreading()); 359 366 … … 393 400 394 401 checkForSpeculationFailure(); 402 } 403 404 void HTMLDocumentParser::pumpPendingSpeculations() 405 { 406 // FIXME: Share this constant with the parser scheduler. 407 const double parserTimeLimit = 0.500; 408 409 // ASSERT that this object is both attached to the Document and protected. 410 ASSERT(refCount() >= 2); 411 412 // FIXME: Pass in current input length. 413 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willWriteHTML(document(), 0, lineNumber().zeroBasedInt()); 414 415 double startTime = currentTime(); 416 417 while (!m_speculations.isEmpty()) { 418 processParsedChunkFromBackgroundParser(m_speculations.takeFirst()); 419 420 if (isWaitingForScripts() || isStopped()) 421 break; 422 423 if (currentTime() - startTime > parserTimeLimit && !m_speculations.isEmpty()) { 424 m_parserScheduler->scheduleForResume(); 425 break; 426 } 427 } 428 429 InspectorInstrumentation::didWriteHTML(cookie, lineNumber().zeroBasedInt()); 395 430 } 396 431 … … 796 831 // but we need to ensure it isn't deleted yet. 797 832 RefPtr<HTMLDocumentParser> protect(this); 798 799 // FIXME: Pass in current input length. 800 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willWriteHTML(document(), 0, lineNumber().zeroBasedInt()); 801 802 while (!m_speculations.isEmpty()) { 803 processParsedChunkFromBackgroundParser(m_speculations.takeFirst()); 804 if (isWaitingForScripts() || isStopped()) 805 break; 806 } 807 808 InspectorInstrumentation::didWriteHTML(cookie, lineNumber().zeroBasedInt()); 809 833 pumpPendingSpeculations(); 810 834 return; 811 835 } -
trunk/Source/WebCore/html/parser/HTMLDocumentParser.h
r143797 r143845 143 143 void didFailSpeculation(PassOwnPtr<HTMLToken>, PassOwnPtr<HTMLTokenizer>); 144 144 void processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); 145 void pumpPendingSpeculations(); 145 146 #endif 146 147 -
trunk/Source/WebCore/html/parser/HTMLParserScheduler.cpp
r142378 r143845 38 38 39 39 // defaultParserTimeLimit is the seconds the parser will run in one write() call 40 // before yielding. Inline <script> execution can cause it to excedethe limit.40 // before yielding. Inline <script> execution can cause it to exceed the limit. 41 41 // FIXME: We would like this value to be 0.2. 42 42 static const double defaultParserTimeLimit = 0.500;
Note: See TracChangeset
for help on using the changeset viewer.