GC allocation trigger should be tuned to system RAM
https://bugs.webkit.org/show_bug.cgi?id=87039

Reviewed by Darin Adler.

../JavaScriptCore: 

This helps avoid OOM crashes on small platforms, and helps avoid "too much GC"
performance issues on big platforms.

* heap/Heap.cpp:
(JSC::Heap::Heap):
(JSC::Heap::collect):
* heap/Heap.h:
(Heap): GC balances between a fixed minimum and a proportional multiplier,
which are limited based on system RAM.

* runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::JSGlobalData):
(JSC::JSGlobalData::createContextGroup):
(JSC::JSGlobalData::create):
(JSC::JSGlobalData::createLeaked):
* runtime/JSGlobalData.h:
(JSGlobalData): Renamed HeapSize to HeapType because the exact size is
influenced by the heap type, but not determined by it.

../WTF: 

Added a helper function for measuring system RAM.

* GNUmakefile.list.am:
* WTF.gypi:
* WTF.pro:
* WTF.vcproj/WTF.vcproj:
* WTF.xcodeproj/project.pbxproj:
* wtf/AmountOfRAM.cpp: Added.
(WTF):
(WTF::computeAmountOfRAM):
(WTF::amountOfRAM):
* wtf/AmountOfRAM.h: Added.
(WTF):
* wtf/CMakeLists.txt:
* wtf/StdLibExtras.h:
(WTF):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118019 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] canvas/philip/tests/2d.path.stroke.overlap.html fails with Qt-4.6.2 or higher
https://bugs.webkit.org/show_bug.cgi?id=40362

Reviewed by Noam Rosenthal.

Source/WebCore:

Before drawing the stroke from a certain path, it should make the union of the stroke areas.
The previous implementation didn't consider that so the intersection was painted twice.
By using QPainterPathStroker, we create a QPainterPath on top of the platform path, and
then we fill it with the expected brush. This way we avoid repainting areas.

* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::fillPathStroke):
(WebCore):
(WebCore::GraphicsContext::strokePath):

LayoutTests:

* platform/qt/Skipped: Unskip test after fix.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118020 268f45cc-cd09-0410-ab3c-d52691b4dbfc
DFG should support reflective arguments access
https://bugs.webkit.org/show_bug.cgi?id=85721

Reviewed by Oliver Hunt.
        
Merged r116345 from dfgopt.
        
This adds support for op_create_arguments to the DFG. No other arguments-related
opcodes are added by this change, though it does add a lot of the scaffolding
necessary for the other ops.
        
This also adds GetByVal/PutByVal optimizations for Arguments.
        
Finally, this rationalizes slowPathCall with no return. Previously, that would
work via callOperation() overloads that took InvalidGPRReg as the return GPR.
But that creates awful ambiguity, since we had template functions that were
polymorphic over all parameters except the second, which was a GPRReg, and a
bunch of non-template overloads that also potentially had GPRReg as the second
argument. I finally started to hit this ambiguity and was getting absolutely
bizarre compiler errors, that made me feel like I was programming in SML. So,
I changed the no-argument overloads to take NoResultTag instead, which made
everything sensible again by eliminating the overload ambiguity.
        
This is a ~7% speed-up on V8/earley and neutral elsewhere.

* bytecode/PredictedType.h:
(JSC::isArgumentsPrediction):
(JSC):
(JSC::isActionableMutableArrayPrediction):
* dfg/DFGAbstractState.cpp:
(JSC::DFG::AbstractState::execute):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGCCallHelpers.h:
(JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
(CCallHelpers):
* dfg/DFGCSEPhase.cpp:
(JSC::DFG::CSEPhase::performNodeCSE):
* dfg/DFGCapabilities.h:
(JSC::DFG::canCompileOpcode):
(JSC::DFG::canInlineOpcode):
* dfg/DFGCommon.h:
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGNode.h:
(JSC::DFG::Node::unmodifiedArgumentsRegister):
(Node):
(JSC::DFG::Node::shouldSpeculateArguments):
* dfg/DFGNodeType.h:
(DFG):
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGPredictionPropagationPhase.cpp:
(JSC::DFG::PredictionPropagationPhase::propagate):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileGetIndexedPropertyStorage):
(JSC::DFG::SpeculativeJIT::compileGetByValOnArguments):
(DFG):
(JSC::DFG::SpeculativeJIT::compileGetArgumentsLength):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::silentSpillAllRegistersImpl):
(SpeculativeJIT):
(JSC::DFG::SpeculativeJIT::pickCanTrample):
(JSC::DFG::SpeculativeJIT::callOperation):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::cachedPutById):
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::cachedPutById):
(JSC::DFG::SpeculativeJIT::compile):
* runtime/Arguments.h:
(ArgumentsData):
(Arguments):
(JSC::Arguments::offsetOfData):



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

* wtf/RAMSize.cpp:
(WTF::computeRAMSize):
If you say you are going to return a size_t, actually return a size_t.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118031 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] Fix tests being flaky when multiple draws occur in between commits
https://bugs.webkit.org/show_bug.cgi?id=83935

Tests that are verifying events in a commit/draw lock-step pattern, should use
sourceFrameNumber() not frameNumber() on the impl side.
Otherwise they will fail if the same frame is drawn more than once in
between commits (which is perfectly legal and could happen for example
because we draw without a new commit because we are still in BEGIN_FRAME
or updating resources).

Patch by Daniel Sievers <sievers@chromium.org> on 2012-05-22
Reviewed by Adrienne Walker.

* tests/CCLayerTreeHostTest.cpp:
(WTF::CCLayerTreeHostTestScrollSimple::drawLayersOnCCThread):
(WTF::CCLayerTreeHostTestScrollMultipleRedraw::drawLayersOnCCThread):
(WTF::CCLayerTreeHostTestStartPageScaleAnimation::commitCompleteOnCCThread):
(WTF::CCLayerTreeHostTestAtomicCommit::commitCompleteOnCCThread):
(WTF::CCLayerTreeHostTestAtomicCommit::drawLayersOnCCThread):
(WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::commitCompleteOnCCThread):
(WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::drawLayersOnCCThread):
(WTF::CCLayerTreeHostTestFractionalScroll::drawLayersOnCCThread):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118034 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-05-22  Geoffrey Garen  <ggaren@apple.com>

        Build fix.

        * wtf/RAMSize.cpp:
        (WTF::computeRAMSize): sysctl expects a uint64_t, so use that and then
        cast back to size_t. Since it's coneivable that a 32bit process would
        run on a system with more than 4GB RAM, I added a paranoid check for
        that condition.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] getPlatformThreadRegisters() should fetch target thread's registers
https://bugs.webkit.org/show_bug.cgi?id=87148

Patch by Yong Li <yoli@rim.com> on 2012-05-22
Reviewed by George Staikos.

Our previous implementation of getPlatformThreadRegisters() read registers in current
thread's context but it is supposed to read the target thread's registers.

* heap/MachineStackMarker.cpp:
(JSC::getPlatformThreadRegisters):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118038 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore: Fix iframe printing.
https://bugs.webkit.org/show_bug.cgi?id=85118

Patch by Vitaly Buka <vitalybuka@chromium.org> on 2012-05-22
Reviewed by Darin Adler, Eric Seidel.

Patch fixed two issues by disabling special handling of subframes for printing.
1. Regression. Division by zero when forceLayoutForPagination called for subframes
and page sizes set to zero.
2. Old issue. RendererView adjusted layout of subframes for printing and set invalid
dimensions. Sometimes it caused missing iframe when printed.

Test: printing/iframe-print.html

* page/Frame.cpp:
(WebCore::Frame::setPrinting): Calls forceLayoutForPagination for root frames only.
(WebCore::Frame::resizePageRectsKeepingRatio): Added ASSERTs to catch division by zero.
* rendering/RenderView.cpp: Replaced printing() with shouldUsePrintingLayout() for most calls.
(WebCore::RenderView::computeLogicalHeight):
(WebCore::RenderView::computeLogicalWidth):
(WebCore::RenderView::layout):
(WebCore::RenderView::shouldUsePrintingLayout): Returns true only if printing enabled and it's a root frame.
(WebCore::RenderView::viewRect):
(WebCore::RenderView::viewHeight):
(WebCore::RenderView::viewWidth):
* rendering/RenderView.h:

LayoutTests: LayoutTest for iframe printing.
https://bugs.webkit.org/show_bug.cgi?id=85118

Patch by Vitaly Buka <vitalybuka@chromium.org> on 2012-05-22
Reviewed by Darin Adler, Eric Seidel.

* printing/iframe-print-expected.txt: Added.
* printing/iframe-print.html: Added.
* printing/resources/iframe-subframe-vertical-rl.html: Added.
* printing/resources/iframe-subframe.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118039 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] platform/chromium/.../visibility-simple-*-layer.html fails intermittently on Windows bots.

Unreviewed gardening.

* platform/chromium/test_expectations.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118040 268f45cc-cd09-0410-ab3c-d52691b4dbfc
.: == Rolled over to ChangeLog-2012-05-22 ==

Source/JavaScriptCore: == Rolled over to ChangeLog-2012-05-22 ==

Source/WebCore: == Rolled over to ChangeLog-2012-05-22 ==

Source/WebKit/chromium: == Rolled over to ChangeLog-2012-05-22 ==

Source/WebKit/gtk: == Rolled over to ChangeLog-2012-05-22 ==

Source/WebKit2: == Rolled over to ChangeLog-2012-05-22 ==

Tools: == Rolled over to ChangeLog-2012-05-22 ==

LayoutTests: == Rolled over to ChangeLog-2012-05-22 ==

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118041 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r117613): Dromaeo/jslib-style-prototype regressed by 20%
https://bugs.webkit.org/show_bug.cgi?id=87142

Reviewed by Alexis Menard.

Move CSSPropertyDisplay back into isValidKeywordPropertyAndValue.
Pass in the parser context so we can check whether we're grid or not.

No new tests. Covered by Dromaeo/jslib-style-prototype perf test.

* css/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue):
(WebCore::isKeywordPropertyID):
(WebCore::parseKeywordValue):
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseFont):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118044 268f45cc-cd09-0410-ab3c-d52691b4dbfc
echo-inspan.pl is missing a semicolon on line 14, freaks out Apache on multiple regression tests
https://bugs.webkit.org/show_bug.cgi?id=86023

Reviewed by Eric Seidel.

This typo was causing a syntax error, making us lose test coverage.

* http/tests/security/xssAuditor/open-iframe-src-expected.txt: Rebased result.
* http/tests/security/xssAuditor/open-script-src-expected.txt: Ditto.
* http/tests/security/xssAuditor/resources/echo-inspan.pl:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118047 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WTR needs an implementation of setAutomaticLinkDetectionEnabled
https://bugs.webkit.org/show_bug.cgi?id=87162

Add editing/inserting/typing-space-to-trigger-smart-link.html to the WK2 Skipped list.

* platform/wk2/Skipped:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Use the same animation begin time while updating compositing layers
https://bugs.webkit.org/show_bug.cgi?id=87080

Reviewed by Dean Jackson.

Tidied up some beginAnimationUpdate/endAnimationUpdate logic,
but further cleaning is required. We currently bracket some calls
to recaclcStyle() with begin/endAnimationUpdate, but not all.
We don't bracket layout, or compositing updates. This patch
adds bracketing around compositing updates, in order to be
able to add some assertions in a later patch that rely on
RenderLayer::currentTransform() giving consistent results,
since currentTransform() depends on the animation begin time.

Made AnimationController::beginAnimationUpdate() and
AnimationController::endAnimationUpdate() nestable by adding
a counter.

Added a stack-based class, AnimationUpdateBlock, which
calls begin/endAnimationUpdate.

Replaced calls to begin/endAnimationUpdate in Document::updateStyleIfNeeded()
and Document::styleResolverChanged() with AnimationUpdateBlock. Filed a bug
to cover other calls to recalcStyle which might need this (87159).

Removed a call to beginAnimationUpdate() in Document::implicitOpen(),
which was added in r42415. I believe that r57390 makes this unnecessary,
and was not able to reproduce the original bug after removing it. It
was the only unpaired beginAnimationUpdate call.

Made AnimationControllerPrivate::getAnimatedStyleForRenderer() not
use a new beginTime each time it was called, so its beginTime now
depends on some earlier beginAnimationUpdate.

Fixed CSSComputedStyleDeclaration::getPropertyCSSValue() to use
an AnimationUpdateBlock so that calls to computed style do
use the current time to compute an animating value (as before).

Not testable.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* dom/Document.cpp:
(WebCore::Document::updateStyleIfNeeded):
(WebCore::Document::implicitOpen):
(WebCore::Document::styleResolverChanged):
* page/animation/AnimationController.cpp:
(WebCore::AnimationControllerPrivate::getAnimatedStyleForRenderer):
(WebCore::AnimationController::AnimationController):
(WebCore::AnimationController::beginAnimationUpdate):
(WebCore::AnimationController::endAnimationUpdate):
* page/animation/AnimationController.h:
(AnimationController):
(WebCore):
(AnimationUpdateBlock):
(WebCore::AnimationUpdateBlock::AnimationUpdateBlock):
(WebCore::AnimationUpdateBlock::~AnimationUpdateBlock):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateCompositingLayers):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118052 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Add unit testing for WebTransformationMatrix::blend()
https://bugs.webkit.org/show_bug.cgi?id=87066

Reviewed by Adrienne Walker.

8 more unit tests added:
WebTransformationMatrixTest.verifyBlendForTranslation
WebTransformationMatrixTest.verifyBlendForScale
WebTransformationMatrixTest.verifyBlendForSkewX
WebTransformationMatrixTest.verifyBlendForSkewY
WebTransformationMatrixTest.verifyBlendForRotationAboutX
WebTransformationMatrixTest.verifyBlendForRotationAboutY
WebTransformationMatrixTest.verifyBlendForRotationAboutZ
WebTransformationMatrixTest.verifyBlendForCompositeTransform

* tests/WebTransformationMatrixTest.cpp:
(WebKit::TEST):
(WebKit):
(WebKit::printTransform):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118054 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WK2 Skipped list should be updated to reflect that
https://bugs.webkit.org/show_bug.cgi?id=57515 has been fixed.
https://bugs.webkit.org/show_bug.cgi?id=87170.

Reviewed by Brady Eidson.

Remove the tests from the Skipped list that now pass, separate out the test that crashes with
its own entry, and correctly cover the shadow dom tests.

* platform/wk2/Skipped:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118058 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] Expose setMediaPlaybackRequiresUserGesture via WebSettings
https://bugs.webkit.org/show_bug.cgi?id=87164

Reviewed by Eric Seidel.

This is used by the Chromium Android port.

* public/WebSettings.h:
* src/WebSettingsImpl.cpp:
(WebKit::WebSettingsImpl::setMediaPlaybackRequiresUserGesture):
(WebKit):
* src/WebSettingsImpl.h:
(WebSettingsImpl):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118059 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Crash when a plug-in view outlives its containing WebPage
https://bugs.webkit.org/show_bug.cgi?id=87163
<rdar://problem/10849258>

Reviewed by Dan Bernstein.

In rare cases, when a plug-in is kept alive for some reason it can outlive its WebPage. When that happens,
the PluginView destructor will try to access the (deleted) web page and we'll crash.

Fix this by making the WebPage destructor iterate over all the registered plug-ins and null out the m_webPage pointer.
Don't try to access the WebPage object if it's null.

Also, remove PLATFORM(MAC) ifdefs around the HashSet of known plug-in views as well as the member functions that access the set;
we want this to be cross platform now.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::PluginView):
(WebKit::PluginView::~PluginView):
(WebKit::PluginView::webPageDestroyed):
(WebKit):
* WebProcess/Plugins/PluginView.h:
(PluginView):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::~WebPage):
(WebKit::WebPage::scalePage):
(WebKit):
* WebProcess/WebPage/WebPage.h:
(WebPage):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118060 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[TextureMapper] [Cairo] Implement repaint counters
https://bugs.webkit.org/show_bug.cgi?id=87062

Reviewed by Gustavo Noronha Silva.

No new tests. This just adds a debugging feature that shouldn't
affect the normal drawing of a page.

* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperLayer::updateBackingStore): Now, if repaint counters are
enabled, increment the repaint count and call drawRepaintCounter.
(WebCore::TextureMapperLayer::drawRepaintCounter): Added.
* platform/graphics/texmap/TextureMapperLayer.h:
(TextureMapperLayer): Added declaration for drawRepaintCounter.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118061 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] Use overloaded printBegin() webkit API to support auto fit to page functionality.
https://bugs.webkit.org/show_bug.cgi?id=86684

Patch by Kausalya Madhusudhanan <kmadhusu@chromium.org> on 2012-05-22
Reviewed by Darin Fisher.

Source/WebKit/chromium:

* public/WebFrame.h:
(WebFrame):
* public/WebPlugin.h:
(WebPlugin):
* public/WebPrintParams.h:
(WebKit::WebPrintParams::WebPrintParams):
(WebPrintParams):
* src/WebFrameImpl.cpp:
(WebKit):
* src/WebFrameImpl.h:
(WebFrameImpl):
* src/WebPluginContainerImpl.cpp:
(WebKit::WebPluginContainerImpl::printBegin):

Tools:

* DumpRenderTree/chromium/LayoutTestController.cpp:
(LayoutTestController::numberOfPages):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::printPage):

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