Constants folded by DFG::ByteCodeParser should not be dead.
https://bugs.webkit.org/show_bug.cgi?id=130576

Reviewed by Mark Hahnenberg.
        
This fixes bugs in the ByteCodeParser's constant folder by removing that constant folder. This
reduces the number of folders in JSC from fourish to just threeish (parser, DFG AI, and one
or more folders in LLVM). Doing so has no performance impact since the other constant folders
already subsume this one.
        
Also added a test case for the specific bug that instigated this.

* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::getJSConstantForValue):
(JSC::DFG::ByteCodeParser::getJSConstant):
(JSC::DFG::ByteCodeParser::inferredConstant):
(JSC::DFG::ByteCodeParser::handleIntrinsic):
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGNode.h:
* dfg/DFGNodeFlags.h:
* tests/stress/constand-folding-osr-exit.js: Added.
(foo):
(test):
(.var):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166095 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Webkit2] Add APIDownloadClient for download support.
https://bugs.webkit.org/show_bug.cgi?id=130484

Add API::DownloadClient to WebContext and get rid of WebDownloadClient.

Patch by Yongjun Zhang <yongjun_zhang@apple.com> on 2014-03-21
Reviewed by Anders Carlsson.

* UIProcess/API/APIDownloadClient.h: Added.
(API::DownloadClient::~DownloadClient):
(API::DownloadClient::didStart):
(API::DownloadClient::didReceiveAuthenticationChallenge):
(API::DownloadClient::didReceiveResponse):
(API::DownloadClient::didReceiveData):
(API::DownloadClient::shouldDecodeSourceDataOfMIMEType):
(API::DownloadClient::decideDestinationWithSuggestedFilename):
(API::DownloadClient::didCreateDestination):
(API::DownloadClient::didFinish):
(API::DownloadClient::didFail):
(API::DownloadClient::didCancel):
(API::DownloadClient::processDidCrash):
* UIProcess/API/C/WKContext.cpp:
(WKContextSetDownloadClient): Move the original WebDownloadClient methods to a local class
    DownloadClient and set up the downloadClient for WebContext.
* UIProcess/Downloads/DownloadProxy.cpp:
* UIProcess/WebContext.cpp:
(WebKit::WebContext::setDownloadClient):
* UIProcess/WebContext.h:
(WebKit::WebContext::downloadClient):
* UIProcess/WebDownloadClient.cpp: Removed.
* UIProcess/WebDownloadClient.h: Removed.
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166096 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Merge VTTScanner Code from Blink
https://bugs.webkit.org/show_bug.cgi?id=130616

Reviewed by Eric Carlson.

Merged from Blink (patch by fs@opera.com):
https://chromium.googlesource.com/chromium/blink/+/f1ceb058d574a1174b524c57f67350510a942071
http://crbug.com/75273002
https://chromium.googlesource.com/chromium/blink/+/3e2c67969486e86347b328c72c67cacabfe6f4a1
http://crbug.com/134173002
https://chromium.googlesource.com/chromium/blink/+/5962b7bbb001838f3fc7f24817637528b86bfd9b
http://crbug.com/134153002
https://chromium.googlesource.com/chromium/blink/+/6c81f51438013edca920a19fc6a31026fc562af2
http://crbug.com/137033002
https://chromium.googlesource.com/chromium/blink/+/fa286dca17a291da3ae8be80111e2264de6d5cfd
http://crbug.com/140503004
https://chromium.googlesource.com/chromium/blink/+/8f33b63aabcce7dd21dd15288d45c4eb37c02001
http://crbug.com/139343006
https://chromium.googlesource.com/chromium/blink/+/1872b54b908fac525f1ad9d6f15174b11e27c8af
http://crbug.com/143983002
https://chromium.googlesource.com/chromium/blink/+/e6494b3359e2077bd8772d86ab1fb709acf4c398
http://crbug.com/144893002
 
* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* html/track/ParsingUtilities.h: Added.
(skipExactly):
(skipUntil):
(skipWhile):
* html/track/VTTCue.cpp:
(WebCore::VTTCue::markFutureAndPastNodes):
(WebCore::VTTCue::settingName):
(WebCore::scanPercentage):
(WebCore::VTTCue::setCueSettings):
* html/track/VTTCue.h:
* html/track/VTTRegion.cpp:
(WebCore::VTTRegion::setRegionSettings):
(WebCore::VTTRegion::scanSettingName):
(WebCore::parsedEntireRun):
(WebCore::VTTRegion::parseSettingValue):
* html/track/VTTRegion.h:
* html/track/VTTScanner.cpp: Added.
(WebCore::VTTScanner::VTTScanner):
(WebCore::VTTScanner::scan):
(WebCore::VTTScanner::scanRun):
(WebCore::VTTScanner::skipRun):
(WebCore::VTTScanner::extractString):
(WebCore::VTTScanner::restOfInputAsString):
(WebCore::VTTScanner::scanDigits):
(WebCore::VTTScanner::scanFloat):
* html/track/VTTScanner.h: Added.
(WebCore::VTTScanner::Run::Run):
(WebCore::VTTScanner::Run::start):
(WebCore::VTTScanner::Run::end):
(WebCore::VTTScanner::Run::isEmpty):
(WebCore::VTTScanner::isAt):
(WebCore::VTTScanner::isAtEnd):
(WebCore::VTTScanner::match):
(WebCore::VTTScanner::position):
(WebCore::VTTScanner::end):
(WebCore::VTTScanner::LCharPredicateAdapter):
(WebCore::VTTScanner::Run::length):
(WebCore::VTTScanner::scan):
(WebCore::VTTScanner::skipWhile):
(WebCore::VTTScanner::skipUntil):
(WebCore::VTTScanner::collectWhile):
(WebCore::VTTScanner::collectUntil):
(WebCore::VTTScanner::seekTo):
(WebCore::VTTScanner::currentChar):
(WebCore::VTTScanner::advance):
* html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::parseFloatPercentageValue):
(WebCore::WebVTTParser::parseFloatPercentageValuePair):
(WebCore::WebVTTParser::collectTimingsAndSettings):
(WebCore::WebVTTParser::collectTimeStamp):
(WebCore::WebVTTTreeBuilder::constructTreeFromToken):
* html/track/WebVTTParser.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Always retrieve the screen scale factor from WKSI
<rdar://problem/16329679>

Reviewed by Sam Weinig.

* Misc/WebUIKitSupport.mm:
(WebKitSetIsClassic): Empty this out; it's no longer needed, but will still be called.

* UIProcess/ios/WKContentView.mm:
(-[WKContentView initWithFrame:context:WebKit::configuration:WebKit::webView:]):
(-[WKContentView _updateForScreen:]):
Use WKGetScreenScaleFactor/WKGetScaleFactorForScreen.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166098 268f45cc-cd09-0410-ab3c-d52691b4dbfc
6% SunSpider commandline regression due to r165940
https://bugs.webkit.org/show_bug.cgi?id=130617

Reviewed by Michael Saboff.

In GCActivityCallback::didAllocate, lastGCLength() returns 0 if we've never collected 
before. Some of the benchmarks are never running a single EdenCollection, which causes 
them to repeatedly call scheduleTimer with a newDelay of 0. This defeats our timer 
slop heuristic, causing us to invoke CFRunLoopTimerSetNextFireDate a couple orders of 
magnitude more than we normally would.

The fix is to seed the last GC lengths in Heap with a non-zero length so that our heuristic works.

* heap/Heap.cpp:
(JSC::Heap::Heap):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166099 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Subpixel rendering: Make <img> positioning subpixel aware.
https://bugs.webkit.org/show_bug.cgi?id=130596

Reviewed by Simon Fraser.

Change <img> positioning from integral to device pixel. It enables us
to paint hairline borders around <img> properly.
This patch changes the behavior of broken image representation from constant 1 CSS px border
to a dynamic 1 device px.

Source/WebCore:

Test: fast/images/hidpi-image-position-on-device-pixels.html

* WebCore.exp.in:
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawImage):
* platform/graphics/GraphicsContext.h:
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::drawRect):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawRect):
* platform/graphics/wince/GraphicsContextWinCE.cpp:
(WebCore::GraphicsContext::drawRect):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::paintReplaced):
(WebCore::RenderImage::paintIntoRect):
* rendering/RenderImage.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::drawPlatformResizerImage):

LayoutTests:

* fast/images/hidpi-image-position-on-device-pixels-expected.html: Added.
* fast/images/hidpi-image-position-on-device-pixels.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166100 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS] remote command callbacks must happen on the WebThread
https://bugs.webkit.org/show_bug.cgi?id=130618

Reviewed by Jer Noble.

* platform/ios/RemoteCommandListenerIOS.h:
(WebCore::RemoteCommandListenerIOS::createWeakPtr):
* platform/ios/RemoteCommandListenerIOS.mm:
(WebCore::RemoteCommandListenerIOS::RemoteCommandListenerIOS): Dispatch commands to the
    main thread before making listener callbacks.


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