[webkit-reviews] review denied: [Bug 110547] Free up background parser's checkpoints when speculation succeeds : [Attachment 191458] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Mar 8 11:14:02 PST 2013


Adam Barth <abarth at webkit.org> has denied Eric Seidel <eric at webkit.org>'s
request for review:
Bug 110547: Free up background parser's checkpoints when speculation succeeds
https://bugs.webkit.org/show_bug.cgi?id=110547

Attachment 191458: Patch
https://bugs.webkit.org/attachment.cgi?id=191458&action=review

------- Additional Comments from Adam Barth <abarth at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=191458&action=review


I realize my complaints below are mostly aesthetic...

> Source/WebCore/html/parser/BackgroundHTMLInputStream.cpp:56
> +void
BackgroundHTMLInputStream::releaseDataUpThroughCheckpoint(HTMLInputCheckpoint
checkpointIndex)

invalidateCheckpointsBefore ?

>> Source/WebCore/html/parser/BackgroundHTMLInputStream.cpp:58
>> +	const Checkpoint& checkpoint = m_checkpoints[checkpointIndex];
> 
> Would it make sense to assert the invariant checkpointIndex <
m_checkpoints.size() in this function?

We should ASSERT that checkpoint hasn't been invalidated yet.

>> Source/WebCore/html/parser/BackgroundHTMLInputStream.cpp:60
>> +	    m_segments[i] = String();
> 
> Does this work correctly in the case where there are multiple checkpoints per
append?  Probably.
> 
> Also, this algorithm is n^2.	Should we keep some state for the smallest
index that has actual data and start the loop from there?

Please fix the n^2 issue.

>> Source/WebCore/html/parser/HTMLDocumentParser.cpp:470
>> +	    // Processing a chunk can call document.write, causing us to
invalidate any remaining speculations.
>> +	    // Similarly, if we're stopped just abort and don't bother to tell
the parser about passing this checkpoint.
>> +	    if (m_speculations.isEmpty() || isStopped()) {
>> +		checkpointIndex = 0;
>> +		break;
>> +	    }
> 
> This is pretty ugly....

There must be a way to structure this code so that it's less subtle.  Maybe we
should do this work in validateSpeculations instead?


More information about the webkit-reviews mailing list