Position grid items by row/column index
https://bugs.webkit.org/show_bug.cgi?id=91293

Reviewed by Ojan Vafai.

Source/WebCore:

Do some initial grid positioning. Only handle the simple case where tracks are
fixed values and don't properly size the grid items. This gives us something to
work with and starts implementing the "Grid Track Sizing Algorithm":
http://dev.w3.org/csswg/css3-grid-layout/#grid-track-sizing-algorithm0

Test: fast/css-grid-layout/place-cell-by-index.html

* rendering/RenderGrid.cpp:
(RenderGrid::GridTrack): Data structure for holding the track size. UsedBreadth matches the terminology
used in the spec.
(WebCore::RenderGrid::layoutBlock): Pull in some boiler plate code and put the
grid specific code in layoutGridItems.
(WebCore::RenderGrid::computedUsedBreadthOfGridTracks): Implement part of the grid track sizing algorithm.
(WebCore::RenderGrid::layoutGridItems): Compute the size of grid tracks, layout and position children.
(WebCore::RenderGrid::findChildLogicalPosition): Map track sizes to the actual position of the child.
* rendering/RenderGrid.h:
* rendering/style/RenderStyle.h: Just return a copy of Length rather than a reference to Length. This seems
more consistent with other getters that return a Length.

LayoutTests:

Add a test for grid layout in each writing mode direction.  The height in vertical writing mode is incorrect for now.

* fast/css-grid-layout/containing-block-grids-expected.html: Scope <p> around text only.
* fast/css-grid-layout/containing-block-grids.html: Fix missing closing </div>.
* fast/css-grid-layout/place-cell-by-index-expected.txt: Added.
* fast/css-grid-layout/place-cell-by-index.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122747 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Cleanup a bunch of invalid BUG* lines. Rebaseline tests that were straightfoward
rebaselines and update the expectations to match what's actually happening on the bots.

* platform/chromium-linux/fast/repaint/repaint-across-writing-mode-boundary-expected.png:
* platform/chromium-linux/http/tests/misc/slow-loading-image-in-pattern-expected.png:
* platform/chromium-mac-snowleopard/fast/backgrounds/solid-color-context-restore-expected.png: Added.
* platform/chromium-mac-snowleopard/fast/reflections/inline-crash-expected.png: Added.
* platform/chromium-mac-snowleopard/http/tests/misc/slow-loading-image-in-pattern-expected.png: Added.
* platform/chromium-mac/fast/backgrounds/solid-color-context-restore-expected.png: Added.
* platform/chromium-mac/fast/reflections/inline-crash-expected.png: Added.
* platform/chromium-mac/http/tests/misc/slow-loading-image-in-pattern-expected.png: Added.
* platform/chromium-mac/transforms/2d/zoom-menulist-expected.png: Added.
* platform/chromium-win/http/tests/misc/slow-loading-image-in-pattern-expected.png:
* platform/chromium/TestExpectations:
* platform/gtk/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122748 268f45cc-cd09-0410-ab3c-d52691b4dbfc
test-webkitpy: use message pools
https://bugs.webkit.org/show_bug.cgi?id=91292

Reviewed by Ojan Vafai.

Restructure the test-running code to be message-driven and
use a MessagePool; note that this does not yet actually run the
tests in parallel.

Also clean up the unit tests so that the fake loader is passed
to the _Worker properly, and reduce a lot of the cut&pasted code
in the tests.

No functional changes; covered by existing tests.

* Scripts/webkitpy/test/printer.py:
(Printer.print_started_test):
(Printer.print_finished_test):
* Scripts/webkitpy/test/runner.py:
(Runner.__init__):
(Runner.run):
(Runner.handle):
(_Worker):
(_Worker.__init__):
(_Worker.handle):
* Scripts/webkitpy/test/runner_unittest.py:
(RunnerTest.assert_run):
(RunnerTest.test_regular):
(RunnerTest.test_verbose):
(RunnerTest.test_timing):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122749 268f45cc-cd09-0410-ab3c-d52691b4dbfc
test-webkitpy: run tests in parallel
https://bugs.webkit.org/show_bug.cgi?id=91294

Reviewed by Ojan Vafai.

This change adds support for running tests in parallel. This is
not yet on by default, since the logging isn't very pretty w/
parallel tests.

Also, there are some (multiprocessing-related) tests that can't be
run in parallel and so we skip them in that situation; I need to
come up with a mechanism for dealing with this, since you
apparently can't use multiprocessing as both a parent and a
child process.

* Scripts/webkitpy/test/finder.py:
(Finder.find_names):
(Finder._default_names):
* Scripts/webkitpy/test/main.py:
(Tester._parse_args):
(Tester.run):
* Scripts/webkitpy/test/main_unittest.py:
(TesterTest.test_no_tests_found):
* Scripts/webkitpy/test/runner.py:
(Runner.run):
* Scripts/webkitpy/test/runner_unittest.py:
(RunnerTest.test_regular):
(RunnerTest.test_verbose):
(RunnerTest.test_timing):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122750 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Unreviewed gardening. Layout Test fast/frames/calculate-fixed.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=91415

Has been intermittently failing TEXT since at least r122699.

* platform/chromium/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122752 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add dfg switch to create_jit_stubs script
https://bugs.webkit.org/show_bug.cgi?id=91256

Reviewed by Geoffrey Garen.

* create_jit_stubs: Add a switch to enable or disable the generation of
                    stub functions in #if ENABLE(DFG_JIT) conditions.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122753 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Upstream WebGL Code
https://bugs.webkit.org/show_bug.cgi?id=91143

Patch by Joshua Netterfield <jnetterfield@rim.com> on 2012-07-16
Reviewed by Rob Buis.

This patch includes BlackBerry-specific fixes for anti-aliasing, logging, and shader compilation.

Source/WebCore:

No new tests, because there is no new functionality.

* platform/graphics/GraphicsContext3D.h: Add a value for TI Imagination chipsets on BlackBerry platforms
* platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp: Multiple downstream changes
(WebCore::GraphicsContext3D::GraphicsContext3D):
(WebCore::GraphicsContext3D::reshapeFBOs):
(WebCore):
(WebCore::GraphicsContext3D::logFrameBufferStatus):
(WebCore::GraphicsContext3D::readPixelsIMG): BlackBerry-specific fix for Imagination hardware.
(WebCore::GraphicsContext3D::paintsIntoCanvasBuffer):
(WebCore::GraphicsContext3D::platformTexture):
(WebCore::GraphicsContext3D::platformGraphicsContext3D):
(WebCore::GraphicsContext3D::paintToCanvas):
* platform/graphics/opengl/Extensions3DOpenGL.h: Remove unnecessary whitespace.
(Extensions3DOpenGL):
* platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
(WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE): Hack to fix ANGLE-generated code on BlackBerry platforms.
* platform/graphics/opengl/Extensions3DOpenGLCommon.h:
(Extensions3DOpenGLCommon):
* platform/graphics/opengl/Extensions3DOpenGLES.cpp: I am not in a position to change system headers from correct to incorrect.
(WebCore::Extensions3DOpenGLES::renderbufferStorageMultisample):
(WebCore::Extensions3DOpenGLES::supportsExtension):
* platform/graphics/opengl/Extensions3DOpenGLES.h: I am not in a position to change system headers from correct to incorrect.
(Extensions3DOpenGLES):
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: Add a BlackBerry-specific anti-aliasing fix.
(WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
(WebCore::GraphicsContext3D::prepareTexture):
(WebCore::GraphicsContext3D::bindFramebuffer):
(WebCore::GraphicsContext3D::compileShader):
(WebCore::GraphicsContext3D::copyTexImage2D):
(WebCore::GraphicsContext3D::copyTexSubImage2D):
(WebCore):
* platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
(WebCore):

Source/WebKit:

* PlatformBlackBerry.cmake: Define WTF_USE_OPENGL_ES_2 on WebGL-enabled builds.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122754 268f45cc-cd09-0410-ab3c-d52691b4dbfc
SVGAnimationElement::currentValuesForValuesAnimation crash
https://bugs.webkit.org/show_bug.cgi?id=91326

Reviewed by Simon Fraser.

SVGSMILElement::progress() assumes that seekToIntervalCorrespondingToTime() always
lands inside a defined interval, but one can force arbitrary time offsets using
setCurrentTime(). This patch adds logic for handling non-interval time offsets
gracefully.

Source/WebCore:

Test: svg/animations/smil-setcurrenttime-crash.svg

* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::progress):

LayoutTests:

* svg/animations/smil-setcurrenttime-crash-expected.txt: Added.
* svg/animations/smil-setcurrenttime-crash.svg: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122755 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Remove targetRenderSurface concept, give layers a renderTarget which is the layer whose coordinate space they draw into
https://bugs.webkit.org/show_bug.cgi?id=91288

Reviewed by Adrienne Walker.

Source/WebCore:

Always use pointers to layers when discussing render targets instead of
pointing directly to a RenderSurface.

Covered by existing tests.

* platform/graphics/chromium/LayerChromium.cpp:
(WebCore::LayerChromium::LayerChromium):
(WebCore::LayerChromium::createRenderSurface):
* platform/graphics/chromium/LayerChromium.h:
(WebCore::LayerChromium::renderTarget):
(WebCore::LayerChromium::setRenderTarget):
(LayerChromium):
* platform/graphics/chromium/RenderSurfaceChromium.cpp:
* platform/graphics/chromium/RenderSurfaceChromium.h:
* platform/graphics/chromium/ScrollbarLayerChromium.cpp:
(WebCore::ScrollbarLayerChromium::setTexturePriorities):
* platform/graphics/chromium/TiledLayerChromium.cpp:
(WebCore::TiledLayerChromium::setTexturePrioritiesInRect):
* platform/graphics/chromium/cc/CCLayerImpl.cpp:
(WebCore::CCLayerImpl::CCLayerImpl):
(WebCore::CCLayerImpl::createRenderSurface):
(WebCore::CCLayerImpl::dumpLayerProperties):
* platform/graphics/chromium/cc/CCLayerImpl.h:
(WebCore::CCLayerImpl::renderTarget):
(WebCore::CCLayerImpl::setRenderTarget):
(CCLayerImpl):
* platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
(WebCore::calculateLayerScissorRect):
(WebCore::calculateSurfaceScissorRect):
(WebCore::calculateVisibleContentRect):
(WebCore::computeScrollCompensationForThisLayer):
(WebCore::calculateDrawTransformsInternal):
(WebCore::pointIsClippedBySurfaceOrClipRect):
* platform/graphics/chromium/cc/CCOcclusionTracker.cpp:
(WebCore::::enterLayer):
(WebCore::::leaveLayer):
(WebCore::::enterRenderTarget):
(WebCore::::finishedRenderTarget):
(WebCore):
(WebCore::reduceOcclusionBelowSurface):
(WebCore::::leaveToRenderTarget):
(WebCore::::markOccludedBehindLayer):
(WebCore::::occluded):
(WebCore::::unoccludedContentRect):
(WebCore::::unoccludedContributingSurfaceContentRect):
(WebCore::::layerScissorRectInTargetSurface):
* platform/graphics/chromium/cc/CCOcclusionTracker.h:
(CCOcclusionTrackerBase):
(WebCore::CCOcclusionTrackerBase::StackObject::StackObject):
(StackObject):
* platform/graphics/chromium/cc/CCQuadCuller.cpp:
(WebCore::CCQuadCuller::appendSurface):
* platform/graphics/chromium/cc/CCRenderSurface.cpp:
* platform/graphics/chromium/cc/CCRenderSurface.h:
(CCRenderSurface):

Source/WebKit/chromium:

* tests/CCDamageTrackerTest.cpp:
(WebKitTests::TEST_F):
* tests/CCLayerImplTest.cpp:
(WebCore::TEST):
* tests/CCLayerTreeHostCommonTest.cpp:
* tests/CCOcclusionTrackerTest.cpp:
(WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest):
(WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest):
(WebKitTests::CCOcclusionTrackerTestAnimationOpacity1OnMainThread::runMyTest):
(WebKitTests::CCOcclusionTrackerTestAnimationOpacity0OnMainThread::runMyTest):
(WebKitTests::CCOcclusionTrackerTestAnimationTranslateOnMainThread::runMyTest):
(WebKitTests::CCOcclusionTrackerTestReplicaOccluded::runMyTest):
(WebKitTests::CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded::runMyTest):
(WebKitTests::CCOcclusionTrackerTestSurfaceAndReplicaOccludedDifferently::runMyTest):
(WebKitTests::CCOcclusionTrackerTestSurfaceChildOfSurface::runMyTest):
(WebKitTests::CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor::runMyTest):
(WebKitTests::CCOcclusionTrackerTestSurfaceChildOfClippingSurface::runMyTest):
* tests/CCQuadCullerTest.cpp:
* tests/CCTiledLayerTestCommon.cpp:
(WebKitTests::FakeTiledLayerChromium::setTexturePriorities):
* tests/LayerChromiumTest.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122756 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Any webpage can crash webkit via qnx.callExtensionMethod assuming 'this' is the 'qnx' object.
https://bugs.webkit.org/show_bug.cgi?id=91419

Run the following in inspector to crash WebKit

qnx.callExtensionMethod.apply(window, []);

In the c++ that handles the function it assumes that when callExtensionMethod
is called that 'this' is the object 'qnx'.  The qnx object has a hidden
variable that the code casts and uses, but when 'this' is not qnx such as the
example this will cause a crash.  Any website can insert the above JavaScript
to cause the crash.

Patch by Benjamin C Meyer <bmeyer@rim.com> on 2012-07-16
Reviewed by Yong Li.

* WebCoreSupport/ClientExtension.cpp:
(clientExtensionMethod):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122757 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix Layout Test pointer-lock/locked-element-removed-from-dom.html flakiness.
https://bugs.webkit.org/show_bug.cgi?id=91373

Reviewed by Adrienne Walker.

pointer-lock-test-harness corrected to no longer silently allow too many
asynchronous doNextStep calls in a test. The locked-element-removed-from-dom test
generated too many events and incorrectly exited the test early.

* platform/chromium/TestExpectations:
    Re-enabled locked-element-removed-from-dom test.html
* pointer-lock/locked-element-removed-from-dom.html:
    Absorb extra doNextStep.
* pointer-lock/resources/pointer-lock-test-harness.js:
(doNextStep.setTimeout):
    Fail tests that call doNextStep too many times.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122758 268f45cc-cd09-0410-ab3c-d52691b4dbfc
test-webkitpy: handle failures properly when running in parallel
https://bugs.webkit.org/show_bug.cgi?id=91416

Reviewed by Tony Chang.

It turns out that unittest.TestResults contain a handle to the
test method itself, which isn't picklable; it's sufficient to just
store the test name instead of the actual method. By doing so
we can move the test_name() method from the printer to the
runner where it belongs (so the printer is less dependent on the
unittest framework's data structures).

This change should really have a test but I don't know how to
write one that properly captures the behavior and won't cause
test-webkitpy itself to fail. I've verified the fix by hand, at
least, in the meantime.

* Scripts/webkitpy/test/printer.py:
(Printer.__init__):
(Printer.print_result):
* Scripts/webkitpy/test/runner.py:
(_test_name):
(Runner.all_test_names):
(_Worker.handle):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122759 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Adobe Web Platform Team Blog is missing from Planet WebKit
https://bugs.webkit.org/show_bug.cgi?id=91407

Reviewed by Andreas Kling.

Adding Adobe Web Platform Team Blog feed to Planet WebKit.

* config.ini:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122760 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=91299
Paginated views should restrict available height to column height
-and corresponding-
<rdar://problem/11152108>

Reviewed by Dan Bernstein.

Source/WebCore: 

Now that RenderViews can have columns, availableLogicalHeight needs to consider 
that column height, much like how availableLogicalWidth already considers column 
width.

availableLogicalHeight is newly virtual, like the already-virtual 
availableLogicalWidth.
* rendering/RenderBox.h:
(RenderBox):

Check with the columnHeight.
* rendering/RenderView.cpp:
(WebCore):
(WebCore::RenderView::availableLogicalHeight):
* rendering/RenderView.h:

setPagination now takes pageLength as an optional parameter. 
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::setPagination):
* testing/InternalSettings.h:
(WebCore::InternalSettings::setPagination):
(InternalSettings):
* testing/InternalSettings.idl:
* testing/Internals.cpp:
(WebCore::Internals::setPagination):
* testing/Internals.h:
(WebCore::Internals::setPagination):
(Internals):
* testing/Internals.idl:

LayoutTests: 

New test.
* fast/multicol/resources/big-green.png: Added.
* fast/multicol/shrink-to-column-height-for-pagination.html: Added.
* platform/mac/fast/multicol/shrink-to-column-height-for-pagination-expected.png: Added.
* platform/mac/fast/multicol/shrink-to-column-height-for-pagination-expected.txt: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122761 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Unreviewed gardening. Layout Test svg/W3C-SVG-1.1/animate-elem-39-t.svg is flaky
https://bugs.webkit.org/show_bug.cgi?id=91421

This test is flaky (crashing) on the Win7 bot and has been for some time.

* platform/chromium/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122763 268f45cc-cd09-0410-ab3c-d52691b4dbfc
test-webkitpy: clean up logging to make it ninja-esque
https://bugs.webkit.org/show_bug.cgi?id=91297

Reviewed by Adam Barth.

This patch changes the output of test-webkitpy to be closer to
what ninja produces. Namely:

If you are running with stderr writing to a tty (and not -v), we
will no longer print '...' as tests complete. Instead, we use a
metered stream and print entries of the form:
   '[X/Y] test_name passed/failed/erred'
where X is the current test # and Y is the total number of tests.

If you are running with stderr piped to a file or other non-tty
object (or with -v), you get the same output, one per line for
every test.

In addition, if tests fail or err out, you get the stack trace
immediately; you don't have to wait until the end of the run.

Lastly, this change cleans up the unit tests for test-webkitpy
itself to not confuse the logger and to work cleanly w/ multiple
processes. It looks like between this and all the clean up in
MessagePool that happened as it landed, we can now run
multiprocessing tests in parallel.

* Scripts/webkitpy/test/finder.py:
(Finder._default_names):
* Scripts/webkitpy/test/finder_unittest.py:
(FinderTest.setUp):
(FinderTest.tearDown):
* Scripts/webkitpy/test/printer.py:
(Printer.__init__):
(Printer.configure):
(Printer.print_started_test):
(Printer.print_finished_test):
(Printer._test_line):
(Printer.print_result):
* Scripts/webkitpy/test/runner.py:
(Runner.run):
* Scripts/webkitpy/test/runner_unittest.py:
(RunnerTest.setUp):
(RunnerTest):
(RunnerTest.tearDown):
(RunnerTest.assert_run):
(RunnerTest.test_regular):
(RunnerTest.test_verbose):
(RunnerTest.test_timing):

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

* wtf/FastMalloc.cpp:
(WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122765 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Remove non-ephemeral data from RenderSurface as it duplicates data from the owning layer
https://bugs.webkit.org/show_bug.cgi?id=91418

Reviewed by Adrienne Walker.

This removes the filters and masks from render surfaces, and makes them
used directly from the owning layer. Also removes skipsDraw from
surfaces as it was just not used at all.

Covered by existing tests.

* platform/graphics/chromium/LayerChromium.h:
(WebCore::LayerChromium::filters):
(WebCore::LayerChromium::backgroundFilters):
(WebCore::LayerChromium::hasMask):
(WebCore::LayerChromium::hasReplica):
(WebCore::LayerChromium::replicaHasMask):
(LayerChromium):
* platform/graphics/chromium/RenderSurfaceChromium.cpp:
(WebCore::RenderSurfaceChromium::RenderSurfaceChromium):
* platform/graphics/chromium/RenderSurfaceChromium.h:
(RenderSurfaceChromium):
* platform/graphics/chromium/cc/CCLayerImpl.h:
(WebCore::CCLayerImpl::hasMask):
(WebCore::CCLayerImpl::hasReplica):
(WebCore::CCLayerImpl::replicaHasMask):
(CCLayerImpl):
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::calculateMemoryForRenderSurfaces):
* platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
(WebCore::calculateDrawTransformsInternal):
* platform/graphics/chromium/cc/CCOcclusionTracker.cpp:
(WebCore::::finishedRenderTarget):
(WebCore::reduceOcclusionBelowSurface):
(WebCore::::leaveToRenderTarget):
* platform/graphics/chromium/cc/CCRenderPass.cpp:
(WebCore::CCRenderPass::appendQuadsForRenderSurfaceLayer):
* platform/graphics/chromium/cc/CCRenderSurface.cpp:
(WebCore::CCRenderSurface::drawableContentRect):
(WebCore::CCRenderSurface::appendQuads):
* platform/graphics/chromium/cc/CCRenderSurface.h:
(CCRenderSurface):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122766 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r122739.
http://trac.webkit.org/changeset/122739
https://bugs.webkit.org/show_bug.cgi?id=91424

Broke mac builds (Requested by rniwa on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-07-16

* inspector/CodeGeneratorInspector.py:
(flatten_list):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122767 268f45cc-cd09-0410-ab3c-d52691b4dbfc
DFG PutById transition should handle storage allocation, and inline it
https://bugs.webkit.org/show_bug.cgi?id=91337

Reviewed by Oliver Hunt.

This enables the patching of DFG PutById to handle the out-of-line storage
allocation case. Furthermore, it inlines out-of-line storage allocation (and
reallocation) into the generated stubs.  
        
To do this, this patch adds the ability to store the relevant register
allocation state (i.e. the set of in-use registers) in the structure stub
info so that the stub generation code can more flexibly select scratch
registers: sometimes it needs none, sometimes one - or sometimes up to
three. Moreover, to make the stub generation register allocation simple and
maintainable, this patch introduces a reusable scratch register allocator
class. This register allocator understands that some registers are in use by
the main path code and so must be spilled as necessary, other registers are
locked for use in the stub itself and so cannot even be spilled, while still
others may be allocated for scratch purposes. A scratch register that is
used must be spilled. If a register is locked, it cannot be used as a
scratch register. If a register is used, it can be used as a scratch
register so long as it is spilled.
        
This is a sub-1% speed-up on V8 and neutral elsewhere.

* GNUmakefile.list.am:
* JavaScriptCore.xcodeproj/project.pbxproj:
* assembler/MacroAssemblerCodeRef.h:
(FunctionPtr):
(JSC::FunctionPtr::FunctionPtr):
* bytecode/StructureStubInfo.h:
* dfg/DFGCCallHelpers.h:
(JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
(CCallHelpers):
* dfg/DFGGPRInfo.h:
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::link):
* dfg/DFGJITCompiler.h:
(JSC::DFG::PropertyAccessRecord::PropertyAccessRecord):
(PropertyAccessRecord):
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGRegisterBank.h:
(JSC::DFG::RegisterBank::isInUse):
(RegisterBank):
* dfg/DFGRegisterSet.h: Added.
(DFG):
(RegisterSet):
(JSC::DFG::RegisterSet::RegisterSet):
(JSC::DFG::RegisterSet::asPOD):
(JSC::DFG::RegisterSet::copyInfo):
(JSC::DFG::RegisterSet::set):
(JSC::DFG::RegisterSet::setGPRByIndex):
(JSC::DFG::RegisterSet::clear):
(JSC::DFG::RegisterSet::get):
(JSC::DFG::RegisterSet::getGPRByIndex):
(JSC::DFG::RegisterSet::getFreeGPR):
(JSC::DFG::RegisterSet::setFPRByIndex):
(JSC::DFG::RegisterSet::getFPRByIndex):
(JSC::DFG::RegisterSet::setByIndex):
(JSC::DFG::RegisterSet::getByIndex):
(JSC::DFG::RegisterSet::numberOfSetGPRs):
(JSC::DFG::RegisterSet::numberOfSetFPRs):
(JSC::DFG::RegisterSet::numberOfSetRegisters):
(JSC::DFG::RegisterSet::setBit):
(JSC::DFG::RegisterSet::clearBit):
(JSC::DFG::RegisterSet::getBit):
* dfg/DFGRepatch.cpp:
(JSC::DFG::generateProtoChainAccessStub):
(JSC::DFG::tryCacheGetByID):
(JSC::DFG::tryBuildGetByIDList):
(JSC::DFG::emitPutReplaceStub):
(JSC::DFG::emitPutTransitionStub):
(JSC::DFG::tryCachePutByID):
(JSC::DFG::tryBuildPutByIdList):
* dfg/DFGScratchRegisterAllocator.h: Added.
(DFG):
(ScratchRegisterAllocator):
(JSC::DFG::ScratchRegisterAllocator::ScratchRegisterAllocator):
(JSC::DFG::ScratchRegisterAllocator::lock):
(JSC::DFG::ScratchRegisterAllocator::allocateScratch):
(JSC::DFG::ScratchRegisterAllocator::allocateScratchGPR):
(JSC::DFG::ScratchRegisterAllocator::allocateScratchFPR):
(JSC::DFG::ScratchRegisterAllocator::didReuseRegisters):
(JSC::DFG::ScratchRegisterAllocator::preserveReusedRegistersByPushing):
(JSC::DFG::ScratchRegisterAllocator::restoreReusedRegistersByPopping):
(JSC::DFG::ScratchRegisterAllocator::desiredScratchBufferSize):
(JSC::DFG::ScratchRegisterAllocator::preserveUsedRegistersToScratchBuffer):
(JSC::DFG::ScratchRegisterAllocator::restoreUsedRegistersFromScratchBuffer):
* dfg/DFGSpeculativeJIT.h:
(SpeculativeJIT):
(JSC::DFG::SpeculativeJIT::usedRegisters):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::cachedGetById):
(JSC::DFG::SpeculativeJIT::cachedPutById):
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::cachedGetById):
(JSC::DFG::SpeculativeJIT::cachedPutById):
(JSC::DFG::SpeculativeJIT::compile):
* heap/CopiedAllocator.h:
(CopiedAllocator):
(JSC::CopiedAllocator::fastPathShouldSucceed):
(JSC):



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