REGRESSION (r167530): ASSERT(m_selfTime <= m_totalTime) on tests that run after certain Inspector tests
https://bugs.webkit.org/show_bug.cgi?id=131919

* TestExpectations: Skipping some Inspector tests, hopefully these are the ones that
cause trouble later.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167593 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move cross-port Source/WebCore/page/ code to std::unique_ptr
https://bugs.webkit.org/show_bug.cgi?id=130534

Reviewed by Darin Adler.


Source/WebCore: 
Replace uses of OwnPtr and PassOwnPtr in cross-port code under Source/WebCore/page/ with
std::unique_ptr. Unnecessary OwnPtr.h and PassOwnPtr.h header inclusions are removed as well.

* dom/Document.cpp:
(WebCore::Document::initSecurityContext):
* dom/SecurityContext.cpp:
(WebCore::SecurityContext::setContentSecurityPolicy):
* dom/SecurityContext.h:
* page/CaptionUserPreferences.h:
* page/ContentSecurityPolicy.cpp:
(WebCore::CSPDirectiveList::create):
(WebCore::CSPDirectiveList::checkEvalAndReportViolation):
(WebCore::CSPDirectiveList::checkInlineAndReportViolation):
(WebCore::CSPDirectiveList::checkSourceAndReportViolation):
(WebCore::CSPDirectiveList::setCSPDirective):
(WebCore::ContentSecurityPolicy::didReceiveHeader):
* page/ContentSecurityPolicy.h:
* page/DOMSecurityPolicy.h:
* page/DOMWindow.cpp:
(WebCore::PostMessageTimer::fired):
(WebCore::DOMWindow::postMessageTimerFired):
* page/DOMWindow.h:
* page/EventHandler.cpp:
(WebCore::EventHandler::EventHandler):
* page/EventHandler.h:
* page/Frame.cpp:
(WebCore::Frame::Frame):
(WebCore::createRegExpForLabels):
(WebCore::Frame::searchForLabelsAboveCell):
(WebCore::Frame::searchForLabelsBeforeElement):
(WebCore::matchLabelsAgainstString):
(WebCore::Frame::setTiledBackingStoreEnabled):
* page/Frame.h:
* page/FrameView.cpp:
(WebCore::FrameView::addEmbeddedObjectToUpdate):
(WebCore::FrameView::addSlowRepaintObject):
(WebCore::FrameView::addViewportConstrainedObject):
(WebCore::FrameView::addScrollableArea):
* page/FrameView.h:
* page/Page.cpp:
(WebCore::Page::Page):
* page/Page.h:
* page/PageConsole.h:
* page/PageThrottler.h:
* page/SecurityPolicy.cpp:
(WebCore::SecurityPolicy::addOriginAccessWhitelistEntry):
* page/animation/AnimationController.h:
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::PropertyWrapperVisitedAffectedColor::PropertyWrapperVisitedAffectedColor):
(WebCore::CSSPropertyAnimationWrapperMap::instance):
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* page/mac/PageMac.cpp:
(WebCore::Page::addSchedulePair):
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::applyContentSecurityPolicyFromString):

Source/WebKit/mac: 
* WebView/WebHTMLRepresentation.mm:
(searchForLabelsBeforeElement): Pass a RegExp reference to Frame::searchForLabelsAboveCell().


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167594 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Win] Unreviewed build fix.

* inspector/TimelineRecordFactory.cpp: Add missing include.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167595 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Media] Clean up localized strings in controls
https://bugs.webkit.org/show_bug.cgi?id=131857
<rdar://problem/16663005>

Reviewed by Eric Carlson.

There is no need for separate localization files
on OS X and iOS. Move the small number of iOS-specific
localizations into a shared file.

We also don't need a function to return a static table.
Ultimately I think we want a top-level WebKit object that
hold the table, but for now use a global variable
called UIStringTable. Since we're in an isolated world, we
won't clash with anything.

I noticed a few cases were we grab a localized string and
then instantly run a replacement on it. This should be
supported directly in the UIString() accessor.

* English.lproj/mediaControlsLocalizedStrings.js: Add iOS strings. Just
use a static table.
(mediaControlsLocalizedStrings): Deleted.
* English.lproj/mediaControlsLocalizedStringsiOS.js: Removed.
* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.extend): Fix braces.
(Controller.prototype.UIString): Use the string table, and allow replacement.
(Controller.prototype.createControls): Use new UIString replacement.
* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.updateWirelessPlaybackStatus): Use new UIString.
(ControllerIOS.prototype.UIString): Deleted. Use the parent class version.
* WebCore.xcodeproj/project.pbxproj: Remove file from Resources.
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::mediaControlsScript): No need to include the iOS
specific localization file.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167596 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[New Multicolumn] Pagination mode messed up with non-inline axis and reversed direction.
https://bugs.webkit.org/show_bug.cgi?id=131811

Reviewed by Dean Jackson.


Source/WebCore: 
Added fast/multicol/newmulticol/compare-with-old-impl/BottomToTop-tb.html
        
With block axis pagination mode, it is possible to set a column height that is not the same
as the available fill height for a block. The new multi-column code had the assumption that
the column height was the same as the amount of fill room you had available. This is not
the case.
        
To correct the issue, I added a member variable to RenderMultiColumnSet that stores the
available column height as a separate variable from the computed column height. This allows
the pagination API to specify a different column height that is not the same as the view's
content height.

Even though it isn't involved in the solution, I also patched pageOrViewLogicalHeight on
RenderView to work with the new column code as well.

To address the layout test failures (that caused the previous rollout), I made sure to
initialize m_availableHeight to 0 when m_computedColumnHeight also gets reset to 0.
        
The assertion is not something I could reproduce on any machine, but I can see the problem.
I patched Page's pageCount method to not have column code directly in Page.cpp, 
and to make a new pageCount() method on RenderView that Page calls
into. This method is now patched to handle the new column code as well as the old. I have
no real way of testing this method though, since I can't reproduce the assertion that the
bots were experiencing.

* page/Page.cpp:
(WebCore::Page::pageCount):
* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::RenderMultiColumnSet):
(WebCore::RenderMultiColumnSet::setAndConstrainColumnHeight):
(WebCore::RenderMultiColumnSet::prepareForLayout):
(WebCore::RenderMultiColumnSet::computeLogicalHeight):
* rendering/RenderMultiColumnSet.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::pageOrViewLogicalHeight):
(WebCore::RenderView::pageCount):
* rendering/RenderView.h:

LayoutTests: 
* fast/multicol/newmulticol/compare-with-old-impl/BottomToTop-tb-expected.html: Added.
* fast/multicol/newmulticol/compare-with-old-impl/BottomToTop-tb.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167597 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r160908): Safari doesn't draw rotated images properly first time
https://bugs.webkit.org/show_bug.cgi?id=131930

Reviewed by Anders Carlsson.

With render tree creation sufficiently lazy, we had to put some explicit
calls to updateStyleIfNeeded into the ImageDocument class.

* dom/DOMImplementation.cpp:
(WebCore::DOMImplementation::createDocument): Pass a Frame&.

* html/ImageDocument.cpp:
(WebCore::ImageDocument::imageSize): Added this helper function. This updates
style so we can use the renderer to compute an image size taking things like
orientation into account, and also passes in the zoom factor.
(WebCore::ImageDocument::updateDuringParsing): Moved the body of the
ImageDocumentParser::appendBytes function into this function. Since it's a
member of ImageDocument, it has better access to appropriate private members,
and we don't have to expose as many functions to the public. Also changed to
not use the frame so much. Also merged in the code that creates the document
instead of having it be a side effect in the cachedImage helper function; all
the other call sites were checking for null before calling cachedImage.
(WebCore::ImageDocument::finishedParsing): Moved the body of the
ImageDocumentParser::finish function here. Added a call to updateStyleIfNeeded
before using the renderer to get the image size.
(WebCore::ImageDocumentParser::document): Made this return a reference. It's
just a convenience function used in the two functions below.
(WebCore::ImageDocumentParser::appendBytes): Just call updateDuringParsing.
(WebCore::ImageDocumentParser::finish): Just call finishedParsing.
(WebCore::ImageDocument::ImageDocument): Take a reference for the argument,
use nullptr, and also initialize m_shouldShrinkImage directly instead of using
a shouldShrinkToFit() helper function to do it.
(WebCore::ImageDocument::createDocumentStructure): Removed unneeded check of
null for the frame, since the caller does it. Removed some unneeded
IGNORE_EXCEPTON and a stray semicolon. Use m_shouldShrinkImage instead of
calling shouldShrinkToFit since at this early point they will be identical.
(WebCore::ImageDocument::scale): Make non-const so we can call the new
imageSize helper. Use Document::view instead of Frame::view. Improved the
conversion to floating point so it doesn't involve a static_cast and an extra
conversion from int to LayoutUnit.
(WebCore::ImageDocument::resizeImageToFit): Ditto.
(WebCore::ImageDocument::imageClicked): Ditto.
(WebCore::ImageDocument::imageUpdated): Ditto. Also use m_shouldShrinkImage
ibnstead of shouldShrinkToFit.
(WebCore::ImageDocument::restoreImageSize): Ditto.
(WebCore::ImageDocument::imageFitsInWindow): Ditto.
(WebCore::ImageDocument::windowSizeChanged): Ditto.
(WebCore::ImageDocument::cachedImage): Deleted. Moved logic into updateDuringParsing.
(WebCore::ImageDocument::shouldShrinkToFit): Deleted. Moved logic into constructor.
(WebCore::ImageEventListener::handleEvent): Updated for changes above.
(WebCore::ImageEventListener::operator==): Simplified. No reason this has to check
whether both listeners are in the same document.
(WebCore::ImageDocumentElement::didMoveToNewDocument): Use nullptr.

* html/ImageDocument.h: Deleted some unused things, updated for changes above,
and made some memer functions private.

* loader/FrameLoaderClient.h: Deleted the allowScriptFromSource, allowPlugins,
allowImage, and allowDisplayingInsecureContent functions. These were only used in
Chromium and are now unneeded complexity. We could bring them back if anyone wants them.

* loader/MixedContentChecker.cpp:
(WebCore::MixedContentChecker::canDisplayInsecureContent): Removed call to
allowDisplayingInsecureContent, just use the setting directly.
(WebCore::MixedContentChecker::canRunInsecureContent): Removed call to
allowRunningInsecureContent, just use the setting directly.

* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::allowPlugins): Removed call to allowPlugins, just
use the arePluginsEnabled setting directly.

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::canRequest): Removed call to allowScriptFromSource, just
use the isScriptEnabled setting directly.
(WebCore::CachedResourceLoader::clientDefersImage): Removed call to allowImage.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167598 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r167591): ARM64 and ARM traditional builds broken
https://bugs.webkit.org/show_bug.cgi?id=131935

Reviewed by Mark Hahnenberg.

Added store8(TrustedImm32, MacroAssembler::Address) to the ARM traditional and ARM64
macro assemblers.  Added a new test for the original patch.

* assembler/MacroAssemblerARM.h:
(JSC::MacroAssemblerARM::store8):
* assembler/MacroAssemblerARM64.h:
(JSC::MacroAssemblerARM64::store8):
* tests/stress/dfg-create-arguments-inline-alloc.js: New test.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167599 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Take block execution count estimates into account when voting double
https://bugs.webkit.org/show_bug.cgi?id=131906

Reviewed by Geoffrey Garen.
        
This was a drama in three acts.
        
Act I: Slurp in BasicBlock::executionCount and use it as a weight when counting the
    number of uses of a variable that want double or non-double. Easy as pie. This
    gave me a huge speed-up on FloatMM and a huge slow-down on basically everything
    else.
        
Act II: Realize that there were some programs where our previous double voting was
    just on the edge of disaster and making it more precise tipped it over. In
    particular, if you had an integer variable that would infrequently be used in a
    computation that resulted in a variable that was frequently used as an array index,
    the outer infrequentness would be the thing we'd use in the vote. So, an array
    index would become double. We fix this by reviving global backwards propagation
    and introducing the concept of ReallyWantsInt, which is used just for array
    indices. Any variable transitively flagged as ReallyWantsInt will never be forced
    double. We need that flag to be separate from UsedAsInt, since UsedAsInt needs to
    be set in bitops for RageConversion but using it for double forcing is too much.
    Basically, it's cheaper to have to convert a double to an int for a bitop than it
    is to convert a double to an int for an array index; also a variable being used as
    an array index is a much stronger hint that it ought to be an int. This recovered
    performance on everything except programs that used FTL OSR entry.
        
Act III: Realize that OSR entrypoint creation creates blocks that have NaN execution
    count, which then completely pollutes the weighting - essentially all votes go
    NaN. Fix this with some surgical defenses. Basically, any client of execution
    counts should allow for them to be NaN and shouldn't completely fall off a cliff
    when it happens.
        
This is awesome. 75% speed-up on FloatMM. 11% speed-up on audio-dft. This leads to
7% speed-up on AsmBench and 2% speed-up on Kraken.

* CMakeLists.txt:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* dfg/DFGBackwardsPropagationPhase.cpp:
(JSC::DFG::BackwardsPropagationPhase::run):
(JSC::DFG::BackwardsPropagationPhase::propagate):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::dumpBlockHeader):
* dfg/DFGGraph.h:
(JSC::DFG::Graph::voteNode):
(JSC::DFG::Graph::voteChildren):
* dfg/DFGNodeFlags.cpp:
(JSC::DFG::dumpNodeFlags):
* dfg/DFGNodeFlags.h:
* dfg/DFGOSREntrypointCreationPhase.cpp:
(JSC::DFG::OSREntrypointCreationPhase::run):
* dfg/DFGPlan.cpp:
(JSC::DFG::Plan::compileInThreadImpl):
* dfg/DFGPredictionPropagationPhase.cpp:
(JSC::DFG::PredictionPropagationPhase::doDoubleVoting):
(JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting):
* dfg/DFGVariableAccessData.cpp: Added.
(JSC::DFG::VariableAccessData::VariableAccessData):
(JSC::DFG::VariableAccessData::mergeIsCaptured):
(JSC::DFG::VariableAccessData::mergeShouldNeverUnbox):
(JSC::DFG::VariableAccessData::predict):
(JSC::DFG::VariableAccessData::mergeArgumentAwarePrediction):
(JSC::DFG::VariableAccessData::shouldUseDoubleFormatAccordingToVote):
(JSC::DFG::VariableAccessData::tallyVotesForShouldUseDoubleFormat):
(JSC::DFG::VariableAccessData::mergeDoubleFormatState):
(JSC::DFG::VariableAccessData::makePredictionForDoubleFormat):
(JSC::DFG::VariableAccessData::flushFormat):
* dfg/DFGVariableAccessData.h:
(JSC::DFG::VariableAccessData::vote):
(JSC::DFG::VariableAccessData::VariableAccessData): Deleted.
(JSC::DFG::VariableAccessData::mergeIsCaptured): Deleted.
(JSC::DFG::VariableAccessData::mergeShouldNeverUnbox): Deleted.
(JSC::DFG::VariableAccessData::predict): Deleted.
(JSC::DFG::VariableAccessData::mergeArgumentAwarePrediction): Deleted.
(JSC::DFG::VariableAccessData::shouldUseDoubleFormatAccordingToVote): Deleted.
(JSC::DFG::VariableAccessData::tallyVotesForShouldUseDoubleFormat): Deleted.
(JSC::DFG::VariableAccessData::mergeDoubleFormatState): Deleted.
(JSC::DFG::VariableAccessData::makePredictionForDoubleFormat): Deleted.
(JSC::DFG::VariableAccessData::flushFormat): Deleted.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167600 268f45cc-cd09-0410-ab3c-d52691b4dbfc
http/tests/cache/subresource-failover-to-network.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=131936

Reviewed by Brady Eidson.

The test was racy, because it was unintentionally queuing TestRunner operations
twice. Also, it failed to clean up its cookie.

Rewrote to not use TestRunner queuing, making the test work in browser.

* http/tests/cache/resources/subresource-failover-to-network.cgi:
* http/tests/cache/subresource-failover-to-network.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167601 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore: [New Multicolumn] Column balancing is slow on float-multicol.html
https://bugs.webkit.org/show_bug.cgi?id=131801

Reviewed by Enrica Casucci.

Added fast/multicol/tall-float.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::expandsToEncloseOverhangingFloats):
Make RenderFlowThreads expand to encompass floats. Also from Morten's patch for
Blink (#361551).

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::computeOverflow):
Fix a bug where the new multi-column code was adding in overflow for floats
when it should not. This was resulting in the creation of scrollbars when none
should exist. This is my own addition.

(WebCore::RenderBlockFlow::addOverhangingFloats):
Make RenderFlowThreads and RenderRegions ignore overhanging float additions. This
comes from Morten's patch for Blink (#361551).

LayoutTests: http/tests/cache/subresource-failover-to-network.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=131936

Patch by Alexey Proskuryakov <ap@apple.com> on 2014-04-21
Reviewed by Brady Eidson.

The test was racy, because it was unintentionally queuing TestRunner operations
twice. Also, it failed to clean up its cookie.

Rewrote to not use TestRunner queuing, making the test work in browser.

* http/tests/cache/resources/subresource-failover-to-network.cgi:
* http/tests/cache/subresource-failover-to-network.html:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167602 268f45cc-cd09-0410-ab3c-d52691b4dbfc