DFG recompilation heuristics should be based on count, not rate
https://bugs.webkit.org/show_bug.cgi?id=90146

Reviewed by Oliver Hunt.
        
Rolling r121511 back in after fixing the DFG's interpretation of op_div
profiling, with Gavin's rubber stamp.

This removes a bunch of code that was previously trying to prevent spurious
reoptimizations if a large enough majority of executions of a code block did
not result in OSR exit. It turns out that this code was purely harmful. This
patch removes all of that logic and replaces it with a dead-simple
heuristic: if you exit more than N times (where N is an exponential function
of the number of times the code block has already been recompiled) then we
will recompile.
        
This appears to be a broad ~1% win on many benchmarks large and small.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::CodeBlock):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::couldTakeSpecialFastCase):
(CodeBlock):
(JSC::CodeBlock::osrExitCounter):
(JSC::CodeBlock::countOSRExit):
(JSC::CodeBlock::addressOfOSRExitCounter):
(JSC::CodeBlock::offsetOfOSRExitCounter):
(JSC::CodeBlock::adjustedExitCountThreshold):
(JSC::CodeBlock::exitCountThresholdForReoptimization):
(JSC::CodeBlock::exitCountThresholdForReoptimizationFromLoop):
(JSC::CodeBlock::shouldReoptimizeNow):
(JSC::CodeBlock::shouldReoptimizeFromLoopNow):
* bytecode/ExecutionCounter.cpp:
(JSC::ExecutionCounter::setThreshold):
* bytecode/ExecutionCounter.h:
(ExecutionCounter):
(JSC::ExecutionCounter::clippedThreshold):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::makeDivSafe):
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::compileBody):
* dfg/DFGOSRExit.cpp:
(JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
* dfg/DFGOSRExitCompiler.cpp:
(JSC::DFG::OSRExitCompiler::handleExitCounts):
* dfg/DFGOperations.cpp:
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):
* runtime/Options.h:
(JSC):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122206 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed.  Rolled DEPS.

* DEPS:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122207 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r122166): It made 170 tests crash on 32 bit platforms
https://bugs.webkit.org/show_bug.cgi?id=90852

Patch by Filip Pizlo <fpizlo@apple.com> on 2012-07-10
Reviewed by Zoltan Herczeg.

If we can't use the range filter, we should still make sure that the
address is remotely sane, otherwise the hashtables will assert.

* jit/JITStubRoutine.h:
(JSC::JITStubRoutine::passesFilter):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122208 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed gardening
Rebaseline.

* platform/chromium-linux/http/tests/media/video-buffered-range-contains-currentTime-expected.png:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122209 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed gardening after r122204.

* fast/viewport/viewport-legacy-xhtmlmp-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122210 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Re-enable __declspec(dl{import,export}) for MinGW when using EXPORT_MACROS
https://bugs.webkit.org/show_bug.cgi?id=90612

Patch by Jocelyn Turcotte <jocelyn.turcotte@nokia.com> on 2012-07-10
Reviewed by Csaba Osztrogonác.

MinGW was switched to use auto import/export of symbols on r44184.
From my understanding of the documentation, MinGW will not auto-export symbols
unless there are no explicit __declspec(dlexport) in the DLL already.

The issues that originally made us rely on the auto-import feature of MinGW
should now be resolved with the EXPORT_MACROS work. This patch re-enables them.

It also removes the GCC check for internal symbols hiding as the visibility should
already be hidden by default for both MSVC and GCC on Windows anyway.

* wtf/ExportMacros.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122211 268f45cc-cd09-0410-ab3c-d52691b4dbfc
RTL calendar picker for <input type=date> is too narrow and clipped
https://bugs.webkit.org/show_bug.cgi?id=90864

Reviewed by Kentaro Hara.

.:

* ManualTests/forms/calendar-picker.html:
- Add isRTL:true for the arabic setting
- Reset the iframe size when the setting is changed.

Source/WebCore:

Tests: ManualTests/forms/calendar-picker.html

* Resources/calendarPicker.js:
(fixWindowSize):
Checks the left edge of elemenets in RTL.
(layout): Add dir=ltr for the manual test, which re-uses the document.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122212 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] WebKit DRT and WTR fail to build due to undefined reference to WTF::MD5::*
https://bugs.webkit.org/show_bug.cgi?id=90868

Unreviewed EFL build fix.

Correct CMake configuration to have EFL's DRT and WebKitTestRunner link
WTF library. This is needed to resolve undefined reference to WTF::MD5::*.

Patch by Christophe Dumez <christophe.dumez@intel.com> on 2012-07-10

* DumpRenderTree/efl/CMakeLists.txt:
* WebKitTestRunner/PlatformEfl.cmake:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122213 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Unreviewed gardening. Skip a flakey test after r122168.
https://bugs.webkit.org/show_bug.cgi?id=90845.

Patch by Ádám Kallai <kadam@inf.u-szeged.hu> on 2012-07-10

* platform/qt/Skipped:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122214 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Don't destroy the decoded data of an image if WebKit is about to render the image.
https://bugs.webkit.org/show_bug.cgi?id=90721

Patch by Huang Dongsung <luxtella@company100.net> on 2012-07-10
Reviewed by Antti Koivisto.

When the cache capacity of the MemoryCache is exceeded, the decoded data of all
the CachedImages are destroyed. Even the images inside the viewport are
destroyed.  However, if the images need to be rendered again due to scoll events
or animation, they must be decoded again. As an extreme case, if there is an
animation with an image when MemoryCache is almost full, the image must be
decoded every frame. This slows down animation and needlessly consumes CPU
cycles.

Therefore, it is better to not destory the decoded data of an image if the image
is inside the viewport because there is high chance that the image needs to be
rendered again soon. This patch reduces the unnecessary repetition of image decoding
on low memory, and also relieves the memory fragmentation because it avoids reallocation
of image frames.

In addition, there is another positive side effect. Currently,
CachedImageClient::willRenderImage() is used only to determine if GIF animation needs
to be paused or not in CachedImage::shouldPauseAnimation(). This patch makes
GIF animation outside the viewort be paused.

This is also a prerequisite for parallel image decoders. Because parallel image
decoders decode an image asynchronously, clients cannot render the image at the time
when the request is made. Clients can draw the image later after receiving image
decoding complete notification. However, there is a problem because MemoryCache can
destroy the decoded data before clients actually render the image. So parallel image decoders
must prevent the decoded data from being destroyed if the image will be rendered
soon.

This patch may consume a little more memory, but furtunately the peak memory usage
is almost the same.

No new tests - no new testable functionality.

* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::likelyToBeUsedSoon):
(WebCore):
(WebCore::CachedImage::shouldPauseAnimation):
* loader/cache/CachedImage.h:
(CachedImage):
* loader/cache/CachedResource.h:
(CachedResource):
(WebCore::CachedResource::likelyToBeUsedSoon):
* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::pruneLiveResourcesToSize):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::willRenderImage):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122215 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: [Extensions API] simplify panel size check in extensions-panel.html
https://bugs.webkit.org/show_bug.cgi?id=90799

Reviewed by Vsevolod Vlasov.

- use window argument in Panel.onShown() to check panel window size;

* http/tests/inspector/resources/extension-panel.html:
* inspector/extensions/extensions-panel-expected.txt:
* inspector/extensions/extensions-panel.html:
* platform/mac/Skipped:
* platform/qt/Skipped:
* platform/wincairo/Skipped:

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