Web Inspector: Fixes to layout test infrastructure
https://bugs.webkit.org/show_bug.cgi?id=136360

Patch by Matt Baker <mattbaker@apple.com> on 2014-09-08
Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

Added missing includes to Test.html, which was breaking tests that
depended on SourceCodeLocation and LazySourceCodeLocation. Also fixed
bug which prevented test results from being resent after reloading the
page under test.

* UserInterface/Base/Test.js:
(InspectorTest.reloadPage):
* UserInterface/Test.html:

LayoutTests:

Updated expected results to reflect breakpoint resolution changes in r171784.

* inspector/debugger/probe-manager-add-remove-actions-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@173405 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Add layout test for lowercase CSSProperty names
https://bugs.webkit.org/show_bug.cgi?id=135961

Patch by Matt Baker <mattbaker@apple.com> on 2014-09-08
Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

Modified test components to support testing CSSStyleManager and related classes:
- Added required models to Test.html
- Added CSSCompletions initialization to Test.js
- CSSCompletions doesn't assume presence of CodeMirror.

* UserInterface/Base/Test.js:
(WebInspector.loaded):
* UserInterface/Models/CSSCompletions.js:
* UserInterface/Test.html:

LayoutTests:

Added test to check that property names in matched CSS rules are returned in lowercase
when specified with upper or mixed case in the original CSS source.

* inspector/css/matched-style-properties-expected.txt: Added.
* inspector/css/matched-style-properties.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@173406 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Inspector frequently restores wrong view when opened (often Timelines instead of Resource)
https://bugs.webkit.org/show_bug.cgi?id=135965

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2014-09-08
Reviewed by Timothy Hatcher.

There were numerous subtle race conditions in state restoration.
This patch intends to fix a number of them to get what feels
like sane behavior for selected sidebar state restoration.

1. Starting a Timeline recording no longer automatically switches to the TimelineContentView.
This was making every reload switch to Timelines. If you had
a resource selected (e.g. the DOM Tree) we should go back
to showing the DOM tree.

2. Background sidebars should not reveal and select tree elements.
This was making resources get selected in Timelines when reloading the page
because the background Resources sidebar was restoring selection of the resource.
That is an unexpected selection and breaks the experience of Timelines.

3. ContentView changes during page navigation / reload should not be saved, and improve Resource restoration.
If a TimelineContentView was in the ContentBrowser back/forward history,
a reload with a resource selected in the Resources sidebar would end up
showing the Timelines sidebar. This was because when ContentViews are
closed during the navigation, the ContentBrowser would fall back to the
remaining TimelineContentView and switch to its only allowed sidebar
(Timelines). ResourceSidebarPanel, knowing a resource was selected,
would select the MainFrame intending to stay in the Resource sidebar,
but the resource is okay with showing in any sidebar, so we stay on Timelines.

4. Resource sidebar state restoration should propertly restore selection.
On reload, state restoration would know the resource to re-select in the
Resources sidebar. As ResourceTreeElements are added to the sidebar
they are checked against the state restoration cookie. If they match,
they would select the element and delete the cookie. Unfortunately,
if this was the first TreeElement child being added to a FrameTreeElement,
the FrameTreeElement onpopulate would remove all children and re-add
them in a unique way. Unfortunately this means the TreeElement we
selected based on the cookie, immediately got thrown away and recreated,
and we no longer reveal and select it. This is a special case for
FrameTreeElements which use the onpopulate SPI. So, instead of starting
processing the new element queue, if this is the first time just trigger
the onpopulate and elements are made just once.

5. Show Error Console triggering early, could have unexpected sidebar behavior.
Opening Web Inspector directly to the console can run before
WebInspector.contentLoaded (DOMContentLoaded). So in that case
WebInspector.showFullHeightConsole was not handling if the contentBrowser
had no content view yet, and the sidebar might be-reopened later on
in contentLoaded based on the setting value.

6. Improve automatic resource selection for sidebars with multiple tree outlines.
Selecting a call frame tree element was unexpectedly changing the
selection to a Resource where the breakpoint was set. This was
because we were only looking at one of potentially many content
tree outlines in the sidebar to see if there was a user action.

* UserInterface/Base/Main.js:
(WebInspector.contentLoaded):
(WebInspector.showFullHeightConsole):
(WebInspector.toggleConsoleView):
(WebInspector._mainResourceDidChange):
(WebInspector._provisionalLoadStarted):
(WebInspector._revealAndSelectRepresentedObjectInNavigationSidebar):
(WebInspector._updateCookieForInspectorViewState):
(WebInspector._contentBrowserCurrentContentViewDidChange):
* UserInterface/Views/NavigationSidebarPanel.js:
(WebInspector.NavigationSidebarPanel.prototype._treeElementAddedOrChanged):
* UserInterface/Views/ResourceSidebarPanel.js:
(WebInspector.ResourceSidebarPanel.prototype._mainFrameMainResourceDidChange.delayedWork):
(WebInspector.ResourceSidebarPanel.prototype._mainFrameMainResourceDidChange):
* UserInterface/Views/TimelineSidebarPanel.js:
(WebInspector.TimelineSidebarPanel.prototype._recordingLoaded):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@173407 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Skip some WebGL conformance tests that may be passing on the bots now.

* platform/mac/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@173409 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r173402.
https://bugs.webkit.org/show_bug.cgi?id=136649

Breaking buildw with error "unable to restore file position to
0x00000c60 for section __DWARF.__debug_info (errno = 9)"
(Requested by mlam_ on #webkit).

Reverted changeset:

"Move CallFrame and Register inlines functions out of
JSScope.h."
https://bugs.webkit.org/show_bug.cgi?id=136579
http://trac.webkit.org/changeset/173402

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@173410 268f45cc-cd09-0410-ab3c-d52691b4dbfc
DFG should have a reusable SSA builder
https://bugs.webkit.org/show_bug.cgi?id=136331

Reviewed by Oliver Hunt.
        
Source/JavaScriptCore:

We want to implement sophisticated SSA transformations like object allocation sinking
(https://bugs.webkit.org/show_bug.cgi?id=136330), but to do that, we need to be able to do
updates to SSA that require inserting new Phi's. This requires calculating where Phis go.
Previously, our Phi calculation was based on Aycock and Horspool's algorithm, and our
implementation of this algorithm only worked when doing CPS->SSA conversion. The code
could not be reused for cases where some phase happens to know that it introduced a few
defs in some blocks and it wants to figure out where the Phis should go. Moreover, even
the general algorithm of Aycock and Horspool is not well suited to such targetted SSA
updates, since it requires first inserting maximal Phis. That scales well when the Phis
were already there (like in our CPS form) but otherwise it's quite unnatural and may be
difficult to make efficient.
        
The usual way of handling both SSA conversion and SSA update is to use Cytron et al's
algorithm based on dominance frontiers. For a while now, I've been working on creating a
Cytron-based SSA calculator that can be used both as a replacement for our current SSA
converter and as a reusable tool for any phase that needs to do SSA update. I previously
optimized our dominator calculation and representation to use dominator trees computed
using Lengauer and Tarjan's algorithm - mainly to make it more scalable to enumerate over
the set of blocks that dominate you or vice-versa, and then I implemented a dominance
frontier calculator. This patch implements the final step towards making SSA update
available to all SSA phases: it implements an SSACalculator that can tell you where Phis
go when given an arbitrary set of Defs. To keep things simple, and to ensure that we have
good test coverage for this SSACalculator, this patch replaces the old Aycock-Horspool
SSA converter with one based on the SSACalculator.
        
This has no observable impact. It does reduce the amount of code in SSAConversionPhase.
But even better, it makes SSAConversionPhase have significantly less tricky logic. It
mostly just relies on SSACalculator to do the tricky stuff, and SSAConversionPhase mostly
just reasons about the weirdnesses unique to the ThreadedCPS form that it sees as input.
In fact, using the Cytron et al approach means that there isn't really any "smoke and
mirrors" trickyness related to SSA. SSACalculator's only "tricks" are using the pruned
iterated dominance frontier to place Phi's and using the dom tree to find reaching defs.
The complexity is mostly confined to Dominators, which computes various dominator-related
properties over the control flow graph. That class can be difficult to understand, but at
least it follows well-known graph theory wisdom.

* CMakeLists.txt:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* dfg/DFGAnalysis.h:
* dfg/DFGCSEPhase.cpp:
* dfg/DFGDCEPhase.cpp:
(JSC::DFG::DCEPhase::run):
* dfg/DFGDominators.h:
(JSC::DFG::Dominators::immediateDominatorOf):
(JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf):
(JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::dump):
(JSC::DFG::Graph::blocksInPreOrder):
(JSC::DFG::Graph::blocksInPostOrder):
(JSC::DFG::Graph::getBlocksInPreOrder): Deleted.
(JSC::DFG::Graph::getBlocksInPostOrder): Deleted.
* dfg/DFGGraph.h:
* dfg/DFGLICMPhase.cpp:
(JSC::DFG::LICMPhase::run):
* dfg/DFGNodeFlags.h:
* dfg/DFGPhase.cpp:
(JSC::DFG::Phase::beginPhase):
(JSC::DFG::Phase::endPhase):
* dfg/DFGPhase.h:
* dfg/DFGSSACalculator.cpp: Added.
(JSC::DFG::SSACalculator::Variable::dump):
(JSC::DFG::SSACalculator::Variable::dumpVerbose):
(JSC::DFG::SSACalculator::Def::dump):
(JSC::DFG::SSACalculator::SSACalculator):
(JSC::DFG::SSACalculator::~SSACalculator):
(JSC::DFG::SSACalculator::newVariable):
(JSC::DFG::SSACalculator::newDef):
(JSC::DFG::SSACalculator::nonLocalReachingDef):
(JSC::DFG::SSACalculator::reachingDefAtTail):
(JSC::DFG::SSACalculator::dump):
* dfg/DFGSSACalculator.h: Added.
(JSC::DFG::SSACalculator::Variable::index):
(JSC::DFG::SSACalculator::Variable::Variable):
(JSC::DFG::SSACalculator::Def::variable):
(JSC::DFG::SSACalculator::Def::block):
(JSC::DFG::SSACalculator::Def::value):
(JSC::DFG::SSACalculator::Def::Def):
(JSC::DFG::SSACalculator::variable):
(JSC::DFG::SSACalculator::computePhis):
(JSC::DFG::SSACalculator::phisForBlock):
(JSC::DFG::SSACalculator::reachingDefAtHead):
* dfg/DFGSSAConversionPhase.cpp:
(JSC::DFG::SSAConversionPhase::SSAConversionPhase):
(JSC::DFG::SSAConversionPhase::run):
(JSC::DFG::SSAConversionPhase::forwardPhiChildren): Deleted.
(JSC::DFG::SSAConversionPhase::forwardPhi): Deleted.
(JSC::DFG::SSAConversionPhase::forwardPhiEdge): Deleted.
(JSC::DFG::SSAConversionPhase::deduplicateChildren): Deleted.
* dfg/DFGSSAConversionPhase.h:
* dfg/DFGValidate.cpp:
(JSC::DFG::Validate::Validate):
(JSC::DFG::Validate::dumpGraphIfAppropriate):
(JSC::DFG::validate):
* dfg/DFGValidate.h:
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::lower):
* runtime/Options.h:

Source/WTF:

Update the alloc() method to use variadic templates. This makes it more natural to use.

* wtf/SegmentedVector.h:
(WTF::SegmentedVector::alloc):



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