ImageBufferBackingStoreCache should use DeferrableOneShotTimer
https://bugs.webkit.org/show_bug.cgi?id=126155

Reviewed by Anders Carlsson.

Since ImageBufferBackingStoreCache's purge timer is pushed out every time
a backing store is deallocated, we can easily waste a lot of time rescheduling
the timer. Since it's a cache purge timer and doesn't need that kind of precision,
adopt DeferrableOneShotTimer, which is much more performant when deferred frequently.

* platform/graphics/cg/ImageBufferBackingStoreCache.cpp:
(WebCore::ImageBufferBackingStoreCache::ImageBufferBackingStoreCache):
(WebCore::ImageBufferBackingStoreCache::timerFired):
(WebCore::ImageBufferBackingStoreCache::schedulePurgeTimer):
* platform/graphics/cg/ImageBufferBackingStoreCache.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add support for StoreBarrier and friends to the FTL
https://bugs.webkit.org/show_bug.cgi?id=126040

Reviewed by Filip Pizlo.

* ftl/FTLAbstractHeapRepository.h:
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLIntrinsicRepository.h:
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileStoreBarrier):
(JSC::FTL::LowerDFGToLLVM::compileConditionalStoreBarrier):
(JSC::FTL::LowerDFGToLLVM::compileStoreBarrierWithNullCheck):
(JSC::FTL::LowerDFGToLLVM::loadMarkByte):
(JSC::FTL::LowerDFGToLLVM::emitStoreBarrier):
* heap/Heap.cpp:
(JSC::Heap::Heap):
* heap/Heap.h:
(JSC::Heap::writeBarrierBuffer):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161240 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Update Promises to the https://github.com/domenic/promises-unwrapping spec
https://bugs.webkit.org/show_bug.cgi?id=120954

Reviewed by Filip Pizlo.

Source/JavaScriptCore: 

Update Promises to the revised spec. Notable changes:
- JSPromiseResolver is gone.
- TaskContext has been renamed Microtask and now has a virtual run() function.
- Instead of using custom InternalFunction subclasses, JSFunctions are used
  with PrivateName properties for internal slots.

* CMakeLists.txt:
* DerivedSources.make:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
* interpreter/CallFrame.h:
(JSC::ExecState::promiseConstructorTable):
* runtime/CommonIdentifiers.cpp:
(JSC::CommonIdentifiers::CommonIdentifiers):
* runtime/CommonIdentifiers.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::reset):
(JSC::JSGlobalObject::visitChildren):
(JSC::JSGlobalObject::queueMicrotask):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::promiseConstructor):
(JSC::JSGlobalObject::promisePrototype):
(JSC::JSGlobalObject::promiseStructure):
* runtime/JSPromise.cpp:
(JSC::JSPromise::create):
(JSC::JSPromise::JSPromise):
(JSC::JSPromise::finishCreation):
(JSC::JSPromise::visitChildren):
(JSC::JSPromise::reject):
(JSC::JSPromise::resolve):
(JSC::JSPromise::appendResolveReaction):
(JSC::JSPromise::appendRejectReaction):
(JSC::triggerPromiseReactions):
* runtime/JSPromise.h:
(JSC::JSPromise::status):
(JSC::JSPromise::result):
(JSC::JSPromise::constructor):
* runtime/JSPromiseCallback.cpp: Removed.
* runtime/JSPromiseCallback.h: Removed.
* runtime/JSPromiseConstructor.cpp:
(JSC::constructPromise):
(JSC::JSPromiseConstructor::getCallData):
(JSC::JSPromiseConstructorFuncCast):
(JSC::JSPromiseConstructorFuncResolve):
(JSC::JSPromiseConstructorFuncReject):
* runtime/JSPromiseConstructor.h:
* runtime/JSPromiseDeferred.cpp: Added.
(JSC::JSPromiseDeferred::create):
(JSC::JSPromiseDeferred::JSPromiseDeferred):
(JSC::JSPromiseDeferred::finishCreation):
(JSC::JSPromiseDeferred::visitChildren):
(JSC::createJSPromiseDeferredFromConstructor):
(JSC::updateDeferredFromPotentialThenable):
* runtime/JSPromiseDeferred.h: Added.
(JSC::JSPromiseDeferred::createStructure):
(JSC::JSPromiseDeferred::promise):
(JSC::JSPromiseDeferred::resolve):
(JSC::JSPromiseDeferred::reject):
* runtime/JSPromiseFunctions.cpp: Added.
(JSC::deferredConstructionFunction):
(JSC::createDeferredConstructionFunction):
(JSC::identifyFunction):
(JSC::createIdentifyFunction):
(JSC::promiseAllCountdownFunction):
(JSC::createPromiseAllCountdownFunction):
(JSC::promiseResolutionHandlerFunction):
(JSC::createPromiseResolutionHandlerFunction):
(JSC::rejectPromiseFunction):
(JSC::createRejectPromiseFunction):
(JSC::resolvePromiseFunction):
(JSC::createResolvePromiseFunction):
(JSC::throwerFunction):
(JSC::createThrowerFunction):
* runtime/JSPromiseFunctions.h: Added.
* runtime/JSPromisePrototype.cpp:
(JSC::JSPromisePrototypeFuncThen):
(JSC::JSPromisePrototypeFuncCatch):
* runtime/JSPromiseReaction.cpp: Added.
(JSC::createExecutePromiseReactionMicroTask):
(JSC::ExecutePromiseReactionMicroTask::run):
(JSC::JSPromiseReaction::create):
(JSC::JSPromiseReaction::JSPromiseReaction):
(JSC::JSPromiseReaction::finishCreation):
(JSC::JSPromiseReaction::visitChildren):
* runtime/JSPromiseReaction.h: Added.
(JSC::JSPromiseReaction::createStructure):
(JSC::JSPromiseReaction::deferred):
(JSC::JSPromiseReaction::handler):
* runtime/JSPromiseResolver.cpp: Removed.
* runtime/JSPromiseResolver.h: Removed.
* runtime/JSPromiseResolverConstructor.cpp: Removed.
* runtime/JSPromiseResolverConstructor.h: Removed.
* runtime/JSPromiseResolverPrototype.cpp: Removed.
* runtime/JSPromiseResolverPrototype.h: Removed.
* runtime/Microtask.h: Added.
* runtime/VM.cpp:
(JSC::VM::VM):
(JSC::VM::~VM):
* runtime/VM.h:

Source/WebCore: 

* ForwardingHeaders/runtime/JSPromiseDeferred.h: Added.
* ForwardingHeaders/runtime/JSPromiseResolver.h: Removed.
* bindings/js/JSDOMGlobalObjectTask.cpp:
(WebCore::JSGlobalObjectTask::JSGlobalObjectTask):
* bindings/js/JSDOMGlobalObjectTask.h:
* bindings/js/JSDOMPromise.cpp:
(WebCore::DeferredWrapper::DeferredWrapper):
(WebCore::DeferredWrapper::promise):
(WebCore::DeferredWrapper::resolve):
(WebCore::DeferredWrapper::reject):
* bindings/js/JSDOMPromise.h:
(WebCore::DeferredWrapper::resolve):
(WebCore::DeferredWrapper::reject):
(WebCore::DeferredWrapper::resolve<String>):
(WebCore::DeferredWrapper::resolve<bool>):
(WebCore::char>>):
(WebCore::DeferredWrapper::reject<String>):
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::queueTaskToEventLoop):
* bindings/js/JSDOMWindowBase.h:
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::JSSubtleCrypto::encrypt):
(WebCore::JSSubtleCrypto::decrypt):
(WebCore::JSSubtleCrypto::sign):
(WebCore::JSSubtleCrypto::verify):
(WebCore::JSSubtleCrypto::digest):
(WebCore::JSSubtleCrypto::generateKey):
(WebCore::JSSubtleCrypto::importKey):
(WebCore::JSSubtleCrypto::exportKey):
(WebCore::JSSubtleCrypto::wrapKey):
(WebCore::JSSubtleCrypto::unwrapKey):
* bindings/js/JSWorkerGlobalScopeBase.cpp:
(WebCore::JSWorkerGlobalScopeBase::queueTaskToEventLoop):
* bindings/js/JSWorkerGlobalScopeBase.h:

LayoutTests: 

* crypto/subtle/argument-conversion.html:
* crypto/subtle/resources/common.js:
* crypto/subtle/sha-1.html:
* crypto/subtle/sha-224.html:
* crypto/subtle/sha-256.html:
* crypto/subtle/sha-384.html:
* crypto/subtle/sha-512.html:
* js/dom/Promise-already-fulfilled-expected.txt: Removed.
* js/dom/Promise-already-fulfilled.html: Removed.
* js/dom/Promise-already-rejected.html:
* js/dom/Promise-already-resolved.html:
* js/dom/Promise-catch-expected.txt:
* js/dom/Promise-catch-in-workers-expected.txt:
* js/dom/Promise-catch.html:
* js/dom/Promise-chain.html:
* js/dom/Promise-exception-expected.txt:
* js/dom/Promise-exception.html:
* js/dom/Promise-expected.txt:
* js/dom/Promise-fulfill-expected.txt: Removed.
* js/dom/Promise-fulfill-in-workers-expected.txt: Removed.
* js/dom/Promise-fulfill-in-workers.html: Removed.
* js/dom/Promise-fulfill.html: Removed.
* js/dom/Promise-init-callback-receiver-expected.txt: Added.
* js/dom/Promise-init-callback-receiver.html: Added.
* js/dom/Promise-init-expected.txt:
* js/dom/Promise-init-in-workers-expected.txt:
* js/dom/Promise-init.html:
* js/dom/Promise-onFulfilled-deep-expected.txt: Added.
* js/dom/Promise-onFulfilled-deep.html: Added.
* js/dom/Promise-onRejected-deep-expected.txt: Added.
* js/dom/Promise-onRejected-deep.html: Added.
* js/dom/Promise-reject.html:
* js/dom/Promise-resolve-chain.html:
* js/dom/Promise-resolve-expected.txt:
* js/dom/Promise-resolve-in-workers-expected.txt:
* js/dom/Promise-resolve-state-expected.txt: Added.
* js/dom/Promise-resolve-state-in-workers-expected.txt: Added.
* js/dom/Promise-resolve-state-in-workers.html: Added.
* js/dom/Promise-resolve-state.html: Added.
* js/dom/Promise-resolve-with-itself-expected.txt: Added.
* js/dom/Promise-resolve-with-itself.html: Added.
* js/dom/Promise-resolve-with-then-exception.html:
* js/dom/Promise-resolve-with-then-fulfill-expected.txt:
* js/dom/Promise-resolve-with-then-fulfill.html:
* js/dom/Promise-resolve-with-then-reject-expected.txt:
* js/dom/Promise-resolve-with-then-reject.html:
* js/dom/Promise-resolve.html:
* js/dom/Promise-simple-expected.txt:
* js/dom/Promise-simple-fulfill-expected.txt: Removed.
* js/dom/Promise-simple-fulfill-inside-callback-expected.txt: Removed.
* js/dom/Promise-simple-fulfill-inside-callback.html: Removed.
* js/dom/Promise-simple-fulfill.html: Removed.
* js/dom/Promise-simple-in-workers-expected.txt:
* js/dom/Promise-simple-resolve-expected.txt: Added.
* js/dom/Promise-simple-resolve.html: Added.
* js/dom/Promise-simple.html:
* js/dom/Promise-static-all-expected.txt: Added.
* js/dom/Promise-static-all.html: Added.
* js/dom/Promise-static-cast-expected.txt: Added.
* js/dom/Promise-static-cast.html: Added.
* js/dom/Promise-static-fulfill-expected.txt: Removed.
* js/dom/Promise-static-fulfill.html: Removed.
* js/dom/Promise-static-race-expected.txt: Added.
* js/dom/Promise-static-race.html: Added.
* js/dom/Promise-static-resolve.html:
* js/dom/Promise-then-callback-receiver-expected.txt: Added.
* js/dom/Promise-then-callback-receiver.html: Added.
* js/dom/Promise-then-expected.txt:
* js/dom/Promise-then-in-workers-expected.txt:
* js/dom/Promise-then-without-callbacks.html:
* js/dom/Promise-then.html:
* js/dom/Promise-types-expected.txt:
* js/dom/Promise-types.html:
* js/dom/Promise.html:
* js/resources/Promise-catch-in-workers.js:
* js/resources/Promise-fulfill-in-workers.js: Removed.
* js/resources/Promise-init-in-workers.js:
* js/resources/Promise-reject-in-workers.js:
* js/resources/Promise-resolve-in-workers.js:
* js/resources/Promise-resolve-state-in-workers.js: Added.
* js/resources/Promise-simple-in-workers.js:
* js/resources/Promise-then-in-workers.js:
* js/resources/Promise-then-without-callbacks-in-workers.js:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161241 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WebGL] Correct symbol lookup logic to handle 1-element arrays
https://bugs.webkit.org/show_bug.cgi?id=126411
<rdar://problem/15394564>

Reviewed by Dean Jackson.

* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::getUniformLocation): Revise code to handle the case of single-element
arrays.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161242 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] fixing ycm_extra_conf.py file
https://bugs.webkit.org/show_bug.cgi?id=126371

It's an attempt to fix three problems with the current ycm_extra_conf file.
The current implementation assumes that it's a symlink, which is not true.
Usually python creates a pyc file, and this is what you get in __file__.
the .pyc is not a symlink, and the current implementation doesn't work
if that's the case.

It also assumes that the user is in the root folder.
If the user is in WebkitBuild/Debug and open a file as ../../Source/* it won't work.

Last but not least, "elif flag in FLAGS_PRECEDING_PATHS" emits an
exception since "flag" doesn't exists.

All those things were fixed.

Patch by Danilo Cesar Lemes de Paula <danilo.cesar@collabora.co.uk> on 2014-01-02
Reviewed by Martin Robinson.

* gtk/ycm_extra_conf.py:
(transform_relative_paths_to_absolute_paths):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161243 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Crash in WebCore::translateIntersectionPointsToSkipInkBoundaries
https://bugs.webkit.org/show_bug.cgi?id=126252

Reviewed by Alexey Proskuryakov.

Source/WebCore:

lastIntermediate was a iterator pointing into a Vector, which was being re-used
even while appending to the Vector. If any of the append operators triggered
a realloc, the iterator would point to the old free'ed memory.

Test: fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-crash-many-gaps.html

* rendering/InlineTextBox.cpp:
(WebCore::translateIntersectionPointsToSkipInkBoundaries):

LayoutTests:

This test causes intermediateTuples, a Vector of tuples of floats, to have enough
entries to cause a realloc. In my tests, the realloc seems to always allocate the
next area of memory (without unmapping any old pages), so this test only crashes
if guardMalloc is used.

* fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-crash-many-gaps-expected.txt: Added.
* fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-crash-many-gaps.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161244 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed EFL gardening. Rebaselining after r161140.

* platform/efl/fast/table/dynamic-caption-add-before-child-expected.png:
* platform/efl/fast/table/dynamic-caption-add-before-child-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161245 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Propagate WindowServer modifications state to WebProcess
https://bugs.webkit.org/show_bug.cgi?id=126356

Reviewed by Sam Weinig.

This will be necessary to move control of process suppression to the WebProcess.
IsVisuallyIdle implies the process has stopped painting, or painted rects are
occluded and not actually being composited. State is provided on a per
WindowServer connection basis, and as such may produce (safe) false positives.

* Shared/ViewState.h:
    - added IsVisuallyIdle.
* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::isVisuallyIdle):
    - added, on mac checks WindowServerConnection.
* UIProcess/PageClient.h:
(WebKit::PageClient::isVisuallyIdle):
    - base implementation purely based on isViewVisible.
* UIProcess/WebContext.cpp:
(WebKit::WebContext::windowServerConnectionStateChanged):
    - broadcast the state change.
* UIProcess/WebContext.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateViewState):
(WebKit::WebPageProxy::viewStateDidChange):
    - propagate IsVisuallyIdle.
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::windowServerConnectionStateChanged):
    - broadcast the state change.
* UIProcess/WebProcessProxy.h:
    - add windowServerConnectionStateChanged.
* UIProcess/mac/WebContextMac.mm:
(WebKit::WebContext::updateProcessSuppressionStateOfGlobalChildProcesses):
    - moved from static in fle to static member of class.
(WebKit::WebContext::platformInitialize):
    - no need to enableOcclusionNotifications.
(WebKit::WebContext::canEnableProcessSuppressionForNetworkProcess):
(WebKit::WebContext::canEnableProcessSuppressionForWebProcess):
(WebKit::WebContext::canEnableProcessSuppressionForGlobalChildProcesses):
    - changed to call WindowServerConnection.
(WebKit::WebContext::processSuppressionEnabledChanged):
    - don't remove/reregister occlusion notifications.
* UIProcess/mac/WindowServerConnection.h: Added.
(WebKit::WindowServerConnection::applicationIsOccluded):
(WebKit::WindowServerConnection::applicationWindowModificationsHaveStopped):
    - accessors.
* UIProcess/mac/WindowServerConnection.mm: Added.
(WebKit::WindowServerConnection::applicationBecameOccluded):
(WebKit::WindowServerConnection::applicationWindowModificationsStopped):
(WebKit::WindowServerConnection::applicationBecameVisible):
(WebKit::WindowServerConnection::applicationWindowModificationsStarted):
    - handle notifications from the WindowServer.
(WebKit::WindowServerConnection::windowServerConnectionStateChanged):
    - broadcast the state change.
(WebKit::WindowServerConnection::shared):
    - accessor for singleton object.
(WebKit::WindowServerConnection::WindowServerConnection):
    - constructor inizializes fields & register notification handlers.
* WebKit2.xcodeproj/project.pbxproj:
    - added new files.
* config.h:
    - added HAVE_WINDOW_SERVER_OCCLUSION_NOTIFICATIONS.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161246 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WebGL] Correct symbol lookup logic to handle 1-element arrays
https://bugs.webkit.org/show_bug.cgi?id=126411
<rdar://problem/15394564>

Reviewed by Dean Jackson.

Source/WebCore: 

Tested by revisions to webgl/1.0.2/conformance/glsl/misc/shader-with-array-of-structs-containing-arrays.html

* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::getUniformLocation): Revise to
handle access to zeroeth element of the array.

LayoutTests: 

* webgl/1.0.2/resources/webgl_test_files/conformance/glsl/misc/shader-with-array-of-structs-containing-arrays.html: Add test for accessing the
single-element array.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161247 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WebGL] Correct symbol lookup logic to handle 1-element arrays
https://bugs.webkit.org/show_bug.cgi?id=126411
<rdar://problem/15394564>

Patch by Brent Fulgham <bfulgham@apple.com> on 2014-01-02
Reviewed by Dean Jackson.

* webgl/1.0.2/resources/webgl_test_files/conformance/glsl/misc/shader-with-array-of-structs-containing-arrays.html: Add test for accessing the
single-element array.

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