Function.bind itself is too slow
https://bugs.webkit.org/show_bug.cgi?id=131636

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:
Rather than forcing creation of an activation, we now store
bound function properties directly on the returned closure.
This is necessary to deal with code that creates many function
bindings, but does not call them very often.

This is a 60% speed up in the included js/regress test.

* builtins/BuiltinExecutables.cpp:
(JSC::BuiltinExecutables::createBuiltinExecutable):
* builtins/Function.prototype.js:
(bind.bindingFunction):
(bind.else.switch.case.1.bindingFunction.bindingFunction.bindingFunction.boundOversizedCallThunk):
(bind.else.switch.case.1.bindingFunction):
(bind.else.switch.case.2.bindingFunction.bindingFunction.bindingFunction.boundOversizedCallThunk):
(bind.else.switch.case.2.bindingFunction):
(bind.else.switch.case.3.bindingFunction.bindingFunction.bindingFunction.boundOversizedCallThunk):
(bind.else.switch.case.3.bindingFunction):
(bind.else.switch.bindingFunction):
(bind):
(bind.else.switch.case.1.bindingFunction.oversizedCall): Deleted.
(bind.else.switch.case.2.bindingFunction.oversizedCall): Deleted.
(bind.else.switch.case.3.bindingFunction.oversizedCall): Deleted.
* runtime/CommonIdentifiers.h:

LayoutTests:
New test, and fix bogus log in old one

* js/regress/function-bind-create-expected.html: Added.
* js/regress/function-bind-create.html: Added.
* js/regress/script-tests/function-bind-create.js: Added.
(test):
* js/regress/script-tests/function-bind.js:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167272 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS WK2] Hash table assertion closing a tab
https://bugs.webkit.org/show_bug.cgi?id=131640

Reviewed by Tim Horton.

Have RemoteLayerTreeContext keep track of all PlatformCALayerRemotes,
and clear their context pointer when it is being destroyed to avoid
calling into a deleted object later.

* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::~PlatformCALayerRemote):
(WebKit::PlatformCALayerRemote::addAnimationForKey):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:
(WebKit::PlatformCALayerRemote::clearContext):
* WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
* WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
(WebKit::RemoteLayerTreeContext::~RemoteLayerTreeContext):
(WebKit::RemoteLayerTreeContext::layerWasCreated):
(WebKit::RemoteLayerTreeContext::layerWillBeDestroyed):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167273 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS][WK2] Change the SPI used when starting the rotation animation
https://bugs.webkit.org/show_bug.cgi?id=131638

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-04-14
Reviewed by Tim Horton.

Having an update block where all the properties are changed is more convenient for Safari.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _beginAnimatedResizeWithUpdates:]):
(-[WKWebView _beginAnimatedResizeToSize:obscuredInsets:minimumLayoutSizeOverride:]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Cocoa] Add a WKWebProcessPlugInFormDelegate method corresponding to willSendSubmitEvent
https://bugs.webkit.org/show_bug.cgi?id=131639

Reviewed by Tim Horton.

* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFormDelegatePrivate.h: Declared
new delegate method.
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
(-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Added an override
of API::InjectedBundle::FormClient::willSendSubmitEvent which calls the new delegate
method.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Let the bundle form client know whether a change in a text field was initiated by user typing
https://bugs.webkit.org/show_bug.cgi?id=131643

Reviewed by Sam Weinig.

* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFormDelegatePrivate.h: Added
initiatedByUserTyping parameter to the delegate method.

* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
(-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Updated overload of
textDidChangeInTextField to take the initiatedByUserTyping parameter and pass it along to
the delegate.

* WebProcess/InjectedBundle/APIInjectedBundleFormClient.h:
(API::InjectedBundle::FormClient::textDidChangeInTextField): Added initiatedByUserTyping
parameter.

* WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
(WebKit::InjectedBundlePageFormClient::textDidChangeInTextField): Maintained the existing
behavior of not calling the C SPI client if the change was not initiated by user typing.
* WebProcess/InjectedBundle/InjectedBundlePageFormClient.h: Updated for added parameter.

* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::textDidChangeInTextField): Changed to call the bundle client
function unconditionally, but pass along whether the change was initiated by user typing.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167276 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Do more things under memory pressure on non-iOS platforms.
<https://webkit.org/b/131625>

Reviewed by Antti Koivisto.

Rename hasReceivedMemoryPressure() to isUnderMemoryPressure() and
make it use std::atomic<bool> instead of OSAtomic primitives.

Unmask most of the PLATFORM(IOS) blocks so all platforms can take
advantage of optimizations done while under pressure. Note that
isUnderMemoryPressure() will still always return false on platforms
other than iOS/WK1, but this will change soon.

* history/PageCache.cpp:
(WebCore::PageCache::canCache):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::commitProvisionalLoad):
* page/FrameView.cpp:
(WebCore::FrameView::willPaintContents):
(WebCore::FrameView::didPaintContents):
* platform/MemoryPressureHandler.cpp:
(WebCore::MemoryPressureHandler::MemoryPressureHandler):
* platform/MemoryPressureHandler.h:
(WebCore::MemoryPressureHandler::isUnderMemoryPressure):
* platform/cocoa/MemoryPressureHandlerCocoa.mm:
(WebCore::MemoryPressureHandler::setReceivedMemoryPressure):
(WebCore::MemoryPressureHandler::clearMemoryPressure):
(WebCore::MemoryPressureHandler::respondToMemoryPressureIfNeeded):
(WebCore::MemoryPressureHandler::hasReceivedMemoryPressure): Deleted.
* platform/graphics/FontCache.cpp:
(WebCore::FontCache::purgeInactiveFontDataIfNeeded):
* platform/ios/LegacyTileCache.mm:
(WebCore::LegacyTileCache::createTilesInActiveGrid):
* platform/ios/LegacyTileGrid.mm:
(WebCore::LegacyTileGrid::shouldUseMinimalTileCoverage):
* platform/ios/LegacyTileLayerPool.mm:
(WebCore::LegacyTileLayerPool::addLayer):
* platform/ios/TileControllerMemoryHandlerIOS.cpp:
(WebCore::TileControllerMemoryHandler::tileControllerGainedUnparentedTiles):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167277 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Assertion failure !node || node->isElementNode() in
WebCore::RenderBlock::inlineElementContinuation

https://bugs.webkit.org/show_bug.cgi?id=108829
<rdar://problem/13666405>

I can't reproduce this assertion failure, but there seems to be an
invalid assumption in RenderBlock::inlineElementContinuation() that
anything with the "isInline()" bit set is a RenderInline.

No new test because the test case in the bug does not repro for me.

Reviewed by Brent Fulgham.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::inlineElementContinuation):
Dave Hyatt says that this function should only return RenderInline
objects (not non-RenderInline inline objects), so update the checks
from isInline() to isRenderInline() before casting with
toRenderInline().

* rendering/RenderInline.cpp:
(WebCore::RenderInline::inlineElementContinuation):
Ditto.

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

* page/FrameView.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167279 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r166027) Menu is shown and immediately hidden after doubletap gesture.
https://bugs.webkit.org/show_bug.cgi?id=131646
<rdar://problem/16614374>

Reviewed by Benjamin Poulain.

This is a problem with every gesture that changes the selection
We don't need to delay updating the selection if the selection is
being changed with a gesture.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]):
(-[WKContentView changeSelectionWithGestureAt:withGesture:withState:]):
(-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]):
(-[WKContentView changeSelectionWithTouchesFrom:to:withGesture:withState:]):
(-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]):
(-[WKContentView _selectionChanged]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167280 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSSExclusions] Remove FIXME referencing closed bug
https://bugs.webkit.org/show_bug.cgi?id=131645

Reviewed by Dean Jackson.

This is silly, but the comment is really confusing as it's entirely
wrong now.

No new tests, no behavior change.

* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeRequiresRepaint):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167281 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[MSE][Mac] video.currentTime is sometimes negative.
https://bugs.webkit.org/show_bug.cgi?id=131644

Reviewed by Eric Carlson.

AVSampleBufferRenderSynchronizer will occasionally return slightly negative values
when beginning playback. Clamp the return value to 0.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::currentTimeDouble):


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