Timeline



Jul 28, 2013:

11:23 PM Changeset in webkit [153418] by akling@apple.com
  • 2 edits in trunk/Source/WebCore

Don't update the text track override CSS every time a media element is created.
<http://webkit.org/b/119199>
<rdar://problem/14572855>

Reviewed by Darin Adler.

We should only have to update the CSS if the accessibility caption preferences are changed.
This was forcing a full style recalc in every Document any time a media element is instantiated.

  • page/CaptionUserPreferencesMediaAF.cpp:

(WebCore::CaptionUserPreferencesMediaAF::setInterestedInCaptionPreferenceChanges):

9:37 PM Changeset in webkit [153417] by Lucas Forschler
  • 4 edits
    2 copies in branches/safari-537-branch

Merged r153399. <rdar://problem/14549536>

9:27 PM Changeset in webkit [153416] by Lucas Forschler
  • 8 edits in branches/safari-537-branch/Source/WebKit2

Merged r153404. <rdar://problem/14444331>

9:22 PM Changeset in webkit [153415] by Lucas Forschler
  • 2 edits in branches/safari-537-branch/Source/WebKit2

Merged r153402. <rdar://problem/14517068>

8:08 PM Changeset in webkit [153414] by aestes@apple.com
  • 2 edits in trunk/Tools

Include <stdio.h> to declare perror()
https://bugs.webkit.org/show_bug.cgi?id=119198

Reviewed by Andreas Kling.

Silences an implicit declaration warning.

  • DumpRenderTree/mac/PerlSupport/DumpRenderTreeSupport.c:
6:16 PM Changeset in webkit [153413] by aestes@apple.com
  • 2 edits in trunk/Source/WebCore

Stop exporting Widget::frameRectsChanged()
https://bugs.webkit.org/show_bug.cgi?id=119196

Reviewed by Darin Adler.

The definition is inlined in a private header, so there's no need to
export a symbol to link against. On the Mac, since we compile with
-fvisibility-inlines-hidden, removing the symbol from the export file
silences an ld warning about exporting a hidden symbol.

  • WebCore.exp.in: Removed ZN7WebCore6Widget17frameRectsChangedEv.
4:36 PM Changeset in webkit [153412] by weinig@apple.com
  • 2 edits in trunk/Source/WebCore

Clean up CSSPrimitiveValue::equals a bit
https://bugs.webkit.org/show_bug.cgi?id=119195

Reviewed by Andreas Kling.

  • css/CSSPrimitiveValue.cpp:

(WebCore::CSSPrimitiveValue::equals):
This should not change behavior, but is quite a bit clearer.

3:08 PM Changeset in webkit [153411] by Antoine Quint
  • 2 edits in trunk/LayoutTests

fast/forms/input-in-table-cell-no-value.html fails on platform without ENABLE(INPUT_TYPE_DATE)
https://bugs.webkit.org/show_bug.cgi?id=90987

This test now passes on Mac so we don't need to skip it any longer.

Reviewed by Anders Carlsson.

  • platform/mac/TestExpectations:
11:04 AM Changeset in webkit [153410] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

REGRESSION: Crash when opening Facebook.com
https://bugs.webkit.org/show_bug.cgi?id=119155

Reviewed by Andreas Kling.

Scope nodes are always objects, so we should be using SpecObjectOther
rather than SpecCellOther. Marking Scopes as CellOther leads to a
contradiction in the CFA, resulting in bogus codegen.

  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::::executeEffects):

  • dfg/DFGPredictionPropagationPhase.cpp:

(JSC::DFG::PredictionPropagationPhase::propagate):

Jul 27, 2013:

11:48 PM Changeset in webkit [153409] by ryuan.choi@samsung.com
  • 6 edits in trunk

[EFL] Bump required version of EFL to 1.7
https://bugs.webkit.org/show_bug.cgi?id=119144

Reviewed by Christophe Dumez.

.:

We have supported 1.6 for Tizen build since r137203.
But Tizen now supports 1.7+ after Tizen released 2.0.

  • Source/cmake/OptionsEfl.cmake:

Bumped EFL to 1.7 and removed promotion.

Source/WebCore:

  • platform/efl/FileSystemEfl.cpp: Removed workaround code which was fixed at Eina 1.7

(WebCore::listDirectory):

Tools:

  • MiniBrowser/efl/CMakeLists.txt: Bumped EFL to 1.7
10:14 PM Changeset in webkit [153408] by commit-queue@webkit.org
  • 19 edits in trunk/Source

Replace all uses of GraphicsLayer::create function with the one that takes a GraphicsLayerFactory
https://bugs.webkit.org/show_bug.cgi?id=119186

Patch by Jacky Jiang <zhajiang@blackberry.com> on 2013-07-27
Reviewed by Anders Carlsson.

Source/WebCore:

Remove GraphicsLayer::create(GraphicsLayerClient*) function since it's
been deprecated by r130072.

  • WebCore.exp.in:
  • WebCore.order:
  • platform/graphics/GraphicsLayer.h:
  • platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:
  • platform/graphics/ca/GraphicsLayerCA.cpp:
  • platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:

Source/WebKit/blackberry:

Replace GraphicsLayer::create calls and add a new function WebPagePrivate::graphicsLayerFactory().

  • Api/WebOverlay.cpp:

(BlackBerry::WebKit::WebOverlayPrivateWebKitThread::WebOverlayPrivateWebKitThread):

  • Api/WebPage.cpp:

(BlackBerry::WebKit::WebPagePrivate::graphicsLayerFactory):
(BlackBerry::WebKit::WebPagePrivate::overlayLayer):

  • Api/WebPage_p.h:
  • WebKitSupport/FrameLayers.cpp:

(BlackBerry::WebKit::FrameLayers::addLayer):

  • WebKitSupport/SelectionOverlay.cpp:

(BlackBerry::WebKit::SelectionOverlay::draw):

Source/WebKit/efl:

  • WebCoreSupport/AcceleratedCompositingContextEfl.cpp:

(WebCore::AcceleratedCompositingContext::attachRootGraphicsLayer):

Source/WebKit/qt:

  • WebCoreSupport/TextureMapperLayerClientQt.cpp:

(TextureMapperLayerClientQt::setRootGraphicsLayer):

Source/WebKit2:

  • UIProcess/mac/RemoteLayerTreeHost.mm:

(WebKit::RemoteLayerTreeHost::getOrCreateLayer):

5:05 PM Changeset in webkit [153407] by ap@apple.com
  • 5 edits in trunk/Source/WebCore

HTMLParserScheduler gets into an inconsistent state when suspended for reasons
other than WillDeferLoading
https://bugs.webkit.org/show_bug.cgi?id=119172

Reviewed by Sam Weinig.

When loading is not deferred, even a suspended parser will be processing new data
from network, potentially starting its next chunk timer.

Limit suspending to when we can actually enforce it.

Here is what happens for each ReasonForSuspension:

  • JavaScriptDebuggerPaused: continuing to parse is probably wrong, but in practice,

this is unlikely to happen while debugging, and wasn't properly prevented before
this patch anyway.

  • WillDeferLoading: No change in behavior.
  • DocumentWillBecomeInactive: This is about page cache, and documents are only allowed

to be cached when fully loaded.

  • PageWillBeSuspended: This appears to be part of Frame::suspendActiveDOMObjectsAndAnimations()

implementation, I'm guessing that it is appropriate to continue loading.

  • dom/Document.cpp:

(WebCore::Document::suspendScheduledTasks):
(WebCore::Document::resumeScheduledTasks):
Only suspend/resume parsing when loading is deferred. This is not expressed directly,
but it's important to do this to avoid executing JS behind alerts and other modal dialogs.

  • html/parser/HTMLParserScheduler.h: Added m_suspended member variable for assertions.
  • html/parser/HTMLParserScheduler.cpp:

(WebCore::HTMLParserScheduler::HTMLParserScheduler):
(WebCore::HTMLParserScheduler::continueNextChunkTimerFired):
(WebCore::HTMLParserScheduler::scheduleForResume):
(WebCore::HTMLParserScheduler::suspend):
(WebCore::HTMLParserScheduler::resume):
Update m_suspended and assert as appropriate. No behavior changes for release mode.

  • page/Frame.cpp: (WebCore::Frame::suspendActiveDOMObjectsAndAnimations):

Added a FIXME.

5:04 PM Changeset in webkit [153406] by ap@apple.com
  • 6 edits in trunk/Source/WebCore

Make SuspendableTimer safer
https://bugs.webkit.org/show_bug.cgi?id=119127

Reviewed by Sam Weinig.

SuspendableTimer now enforces that it stays suspended until resumed (or until stopped
and started again). To ensure this, TimerBase is now a private base class, and parts of
its interface that clients use are reimplemented with suspend/resume in mind.

Derived classes are still allowed to override TimerBase virtual functions (notably
fired() and alignedFireTime()).

  • dom/DocumentEventQueue.cpp:

(WebCore::DocumentEventQueueTimer): Removed an extraneous WTF_MAKE_NONCOPYABLE,
TimerBase has it already.
(WebCore::DocumentEventQueueTimer::create): Use our normal create() pattern.
(WebCore::DocumentEventQueue::DocumentEventQueue): Made the constructor private, accordingly.
(WebCore::DocumentEventQueue::cancelEvent): Use SuspendableTimer::cancel(), which
is a new name to disambiguate TimerBase::stop() and ActiveDOMObject::stop().
(WebCore::DocumentEventQueue::close): Ditto.

  • page/DOMTimer.cpp:

(WebCore::DOMTimer::fired): Now that SuspendableTimer knows whether it's currently
suspended, assert that it's not.
(WebCore::DOMTimer::didStop): Separated ActiveDOMObject::stop() implementation from
additional cleanup, allowing for better SuspendableTimer encapsulation.

  • page/DOMTimer.h: Added FINAL and OVVERIDE specifiers as appropriate.
  • page/SuspendableTimer.h: Added FINAL (and OVERRIDE) qualifiers to ActiveDOMObject

methods. A derived class that wants to override current behavior is most likely not
a timer, and thus shouldn't be a derived class.
(WebCore::SuspendableTimer::isActive): SuspendableTimer with a next fire time is
active even if suspended, we shouldn't overwrite its saved data thinking that it's
inactive.
(WebCore::SuspendableTimer::isSuspended): Exposed to clients (m_suspended is no
longer debug only).

  • page/SuspendableTimer.cpp:

(WebCore::SuspendableTimer::SuspendableTimer): Updated for new variable names.
(WebCore::SuspendableTimer::stop): This is ActiveDOMObject::stop(), which is called
before final destruction. We don't track this state directly, but can approximate
with setting m_suspended, so even if someone tries to start the timer afterwards,
it won't fire.
(WebCore::SuspendableTimer::suspend): Updated for new names.
(WebCore::SuspendableTimer::resume): Ditto.
(WebCore::SuspendableTimer::didStop): No-op default implementation for client hook.
(WebCore::SuspendableTimer::cancel): Equivalent of TimerBase::stop(), which also
works when suspended.
(WebCore::SuspendableTimer::startRepeating): Replacement for TimerBase function with
the same name, which works correctly when suspended. We don't want to actually start
the timer in this case.
(WebCore::SuspendableTimer::startOneShot): Ditto.
(WebCore::SuspendableTimer::repeatInterval): Ditto.
(WebCore::SuspendableTimer::augmentFireInterval): Ditto.
(WebCore::SuspendableTimer::augmentRepeatInterval): Ditto.

4:53 PM Changeset in webkit [153405] by bshafiei@apple.com
  • 2 edits in branches/safari-537-branch/Source/ThirdParty

Merged r153403.

4:44 PM Changeset in webkit [153404] by Chris Fleizach
  • 8 edits in trunk/Source/WebKit2

AX: VoiceOver not working with data detection page overlays
https://bugs.webkit.org/show_bug.cgi?id=118680

Reviewed by Sam Weinig.

Expose API in BundlePageOverlay so that accessibility attributes can be retrieved through the overlay.
This requires two methods in a new callback struct. One to copy the attribute names, and the other to
copy the attribute values. I've folded both parameterized and non-parameterized attribute names into one method
with a boolean to determine which one should be used. The non-parameterized attributes are not used or passed to the
overlay at this time as there are no clients with such a need.

  • WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:

(PageOverlayClientImpl::setAccessibilityClient):
(PageOverlayClientImpl::PageOverlayClientImpl):
(PageOverlayClientImpl::copyAccessibilityAttributeValue):
(PageOverlayClientImpl::copyAccessibilityAttributeNames):
(WKBundlePageOverlaySetAccessibilityClient):

  • WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h:
  • WebProcess/WebPage/PageOverlay.cpp:

(WebKit::PageOverlay::copyAccessibilityAttributeValue):
(WebKit::PageOverlay::copyAccessibilityAttributeNames):

  • WebProcess/WebPage/PageOverlay.h:

(WebKit::PageOverlay::Client::copyAccessibilityAttributeValue):
(WebKit::PageOverlay::Client::copyAccessibilityAttributeNames):
(WebKit::PageOverlay::client):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::pageOverlayCopyAccessibilityAttributeValue):
(WebKit::WebPage::pageOverlayCopyAccessibilityAttributesNames):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/mac/WKAccessibilityWebPageObject.mm:

(-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]):
(-[WKAccessibilityWebPageObject _convertScreenPointToWindow:]):
(-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]):

4:20 PM Changeset in webkit [153403] by mrowe@apple.com
  • 2 edits in trunk/Source/ThirdParty

Fix builds against an SDK.

  • gtest/xcode/Config/FrameworkTarget.xcconfig: Ensure that gtest.framework is installed

in a location compatible with the SDK generation process.

4:14 PM Changeset in webkit [153402] by Simon Fraser
  • 2 edits in trunk/Source/WebKit2

If entering fullscreen for a window fails, don't leave things in a bad state
https://bugs.webkit.org/show_bug.cgi?id=119179
<rdar://problem/14517068>

Reviewed by Sam Weinig.

On Lion, attempting to take a video fullscreen when the Safari window is already
fullscreen can sometimes fail, and AppKit informs us via windowDidFailToEnterFullScreen:

When this happens we have to undo the work done when entering fullscreen, to
avoid leaving things in a bad state.

  • UIProcess/mac/WKFullScreenWindowController.mm:

(-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):

3:23 PM Changeset in webkit [153401] by weinig@apple.com
  • 2 edits in trunk/Source/WebCore

Add assertions for CSSPrimitiveValue's m_value.valueID accessor
https://bugs.webkit.org/show_bug.cgi?id=119180

Reviewed by Andreas Kling.

  • css/CSSPrimitiveValueMappings.h:

(WebCore::CSSPrimitiveValue::operator CSSReflectionDirection):
(WebCore::CSSPrimitiveValue::operator ColumnSpan):
(WebCore::CSSPrimitiveValue::operator PrintColorAdjust):
(WebCore::CSSPrimitiveValue::operator EBorderStyle):
(WebCore::CSSPrimitiveValue::operator OutlineIsAuto):
(WebCore::CSSPrimitiveValue::operator CompositeOperator):
(WebCore::CSSPrimitiveValue::operator ControlPart):
(WebCore::CSSPrimitiveValue::operator EBackfaceVisibility):
(WebCore::CSSPrimitiveValue::operator EFillAttachment):
(WebCore::CSSPrimitiveValue::operator EFillBox):
(WebCore::CSSPrimitiveValue::operator EFillRepeat):
(WebCore::CSSPrimitiveValue::operator EBoxPack):
(WebCore::CSSPrimitiveValue::operator EBoxAlignment):
(WebCore::CSSPrimitiveValue::operator EBoxDecorationBreak):
(WebCore::CSSPrimitiveValue::operator BackgroundEdgeOrigin):
(WebCore::CSSPrimitiveValue::operator EBoxSizing):
(WebCore::CSSPrimitiveValue::operator EBoxDirection):
(WebCore::CSSPrimitiveValue::operator EBoxLines):
(WebCore::CSSPrimitiveValue::operator EBoxOrient):
(WebCore::CSSPrimitiveValue::operator ECaptionSide):
(WebCore::CSSPrimitiveValue::operator EClear):
(WebCore::CSSPrimitiveValue::operator ECursor):
(WebCore::CSSPrimitiveValue::operator CursorVisibility):
(WebCore::CSSPrimitiveValue::operator EDisplay):
(WebCore::CSSPrimitiveValue::operator EEmptyCell):
(WebCore::CSSPrimitiveValue::operator EAlignItems):
(WebCore::CSSPrimitiveValue::operator EJustifyContent):
(WebCore::CSSPrimitiveValue::operator EFlexDirection):
(WebCore::CSSPrimitiveValue::operator EAlignContent):
(WebCore::CSSPrimitiveValue::operator EFlexWrap):
(WebCore::CSSPrimitiveValue::operator EFloat):
(WebCore::CSSPrimitiveValue::operator LineBreak):
(WebCore::CSSPrimitiveValue::operator EListStylePosition):
(WebCore::CSSPrimitiveValue::operator EListStyleType):
(WebCore::CSSPrimitiveValue::operator EMarginCollapse):
(WebCore::CSSPrimitiveValue::operator EMarqueeBehavior):
(WebCore::CSSPrimitiveValue::operator RegionFragment):
(WebCore::CSSPrimitiveValue::operator EMarqueeDirection):
(WebCore::CSSPrimitiveValue::operator ENBSPMode):
(WebCore::CSSPrimitiveValue::operator EOverflow):
(WebCore::CSSPrimitiveValue::operator EPageBreak):
(WebCore::CSSPrimitiveValue::operator EPosition):
(WebCore::CSSPrimitiveValue::operator EResize):
(WebCore::CSSPrimitiveValue::operator ETableLayout):
(WebCore::CSSPrimitiveValue::operator ETextAlign):
(WebCore::CSSPrimitiveValue::operator TextAlignLast):
(WebCore::CSSPrimitiveValue::operator TextJustify):
(WebCore::CSSPrimitiveValue::operator TextDecoration):
(WebCore::CSSPrimitiveValue::operator TextDecorationStyle):
(WebCore::CSSPrimitiveValue::operator TextUnderlinePosition):
(WebCore::CSSPrimitiveValue::operator ETextSecurity):
(WebCore::CSSPrimitiveValue::operator ETextTransform):
(WebCore::CSSPrimitiveValue::operator EUnicodeBidi):
(WebCore::CSSPrimitiveValue::operator EUserDrag):
(WebCore::CSSPrimitiveValue::operator EUserModify):
(WebCore::CSSPrimitiveValue::operator EUserSelect):
(WebCore::CSSPrimitiveValue::operator EVerticalAlign):
(WebCore::CSSPrimitiveValue::operator EVisibility):
(WebCore::CSSPrimitiveValue::operator EWhiteSpace):
(WebCore::CSSPrimitiveValue::operator EWordBreak):
(WebCore::CSSPrimitiveValue::operator EOverflowWrap):
(WebCore::CSSPrimitiveValue::operator TextDirection):
(WebCore::CSSPrimitiveValue::operator WritingMode):
(WebCore::CSSPrimitiveValue::operator TextCombine):
(WebCore::CSSPrimitiveValue::operator RubyPosition):
(WebCore::CSSPrimitiveValue::operator TextEmphasisPosition):
(WebCore::CSSPrimitiveValue::operator TextOverflow):
(WebCore::CSSPrimitiveValue::operator TextEmphasisFill):
(WebCore::CSSPrimitiveValue::operator TextEmphasisMark):
(WebCore::CSSPrimitiveValue::operator TextOrientation):
(WebCore::CSSPrimitiveValue::operator EPointerEvents):
(WebCore::CSSPrimitiveValue::operator FontDescription::Kerning):
(WebCore::CSSPrimitiveValue::operator FontSmoothingMode):
(WebCore::CSSPrimitiveValue::operator FontWeight):
(WebCore::CSSPrimitiveValue::operator FontItalic):
(WebCore::CSSPrimitiveValue::operator FontSmallCaps):
(WebCore::CSSPrimitiveValue::operator TextRenderingMode):
(WebCore::CSSPrimitiveValue::operator ColorSpace):
(WebCore::CSSPrimitiveValue::operator Hyphens):
(WebCore::CSSPrimitiveValue::operator LineSnap):
(WebCore::CSSPrimitiveValue::operator LineAlign):
(WebCore::CSSPrimitiveValue::operator Order):
(WebCore::CSSPrimitiveValue::operator ESpeak):
(WebCore::CSSPrimitiveValue::operator BlendMode):
(WebCore::CSSPrimitiveValue::operator LineCap):
(WebCore::CSSPrimitiveValue::operator LineJoin):
(WebCore::CSSPrimitiveValue::operator WindRule):
(WebCore::CSSPrimitiveValue::operator EAlignmentBaseline):
(WebCore::CSSPrimitiveValue::operator EBorderCollapse):
(WebCore::CSSPrimitiveValue::operator EBorderFit):
(WebCore::CSSPrimitiveValue::operator EImageRendering):
(WebCore::CSSPrimitiveValue::operator ETransformStyle3D):
(WebCore::CSSPrimitiveValue::operator ColumnAxis):
(WebCore::CSSPrimitiveValue::operator ColumnProgression):
(WebCore::CSSPrimitiveValue::operator WrapFlow):
(WebCore::CSSPrimitiveValue::operator WrapThrough):
(WebCore::CSSPrimitiveValue::operator GridAutoFlow):
(WebCore::CSSPrimitiveValue::operator EBufferedRendering):
(WebCore::CSSPrimitiveValue::operator EColorInterpolation):
(WebCore::CSSPrimitiveValue::operator EColorRendering):
(WebCore::CSSPrimitiveValue::operator EDominantBaseline):
(WebCore::CSSPrimitiveValue::operator EShapeRendering):
(WebCore::CSSPrimitiveValue::operator ETextAnchor):
(WebCore::CSSPrimitiveValue::operator SVGWritingMode):
(WebCore::CSSPrimitiveValue::operator EVectorEffect):
(WebCore::CSSPrimitiveValue::operator EMaskType):
Assert that the CSSPrimitiveValue is holding a CSSValueID before accessing it.

2:40 PM Changeset in webkit [153400] by akling@apple.com
  • 2 edits in trunk/Source/WTF

REGRESSION(r153380): Can't open messages on Gmail
https://bugs.webkit.org/show_bug.cgi?id=119165

Patch by Ryosuke Niwa <rniwa@webkit.org> on 2013-07-27
Reviewed by Andreas Kling.

This bug was caused by r153380. The bug doesn't reproduce as long as WebKit is built by clang 4.2 and later
or final is disabled (it could be clang 4.1 and later but we don't have information about that).

Fix the bug by disabling final on earlier versions of clang. Unfortunately we can only check versions of
Apple clang since clang_major and clang_minor are vendor dependent.

  • wtf/Compiler.h:
1:49 PM Changeset in webkit [153399] by weinig@apple.com
  • 4 edits
    2 adds in trunk

Stop pretending to support <string> for text-align.
https://bugs.webkit.org/show_bug.cgi?id=119107

Reviewed by Andreas Kling.

Source/WebCore:

Test: fast/css/text-align-string-crash.html

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseValue):
Stop pretending to support <string> for text-align.

  • css/DeprecatedStyleBuilder.cpp:

(WebCore::ApplyPropertyTextAlign::applyValue):
ASSERT that only value IDs get passed.

LayoutTests:

  • fast/css/text-align-string-crash-expected.txt: Added.
  • fast/css/text-align-string-crash.html: Added.

Jul 26, 2013:

9:48 PM Changeset in webkit [153398] by gyuyoung.kim@samsung.com
  • 5 edits in trunk/Source/WebCore

Introduce toSVGRectElement(), use it
https://bugs.webkit.org/show_bug.cgi?id=119126

Reviewed by Andreas Kling.

As a step to change static_cast with toSVGXXX, static_cast<SVGRectElement*> can
be changed with toSVGRectElement().

No new tests, no behavior change.

  • rendering/svg/RenderSVGRect.cpp:

(WebCore::RenderSVGRect::updateShapeFromElement):

  • rendering/svg/SVGPathData.cpp:

(WebCore::updatePathFromRectElement):

  • rendering/svg/SVGRenderTreeAsText.cpp:

(WebCore::operator<<):

  • svg/SVGRectElement.h:

(WebCore::toSVGRectElement):

6:17 PM Changeset in webkit [153397] by commit-queue@webkit.org
  • 4 edits in trunk/Source/WebCore

With frame flattening on, too many resize events fired if document is resized in onresize handler.
https://bugs.webkit.org/show_bug.cgi?id=119075

Patch by Yongjun Zhang <yongjun_zhang@apple.com> on 2013-07-26
Reviewed by Simon Fraser.

With http://trac.webkit.org/changeset/149287, WebCore also sends resize event in FrameView::setFrameRect. When
flattening an iframe, setFrameRect could be called multiple times from RenderFrameBase::layoutWithFlattening and
we could get multiple resize events. This patch adds a flag in FrameView to disallow sending resize events if
we are inside layoutWithFlattening. The resize event will be sent in performPostLayoutTasks after the iframe
is done laying out.

Manually tested by verifying the rendering slowness in www.hi-pda.com is fixed when frame flattening is enabled.

  • page/FrameView.cpp:

(WebCore::FrameView::FrameView):
(WebCore::FrameView::setFrameRect):

  • page/FrameView.h:

(WebCore::FrameView::setResizeEventAllowed):
(WebCore::FrameView::resizeEventAllowed):

  • rendering/RenderFrameBase.cpp:

(WebCore::RenderFrameBase::layoutWithFlattening):

5:57 PM Changeset in webkit [153396] by dino@apple.com
  • 10 edits
    2 adds in trunk

Allow new transitions to run even when controller is suspended
https://bugs.webkit.org/show_bug.cgi?id=119171
<rdar://problem/14511404>

Reviewed by Simon Fraser.

Source/WebCore:

Expose a new property on AnimationController that allows newly created
animations to run even if the controller says it is suspended. See WebKit
ChangeLog for more details.

Test: transitions/created-while-suspended.html

  • WebCore.exp.in: Export the new methods so WebView can use them.
  • page/animation/AnimationController.cpp:

(WebCore::AnimationControllerPrivate::AnimationControllerPrivate): Initialize new flag to false.
(WebCore::AnimationControllerPrivate::startAnimationsIfNotSuspended): Check new flag is not true.
(WebCore::AnimationControllerPrivate::setAllowsNewAnimationsWhileSuspended): Expose setter.
(WebCore::AnimationController::allowsNewAnimationsWhileSuspended): "Public" getter.
(WebCore::AnimationController::setAllowsNewAnimationsWhileSuspended): "Public" setter.

  • page/animation/AnimationController.h:
  • page/animation/AnimationControllerPrivate.h:

(WebCore::AnimationControllerPrivate::allowsNewAnimationsWhileSuspended):

  • page/animation/CompositeAnimation.cpp:

(WebCore::CompositeAnimation::CompositeAnimation): Only suspend if new flag is false. Everything else
relies on the m_suspended flag, so the real code change is this one line.

Source/WebKit/mac:

Expose a new SPI on WebView that triggers the (buggy) old behaviour
for animations, such that any newly created animations will start even
when the document is supposedly suspended. It turns out that client content was
unknowingly relying on this behaviour - e.g. suspending a view, loading a
bunch of new content, bringing the view on screen and then unsuspending. In this
situation, we were not running CSS transitions, because the page was suspended.
However, JS was still triggering them, and content was expecting a transitionEnd event.

  • WebView/WebView.mm:

(-[WebView allowsNewCSSAnimationsWhileSuspended]): Calls into AnimationController.
(-[WebView setAllowsNewCSSAnimationsWhileSuspended:]): Ditto.

  • WebView/WebViewPrivate.h: New methods listed above.

LayoutTests:

This is actually a test to make sure this fix didn't break anything. There is no
way to trigger the new behaviour from the test system (or from Safari).

5:24 PM Changeset in webkit [153395] by Lucas Forschler
  • 2 edits in branches/safari-537-branch/Source/WebKit/mac

Merged r153379. <rdar://problem/14554723>

5:22 PM Changeset in webkit [153394] by Lucas Forschler
  • 16 edits in branches/safari-537-branch/Source

Merged r153378. <rdar://problem/14549021>

4:54 PM Changeset in webkit [153393] by Lucas Forschler
  • 2 edits in branches/safari-537-branch/Source/WebCore

Merged r153349. <rdar://problem/14545393>

4:51 PM Changeset in webkit [153392] by Lucas Forschler
  • 3 edits
    2 copies in branches/safari-537-branch

Merged r153366. <rdar://problem/14556358>

4:48 PM Changeset in webkit [153391] by Lucas Forschler
  • 5 edits
    1 copy in branches/safari-537-branch

Merged r153344. <rdar://problem/13439291>

4:46 PM Changeset in webkit [153390] by Lucas Forschler
  • 5 edits
    1 copy in branches/safari-537-branch

Merged r153107. <rdar://problem/14494064>

4:43 PM Changeset in webkit [153389] by Lucas Forschler
  • 2 edits in branches/safari-537-branch/Source/WebCore

Merged r153102. <rdar://problem/14433205>

4:41 PM Changeset in webkit [153388] by Lucas Forschler
  • 2 edits in branches/safari-537-branch/Source/WebCore

Merged r152905. <rdar://problem/14489987>

4:19 PM Changeset in webkit [153387] by msaboff@apple.com
  • 2 edits in trunk/Source/WTF

ASSERT failure in wtf/CheckedBoolean.h line 43 on Windows
https://bugs.webkit.org/show_bug.cgi?id=119170

Reviewed by Michael Saboff.

Added a copy constructor to CheckedBoolean.

  • wtf/CheckedBoolean.h:

(CheckedBoolean::CheckedBoolean):

4:00 PM Changeset in webkit [153386] by commit-queue@webkit.org
  • 3 edits
    6 adds
    2 deletes in trunk/LayoutTests

[CSS Shapes] New positioning model: support for polygon shape-outside
https://bugs.webkit.org/show_bug.cgi?id=118085

Patch by Bem Jones-Bey <Bem Jones-Bey> on 2013-07-26
Reviewed by Dirk Schulze.

Update polygon tests to work for new positioning model and migrate
them to be W3C spec tests. Thus, they have been imported from the
CSSWG repository now.

  • TestExpectations: Remove skip for replaced test.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-polygon-000-expected.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-polygon-000.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-polygon-001-expected.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-polygon-001.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-polygon-002-expected.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-polygon-002.html: Added.
  • csswg/submitted/shapes/shape-outside/w3c-import.log:
  • fast/shapes/shape-outside-floats/shape-outside-floats-simple-polygon-expected.html: Removed.
  • fast/shapes/shape-outside-floats/shape-outside-floats-simple-polygon.html: Removed.
3:54 PM Changeset in webkit [153385] by achristensen@apple.com
  • 2 edits in trunk/Source/ThirdParty/ANGLE

Added module definition file for building libEGL.
https://bugs.webkit.org/show_bug.cgi?id=119162

Reviewed by Brent Fulgham.

  • ANGLE.vcxproj/libEGLCommon.props: Added reference to libEGL.def.
2:57 PM Changeset in webkit [153384] by Brent Fulgham
  • 2 edits in trunk/Source/WebCore

[Windows] Unreviewed build fix.

  • platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:

(WebCore::createMetadataKeyNames): Do not include Media Selection
synbols when building without Media Selection API.

2:21 PM Changeset in webkit [153383] by oliver@apple.com
  • 6 edits in trunk

REGRESSION(FTL?): Crashes in plugin tests
https://bugs.webkit.org/show_bug.cgi?id=119141

Reviewed by Michael Saboff.

Source/JavaScriptCore:

Re-export getStackTrace

  • interpreter/Interpreter.h:

Source/WebCore:

Getting the correct semantics to appease the inspector is fairly
awful with the iterator system. For the time being lets just revert
to requesting a full stack trace as we did in the past.

  • bindings/js/ScriptCallStackFactory.cpp:

(WebCore::createScriptCallStack):

LayoutTests:

Bring back plugin tests

  • platform/mac/TestExpectations:
2:17 PM Changeset in webkit [153382] by Brent Fulgham
  • 3 edits in trunk/Source/WebCore

[Windows] Unreviewed build fix.

Correct build when targeting a release that does not have the AVCF
Legible Output infrastructure.

  • platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h: Exclude

a soft-link target when the API doesn't exist.

  • platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:

Correct include options for non-Legible Output supporting environments.
(WebCore::MediaPlayerPrivateAVFoundationCF::processLegacyClosedCaptionsTracks):
Prevent build failure when building with legacy caption support.

2:12 PM Changeset in webkit [153381] by fpizlo@apple.com
  • 6 edits
    6 adds in trunk

REGRESSION: Crash when opening a message on Gmail
https://bugs.webkit.org/show_bug.cgi?id=119105

Source/JavaScriptCore:

Reviewed by Oliver Hunt and Mark Hahnenberg.

  • GetById patching in the DFG needs to be more disciplined about how it derives the slow path.


  • Fix some dumping code thread safety issues.
  • bytecode/CallLinkStatus.cpp:

(JSC::CallLinkStatus::dump):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpBytecode):

  • dfg/DFGRepatch.cpp:

(JSC::DFG::getPolymorphicStructureList):
(JSC::DFG::tryBuildGetByIDList):

LayoutTests:

Reviewed by Oliver Hunt and Mark Hahnenberg.

  • fast/js/dfg-get-by-id-unset-then-proto-less-warmup.html: Added.
  • fast/js/dfg-get-by-id-unset-then-proto-more-warmup.html: Added.
  • fast/js/dfg-get-by-id-unset-then-proto.html: Added.
  • fast/js/jsc-test-list
  • fast/js/script-tests/dfg-get-by-id-unset-then-proto-less-warmup.js: Added.

(foo):
(Blah):

  • fast/js/script-tests/dfg-get-by-id-unset-then-proto-more-warmup.js: Added.

(foo):
(Blah):

  • fast/js/script-tests/dfg-get-by-id-unset-then-proto.js: Added.

(foo):
(Blah):

1:41 PM Changeset in webkit [153380] by akling@apple.com
  • 102 edits in trunk

Apply FINAL to the RenderObject hierarchy.
<http://webkit.org/b/115977>

Mostly from Blink r148795 by <cevans@chromium.org>
<http://src.chromium.org/viewvc/blink?view=revision&revision=148795>

  • rendering/: Beat things with the FINAL stick.
  • WebCore.exp.in: Export a now-needed symbol.
1:39 PM Changeset in webkit [153379] by andersca@apple.com
  • 2 edits in trunk/Source/WebKit/mac

Add another method that we need to set aside subviews for
https://bugs.webkit.org/show_bug.cgi?id=119157
<rdar://problem/14554723>

Reviewed by Beth Dakin.

  • WebView/WebHTMLView.mm:

(-[WebHTMLView _recursive:displayRectIgnoringOpacity:inContext:topView:]):
(-[WebHTMLView _recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:]):

1:09 PM Changeset in webkit [153378] by timothy_horton@apple.com
  • 16 edits in trunk/Source

Add a mode where autosizing fixes the FrameView height to at least the WKView height
https://bugs.webkit.org/show_bug.cgi?id=119104
<rdar://problem/14549021>

Reviewed by Anders Carlsson.

  • WebCore.exp.in: Export FrameView::setAutoSizeFixedMinimumHeight.
  • page/FrameView.cpp:

(WebCore::FrameView::FrameView):
Initialize m_autoSizeFixedMinimumHeight to 0.

(WebCore::FrameView::autoSizeIfEnabled):
Increase the FrameView height to m_autoSizeFixedMinimumHeight if necessary,
and do another layout. Store the computed intrinsic content size.

(WebCore::FrameView::setAutoSizeFixedMinimumHeight): Added.

  • page/FrameView.h:

(WebCore::FrameView::autoSizingIntrinsicContentSize): Added.

  • Shared/WebPageCreationParameters.cpp:

(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):

  • Shared/WebPageCreationParameters.h:

Add autoSizingShouldExpandToViewHeight parameter.

  • UIProcess/API/mac/WKView.mm:

(-[WKView minimumWidthForAutoLayout]):
(-[WKView setMinimumWidthForAutoLayout:]):
Un-deprecate these as they're still useful if not sending a height.

(-[WKView shouldExpandToViewHeightForAutoLayout]):
(-[WKView setShouldExpandToViewHeightForAutoLayout:]):

  • UIProcess/API/mac/WKViewPrivate.h:

New property, forward to WebPageProxy.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::creationParameters):
(WebKit::WebPageProxy::setAutoSizingShouldExpandToViewHeight):

  • UIProcess/WebPageProxy.h:

(WebKit::WebPageProxy::autoSizingShouldExpandToViewHeight):
New property, forward to WebPage.

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:

(WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
If enabled, update the FrameView's autoSizeFixedMinimumHeight.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::WebPage):
(WebKit::WebPage::setAutoSizingShouldExpandToViewHeight):

  • WebProcess/WebPage/WebPage.h:

(WebKit::WebPage::autoSizingShouldExpandToViewHeight):
New property; if enabled, set FrameView's autoSizeFixedMinimumHeight,
otherwise reset it to 0.

  • WebProcess/WebPage/WebPage.messages.in:
  • WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:

(WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeTimerFired):
(WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
Retrieve intrinsic content size explicitly from the FrameView, as
it may not have used it as its final contentsSize if
autoSizeFixedMinimumHeight is set.

Set the WebPage's size in case the load is committed so that the
WebFrameLoaderClient doesn't reset us to the wrong size.

Update autoSizeFixedMinimumHeight if enabled when the view size changes.

12:19 PM Changeset in webkit [153377] by Brent Fulgham
  • 2 edits in trunk/Source/WebCore

[Windows] Remove workarounds now that rdar://problem/14390466 is fixed.
https://bugs.webkit.org/show_bug.cgi?id=119150

Reviewed by Anders Carlsson.

  • platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:

(WebCore::AVFWrapper::createPlayer): Remove workaround to add legible output
after player is created.
(WebCore::AVFWrapper::createPlayerItem): Remove workaround to delay adding
legible output until player is created.
(WebCore::AVFWrapper::platformLayer): Get rid of unused temporary.

12:06 PM Changeset in webkit [153376] by fpizlo@apple.com
  • 4 edits in trunk/Tools

WKTR should know about the JSC extensions to testRunner
https://bugs.webkit.org/show_bug.cgi?id=119154

Reviewed by Mark Hahnenberg and Geoffrey Garen.

This makes some fast/js tests pass.

  • WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
  • WebKitTestRunner/InjectedBundle/TestRunner.cpp:

(WTR::TestRunner::numberOfDFGCompiles):
(WTR::TestRunner::neverInlineFunction):

  • WebKitTestRunner/InjectedBundle/TestRunner.h:
11:17 AM Changeset in webkit [153375] by commit-queue@webkit.org
  • 2 edits in trunk/Source/JavaScriptCore

[mips] Fix LLINT build for mips backend
https://bugs.webkit.org/show_bug.cgi?id=119152

Patch by Balazs Kilvady <kilvadyb@homejinni.com> on 2013-07-26
Reviewed by Oliver Hunt.

  • offlineasm/mips.rb:
11:07 AM Changeset in webkit [153374] by mhahnenberg@apple.com
  • 4 edits
    3 adds in trunk

Setting a large numeric property on an object causes it to allocate a huge backing store
https://bugs.webkit.org/show_bug.cgi?id=118914

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

There are two distinct actions that we're trying to optimize for:

new Array(100000);

and:

a = [];
a[100000] = 42;

In the first case, the programmer has indicated that they expect this Array to be very big,
so they should get a contiguous array up until some threshold, above which we perform density
calculations to see if it is indeed dense enough to warrant being contiguous.

In the second case, the programmer hasn't indicated anything about the size of the Array, so
we should be more conservative and assume it should be sparse until we've proven otherwise.

Currently both of those cases are handled by MIN_SPARSE_ARRAY_INDEX. We should distinguish
between them for the purposes of not over-allocating large backing stores like we see on
http://www.peekanalytics.com/burgerjoints/

The way that we'll do this is to keep the MIN_SPARSE_ARRAY_INDEX for the first case, and
introduce a new heuristic for the second case. If we are putting to an index above a certain
threshold (say, 1000) and it is beyond the length of the array, then we will use a sparse
map instead. So for example, in the second case above the empty array has a blank indexing
type and a length of 0. We put-by-val to an index > 1000 and > a.length, so we'll use a sparse map.

This fix is ~800x speedup on the accompanying regression test :-o

  • runtime/ArrayConventions.h:

(JSC::indexIsSufficientlyBeyondLengthForSparseMap):

  • runtime/JSObject.cpp:

(JSC::JSObject::putByIndexBeyondVectorLengthWithoutAttributes):
(JSC::JSObject::putByIndexBeyondVectorLengthWithArrayStorage):
(JSC::JSObject::putByIndexBeyondVectorLength):
(JSC::JSObject::putDirectIndexBeyondVectorLengthWithArrayStorage):

LayoutTests:

Added new regression test for put-by-val-ing to a blank indexing type with a large index.
This fix is ~800x speedup on this regression test :-o

  • fast/js/regress/put-by-val-large-index-blank-indexing-type.html: Added.
  • fast/js/regress/script-tests/put-by-val-large-index-blank-indexing-type.js: Added.
9:22 AM Changeset in webkit [153373] by Brent Fulgham
  • 3 edits in trunk/Source/WebCore

[Windows] Unreviewed gardening.

  • WebCore.vcxproj/WebCore.vcxproj: Add missing header file to ease code viewing.
  • WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
8:19 AM Changeset in webkit [153372] by anilsson@rim.com
  • 2 edits in trunk/Source/WebCore

[BlackBerry] LayerTiler fails to render layer after waking up
https://bugs.webkit.org/show_bug.cgi?id=119146

Reviewed by George Staikos.

When the application is backgrounded, all tiles are freed up to
release memory back to the system. We also mark the contents as dirty
in LayerTiler::deleteTextures() so tiles will be repopulated when
waking up again.

The problem was caused by an optimization to avoid re-rendering tiles
repeatedly until the UI thread catches up with the fact that we have
indeed rendered those tiles (which will happen when the UI thread next
composites a frame).

When contents are dirty, we're not supposed to perform this
optimization (i.e. we're not supposed to skip rendering) because the
appearance of the layer has changed, so we do need to render those
tiles. Unfortunately, the code that was supposed to forget the list of
tiles rendered was in a conditional, "if (frontVisibility)", which
happened to be false sometimes when the app woke up again. So we ended
up perpetually skipping those render jobs, and the UI thread kept
yelling at us to render them.

Fixed by unconditionally dropping the list of tiles rendered when
contents are dirty.

This can't be detected without pixel tests, which BB DRT currently
doesn't support.

JIRA 452460

  • platform/graphics/blackberry/LayerTiler.cpp:

(WebCore::LayerVisibility::clearTilesRendered):
(WebCore::LayerTiler::updateTextureContentsIfNeeded):

7:41 AM Changeset in webkit [153371] by commit-queue@webkit.org
  • 3 edits in trunk/Source/JavaScriptCore

REGRESSION(FTL): Fix lots of crashes in sh4 baseline JIT.
https://bugs.webkit.org/show_bug.cgi?id=119148

Patch by Julien Brianceau <jbrianceau@nds.com> on 2013-07-26
Reviewed by Csaba Osztrogonác.

  • jit/JSInterfaceJIT.h: "secondArgumentRegister" is wrong for sh4.
  • llint/LowLevelInterpreter32_64.asm: "move t0, a0" is missing

in nativeCallTrampoline for sh4. Reuse MIPS implementation to avoid
code duplication.

3:33 AM Changeset in webkit [153370] by commit-queue@webkit.org
  • 2 edits in trunk/Source/JavaScriptCore

REGRESSION(FTL): Crash in sh4 baseline JIT.
https://bugs.webkit.org/show_bug.cgi?id=119138

Patch by Julien Brianceau <jbrianceau@nds.com> on 2013-07-26
Reviewed by Csaba Osztrogonác.

This crash is due to incomplete report of r150146 and r148474.

  • jit/JITStubsSH4.h:
1:34 AM Changeset in webkit [153369] by zandobersek@gmail.com
  • 2 edits in trunk/Source/JavaScriptCore

Unreviewed.

  • Target.pri: Adding missing DFG files to the Qt build.

Jul 25, 2013:

10:54 PM Changeset in webkit [153368] by Csaba Osztrogonác
  • 3 edits in trunk/Source/JavaScriptCore

GTK and Qt buildfix after the intrusive win buildfix r153360.

  • GNUmakefile.list.am:
  • Target.pri:
9:35 PM Changeset in webkit [153367] by rniwa@webkit.org
  • 3 edits in trunk/Source/WebCore

Remove unused HTMLTextFormControlElement::textRendererAfterUpdateLayout
https://bugs.webkit.org/show_bug.cgi?id=119121

Reviewed by Andreas Kling.

Merge https://chromium.googlesource.com/chromium/blink/+/3255ce725711707fe1fd18be91a6d06789517220.

  • html/HTMLTextFormControlElement.cpp:
  • html/HTMLTextFormControlElement.h:
8:59 PM Changeset in webkit [153366] by rniwa@webkit.org
  • 3 edits
    2 adds in trunk

Fix document leak when selection is created inside the document
https://bugs.webkit.org/show_bug.cgi?id=119122

Reviewed by Andreas Kling.

Source/WebCore:

Merge https://chromium.googlesource.com/chromium/blink/+/b908cb4c8da93316d787de31c93f2a43de332a10

The bug was caused by FrameSelection::m_previousCaretNode holding onto a Node, leaking its document.
Fixed the bug by explicitly clearing it in FrameSelection::prepareForDestruction.

Test: editing/selection/leak-document-with-selection-inside.html

  • editing/FrameSelection.cpp:

(WebCore::FrameSelection::prepareForDestruction):

LayoutTests:

Added a regression test.

  • editing/selection/leak-document-with-selection-inside-expected.txt: Added.
  • editing/selection/leak-document-with-selection-inside.html: Added.
6:48 PM Changeset in webkit [153365] by gyuyoung.kim@samsung.com
  • 2 edits in trunk/Source/JavaScriptCore

Unreviewed, fix build break after r153360.

  • CMakeLists.txt: Add CommonSlowPathsExceptions.cpp.
6:41 PM Changeset in webkit [153364] by roger_fong@apple.com
  • 6 edits in trunk/Source

Unreviewed build fix, AppleWin port.

6:35 PM Changeset in webkit [153363] by bshafiei@apple.com
  • 3 edits in branches/safari-537-branch/Tools

Merged r153353. <rdar://problem/13562022>

6:24 PM Changeset in webkit [153362] by commit-queue@webkit.org
  • 3 edits
    2 moves
    2 adds
    2 deletes in trunk/LayoutTests

[CSS Shapes] New positioning model: support for inset rectangle shape-outside
https://bugs.webkit.org/show_bug.cgi?id=118083

Patch by Bem Jones-Bey <Bem Jones-Bey> on 2013-07-25
Reviewed by Dirk Schulze.

Update inset-rectangle tests to work with new positioning model.
Removed some test cases that aren't really needed or aren't applicable
with the new model. These test cases live in the CSS WG's repo now, so
they've been imported here.

  • TestExpectations: Remove skip lines for replaced tests.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-inset-rectangle-000-expected.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-inset-rectangle-000.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-inset-rectangle-001-expected.html: Renamed from LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-simple-rounded-inset-rectangle-expected.html.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-inset-rectangle-001.html: Renamed from LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-simple-rounded-inset-rectangle.html.
  • csswg/submitted/shapes/shape-outside/w3c-import.log:
  • fast/shapes/shape-outside-floats/shape-outside-floats-simple-inset-rectangle-expected.html: Removed.
  • fast/shapes/shape-outside-floats/shape-outside-floats-simple-inset-rectangle.html: Removed.
5:40 PM Changeset in webkit [153361] by roger_fong@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

Unreviewed. Followup to r153360.

5:22 PM Changeset in webkit [153360] by msaboff@apple.com
  • 6 edits
    2 adds in trunk/Source/JavaScriptCore

[Windows] Speculative build fix.

Moved interpreterThrowInCaller() out of LLintExceptions.cpp into new CommonSlowPathsExceptions.cpp
that is always compiled. Made LLInt::returnToThrow() conditional on LLINT being enabled.
Roger will add the new files to Windows project in another checkin.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • llint/LLIntExceptions.cpp:
  • llint/LLIntExceptions.h:
  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • runtime/CommonSlowPaths.cpp:

(JSC::SLOW_PATH_DECL):

  • runtime/CommonSlowPathsExceptions.cpp: Added.

(JSC::CommonSlowPaths::interpreterThrowInCaller):

  • runtime/CommonSlowPathsExceptions.h: Added.
5:19 PM Changeset in webkit [153359] by Brent Fulgham
  • 3 edits in trunk/Source/JavaScriptCore

[Windows] Unreviewed build fix.

  • JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: Add missing IntendedStructureChange.h,.cpp and

parser/SourceCode.h,.cpp.

5:18 PM Changeset in webkit [153358] by Brent Fulgham
  • 7 edits in trunk/Source/WTF

[Windows] Unreviewed build fix.

  • WTF.vcxproj/WTF.vcxproj: Add missing SixCharacterHash.h,.cpp files.
  • WTF.vcxproj/WTF.vcxproj.filters: Ditto.
  • wtf/NumberOfCores.h: Add export macro to numberOfProcessorCores.
  • wtf/PrintStream.h: Add export macro to dumpCharacter.
  • wtf/SixCharacterHash.h: Add export macro to sixCharacterHashStringToInteger

and integerToSixCharacterHashString.

  • wtf/text/CString.h: Add export macro to hash and equal methods.

(WTF::CStringHash::hash): Add export macro.

5:13 PM Changeset in webkit [153357] by andersca@apple.com
  • 6 edits in trunk/Source/JavaScriptCore

ASSERT(m_vm->apiLock().currentThreadIsHoldingLock()); fails for Safari on current ToT
https://bugs.webkit.org/show_bug.cgi?id=119108

Reviewed by Mark Hahnenberg.

Add a currentThreadIsHoldingAPILock() function to VM that checks if the current thread is the exclusive API thread.

  • heap/CopiedSpace.cpp:

(JSC::CopiedSpace::tryAllocateSlowCase):

  • heap/Heap.cpp:

(JSC::Heap::protect):
(JSC::Heap::unprotect):
(JSC::Heap::collect):

  • heap/MarkedAllocator.cpp:

(JSC::MarkedAllocator::allocateSlowCase):

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::init):

  • runtime/VM.h:

(JSC::VM::currentThreadIsHoldingAPILock):

4:57 PM Changeset in webkit [153356] by akling@apple.com
  • 30 edits in trunk/Source

ChromeClient::focusedNodeChanged() should be focusedElementChanged().
<http://webkit.org/b/119110>

Reviewed by Anders Carlsson.

Source/WebCore:

Because only Elements can be focused.

  • dom/Document.cpp:

(WebCore::Document::setFocusedElement):

  • loader/EmptyClients.h:

(WebCore::EmptyChromeClient::focusedElementChanged):

  • page/Chrome.cpp:

(WebCore::Chrome::focusedElementChanged):

  • page/Chrome.h:
  • page/ChromeClient.h:

Source/WebKit/blackberry:

  • WebCoreSupport/ChromeClientBlackBerry.cpp:

(WebCore::ChromeClientBlackBerry::focusedElementChanged):

  • WebCoreSupport/ChromeClientBlackBerry.h:

Source/WebKit/efl:

  • WebCoreSupport/ChromeClientEfl.cpp:

(WebCore::ChromeClientEfl::focusedElementChanged):

  • WebCoreSupport/ChromeClientEfl.h:

Source/WebKit/gtk:

  • WebCoreSupport/ChromeClientGtk.cpp:

(WebKit::ChromeClient::focusedElementChanged):

  • WebCoreSupport/ChromeClientGtk.h:

Source/WebKit/mac:

  • WebCoreSupport/WebChromeClient.h:
  • WebCoreSupport/WebChromeClient.mm:

(WebChromeClient::focusedElementChanged):

Source/WebKit/qt:

  • WebCoreSupport/ChromeClientQt.cpp:

(WebCore::ChromeClientQt::focusedElementChanged):

  • WebCoreSupport/ChromeClientQt.h:

Source/WebKit/win:

  • WebCoreSupport/WebChromeClient.cpp:

(WebChromeClient::focusedElementChanged):

  • WebCoreSupport/WebChromeClient.h:

Source/WebKit/wince:

  • WebCoreSupport/ChromeClientWinCE.cpp:

(WebKit::ChromeClientWinCE::focusedElementChanged):

  • WebCoreSupport/ChromeClientWinCE.h:

Source/WebKit2:

  • WebProcess/WebCoreSupport/WebChromeClient.cpp:

(WebKit::WebChromeClient::focusedElementChanged):

  • WebProcess/WebCoreSupport/WebChromeClient.h:
4:23 PM Changeset in webkit [153355] by kseo@webkit.org
  • 12 edits in trunk/Source

[WK2][Soup] Add private browsing support
https://bugs.webkit.org/show_bug.cgi?id=118657

Reviewed by Gustavo Noronha Silva.

Source/WebCore:

Support private browsing by adding a method to create a private
browsing soup session. This private browsing session uses a
non-persistent cookie jar and does not use the disk cache feature.

No new tests. Covered by existing private browsing tests.

  • platform/network/NetworkStorageSession.h:

(WebCore::NetworkStorageSession::isPrivateBrowsingSession):
Add USE(SOUP) guard to isPrivateBrowsingSession() and m_isPrivate.

  • platform/network/ResourceHandle.h:

Add a factory method to create a private browsing session for soup.

  • platform/network/soup/CookieJarSoup.cpp:

(WebCore::createPrivateBrowsingCookieJar):

  • platform/network/soup/CookieJarSoup.h:

Add a method to create a non-persistent cookie jar for private browsing.

  • platform/network/soup/NetworkStorageSessionSoup.cpp:

(WebCore::NetworkStorageSession::NetworkStorageSession):
Initialize m_isPrivate to false.
(WebCore::NetworkStorageSession::createPrivateBrowsingSession):
Implement the method by invoking ResourceHandle::createPrivateBrowsingSession.

  • platform/network/soup/ResourceHandleSoup.cpp:

(WebCore::createSoupSession):
Extract common soup session creation code so that both defaultSession
and createPrivateBrowsingSession can use this function to create a soup
session.
(WebCore::ResourceHandle::defaultSession):
Change to use createSoupSession.
(WebCore::ResourceHandle::createPrivateBrowsingSession):
Create a session which uses a non-persistent cookie jar.

Source/WebKit2:

Support private browsing in WK2 by implementing private browsing
related methods in WebFrameNetworkingContext.

  • WebProcess/InjectedBundle/InjectedBundle.cpp:

(WebKit::InjectedBundle::setPrivateBrowsingEnabled):
Add USE(SOUP) guard.

  • WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:

Add private browsing support methods. Copied from the Mac port.
(WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
(WebKit::WebFrameNetworkingContext::destroyPrivateBrowsingSession):
(WebKit::WebFrameNetworkingContext::storageSession):
Check if the frame enables private browsing and return the private
browsing session.

  • WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h:
  • WebProcess/WebProcess.cpp:

(WebKit::WebProcess::ensurePrivateBrowsingSession):
Add USE(SOUP) guard.

4:14 PM Changeset in webkit [153354] by zandobersek@gmail.com
  • 2 edits in trunk/Source/JavaScriptCore

REGRESSION(FTL): Most layout tests crashes
https://bugs.webkit.org/show_bug.cgi?id=119089

Reviewed by Oliver Hunt.

  • runtime/ExecutionHarness.h:

(JSC::prepareForExecution): Move prepareForExecutionImpl call into its own statement. This prevents the GCC-compiled
code to create the PassOwnPtr<JSC::JITCode> (intended as a parameter to the installOptimizedCode call) from the jitCode
RefPtr<JSC::JITCode> parameter before the latter was actually given a proper value through the prepareForExecutionImpl call.
Currently it's created beforehand and therefor holds a null pointer before it's anchored as the JIT code in
JSC::CodeBlock::setJITCode, which later indirectly causes assertions in JSC::CodeBlock::jitCompile.
(JSC::prepareFunctionForExecution): Ditto for prepareFunctionForExecutionImpl.

4:07 PM Changeset in webkit [153353] by mrowe@apple.com
  • 3 edits in trunk/Tools

Fix build of DumpRenderTree and WebKitTestRunner when building against an SDK.

  • DumpRenderTree/mac/Configurations/Base.xcconfig: Fix framework search path when building against an SDK.
  • WebKitTestRunner/Configurations/Base.xcconfig: Ditto. Also fix where our scripts look for WebCore.framework

so they pull the version out of the SDK.

3:36 PM Changeset in webkit [153352] by kseo@webkit.org
  • 2 edits in trunk/Source/WebKit2

Build fix: use of long long in CoreIPC::ArgumentEncoder and CoreIPC::ArgumentDecoder
https://bugs.webkit.org/show_bug.cgi?id=118228

Reviewed by Anders Carlsson.

Build fails on some platforms where int64_t and long long are different types.

  • Shared/FileAPI/BlobRegistrationData.cpp:

(WebKit::BlobRegistrationData::encode):
Add explicit casts to int64_t.
(WebKit::BlobRegistrationData::decode):
Use int64_t instead of long long.

3:33 PM Changeset in webkit [153351] by Brent Fulgham
  • 2 edits in trunk/Source/JavaScriptCore

[Windows] Unreviewed build fix.

include path.

3:29 PM Changeset in webkit [153350] by zoltan@webkit.org
  • 5 edits in trunk/LayoutTests

[CSS Shapes] Add missing includes to shape-inside polygon tests
https://bugs.webkit.org/show_bug.cgi?id=119098

Reviewed by Dirk Schulze.

We need to include subpixel-utils.js for tests which use simple-polygon.js, since it uses
SubPixelLayout, otherwise both the result/expected are generating incorrect output.

  • fast/shapes/shape-inside/shape-inside-regular-polygon16-expected.html:
  • fast/shapes/shape-inside/shape-inside-regular-polygon16.html:
  • fast/shapes/shape-inside/shape-inside-regular-polygon8-expected.html:
  • fast/shapes/shape-inside/shape-inside-regular-polygon8.html:
3:25 PM Changeset in webkit [153349] by timothy_horton@apple.com
  • 2 edits in trunk/Source/WebCore

Null check m_frame in maximum and minimumScrollPosition
https://bugs.webkit.org/show_bug.cgi?id=119109
<rdar://problem/14545393>

Reviewed by Darin Adler.

  • page/FrameView.cpp:

(WebCore::FrameView::minimumScrollPosition):
(WebCore::FrameView::maximumScrollPosition):
Null-check m_frame (and move the early-return after the clamp-to-0
as the revert in r152911 should have).

2:48 PM Changeset in webkit [153348] by andersca@apple.com
  • 5 edits in trunk

Localizable.strings generated by extract-localizable-strings should be UTF-8
https://bugs.webkit.org/show_bug.cgi?id=119106

Reviewed by Mark Rowe.

Source/WebCore:

  • English.lproj/Localizable.strings:

Re-encode this as UTF-8 and remove the BOM.

  • WebCore.xcodeproj/project.pbxproj:

Set the file encoding of Localizable.strings to UTF-8.

Tools:

Output strings as UTF-8.

  • Scripts/extract-localizable-strings:
2:40 PM Changeset in webkit [153347] by rniwa@webkit.org
  • 3 edits
    2 adds in trunk

Don't force layout when querying a fixed or non-box margin/padding property
https://bugs.webkit.org/show_bug.cgi?id=118032

Reviewed by David Hyatt.

Source/WebCore:

Merge https://chromium.googlesource.com/chromium/blink/+/66427d0825fcc2975bd50220cdcaa2504d6f36e5.

This patch avoids layout in ComputedStyleExtractor::propertyValue for margin and padding properties
when they are of fixed length. According to the Blink patch's author, this improves the page load
time of economist.com by 27%.

The actual code change is significantly different from the original Blink patch since we've done
some refactorins in r152938 and r153067 to make this change more self-contained.

Test: fast/css/computed-width-without-renderer.html

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::zoomAdjustedPaddingOrMarginPixelValue):
(WebCore::paddingOrMarginIsRendererDependent):
(WebCore::isLayoutDependent):
(WebCore::ComputedStyleExtractor::propertyValue):

LayoutTests:

Add a regression test inspired by the one added in
https://chromium.googlesource.com/chromium/blink/+/ff234b1593b2b493d47f38f687d09a87bc42c9eb.

  • fast/css/computed-width-without-renderer-expected.txt: Added.
  • fast/css/computed-width-without-renderer.html: Added.
2:13 PM Changeset in webkit [153346] by achristensen@apple.com
  • 3 edits
    12 adds
    14 deletes in trunk/Source

Source/ThirdParty/ANGLE: Made Windows build system for ANGLE and removed existing broken build system.
Removed empty src/libGLESv2/shaders directory and old README files.
https://bugs.webkit.org/show_bug.cgi?id=119103

Reviewed by Brent Fulgham.

  • ANGLE.vcxproj: Added.
  • ANGLE.vcxproj/ANGLEGenerated.vcxproj: Added.
  • ANGLE.vcxproj/ANGLEGenerated.vcxproj.filters: Added.
  • ANGLE.vcxproj/libEGL.vcxproj: Added.
  • ANGLE.vcxproj/libEGL.vcxproj.filters: Added.
  • ANGLE.vcxproj/libEGLCommon.props: Added.
  • ANGLE.vcxproj/libGLESv2.vcxproj: Added.
  • ANGLE.vcxproj/libGLESv2.vcxproj.filters: Added.
  • ANGLE.vcxproj/libGLESv2Common.props: Added.
  • ANGLE.vcxproj/translator.vcxproj: Added.
  • ANGLE.vcxproj/translator.vcxproj.filters: Added.
  • ANGLE.vcxproj/translatorCommon.props: Added.
  • src/ANGLE.sln: Removed.
  • src/compiler/preprocessor/preprocessor.vcxproj: Removed.
  • src/compiler/preprocessor/preprocessor.vcxproj.filters: Removed.
  • src/compiler/translator_common.vcxproj: Removed.
  • src/compiler/translator_common.vcxproj.filters: Removed.
  • src/compiler/translator_hlsl.vcxproj: Removed.
  • src/compiler/translator_hlsl.vcxproj.filters: Removed.
  • src/libEGL/README: Removed.
  • src/libEGL/libEGL.vcxproj: Removed.
  • src/libEGL/libEGL.vcxproj.filters: Removed.
  • src/libGLESv2/README: Removed.
  • src/libGLESv2/libGLESv2.vcxproj: Removed.
  • src/libGLESv2/libGLESv2.vcxproj.filters: Removed.
  • src/libGLESv2/shaders: Removed.

Source/WebKit: Made Windows build system for ANGLE.
https://bugs.webkit.org/show_bug.cgi?id=119103

Reviewed by Brent Fulgham.

  • WebKit.vcxproj/WebKit.sln:

Added ANGLEGenerated, libEGL, libGLESv2, and translator projects.
These projects are currently not built.

1:56 PM Changeset in webkit [153345] by Brent Fulgham
  • 2 edits in trunk/Source/WTF

[Windows] Provide ASM implemenation of 8-bit compare-and-swap
https://bugs.webkit.org/show_bug.cgi?id=119084

Patch by peavo@outlook.com <peavo@outlook.com> on 2013-07-25
Reviewed by Brent Fulgham.

  • wtf/Atomics.h:

(WTF::weakCompareAndSwap): Add a 32-bit X86 Assembly path for
Windows build.

1:52 PM Changeset in webkit [153344] by weinig@apple.com
  • 5 edits
    1 add in trunk

-[WebHTMLView attributedSubstringForProposedRange:actualRange:] does not include strikethrough attribute in the returned attributed string
https://bugs.webkit.org/show_bug.cgi?id=119099
<rdar://problem/13439291>

Reviewed by Enrica Casucci.

Source/WebCore:

Tests:

API Test: AttributedStringTest_Strikethrough

  • platform/mac/HTMLConverter.mm:

(+[WebHTMLConverter editingAttributedStringFromRange:]):
Set the NSStrikethroughStyleAttributeName attribute when text-decoration: line-through is seen.

Tools:

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/mac/AttributedString.mm:

(TestWebKitAPI::attributedString):
(TestWebKitAPI::AttributedStringTest_CustomFont::didLoadURL):
(TestWebKitAPI::AttributedStringTest_CustomFont::url):
(TestWebKitAPI::AttributedStringTest_CustomFont::runTest):
(TestWebKitAPI::TEST_F):
(TestWebKitAPI::AttributedStringTest_Strikethrough::didLoadURL):
(TestWebKitAPI::AttributedStringTest_Strikethrough::url):
(TestWebKitAPI::AttributedStringTest_Strikethrough::runTest):

  • TestWebKitAPI/Tests/mac/attributedStringStrikethrough.html: Added.

Add tests for attributed strings with strikethrough. Refactor the attributed string tests
to make adding more easier in the future.

1:40 PM Changeset in webkit [153343] by Brent Fulgham
  • 3 edits in trunk/Source/JavaScriptCore

[Windows] Unreviewed build fix.

  • JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: Add some missing files:

runtime/VM.h,.cpp; Remove deleted JSGlobalData.h,.cpp.

1:37 PM Changeset in webkit [153342] by Brent Fulgham
  • 3 edits in trunk/Source/WTF

[Windows] Unreviewed build fix.

  • WTF.vcxproj/WTF.vcxproj: Add missing CompilationThread.h,.cpp
  • WTF.vcxproj/WTF.vcxproj.filters: Ditto.
1:22 PM Changeset in webkit [153341] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

Make all jit & non-jit combos build cleanly
https://bugs.webkit.org/show_bug.cgi?id=119102

Reviewed by Anders Carlsson.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::counterValueForOptimizeSoon):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::optimizeAfterWarmUp):
(JSC::CodeBlock::numberOfDFGCompiles):

1:19 PM Changeset in webkit [153340] by psolanki@apple.com
  • 2 edits in trunk/Source/WebCore

Unreviewed build fix after r153333.

  • platform/network/cf/ResourceResponseCFNet.cpp: Remove toTimeT since it is no longer called.
12:36 PM Changeset in webkit [153339] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

32 bit portion of load validation logic
https://bugs.webkit.org/show_bug.cgi?id=118878
Reviewed by NOBODY (Build fix).

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

12:05 PM Changeset in webkit [153338] by betravis@adobe.com
  • 2 edits in trunk/LayoutTests

[CSS Shapes] Fix typo in simple-polygon.js
https://bugs.webkit.org/show_bug.cgi?id=119096

Reviewed by Dirk Schulze.

A function name typo was preventing tests and expectations using simple-polygon.js
from generating correct output.

  • fast/shapes/resources/simple-polygon.js:

(polygonXIntercepts): Correctly camel-case function name.

11:20 AM Changeset in webkit [153337] by commit-queue@webkit.org
  • 3 edits
    4 moves in trunk/LayoutTests

[CSS Shapes] New positioning model: support for circle and ellipse shape-outside
https://bugs.webkit.org/show_bug.cgi?id=118084

Patch by Bem Jones-Bey <Bem Jones-Bey> on 2013-07-25
Reviewed by Dirk Schulze.

Update circle and ellipse tests to work with new positioning. These
have been rehomed as W3C spec tests, and thus are imported from the
CSSWG's repository.

  • TestExpectations: Remove skip for updated tests.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-circle-000-expected.html: Renamed from LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-simple-circle-expected.html.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-circle-000.html: Renamed from LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-simple-circle.html.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-ellipse-000-expected.html: Renamed from LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-simple-ellipse-expected.html.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-ellipse-000.html: Renamed from LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-simple-ellipse.html.
  • csswg/submitted/shapes/shape-outside/w3c-import.log:
11:11 AM Changeset in webkit [153336] by michael.bruning@digia.com
  • 2 edits in trunk/Source/WTF

Fix Windows build after r153134.
https://bugs.webkit.org/show_bug.cgi?id=119090

Reviewed by Oliver Hunt.

Add USE(PTHREADS) guards around pthread specific code
for now. This will cause isCompilationThread to always
return false on non pthread platforms such as Windows.

We might be able to use the Windows one-time initialization
for this, but this is only available from Windows Vista on.

  • wtf/CompilationThread.cpp:

(WTF::initializeCompilationThreads):

10:55 AM Changeset in webkit [153335] by Christophe Dumez
  • 2 edits in trunk/Source/WebCore

Unreviewed EFL build fix after r153315.

Fix build error after we started compiling with c++0x support
in r153315.

  • platform/efl/RenderThemeEfl.cpp:

(WebCore::toEdjeGroup):

10:10 AM Changeset in webkit [153334] by oliver@apple.com
  • 4 edits in trunk/Source/JavaScriptCore

More 32bit build fixes

10:10 AM Changeset in webkit [153333] by andersca@apple.com
  • 8 edits in trunk/Source

Remove lastModifiedDate from ResourceResponse
https://bugs.webkit.org/show_bug.cgi?id=119092

Reviewed by Andreas Kling.

Source/WebCore:

Computing m_lastResponseDate is costly on some platforms and we already have a better way to
get the last response time, so convert the two call sites that used to call ResourceresponseBase::lastModifiedDate()
over to using lastModified() instead.

  • platform/network/ResourceResponseBase.cpp:

(WebCore::ResourceResponseBase::ResourceResponseBase):
(WebCore::ResourceResponseBase::adopt):
(WebCore::ResourceResponseBase::copyData):

  • platform/network/ResourceResponseBase.h:
  • platform/network/cf/ResourceResponseCFNet.cpp:

(WebCore::ResourceResponse::platformLazyInit):

  • plugins/PluginStream.cpp:

(WebCore::lastModifiedDate):
(WebCore::PluginStream::startStream):

Source/WebKit2:

Update for WebCore changes.

  • WebProcess/Plugins/PluginView.cpp:

(WebKit::lastModifiedDate):
Use ResourceResponse::lastModified() to get the last modified date.

(WebKit::PluginView::Stream::didReceiveResponse):
Call the static lastModified function.

(WebKit::PluginView::manualLoadDidReceiveResponse):
Ditto.

10:10 AM Changeset in webkit [153332] by Christophe Dumez
  • 2 edits in trunk

Unreviewed EFL build fix after r153315.

Use -std=gnu++0x instead of -std=c++0x as we rely on GNU extensions such as
typeof().

  • Source/cmake/WebKitHelpers.cmake:
10:01 AM Changeset in webkit [153331] by commit-queue@webkit.org
  • 7 edits in trunk/Source

Optimize the thread locks for API Shims
https://bugs.webkit.org/show_bug.cgi?id=118573

Patch by Yi Shen <max.hong.shen@gmail.com> on 2013-07-25
Reviewed by Geoffrey Garen.

Remove the thread lock from API Shims if the VM has an exclusive thread (e.g. the VM
only used by WebCore's main thread).

Source/JavaScriptCore:

  • API/APIShims.h:

(JSC::APIEntryShim::APIEntryShim):
(JSC::APICallbackShim::APICallbackShim):

  • runtime/JSLock.cpp:

(JSC::JSLockHolder::JSLockHolder):
(JSC::JSLockHolder::init):
(JSC::JSLockHolder::~JSLockHolder):
(JSC::JSLock::DropAllLocks::DropAllLocks):
(JSC::JSLock::DropAllLocks::~DropAllLocks):

  • runtime/VM.cpp:

(JSC::VM::VM):

  • runtime/VM.h:

Source/WebCore:

No new tests required since no functionality changed.

  • bindings/js/JSDOMWindowBase.cpp:

(WebCore::JSDOMWindowBase::commonVM):

9:40 AM Changeset in webkit [153330] by betravis@adobe.com
  • 10 edits in trunk/Source/WebCore

[CSS Shapes] Shape methods and member variables should be guarded with the CSS_SHAPES flag
https://bugs.webkit.org/show_bug.cgi?id=117277

Reviewed by Alexandru Chiculita.

This patch adds some compile guards that were missing from the RenderStyle and
StyleRareNonInheritedData files. When the compile guard caused parameters to
not be used, the parameters were marked using UNUSED_PARAM.

  • css/CSSPropertyNames.in: Inserting a line to trigger build.
  • rendering/RenderBlock.cpp:

(WebCore::shapeInfoRequiresRelayout):
(WebCore::RenderBlock::updateRegionsAndShapesBeforeChildLayout):
(WebCore::RenderBlock::logicalRightFloatOffsetForLine):

  • rendering/RenderBox.cpp:

(WebCore::isCandidateForOpaquenessTest):

  • rendering/RenderBox.h:
  • rendering/RenderObject.h:
  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::changeRequiresLayout):
(WebCore::RenderStyle::changeRequiresRepaint):

  • rendering/style/RenderStyle.h:
  • rendering/style/StyleRareNonInheritedData.cpp:

(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):

  • rendering/style/StyleRareNonInheritedData.h:
9:38 AM Changeset in webkit [153329] by Christophe Dumez
  • 2 edits in trunk/Source/JavaScriptCore

Unreviewed build fix after r153218.

Broke the EFL port build with gcc 4.7.

  • interpreter/StackIterator.cpp:

(JSC::printif):

9:24 AM Changeset in webkit [153328] by commit-queue@webkit.org
  • 2 edits in trunk/Source/JavaScriptCore

Build fix: add missing #include.
https://bugs.webkit.org/show_bug.cgi?id=119087

Patch by Julien Brianceau <jbrianceau@nds.com> on 2013-07-25
Reviewed by Allan Sandfeld Jensen.

  • bytecode/ArrayProfile.cpp:
9:13 AM Changeset in webkit [153327] by Carlos Garcia Campos
  • 3 edits
    6 adds in trunk/Source/WebKit2

[GTK] Add support for running unit tests in the web process
https://bugs.webkit.org/show_bug.cgi?id=118427

Reviewed by Gustavo Noronha Silva.

Some tests, like GObject DOM bindings API tests, run entirely in
the WebProcess, so we just need to start the test from the UI
process and wait until the test finishes running in the
WebProcess. Tests are split in two files, one containing the
actual test that runs in the WebProcess and another one to add the
tests to the glib test system that works as a
proxy. WebProcessTestRunner class starts a private DBus session
bus and starts the tests sending a message to the WebExtension
waiting until it finishes or fails. WebProcess tests are created
by defining a class derived from WebProcessTest class and
implementing the static create method and the virtual runTest
method. The macro REGISTER_TEST is used by the web process tests
to register their test cases. This patch includes the migration
of the WebKitDOMNode test, all other GObject DOM bindings tests
will be migrated in the same way in follow up patches.

  • UIProcess/API/gtk/tests/DOMNodeTest.cpp: Added.

(WebKitDOMNodeTest::create): Create a new WebKitDOMNodeTest.
(WebKitDOMNodeTest::webPageFromArgs): Get the pageID parameter
from the arguments dictionary.
(WebKitDOMNodeTest::testHierarchyNavigation):
(WebKitDOMNodeTest::testInsertion):
(WebKitDOMNodeTest::runTest): Run the given test.
(registerTests): Register test cases.

  • UIProcess/API/gtk/tests/GNUmakefile.am: Add new files to

compilation.

  • UIProcess/API/gtk/tests/TestDOMNode.cpp: Added.

(testWebKitDOMNodeHierarchyNavigation):
(testWebKitDOMNodeInsertion):
(beforeAll):
(afterAll):

  • UIProcess/API/gtk/tests/TestMain.cpp:

(main): Unset DBUS_SESSION_BUS_ADDRESS environment variable to
make sure that the GLib bus singleton is initialized by the
private DBus session bus created by the tests.

  • UIProcess/API/gtk/tests/WebProcessTest.cpp: Added.

(testsMap): Initialize and get the global map of tests.
(WebProcessTest::add): Add a new test to the map, keeping a
function to create the test.
(WebProcessTest::create): Create a test for the given name.
(methodCallCallback): Handle RunTest DBus method. It creates and
runs the given test.
(webkit_web_extension_initialize):Register the DBus service for
this WebExtension.

  • UIProcess/API/gtk/tests/WebProcessTest.h: Added.
  • UIProcess/API/gtk/tests/WebProcessTestRunner.cpp: Added.

(WebProcessTestRunner::WebProcessTestRunner): Start a private DBus
session bus and get a connection to it.
(WebProcessTestRunner::~WebProcessTestRunner): Stop the private
DBus session bus.
(WebProcessTestRunner::proxyCreatedCallback):
(WebProcessTestRunner::proxy): Create a new proxy to send messages
to the WebExtension if it doesn't exists.
(WebProcessTestRunner::onNameAppeared): Called when the DBus
service has been registered in the WebExtension and it's safe to
create a proxy.
(WebProcessTestRunner::onNameVanished): Called when the DBus
service is unregistered. This happens when the web process crash,
so we just exit here, because the g_asserts in the web process
have already registered the error message.
(WebProcessTestRunner::testFinishedCallback): Called when the
WebProcess tests has finished.
(WebProcessTestRunner::runTest): Send a message to the
WebExtension to start the given test and monitor the service.
(WebProcessTestRunner::finishTest): Save the test result and
finish the main loop.

  • UIProcess/API/gtk/tests/WebProcessTestRunner.h: Added.
7:26 AM Changeset in webkit [153326] by allan.jensen@digia.com
  • 2 edits in trunk/Source/WTF

Fix windows build after FTL upstream

Unreviewed build fix.

  • wtf/Atomics.h:

(WTF::weakCompareAndSwap):

6:53 AM Changeset in webkit [153325] by ryuan.choi@samsung.com
  • 2 edits in trunk/Source/JavaScriptCore

Unreviewed, build fix on the EFL port.

  • CMakeLists.txt: Added JSCTestRunnerUtils.cpp.
6:50 AM Changeset in webkit [153324] by commit-queue@webkit.org
  • 2 edits in trunk/Source/JavaScriptCore

[sh4] Add missing store8(TrustedImm32, void*) implementation in baseline JIT.
https://bugs.webkit.org/show_bug.cgi?id=119083

Patch by Julien Brianceau <jbrianceau@nds.com> on 2013-07-25
Reviewed by Allan Sandfeld Jensen.

  • assembler/MacroAssemblerSH4.h:

(JSC::MacroAssemblerSH4::store8):

6:23 AM Changeset in webkit [153323] by allan.jensen@digia.com
  • 2 edits in trunk/Source/JavaScriptCore

[Qt] Fix test build after FTL upstream

Unreviewed build fix.

  • Target.pri:
6:11 AM Changeset in webkit [153322] by allan.jensen@digia.com
  • 3 edits in trunk/Source/JavaScriptCore

[Qt] Build fix after FTL.

Un Reviewed build fix.

  • Target.pri:
  • interpreter/StackIterator.cpp:

(JSC::StackIterator::Frame::print):

6:07 AM Changeset in webkit [153321] by rgabor@webkit.org
  • 2 edits in trunk/Source/JavaScriptCore

Unreviewed build fix after FTL upstream.

  • dfg/DFGWorklist.cpp:

(JSC::DFG::Worklist::~Worklist):

5:49 AM Changeset in webkit [153320] by kov@webkit.org
  • 2 edits in trunk/Source/WebCore/platform/gtk/po

[l10n] [mr] Updated WebKitGTK+ Translation(s) in Marathi [mr] language
https://bugs.webkit.org/show_bug.cgi?id=117282

Patch by Sandeep Shedmake <sandeep.shedmake@gmail.com> on 2013-07-25
Reviewed by Gustavo Noronha.

  • mr.po: Updated.
5:35 AM Changeset in webkit [153319] by ryuan.choi@samsung.com
  • 7 edits in trunk/Source

Unreviewed, build fix on the EFL port.

Source/JavaScriptCore:

  • CMakeLists.txt:

Added SourceCode.cpp and removed BlackBerry file.

  • jit/JITCode.h:

(JSC::JITCode::nextTierJIT):
Fixed to build break because of -Werror=return-type

  • parser/Lexer.cpp: Includes JSFunctionInlines.h
  • runtime/JSScope.h:

(JSC::makeType):
Fixed to build break because of -Werror=return-type

Source/WTF:

  • wtf/CMakeLists.txt: Added SixCharacterHash.cpp
5:31 AM Changeset in webkit [153318] by kadam@inf.u-szeged.hu
  • 2 edits in trunk/Source/JavaScriptCore

Unreviewed build fixing after FTL upstream.

  • runtime/Executable.cpp:

(JSC::FunctionExecutable::produceCodeBlockFor):

5:29 AM Changeset in webkit [153317] by commit-queue@webkit.org
  • 2 edits in trunk/Source/JavaScriptCore

Add missing implementation of bxxxnz in sh4 LLINT.
https://bugs.webkit.org/show_bug.cgi?id=119079

Patch by Julien Brianceau <jbrianceau@nds.com> on 2013-07-25
Reviewed by Allan Sandfeld Jensen.

  • offlineasm/sh4.rb:
5:18 AM Changeset in webkit [153316] by rgabor@webkit.org
  • 4 edits in trunk/Source

Unreviewed, build fix on the Qt port.

Source/JavaScriptCore:

  • Target.pri: Add additional build files for the FTL.

Source/WTF:

  • WTF.pro: Add additional build files for the FTL.
5:09 AM Changeset in webkit [153315] by ryuan.choi@samsung.com
  • 2 edits in trunk

[CMAKE] Enforce c++0x for cmake based ports
https://bugs.webkit.org/show_bug.cgi?id=119081

Reviewed by Gyuyoung Kim.

  • Source/cmake/WebKitHelpers.cmake:

Enforce c++0x for all cmake based ports to fix build break.

5:04 AM Changeset in webkit [153314] by kadam@inf.u-szeged.hu
  • 2 edits in trunk/Source/JavaScriptCore

Unreviewed buildfix after FTL upstream..

  • interpreter/StackIterator.cpp:

(JSC::StackIterator::Frame::codeType):
(JSC::StackIterator::Frame::functionName):
(JSC::StackIterator::Frame::sourceURL):
(JSC::StackIterator::Frame::logicalFrame):

4:23 AM Changeset in webkit [153313] by zandobersek@gmail.com
  • 2 edits in trunk/Source/JavaScriptCore

Unreviewed.

  • heap/CopyVisitor.cpp: Include CopiedSpaceInlines header so the CopiedSpace::recycleEvacuatedBlock

method is not left undefined, causing build failures on (at least) the GTK port.

4:19 AM Changeset in webkit [153312] by zandobersek@gmail.com
  • 5 edits in trunk/Source

Source/JavaScriptCore: Unreviewed, further build fixing on the GTK port.

  • GNUmakefile.list.am: Add CompilationResult source files to the build.

Source/WTF: Unreviewed, further GTK build fixing.

  • GNUmakefile.am: Make libWTF.la depend on any changes made to the build targets list.
  • GNUmakefile.list.am: Add SixCharacterHash source files to the build.
3:54 AM Changeset in webkit [153311] by zandobersek@gmail.com
  • 3 edits in trunk/Source/JavaScriptCore

Unreviewed GTK build fixing.

  • GNUmakefile.am: Make the shared libjsc library depend on any changes to the build target list.
  • GNUmakefile.list.am: Add additional build targets for files that were introduced by the FTL branch merge.
3:51 AM Changeset in webkit [153310] by Csaba Osztrogonác
  • 2 edits in trunk/Source/JavaScriptCore

Buildfix after this error:
error: 'pathName' may be used uninitialized in this function [-Werror=uninitialized]

  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::compileInThread):

3:46 AM Changeset in webkit [153309] by Csaba Osztrogonác
  • 2 edits in trunk/Source/WTF

[GTK] Similar fix to r153304.

  • GNUmakefile.list.am:
3:42 AM Changeset in webkit [153308] by Csaba Osztrogonác
  • 2 edits in trunk/Source/JavaScriptCore

One more buildfix after FTL upstream.

Return a dummy value after RELEASE_ASSERT_NOT_REACHED() to make GCC happy.

  • dfg/DFGLazyJSValue.cpp:

(JSC::DFG::LazyJSValue::getValue):
(JSC::DFG::LazyJSValue::strictEqual):

3:24 AM Changeset in webkit [153307] by commit-queue@webkit.org
  • 3 edits in trunk/Source/JavaScriptCore

Fix "Unhandled opcode localAnnotation" build error in sh4 and mips LLINT.
https://bugs.webkit.org/show_bug.cgi?id=119076

Patch by Julien Brianceau <jbrianceau@nds.com> on 2013-07-25
Reviewed by Allan Sandfeld Jensen.

  • offlineasm/mips.rb:
  • offlineasm/sh4.rb:
2:51 AM Changeset in webkit [153306] by zandobersek@gmail.com
  • 2 edits in trunk/Source/JavaScriptCore

Unreviewed GTK build fix.

  • GNUmakefile.list.am: Adding JSCTestRunnerUtils files to the build.
2:29 AM Changeset in webkit [153305] by zandobersek@gmail.com
  • 1 edit
    1 add in trunk/Source/JavaScriptCore

Unreviewed. Further build fixing for the GTK port. Adding the forwarding header
for JSCTestRunnerUtils.h as required by the DumpRenderTree compilation.

  • ForwardingHeaders/JavaScriptCore/JSCTestRunnerUtils.h: Added.
2:27 AM Changeset in webkit [153304] by g.czajkowski@samsung.com
  • 2 edits in trunk/Source/WTF

Build break in debug after r153134: StringImpl.h:640: undefined reference to `WTF::isCompilationThread()
https://bugs.webkit.org/show_bug.cgi?id=119077

Reviewed by Christophe Dumez.

  • wtf/CMakeLists.txt:

Added CompilationThread.{h/cpp}.

2:08 AM Changeset in webkit [153303] by zandobersek@gmail.com
  • 3 edits in trunk/Source/JavaScriptCore

Unreviewed. Fixing the GTK build after the FTL merging by updating the build targets list.

  • GNUmakefile.am:
  • GNUmakefile.list.am:
1:34 AM Changeset in webkit [153302] by kadam@inf.u-szeged.hu
  • 2 edits in trunk/Source/JavaScriptCore

Unreviewed buildfix after FTL upstream.

  • runtime/JSScope.h:

(JSC::needsVarInjectionChecks):

12:53 AM Changeset in webkit [153301] by Csaba Osztrogonác
  • 4 edits in trunk/Source/JavaScriptCore

One more fix after FTL upstream.

  • Target.pri:
  • bytecode/CodeBlock.h:
  • bytecode/GetByIdStatus.h:

(JSC::GetByIdStatus::GetByIdStatus):

Jul 24, 2013:

11:09 PM Changeset in webkit [153300] by Csaba Osztrogonác
  • 3 edits in trunk/Source/JavaScriptCore

Unreviewed buildfix after FTL upstream.

Add ftl directory as include path.

10:59 PM Changeset in webkit [153299] by Csaba Osztrogonác
  • 3 edits in trunk/Source/JavaScriptCore

Unreviewed buildfix after FTL upstream for non C++11 builds.

  • interpreter/CallFrame.h:
  • interpreter/StackIteratorPrivate.h:

(JSC::StackIterator::end):

10:02 PM Changeset in webkit [153298] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

Endeavour to fix CMakelist builds

9:36 PM Changeset in webkit [153297] by gyuyoung.kim@samsung.com
  • 5 edits in trunk/Source/WebCore

Introduce toSVGPatternElement(), use it
https://bugs.webkit.org/show_bug.cgi?id=119013

Reviewed by Andreas Kling.

As a step to change static_cast with toSVGXXX, static_cast<SVGPatternElement*> can
be changed with toSVGPatternElement().

Merge from https://src.chromium.org/viewvc/blink?view=rev&revision=154734

  • rendering/svg/RenderSVGResourcePattern.cpp:

(WebCore::RenderSVGResourcePattern::buildPattern):

  • rendering/svg/SVGRenderTreeAsText.cpp:

(WebCore::writeSVGResourceContainer):

  • rendering/svg/SVGResources.cpp:

(WebCore::targetReferenceFromResource):

  • svg/SVGPatternElement.h:

(WebCore::toSVGPatternElement):

9:05 PM Changeset in webkit [153296] by oliver@apple.com
  • 39 edits
    5 copies
    1 add in trunk/Source

fourthTier: DFG IR dumps should be easier to read
https://bugs.webkit.org/show_bug.cgi?id=119050

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

Added a DumpContext that includes support for printing an endnote
that describes all structures in full, while the main flow of the
dump just uses made-up names for the structures. This is helpful
since Structure::dump() may print a lot. The stuff it prints is
useful, but if it's all inline with the surrounding thing you're
dumping (often, a node in the DFG), then you get a ridiculously
long print-out. All classes that dump structures (including
Structure itself) now have dumpInContext() methods that use
inContext() for dumping anything that might transitively print a
structure. If Structure::dumpInContext() is called with a NULL
context, it just uses dump() like before. Hence you don't have to
know anything about DumpContext unless you want to.

inContext(*structure, context) dumps something like %B4:Array,
and the endnote will have something like:

%B4:Array = 0x10e91a180:[Array, {Edge:100, Normal:101, Line:102, NumPx:103, LastPx:104}, ArrayWithContiguous, Proto:0x10e99ffe0]

where B4 is the inferred name that StringHashDumpContext came up
with.

Also shortened a bunch of other dumps, removing information that
isn't so important.

(JSC::dumpArrayModes):

  • bytecode/CodeBlockHash.cpp:

(JSC):
(JSC::CodeBlockHash::CodeBlockHash):
(JSC::CodeBlockHash::dump):

  • bytecode/CodeOrigin.cpp:

(JSC::CodeOrigin::dumpInContext):
(JSC):
(JSC::InlineCallFrame::dumpInContext):
(JSC::InlineCallFrame::dump):

  • bytecode/CodeOrigin.h:

(CodeOrigin):
(InlineCallFrame):

  • bytecode/Operands.h:

(JSC::OperandValueTraits::isEmptyForDump):
(Operands):
(JSC::Operands::dump):
(JSC):

  • bytecode/OperandsInlines.h: Added.

(JSC):
(JSC::::dumpInContext):

  • bytecode/StructureSet.h:

(JSC::StructureSet::dumpInContext):
(JSC::StructureSet::dump):
(StructureSet):

  • dfg/DFGAbstractValue.cpp:

(JSC::DFG::AbstractValue::dump):
(DFG):
(JSC::DFG::AbstractValue::dumpInContext):

  • dfg/DFGAbstractValue.h:

(JSC::DFG::AbstractValue::operator!):
(AbstractValue):

  • dfg/DFGCFAPhase.cpp:

(JSC::DFG::CFAPhase::performBlockCFA):

  • dfg/DFGCommon.cpp:
  • dfg/DFGCommon.h:

(JSC::DFG::NodePointerTraits::isEmptyForDump):

  • dfg/DFGDisassembler.cpp:

(JSC::DFG::Disassembler::createDumpList):

  • dfg/DFGDisassembler.h:

(Disassembler):

  • dfg/DFGFlushFormat.h:

(WTF::inContext):
(WTF):

  • dfg/DFGFlushLivenessAnalysisPhase.cpp:
  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dumpCodeOrigin):
(JSC::DFG::Graph::dump):
(JSC::DFG::Graph::dumpBlockHeader):

  • dfg/DFGGraph.h:

(Graph):

  • dfg/DFGLazyJSValue.cpp:

(JSC::DFG::LazyJSValue::dumpInContext):
(JSC::DFG::LazyJSValue::dump):
(DFG):

  • dfg/DFGLazyJSValue.h:

(LazyJSValue):

  • dfg/DFGNode.h:

(JSC::DFG::nodeMapDump):
(WTF::inContext):
(WTF):

  • dfg/DFGOSRExitCompiler32_64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGOSRExitCompiler64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGStructureAbstractValue.h:

(JSC::DFG::StructureAbstractValue::dumpInContext):
(JSC::DFG::StructureAbstractValue::dump):
(StructureAbstractValue):

  • ftl/FTLExitValue.cpp:

(JSC::FTL::ExitValue::dumpInContext):
(JSC::FTL::ExitValue::dump):
(FTL):

  • ftl/FTLExitValue.h:

(ExitValue):

  • ftl/FTLLowerDFGToLLVM.cpp:
  • ftl/FTLValueSource.cpp:

(JSC::FTL::ValueSource::dumpInContext):
(FTL):

  • ftl/FTLValueSource.h:

(ValueSource):

  • runtime/DumpContext.cpp: Added.

(JSC):
(JSC::DumpContext::DumpContext):
(JSC::DumpContext::~DumpContext):
(JSC::DumpContext::isEmpty):
(JSC::DumpContext::dump):

  • runtime/DumpContext.h: Added.

(JSC):
(DumpContext):

  • runtime/JSCJSValue.cpp:

(JSC::JSValue::dump):
(JSC):
(JSC::JSValue::dumpInContext):

  • runtime/JSCJSValue.h:

(JSC):
(JSValue):

  • runtime/Structure.cpp:

(JSC::Structure::dumpInContext):
(JSC):
(JSC::Structure::dumpBrief):
(JSC::Structure::dumpContextHeader):

  • runtime/Structure.h:

(JSC):
(Structure):

Source/WTF:

Reviewed by Mark Hahnenberg.

Added support for dumping values within a context. By default, if you say
print(inContext(value, context)) it calls value.dumpInContext(out, context)
instead of value.dump(out).

Hoisted the support for six-character hashes out of JSC::CodeBlockHash into
WTF, in the form of SixCharacterHash.h.

Added a helper for creating dump contexts where the inContext() dump will
just use a short string hash to "name" the object being dumped, and then
will print out the full dumps in an endnote to your dump.

Added support for using CString as a hashtable key.

  • WTF.xcodeproj/project.pbxproj:
  • wtf/PrintStream.h:

(WTF):
(ValueInContext):
(WTF::ValueInContext::ValueInContext):
(WTF::ValueInContext::dump):
(WTF::inContext):

  • wtf/SixCharacterHash.cpp: Added.

(WTF):
(WTF::sixCharacterHashStringToInteger):
(WTF::integerToSixCharacterHashString):

  • wtf/SixCharacterHash.h: Added.

(WTF):

  • wtf/StringHashDumpContext.h: Added.

(WTF):
(StringHashDumpContext):
(WTF::StringHashDumpContext::StringHashDumpContext):
(WTF::StringHashDumpContext::getID):
(WTF::StringHashDumpContext::dumpBrief):
(WTF::StringHashDumpContext::brief):
(WTF::StringHashDumpContext::isEmpty):
(WTF::StringHashDumpContext::dump):

  • wtf/text/CString.cpp:

(WTF::CString::hash):
(WTF):
(WTF::operator<):
(WTF::CStringHash::equal):

  • wtf/text/CString.h:

(WTF::CString::CString):
(CString):
(WTF::CString::isHashTableDeletedValue):
(WTF):
(WTF::CStringHash::hash):
(CStringHash):

9:05 PM Changeset in webkit [153295] by oliver@apple.com
  • 13 edits
    4 copies
    1 add in trunk/Source/JavaScriptCore

fourthTier: DFG should do a high-level LICM before going to FTL
https://bugs.webkit.org/show_bug.cgi?id=118749

Reviewed by Oliver Hunt.

Implements LICM hoisting for nodes that never write anything and never read
things that are clobbered by the loop. There are some other preconditions for
hoisting, see DFGLICMPhase.cpp.

Also did a few fixes:

  • ClobberSet::add was failing to switch Super entries to Direct entries in some cases.
  • DFGClobberize.cpp needed to #include "Operations.h".
  • DCEPhase needs to process the graph in reverse DFS order, when we're in SSA.
  • AbstractInterpreter can now execute a Node without knowing its indexInBlock. Knowing the indexInBlock is an optional optimization that all other clients of AI still opt into, but LICM doesn't.

This makes the FTL a 2.19x speed-up on imaging-gaussian-blur.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • dfg/DFGAbstractInterpreter.h:

(AbstractInterpreter):

  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::::executeEffects):
(JSC::DFG::::execute):
(DFG):
(JSC::DFG::::clobberWorld):
(JSC::DFG::::clobberStructures):

  • dfg/DFGAtTailAbstractState.cpp: Added.

(DFG):
(JSC::DFG::AtTailAbstractState::AtTailAbstractState):
(JSC::DFG::AtTailAbstractState::~AtTailAbstractState):
(JSC::DFG::AtTailAbstractState::createValueForNode):
(JSC::DFG::AtTailAbstractState::forNode):

  • dfg/DFGAtTailAbstractState.h: Added.

(DFG):
(AtTailAbstractState):
(JSC::DFG::AtTailAbstractState::initializeTo):
(JSC::DFG::AtTailAbstractState::forNode):
(JSC::DFG::AtTailAbstractState::variables):
(JSC::DFG::AtTailAbstractState::block):
(JSC::DFG::AtTailAbstractState::isValid):
(JSC::DFG::AtTailAbstractState::setDidClobber):
(JSC::DFG::AtTailAbstractState::setIsValid):
(JSC::DFG::AtTailAbstractState::setBranchDirection):
(JSC::DFG::AtTailAbstractState::setFoundConstants):
(JSC::DFG::AtTailAbstractState::haveStructures):
(JSC::DFG::AtTailAbstractState::setHaveStructures):

  • dfg/DFGBasicBlock.h:

(JSC::DFG::BasicBlock::insertBeforeLast):

  • dfg/DFGBasicBlockInlines.h:

(DFG):

  • dfg/DFGClobberSet.cpp:

(JSC::DFG::ClobberSet::add):
(JSC::DFG::ClobberSet::addAll):

  • dfg/DFGClobberize.cpp:

(JSC::DFG::doesWrites):

  • dfg/DFGClobberize.h:

(DFG):

  • dfg/DFGDCEPhase.cpp:

(JSC::DFG::DCEPhase::DCEPhase):
(JSC::DFG::DCEPhase::run):
(JSC::DFG::DCEPhase::fixupBlock):
(DCEPhase):

  • dfg/DFGEdgeDominates.h: Added.

(DFG):
(EdgeDominates):
(JSC::DFG::EdgeDominates::EdgeDominates):
(JSC::DFG::EdgeDominates::operator()):
(JSC::DFG::EdgeDominates::result):
(JSC::DFG::edgesDominate):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::FixupPhase::checkArray):

  • dfg/DFGLICMPhase.cpp: Added.

(LICMPhase):
(JSC::DFG::LICMPhase::LICMPhase):
(JSC::DFG::LICMPhase::run):
(JSC::DFG::LICMPhase::attemptHoist):
(DFG):
(JSC::DFG::performLICM):

  • dfg/DFGLICMPhase.h: Added.

(DFG):

  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::compileInThreadImpl):

9:05 PM Changeset in webkit [153294] by oliver@apple.com
  • 5 edits
    6 adds in trunk/Source

fourthTier: DFG Nodes should be able to abstractly tell you what they read and what they write
https://bugs.webkit.org/show_bug.cgi?id=118910

Source/JavaScriptCore:

Reviewed by Sam Weinig.

Add the notion of AbstractHeap to the DFG. This is analogous to the AbstractHeap in
the FTL, except that the FTL's AbstractHeaps are used during LLVM lowering and are
engineered to obey LLVM TBAA logic. The FTL's AbstractHeaps are also engineered to
be inexpensive to use (they just give you a TBAA node) but expensive to create (you
create them all up front). FTL AbstractHeaps also don't actually give you the
ability to reason about aliasing; they are *just* a mechanism for lowering to TBAA.
The DFG's AbstractHeaps are engineered to be both cheap to create and cheap to use.
They also give you aliasing machinery. The DFG AbstractHeaps are represented
internally by a int64_t. Many comparisons between them are just integer comaprisons.
AbstractHeaps form a three-level hierarchy (World is the supertype of everything,
Kind with a TOP payload is a direct subtype of World, and Kind with a non-TOP
payload is the direct subtype of its corresponding TOP Kind).

Add the notion of a ClobberSet. This is the set of AbstractHeaps that you had
clobbered. It represents the set that results from unifying a bunch of
AbstractHeaps, and is intended to quickly answer overlap questions: does the given
AbstractHeap overlap any AbstractHeap in the ClobberSet? To this end, if you add an
AbstractHeap to a set, it "directly" adds the heap itself, and "super" adds all of
its ancestors. An AbstractHeap is said to overlap a set if any direct or super
member is equal to it, or if any of its ancestors are equal to a direct member.

Example #1:

  • I add Variables(5). I.e. Variables is the Kind and 5 is the payload. This is a subtype of Variables, which is a subtype of World.
  • You query Variables. I.e. Variables with a TOP payload, which is the supertype of Variables(X) for any X, and a subtype of World.

The set will have Variables(5) as a direct member, and Variables and World as
super members. The Variables query will immediately return true, because
Variables is indeed a super member.

Example #2:

  • I add Variables(5)
  • You query NamedProperties

NamedProperties is not a member at all (neither direct or super). We next
query World. World is a member, but it's a super member, so we return false.

Example #3:

  • I add Variables
  • You query Variables(5)

The set will have Variables as a direct member, and World as a super member.
The Variables(5) query will not find Variables(5) in the set, but then it
will query Variables. Variables is a direct member, so we return true.

Example #4:

  • I add Variables
  • You query NamedProperties(5)

Neither NamedProperties nor NamedProperties(5) are members. We next query
World. World is a member, but it's a super member, so we return false.

Overlap queries require that either the heap being queried is in the set (either
direct or super), or that one of its ancestors is a direct member. Another way to
think about how this works is that two heaps A and B are said to overlap if
A.isSubtypeOf(B) or B.isSubtypeOf(A). This is sound since heaps form a
single-inheritance heirarchy. Consider that we wanted to implement a set that holds
heaps and answers the question, "is any member in the set an ancestor (i.e.
supertype) of some other heap". We would have the set contain the heaps themselves,
and we would satisfy the query "A.isSubtypeOfAny(set)" by walking the ancestor
chain of A, and repeatedly querying its membership in the set. This is what the
"direct" members of our set do. Now consider the other part, where we want to ask if
any member of the set is a descendent of a heap, or "A.isSupertypeOfAny(set)". We
would implement this by implementing set.add(B) as adding not just B but also all of
B's ancestors; then we would answer A.isSupertypeOfAny(set) by just checking if A is
in the set. With two such sets - one that answers isSubtypeOfAny() and another that
answers isSupertypeOfAny() - we could answer the "do any of my heaps overlap your
heap" question. ClobberSet does this, but combines the two sets into a single
HashMap. The HashMap's value, "direct", means that the key is a member of both the
supertype set and the subtype set; if it's false then it's only a member of one of
them.

Finally, this adds a functorized clobberize() method that adds the read and write
clobbers of a DFG::Node to read and write functors. Common functors for adding to
ClobberSets, querying overlap, and doing nothing are provided. Convenient wrappers
are also provided. This allows you to say things like:

ClobberSet set;
addWrites(graph, node1, set);
if (readsOverlap(graph, node2, set))

We know that node1 may write to something that node2 may read from.

Currently this facility is only used to improve graph dumping, but it will be
instrumental in both LICM and GVN. In the future, I want to completely kill the
NodeClobbersWorld and NodeMightClobber flags, and eradicate CSEPhase's hackish way
of accomplishing almost exactly what AbstractHeap gives you.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • dfg/DFGAbstractHeap.cpp: Added.

(DFG):
(JSC::DFG::AbstractHeap::Payload::dump):
(JSC::DFG::AbstractHeap::dump):
(WTF):
(WTF::printInternal):

  • dfg/DFGAbstractHeap.h: Added.

(DFG):
(AbstractHeap):
(Payload):
(JSC::DFG::AbstractHeap::Payload::Payload):
(JSC::DFG::AbstractHeap::Payload::top):
(JSC::DFG::AbstractHeap::Payload::isTop):
(JSC::DFG::AbstractHeap::Payload::value):
(JSC::DFG::AbstractHeap::Payload::valueImpl):
(JSC::DFG::AbstractHeap::Payload::operator==):
(JSC::DFG::AbstractHeap::Payload::operator!=):
(JSC::DFG::AbstractHeap::Payload::operator<):
(JSC::DFG::AbstractHeap::Payload::isDisjoint):
(JSC::DFG::AbstractHeap::Payload::overlaps):
(JSC::DFG::AbstractHeap::AbstractHeap):
(JSC::DFG::AbstractHeap::operator!):
(JSC::DFG::AbstractHeap::kind):
(JSC::DFG::AbstractHeap::payload):
(JSC::DFG::AbstractHeap::isDisjoint):
(JSC::DFG::AbstractHeap::overlaps):
(JSC::DFG::AbstractHeap::supertype):
(JSC::DFG::AbstractHeap::hash):
(JSC::DFG::AbstractHeap::operator==):
(JSC::DFG::AbstractHeap::operator!=):
(JSC::DFG::AbstractHeap::operator<):
(JSC::DFG::AbstractHeap::isHashTableDeletedValue):
(JSC::DFG::AbstractHeap::payloadImpl):
(JSC::DFG::AbstractHeap::encode):
(JSC::DFG::AbstractHeapHash::hash):
(JSC::DFG::AbstractHeapHash::equal):
(AbstractHeapHash):
(WTF):

  • dfg/DFGClobberSet.cpp: Added.

(DFG):
(JSC::DFG::ClobberSet::ClobberSet):
(JSC::DFG::ClobberSet::~ClobberSet):
(JSC::DFG::ClobberSet::add):
(JSC::DFG::ClobberSet::addAll):
(JSC::DFG::ClobberSet::contains):
(JSC::DFG::ClobberSet::overlaps):
(JSC::DFG::ClobberSet::clear):
(JSC::DFG::ClobberSet::direct):
(JSC::DFG::ClobberSet::super):
(JSC::DFG::ClobberSet::dump):
(JSC::DFG::ClobberSet::setOf):
(JSC::DFG::addReads):
(JSC::DFG::addWrites):
(JSC::DFG::addReadsAndWrites):
(JSC::DFG::readsOverlap):
(JSC::DFG::writesOverlap):

  • dfg/DFGClobberSet.h: Added.

(DFG):
(ClobberSet):
(JSC::DFG::ClobberSet::isEmpty):
(ClobberSetAdd):
(JSC::DFG::ClobberSetAdd::ClobberSetAdd):
(JSC::DFG::ClobberSetAdd::operator()):
(ClobberSetOverlaps):
(JSC::DFG::ClobberSetOverlaps::ClobberSetOverlaps):
(JSC::DFG::ClobberSetOverlaps::operator()):
(JSC::DFG::ClobberSetOverlaps::result):

  • dfg/DFGClobberize.cpp: Added.

(DFG):
(JSC::DFG::didWrites):

  • dfg/DFGClobberize.h: Added.

(DFG):
(JSC::DFG::clobberize):
(NoOpClobberize):
(JSC::DFG::NoOpClobberize::NoOpClobberize):
(JSC::DFG::NoOpClobberize::operator()):
(CheckClobberize):
(JSC::DFG::CheckClobberize::CheckClobberize):
(JSC::DFG::CheckClobberize::operator()):
(JSC::DFG::CheckClobberize::result):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dump):

Source/WTF:

Reviewed by Sam Weinig.

Fix compile goof in sortedListDump().

  • wtf/ListDump.h:

(WTF::sortedListDump):

Conflicts:

Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

9:05 PM Changeset in webkit [153293] by oliver@apple.com
  • 4 edits in trunk/Source/JavaScriptCore

fourthTier: It should be easy to figure out which blocks nodes belong to
https://bugs.webkit.org/show_bug.cgi?id=118957

Reviewed by Sam Weinig.

  • dfg/DFGGraph.cpp:

(DFG):
(JSC::DFG::Graph::initializeNodeOwners):

  • dfg/DFGGraph.h:

(Graph):

  • dfg/DFGNode.h:
9:05 PM Changeset in webkit [153292] by oliver@apple.com
  • 18 edits in trunk/Source/JavaScriptCore

fourthTier: NodeExitsForward shouldn't be duplicated in NodeType
https://bugs.webkit.org/show_bug.cgi?id=118956

Reviewed by Sam Weinig.

We had two way of expressing that something exits forward: the NodeExitsForward
flag and the word 'Forward' in the NodeType. That's kind of dumb. This patch
makes it just be a flag.

  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::::executeEffects):

  • dfg/DFGArgumentsSimplificationPhase.cpp:

(JSC::DFG::ArgumentsSimplificationPhase::run):

  • dfg/DFGCSEPhase.cpp:

(JSC::DFG::CSEPhase::int32ToDoubleCSE):
(JSC::DFG::CSEPhase::checkStructureElimination):
(JSC::DFG::CSEPhase::structureTransitionWatchpointElimination):
(JSC::DFG::CSEPhase::putStructureStoreElimination):
(JSC::DFG::CSEPhase::checkArrayElimination):
(JSC::DFG::CSEPhase::performNodeCSE):

  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::foldConstants):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::FixupPhase::injectInt32ToDoubleNode):

  • dfg/DFGMinifiedNode.h:

(JSC::DFG::belongsInMinifiedGraph):
(JSC::DFG::MinifiedNode::hasChild):

  • dfg/DFGNode.h:

(JSC::DFG::Node::convertToStructureTransitionWatchpoint):
(JSC::DFG::Node::hasStructureSet):
(JSC::DFG::Node::hasStructure):
(JSC::DFG::Node::hasArrayMode):
(JSC::DFG::Node::willHaveCodeGenOrOSR):

  • dfg/DFGNodeType.h:

(DFG):
(JSC::DFG::needsOSRForwardRewiring):

  • dfg/DFGPredictionPropagationPhase.cpp:

(JSC::DFG::PredictionPropagationPhase::propagate):

  • dfg/DFGSafeToExecute.h:

(JSC::DFG::safeToExecute):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileInt32ToDouble):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGTypeCheckHoistingPhase.cpp:

(JSC::DFG::TypeCheckHoistingPhase::run):
(JSC::DFG::TypeCheckHoistingPhase::identifyRedundantStructureChecks):
(JSC::DFG::TypeCheckHoistingPhase::identifyRedundantArrayChecks):

  • dfg/DFGVariableEventStream.cpp:

(JSC::DFG::VariableEventStream::reconstruct):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode):

9:05 PM Changeset in webkit [153291] by oliver@apple.com
  • 10 edits in trunk/Source/JavaScriptCore

fourthTier: It should be possible for a DFG::Node to claim to exit to one CodeOrigin, but then claim that it belongs to a different CodeOrigin for all other purposes
https://bugs.webkit.org/show_bug.cgi?id=118946

Reviewed by Geoffrey Garen.

We want to decouple the exit target code origin of a node from the code origin
for all other purposes. The purposes of code origins are:

  • Where the node will exit, if it exits. The exit target should be consistent with the surrounding nodes, in that if you just looked at the code origins of nodes in the graph, they would be consistent with the code origins in bytecode. This is necessary for live-at-bytecode analyses to work, and to preserve the original bytecode semantics when exiting.
  • What kind of code the node came from, for semantics thingies. For example, we might use the code origin to find the node's global object for doing an original array check. Or we might use it to determine if the code is in strict mode. Or other similar things. When we use the code origin in this way, we're basically using it as a way of describing the node's meta-data without putting it into the node directly, to save space. In the absurd extreme you could imagine nodes not even having NodeTypes or NodeFlags, and just using the CodeOrigin to determine what bytecode the node originated from. We won't do that, but you can think of this use of code origins as just a way of compressing meta-data.
  • What code origin we should supply profiling to, if we exit. This is closely related to the semantics thingies, in that the exit profiling is a persistent kind of semantic meta-data that survives between recompiles, and the only way to do that is to ascribe it to the original bytecode via the code origin.

If we hoist a node, we need to change the exit target code origin, but we must not
change the code origin for other purposes. The best way to do this is to decouple
the two kinds of code origin.

OSR exit data structures already do this, because they may edit the exit target
code origin while keeping the code origin for profiling intact. This happens for
forward exits. So, we just need to thread separation all the way back to DFG::Node.
That's what this patch does.

  • dfg/DFGNode.h:

(JSC::DFG::Node::Node):
(Node):

  • dfg/DFGOSRExit.cpp:

(JSC::DFG::OSRExit::OSRExit):

  • dfg/DFGOSRExitBase.h:

(JSC::DFG::OSRExitBase::OSRExitBase):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileCurrentBlock):
(JSC::DFG::SpeculativeJIT::checkArgumentTypes):

  • dfg/DFGSpeculativeJIT.h:

(SpeculativeJIT):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::appendOSRExit):
(LowerDFGToLLVM):

  • ftl/FTLOSRExit.cpp:

(JSC::FTL::OSRExit::OSRExit):

  • ftl/FTLOSRExit.h:

(OSRExit):

9:05 PM Changeset in webkit [153290] by oliver@apple.com
  • 6 edits
    1 add in trunk/Source/JavaScriptCore

fourthTier: each DFG node that relies on other nodes to do their type checks should be able to tell you if those type checks happened
https://bugs.webkit.org/show_bug.cgi?id=118866

Reviewed by Sam Weinig.

Adds a safeToExecute() method that takes a node and an abstract state and tells you
if the node will run without crashing under that state.

(JSC::CodeBlock::CodeBlock):

  • dfg/DFGCFAPhase.cpp:

(CFAPhase):
(JSC::DFG::CFAPhase::CFAPhase):
(JSC::DFG::CFAPhase::run):
(JSC::DFG::CFAPhase::performBlockCFA):
(JSC::DFG::CFAPhase::performForwardCFA):

  • dfg/DFGSafeToExecute.h: Added.

(DFG):
(SafeToExecuteEdge):
(JSC::DFG::SafeToExecuteEdge::SafeToExecuteEdge):
(JSC::DFG::SafeToExecuteEdge::operator()):
(JSC::DFG::SafeToExecuteEdge::result):
(JSC::DFG::safeToExecute):

  • dfg/DFGStructureAbstractValue.h:

(JSC::DFG::StructureAbstractValue::isValidOffset):
(StructureAbstractValue):

  • runtime/Options.h:

(JSC):

9:05 PM Changeset in webkit [153289] by oliver@apple.com
  • 9 edits
    3 adds in trunk

fourthTier: FTL should be able to generate LLVM IR that uses an intrinsic for OSR exit
https://bugs.webkit.org/show_bug.cgi?id=118948

Source/JavaScriptCore:

Reviewed by Sam Weinig.

  • Add the ability to generate LLVM IR but then not use it, via --llvmAlwaysFails=true. This allows doing "what if" experiments with IR generation, even if the generated IR can't yet execute.
  • Add an OSR exit path that just calls an intrinsic that combines the branch and the off-ramp.

(JSC::DFG::Plan::compileInThreadImpl):

  • ftl/FTLFail.cpp: Added.

(FTL):
(JSC::FTL::fail):

  • ftl/FTLFail.h: Added.

(FTL):

  • ftl/FTLIntrinsicRepository.h:

(FTL):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::appendOSRExit):
(JSC::FTL::LowerDFGToLLVM::emitOSRExitCall):

  • runtime/Options.h:

(JSC):

Tools:

Reviewed by Sam Weinig.

  • Make ReducedFTL capable of dealing with code that uses the fake OSR exit intrinsic, by exporting it as a function.
  • Make combineModules.rb idempotent. Sometimes it's convenient to run a file through it even if you know that you've already done so. See processIRDump.sh.
  • Add a script, processIRDump.sh, that takes the output of --dumpLLVMIR=true and runs it through ReducedFTL automatically. You typically want to say something like:

jsc --dumpLLVMIR=true <program(s)> > jsc-output.txt
./processIRDump.sh --timing < jsc-output.txt

  • ReducedFTL/ReducedFTL.c:

(webkit_osr_exit):

  • ReducedFTL/combineModules.rb:
  • ReducedFTL/processIRDump.sh: Added.
9:05 PM Changeset in webkit [153288] by oliver@apple.com
  • 2 edits in trunk/Tools

fourthTier: We should use the no-asserts build of LLVM if that's what the user configured
https://bugs.webkit.org/show_bug.cgi?id=118947

Reviewed by Dan Bernstein.

  • Scripts/copy-webkitlibraries-to-product-directory:
9:05 PM Changeset in webkit [153287] by oliver@apple.com
  • 4 edits
    1 add in trunk/Source/JavaScriptCore

fourthTier: StringObjectUse uses structures, and CSE should know that
https://bugs.webkit.org/show_bug.cgi?id=118940

Reviewed by Geoffrey Garen.

This is asymptomatic right now, but we should fix it.

(JSC::DFG::CSEPhase::putStructureStoreElimination):

  • dfg/DFGEdgeUsesStructure.h: Added.

(DFG):
(EdgeUsesStructure):
(JSC::DFG::EdgeUsesStructure::EdgeUsesStructure):
(JSC::DFG::EdgeUsesStructure::operator()):
(JSC::DFG::EdgeUsesStructure::result):
(JSC::DFG::edgesUseStructure):

  • dfg/DFGUseKind.h:

(DFG):
(JSC::DFG::usesStructure):

Conflicts:

Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

9:05 PM Changeset in webkit [153286] by oliver@apple.com
  • 9 edits
    13 adds in trunk

fourthTier: String GetByVal out-of-bounds handling is so wrong
https://bugs.webkit.org/show_bug.cgi?id=118935

Source/JavaScriptCore:

Reviewed by Geoffrey Garen.

Bunch of String GetByVal out-of-bounds fixes:

  • Even if the string proto chain is sane, we need to watch out for negative indices. They may get values or call getters in the prototypes, since proto sanity doesn't check for negative indexed properties, as they are not technically indexed properties.
  • GetByVal String out-of-bounds does in fact clobberWorld(). CSE should be given this information.
  • GetByVal String out-of-bounds does in fact clobberWorld(). CFA should be given this information.

Also fixed some other things:

  • If the DFG is disabled, the testRunner should pretend that we've done a bunch of DFG compiles. That's necessary to prevent the tests from timing out.
  • Disassembler shouldn't try to dump source code since it's not safe in the concurrent JIT.
  • API/JSCTestRunnerUtils.cpp:

(JSC::numberOfDFGCompiles):

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::::executeEffects):

  • dfg/DFGDisassembler.cpp:

(JSC::DFG::Disassembler::dumpHeader):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::byValIsPure):

  • dfg/DFGSaneStringGetByValSlowPathGenerator.h: Added.

(DFG):
(SaneStringGetByValSlowPathGenerator):
(JSC::DFG::SaneStringGetByValSlowPathGenerator::SaneStringGetByValSlowPathGenerator):
(JSC::DFG::SaneStringGetByValSlowPathGenerator::generateInternal):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileGetByValOnString):

LayoutTests:

Reviewed by Geoffrey Garen.

  • fast/js/dfg-string-out-of-bounds-check-structure-expected.txt: Added.
  • fast/js/dfg-string-out-of-bounds-check-structure.html: Added.
  • fast/js/dfg-string-out-of-bounds-cse-expected.txt: Added.
  • fast/js/dfg-string-out-of-bounds-cse.html: Added.
  • fast/js/dfg-string-out-of-bounds-negative-check-structure-expected.txt: Added.
  • fast/js/dfg-string-out-of-bounds-negative-check-structure.html: Added.
  • fast/js/dfg-string-out-of-bounds-negative-proto-value-expected.txt: Added.
  • fast/js/dfg-string-out-of-bounds-negative-proto-value.html: Added.
  • fast/js/jsc-test-list:
  • fast/js/script-tests/dfg-string-out-of-bounds-check-structure.js: Added.

(foo):

  • fast/js/script-tests/dfg-string-out-of-bounds-cse.js: Added.

(foo):

  • fast/js/script-tests/dfg-string-out-of-bounds-negative-check-structure.js: Added.

(foo):
(while):

  • fast/js/script-tests/dfg-string-out-of-bounds-negative-proto-value.js: Added.

(foo):

9:05 PM Changeset in webkit [153285] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: Structure::isValidOffset() should be able to tell you if you're loading a valid JSValue, and not just not crashing
https://bugs.webkit.org/show_bug.cgi?id=118911

Reviewed by Geoffrey Garen.

We could also have a separate method like "willNotCrash(offset)", but that's not
what isValidOffset() is intended to mean.

  • runtime/Structure.h:

(JSC::Structure::isValidOffset):

9:05 PM Changeset in webkit [153284] by oliver@apple.com
  • 13 edits in trunk/Source/JavaScriptCore

fourthTier: Structure should be able to tell you if it's valid to load at a given offset from any object with that structure
https://bugs.webkit.org/show_bug.cgi?id=118878

Reviewed by Oliver Hunt.

  • Change Structure::isValidOffset() to actually answer the question "If I attempted to load from an object of this structure, at this offset, would I commit suicide or would I get back some kind of value?"
  • Change StorageAccessData::offset to use a PropertyOffset. It should have been that way from the start.
  • Fix PutStructure so that it sets haveStructures in all of the cases that it should.
  • Make GetByOffset also reference the base object in addition to the butterfly.

The future use of this power will be to answer questions like "If I hoisted this
GetByOffset or PutByOffset to this point, would it cause crashes, or would it be
fine?"

I don't currently plan to use this power to perform validation, since the CSE has
the power to eliminate CheckStructure's that the CFA wouldn't be smart enough to
remove - both in the case of StructureSets where size >= 2 and in the case of
CheckStructures that match across PutStructures. At first I tried to write a
validator that was aware of this, but the validation code got way too complicated
and I started having nightmares of spurious assertion bugs being filed against me.

This also changes some of the code for how we hash FunctionExecutable's for debug
dumps, since that code still had some thread-safety issues. Basically, the
concurrent JIT needs to use the CodeBlock's precomputed hash and never call anything
that could transitively try to compute the hash from the source code. The source
code is a string that may be lazily computed, and that involves all manner of thread
unsafe things.

  • bytecode/CodeOrigin.cpp:

(JSC::InlineCallFrame::hash):

  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::::executeEffects):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleGetByOffset):
(JSC::DFG::ByteCodeParser::handlePutByOffset):
(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGCFAPhase.cpp:

(JSC::DFG::CFAPhase::performBlockCFA):

  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::foldConstants):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGGraph.h:

(StorageAccessData):

  • dfg/DFGNode.h:

(JSC::DFG::Node::convertToGetByOffset):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileGetByOffset):
(JSC::FTL::LowerDFGToLLVM::compilePutByOffset):

  • runtime/FunctionExecutableDump.cpp:

(JSC::FunctionExecutableDump::dump):

  • runtime/Structure.h:

(Structure):
(JSC::Structure::isValidOffset):

9:05 PM Changeset in webkit [153283] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: AbstractInterpreter should explicitly ask AbstractState to create new AbstractValues for newly born nodes
https://bugs.webkit.org/show_bug.cgi?id=118880

Reviewed by Sam Weinig.

It should be possible to have an AbstractState that is backed by a HashMap. But to
do this, the AbstractInterpreter should explicitly ask for new nodes to be added to
the map, since otherwise the idiom of getting a reference to the AbstractValue
returned by forNode() would cause really subtle memory corruption bugs.

  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::::executeEffects):

  • dfg/DFGInPlaceAbstractState.h:

(JSC::DFG::InPlaceAbstractState::createValueForNode):
(InPlaceAbstractState):

9:05 PM Changeset in webkit [153282] by oliver@apple.com
  • 11 edits
    2 moves
    3 adds in trunk/Source/JavaScriptCore

fourthTier: Decouple the way that CFA stores its state from the way it does abstract interpretation
https://bugs.webkit.org/show_bug.cgi?id=118835

Reviewed by Oliver Hunt.

This separates AbstractState into two things:

  • InPlaceAbstractState, which can tell you the abstract state of anything you might care about, and uses the old AbstractState's algorithms and data structures for doing so.
  • AbstractInterpreter<AbstractStateType>, which can execute a DFG::Node* with respect to an AbstractStateType. Currently we always use AbstractStateType = InPlaceAbstractState. But we could drop in an other class that supports basic primitives like forNode() and variables().

This is important because:

  • We want to hoist things out of loops.
  • We don't know what things rely on what type checks.
  • We only want to hoist type checks out of loops if they aren't clobbered.
  • We may want to still hoist things that depended on those type checks, if it's safe to do those things based on the CFA state at the tail of the loop pre-header.
  • We don't want things to rely on their type checks by way of a token, because that's just weird.

So, we want to be able to have a special form of the CFA that can
incrementally update a basic block's state-at-tail, and we want to be able to
do this for multiple blocks simultaneously. This requires *not* storing the
per-node state in the nodes themselves, but instead using the at-tail HashMap
directly.

Hence we need to have a way of making the abstract interpreter (i.e.
AbstractState::execute) polymorphic with respect to state representation. Put
another way, we need to separate the way that abstract state is represented
from the way DFG IR is abstractly interpreted.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • dfg/DFGAbstractInterpreter.h: Added.

(DFG):
(AbstractInterpreter):
(JSC::DFG::AbstractInterpreter::forNode):
(JSC::DFG::AbstractInterpreter::variables):
(JSC::DFG::AbstractInterpreter::needsTypeCheck):
(JSC::DFG::AbstractInterpreter::filterEdgeByUse):
(JSC::DFG::AbstractInterpreter::filter):
(JSC::DFG::AbstractInterpreter::filterArrayModes):
(JSC::DFG::AbstractInterpreter::filterByValue):
(JSC::DFG::AbstractInterpreter::trySetConstant):
(JSC::DFG::AbstractInterpreter::filterByType):

  • dfg/DFGAbstractInterpreterInlines.h: Added.

(DFG):
(JSC::DFG::::AbstractInterpreter):
(JSC::DFG::::~AbstractInterpreter):
(JSC::DFG::::booleanResult):
(JSC::DFG::::startExecuting):
(JSC::DFG::::executeEdges):
(JSC::DFG::::verifyEdge):
(JSC::DFG::::verifyEdges):
(JSC::DFG::::executeEffects):
(JSC::DFG::::execute):
(JSC::DFG::::clobberWorld):
(JSC::DFG::::clobberCapturedVars):
(JSC::DFG::::clobberStructures):
(JSC::DFG::::dump):
(JSC::DFG::::filter):
(JSC::DFG::::filterArrayModes):
(JSC::DFG::::filterByValue):

  • dfg/DFGAbstractState.cpp: Removed.
  • dfg/DFGAbstractState.h: Removed.
  • dfg/DFGArgumentsSimplificationPhase.cpp:
  • dfg/DFGCFAPhase.cpp:

(JSC::DFG::CFAPhase::CFAPhase):
(JSC::DFG::CFAPhase::performBlockCFA):
(CFAPhase):

  • dfg/DFGCFGSimplificationPhase.cpp:
  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::ConstantFoldingPhase):
(JSC::DFG::ConstantFoldingPhase::foldConstants):
(ConstantFoldingPhase):

  • dfg/DFGInPlaceAbstractState.cpp: Added.

(DFG):
(JSC::DFG::InPlaceAbstractState::InPlaceAbstractState):
(JSC::DFG::InPlaceAbstractState::~InPlaceAbstractState):
(JSC::DFG::InPlaceAbstractState::beginBasicBlock):
(JSC::DFG::setLiveValues):
(JSC::DFG::InPlaceAbstractState::initialize):
(JSC::DFG::InPlaceAbstractState::endBasicBlock):
(JSC::DFG::InPlaceAbstractState::reset):
(JSC::DFG::InPlaceAbstractState::mergeStateAtTail):
(JSC::DFG::InPlaceAbstractState::merge):
(JSC::DFG::InPlaceAbstractState::mergeToSuccessors):
(JSC::DFG::InPlaceAbstractState::mergeVariableBetweenBlocks):

  • dfg/DFGInPlaceAbstractState.h: Added.

(DFG):
(InPlaceAbstractState):
(JSC::DFG::InPlaceAbstractState::forNode):
(JSC::DFG::InPlaceAbstractState::variables):
(JSC::DFG::InPlaceAbstractState::block):
(JSC::DFG::InPlaceAbstractState::didClobber):
(JSC::DFG::InPlaceAbstractState::isValid):
(JSC::DFG::InPlaceAbstractState::setDidClobber):
(JSC::DFG::InPlaceAbstractState::setIsValid):
(JSC::DFG::InPlaceAbstractState::setBranchDirection):
(JSC::DFG::InPlaceAbstractState::setFoundConstants):
(JSC::DFG::InPlaceAbstractState::haveStructures):
(JSC::DFG::InPlaceAbstractState::setHaveStructures):

  • dfg/DFGMergeMode.h: Added.

(DFG):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::SpeculativeJIT):
(JSC::DFG::SpeculativeJIT::backwardTypeCheck):
(JSC::DFG::SpeculativeJIT::compileCurrentBlock):
(JSC::DFG::SpeculativeJIT::compileToStringOnCell):
(JSC::DFG::SpeculativeJIT::speculateStringIdentAndLoadStorage):
(JSC::DFG::SpeculativeJIT::speculateStringObject):
(JSC::DFG::SpeculativeJIT::speculateStringOrStringObject):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::needsTypeCheck):
(SpeculativeJIT):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
(JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
(JSC::DFG::SpeculativeJIT::fillSpeculateCell):
(JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
(JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
(JSC::DFG::SpeculativeJIT::fillSpeculateCell):
(JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):

  • ftl/FTLLowerDFGToLLVM.cpp:

(FTL):
(JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::appendTypeCheck):
(JSC::FTL::LowerDFGToLLVM::speculate):
(JSC::FTL::LowerDFGToLLVM::speculateNumber):
(JSC::FTL::LowerDFGToLLVM::speculateRealNumber):
(LowerDFGToLLVM):

Conflicts:

Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

9:04 PM Changeset in webkit [153281] by oliver@apple.com
  • 8 edits in trunk/Source/JavaScriptCore

fourthTier: DFG shouldn't create CheckStructures for array accesses except if the ArrayMode implies an original array access
https://bugs.webkit.org/show_bug.cgi?id=118867

Reviewed by Mark Hahnenberg.

This allows us to kill off a bunch of code in the parser, in fixup, and to simplify
ArrayProfile.

It also makes it easier to ask any array-using node how to create its type check.

Doing this required fixing a bug in LowLevelInterpreter64, where it was storing into
an array profile, thinking that it was storing into a value profile. Reshuffling the
fields in ArrayProfile revealed this.

  • bytecode/ArrayProfile.cpp:

(JSC::ArrayProfile::computeUpdatedPrediction):
(JSC::ArrayProfile::briefDescriptionWithoutUpdating):

  • bytecode/ArrayProfile.h:

(JSC::ArrayProfile::ArrayProfile):
(ArrayProfile):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::updateAllArrayPredictions):
(JSC::CodeBlock::updateAllPredictions):

  • bytecode/CodeBlock.h:

(CodeBlock):
(JSC::CodeBlock::updateAllArrayPredictions):

  • dfg/DFGArrayMode.h:

(ArrayMode):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::getArrayModeConsideringSlowPath):
(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):
(FixupPhase):
(JSC::DFG::FixupPhase::checkArray):
(JSC::DFG::FixupPhase::blessArrayOperation):

  • llint/LowLevelInterpreter64.asm:
9:04 PM Changeset in webkit [153280] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: CFA should consider live-at-head for clobbering and dumping
https://bugs.webkit.org/show_bug.cgi?id=118857

Reviewed by Mark Hahnenberg.

  • clobberStructures() was not considering nodes live-at-head when in SSA form. This means it would fail to clobber some structures.
  • dump() was not considering nodes live-at-head when in SSA form. This means it wouldn't dump everything that you might be interested in.
  • AbstractState::m_currentNode is a useless variable and we should get rid of it.
  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::AbstractState):
(JSC::DFG::AbstractState::beginBasicBlock):
(JSC::DFG::AbstractState::reset):
(JSC::DFG::AbstractState::startExecuting):
(JSC::DFG::AbstractState::clobberStructures):
(JSC::DFG::AbstractState::dump):

  • dfg/DFGAbstractState.h:

(AbstractState):

9:04 PM Changeset in webkit [153279] by oliver@apple.com
  • 8 edits
    1 copy
    1 add in trunk/Source/JavaScriptCore

fourthTier: Add a phase to create loop pre-headers
https://bugs.webkit.org/show_bug.cgi?id=118778

Reviewed by Oliver Hunt.

Add a loop pre-header creation phase. Any loop that doesn't already have
just one predecessor that isn't part of the loop has a pre-header
prepended. All non-loop predecessors then jump to that pre-header.

Also fix a handful of bugs:

  • DFG::Analysis should set m_valid before running the analysis, since that makes it easier to use ASSERT(m_valid) in the analysis' methods, which may be called by the analysis before the analysis completes. NaturalLoops does this with loopsOf().
  • NaturalLoops::headerOf() was missing a check for innerMostLoopOf() returning 0, since that'll happen if the block isn't in any loop.
  • Change BlockInsertionSet to dethread the graph, since anyone using it will want to do so.
  • Change dethreading to ignore SSA form graphs.

This also adds NaturalLoops::belongsTo(), which I always used in the
pre-header creation phase. I didn't end up using it but I'll probably use
it in the near future.

(JSC::DFG::Analysis::computeIfNecessary):

  • dfg/DFGBlockInsertionSet.cpp:

(JSC::DFG::BlockInsertionSet::execute):

  • dfg/DFGCriticalEdgeBreakingPhase.cpp:

(JSC::DFG::CriticalEdgeBreakingPhase::breakCriticalEdge):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dethread):

  • dfg/DFGLoopPreHeaderCreationPhase.cpp: Added.

(DFG):
(LoopPreHeaderCreationPhase):
(JSC::DFG::LoopPreHeaderCreationPhase::LoopPreHeaderCreationPhase):
(JSC::DFG::LoopPreHeaderCreationPhase::run):
(JSC::DFG::performLoopPreHeaderCreation):

  • dfg/DFGLoopPreHeaderCreationPhase.h: Added.

(DFG):

  • dfg/DFGNaturalLoops.h:

(NaturalLoop):
(JSC::DFG::NaturalLoops::headerOf):
(JSC::DFG::NaturalLoops::innerMostLoopOf):
(JSC::DFG::NaturalLoops::innerMostOuterLoop):
(JSC::DFG::NaturalLoops::belongsTo):
(NaturalLoops):

  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::compileInThreadImpl):

Conflicts:

Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

9:04 PM Changeset in webkit [153278] by oliver@apple.com
  • 7 edits in trunk/Source/JavaScriptCore

fourthTier: Rationalize Node::replacement
https://bugs.webkit.org/show_bug.cgi?id=118774

Reviewed by Oliver Hunt.

  • Clearing of replacements is now done in Graph::clearReplacements().
  • New nodes now have replacement set to 0.
  • dfg/DFGCPSRethreadingPhase.cpp:

(JSC::DFG::CPSRethreadingPhase::run):
(JSC::DFG::CPSRethreadingPhase::freeUnnecessaryNodes):
(JSC::DFG::CPSRethreadingPhase::canonicalizeGetLocalFor):

  • dfg/DFGCSEPhase.cpp:

(JSC::DFG::CSEPhase::run):
(JSC::DFG::CSEPhase::setReplacement):
(JSC::DFG::CSEPhase::performBlockCSE):

  • dfg/DFGGraph.cpp:

(DFG):
(JSC::DFG::Graph::clearReplacements):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::performSubstitutionForEdge):
(Graph):

  • dfg/DFGNode.h:

(JSC::DFG::Node::Node):

  • dfg/DFGSSAConversionPhase.cpp:

(JSC::DFG::SSAConversionPhase::run):

9:04 PM Changeset in webkit [153277] by oliver@apple.com
  • 7 edits in trunk/Source

fourthTier: NaturalLoops should be able to quickly answer questions like "what loops own this basic block"
https://bugs.webkit.org/show_bug.cgi?id=118750

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

  • dfg/DFGBasicBlock.h:

(BasicBlock):

  • dfg/DFGNaturalLoops.cpp:

(JSC::DFG::NaturalLoops::compute):
(JSC::DFG::NaturalLoops::loopsOf):

  • dfg/DFGNaturalLoops.h:

(DFG):
(JSC::DFG::NaturalLoop::NaturalLoop):
(NaturalLoop):
(JSC::DFG::NaturalLoop::index):
(JSC::DFG::NaturalLoop::isOuterMostLoop):
(JSC::DFG::NaturalLoop::addBlock):
(JSC::DFG::NaturalLoops::headerOf):
(JSC::DFG::NaturalLoops::innerMostLoopOf):
(NaturalLoops):
(JSC::DFG::NaturalLoops::innerMostOuterLoop):

  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::compileInThreadImpl):

Source/WTF:

Reviewed by Mark Hahnenberg.

Add a utility function for inserting an element into a vector that has bounded size,
and where the insertion causes things to drop off the end.

  • wtf/StdLibExtras.h:

(WTF):
(WTF::insertIntoBoundedVector):

9:04 PM Changeset in webkit [153276] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: don't GC when shutting down the VM
https://bugs.webkit.org/show_bug.cgi?id=118751

Reviewed by Mark Hahnenberg.

  • heap/Heap.h:

(Heap):

  • runtime/VM.cpp:

(JSC::VM::~VM):

9:04 PM Changeset in webkit [153275] by oliver@apple.com
  • 1 edit
    4 adds in trunk/Tools

fourthTier: We should have a reduced FTL LLVM pipeline tool in the repository
https://bugs.webkit.org/show_bug.cgi?id=118647

Rubber stamped by Geoffrey Garen and Mark Hahnenberg.

Add a tool that takes in an LLVM bitcode file and JITs it in exactly the same
way that the FTL would.

Also add a tool that combines multiple LLVM modules generated by FTL into a
single module.

  • ReducedFTL: Added.
  • ReducedFTL/ReducedFTL.c: Added.

(usage):
(currentTime):
(MemorySection):
(mmAllocateCodeSection):
(mmAllocateDataSection):
(mmApplyPermissions):
(mmDestroy):
(symbolLookupCallback):
(main):

  • ReducedFTL/build.sh: Added.
  • ReducedFTL/combineModules.rb: Added.
9:04 PM Changeset in webkit [153274] by oliver@apple.com
  • 45 edits
    10 copies
    8 adds in trunk/Source

fourthTier: DFG should have an SSA form for use by FTL
https://bugs.webkit.org/show_bug.cgi?id=118338

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

Adds an SSA form to the DFG. We can convert ThreadedCPS form into SSA form
after breaking critical edges. The conversion algorithm follows Aycock and
Horspool, and the SSA form itself follows something I've done before, where
instead of having Phi functions specify input nodes corresponding to block
predecessors, we instead have Upsilon functions in the predecessors that
specify which value in that block goes into which subsequent Phi. Upsilons
don't have to dominate Phis (usually they don't) and they correspond to a
non-SSA "mov" into the Phi's "variable". This gives all of the good
properties of SSA, while ensuring that a bunch of CFG transformations don't
have to be SSA-aware.

So far the only DFG phases that are SSA-aware are DCE and CFA. CFG
simplification is probably SSA-aware by default, though I haven't tried it.
Constant folding probably needs a few tweaks, but is likely ready. Ditto
for CSE, though it's not clear that we'd want to use block-local CSE when
we could be doing GVN.

Currently only the FTL can generate code from the SSA form, and there is no
way to convert from SSA to ThreadedCPS or LoadStore. There probably will
never be such a capability.

In order to handle OSR exit state in the SSA, we place MovHints at Phi
points. Other than that, you can reconstruct state-at-exit by forward
propagating MovHints. Note that MovHint is the new SetLocal in SSA.
SetLocal and GetLocal only survive into SSA if they are on captured
variables, or in the case of flushes. A "live SetLocal" will be
NodeMustGenerate and will always correspond to a flush. Computing the
state-at-exit requires running SSA liveness analysis, OSR availability
analysis, and flush liveness analysis. The FTL runs all of these prior to
generating code. While OSR exit continues to be tricky, much of the logic
is now factored into separate phases and the backend has to do less work
to reason about what happened outside of the basic block that is being
lowered.

Conversion from DFG SSA to LLVM SSA is done by ensuring that we generate
code in depth-first order, thus guaranteeing that a node will always be
lowered (and hence have a LValue) before any of the blocks dominated by
that node's block have code generated. For Upsilon/Phi, we just use
alloca's. We could do something more clever there, but it's probably not
worth it, at least not now.

Finally, while the SSA form is currently only being converted to LLVM IR,
there is nothing that prevents us from considering other backends in the
future - with the caveat that this form is designed to be first lowered to
a lower-level SSA before actual machine code generation commences. So we
ought to either use LLVM (the intended path) or we will have to write our
own SSA low-level backend.

This runs all of the code that the FTL was known to run previously. No
change in performance for now. But it does open some exciting
possibilities!

(JSC::OperandValueTraits::dump):
(JSC::Operands::fill):
(Operands):
(JSC::Operands::clear):
(JSC::Operands::operator==):

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::beginBasicBlock):
(JSC::DFG::setLiveValues):
(DFG):
(JSC::DFG::AbstractState::initialize):
(JSC::DFG::AbstractState::endBasicBlock):
(JSC::DFG::AbstractState::executeEffects):
(JSC::DFG::AbstractState::mergeStateAtTail):
(JSC::DFG::AbstractState::merge):

  • dfg/DFGAbstractState.h:

(AbstractState):

  • dfg/DFGAdjacencyList.h:

(JSC::DFG::AdjacencyList::justOneChild):
(AdjacencyList):

  • dfg/DFGBasicBlock.cpp: Added.

(DFG):
(JSC::DFG::BasicBlock::BasicBlock):
(JSC::DFG::BasicBlock::~BasicBlock):
(JSC::DFG::BasicBlock::ensureLocals):
(JSC::DFG::BasicBlock::isInPhis):
(JSC::DFG::BasicBlock::isInBlock):
(JSC::DFG::BasicBlock::removePredecessor):
(JSC::DFG::BasicBlock::replacePredecessor):
(JSC::DFG::BasicBlock::dump):
(JSC::DFG::BasicBlock::SSAData::SSAData):
(JSC::DFG::BasicBlock::SSAData::~SSAData):

  • dfg/DFGBasicBlock.h:

(BasicBlock):
(JSC::DFG::BasicBlock::operator[]):
(JSC::DFG::BasicBlock::successor):
(JSC::DFG::BasicBlock::successorForCondition):
(SSAData):

  • dfg/DFGBasicBlockInlines.h:

(DFG):

  • dfg/DFGBlockInsertionSet.cpp: Added.

(DFG):
(JSC::DFG::BlockInsertionSet::BlockInsertionSet):
(JSC::DFG::BlockInsertionSet::~BlockInsertionSet):
(JSC::DFG::BlockInsertionSet::insert):
(JSC::DFG::BlockInsertionSet::insertBefore):
(JSC::DFG::BlockInsertionSet::execute):

  • dfg/DFGBlockInsertionSet.h: Added.

(DFG):
(BlockInsertionSet):

  • dfg/DFGCFAPhase.cpp:

(JSC::DFG::CFAPhase::run):

  • dfg/DFGCFGSimplificationPhase.cpp:
  • dfg/DFGCPSRethreadingPhase.cpp:

(JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock):

  • dfg/DFGCommon.cpp:

(WTF::printInternal):

  • dfg/DFGCommon.h:

(JSC::DFG::doesKill):
(DFG):
(JSC::DFG::killStatusForDoesKill):

  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::foldConstants):
(JSC::DFG::ConstantFoldingPhase::isCapturedAtOrAfter):

  • dfg/DFGCriticalEdgeBreakingPhase.cpp: Added.

(DFG):
(CriticalEdgeBreakingPhase):
(JSC::DFG::CriticalEdgeBreakingPhase::CriticalEdgeBreakingPhase):
(JSC::DFG::CriticalEdgeBreakingPhase::run):
(JSC::DFG::CriticalEdgeBreakingPhase::breakCriticalEdge):
(JSC::DFG::performCriticalEdgeBreaking):

  • dfg/DFGCriticalEdgeBreakingPhase.h: Added.

(DFG):

  • dfg/DFGDCEPhase.cpp:

(JSC::DFG::DCEPhase::run):
(JSC::DFG::DCEPhase::findTypeCheckRoot):
(JSC::DFG::DCEPhase::countNode):
(DCEPhase):
(JSC::DFG::DCEPhase::countEdge):
(JSC::DFG::DCEPhase::eliminateIrrelevantPhantomChildren):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):

  • dfg/DFGEdge.cpp:

(JSC::DFG::Edge::dump):

  • dfg/DFGEdge.h:

(JSC::DFG::Edge::Edge):
(JSC::DFG::Edge::setNode):
(JSC::DFG::Edge::useKindUnchecked):
(JSC::DFG::Edge::setUseKind):
(JSC::DFG::Edge::setProofStatus):
(JSC::DFG::Edge::willNotHaveCheck):
(JSC::DFG::Edge::willHaveCheck):
(Edge):
(JSC::DFG::Edge::killStatusUnchecked):
(JSC::DFG::Edge::killStatus):
(JSC::DFG::Edge::setKillStatus):
(JSC::DFG::Edge::doesKill):
(JSC::DFG::Edge::doesNotKill):
(JSC::DFG::Edge::shift):
(JSC::DFG::Edge::makeWord):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGFlushFormat.cpp: Added.

(WTF):
(WTF::printInternal):

  • dfg/DFGFlushFormat.h: Added.

(DFG):
(JSC::DFG::resultFor):
(JSC::DFG::useKindFor):
(WTF):

  • dfg/DFGFlushLivenessAnalysisPhase.cpp: Added.

(DFG):
(FlushLivenessAnalysisPhase):
(JSC::DFG::FlushLivenessAnalysisPhase::FlushLivenessAnalysisPhase):
(JSC::DFG::FlushLivenessAnalysisPhase::run):
(JSC::DFG::FlushLivenessAnalysisPhase::process):
(JSC::DFG::FlushLivenessAnalysisPhase::setForNode):
(JSC::DFG::FlushLivenessAnalysisPhase::flushFormat):
(JSC::DFG::performFlushLivenessAnalysis):

  • dfg/DFGFlushLivenessAnalysisPhase.h: Added.

(DFG):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dump):
(JSC::DFG::Graph::dumpBlockHeader):
(DFG):
(JSC::DFG::Graph::addForDepthFirstSort):
(JSC::DFG::Graph::getBlocksInDepthFirstOrder):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::convertToConstant):
(JSC::DFG::Graph::valueProfileFor):
(Graph):

  • dfg/DFGInsertionSet.h:

(DFG):
(JSC::DFG::InsertionSet::execute):

  • dfg/DFGLivenessAnalysisPhase.cpp: Added.

(DFG):
(LivenessAnalysisPhase):
(JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase):
(JSC::DFG::LivenessAnalysisPhase::run):
(JSC::DFG::LivenessAnalysisPhase::process):
(JSC::DFG::LivenessAnalysisPhase::addChildUse):
(JSC::DFG::performLivenessAnalysis):

  • dfg/DFGLivenessAnalysisPhase.h: Added.

(DFG):

  • dfg/DFGNode.cpp:

(JSC::DFG::Node::hasVariableAccessData):
(DFG):

  • dfg/DFGNode.h:

(DFG):
(Node):
(JSC::DFG::Node::hasLocal):
(JSC::DFG::Node::variableAccessData):
(JSC::DFG::Node::hasPhi):
(JSC::DFG::Node::phi):
(JSC::DFG::Node::takenBlock):
(JSC::DFG::Node::notTakenBlock):
(JSC::DFG::Node::successor):
(JSC::DFG::Node::successorForCondition):
(JSC::DFG::nodeComparator):
(JSC::DFG::nodeListDump):
(JSC::DFG::nodeMapDump):

  • dfg/DFGNodeFlags.cpp:

(JSC::DFG::dumpNodeFlags):

  • dfg/DFGNodeType.h:

(DFG):

  • dfg/DFGOSRAvailabilityAnalysisPhase.cpp: Added.

(DFG):
(OSRAvailabilityAnalysisPhase):
(JSC::DFG::OSRAvailabilityAnalysisPhase::OSRAvailabilityAnalysisPhase):
(JSC::DFG::OSRAvailabilityAnalysisPhase::run):
(JSC::DFG::performOSRAvailabilityAnalysis):

  • dfg/DFGOSRAvailabilityAnalysisPhase.h: Added.

(DFG):

  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::compileInThreadImpl):

  • dfg/DFGPredictionInjectionPhase.cpp:

(JSC::DFG::PredictionInjectionPhase::run):

  • dfg/DFGPredictionPropagationPhase.cpp:

(JSC::DFG::PredictionPropagationPhase::propagate):

  • dfg/DFGSSAConversionPhase.cpp: Added.

(DFG):
(SSAConversionPhase):
(JSC::DFG::SSAConversionPhase::SSAConversionPhase):
(JSC::DFG::SSAConversionPhase::run):
(JSC::DFG::SSAConversionPhase::forwardPhiChildren):
(JSC::DFG::SSAConversionPhase::forwardPhi):
(JSC::DFG::SSAConversionPhase::forwardPhiEdge):
(JSC::DFG::SSAConversionPhase::deduplicateChildren):
(JSC::DFG::SSAConversionPhase::addFlushedLocalOp):
(JSC::DFG::SSAConversionPhase::addFlushedLocalEdge):
(JSC::DFG::performSSAConversion):

  • dfg/DFGSSAConversionPhase.h: Added.

(DFG):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGValidate.cpp:

(JSC::DFG::Validate::validate):
(Validate):
(JSC::DFG::Validate::validateCPS):

  • dfg/DFGVariableAccessData.h:

(JSC::DFG::VariableAccessData::flushFormat):
(VariableAccessData):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::lower):
(JSC::FTL::LowerDFGToLLVM::createPhiVariables):
(JSC::FTL::LowerDFGToLLVM::compileBlock):
(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileUpsilon):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::compilePhi):
(JSC::FTL::LowerDFGToLLVM::compileJSConstant):
(JSC::FTL::LowerDFGToLLVM::compileWeakJSConstant):
(JSC::FTL::LowerDFGToLLVM::compileGetArgument):
(JSC::FTL::LowerDFGToLLVM::compileGetLocal):
(JSC::FTL::LowerDFGToLLVM::compileSetLocal):
(JSC::FTL::LowerDFGToLLVM::compileAdd):
(JSC::FTL::LowerDFGToLLVM::compileArithSub):
(JSC::FTL::LowerDFGToLLVM::compileArithMul):
(JSC::FTL::LowerDFGToLLVM::compileArithDiv):
(JSC::FTL::LowerDFGToLLVM::compileArithMod):
(JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax):
(JSC::FTL::LowerDFGToLLVM::compileArithAbs):
(JSC::FTL::LowerDFGToLLVM::compileArithNegate):
(JSC::FTL::LowerDFGToLLVM::compileBitAnd):
(JSC::FTL::LowerDFGToLLVM::compileBitOr):
(JSC::FTL::LowerDFGToLLVM::compileBitXor):
(JSC::FTL::LowerDFGToLLVM::compileBitRShift):
(JSC::FTL::LowerDFGToLLVM::compileBitLShift):
(JSC::FTL::LowerDFGToLLVM::compileBitURShift):
(JSC::FTL::LowerDFGToLLVM::compileUInt32ToNumber):
(JSC::FTL::LowerDFGToLLVM::compileInt32ToDouble):
(JSC::FTL::LowerDFGToLLVM::compileGetButterfly):
(JSC::FTL::LowerDFGToLLVM::compileGetArrayLength):
(JSC::FTL::LowerDFGToLLVM::compileGetByVal):
(JSC::FTL::LowerDFGToLLVM::compileGetByOffset):
(JSC::FTL::LowerDFGToLLVM::compileGetGlobalVar):
(JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant):
(JSC::FTL::LowerDFGToLLVM::compileCompareStrictEq):
(JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant):
(JSC::FTL::LowerDFGToLLVM::compileCompareLess):
(JSC::FTL::LowerDFGToLLVM::compileCompareLessEq):
(JSC::FTL::LowerDFGToLLVM::compileCompareGreater):
(JSC::FTL::LowerDFGToLLVM::compileCompareGreaterEq):
(JSC::FTL::LowerDFGToLLVM::compileLogicalNot):
(JSC::FTL::LowerDFGToLLVM::speculateBackward):
(JSC::FTL::LowerDFGToLLVM::lowInt32):
(JSC::FTL::LowerDFGToLLVM::lowCell):
(JSC::FTL::LowerDFGToLLVM::lowBoolean):
(JSC::FTL::LowerDFGToLLVM::lowDouble):
(JSC::FTL::LowerDFGToLLVM::lowJSValue):
(JSC::FTL::LowerDFGToLLVM::lowStorage):
(JSC::FTL::LowerDFGToLLVM::speculate):
(JSC::FTL::LowerDFGToLLVM::speculateBoolean):
(JSC::FTL::LowerDFGToLLVM::isLive):
(JSC::FTL::LowerDFGToLLVM::use):
(JSC::FTL::LowerDFGToLLVM::initializeOSRExitStateForBlock):
(JSC::FTL::LowerDFGToLLVM::appendOSRExit):
(JSC::FTL::LowerDFGToLLVM::emitOSRExitCall):
(JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode):
(JSC::FTL::LowerDFGToLLVM::linkOSRExitsAndCompleteInitializationBlocks):
(JSC::FTL::LowerDFGToLLVM::setInt32):
(JSC::FTL::LowerDFGToLLVM::setJSValue):
(JSC::FTL::LowerDFGToLLVM::setBoolean):
(JSC::FTL::LowerDFGToLLVM::setStorage):
(JSC::FTL::LowerDFGToLLVM::setDouble):
(JSC::FTL::LowerDFGToLLVM::isValid):

  • ftl/FTLLoweredNodeValue.h: Added.

(FTL):
(LoweredNodeValue):
(JSC::FTL::LoweredNodeValue::LoweredNodeValue):
(JSC::FTL::LoweredNodeValue::isSet):
(JSC::FTL::LoweredNodeValue::operator!):
(JSC::FTL::LoweredNodeValue::value):
(JSC::FTL::LoweredNodeValue::block):

  • ftl/FTLValueFromBlock.h:

(JSC::FTL::ValueFromBlock::ValueFromBlock):
(ValueFromBlock):

  • ftl/FTLValueSource.cpp:

(JSC::FTL::ValueSource::dump):

  • ftl/FTLValueSource.h:

Source/WTF:

Reviewed by Mark Hahnenberg.

  • Extend variadicity of PrintStream and dataLog.
  • Give HashSet the ability to add a span of things.
  • Give HashSet the ability to == another HashSet.
  • Note FIXME's in HashTable concerning copying performance, that affects the way that the DFG now uses HashSets and HashMaps.
  • Factor out the bulk-insertion logic of JSC::DFG::InsertionSet into WTF::Insertion, so that it can be used in more places.
  • Create a dumper for lists and maps.
  • WTF.xcodeproj/project.pbxproj:
  • wtf/DataLog.h:

(WTF):
(WTF::dataLog):

  • wtf/HashSet.h:

(HashSet):
(WTF):
(WTF::::add):
(WTF::=):

  • wtf/HashTable.h:

(WTF::::HashTable):
(WTF::=):

  • wtf/Insertion.h: Added.

(WTF):
(Insertion):
(WTF::Insertion::Insertion):
(WTF::Insertion::index):
(WTF::Insertion::element):
(WTF::Insertion::operator<):
(WTF::executeInsertions):

  • wtf/ListDump.h: Added.

(WTF):
(ListDump):
(WTF::ListDump::ListDump):
(WTF::ListDump::dump):
(MapDump):
(WTF::MapDump::MapDump):
(WTF::MapDump::dump):
(WTF::listDump):
(WTF::sortedListDump):
(WTF::lessThan):
(WTF::mapDump):
(WTF::sortedMapDump):

  • wtf/PrintStream.h:

(PrintStream):
(WTF::PrintStream::print):

Conflicts:

Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

9:04 PM Changeset in webkit [153273] by oliver@apple.com
  • 9 edits in trunk/Source/JavaScriptCore

fourthTier: Resurrect the CLoop LLINT on the FTL branch.
https://bugs.webkit.org/show_bug.cgi?id=118144.

Reviewed by Mark Hahnenberg.

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::jitType):

  • Fix the CodeBlock jitType to be InterpreterThunk when !ENABLE_JIT.
  • bytecode/JumpTable.h:

(JSC::SimpleJumpTable::clear):

  • interpreter/StackIterator.cpp:

(JSC::StackIterator::Frame::bytecodeOffset):
(JSC::StackIterator::Frame::print):

  • jit/JITCode.cpp:

(JSC):

  • jit/JITExceptions.cpp:

(JSC::getExceptionLocation):

  • llint/LowLevelInterpreter.cpp:
  • offlineasm/cloop.rb:
  • runtime/Structure.cpp:
9:04 PM Changeset in webkit [153272] by oliver@apple.com
  • 4 edits in trunk/Source/JavaScriptCore

fourthTier: NaturalLoops + Profiler = Crash
https://bugs.webkit.org/show_bug.cgi?id=118486

Reviewed by Geoffrey Garen.

I borked dominators in:
http://trac.webkit.org/changeset/152431/branches/dfgFourthTier/Source/JavaScriptCore/dfg/DFGDominators.h

This patch also adds some debug support, and fixes the loop that adds a block to
an already-existing natural loop. Note that we currently don't take that path in
most programs, but it will arise, for example if you use 'continue' - though you'd
have to use it rather cleverly since the bytecode will not jump to the loop header
in most uses of 'continue'.

  • dfg/DFGDominators.cpp:

(JSC::DFG::Dominators::dump):
(DFG):

  • dfg/DFGDominators.h:

(JSC::DFG::Dominators::dominates):
(Dominators):

  • dfg/DFGNaturalLoops.cpp:

(JSC::DFG::NaturalLoops::compute):

9:04 PM Changeset in webkit [153271] by oliver@apple.com
  • 4 edits in trunk/Source/JavaScriptCore

fourthTier: DFG::AbstractState::beginBasicBlock() should set m_haveStructures if any of the valuesAtHead have either a current known structure or a non-top/non-bottom array modes
https://bugs.webkit.org/show_bug.cgi?id=118489

Reviewed by Mark Hahnenberg.

  • bytecode/ArrayProfile.h:

(JSC::arrayModesAreClearOrTop):
(JSC):

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::beginBasicBlock):

  • dfg/DFGAbstractValue.h:

(JSC::DFG::AbstractValue::hasClobberableState):
(AbstractValue):

9:04 PM Changeset in webkit [153270] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: CheckArray should call the right version of filterArrayModes
https://bugs.webkit.org/show_bug.cgi?id=118488

Reviewed by Filip Pizlo.

Currently in the CFA CheckArray doesn't call the right filterArrayMode which can cause
the CFA to ignore when it sees a contradiction.

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::executeEffects):

9:04 PM Changeset in webkit [153269] by oliver@apple.com
  • 12 edits in trunk/Source/JavaScriptCore

fourthTier: Graph::clearAndDerefChild() makes no sense anymore, and neither does Nop
https://bugs.webkit.org/show_bug.cgi?id=118452

Reviewed by Sam Weinig.

Noticed that ArgumentsSimplificationPhase was converting something to a Nop and then
resetting its children using clearAndDerefChild(). Using Nop instead of Phantom is a
holdover from back when we needed a no-MustGenerate no-op. We don't anymore. Using
clearAndDerefChild() was necessary back when we did eager reference counting. We
don't need to do that anymore, and in fact clearAndDerefChild() appeared to not do
any reference counting, so it was badly named to begin with.

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::executeEffects):

  • dfg/DFGArgumentsSimplificationPhase.cpp:

(JSC::DFG::ArgumentsSimplificationPhase::run):

  • dfg/DFGCPSRethreadingPhase.cpp:

(JSC::DFG::CPSRethreadingPhase::freeUnnecessaryNodes):

  • dfg/DFGCSEPhase.cpp:

(JSC::DFG::CSEPhase::performNodeCSE):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGGraph.h:

(Graph):

  • dfg/DFGNode.h:

(JSC::DFG::Node::willHaveCodeGenOrOSR):

  • dfg/DFGNodeType.h:

(DFG):

  • dfg/DFGPredictionPropagationPhase.cpp:

(JSC::DFG::PredictionPropagationPhase::propagate):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

9:04 PM Changeset in webkit [153268] by oliver@apple.com
  • 7 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should better report its compile-times and it should be able to run in a mode where it doesn't spend time generating OSR exits
https://bugs.webkit.org/show_bug.cgi?id=118401

Reviewed by Sam Weinig.

Add two new OSR exit modes, which are useful only for playing with compile times:

  • All OSR exits are llvm.trap().
  • OSR exits don't take arguments and have no exit value marshaling.
  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::compileInThread):
(JSC::DFG::Plan::compileInThreadImpl):

  • dfg/DFGPlan.h:

(Plan):

  • ftl/FTLIntrinsicRepository.h:

(FTL):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::appendOSRExit):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::emitOSRExitCall):

  • ftl/FTLOutput.h:

(JSC::FTL::Output::trap):

  • runtime/Options.h:

(JSC):

9:04 PM Changeset in webkit [153267] by oliver@apple.com
  • 39 edits in trunk/Source/JavaScriptCore

fourthTier: DFG should refer to BasicBlocks by BasicBlock* and not BlockIndex
https://bugs.webkit.org/show_bug.cgi?id=118339

Reviewed by Michael Saboff.

This accomplishes two goals:

1) Simplifies a bunch of code. You can now much more directly get to a successor

or predecessor, since you just get the pointer directly. The backend(s) always
hold onto a pointer to the block they're on, so you don't have to do work to
get the block from the index.

2) It allows for the possibility of inserting blocks into the program.

Previously, if you did that, you'd have to edit all references to blocks since
those references would have outdated indexing after an insertion. Now, if you
change the indexing, you just have to invalidate some analyses and make sure
that you change each block's BasicBlock::index accordingly.

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::initialize):
(JSC::DFG::AbstractState::endBasicBlock):
(JSC::DFG::AbstractState::mergeToSuccessors):

  • dfg/DFGAbstractState.h:

(AbstractState):

  • dfg/DFGArgumentsSimplificationPhase.cpp:

(JSC::DFG::ArgumentsSimplificationPhase::run):

  • dfg/DFGBackwardsPropagationPhase.cpp:

(JSC::DFG::BackwardsPropagationPhase::run):

  • dfg/DFGBasicBlock.h:

(DFG):
(JSC::DFG::BasicBlock::BasicBlock):
(JSC::DFG::BasicBlock::size):
(JSC::DFG::BasicBlock::isEmpty):
(JSC::DFG::BasicBlock::at):
(JSC::DFG::BasicBlock::operator[]):
(JSC::DFG::BasicBlock::last):
(JSC::DFG::BasicBlock::resize):
(JSC::DFG::BasicBlock::grow):
(BasicBlock):
(JSC::DFG::BasicBlock::append):
(JSC::DFG::BasicBlock::numSuccessors):
(JSC::DFG::BasicBlock::successor):
(JSC::DFG::BasicBlock::successorForCondition):
(JSC::DFG::BasicBlock::dump):
(UnlinkedBlock):
(JSC::DFG::UnlinkedBlock::UnlinkedBlock):
(JSC::DFG::getBytecodeBeginForBlock):
(JSC::DFG::blockForBytecodeOffset):

  • dfg/DFGByteCodeParser.cpp:

(ByteCodeParser):
(InlineStackEntry):
(JSC::DFG::ByteCodeParser::handleInlining):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::linkBlock):
(JSC::DFG::ByteCodeParser::linkBlocks):
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
(JSC::DFG::ByteCodeParser::parseCodeBlock):
(JSC::DFG::ByteCodeParser::parse):

  • dfg/DFGCFAPhase.cpp:

(JSC::DFG::CFAPhase::performBlockCFA):
(JSC::DFG::CFAPhase::performForwardCFA):

  • dfg/DFGCFGSimplificationPhase.cpp:

(JSC::DFG::CFGSimplificationPhase::run):
(JSC::DFG::CFGSimplificationPhase::convertToJump):

  • dfg/DFGCPSRethreadingPhase.cpp:

(JSC::DFG::CPSRethreadingPhase::freeUnnecessaryNodes):
(JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlocks):
(JSC::DFG::CPSRethreadingPhase::propagatePhis):
(CPSRethreadingPhase):

  • dfg/DFGCSEPhase.cpp:

(JSC::DFG::CSEPhase::run):

  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::run):
(JSC::DFG::ConstantFoldingPhase::foldConstants):

  • dfg/DFGDCEPhase.cpp:

(JSC::DFG::DCEPhase::run):

  • dfg/DFGDisassembler.cpp:

(JSC::DFG::Disassembler::Disassembler):
(JSC::DFG::Disassembler::createDumpList):

  • dfg/DFGDisassembler.h:

(JSC::DFG::Disassembler::setForBlockIndex):

  • dfg/DFGDominators.cpp:

(JSC::DFG::Dominators::compute):
(JSC::DFG::Dominators::iterateForBlock):

  • dfg/DFGDominators.h:

(JSC::DFG::Dominators::dominates):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::run):
(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dump):
(JSC::DFG::Graph::dumpBlockHeader):
(JSC::DFG::Graph::handleSuccessor):
(JSC::DFG::Graph::determineReachability):
(JSC::DFG::Graph::resetReachability):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::numBlocks):
(JSC::DFG::Graph::block):
(JSC::DFG::Graph::lastBlock):
(Graph):
(JSC::DFG::Graph::appendBlock):
(JSC::DFG::Graph::killBlock):
(DFG):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::JITCompiler):
(JSC::DFG::JITCompiler::link):

  • dfg/DFGJITCompiler.h:

(JSC::DFG::JITCompiler::setForBlockIndex):

  • dfg/DFGNaturalLoops.cpp:

(JSC::DFG::NaturalLoop::dump):
(JSC::DFG::NaturalLoops::compute):
(JSC::DFG::NaturalLoops::loopsOf):

  • dfg/DFGNaturalLoops.h:

(JSC::DFG::NaturalLoop::NaturalLoop):
(JSC::DFG::NaturalLoop::addBlock):
(JSC::DFG::NaturalLoop::header):
(JSC::DFG::NaturalLoop::at):
(JSC::DFG::NaturalLoop::operator[]):
(JSC::DFG::NaturalLoop::contains):
(NaturalLoop):
(JSC::DFG::NaturalLoops::headerOf):
(NaturalLoops):

  • dfg/DFGNode.h:

(DFG):
(JSC::DFG::SwitchCase::SwitchCase):
(JSC::DFG::SwitchCase::withBytecodeIndex):
(SwitchCase):
(JSC::DFG::SwitchCase::targetBytecodeIndex):
(JSC::DFG::SwitchData::SwitchData):
(JSC::DFG::SwitchData::setFallThroughBytecodeIndex):
(JSC::DFG::SwitchData::fallThroughBytecodeIndex):
(SwitchData):
(JSC::DFG::Node::setTakenBlock):
(JSC::DFG::Node::setNotTakenBlock):
(JSC::DFG::Node::takenBlock):
(JSC::DFG::Node::notTakenBlock):
(JSC::DFG::Node::successor):
(JSC::DFG::Node::successorForCondition):

  • dfg/DFGPredictionInjectionPhase.cpp:

(JSC::DFG::PredictionInjectionPhase::run):

  • dfg/DFGPredictionPropagationPhase.cpp:

(JSC::DFG::PredictionPropagationPhase::propagateForward):
(JSC::DFG::PredictionPropagationPhase::propagateBackward):
(JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::convertLastOSRExitToForward):
(JSC::DFG::SpeculativeJIT::nonSpeculativeCompare):
(JSC::DFG::SpeculativeJIT::nonSpeculativeStrictEq):
(JSC::DFG::SpeculativeJIT::compilePeepHoleDoubleBranch):
(JSC::DFG::SpeculativeJIT::compilePeepHoleObjectEquality):
(JSC::DFG::SpeculativeJIT::compilePeepHoleIntegerBranch):
(JSC::DFG::SpeculativeJIT::compilePeepHoleBranch):
(JSC::DFG::SpeculativeJIT::compileCurrentBlock):
(JSC::DFG::SpeculativeJIT::compile):
(JSC::DFG::SpeculativeJIT::createOSREntries):
(JSC::DFG::SpeculativeJIT::linkOSREntries):
(JSC::DFG::SpeculativeJIT::compileStrictEqForConstant):
(JSC::DFG::SpeculativeJIT::compileStrictEq):
(JSC::DFG::SpeculativeJIT::compileRegExpExec):
(JSC::DFG::SpeculativeJIT::addBranch):
(JSC::DFG::SpeculativeJIT::linkBranches):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::nextBlock):
(SpeculativeJIT):
(JSC::DFG::SpeculativeJIT::detectPeepHoleBranch):
(JSC::DFG::SpeculativeJIT::branchDouble):
(JSC::DFG::SpeculativeJIT::branchDoubleNonZero):
(JSC::DFG::SpeculativeJIT::branch32):
(JSC::DFG::SpeculativeJIT::branchTest32):
(JSC::DFG::SpeculativeJIT::branch64):
(JSC::DFG::SpeculativeJIT::branch8):
(JSC::DFG::SpeculativeJIT::branchPtr):
(JSC::DFG::SpeculativeJIT::branchTestPtr):
(JSC::DFG::SpeculativeJIT::branchTest8):
(JSC::DFG::SpeculativeJIT::jump):
(JSC::DFG::SpeculativeJIT::addBranch):
(JSC::DFG::SpeculativeJIT::StringSwitchCase::StringSwitchCase):
(StringSwitchCase):
(JSC::DFG::SpeculativeJIT::BranchRecord::BranchRecord):
(BranchRecord):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNull):
(JSC::DFG::SpeculativeJIT::nonSpeculativeCompareNull):
(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranch):
(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeStrictEq):
(JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
(JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch):
(JSC::DFG::SpeculativeJIT::emitBranch):
(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNull):
(JSC::DFG::SpeculativeJIT::nonSpeculativeCompareNull):
(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranch):
(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeStrictEq):
(JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
(JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch):
(JSC::DFG::SpeculativeJIT::emitBranch):
(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGTypeCheckHoistingPhase.cpp:

(JSC::DFG::TypeCheckHoistingPhase::run):
(JSC::DFG::TypeCheckHoistingPhase::identifyRedundantStructureChecks):
(JSC::DFG::TypeCheckHoistingPhase::identifyRedundantArrayChecks):
(JSC::DFG::TypeCheckHoistingPhase::disableHoistingAcrossOSREntries):

  • dfg/DFGUnificationPhase.cpp:

(JSC::DFG::UnificationPhase::run):

  • dfg/DFGValidate.cpp:

(JSC::DFG::Validate::validate):
(JSC::DFG::Validate::checkOperand):
(JSC::DFG::Validate::reportValidationContext):

  • dfg/DFGVirtualRegisterAllocationPhase.cpp:

(JSC::DFG::VirtualRegisterAllocationPhase::run):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::lower):
(JSC::FTL::LowerDFGToLLVM::compileBlock):
(JSC::FTL::LowerDFGToLLVM::compileJump):
(JSC::FTL::LowerDFGToLLVM::compileBranch):
(JSC::FTL::LowerDFGToLLVM::lowBlock):

9:04 PM Changeset in webkit [153266] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: Unreviewed, add a helpful comment for why DCE is needed in the FTL.

I believe I've now twice down the experiment of disabling DCE in the FTL,
only to realize that this can't work, and that DCE is needed. I'd kind of
like to not make that mistake again.

  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::compileInThreadImpl):

9:04 PM Changeset in webkit [153265] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: DFG::Node::m_opInfo2 should also be a uintptr_t
https://bugs.webkit.org/show_bug.cgi?id=118340

Reviewed by Sam Weinig.

  • dfg/DFGNode.h:

(JSC::DFG::Node::Node):

9:04 PM Changeset in webkit [153264] by oliver@apple.com
  • 8 edits in trunk/Source

fourthTier: Have fewer Arrayify's
https://bugs.webkit.org/show_bug.cgi?id=118335

Reviewed by Mark Hahnenberg.

A lot of Arrayify's arise because some program saw Int32 arrays early on in
execution, but then they all got converted to Double arrays and the program
will never see Int32 arrays ever again. Prior to this change you would always
have an Arrayify in this case. But with this change, the first time that an
ArrayProfile is about to go polymorphic in computeUpdatedPrediction(), it
instead forcibly monomorphises itself to the latest-seen structure.
Thereafter it will never again perform this monomorphisation. This is
controlled by ArrayProfile::m_didPerformFirstRunPruning. This is a 5%
speed-up on Kraken/imaging-gaussian-blur with the FTL enabled, and it
unblocks a bunch of stuff we want to do in the future because it makes a
bunch of loops effect-free.

We will still want to implement Arrayify hoisting in the future, but this is
great anyway because it's better to not have Arrayifications than it is to
have hoisted Arrayifications.

  • bytecode/ArrayProfile.cpp:

(JSC::ArrayProfile::computeUpdatedPrediction):
(JSC::ArrayProfile::briefDescription):
(JSC):
(JSC::ArrayProfile::briefDescriptionWithoutUpdating):

  • bytecode/ArrayProfile.h:

(JSC::ArrayProfile::ArrayProfile):
(ArrayProfile):

9:04 PM Changeset in webkit [153263] by oliver@apple.com
  • 5 edits in trunk/Source/JavaScriptCore

fourthTier: add option to disable OSR entry in loops
https://bugs.webkit.org/show_bug.cgi?id=118329

Reviewed by Mark Hahnenberg.

This adds that option, and also makes the OSR exit reoptimization trigger rely less on
OSR entry failing. Now even if we never attempt OSR entry but our execution counter gets
high after a small number of OSR exits, we will recompile.

  • dfg/DFGOSRExitCompilerCommon.cpp:

(JSC::DFG::handleExitCounts):

  • dfg/DFGOperations.cpp:
  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_loop_hint):
(JSC::JIT::emitSlow_op_loop_hint):

  • runtime/Options.h:

(JSC):

9:04 PM Changeset in webkit [153262] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: since the FTL disassembly hacks cannot distinguish between code and data, the LLVM disassembler symbol table callback should be able to deal gracefully with arbitrary garbage
https://bugs.webkit.org/show_bug.cgi?id=118313

Reviewed by Mark Hahnenberg.

Give it a mode where we can still crash on unrecognized reference types, so that we might
implement them in the future, but by default just print some stuff and keep going.

  • disassembler/LLVMDisassembler.cpp:

(JSC):
(JSC::symbolLookupCallback):

9:04 PM Changeset in webkit [153261] by oliver@apple.com
  • 5 edits in trunk/Source

fourthTier: FTL should use the equivalent of llvm opt -O2 by default
https://bugs.webkit.org/show_bug.cgi?id=118311

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

Use a PassManagerBuilder instead of rolling our own.

This boosts our speed-up by another 5% or so.

  • ftl/FTLCompile.cpp:

(JSC::FTL::compile):

  • runtime/Options.h:

(JSC):

Source/WTF:

Reviewed by Mark Hahnenberg.

  • wtf/LLVMHeaders.h:
9:04 PM Changeset in webkit [153260] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should run LICM after AA setup
https://bugs.webkit.org/show_bug.cgi?id=118277

Reviewed by Maciej Stachowiak.

LICM queries alias analysis. Hence, just like GVN, it should run after
we have set up the alias analysis.

  • ftl/FTLCompile.cpp:

(JSC::FTL::compile):

9:04 PM Changeset in webkit [153259] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should run AA passes before GVN
https://bugs.webkit.org/show_bug.cgi?id=118276

Rubber stamped by Geoffrey Garen.

These enable load elimination in GVN.

Immediately gives us a speed-up on a bunch of benchmarks I hacked to run
properly in the FTL. One example is 20% on imaging-gaussian-blur. (Fair
warning: the stock version of that benchmark won't see speed-ups -
probably slow-downs instead - because the FTL can't do OSR entry yet.)
Another example is the findGraphNode function, which now sees a 7%
speed-up, and that's without even doing LICM or other good things.

  • ftl/FTLCompile.cpp:

(JSC::FTL::compile):

9:04 PM Changeset in webkit [153258] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: Make Graph::substituteGetLocal() out-of-line

Rubber stamped by Geoffrey Garen.

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::substituteGetLocal):
(DFG):

  • dfg/DFGGraph.h:

(Graph):

9:04 PM Changeset in webkit [153257] by oliver@apple.com
  • 8 edits
    1 copy
    2 adds in trunk/Source/JavaScriptCore

fourthTier: DFG should know how to find natural loops
https://bugs.webkit.org/show_bug.cgi?id=118152

Reviewed by Mark Hahnenberg.

There are a bunch of things we can do when we know where the loops are.
Previously we didn't. With this patch, we do.

This patch adds the classic dominator based natural loop finder.

The only client of this right now is the DFG::Disassembler. It prints out
a summary of the analysis for each block.

This will become more important when I do
https://bugs.webkit.org/show_bug.cgi?id=118151, which definitely requires
this kind of analysis, at least if we want to do the optimization over
DFG IR (and I'm pretty sure we do).

(DFG):
(Analysis):
(JSC::DFG::Analysis::Analysis):
(JSC::DFG::Analysis::invalidate):
(JSC::DFG::Analysis::computeIfNecessary):
(JSC::DFG::Analysis::isValid):

  • dfg/DFGCFGSimplificationPhase.cpp:

(JSC::DFG::CFGSimplificationPhase::run):

  • dfg/DFGDisassembler.cpp:

(JSC::DFG::Disassembler::createDumpList):

  • dfg/DFGDominators.cpp:

(JSC::DFG::Dominators::Dominators):
(JSC::DFG::Dominators::compute):

  • dfg/DFGDominators.h:

(Dominators):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dumpBlockHeader):
(JSC::DFG::Graph::invalidateCFG):
(DFG):

  • dfg/DFGGraph.h:

(Graph):

  • dfg/DFGNaturalLoops.cpp: Added.

(DFG):
(JSC::DFG::NaturalLoop::dump):
(JSC::DFG::NaturalLoops::NaturalLoops):
(JSC::DFG::NaturalLoops::~NaturalLoops):
(JSC::DFG::NaturalLoops::compute):
(JSC::DFG::NaturalLoops::loopsOf):
(JSC::DFG::NaturalLoops::dump):

  • dfg/DFGNaturalLoops.h: Added.

(DFG):
(NaturalLoop):
(JSC::DFG::NaturalLoop::NaturalLoop):
(JSC::DFG::NaturalLoop::addBlock):
(JSC::DFG::NaturalLoop::header):
(JSC::DFG::NaturalLoop::size):
(JSC::DFG::NaturalLoop::at):
(JSC::DFG::NaturalLoop::operator[]):
(JSC::DFG::NaturalLoop::contains):
(NaturalLoops):
(JSC::DFG::NaturalLoops::numLoops):
(JSC::DFG::NaturalLoops::loop):
(JSC::DFG::NaturalLoops::headerOf):

9:04 PM Changeset in webkit [153256] by oliver@apple.com
  • 15 edits
    2 copies
    1 move
    2 adds in trunk/Source

fourthTier: JSC's disassembly infrastructure should be able to disassemble the code that LLVM generates
https://bugs.webkit.org/show_bug.cgi?id=118148

Source/JavaScriptCore:

Reviewed by Anders Carlsson.

Oh boy. UDis86 cannot disassemble the AVX (or whatever it's called) stuff
that LLVM generates for floating point. So the right decision is to
switch to the LLVM disassembler, right? Wrong!! LLVM's disassembler
cannot disassemble the load-from-absolute-address-into-%rax instructions
that our JIT generates quite a lot of.

So, this keeps the UDis86 disassembler, but adds the LLVM disassembler,
and requires the caller of disassemble() to hint which one is likely to
be less wrong for the given code.

Maybe in the future LLVM will catch up to UDis86, but it's definitely not
there right now.

This now allows us to disassemble all of the code that LLVM generates.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • disassembler/Disassembler.cpp:

(JSC::disassemble):

  • disassembler/Disassembler.h:

(JSC::tryToDisassemble):
(JSC):

  • disassembler/LLVMDisassembler.cpp: Added.

(JSC):
(JSC::symbolLookupCallback):
(JSC::tryToDisassembleWithLLVM):

  • disassembler/LLVMDisassembler.h: Added.

(JSC):
(JSC::tryToDisassembleWithLLVM):

  • disassembler/UDis86Disassembler.cpp:

(JSC::tryToDisassembleWithUDis86):

  • disassembler/UDis86Disassembler.h: Added.

(JSC):
(JSC::tryToDisassembleWithUDis86):

  • disassembler/X86Disassembler.cpp: Added.

(JSC):
(JSC::tryToDisassemble):

  • ftl/FTLAbbreviatedTypes.h:
  • ftl/FTLCompile.cpp:

(JSC::FTL::compile):

  • ftl/FTLJITCode.h:
  • ftl/FTLJITFinalizer.h:
  • ftl/FTLLLVMHeaders.h: Removed.
  • ftl/FTLLink.cpp:
  • runtime/InitializeThreading.cpp:

(JSC::initializeThreadingOnce):

  • runtime/Options.h:

(JSC):

Source/WTF:

Reviewed by Anders Carlsson.

We now use LLVM for two things: disassembler and FTL. Separate out the question
of whether we have LLVM (HAVE(LLVM)) from whether we want to use the LLVM
disassembler (USE(LLVM_DISASSEMBLER)) and whether we enable the FTL
(ENABLE(FTL_JIT)).

Also move the cruft for including LLVM headers into WTF since now we use it in
a bunch of places, not all related to FTL. There's no obvious place to put that
file in JSC so I put it in WTF.

  • WTF.xcodeproj/project.pbxproj:
  • wtf/LLVMHeaders.h: Copied from Source/JavaScriptCore/ftl/FTLLLVMHeaders.h.
  • wtf/Platform.h:
9:04 PM Changeset in webkit [153255] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should be able to dump disassembly
https://bugs.webkit.org/show_bug.cgi?id=118141

Reviewed by Geoffrey Garen.

  • ftl/FTLCompile.cpp:

(JSC::FTL::compile):

9:04 PM Changeset in webkit [153254] by oliver@apple.com
  • 8 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should support hole/OOB PutByVal's
https://bugs.webkit.org/show_bug.cgi?id=118112

Reviewed by Geoffrey Garen.

Added a common code generator for the out-of-bounds case that is reused by
all contiguous-like arrays (Int32, Double, Contiguous).

This is relatively straight-forward, except that it's the first time that
the FTL has to call DFG operations that take more than two arguments.

  • ftl/FTLAbbreviations.h:

(JSC::FTL::functionType):
(JSC::FTL::buildCall):

  • ftl/FTLAbstractHeapRepository.h:

(FTL):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLIntrinsicRepository.h:

(FTL):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compilePutByVal):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::contiguousPutByValOutOfBounds):
(JSC::FTL::LowerDFGToLLVM::vmCall):

  • ftl/FTLOutput.h:

(JSC::FTL::Output::call):

9:03 PM Changeset in webkit [153253] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: FTL::canCompile(Graph&) should not consider nodes that won't be compiled
https://bugs.webkit.org/show_bug.cgi?id=118097

Reviewed by Mark Hahnenberg.

This increases coverage to include programs that have unprofiled paths. Those paths will
often have nodes that appear to do untyped speculations, and the FTL sometimes doesn't
support those; except that it doesn't matter since the reason why they were untyped is
that they were unprofiled and anyway we won't run them because we'll exit before them.

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

9:03 PM Changeset in webkit [153252] by oliver@apple.com
  • 4 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should support ArrayifyToStructure
https://bugs.webkit.org/show_bug.cgi?id=118095

Reviewed by Mark Hahnenberg.

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLIntrinsicRepository.h:

(FTL):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileArrayifyToStructure):
(LowerDFGToLLVM):

9:03 PM Changeset in webkit [153251] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should support ForwardCheckStructure/ForwardStructureTransitionWatchpoint and doing so shouldn't break V8/crypto
https://bugs.webkit.org/show_bug.cgi?id=118091

Reviewed by Mark Hahnenberg.

I was going to just add ForwardCheckStructure/ForwardStructureTransitionWatchpoint support,
which is trivial. But doing so increases coverage a lot, and revealed long-standing bugs in
the FTL. I then fixed those bugs, also:

  • The FTL should not attempt to compile a block that is not reachable according to the CFA. This is analogous to terminating basic block compilation if the CFA becomes !isValid(). Attempting to compile such a block means that you're running on broken CFA state, and the CFA will become inconsistent with the code you're generating, leading to some strangeness. For example, the FTL relies on the CFA to tell it that we gave up compiling a node and hence don't have LValue's for that node (by virtue of us giving up due to !isValid()). But the CFA's isValid() bit will not be set correctly for blocks that weren't visited by the CFA at all, and the CFA expects you to know this because it expects that you already checked BasicBlock::cfaHasVisited.
  • SetLocal needs to change the ValueSource of the operand to indicate that its value has been stashed in the local (i.e. the "reference" corresponding to the operand in FTL speak). This is because although OSR exit already knows that the value of the operand is stored in the Node, and it already knows what LValue corresponds to the node, OSR exit will also assume that if the Node dies then the value-at-exit for that operand should be Dead (i.e. jsUndefined). But the Node dying, and the local dying, are two distinct things; in particular the local always outlives the Node in the case of a SetLocal. So, we just need to have SetLocal have the ValueSource be BlahInLocal rather than HaveNode, to ensure that OSR exit knows that the darn thing is really live until the end of the basic block, as opposed to until whenever the Node dies (which could be at any time).
  • PutByOffset was erroneously storing to an offset from the base object, rather than an offset from the storage. Note that the storage will be the base object (exactly - i.e. same node, same value) for inline stores, but will be a distinct thing for out-of-line stores.
  • At-head set-up of OSR exit state was using ValueInLocals for variables forced double, when it should have been using DoubleInLocals.
  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileBlock):
(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileSetLocal):
(JSC::FTL::LowerDFGToLLVM::compilePutByOffset):
(JSC::FTL::LowerDFGToLLVM::initializeOSRExitStateForBlock):
(JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode):

9:03 PM Changeset in webkit [153250] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should support PutByVal
https://bugs.webkit.org/show_bug.cgi?id=118075

Reviewed by Mark Hahnenberg.

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::lower):
(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileGetByVal):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::compilePutByVal):

9:03 PM Changeset in webkit [153249] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: Convert versus AsIs should have no bearing on whether we can do the SaneChain optimization for double array GetByVals
https://bugs.webkit.org/show_bug.cgi?id=118028

Reviewed by Sam Weinig.

The SaneChain optimization allows us to get rid of the NaN check on loading from
a double array, if the result is used in an arithmetic op that wouldn't
distinguish between NaN and undefined. Normally the NaN check would be needed
because NaN is the hole marker.

The SaneChain optimization definitely requires that you're an Original array,
since we need to watchpoint the array prototype chain. And so it also needs to
be a JSArray, and not an object that has indexed double properties. We also
require an in-bounds access, since the backend is only capable of the
optimization in the in-bounds case (though we could extend it to OOB in the
future). But whether the array is being converted or is as-is isn't relevant.
Either way, if it's a double original array in-bounds access by the time that
the array check (or conversion!) completes, we can do the optimization.

Ever-so-slight speed-up on Kraken/imaging-gaussian-blur.

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

9:03 PM Changeset in webkit [153248] by oliver@apple.com
  • 21 edits
    26 adds in trunk

fourthTier: DFG should support switch_string
https://bugs.webkit.org/show_bug.cgi?id=117967

Source/JavaScriptCore:

Reviewed by Sam Weinig.

Add a reusable binary switch creator.

Implement switch on string using three modes:

  • Binary switch on StringImpl* in the case of identifiers.
  • Trie of binary switches on characters in the case of a not-too-big switch over not-too-big 8-bit strings.
  • Hash lookup if all else fails.

Anywhere from a 2x to 3x speed-up on microbenchmarks that stress
string switches. 25-35% speed-up on HashMap tests. 4% speed-up on
pdfjs.

(StringJumpTable):
(JSC::StringJumpTable::clear):

  • dfg/DFGBackwardsPropagationPhase.cpp:

(JSC::DFG::BackwardsPropagationPhase::propagate):

  • dfg/DFGBinarySwitch.cpp: Added.

(DFG):
(JSC::DFG::BinarySwitch::BinarySwitch):
(JSC::DFG::BinarySwitch::advance):
(JSC::DFG::BinarySwitch::build):

  • dfg/DFGBinarySwitch.h: Added.

(DFG):
(BinarySwitch):
(JSC::DFG::BinarySwitch::caseIndex):
(JSC::DFG::BinarySwitch::caseValue):
(JSC::DFG::BinarySwitch::fallThrough):
(JSC::DFG::BinarySwitch::Case::Case):
(Case):
(JSC::DFG::BinarySwitch::Case::operator<):
(JSC::DFG::BinarySwitch::BranchCode::BranchCode):
(BranchCode):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGCapabilities.cpp:

(JSC::DFG::capabilityLevel):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::link):

  • dfg/DFGLazyJSValue.cpp:

(JSC::DFG::LazyJSValue::getValue):
(JSC::DFG::equalToStringImpl):
(DFG):
(JSC::DFG::LazyJSValue::strictEqual):
(JSC::DFG::LazyJSValue::dump):

  • dfg/DFGLazyJSValue.h:

(JSC::DFG::LazyJSValue::knownStringImpl):
(LazyJSValue):
(JSC::DFG::LazyJSValue::stringImpl):
(JSC::DFG::LazyJSValue::switchLookupValue):

  • dfg/DFGNode.cpp:

(WTF::printInternal):

  • dfg/DFGNode.h:
  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::emitSwitchChar):
(JSC::DFG::SpeculativeJIT::StringSwitchCase::operator<):
(DFG):
(JSC::DFG::SpeculativeJIT::emitBinarySwitchStringRecurse):
(JSC::DFG::SpeculativeJIT::emitSwitchStringOnString):
(JSC::DFG::SpeculativeJIT::emitSwitchString):
(JSC::DFG::SpeculativeJIT::emitSwitch):
(JSC::DFG::SpeculativeJIT::addBranch):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::callOperation):
(JSC::DFG::SpeculativeJIT::branch8):
(SpeculativeJIT):
(JSC::DFG::SpeculativeJIT::StringSwitchCase::StringSwitchCase):
(StringSwitchCase):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileSwitch):

  • runtime/Options.h:

(JSC):

Source/WTF:

Reviewed by Sam Weinig.

Make it possible to compare a RefPtr<StringImpl> and a StringImpl* without
having to ref the StringImpl.

  • wtf/text/StringHash.h:

(WTF::StringHash::equal):

LayoutTests:

Reviewed by Sam Weinig.

  • fast/js/regress/script-tests/switch-string-basic-big-var.js: Added.

(foo):
(make):

  • fast/js/regress/script-tests/switch-string-basic-big.js: Added.

(foo):
(make):

  • fast/js/regress/script-tests/switch-string-basic-var.js: Added.

(foo):
(make):

  • fast/js/regress/script-tests/switch-string-basic.js: Added.

(foo):

  • fast/js/regress/script-tests/switch-string-big-length-tower-var.js: Added.

(foo):

  • fast/js/regress/script-tests/switch-string-length-tower-var.js: Added.

(foo):

  • fast/js/regress/script-tests/switch-string-length-tower.js: Added.

(foo):

  • fast/js/regress/script-tests/switch-string-short.js: Added.

(foo):

  • fast/js/regress/switch-string-basic-big-expected.txt: Added.
  • fast/js/regress/switch-string-basic-big-var-expected.txt: Added.
  • fast/js/regress/switch-string-basic-big-var.html: Added.
  • fast/js/regress/switch-string-basic-big.html: Added.
  • fast/js/regress/switch-string-basic-expected.txt: Added.
  • fast/js/regress/switch-string-basic-var-expected.txt: Added.
  • fast/js/regress/switch-string-basic-var.html: Added.
  • fast/js/regress/switch-string-basic.html: Added.
  • fast/js/regress/switch-string-big-length-tower-var-expected.txt: Added.
  • fast/js/regress/switch-string-big-length-tower-var.html: Added.
  • fast/js/regress/switch-string-length-tower-expected.txt: Added.
  • fast/js/regress/switch-string-length-tower-var-expected.txt: Added.
  • fast/js/regress/switch-string-length-tower-var.html: Added.
  • fast/js/regress/switch-string-length-tower.html: Added.
  • fast/js/regress/switch-string-short-expected.txt: Added.
  • fast/js/regress/switch-string-short.html: Added.

Conflicts:

Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

9:03 PM Changeset in webkit [153247] by oliver@apple.com
  • 11 edits in trunk/Source

fourthTier: Count external memory usage towards heap footprint
https://bugs.webkit.org/show_bug.cgi?id=117948

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Currently just count strings. Strings get counted in such a way that we won't re-count strings
that are aliased, by dividing by the reference count. This then ups the GC footprint and allows
the collector to appropriately amortize itself.

  • heap/Heap.cpp:

(JSC::Heap::Heap):
(JSC::Heap::size):
(JSC::Heap::collect):

  • heap/Heap.h:

(Heap):

  • heap/SlotVisitor.h:
  • heap/SlotVisitorInlines.h:

(JSC::SlotVisitor::reportExtraMemoryUsage):
(JSC):

  • runtime/JSString.cpp:

(JSC::JSString::visitChildren):

Source/WTF:

Expose some functionality needed for properly measuring StringImpl footprint.

  • wtf/Atomics.h:

(WTF::weakCompareAndSwapSize):
(WTF):

  • wtf/MathExtras.h:

(divideRoundedUp):

  • wtf/text/StringImpl.h:

(WTF::StringImpl::cost):
(StringImpl):
(WTF::StringImpl::costDuringGC):
(WTF::StringImpl::refCount):

9:03 PM Changeset in webkit [153246] by oliver@apple.com
  • 1 edit in trunk/Source/WTF/ChangeLog

fourthTier: DFG should optimize identifier string equality
https://bugs.webkit.org/show_bug.cgi?id=117920

Reviewed by Sam Weinig.

Note that this ChangeLog was supposed to be committed in r151890.

Expose the IsIdentifier bit to the JIT.

  • wtf/text/StringImpl.h:

(WTF::StringImpl::flagIsIdentifier):

9:03 PM Changeset in webkit [153245] by oliver@apple.com
  • 12 edits
    6 adds in trunk

fourthTier: DFG should optimize identifier string equality
https://bugs.webkit.org/show_bug.cgi?id=117920

Source/JavaScriptCore:

Reviewed by Sam Weinig.

This is a 20% speed-up for string equality comparisons when both strings are
identifiers.

This is important for two reasons:

1) Using strings as enumerations is an idiom. A great example is typeof. It

would be great if this performed better.

2) When I implement switch_string in the DFG, it would be great to optimize

the case where the switched-on value is an identifier. That would involve
a simple binary switch rather than a more complicated trie-switch over
characters.

  • bytecode/SpeculatedType.cpp:

(JSC::dumpSpeculation):
(JSC::speculationToAbbreviatedString):
(JSC::speculationFromCell):

  • bytecode/SpeculatedType.h:

(JSC):
(JSC::isStringIdentSpeculation):
(JSC::isStringSpeculation):

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::executeEffects):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGNode.h:

(JSC::DFG::Node::shouldSpeculateStringIdent):
(Node):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compilePeepHoleBranch):
(JSC::DFG::SpeculativeJIT::compare):
(JSC::DFG::SpeculativeJIT::compileStrictEq):
(JSC::DFG::SpeculativeJIT::compileStringEquality):
(JSC::DFG::SpeculativeJIT::compileStringIdentEquality):
(DFG):
(JSC::DFG::SpeculativeJIT::speculateString):
(JSC::DFG::SpeculativeJIT::speculateStringIdentAndLoadStorage):
(JSC::DFG::SpeculativeJIT::speculateStringIdent):
(JSC::DFG::SpeculativeJIT::speculate):

  • dfg/DFGSpeculativeJIT.h:

(SpeculativeJIT):

  • dfg/DFGUseKind.cpp:

(WTF::printInternal):

  • dfg/DFGUseKind.h:

(JSC::DFG::typeFilterFor):
(JSC::DFG::isCell):

LayoutTests:

Reviewed by Sam Weinig.

Add a benchmark for string equality where there is a long identifier, and
also add a benchmark for non-identifier string equality (since the previous
test for string equality was really identifier equality).

  • fast/js/regress/script-tests/string-long-ident-equality.js: Added.

(foo):

  • fast/js/regress/script-tests/string-var-equality.js: Added.

(addFoo):
(foo):

  • fast/js/regress/string-long-ident-equality-expected.txt: Added.
  • fast/js/regress/string-long-ident-equality.html: Added.
  • fast/js/regress/string-var-equality-expected.txt: Added.
  • fast/js/regress/string-var-equality.html: Added.
9:03 PM Changeset in webkit [153244] by oliver@apple.com
  • 10 edits
    6 adds in trunk

fourthTier: DFG shouldn't exit just because a String GetByVal went out-of-bounds
https://bugs.webkit.org/show_bug.cgi?id=117906

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

This does the obvious thing, but also makes sure that out-of-bounds accesses
don't fall off into a C call, but try to do the fast thing if the prototype
chain is sane. We ought to probably do this for other array accesses in the
future, as well, since it's so darn easy.

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::executeEffects):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileGetByValOnString):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::callOperation):

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::objectPrototypeIsSane):
(JSC):
(JSC::JSGlobalObject::arrayPrototypeChainIsSane):
(JSC::JSGlobalObject::stringPrototypeChainIsSane):

  • runtime/JSGlobalObject.h:

(JSGlobalObject):

LayoutTests:

Reviewed by Mark Hahnenberg.

The out-of-bounds benchmark that isn't insane speeds up by 22x in this
patch.

  • fast/js/regress/script-tests/string-get-by-val-out-of-bounds-insane.js: Added.

(foo):

  • fast/js/regress/script-tests/string-get-by-val-out-of-bounds.js: Added.

(foo):

  • fast/js/regress/string-get-by-val-out-of-bounds-expected.txt: Added.
  • fast/js/regress/string-get-by-val-out-of-bounds-insane-expected.txt: Added.
  • fast/js/regress/string-get-by-val-out-of-bounds-insane.html: Added.
  • fast/js/regress/string-get-by-val-out-of-bounds.html: Added.
9:03 PM Changeset in webkit [153243] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: GC's put_by_id transition fixpoint should converge more quickly
https://bugs.webkit.org/show_bug.cgi?id=117912

Reviewed by Mark Hahnenberg.

This was a rookie mistake. The GC does a classic forward data flow fixpoint. These work well so long as you
iterate the program in program order, or at least something close to program order. Because I enjoy reverse
loops ("while (n--) blah"), I ended up iterating in *reverse* of program order which ensured worst-case
pathologies every single time. And unsurprisingly, this slowed down a program, namely pdfjs.

Flipping the loops to iterate forward fixes a 90% regression in Octane/pdfjs and is otherwise neutral.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::propagateTransitions):

9:03 PM Changeset in webkit [153242] by oliver@apple.com
  • 4 edits
    3 adds in trunk

fourthTier: DFG should CSE MakeRope
https://bugs.webkit.org/show_bug.cgi?id=117905

Source/JavaScriptCore:

Reviewed by Geoffrey Garen.

Adds MakeRope to the CSE phase and removes the comment that says that
we could do it but aren't doing it.

Also fixed SpeculatedType dumping so that if you have a Cell type then
it just prints "Cell" and if you just have Object then it just prints
"Object", instead of printing the long list of types.

  • bytecode/SpeculatedType.cpp:

(JSC::dumpSpeculation):

  • dfg/DFGCSEPhase.cpp:

(JSC::DFG::CSEPhase::performNodeCSE):

LayoutTests:

Reviewed by Geoffrey Garen.

This benchmark speeds up by 50%.

  • fast/js/regress/make-rope-cse-expected.txt: Added.
  • fast/js/regress/make-rope-cse.html: Added.
  • fast/js/regress/script-tests/make-rope-cse.js: Added.

(foo):

9:03 PM Changeset in webkit [153241] by oliver@apple.com
  • 8 edits
    3 adds in trunk

fourthTier: DFG should't exit just because it GetByVal'd a big character
https://bugs.webkit.org/show_bug.cgi?id=117899

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

Add a slow path. Also clarify handling of GetByVal in PutStructure elimination.
Previously it would fail due to canExit() but now we can also fail because
GetByVal(String) can allocate. Just make it so GetByVal is totally poisoned, in
a very explicit way.

  • dfg/DFGCSEPhase.cpp:

(JSC::DFG::CSEPhase::putStructureStoreElimination):

  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileGetByValOnString):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::callOperation):
(SpeculativeJIT):

LayoutTests:

Reviewed by Mark Hahnenberg.

This benchmark speeds up by 3x.

  • fast/js/regress/script-tests/string-get-by-val-big-char.js: Added.

(foo):

  • fast/js/regress/string-get-by-val-big-char-expected.txt: Added.
  • fast/js/regress/string-get-by-val-big-char.html: Added.
9:03 PM Changeset in webkit [153240] by oliver@apple.com
  • 10 edits
    3 adds in trunk

fourthTier: Small strings shouldn't get GC'd
https://bugs.webkit.org/show_bug.cgi?id=117897

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

Kill off the code needed to allocate them lazily and finalize them.

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileGetByValOnString):

  • heap/Heap.cpp:

(JSC::Heap::collect):

  • runtime/JSString.h:

(JSC::jsSingleCharacterString):
(JSC::jsSingleCharacterSubstring):
(JSC::jsString):
(JSC::jsSubstring8):
(JSC::jsSubstring):
(JSC::jsOwnedString):

  • runtime/NumberPrototype.cpp:

(JSC::integerValueToString):

  • runtime/SmallStrings.cpp:

(JSC):
(JSC::SmallStrings::initializeCommonStrings):
(JSC::SmallStrings::visitStrongReferences):

  • runtime/SmallStrings.h:

(JSC::SmallStrings::singleCharacterString):
(SmallStrings):

LayoutTests:

Reviewed by Mark Hahnenberg.

This test speeds up by 5%.

  • fast/js/regress/script-tests/string-get-by-val.js: Added.

(foo):

  • fast/js/regress/string-get-by-val-expected.txt: Added.
  • fast/js/regress/string-get-by-val.html: Added.
9:03 PM Changeset in webkit [153239] by oliver@apple.com
  • 1 edit in trunk/Source/JavaScriptCore/runtime/JSString.h

fourthTier: Re-indent JSString.h to aid mhe merging of the FTL branch

9:03 PM Changeset in webkit [153238] by oliver@apple.com
  • 7 edits in trunk/Source/JavaScriptCore

fourthTier: Structure should have a dump()
https://bugs.webkit.org/show_bug.cgi?id=117859

Reviewed by Geoffrey Garen.

This is pretty cool. Anywhere we previously printed Structure pointers in dumps,
we now print a bunch of other info as well. For example, for an object literal
like "{f:42, g:64, h:24}", when we print the structure we'll now get:

0x107a0af80:[Object, {f:0, g:1, h:2}, NonArray, Proto:0x107a8fff0]

This also changes a bunch of places to use the dump method.

  • bytecode/StructureSet.h:

(JSC::StructureSet::dump):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dump):

  • dfg/DFGStructureAbstractValue.h:

(JSC::DFG::StructureAbstractValue::dump):

  • runtime/JSCJSValue.cpp:

(JSC::JSValue::dump):

  • runtime/Structure.cpp:

(JSC::Structure::dump):
(JSC):

  • runtime/Structure.h:

(Structure):

9:03 PM Changeset in webkit [153237] by oliver@apple.com
  • 19 edits in trunk/Source/JavaScriptCore

fourthTier: There should only be one table of SimpleJumpTables
https://bugs.webkit.org/show_bug.cgi?id=117856

Reviewed by Geoffrey Garen.

Having multiple tables of SimpleJumpTables just means we have to duplicate a
ton of code. This patch deduplicates all of it.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpBytecode):
(JSC):
(JSC::CodeBlock::CodeBlock):
(JSC::CodeBlock::shrinkToFit):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::numberOfSwitchJumpTables):
(JSC::CodeBlock::addSwitchJumpTable):
(JSC::CodeBlock::switchJumpTable):
(JSC::CodeBlock::clearSwitchJumpTables):
(RareData):

  • bytecode/PreciseJumpTargets.cpp:

(JSC):
(JSC::computePreciseJumpTargets):

  • bytecode/UnlinkedCodeBlock.h:

(JSC::UnlinkedCodeBlock::shrinkToFit):
(JSC::UnlinkedCodeBlock::numberOfSwitchJumpTables):
(JSC::UnlinkedCodeBlock::addSwitchJumpTable):
(JSC::UnlinkedCodeBlock::switchJumpTable):
(RareData):

  • bytecompiler/BytecodeGenerator.cpp:

(JSC):
(JSC::prepareJumpTableForSwitch):
(JSC::BytecodeGenerator::endSwitch):

  • dfg/DFGByteCodeParser.cpp:

(InlineStackEntry):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::link):

  • dfg/DFGJITCompiler.h:

(JITCompiler):

  • dfg/DFGOperations.cpp:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::emitSwitchIntJump):
(DFG):
(JSC::DFG::SpeculativeJIT::emitSwitchImm):
(JSC::DFG::SpeculativeJIT::emitSwitchCharStringJump):

  • dfg/DFGSpeculativeJIT.h:

(SpeculativeJIT):

  • ftl/FTLLink.cpp:

(JSC::FTL::link):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_switch_imm):
(JSC::JIT::emit_op_switch_char):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_switch_imm):
(JSC::JIT::emit_op_switch_char):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
9:03 PM Changeset in webkit [153236] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should clear character switch jump tables
https://bugs.webkit.org/show_bug.cgi?id=117852

Reviewed by Sam Weinig.

The FTL just uses LLVM's switch, which results in LLVM allocating its own switch
jump tables as needed.

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::clearCharacterSwitchJumpTables):

  • ftl/FTLLink.cpp:

(JSC::FTL::link):

9:03 PM Changeset in webkit [153235] by oliver@apple.com
  • 17 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should support SwitchChar
https://bugs.webkit.org/show_bug.cgi?id=117849

Reviewed by Geoffrey Garen.

This adds Switch(SwitchChar) to the FTL and also implicitly does some other things.
SwitchChar requires calling a slow path to resolve ropes. Previously the FTL had no
support for calling slow paths, and we avoided adding coverage that would require
that. Well, this patch adds the ability to call slow paths and just uses that for
resolving ropes for SwitchChar. Also SwitchChar required adding awareness of strings,
so I did that, too.

  • bytecode/CodeBlock.h:

(CodeBlock):
(JSC::CodeBlock::addCodeOrigin):

  • dfg/DFGBackwardsPropagationPhase.cpp:

(JSC::DFG::BackwardsPropagationPhase::propagate):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dump):

  • dfg/DFGNode.cpp:

(WTF):
(WTF::printInternal):

  • dfg/DFGNode.h:

(WTF):

  • dfg/DFGOperations.h:
  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::callOperation):

  • ftl/FTLAbbreviations.h:

(JSC::FTL::int16Type):
(JSC::FTL::constInt):

  • ftl/FTLAbstractHeapRepository.h:

(FTL):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLCommonValues.cpp:

(JSC::FTL::CommonValues::CommonValues):

  • ftl/FTLCommonValues.h:

(CommonValues):

  • ftl/FTLIntrinsicRepository.cpp:

(JSC::FTL::IntrinsicRepository::IntrinsicRepository):
(FTL):

  • ftl/FTLIntrinsicRepository.h:

(FTL):
(IntrinsicRepository):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::lower):
(JSC::FTL::LowerDFGToLLVM::transferAndCheckArguments):
(JSC::FTL::LowerDFGToLLVM::compileJump):
(JSC::FTL::LowerDFGToLLVM::compileBranch):
(JSC::FTL::LowerDFGToLLVM::compileSwitch):
(JSC::FTL::LowerDFGToLLVM::buildSwitch):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::lowString):
(JSC::FTL::LowerDFGToLLVM::speculate):
(JSC::FTL::LowerDFGToLLVM::isObject):
(JSC::FTL::LowerDFGToLLVM::isNotString):
(JSC::FTL::LowerDFGToLLVM::isString):
(JSC::FTL::LowerDFGToLLVM::isNotObject):
(JSC::FTL::LowerDFGToLLVM::speculateObject):
(JSC::FTL::LowerDFGToLLVM::speculateString):
(JSC::FTL::LowerDFGToLLVM::speculateNonNullObject):
(JSC::FTL::LowerDFGToLLVM::vmCall):
(JSC::FTL::LowerDFGToLLVM::callPreflight):
(JSC::FTL::LowerDFGToLLVM::callCheck):
(JSC::FTL::LowerDFGToLLVM::lowBlock):

  • ftl/FTLOutput.h:

(JSC::FTL::Output::constBool):
(JSC::FTL::Output::constInt8):
(JSC::FTL::Output::constInt32):
(JSC::FTL::Output::constIntPtr):
(JSC::FTL::Output::constInt64):
(JSC::FTL::Output::load16):
(JSC::FTL::Output::isNull):
(JSC::FTL::Output::notNull):
(JSC::FTL::Output::testIsZero32):
(JSC::FTL::Output::testNonZero32):
(Output):
(JSC::FTL::Output::operation):
(JSC::FTL::Output::crash):

9:03 PM Changeset in webkit [153234] by oliver@apple.com
  • 22 edits
    8 adds in trunk

fourthTier: DFG should have switch_char
https://bugs.webkit.org/show_bug.cgi?id=117710

Source/JavaScriptCore:

Reviewed by Michael Saboff.

Add op_switch_char. Most of this is fairly simple, except for the whole
LazyJSValue thing.

It's long been the case that anytime you wanted the DFG to speak of a string
that didn't appear in the constant pool, you would have a hard time since
the DFG isn't allowed to allocate in the GC heap. For example, if you know
that you want to speak of a single character string, you might find that
the one you wanted to speak of had been GC'd. Another example is if you
wanted to add constant folding for string concatenation - something we don't
have yet but will want eventually.

I solve this by finally adding the notion of LazyJSValue. In the future I
anticipate using this for a variety of string-related things. The idea here
is that the DFG can either say that it already knows what the value is, or
it can describe the value. For example, in this patch I needed to be able to
describe single-character strings.

(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::CodeBlock):

  • bytecode/JumpTable.h:
  • dfg/DFGBackwardsPropagationPhase.cpp:

(JSC::DFG::BackwardsPropagationPhase::propagate):

  • dfg/DFGByteCodeParser.cpp:

(InlineStackEntry):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):

  • dfg/DFGCFGSimplificationPhase.cpp:

(JSC::DFG::CFGSimplificationPhase::run):

  • dfg/DFGCapabilities.cpp:

(JSC::DFG::capabilityLevel):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGGPRInfo.h:

(JSC::DFG::JSValueRegs::payloadGPR):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::jumpTable):
(DFG):
(JSC::DFG::JITCompiler::numberOfJumpTables):
(JSC::DFG::JITCompiler::linkSwitches):
(JSC::DFG::JITCompiler::link):

  • dfg/DFGJITCompiler.h:

(JITCompiler):

  • dfg/DFGLazyJSValue.cpp: Added.

(DFG):
(JSC::DFG::LazyJSValue::getValue):
(JSC::DFG::equalToSingleCharacter):
(JSC::DFG::LazyJSValue::strictEqual):
(JSC::DFG::LazyJSValue::dump):

  • dfg/DFGLazyJSValue.h: Added.

(DFG):
(LazyJSValue):
(JSC::DFG::LazyJSValue::LazyJSValue):
(JSC::DFG::LazyJSValue::singleCharacterString):
(JSC::DFG::LazyJSValue::tryGetValue):
(JSC::DFG::LazyJSValue::value):
(JSC::DFG::LazyJSValue::character):
(JSC::DFG::LazyJSValue::switchLookupValue):

  • dfg/DFGNode.h:

(JSC::DFG::SwitchCase::SwitchCase):
(SwitchCase):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::emitSwitchIntJump):
(JSC::DFG::SpeculativeJIT::emitSwitchImmIntJump):
(DFG):
(JSC::DFG::SpeculativeJIT::emitSwitchImm):
(JSC::DFG::SpeculativeJIT::emitSwitchCharStringJump):
(JSC::DFG::SpeculativeJIT::emitSwitchChar):
(JSC::DFG::SpeculativeJIT::emitSwitch):

  • dfg/DFGSpeculativeJIT.h:

(SpeculativeJIT):

Source/WTF:

Reviewed by Michael Saboff.

I wanted to be able to say stringImpl->at(index), and now I can!

Also made it possible to convert a UChar to a utf8 CString without
allocating a StringImpl.

  • wtf/text/StringImpl.cpp:

(WTF::StringImpl::utf8Impl):
(WTF):
(WTF::StringImpl::utf8ForCharacters):
(WTF::StringImpl::utf8ForRange):

  • wtf/text/StringImpl.h:

(StringImpl):
(WTF::StringImpl::at):
(WTF::StringImpl::operator[]):

LayoutTests:

Rubber stamped by Mark Hahnenberg.

  • fast/js/regress/script-tests/switch-char-constant.js: Added.

(foo):
(bar):

  • fast/js/regress/script-tests/switch-char.js: Added.

(foo):
(bar):

  • fast/js/regress/switch-char-constant-expected.txt: Added.
  • fast/js/regress/switch-char-constant.html: Added.
  • fast/js/regress/switch-char-expected.txt: Added.
  • fast/js/regress/switch-char.html: Added.
9:03 PM Changeset in webkit [153233] by oliver@apple.com
  • 9 edits
    1 copy in trunk/Source/JavaScriptCore

fourthTier: Refactor ObjCCallbackFunction to inherit directly from InternalFunction
https://bugs.webkit.org/show_bug.cgi?id=117595

Reviewed by Geoffrey Garen.

  • API/APICallbackFunction.h: Added. New struct that allows JSCallbackFunction and

ObjCCallbackFunction to share their host call() implementation through the magic of
templates.
(JSC::APICallbackFunction::call):

  • API/JSCallbackFunction.cpp:

(JSC::JSCallbackFunction::getCallData): Changed to get the template-ized version of
the host function.

  • API/JSCallbackFunction.h:
  • API/ObjCCallbackFunction.h: Now inherits directly from InternalFunction.
  • API/ObjCCallbackFunction.mm:

(JSC::ObjCCallbackFunction::ObjCCallbackFunction):
(JSC::ObjCCallbackFunction::getCallData): Ditto.

9:03 PM Changeset in webkit [153232] by oliver@apple.com
  • 14 edits in trunk/Source/JavaScriptCore

fourthTier: Arity fixup should be done while on same stack
https://bugs.webkit.org/show_bug.cgi?id=117102

Reviewed by Oliver Hunt.

Removed the fixup part of op_call_arityCheck() and op_construct_arityCheck() and moved it to
a thunk for the JITs and as assembly for the llint. This patch provides the plumbing needed to
move to the C stack for JS execution. The fixup thunk and llint code would need to be change to
work with a stack that grows down when we do move to the C stack.

Due to an issue with the offline assembler, I moved the const at the top of LowLevelInterpreter64.asm
and LowLevelInterpreter32_64.asm to LowLevelInterpreter.asm. The problem is that a const defined in
one file that are used in a macro doesn't resolve the const if the macro is used in another file. This
seemed like the quickest path.

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::compileFunction):
(JSC::DFG::JITCompiler::linkFunction):

  • dfg/DFGJITCompiler.h:

(JITCompiler):

  • ftl/FTLLink.cpp:

(JSC::FTL::link):

  • jit/JIT.cpp:

(JSC::JIT::privateCompile):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • jit/JITStubs.h:
  • jit/ThunkGenerators.cpp:

(JSC::arityFixup):

  • jit/ThunkGenerators.h:
  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
  • runtime/CommonSlowPaths.cpp:

(JSC::SLOW_PATH_DECL):

  • runtime/CommonSlowPaths.h:

(JSC::CommonSlowPaths::arityCheckFor):

9:03 PM Changeset in webkit [153231] by oliver@apple.com
  • 13 edits in trunk/Source/JavaScriptCore

fourthTier: Add another temp register regT4 to JSInterfaceJIT
https://bugs.webkit.org/show_bug.cgi?id=117719

Reviewed by Geoffrey Garen.

Made the dedicated bucketCounterRegister to be regT4 and then used regT4 wherever
bucketCounterRegister had been used. Since it is masked whenever it is used and
we are looking for some randomness in the register anyway, we can use it without
any issues.

  • jit/JIT.cpp:

(JSC::JIT::privateCompile):

  • jit/JIT.h:

(JSC::JIT::emitValueProfilingSite):

  • jit/JITCall.cpp:

(JSC::JIT::emitPutCallResult):

  • jit/JITCall32_64.cpp:

(JSC::JIT::emitPutCallResult):

  • jit/JITInlines.h:

(JSC::JIT::emitValueProfilingSite):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_to_this):
(JSC::JIT::emit_op_get_callee):
(JSC::JIT::emit_op_get_argument_by_val):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_get_callee):
(JSC::JIT::emit_op_to_this):
(JSC::JIT::emit_op_get_argument_by_val):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::emit_op_get_by_val):
(JSC::JIT::emitSlow_op_get_by_val):
(JSC::JIT::emit_op_get_by_id):
(JSC::JIT::emitSlow_op_get_by_id):
(JSC::JIT::emit_op_get_from_scope):
(JSC::JIT::emitSlow_op_get_from_scope):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::emit_op_get_by_val):
(JSC::JIT::emitSlow_op_get_by_val):
(JSC::JIT::emit_op_get_by_id):
(JSC::JIT::emitSlow_op_get_by_id):
(JSC::JIT::emit_op_get_from_scope):
(JSC::JIT::emitSlow_op_get_from_scope):

  • jit/JITStubCall.h:

(JSC::JITStubCall::callWithValueProfiling):

  • jit/JSInterfaceJIT.h:

(JSInterfaceJIT):

9:03 PM Changeset in webkit [153230] by oliver@apple.com
  • 8 edits
    1 add in trunk/Source/JavaScriptCore

fourthTier: FTL should support Switch
https://bugs.webkit.org/show_bug.cgi?id=117704

Reviewed by Oliver Hunt.

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::clearImmediateSwitchJumpTables):

  • ftl/FTLAbbreviations.h:

(JSC::FTL::buildFPToSI):
(JSC::FTL::buildSwitch):
(JSC::FTL::addCase):
(FTL):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLink.cpp:

(JSC::FTL::link):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileSwitch):
(LowerDFGToLLVM):

  • ftl/FTLOutput.h:

(JSC::FTL::Output::fpToInt):
(JSC::FTL::Output::fpToInt32):
(Output):
(JSC::FTL::Output::switchInstruction):

  • ftl/FTLSwitchCase.h: Added.

(FTL):
(SwitchCase):
(JSC::FTL::SwitchCase::SwitchCase):
(JSC::FTL::SwitchCase::value):
(JSC::FTL::SwitchCase::target):

Conflicts:

Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

9:03 PM Changeset in webkit [153229] by oliver@apple.com
  • 9 edits
    6 adds in trunk

fourthTier: Add CFG simplification for Switch
https://bugs.webkit.org/show_bug.cgi?id=117677

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

This is for completeness. It only speeds up a microbenchmark at this point.
Broadly, we want all control constructs to be known to the CFG simplifier.

  • dfg/DFGCFGSimplificationPhase.cpp:

(JSC::DFG::CFGSimplificationPhase::run):
(JSC::DFG::CFGSimplificationPhase::convertToJump):
(CFGSimplificationPhase):
(JSC::DFG::CFGSimplificationPhase::noBlocks):
(JSC::DFG::CFGSimplificationPhase::oneBlock):
(JSC::DFG::CFGSimplificationPhase::mergeBlocks):

  • runtime/JSCJSValue.h:

(JSValue):

  • runtime/JSCJSValueInlines.h:

(JSC::JSValue::pureStrictEqual):
(JSC):

Source/WTF:

Reviewed by Mark Hahnenberg.

  • wtf/TriState.h:
  • wtf/text/StringImpl.h:

LayoutTests:

Reviewed by Mark Hahnenberg.

  • fast/js/regress/script-tests/switch-constant.js: Added.

(foo):
(bar):

  • fast/js/regress/script-tests/switch.js: Added.

(foo):
(bar):

  • fast/js/regress/switch-constant-expected.txt: Added.
  • fast/js/regress/switch-constant.html: Added.
  • fast/js/regress/switch-expected.txt: Added.
  • fast/js/regress/switch.html: Added.
9:03 PM Changeset in webkit [153228] by oliver@apple.com
  • 26 edits in trunk/Source/JavaScriptCore

fourthTier: DFG should support op_switch_imm
https://bugs.webkit.org/show_bug.cgi?id=117559

Reviewed by Oliver Hunt.

Implement integer (i.e. immediate) switches in the DFG. Reduce the minimum
threshold for using op_switch.

Also get rid of edge code support, since we haven't used it in the year since
I introduced it. It was supposed to allow us to break critical edges late in
the backend, thus enabling global register allocation from an SSA-form graph.
But we aren't doing that so I figure we should just kill the code for now. It
would have made implementing switch harder.

  • assembler/AbstractMacroAssembler.h:

(JSC::AbstractMacroAssembler::timesPtr):

  • assembler/MacroAssemblerCodeRef.h:

(JSC::MacroAssemblerCodePtr::dumpWithName):
(MacroAssemblerCodePtr):
(JSC::MacroAssemblerCodePtr::dump):
(MacroAssemblerCodeRef):
(JSC::MacroAssemblerCodeRef::dump):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::shrinkToFit):

  • bytecode/JumpTable.h:

(SimpleJumpTable):
(JSC::SimpleJumpTable::clear):

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::executeEffects):
(JSC::DFG::AbstractState::mergeToSuccessors):

  • dfg/DFGBackwardsPropagationPhase.cpp:

(JSC::DFG::BackwardsPropagationPhase::propagate):

  • dfg/DFGByteCodeParser.cpp:

(InlineStackEntry):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::linkBlock):
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):

  • dfg/DFGCapabilities.cpp:

(JSC::DFG::capabilityLevel):

  • dfg/DFGCommon.h:
  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dump):
(JSC::DFG::Graph::determineReachability):

  • dfg/DFGGraph.h:

(Graph):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::JITCompiler):
(JSC::DFG::JITCompiler::link):

  • dfg/DFGJITCompiler.h:

(JITCompiler):
(JSC::DFG::JITCompiler::blockHeads):

  • dfg/DFGNode.h:

(DFG):
(JSC::DFG::SwitchCase::SwitchCase):
(SwitchCase):
(SwitchData):
(JSC::DFG::SwitchData::SwitchData):
(Node):
(JSC::DFG::Node::isSwitch):
(JSC::DFG::Node::isTerminal):
(JSC::DFG::Node::switchData):
(JSC::DFG::Node::numSuccessors):
(JSC::DFG::Node::successor):

  • dfg/DFGNodeType.h:

(DFG):

  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGPredictionPropagationPhase.cpp:

(JSC::DFG::PredictionPropagationPhase::propagate):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::SpeculativeJIT):
(JSC::DFG::SpeculativeJIT::compile):
(JSC::DFG::SpeculativeJIT::createOSREntries):
(JSC::DFG::SpeculativeJIT::emitSwitchImmIntJump):
(DFG):
(JSC::DFG::SpeculativeJIT::emitSwitchImm):
(JSC::DFG::SpeculativeJIT::emitSwitch):
(JSC::DFG::SpeculativeJIT::linkBranches):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::callOperation):
(SpeculativeJIT):
(JSC::DFG::SpeculativeJIT::branchDouble):
(JSC::DFG::SpeculativeJIT::branchDoubleNonZero):
(JSC::DFG::SpeculativeJIT::branch32):
(JSC::DFG::SpeculativeJIT::branchTest32):
(JSC::DFG::SpeculativeJIT::branch64):
(JSC::DFG::SpeculativeJIT::branchPtr):
(JSC::DFG::SpeculativeJIT::branchTestPtr):
(JSC::DFG::SpeculativeJIT::branchTest8):
(JSC::DFG::SpeculativeJIT::jump):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • parser/Nodes.h:

(CaseBlockNode):

9:02 PM Changeset in webkit [153227] by oliver@apple.com
  • 8 edits in trunk/Source

fourthTier: Concurrent JIT shouldn't try to recompute the CodeBlockHash as part of debug dumps, since doing so may fail if dealing with a CachedScript that doesn't have its script string handy
https://bugs.webkit.org/show_bug.cgi?id=117676

Reviewed by Sam Weinig.

Source/JavaScriptCore:

CodeBlock now caches m_hash, and the DFG Driver will force its computation if we're doing debug dumps of any kind.

Also made sure that CodeBlock::CodeBlock initializes all of its fields; it was previously missing the
initialization of m_capabilityLevelState.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::hash):
(JSC::CodeBlock::CodeBlock):

  • bytecode/CodeBlock.h:

(CodeBlock):

  • bytecode/CodeBlockHash.cpp:

(JSC::CodeBlockHash::CodeBlockHash):

  • bytecode/CodeBlockHash.h:

(CodeBlockHash):
(JSC::CodeBlockHash::isSet):
(JSC::CodeBlockHash::operator!):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):

Source/WebCore:

Remove the broken hack for the concurrent JIT, since now the concurrent JIT won't use this code anymore.

No new tests because no new behavior.

  • loader/cache/CachedScript.cpp:

(WebCore::CachedScript::script):

9:02 PM Changeset in webkit [153226] by oliver@apple.com
  • 2 edits in trunk/Source/WTF

fourthTier: Printing a StringImpl* should really guard against NULL
https://bugs.webkit.org/show_bug.cgi?id=117675

Reviewed by Mark Hahnenberg.

  • wtf/PrintStream.cpp:

(WTF::printInternal):

9:02 PM Changeset in webkit [153225] by oliver@apple.com
  • 30 edits
    12 adds in trunk

fourthTier: DFG should support op_in and it should use patching to make it fast
https://bugs.webkit.org/show_bug.cgi?id=117385

Source/JavaScriptCore:

Reviewed by Geoffrey Garen.

Implement op_in in the DFG and give it patching. The code we generate is just
a jump on the hot path, and the slow paths generate stubs and link the jump to
them. I didn't want to bother with patching structures and load offsets and
the like, although I probably could have.

This is a ginormous speed-up on microbenchmarks for "in", obviously.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpAssumingJITType):
(JSC::CodeBlock::resetStubInternal):
(JSC::structureStubInfoLessThan):
(JSC):
(JSC::CodeBlock::sortStructureStubInfos):

  • bytecode/CodeBlock.h:

(CodeBlock):

  • bytecode/StructureStubInfo.cpp:

(JSC::StructureStubInfo::deref):
(JSC::StructureStubInfo::visitWeakReferences):

  • bytecode/StructureStubInfo.h:

(JSC::isInAccess):
(JSC):
(StructureStubInfo):
(JSC::StructureStubInfo::initInList):

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::executeEffects):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGCCallHelpers.h:

(JSC::DFG::CCallHelpers::setupResults):

  • dfg/DFGCapabilities.cpp:

(JSC::DFG::capabilityLevel):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGGPRInfo.h:

(JSC::DFG::JSValueRegs::payloadOnly):
(JSValueRegs):
(JSC::DFG::JSValueRegs::JSValueRegs):
(JSC::DFG::JSValueRegs::operator!):
(JSC::DFG::JSValueSource::operator!):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::link):

  • dfg/DFGJITCompiler.h:

(JSC::DFG::InRecord::InRecord):
(InRecord):
(DFG):
(JITCompiler):
(JSC::DFG::JITCompiler::addIn):

  • dfg/DFGNodeType.h:

(DFG):

  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGPredictionPropagationPhase.cpp:

(JSC::DFG::PredictionPropagationPhase::propagate):

  • dfg/DFGRepatch.cpp:

(JSC::DFG::tryRepatchIn):
(DFG):
(JSC::DFG::dfgRepatchIn):
(JSC::DFG::dfgResetIn):

  • dfg/DFGRepatch.h:

(DFG):
(JSC::DFG::dfgResetIn):

  • dfg/DFGSlowPathGenerator.h:

(JSC::DFG::CallSlowPathGenerator::CallSlowPathGenerator):
(JSC::DFG::CallSlowPathGenerator::tearDown):
(JSC::DFG::CallResultAndNoArgumentsSlowPathGenerator::generateInternal):
(JSC::DFG::CallResultAndOneArgumentSlowPathGenerator::generateInternal):
(JSC::DFG::CallResultAndTwoArgumentsSlowPathGenerator::generateInternal):
(JSC::DFG::CallResultAndThreeArgumentsSlowPathGenerator::generateInternal):
(JSC::DFG::CallResultAndFourArgumentsSlowPathGenerator::generateInternal):
(JSC::DFG::CallResultAndFiveArgumentsSlowPathGenerator::generateInternal):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileIn):
(DFG):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::extractResult):
(DFG):
(SpeculativeJIT):
(JSC::DFG::SpeculativeJIT::callOperation):
(JSC::DFG::SpeculativeJIT::appendCallWithExceptionCheckSetResult):
(JSC::DFG::SpeculativeJIT::appendCallSetResult):
(JSC::DFG::JSValueOperand::tagGPR):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • runtime/JSCJSValue.cpp:

(JSC::JSValue::dump):

  • runtime/JSString.h:

(JSString):
(JSC::JSString::tryGetValueImpl):
(JSC):

  • runtime/Operations.h:

(JSC::normalizePrototypeChainForChainAccess):

Source/WTF:

Reviewed by Geoffrey Garen.

Now if you pass a null StringImpl* then something will still get printed instead
of crashing. I figure that this is broadly useful for debug code, and I make use
of it in the JSC portion of this patch.

  • wtf/PrintStream.cpp:

(WTF::printInternal):

LayoutTests:

Reviewed by Geoffrey Garen.

Test coverage for op_in performance.

  • fast/js/regress/in-four-cases-expected.txt: Added.
  • fast/js/regress/in-four-cases.html: Added.
  • fast/js/regress/in-one-case-false-expected.txt: Added.
  • fast/js/regress/in-one-case-false.html: Added.
  • fast/js/regress/in-one-case-true-expected.txt: Added.
  • fast/js/regress/in-one-case-true.html: Added.
  • fast/js/regress/in-two-cases-expected.txt: Added.
  • fast/js/regress/in-two-cases.html: Added.
  • fast/js/regress/script-tests/in-four-cases.js: Added.

(foo):
(bar):

  • fast/js/regress/script-tests/in-one-case-false.js: Added.

(foo):
(bar):

  • fast/js/regress/script-tests/in-one-case-true.js: Added.

(foo):
(bar):

  • fast/js/regress/script-tests/in-two-cases.js: Added.

(foo):
(bar):

9:02 PM Changeset in webkit [153224] by oliver@apple.com
  • 1 edit in trunk/LayoutTests/fast/js/resources/standalone-pre.js

fourthTier: A few fixups to standalone-pre.js

9:02 PM Changeset in webkit [153223] by oliver@apple.com
  • 11 edits in trunk/Source/JavaScriptCore

fourthTier: The Math object should not be polymorphic
https://bugs.webkit.org/show_bug.cgi?id=117576

Reviewed by Oliver Hunt.

Fill in the Math object eagerly, to avoid its structure changing during
execution. There are lots of ways to skin this cat; this one seemed
easiest, and justified given the relative hotness of math operations.

20% speedup on DSP-filtrr tests, small speedups on a few Kraken tests.

  • DerivedSources.make:
  • JavaScriptCore.order:
  • create_hash_table:
  • interpreter/CallFrame.h:

(JSC::ExecState::jsonTable): Removed the Math object's static table.

  • runtime/JSObject.cpp:

(JSC::JSObject::putDirectNativeFunctionWithoutTransition):

  • runtime/JSObject.h:
  • runtime/MathObject.cpp:

(JSC::MathObject::finishCreation):

  • runtime/MathObject.h:

(JSC::MathObject::create): Set up the Math object at construction time.

  • runtime/VM.cpp:

(JSC::VM::VM):
(JSC::VM::~VM):

  • runtime/VM.h: Removed the Math object's static table.
9:02 PM Changeset in webkit [153222] by oliver@apple.com
  • 28 edits
    2 adds in trunk/Source/JavaScriptCore

fourthTier: The baseline jit and LLint should use common slow paths
https://bugs.webkit.org/show_bug.cgi?id=116889

Reviewed by Filip Pizlo.

Moved the llint_slow_paths that return JSValue along with several others to CommonSlowPaths.cpp.
Eliminated the related JIT stubs. Changes the baseline JIT to call these new common stubs.
Added a simple slow path call class that uses argument registers or the stack instead of
JITStackFrame. Changes the exception mechanism for to check for an exception after making
a slowpath call instead of returning to the handler directly form the slowpath function.

(JSC::JIT::privateCompileMainPass):

  • jit/JIT.h:

(JIT):

  • jit/JITArithmetic.cpp:

(JSC::JIT::emitSlow_op_negate):
(JSC::JIT::emitSlow_op_lshift):
(JSC::JIT::emitSlow_op_rshift):
(JSC::JIT::emitSlow_op_urshift):
(JSC::JIT::emitSlow_op_bitand):
(JSC::JIT::emitSlow_op_inc):
(JSC::JIT::emitSlow_op_dec):
(JSC::JIT::emitSlow_op_mod):
(JSC::JIT::emit_op_mod):
(JSC::JIT::compileBinaryArithOpSlowCase):
(JSC::JIT::emit_op_add):
(JSC::JIT::emitSlow_op_add):
(JSC::JIT::emitSlow_op_mul):
(JSC::JIT::emitSlow_op_div):
(JSC::JIT::emitSlow_op_sub):

  • jit/JITArithmetic32_64.cpp:

(JSC::JIT::emitSlow_op_negate):
(JSC::JIT::emitSlow_op_lshift):
(JSC::JIT::emitRightShiftSlowCase):
(JSC::JIT::emitSlow_op_bitand):
(JSC::JIT::emitSlow_op_bitor):
(JSC::JIT::emitSlow_op_bitxor):
(JSC::JIT::emitSlow_op_inc):
(JSC::JIT::emitSlow_op_dec):
(JSC::JIT::emit_op_add):
(JSC::JIT::emitSlow_op_add):
(JSC::JIT::emitSlow_op_sub):
(JSC::JIT::emitSlow_op_mul):
(JSC::JIT::emitSlow_op_div):
(JSC::JIT::emit_op_mod):
(JSC::JIT::emitSlow_op_mod):

  • jit/JITExceptions.cpp:

(JSC::getExceptionLocation):
(JSC::genericThrow):
(JSC::jitThrowNew):

  • jit/JITExceptions.h:

(ExceptionHandler):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_strcat):
(JSC::JIT::emitSlow_op_create_this):
(JSC::JIT::emitSlow_op_to_this):
(JSC::JIT::emitSlow_op_to_primitive):
(JSC::JIT::emitSlow_op_not):
(JSC::JIT::emitSlow_op_bitxor):
(JSC::JIT::emitSlow_op_bitor):
(JSC::JIT::emitSlow_op_stricteq):
(JSC::JIT::emitSlow_op_nstricteq):
(JSC::JIT::emitSlow_op_to_number):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::privateCompileCTINativeCall):
(JSC::JIT::emitSlow_op_to_primitive):
(JSC::JIT::emit_op_strcat):
(JSC::JIT::emitSlow_op_not):
(JSC::JIT::emitSlow_op_stricteq):
(JSC::JIT::emitSlow_op_nstricteq):
(JSC::JIT::emitSlow_op_to_number):
(JSC::JIT::emit_op_create_arguments):
(JSC::JIT::emitSlow_op_create_this):
(JSC::JIT::emitSlow_op_to_this):
(JSC::JIT::emitSlow_op_get_argument_by_val):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):
(JSC::cti_vm_throw_slowpath):

  • jit/JITStubs.h:
  • jit/JITStubsARM.h:
  • jit/JITStubsARMv7.h:
  • jit/JITStubsMIPS.h:
  • jit/JITStubsSH4.h:
  • jit/JITStubsX86.h:
  • jit/JITStubsX86_64.h:
  • jit/JSInterfaceJIT.h:

(JSInterfaceJIT):

  • jit/SlowPathCall.h: Added.

(JITSlowPathCall):
(JSC::JITSlowPathCall::JITSlowPathCall):
(JSC::JITSlowPathCall::call):

  • jit/ThunkGenerators.cpp:

(JSC::nativeForGenerator):

  • llint/LLIntSlowPaths.cpp:

(LLInt):

  • llint/LLIntSlowPaths.h:

(LLInt):

  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter.cpp:
  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
  • runtime/CommonSlowPaths.cpp: Added.

(JSC::SLOW_PATH_DECL):

  • runtime/CommonSlowPaths.h:

(SlowPathReturnType):
(JSC::encodeResult):
(JSC::decodeResult):

  • runtime/JSCJSValue.h:

(JSValue):

9:02 PM Changeset in webkit [153221] by oliver@apple.com
  • 91 edits
    4 deletes in trunk

fourthTier: Re-worked non-local variable resolution
https://bugs.webkit.org/show_bug.cgi?id=117375

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

This patch has two goals:

(1) Simplicity.

  • Net removes 15 opcodes.
  • Net removes 2,000 lines of code.
  • Removes setPair() from the DFG: All DFG nodes have 1 result register now.

(2) Performance.

  • 2%-3% speedup on SunSpider (20% in LLInt and Baseline JIT)
  • 2% speedup on v8-spider
  • 10% speedup on js-regress-hashmap*
  • Amusing 2X speedup on js-regress-poly-stricteq

The bytecode now separates the scope chain resolution opcode from the
scope access opcode.

OLD:

get_scoped_var r0, 1, 0
inc r0
put_scoped_var 1, 0, r0

NEW:

resolve_scope r0, x(@id0)
get_from_scope r1, r0, x(@id0)
inc r1
put_to_scope r0, x(@id0), r1

Also, we link non-local variable resolution opcodes at CodeBlock link
time instead of time of first opcode execution.

This means that we can represent all possible non-local variable
resolutions using just three opcodes, and any optimizations in these
opcodes naturally apply across-the-board.

  • API/JSCTestRunnerUtils.cpp:

(JSC::numberOfDFGCompiles):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpBytecode): Updated for removed things.

(JSC::CodeBlock::CodeBlock): Always provide the full scope chain when
creating a CodeBlock, so we can perform non-local variable resolution.

Added code to perform linking for these opcodes. This is where we figure
out which non-local variable resolutions are optimizable, and how.

(JSC::CodeBlock::finalizeUnconditionally):
(JSC::CodeBlock::noticeIncomingCall):
(JSC::CodeBlock::optimizeAfterWarmUp):
(JSC::CodeBlock::optimizeAfterLongWarmUp):
(JSC::CodeBlock::optimizeSoon): Updated for removed things.

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::needsActivation):
(JSC::GlobalCodeBlock::GlobalCodeBlock):
(JSC::ProgramCodeBlock::ProgramCodeBlock):
(JSC::EvalCodeBlock::EvalCodeBlock):
(JSC::FunctionCodeBlock::FunctionCodeBlock):

  • bytecode/EvalCodeCache.h:

(JSC::EvalCodeCache::getSlow): Updated for interface changes.

  • bytecode/GetByIdStatus.cpp:

(JSC::GetByIdStatus::computeFor): Treat global object access as
optimizable even though the global object has a custom property access
callback. This is what we've always done since, otherwise, we can't
optimize globals. (In future, we probably want to figure out a more
targeted policy than "any property access callback means no
optimization".)

  • bytecode/GlobalResolveInfo.h: Removed.
  • bytecode/Instruction.h:
  • bytecode/Opcode.h:

(JSC::padOpcodeName):

  • bytecode/PutByIdStatus.cpp:

(JSC::PutByIdStatus::computeFor): Like GetByIdStatus.

  • bytecode/ResolveGlobalStatus.cpp: Removed.
  • bytecode/ResolveGlobalStatus.h: Removed.
  • bytecode/ResolveOperation.h: Removed.
  • bytecode/UnlinkedCodeBlock.cpp:

(JSC::generateFunctionCodeBlock):
(JSC::UnlinkedFunctionExecutable::codeBlockFor):
(JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):

  • bytecode/UnlinkedCodeBlock.h: Don't provide a scope chain to unlinked

code blocks. Giving a scope to an unscoped compilation unit invites
programming errors.

  • bytecode/Watchpoint.h:

(JSC::WatchpointSet::addressOfIsInvalidated):

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::resolveCallee):
(JSC::BytecodeGenerator::local):
(JSC::BytecodeGenerator::constLocal):
(JSC::BytecodeGenerator::resolveType):
(JSC::BytecodeGenerator::emitResolveScope):
(JSC::BytecodeGenerator::emitGetFromScope):
(JSC::BytecodeGenerator::emitPutToScope):
(JSC::BytecodeGenerator::emitInstanceOf):
(JSC::BytecodeGenerator::emitPushWithScope):
(JSC::BytecodeGenerator::emitPopScope):
(JSC::BytecodeGenerator::pushFinallyContext):
(JSC::BytecodeGenerator::emitComplexPopScopes):
(JSC::BytecodeGenerator::popTryAndEmitCatch):
(JSC::BytecodeGenerator::emitPushNameScope):
(JSC::BytecodeGenerator::isArgumentNumber):

  • bytecompiler/BytecodeGenerator.h:

(JSC::Local::Local):
(JSC::Local::operator bool):
(JSC::Local::get):
(JSC::Local::isReadOnly):
(JSC::BytecodeGenerator::scopeDepth):
(JSC::BytecodeGenerator::shouldOptimizeLocals):
(JSC::BytecodeGenerator::canOptimizeNonLocals): Refactored the bytecode
generator to resolve all variables within local scope, as if there
were no non-local scope. This helps provide a separation of concerns:
unlinked bytecode is always scope-free, and the linking stage links
in the provided scope.

  • bytecompiler/NodesCodegen.cpp:

(JSC::ResolveNode::isPure):
(JSC::ResolveNode::emitBytecode):
(JSC::EvalFunctionCallNode::emitBytecode):
(JSC::FunctionCallResolveNode::emitBytecode):
(JSC::PostfixNode::emitResolve):
(JSC::DeleteResolveNode::emitBytecode):
(JSC::TypeOfResolveNode::emitBytecode):
(JSC::PrefixNode::emitResolve):
(JSC::ReadModifyResolveNode::emitBytecode):
(JSC::AssignResolveNode::emitBytecode):
(JSC::ConstDeclNode::emitCodeSingle):
(JSC::ForInNode::emitBytecode): A bunch of this codegen is no longer
necessary, since it's redundant with the linking stage.

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::executeEffects):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::ByteCodeParser):
(JSC::DFG::ByteCodeParser::cellConstantWithStructureCheck):
(JSC::DFG::ByteCodeParser::handlePutByOffset):
(JSC::DFG::ByteCodeParser::handleGetById):
(JSC::DFG::ByteCodeParser::parseBlock): Updated for interface changes.
Notably, we can reuse existing DFG nodes -- but the mapping between
bytecode and DFG nodes has changed, and some nodes and corner cases have
been removed.

  • dfg/DFGCSEPhase.cpp:

(JSC::DFG::CSEPhase::scopedVarLoadElimination):
(JSC::DFG::CSEPhase::varInjectionWatchpointElimination):
(JSC::DFG::CSEPhase::globalVarStoreElimination):
(JSC::DFG::CSEPhase::scopedVarStoreElimination):
(JSC::DFG::CSEPhase::getLocalLoadElimination):
(JSC::DFG::CSEPhase::setLocalStoreElimination):
(JSC::DFG::CSEPhase::performNodeCSE): Added CSE for var injection
watchpoints. Even though watchpoints are "free", they're quite common
inside code that's subject to var injection, so I figured we'd save a
little memory.

  • dfg/DFGCapabilities.cpp:

(JSC::DFG::capabilityLevel):

  • dfg/DFGCapabilities.h: Removed detection for old forms.
  • dfg/DFGDriver.h:

(JSC::DFG::tryCompile):
(JSC::DFG::tryCompileFunction):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGGraph.h:
  • dfg/DFGJITCode.cpp:
  • dfg/DFGNode.h:

(JSC::DFG::Node::convertToStructureTransitionWatchpoint):
(JSC::DFG::Node::hasVarNumber):
(JSC::DFG::Node::hasIdentifierNumberForCheck):
(JSC::DFG::Node::hasRegisterPointer):
(JSC::DFG::Node::hasHeapPrediction):

  • dfg/DFGNodeType.h:
  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGPredictionPropagationPhase.cpp:

(JSC::DFG::PredictionPropagationPhase::propagate):

  • dfg/DFGRepatch.h:

(JSC::DFG::dfgResetGetByID):
(JSC::DFG::dfgResetPutByID):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::callOperation): Removed some unneeded things,
and updated for renames.

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile): The two primary changes here are:

(1) Use a watchpoint for var injection instead of looping over the scope
chain and checking. This is more efficient and much easier to model in
code generation.

(2) I've eliminated the notion of an optimized global assignment that
needs to check for whether it should fire a watchpiont. Instead, we
fire pre-emptively at the point of optimization. This removes a bunch
of edge cases, and it seems like a more honest representation of
the fact that our new optimization contradicts our old one.

  • dfg/DFGTypeCheckHoistingPhase.cpp:

(JSC::DFG::TypeCheckHoistingPhase::identifyRedundantStructureChecks):
(JSC::DFG::TypeCheckHoistingPhase::identifyRedundantArrayChecks):

  • heap/DFGCodeBlocks.cpp:

(JSC::DFGCodeBlocks::jettison):

  • interpreter/CallFrame.h:

(JSC::ExecState::trueCallFrame): Removed stuff that's unused now, and
fixed the build.

  • interpreter/Interpreter.cpp:

(JSC::eval):
(JSC::getBytecodeOffsetForCallFrame):
(JSC::getCallerInfo):
(JSC::Interpreter::throwException): Updated exception scope tracking
to match the rest of our linking strategy: The unlinked bytecode compiles
exception scope as if non-local scope did not exist, and we add in
non-local scope at link time. This means that we can restore the right
scope depth based on a simple number, without checking the contents of
the scope chain.

(JSC::Interpreter::execute): Make sure to establish the full scope chain
before linking eval code. We now require the full scope chain at link
time, in order to link non-local variable resolution opcodes.

  • jit/JIT.cpp:

(JSC::JIT::JIT):
(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):

  • jit/JIT.h:
  • jit/JITArithmetic.cpp:

(JSC::JIT::emit_op_add):

  • jit/JITCode.cpp:
  • jit/JITOpcodes.cpp:

(JSC::JIT::emitSlow_op_bitxor):
(JSC::JIT::emitSlow_op_bitor):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emitSlow_op_to_primitive):
(JSC::JIT::emit_op_strcat):
(JSC::JIT::emitSlow_op_create_this):
(JSC::JIT::emitSlow_op_to_this):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::emitVarInjectionCheck):
(JSC::JIT::emitResolveClosure):
(JSC::JIT::emit_op_resolve_scope):
(JSC::JIT::emitSlow_op_resolve_scope):
(JSC::JIT::emitLoadWithStructureCheck):
(JSC::JIT::emitGetGlobalProperty):
(JSC::JIT::emitGetGlobalVar):
(JSC::JIT::emitGetClosureVar):
(JSC::JIT::emit_op_get_from_scope):
(JSC::JIT::emitSlow_op_get_from_scope):
(JSC::JIT::emitPutGlobalProperty):
(JSC::JIT::emitPutGlobalVar):
(JSC::JIT::emitPutClosureVar):
(JSC::JIT::emit_op_put_to_scope):
(JSC::JIT::emitSlow_op_put_to_scope):
(JSC::JIT::emit_op_init_global_const):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::emitVarInjectionCheck):
(JSC::JIT::emitResolveClosure):
(JSC::JIT::emit_op_resolve_scope):
(JSC::JIT::emitSlow_op_resolve_scope):
(JSC::JIT::emitLoadWithStructureCheck):
(JSC::JIT::emitGetGlobalProperty):
(JSC::JIT::emitGetGlobalVar):
(JSC::JIT::emitGetClosureVar):
(JSC::JIT::emit_op_get_from_scope):
(JSC::JIT::emitSlow_op_get_from_scope):
(JSC::JIT::emitPutGlobalProperty):
(JSC::JIT::emitPutGlobalVar):
(JSC::JIT::emitPutClosureVar):
(JSC::JIT::emit_op_put_to_scope):
(JSC::JIT::emitSlow_op_put_to_scope):
(JSC::JIT::emit_op_init_global_const):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • jit/JITStubs.h: Re-wrote baseline JIT codegen for our new variable

resolution model.

  • llint/LLIntData.cpp:

(JSC::LLInt::Data::performAssertions):

  • llint/LLIntSlowPaths.cpp:
  • llint/LLIntSlowPaths.h:
  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter.cpp:

(JSC::CLoop::execute):

  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm: Ditto for LLInt.
  • offlineasm/x86.rb: Fixed a pre-existing encoding bug for a syntactic

form that we never used before.

  • runtime/ArrayPrototype.cpp:

(JSC::arrayProtoFuncToString):
(JSC::arrayProtoFuncToLocaleString):
(JSC::arrayProtoFuncJoin):
(JSC::arrayProtoFuncConcat):
(JSC::arrayProtoFuncPop):
(JSC::arrayProtoFuncPush):
(JSC::arrayProtoFuncReverse):
(JSC::arrayProtoFuncShift):
(JSC::arrayProtoFuncSlice):
(JSC::arrayProtoFuncSort):
(JSC::arrayProtoFuncSplice):
(JSC::arrayProtoFuncUnShift):
(JSC::arrayProtoFuncFilter):
(JSC::arrayProtoFuncMap):
(JSC::arrayProtoFuncEvery):
(JSC::arrayProtoFuncForEach):
(JSC::arrayProtoFuncSome):
(JSC::arrayProtoFuncReduce):
(JSC::arrayProtoFuncReduceRight):
(JSC::arrayProtoFuncIndexOf):
(JSC::arrayProtoFuncLastIndexOf): Fixed some pre-existing bugs in
'this' value conversion, which I made much more common by removing
special cases in bytecode generation.

These functions need to invoke toThis() because they observe the 'this'
value. Also, toLocaleString() is specified to accept non-array 'this'
values.

(Most other host functions don't need this fix because they perform
strict 'this' checking, which never coerces unexpected types.)

  • runtime/CodeCache.cpp:

(JSC::CodeCache::getCodeBlock):
(JSC::CodeCache::getProgramCodeBlock):
(JSC::CodeCache::getEvalCodeBlock):

  • runtime/CodeCache.h: Don't supply a scope to the unlinked code cache.

Unlinked code is supposed to be scope-free, so let's have the compiler
help verify that.

  • runtime/CommonSlowPaths.cpp:

(JSC::SLOW_PATH_DECL):

  • runtime/CommonSlowPaths.h:
  • runtime/Executable.cpp:

(JSC::EvalExecutable::create):
(JSC::EvalExecutable::compileInternal):
(JSC::ProgramExecutable::compileInternal):
(JSC::FunctionExecutable::produceCodeBlockFor):
(JSC::FunctionExecutable::compileForCallInternal):
(JSC::FunctionExecutable::compileForConstructInternal):

  • runtime/Executable.h:

(JSC::EvalExecutable::numVariables):
(JSC::EvalExecutable::numberOfFunctionDecls):

  • runtime/ExecutionHarness.h:

(JSC::prepareForExecutionImpl):
(JSC::prepareFunctionForExecutionImpl):
(JSC::installOptimizedCode): Fiddled with executable initialization so
that we can always generate a full scope chain before we go to link a
code block. We need this because code block linking now depends on the
scope chain to link non-local variable resolution opcodes.

  • runtime/JSActivation.h:
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::JSGlobalObject):
(JSC::JSGlobalObject::createEvalCodeBlock):

  • runtime/JSGlobalObject.h:

(JSC::JSGlobalObject::varInjectionWatchpoint):

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::globalFuncEval):

  • runtime/JSNameScope.h:
  • runtime/JSScope.cpp:

(JSC::abstractAccess):
(JSC::JSScope::objectAtScope):
(JSC::JSScope::depth):
(JSC::JSScope::resolve):
(JSC::JSScope::abstractResolve): Updated to match changes explained above.

  • runtime/JSScope.h:

(JSC::makeType):
(JSC::needsVarInjectionChecks):
(JSC::ResolveOp::ResolveOp):
(JSC::ResolveModeAndType::ResolveModeAndType):
(JSC::ResolveModeAndType::mode):
(JSC::ResolveModeAndType::type):
(JSC::ResolveModeAndType::operand): Removed the old variable resolution
state machine, since it's unused now. Added logic for performing abstract
variable resolution at link time. This is used by codeblock linking.

  • runtime/ObjectPrototype.cpp:

(JSC::objectProtoFuncValueOf):
(JSC::objectProtoFuncHasOwnProperty):
(JSC::objectProtoFuncIsPrototypeOf):
(JSC::objectProtoFuncDefineGetter):
(JSC::objectProtoFuncDefineSetter):
(JSC::objectProtoFuncLookupGetter):
(JSC::objectProtoFuncLookupSetter):
(JSC::objectProtoFuncPropertyIsEnumerable):
(JSC::objectProtoFuncToLocaleString):
(JSC::objectProtoFuncToString): Fixed some pre-existing bugs in
'this' value conversion, which I made much more common by removing
special cases in bytecode generation.

These functions need to invoke toThis() because they observe the 'this'
value.

  • runtime/StringPrototype.cpp:

(JSC::checkObjectCoercible):
(JSC::stringProtoFuncReplace):
(JSC::stringProtoFuncCharAt):
(JSC::stringProtoFuncCharCodeAt):
(JSC::stringProtoFuncConcat):
(JSC::stringProtoFuncIndexOf):
(JSC::stringProtoFuncLastIndexOf):
(JSC::stringProtoFuncMatch):
(JSC::stringProtoFuncSearch):
(JSC::stringProtoFuncSlice):
(JSC::stringProtoFuncSplit):
(JSC::stringProtoFuncSubstr):
(JSC::stringProtoFuncSubstring):
(JSC::stringProtoFuncToLowerCase):
(JSC::stringProtoFuncToUpperCase):
(JSC::stringProtoFuncLocaleCompare):
(JSC::stringProtoFuncBig):
(JSC::stringProtoFuncSmall):
(JSC::stringProtoFuncBlink):
(JSC::stringProtoFuncBold):
(JSC::stringProtoFuncFixed):
(JSC::stringProtoFuncItalics):
(JSC::stringProtoFuncStrike):
(JSC::stringProtoFuncSub):
(JSC::stringProtoFuncSup):
(JSC::stringProtoFuncFontcolor):
(JSC::stringProtoFuncFontsize):
(JSC::stringProtoFuncAnchor):
(JSC::stringProtoFuncLink):
(JSC::trimString): Fixed some pre-existing bugs in
'this' value conversion, which I made much more common by removing
special cases in bytecode generation.

These functions need to invoke toThis() because they observe the 'this'
value.

  • runtime/StructureRareData.cpp:
  • runtime/VM.cpp:

(JSC::VM::~VM):

  • runtime/WriteBarrier.h:

(JSC::WriteBarrierBase::slot): Modified to reduce casting in client code.

LayoutTests:

This patch removed special-case 'this' resolution from bytecode, making
some pre-existing edge cases in 'this' value treatment much more common.

I updated the test results below, and added some tests, to match bug
fixes for these cases.

  • fast/js/script-tests/array-functions-non-arrays.js:
  • fast/js/array-functions-non-arrays-expected.txt: As specified, it's

not an error to pass a non-array to toLocaleString. Our new result
matches Firefox and Chrome.

  • fast/js/array-prototype-properties-expected.txt: Updated for slightly

clearer error message.

  • fast/js/basic-strict-mode-expected.txt: Updated for slightly more

standard error message.

  • fast/js/object-prototype-toString-expected.txt: Added.
  • fast/js/object-prototype-toString.html: Added. This test demonstrates

why we now fail a Sputnik test below, while Firefox and Chrome pass it.
(The test doesn't test what it thinks it tests, and this test verifies
that we get right what it does think it tests.)

  • fast/js/string-prototype-function-this-expected.txt: Added.
  • fast/js/string-prototype-function-this.html: Added. This test shows

that we CheckObjectCoercible in string prototype functions. (We used
to get this wrong, but Sputnik tests made it seem like we got it right
because they didn't test the dynamic scope case.)

  • sputnik/Conformance/11_Expressions/11.1_Primary_Expressions/11.1.1_The_this_Keyword/S11.1.1_A2-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.4_Array/15.4.4/15.4.4.3_Array_prototype_toLocaleString/S15.4.4.3_A2_T1-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.10_String.prototype.match/S15.5.4.10_A1_T3-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.11_String.prototype.replace/S15.5.4.11_A1_T3-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.12_String.prototype.search/S15.5.4.12_A1_T3-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.13_String.prototype.slice/S15.5.4.13_A1_T3-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.14_String.prototype.split/S15.5.4.14_A1_T3-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.15_String.prototype.substring/S15.5.4.15_A1_T3-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.6_String.prototype.concat/S15.5.4.6_A1_T3-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.7_String.prototype.indexOf/S15.5.4.7_A1_T3-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.8_String.prototype.lastIndexOf/S15.5.4.8_A1_T3-expected.txt:

Updated to show failing results. Firefox and Chrome also fail these
tests, and the ES5 spec seems to mandate failure. Because these tests
resolve a String.prototype function at global scope, the 'this' value
for the call is an environment record. Logically, an environment record
converts to 'undefined' at the call site, and should then fail the
CheckObjectCoercible test.

9:02 PM Changeset in webkit [153220] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: isContravenedByStructure is backwards
https://bugs.webkit.org/show_bug.cgi?id=117366

We should be checking if arrayModeForStructure(structure) is a
subset of arrayModesThatPassFiltering(), not the other way around.
Also renamed isContravenedByStructure to better reflect what the
function is trying to determine.

Rubber stamped by Filip Pizlo.

  • dfg/DFGArrayMode.h:

(JSC::DFG::ArrayMode::structureWouldPassArrayModeFiltering):

  • dfg/DFGTypeCheckHoistingPhase.cpp:

(JSC::DFG::TypeCheckHoistingPhase::noticeStructureCheckAccountingForArrayMode):
(JSC::DFG::ArrayTypeCheck::isContravenedByValue):

9:02 PM Changeset in webkit [153219] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: Type check hoisting phase has a dead if statement
https://bugs.webkit.org/show_bug.cgi?id=117510

Reviewed by Geoffrey Garen.

  • dfg/DFGTypeCheckHoistingPhase.cpp:

(JSC::DFG::TypeCheckHoistingPhase::identifyRedundantArrayChecks):

9:02 PM Changeset in webkit [153218] by oliver@apple.com
  • 22 edits
    2 copies
    3 adds in trunk/Source

fourthTier: Introducing the StackIterator class.

This was a non trivial merge as trunk has changed computation of line and column information

Introducing the StackIterator class.
https://bugs.webkit.org/show_bug.cgi?id=117390.

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

The StackIterator class is meant to unify the way we iterate the JS
stack. It also makes it so that we don't have to copy the frame data
into the intermediate StackFrame struct before processing it.
Unfortunately we still can't get rid of StackFrame because it is used
to record frame information for the Exception stack that is expected
to persist beyond when the frames have been popped off the JS stack.

The StackIterator will iterate over all "logical" frames (i.e. including
inlined frames). As it iterates the JS stack, if it encounters a DFG
frame that has inlined frames, the iterator will canonicalize the
inlined frames before returning. Once canonicalized, the frame can be
read like any other frame.

The StackIterator implements a Frame class that inherits from CallFrame.
The StackIterator::Frame serves as reader of the CallFrame that makes
it easier to access information about the frame. The StackIterator::Frame
only adds functions, and no additional data fields.

  • API/JSContextRef.cpp:

(JSContextCreateBacktrace):

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
  • JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
  • JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • Target.pri:
  • interpreter/CallFrame.cpp:

(JSC::CallFrame::begin):
(JSC::CallFrame::beginAt):

  • interpreter/CallFrame.h:

(JSC::ExecState::setInlineCallFrame):
(ExecState):
(JSC::ExecState::end):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::dumpRegisters):
(JSC::Interpreter::unwindCallFrame):
(JSC::Interpreter::getStackTrace):
(JSC::Interpreter::throwException):
(JSC::Interpreter::debug):

  • interpreter/Interpreter.h:

(Interpreter):

  • interpreter/StackIterator.cpp: Added.

(JSC::StackIterator::StackIterator):
(JSC::StackIterator::beginAt):
(JSC::StackIterator::gotoNextFrame):

  • Based on the deleted Interpreter::findFunctionCallFrameFromVMCode().

(JSC::StackIterator::findFrameForFunction):

  • Based on the deleted Interpreter::retrieveCallerFromVMCode().

(JSC::StackIterator::Frame::codeType):

  • Based on the deleted getStackFrameCodeType().

(JSC::StackIterator::Frame::functionName):

  • Based on StackFrame::friendlyFunctionName().

(JSC::StackIterator::Frame::sourceURL):

  • Based on StackFrame::friendlySourceURL().

(JSC::StackIterator::Frame::toString):

  • Based on StackFrame::toString().

(JSC::StackIterator::Frame::bytecodeOffset):
(JSC::StackIterator::Frame::line):

  • Based on StackFrame::line().

(JSC::StackIterator::Frame::column):

  • Based on StackFrame::column().

(JSC::StackIterator::Frame::arguments):

  • Based on the deleted Interpreter::retrieveArgumentsFromVMCode().

(JSC::StackIterator::Frame::retrieveExpressionInfo):

  • Based on StackFrame::expressionInfo().

(JSC::StackIterator::Frame::logicalFrame):

  • Based on the now deleted CallFrame::trueCallFrame().

(JSC::StackIterator::Frame::logicalCallerFrame):

  • Based on the now deleted CallFrame::trueCallerFrame().

(JSC::jitTypeName):
(JSC::printIndents):
(JSC::printif):
(JSC::StackIterator::Frame::print):
(debugPrintCallFrame):

  • Prints the contents of the frame for debugging purposes. There are 2 versions that can be used as follows:
  1. When you have a valid StackIterator, you can print the current frame's content using the print instance method:

iter->print(indentLevel);

  1. When you have a CallFrame* that you want to dump from a debugger console, you can print its content as follows:

(gdb) call debugPrintCallFrame(callFrame)

A sample of the output looks like this:

frame 0x1510c70b0 {

name 'shouldBe'
sourceURL 'testapi.js'
hostFlag 0
isInlinedFrame 0
callee 0x15154efb0
returnPC 0x10ed0786d
callerFrame 0x1510c7058
logicalCallerFrame 0x1510c7058
rawLocationBits 27 0x1b
codeBlock 0x7fe79b037200

bytecodeOffset 27 0x1b / 210
line 46
column 20
jitType 3 <BaselineJIT> isOptimizingJIT 0
hasCodeOrigins 0

}

  • interpreter/StackIterator.h: Added.

(StackIterator::Frame):
(JSC::StackIterator::Frame::create):
(JSC::StackIterator::Frame::isJSFrame):
(JSC::StackIterator::Frame::callFrame):

  • interpreter/StackIteratorPrivate.h: Added.

(StackIterator):
(JSC::StackIterator::operator*):
(JSC::StackIterator::operator->):
(JSC::StackIterator::operator==):
(JSC::StackIterator::operator!=):
(JSC::StackIterator::operator++):
(JSC::StackIterator::end):
(JSC::StackIterator::empty):

  • jsc.cpp:

(functionJSCStack):

  • profiler/ProfileGenerator.cpp:

(JSC::ProfileGenerator::addParentForConsoleStart):

  • profiler/ProfileNode.h:

(ProfileNode):

  • runtime/JSFunction.cpp:

(JSC::retrieveArguments):
(JSC::JSFunction::argumentsGetter):
(JSC::skipOverBoundFunctions):
(JSC::retrieveCallerFunction):
(JSC::JSFunction::callerGetter):
(JSC::JSFunction::getOwnPropertyDescriptor):
(JSC::JSFunction::defineOwnProperty):

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::globalFuncProtoGetter):
(JSC::globalFuncProtoSetter):

  • runtime/ObjectConstructor.cpp:

(JSC::objectConstructorGetPrototypeOf):

  • runtime/Operations.h:

Source/WebCore:

No new tests.

  • ForwardingHeaders/interpreter/StackIterator.h: Added.
  • bindings/js/JSXMLHttpRequestCustom.cpp:

(WebCore::JSXMLHttpRequest::send):

  • bindings/js/ScriptCallStackFactory.cpp:

(WebCore::createScriptCallStack):

9:02 PM Changeset in webkit [153217] by oliver@apple.com
  • 16 edits
    6 adds in trunk

fourthTier: DFG GetById patching shouldn't distinguish between self lists and proto lists
https://bugs.webkit.org/show_bug.cgi?id=117377

Source/JavaScriptCore:

Reviewed by Geoffrey Garen.

Previously if you did self accesses and then wanted to do a prototype access, you'd
have a bad time: the prototype accesses would be forced to take slow path because
the self list wouldn't allow prototype accesses. Likewise if you did prototype (or
chain) accesses and then wanted to do a self access, similar stupidity would ensue.

This fixes the stupidity.

I believe that this was introduced way back in the days of the old interpreter,
where distinguishing between self lists, proto lists, and chain lists was meaningful
for interpreter performance: it meant fewer branches to evaluate those lists. Then
it got mostly carried over to the old JIT since the old JIT was just initially an
optimized version of the old interpreter, and then later it got carried over to the
DFG because I didn't know any better at the time. Now I do know better and I'm
fixing it.

  • bytecode/PolymorphicAccessStructureList.h:

(JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):

  • bytecode/StructureStubInfo.h:

(JSC::StructureStubInfo::initGetByIdSelfList):

  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGRepatch.cpp:

(JSC::DFG::tryCacheGetByID):
(JSC::DFG::getPolymorphicStructureList):
(DFG):
(JSC::DFG::patchJumpToGetByIdStub):
(JSC::DFG::tryBuildGetByIDList):
(JSC::DFG::dfgBuildGetByIDList):

LayoutTests:

Reviewed by Geoffrey Garen.

Add tests that show why this is important. These tests speed up by more than 3x.

  • fast/js/regress/get-by-id-proto-or-self-expected.txt: Added.
  • fast/js/regress/get-by-id-proto-or-self.html: Added.
  • fast/js/regress/get-by-id-self-or-proto-expected.txt: Added.
  • fast/js/regress/get-by-id-self-or-proto.html: Added.
  • fast/js/regress/script-tests/get-by-id-proto-or-self.js: Added.

(foo):
(bar):
(Foo):

  • fast/js/regress/script-tests/get-by-id-self-or-proto.js: Added.

(foo):
(bar):
(Foo):

9:02 PM Changeset in webkit [153216] by oliver@apple.com
  • 16 edits in trunk/Source

fourthTier: Recursive deadlock in DFG::ByteCodeParser
https://bugs.webkit.org/show_bug.cgi?id=117376

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

Leave the lock early to prevent a deadlock beneath get().

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::parseBlock):

Source/WTF:

Reviewed by Mark Hahnenberg.

I've often wanted to leave a lock early. Now I have that power!

  • wtf/Locker.h:

(WTF::Locker::Locker):
(WTF::Locker::~Locker):
(Locker):
(WTF::Locker::unlockEarly):
(WTF::Locker::lock):

9:02 PM Changeset in webkit [153215] by oliver@apple.com
  • 11 edits in trunk

fourthTier: don't insert ForceOSRExits except for inadequate coverage
https://bugs.webkit.org/show_bug.cgi?id=117363

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

Previously (in http://trac.webkit.org/changeset/151303) I made it so that we
inserted ForceOSRExits more eagerly. I now think it's better to have
contradictions execute normally and exit with full OSR exit profiling. It's
better at catching the few cases where the DFG will end up with different
types than the baseline engines.

This simplifies a bunch of code. For example it gets rid of
ConstantFoldingPhase::paintUnreachableCode().

You can think of this as a partial roll-out of r151303, except that it uses
the facilities introduced by that patch to give us run-time assertions that
check the CFA's correctness: if the CFA thought that something was a
contradiction but the code didn't exit, we'll now trap.

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::AbstractState):
(JSC::DFG::AbstractState::startExecuting):
(JSC::DFG::AbstractState::executeEffects):
(JSC::DFG::AbstractState::execute):
(JSC::DFG::AbstractState::filter):
(JSC::DFG::AbstractState::filterArrayModes):
(JSC::DFG::AbstractState::filterByValue):
(DFG):

  • dfg/DFGAbstractState.h:

(AbstractState):
(JSC::DFG::AbstractState::filter):
(JSC::DFG::AbstractState::filterArrayModes):
(JSC::DFG::AbstractState::filterByValue):

  • dfg/DFGCFAPhase.cpp:

(JSC::DFG::CFAPhase::performBlockCFA):

  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::run):
(JSC::DFG::ConstantFoldingPhase::foldConstants):
(ConstantFoldingPhase):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):

LayoutTests:

Reviewed by Mark Hahnenberg.

Convert this test, since this was the test originally added for
ConstantFoldingPhase::paintUnreachableCode(). I wanted to make sure that I had good coverage
for this since I am removing that method.

  • fast/js/dfg-force-exit-then-sparse-conditional-constant-prop-in-loop-expected.txt:
  • fast/js/script-tests/dfg-force-exit-then-sparse-conditional-constant-prop-in-loop.js:
9:02 PM Changeset in webkit [153214] by oliver@apple.com
  • 4 edits in trunk/Source/JavaScriptCore

fourthTier: Reenable the DFG optimization fixpoint now that it's profitable to do so with concurrent compilation
https://bugs.webkit.org/show_bug.cgi?id=117331

Rubber stamped by Sam Weinig.

  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::compileInThreadImpl):

9:02 PM Changeset in webkit [153213] by oliver@apple.com
  • 25 edits
    1 copy in trunk/Source/JavaScriptCore

fourthTier: DFG CFA should know when it hits a contradiction
https://bugs.webkit.org/show_bug.cgi?id=117272

Reviewed by Oliver Hunt.

This makes the DFG CFA immediately detect when it hit a contradiction. Previously
we might not know this: for example if we did an int32 type check on a known string;
the code would definitely always exit but the CFA would think that we wouldn't have
even though it would have computed a BOTTOM (i.e. contradictory) value for that
variable.

This requires two other changes:

  • CFA must report contradictions as if they are frequent exit sites, since contradictory speculations will subsequently get replaced with ForceOSRExit. ForceOSRExit cannot itself report profiling data back to the DFG::ExitProfile. So, we do this on behalf of the speculation, eagerly, within the CFA. This also has the effect of speeding convergence somewhat. We may want to revisit this later; for example we might want to instead have the notion of a ForceOSRExit that knows the set of speculations that got folded into it.
  • This revealed a bug where the CFA was modeling CheckStructure on a node that had a known singleton m_futurePossibleStructure set somewhat differently than the constant folder. If the CheckStructure was checking a structure set with two or more structures in it, it would not filter the abstract value. But the constant folder would turn this into a watchpoint on the singleton structure, thereby filtering the value. This discrepancy meant that we wouldn't realize the contradiction until the backend, and the AbstractState::bail() method asserts that we always realize contradictions in the constant folder.

(JSC::CodeBlock::addFrequentExitSite):
(JSC::CodeBlock::hasExitSite):
(CodeBlock):

  • bytecode/DFGExitProfile.cpp:

(JSC::DFG::ExitProfile::add):
(JSC::DFG::ExitProfile::hasExitSite):
(JSC::DFG::QueryableExitProfile::QueryableExitProfile):
(JSC::DFG::QueryableExitProfile::~QueryableExitProfile):
(DFG):
(JSC::DFG::QueryableExitProfile::initialize):

  • bytecode/DFGExitProfile.h:

(JSC::DFG::FrequentExitSite::FrequentExitSite):
(ExitProfile):
(JSC::DFG::ExitProfile::hasExitSite):
(QueryableExitProfile):

  • bytecode/ExitKind.cpp:

(JSC::exitKindToString):

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::AbstractState):
(JSC::DFG::AbstractState::beginBasicBlock):
(JSC::DFG::AbstractState::reset):
(JSC::DFG::AbstractState::startExecuting):
(JSC::DFG::AbstractState::executeEffects):
(JSC::DFG::AbstractState::execute):
(JSC::DFG::AbstractState::filter):
(DFG):
(JSC::DFG::AbstractState::filterArrayModes):
(JSC::DFG::AbstractState::filterByValue):
(JSC::DFG::AbstractState::bail):

  • dfg/DFGAbstractState.h:

(AbstractState):
(JSC::DFG::AbstractState::filter):
(JSC::DFG::AbstractState::filterArrayModes):
(JSC::DFG::AbstractState::filterByValue):
(JSC::DFG::AbstractState::filterByType):

  • dfg/DFGAbstractValue.cpp:

(JSC::DFG::AbstractValue::filter):
(JSC::DFG::AbstractValue::filterArrayModes):
(DFG):
(JSC::DFG::AbstractValue::filterByValue):
(JSC::DFG::AbstractValue::normalizeClarity):

  • dfg/DFGAbstractValue.h:

(AbstractValue):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):

  • dfg/DFGCFAPhase.cpp:

(JSC::DFG::CFAPhase::performBlockCFA):

  • dfg/DFGCapabilities.cpp:

(JSC::DFG::debugFail):
(JSC::DFG::capabilityLevel):

  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::foldConstants):
(ConstantFoldingPhase):
(JSC::DFG::ConstantFoldingPhase::paintUnreachableCode):

  • dfg/DFGFiltrationResult.h: Added.

(DFG):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGNodeType.h:

(DFG):

  • dfg/DFGOSRExitBase.cpp:

(JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSiteSlow):

  • dfg/DFGOSRExitBase.h:

(JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSite):

  • dfg/DFGPredictionPropagationPhase.cpp:

(JSC::DFG::PredictionPropagationPhase::propagate):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::backwardTypeCheck):
(JSC::DFG::SpeculativeJIT::bail):
(DFG):
(JSC::DFG::SpeculativeJIT::compile):
(JSC::DFG::SpeculativeJIT::compileToStringOnCell):
(JSC::DFG::SpeculativeJIT::speculateStringObject):
(JSC::DFG::SpeculativeJIT::speculateStringOrStringObject):

  • dfg/DFGSpeculativeJIT.h:

(SpeculativeJIT):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
(JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
(JSC::DFG::SpeculativeJIT::fillSpeculateCell):
(JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
(JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
(JSC::DFG::SpeculativeJIT::fillSpeculateCell):
(JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
(JSC::DFG::SpeculativeJIT::compile):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::appendTypeCheck):

9:02 PM Changeset in webkit [153212] by oliver@apple.com
  • 10 edits in trunk/Source/JavaScriptCore

fourthTier: 32-bit CallFrame::Location should use Instruction* for BytecodeLocation, not bytecodeOffset.
https://bugs.webkit.org/show_bug.cgi?id=117327.

Reviewed by Michael Saboff.

  • Renamed CallFrame::Location's Type to TypeTag.
  • Made the CallFrame::Location::TypeTag private, and provided type specific encoder functions. This reduces verbosity in client code.
  • Fixed the DFG's reifyInlinedCallFrames() on 32-bit ports to store a bytecode Instruction* in the CallFrame location instead of a bytecode offset.
  • Fixed places in JIT and FTL code which populate the CallFrame location (i.e. ArgumentCount tag) to use a Location encoder instead of storing the bytecodeOffset directly. This doesn't make any semantic difference, but it does assert that the stored value does not have bits where we would expect Location TypeTags to be.
  • dfg/DFGJITCompiler.h:

(JSC::DFG::JITCompiler::beginCall):

  • dfg/DFGOSRExitCompilerCommon.cpp:

(JSC::DFG::reifyInlinedCallFrames):

  • ftl/FTLLink.cpp:

(JSC::FTL::link):

  • interpreter/CallFrame.cpp:

(JSC::CallFrame::setLocationAsBytecodeOffset):

  • interpreter/CallFrame.h:

(Location):

  • interpreter/CallFrameInlines.h:

(JSC::CallFrame::Location::encodeAsBytecodeOffset):
(JSC::CallFrame::Location::encodeAsBytecodeInstruction):
(JSC::CallFrame::Location::encodeAsCodeOriginIndex):
(JSC::CallFrame::Location::encodeAsInlinedCode):
(JSC::CallFrame::Location::isBytecodeLocation):
(JSC::CallFrame::setIsInlinedFrame):
(JSC::CallFrame::hasLocationAsBytecodeOffset):
(JSC::CallFrame::setLocationAsBytecodeOffset):

  • jit/JITCall.cpp:

(JSC::JIT::compileOpCall):

  • jit/JITCall32_64.cpp:

(JSC::JIT::compileOpCall):

  • jit/JITInlines.h:

(JSC::JIT::updateTopCallFrame):

9:02 PM Changeset in webkit [153211] by oliver@apple.com
  • 11 edits in trunk/Source/JavaScriptCore

fourthTier: CallFrame::trueCallFrame() should populate the bytecodeOffset field
when reifying inlined frames..
https://bugs.webkit.org/show_bug.cgi?id=117209.

Reviewed by Geoffrey Garen.

When reifying an inlined frame, we fill in its CodeBlock, and
bytecodeOffset. We also set the InlinedFrame bit in the location field.
This is needed in order to iterate the stack correctly. Here's why:

Let's say we have the following stack trace:

X calls A inlines B inlines C calls D

Based on the above scenario,

  1. D's callerFrame points to A (not C).
  2. A has a codeOriginIndex that points to C.

When iterating the stack (from D back towards X), we will encounter A
twice:

t1. when trying to find C as D's caller.

This is the time when we reify B and C using the
codeOriginIndex in A, and return C as the caller frame of D.

t2. when getting's the reified B's caller.

This time, we don't run the reification process, and
just take A as the caller frame of B.

To discern which treatment of the DFG frame (i.e. A) we need to apply,
we check if the callee is an inlined frame:

If callee is NOT an inlined frame (e.g. frame D), apply treatment t1.
If callee is an inlined frame (e.g. frame B), apply treatment t2.

Why not just reify A by replacing its codeOriginIndex with A's
bytecodeOffset?

We can't do this because D's callerFrame pointer still points to A, and
needs to remain that way because we did not deopt A. It remains a DFG
frame which inlined B and C.

If we replace the codeOriginIndex in A with A's bytecodeOffset, we will
only get to iterate the stack correctly once. If we try to iterate the
stack a second time, we will not have the information from the
codeOriginIndex to tell us that D's caller is actually the inlined C,
and not A.

To recap, when reifying frames for stack iteration purposes, the DFG
frame needs to hold on to its codeOriginIndex. This in turn means the
DFG frame will need to be treated in 2 possible ways, and we need to
know if a callee frame is an inlined frame in order to choose the
correct treatment for the DFG frame.

Other changes:

  • Simplified Interpreter::getCallerInfo().
  • Removed CodeBlock::codeOriginForReturn() and supporting code which is now unneeded.
  • Moved CallFrame location bit encoding from the CodeOrigin to the new CallFrame::Location class.
  • Explicitly tagged inlined frames. This is necessary in order to iterate the stack correctly as explained above.
  • bytecode/CodeBlock.cpp:
  • bytecode/CodeBlock.h:

(JSC::CodeBlock::codeOrigins):
(CodeBlock):
(JSC::CodeBlock::codeOrigin):
(RareData):

  • bytecode/CodeOrigin.h:

(CodeOrigin):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::link):

  • dfg/DFGJITCompiler.h:

(JSC::DFG::JITCompiler::beginCall):

  • interpreter/CallFrame.cpp:

(JSC::CallFrame::trueCallFrame):
(JSC::CallFrame::trueCallerFrame):
(JSC::CallFrame::bytecodeOffsetFromCodeOriginIndex):

  • interpreter/CallFrame.h:

(Location):
(ExecState):
(JSC::ExecState::trueCallerFrame):
(JSC::ExecState::callerFrameNoFlags):

  • interpreter/CallFrameInlines.h:

(JSC::CallFrame::Location::encode):
(JSC::CallFrame::Location::decode):
(JSC::CallFrame::Location::isBytecodeOffset):
(JSC::CallFrame::Location::isCodeOriginIndex):
(JSC::CallFrame::Location::isInlinedFrame):
(JSC::CallFrame::isInlinedFrame):
(JSC::CallFrame::setIsInlinedFrame):
(JSC::CallFrame::hasLocationAsBytecodeOffset):
(JSC::CallFrame::hasLocationAsCodeOriginIndex):
(JSC::CallFrame::locationAsBytecodeOffset):
(JSC::CallFrame::setLocationAsBytecodeOffset):
(JSC::CallFrame::locationAsCodeOriginIndex):

  • interpreter/Interpreter.cpp:

(JSC::getCallerInfo):
(JSC::Interpreter::getStackTrace):
(JSC::Interpreter::findFunctionCallFrameFromVMCode):

  • runtime/Arguments.cpp:

(JSC::Arguments::tearOff):

9:02 PM Changeset in webkit [153210] by oliver@apple.com
  • 5 edits in trunk/Source/JavaScriptCore

fourthTier: DFG CFA shouldn't filter ArrayModes with ALL_NON_ARRAY_ARRAY_MODES if the speculated type is not SpecArray
https://bugs.webkit.org/show_bug.cgi?id=117279

Reviewed by Mark Hahnenberg.

The normalization of abstract value clarity introduced in r151229 revealed a
long-standing bug where we filtered ArrayModes incorrectly and sometimes ended
up with BOTTOM incorrectly.

This patch fixes that bug, and cleans up a bunch of debugging infrastructure
that I needed to resurrect to track this down.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::resetStubInternal):
(JSC::CodeBlock::noticeIncomingCall):

  • dfg/DFGAbstractValue.cpp:

(JSC::DFG::AbstractValue::filterArrayModesByType):

  • dfg/DFGCFAPhase.cpp:

(CFAPhase):
(JSC::DFG::CFAPhase::run):
(JSC::DFG::CFAPhase::performBlockCFA):
(JSC::DFG::CFAPhase::performForwardCFA):

  • runtime/Options.h:

(JSC):

9:02 PM Changeset in webkit [153209] by oliver@apple.com
  • 11 edits
    1 add in trunk/Source/JavaScriptCore

fourthTier: Disambiguate between CallFrame bytecodeOffset and codeOriginIndex.
https://bugs.webkit.org/show_bug.cgi?id=117262.

Reviewed by Geoffrey Garen.

When writing to the ArgumentCount tag in CallFrame, we will set the high
bit if the written value is a codeOriginIndex.

(CodeOrigin):
(JSC::CodeOrigin::isHandle):
(JSC::CodeOrigin::encodeHandle):
(JSC::CodeOrigin::decodeHandle):

  • dfg/DFGJITCompiler.h:

(JSC::DFG::JITCompiler::beginCall):

  • dfg/DFGRepatch.cpp:

(JSC::DFG::tryBuildGetByIDList):

  • interpreter/CallFrame.cpp:

(JSC::CallFrame::locationAsBytecodeOffset):
(JSC::CallFrame::setLocationAsBytecodeOffset):
(JSC::CallFrame::currentVPC):
(JSC::CallFrame::setCurrentVPC):
(JSC::CallFrame::trueCallFrame):

  • interpreter/CallFrame.h:

(ExecState):
(JSC::ExecState::inlineCallFrame):

  • interpreter/CallFrameInlines.h: Added.

(JSC::CallFrame::hasLocationAsBytecodeOffset):
(JSC::CallFrame::hasLocationAsCodeOriginIndex):
(JSC::CallFrame::locationAsRawBits):
(JSC::CallFrame::setLocationAsRawBits):
(JSC::CallFrame::locationAsBytecodeOffset):
(JSC::CallFrame::setLocationAsBytecodeOffset):
(JSC::CallFrame::locationAsCodeOriginIndex):

  • interpreter/Interpreter.cpp:

(JSC::getBytecodeOffsetForCallFrame):
(JSC::getCallerInfo):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

9:02 PM Changeset in webkit [153208] by oliver@apple.com
  • 4 edits in trunk/Source/JavaScriptCore

fourthTier: Clean up AbstractValue
https://bugs.webkit.org/show_bug.cgi?id=117217

Reviewed by Oliver Hunt.

This started as an attempt to make it so that when AbstractValue becomes empty,
its m_type always becomes SpecNone. I wanted this to happen naturally. That turns
out to be basically impossible, since AbstractValue is a set that is dynamically
computed from the intersection of several internal sets: so the value becomes
empty when any of the sets go empty. It's OK if we're imprecise here because it's
always safe for the AbstractValue to seem to overapproximate the set of values
that we see. So I mostly gave up on cleaning up that aspect of AbstractValue. But
while trying to make this happen, I encountered two bugs:

  • filterValueByType() ignores the case when m_type contravenes m_value. Namely, we might filter the AbstractValue against a SpeculatedType leading to m_value becoming inconsistent with the new m_type. This change fixes that case. This wasn't a symptomatic bug but it was a silly oversight.
  • filterFuturePossibleStructure() was never right. The one call to this method, in filter(Graph&, const StructureSet&), assumed that the previous notions of what structures the value could have in the future were still relevant. This could lead to a bug where we:

1) CheckStructure(@foo, S1)

Where S1 has a valid watchpoint. Now @foo's abstract value will have current
and future structure = S1.

2) Clobber the world.

Now @foo's abstract value will have current structure = TOP, and future
possible structure = S1.

3) CheckStructure(@foo, S2)

Now @foo's abstract value will have current structure = S2 and future
possible structure = S1 intersect S2 = BOTTOM.

Now we will think that any subsequent watchpoint on @foo is valid because the
value is effectively BOTTOM. That would only be correct if we had actually set
a watchpoint on S1. If we had done so, then (3) would only pass (i.e. @foo
would only have structure S2) if S1's watchpoint fired, in which case (3)
wouldn't have been reachable. But we didn't actually set a watchpoint on S1:
we just observed that we *could* have set the watchpoint. Hence future possible
structure should only be set to either the known structure at compile-time, or
it should be the structure we just checked; in both cases it should only be set
if the structure is watchable.

Then, in addition to all of this, I changed AbstractValue's filtering methods to
call clear() if the AbstractValue is effectively clear. This is just meant to
simplify the recognition of truly empty AbstractValues, but doesn't actually have
any other implications.

  • bytecode/StructureSet.h:

(JSC::StructureSet::dump):

  • dfg/DFGAbstractValue.cpp:

(JSC::DFG::AbstractValue::filter):
(DFG):
(JSC::DFG::AbstractValue::filterArrayModes):
(JSC::DFG::AbstractValue::filterValueByType):
(JSC::DFG::AbstractValue::filterArrayModesByType):
(JSC::DFG::AbstractValue::shouldBeClear):
(JSC::DFG::AbstractValue::normalizeClarity):
(JSC::DFG::AbstractValue::checkConsistency):

  • dfg/DFGAbstractValue.h:

(JSC::DFG::AbstractValue::isClear):
(AbstractValue):

9:01 PM Changeset in webkit [153207] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: The DFG JIT should populate frame bytecodeOffsets on OSR exit.
https://bugs.webkit.org/show_bug.cgi?id=117103.

Reviewed by Geoffrey Garen.

  • dfg/DFGOSRExitCompilerCommon.cpp:

(JSC::DFG::reifyInlinedCallFrames):

9:01 PM Changeset in webkit [153206] by oliver@apple.com
  • 6 edits in trunk/Source/JavaScriptCore

fourthTier: all cached put_by_id transitions, even ones that weren't inlined by the DFG, should be propagated by the GC
https://bugs.webkit.org/show_bug.cgi?id=117170

Reviewed by Mark Hahnenberg.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::visitAggregate):
(JSC::CodeBlock::propagateTransitions):
(JSC):
(JSC::CodeBlock::determineLiveness):
(JSC::CodeBlock::visitWeakReferences):
(JSC::CodeBlock::finalizeUnconditionally):

  • bytecode/CodeBlock.h:

(CodeBlock):

  • bytecode/PolymorphicPutByIdList.h:

(JSC):
(PutByIdAccess):
(PolymorphicPutByIdList):

  • bytecode/StructureStubInfo.h:

(StructureStubInfo):

  • jit/JITCode.h:

(JSC::JITCode::couldBeInterpreted):
(JITCode):

9:01 PM Changeset in webkit [153205] by oliver@apple.com
  • 9 edits in trunk

fourthTier: Get rid of StructureStubInfo::bytecodeIndex
https://bugs.webkit.org/show_bug.cgi?id=117127

Reviewed by Mark Hahnenberg.

StructureStubInfo already has a CodeOrigin field, which also has a bytecodeIndex.
It makes sense to just always use the CodeOrigin.

  • bytecode/StructureStubInfo.h:

(StructureStubInfo):
(JSC::getStructureStubInfoBytecodeIndex):

  • jit/JIT.cpp:

(JSC::PropertyStubCompilationInfo::copyToStubInfo):

  • jit/JIT.h:

(JSC::JIT::compileGetByIdProto):
(JSC::JIT::compileGetByIdSelfList):
(JSC::JIT::compileGetByIdProtoList):
(JSC::JIT::compileGetByIdChainList):
(JSC::JIT::compileGetByIdChain):
(JSC::JIT::compilePutByIdTransition):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::privateCompilePutByIdTransition):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::privateCompilePutByIdTransition):

9:01 PM Changeset in webkit [153204] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: Fix some minor issues in the DFG's profiling of heap accesses
https://bugs.webkit.org/show_bug.cgi?id=113010

Reviewed by Goeffrey Garen.

Carefully merge r146669 from trunk. This required some fiddling since it
wasn't a clean apply.

Original changelog:

1) If a CodeBlock gets jettisoned by GC, we should count the exit sites.

2) If a CodeBlock clears a structure stub during GC, it should record this, and
the DFG should prefer to not inline that access (i.e. treat it as if it had an
exit site).

3) If a PutById was seen by the baseline JIT, and the JIT attempted to cache it,
but it chose not to, then assume that it will take slow path.

4) If we frequently exited because of a structure check on a weak constant,
don't try to inline that access in the future.

5) Treat all exits that were counted as being frequent.

81% speed-up on Octane/gbemu. Small speed-ups elsewhere, and no regressions.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::finalizeUnconditionally):
(JSC):
(JSC::CodeBlock::resetStubDuringGCInternal):
(JSC::CodeBlock::reoptimize):
(JSC::CodeBlock::jettison):
(JSC::ProgramCodeBlock::jettisonImpl):
(JSC::EvalCodeBlock::jettisonImpl):
(JSC::FunctionCodeBlock::jettisonImpl):
(JSC::CodeBlock::tallyFrequentExitSites):

  • bytecode/CodeBlock.h:

(CodeBlock):
(JSC::CodeBlock::tallyFrequentExitSites):
(ProgramCodeBlock):
(EvalCodeBlock):
(FunctionCodeBlock):

  • bytecode/GetByIdStatus.cpp:

(JSC::GetByIdStatus::computeFor):

  • bytecode/PutByIdStatus.cpp:

(JSC::PutByIdStatus::computeFor):

  • bytecode/StructureStubInfo.h:

(JSC::StructureStubInfo::StructureStubInfo):
(StructureStubInfo):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleGetById):
(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGOSRExitBase.cpp:

(JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSiteSlow):

  • dfg/DFGOSRExitBase.h:

(JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSite):
(OSRExitBase):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/Options.h:

(JSC):

9:01 PM Changeset in webkit [153203] by oliver@apple.com
  • 14 edits in trunk/LayoutTests

fourthTier: convert more fast/js/dfg-* tests to wait for the concurrent JIT

Rubber stamped by Mark Hahnenberg.

  • fast/js/dfg-arguments-alias-one-block-overwrite-expected.txt:
  • fast/js/dfg-arguments-out-of-bounds-expected.txt:
  • fast/js/dfg-arith-add-overflow-check-elimination-predicted-but-not-proven-int-expected.txt:
  • fast/js/dfg-arith-add-overflow-check-elimination-tower-of-large-numbers-expected.txt:
  • fast/js/dfg-array-length-dead-expected.txt:
  • fast/js/dfg-array-pop-side-effects-expected.txt:
  • fast/js/resources/js-test-pre.js:

(testFailed):
(dfgIncrement):
(isSuccessfullyParsed):

  • fast/js/script-tests/dfg-arguments-alias-one-block-overwrite.js:
  • fast/js/script-tests/dfg-arguments-out-of-bounds.js:
  • fast/js/script-tests/dfg-arith-add-overflow-check-elimination-predicted-but-not-proven-int.js:
  • fast/js/script-tests/dfg-arith-add-overflow-check-elimination-tower-of-large-numbers.js:
  • fast/js/script-tests/dfg-array-length-dead.js:
  • fast/js/script-tests/dfg-array-pop-side-effects.js:
9:01 PM Changeset in webkit [153202] by oliver@apple.com
  • 5 edits in trunk/Source/JavaScriptCore

fourthTier: Remove CodeOrigin::valueProfileOffset since it was only needed for op_call_put_result.

Rubber stamped by Mark Hahnenberg.

  • bytecode/CodeOrigin.h:

(CodeOrigin):
(JSC::CodeOrigin::CodeOrigin):
(JSC::CodeOrigin::isSet):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::currentCodeOrigin):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::valueProfileFor):

9:01 PM Changeset in webkit [153201] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: Remove finalDestinationOrIgnored since it isn't called anymore.

Rubber stamped by Mark Hahnenberg.

  • bytecompiler/BytecodeGenerator.h:

(BytecodeGenerator):

9:01 PM Changeset in webkit [153200] by oliver@apple.com
  • 20 edits in trunk/Source/JavaScriptCore

fourthTier: get rid of op_call_put_result
https://bugs.webkit.org/show_bug.cgi?id=117047

Reviewed by Gavin Barraclough.

Work in progress. This still makes like 20 tests crash.

op_call_put_result is an oddball. Its semantics are that it takes the return
value of a call instruction, which is set aside in regT0/regT1, and places them
into some stack slot. This is weird since there is an implicit contract with the
preceding bytecode instruction, and it's even weirder since it means that it
doesn't make sense to jump to it; for example OSR exit from the preceding call
instruction must make sure to jump over the op_call_put_result.

So this patch gets rid of op_call_put_result:

  • In bytecode, all calls return a value and we always allocate a temporary for that value even if it isn't used.
  • The LLInt does the return value saving as part of dispatchAfterCall().
  • The JIT and DFG do the return value saving as part of normal code generation. The DFG already did the right thing.
  • DFG->JIT OSR exit in the case of inlining will make the return PC's point at the CallLinkInfo::callReturnLocation, rather than the machine PC associated with the op_call_put_result instruction.
  • Tons of code gets removed. The DFG had to track whether or not a call had a return value in a bunch of places. It had to track the fact that we would exit to after the op_call_put_result. It was a mess. That mess is now gone.
  • bytecode/CallLinkStatus.cpp:

(JSC::CallLinkStatus::computeFromLLInt):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::printCallOp):
(JSC::CodeBlock::dumpArrayProfiling):
(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::CodeBlock):

  • bytecode/CodeBlock.h:
  • bytecode/Opcode.h:

(JSC):
(JSC::padOpcodeName):

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitCall):
(JSC::BytecodeGenerator::emitCallVarargs):
(JSC::BytecodeGenerator::emitConstruct):

  • bytecompiler/NodesCodegen.cpp:

(JSC::NewExprNode::emitBytecode):
(JSC::FunctionCallValueNode::emitBytecode):
(JSC::FunctionCallResolveNode::emitBytecode):
(JSC::FunctionCallBracketNode::emitBytecode):
(JSC::FunctionCallDotNode::emitBytecode):
(JSC::CallFunctionCallDotNode::emitBytecode):
(JSC::ApplyFunctionCallDotNode::emitBytecode):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::ByteCodeParser):
(ByteCodeParser):
(JSC::DFG::ByteCodeParser::currentCodeOrigin):
(JSC::DFG::ByteCodeParser::addCall):
(JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):
(JSC::DFG::ByteCodeParser::getPrediction):
(JSC::DFG::ByteCodeParser::handleCall):
(JSC::DFG::ByteCodeParser::handleInlining):
(JSC::DFG::ByteCodeParser::handleMinMax):
(JSC::DFG::ByteCodeParser::handleIntrinsic):
(JSC::DFG::ByteCodeParser::handleConstantInternalFunction):
(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGCapabilities.cpp:

(JSC::DFG::capabilityLevel):

  • dfg/DFGOSRExitCompiler.cpp:
  • dfg/DFGOSRExitCompilerCommon.cpp:

(JSC::DFG::reifyInlinedCallFrames):

  • jit/JIT.cpp:

(JSC::JIT::privateCompileMainPass):

  • jit/JIT.h:

(JIT):

  • jit/JITCall.cpp:

(JSC::JIT::emitPutCallResult):
(JSC::JIT::compileLoadVarargs):
(JSC::JIT::compileCallEval):
(JSC::JIT::compileCallEvalSlowCase):
(JSC::JIT::compileOpCall):
(JSC::JIT::compileOpCallSlowCase):
(JSC::JIT::emit_op_call):
(JSC):
(JSC::JIT::emit_op_call_eval):
(JSC::JIT::emit_op_call_varargs):
(JSC::JIT::emit_op_construct):
(JSC::JIT::emitSlow_op_call):
(JSC::JIT::emitSlow_op_call_eval):
(JSC::JIT::emitSlow_op_call_varargs):
(JSC::JIT::emitSlow_op_construct):

  • jit/JITCall32_64.cpp:

(JSC::JIT::emitPutCallResult):
(JSC::JIT::compileLoadVarargs):
(JSC::JIT::compileCallEval):
(JSC::JIT::compileCallEvalSlowCase):
(JSC::JIT::compileOpCall):
(JSC::JIT::compileOpCallSlowCase):

  • jit/JITOpcodes.cpp:

(JSC):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::genericCall):
(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • llint/LowLevelInterpreter.cpp:

(JSC::CLoop::execute):

  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
9:01 PM Changeset in webkit [153199] by oliver@apple.com
  • 11 edits in trunk/Source/JavaScriptCore

fourthTier: LLInt shouldn't store an offset call PC during op_call-like calls
https://bugs.webkit.org/show_bug.cgi?id=117048

Reviewed by Mark Hahnenberg.

This just makes everything consistent in the LLInt: anytime any op calls out,
it stores its PC and never the next op's PC.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::linkIncomingCall):
(JSC::CodeBlock::bytecodeOffset):

  • bytecode/CodeBlock.h:
  • bytecode/Opcode.h:

(JSC::padOpcodeName):

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitCallVarargs):

  • llint/LLIntExceptions.cpp:

(JSC::LLInt::interpreterThrowInCaller):
(JSC::LLInt::returnToThrow):
(JSC::LLInt::callToThrow):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter.cpp:

(JSC::CLoop::execute):

  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
9:01 PM Changeset in webkit [153198] by oliver@apple.com
  • 7 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should support ArithAbs
https://bugs.webkit.org/show_bug.cgi?id=116890

Reviewed by Oliver Hunt.

Implements ArithAbs in the FTL, and cleans up the DFG implementation. The
DFG implementation was previously doing zero extensions manually when it
is probably better to just use StrictInt32Operand instead.

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLIntrinsicRepository.h:

(FTL):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileArithAbs):
(LowerDFGToLLVM):

  • ftl/FTLOutput.h:

(JSC::FTL::Output::doubleAbs):

9:01 PM Changeset in webkit [153197] by oliver@apple.com
  • 16 edits
    1 copy in trunk/Source/JavaScriptCore

fourthTier: Misc JIT probe enhacements.
https://bugs.webkit.org/show_bug.cgi?id=116586.

Reviewed by Michael Saboff.

  1. Added JIT probe support for ARMv7 and traditional ARM. Built and tested on ARMv7. ARM version not tested nor built.
  2. Fix the following bugs in the X86 and X86_64 probes:
    1. Cannot assume that the stack pointer is already aligned when we push args for the probe. Instead, we ensure the stack alignment at runtime when we set up the probe call. This is now done in the ctiMasmProbeTrampoline.
    2. On return, the user probe function may have altered the stack pointer value to be restored. Previously, if the sp restore value points to some of the other register restore values in the ProbeContext record, we will fail to return from the probe having those user specified value as we're expected to do. This is now fixed.
  3. Rearranged the X86/X86_64 registers order to organize them like gdb expects on X86_64.
  4. We also now preserve the condition code registers.
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • assembler/ARMAssembler.h:
  • assembler/ARMv7Assembler.h:

(ARMRegisters):

  • assembler/MacroAssemblerARM.cpp:

(JSC::isVFPPresent):
(JSC::MacroAssemblerARM::ProbeContext::dumpCPURegisters):
(JSC::MacroAssemblerARM::ProbeContext::dump):
(JSC::MacroAssemblerARM::probe):

  • assembler/MacroAssemblerARM.h:

(MacroAssemblerARM):
(CPUState):
(ProbeContext):
(JSC::MacroAssemblerARM::trustedImm32FromPtr):

  • assembler/MacroAssemblerARMv7.h:

(MacroAssemblerARMv7):
(CPUState):
(ProbeContext):
(JSC::MacroAssemblerARMv7::trustedImm32FromPtr):

  • assembler/MacroAssemblerX86.h:

(MacroAssemblerX86):
(JSC::MacroAssemblerX86::probe):

  • assembler/MacroAssemblerX86Common.cpp:

(JSC::MacroAssemblerX86Common::ProbeContext::dumpCPURegisters):

  • assembler/MacroAssemblerX86_64.h:

(JSC::MacroAssemblerX86_64::probe):

  • assembler/X86Assembler.h:
  • config.h:
  • jit/JITStubsARM.h:
  • jit/JITStubsARMv7.h:
  • jit/JITStubsX86.h:
  • jit/JITStubsX86Common.h:
  • jit/JITStubsX86_64.h:
9:01 PM Changeset in webkit [153196] by oliver@apple.com
  • 17 edits in trunk

fourthTier: FTL should call masqueradesAsUndefinedWatchpointIfIsStillValid() in all of the places where it currently calls masqueradesAsUndefinedWatchpointIsStillValid()
https://bugs.webkit.org/show_bug.cgi?id=116892

Reviewed by Oliver Hunt.

All of those places mean to plant the watchpoint if it's still valid.

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::equalNullOrUndefined):
(JSC::FTL::LowerDFGToLLVM::speculateNonNullObject):

9:01 PM Changeset in webkit [153195] by oliver@apple.com
  • 5 edits in trunk/LayoutTests

fourthTier: convert more fast/js/dfg-* tests to wait for the concurrent JIT

Rubber stamped by Oliver Hunt.

  • fast/js/dfg-arguments-alias-activation-expected.txt:
  • fast/js/dfg-arguments-alias-activation.html:
  • fast/js/dfg-arguments-alias-expected.txt:
  • fast/js/script-tests/dfg-arguments-alias.js:
9:01 PM Changeset in webkit [153194] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should support ArithMin/ArithMax
https://bugs.webkit.org/show_bug.cgi?id=116885

Reviewed by Oliver Hunt.

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax):

9:01 PM Changeset in webkit [153193] by oliver@apple.com
  • 10 edits in trunk/LayoutTests

fourthTier: convert more fast/js/dfg-* tests to wait for the concurrent JIT

Rubber stamped by Oliver Hunt.

  • fast/js/dfg-abs-backwards-propagation-expected.txt:
  • fast/js/dfg-add-not-number-expected.txt:
  • fast/js/dfg-arguments-alias-escape-expected.txt:
  • fast/js/resources/js-test-pre.js:

(dfgCompiled):
(dfgIncrement):

  • fast/js/script-tests/dfg-abs-backwards-propagation.js:
  • fast/js/script-tests/dfg-add-not-number.js:
  • fast/js/script-tests/dfg-arguments-alias-escape.js:
  • fast/js/script-tests/dfg-arguments-alias-one-block-osr-exit.js:
  • fast/js/script-tests/dfg-arguments-alias-one-block-overwrite-arguments.js:
9:01 PM Changeset in webkit [153192] by oliver@apple.com
  • 4 edits in trunk/LayoutTests

fourthTier: fast/js should have a way of running tests long enough to wait for the concurrent JIT to tier up
https://bugs.webkit.org/show_bug.cgi?id=116878

Reviewed by Oliver Hunt.

This adds three things to js-test-pre and uses them in one representative test:

silentTestPass: If you set this to true, then testPassed() won't print anything, and will instead just have

isSuccessfullyParsed() print a message saying that some tests passed silently. This allows tests to call
shouldBe() and friends in a loop whose running time is dependent on concurrent JIT behavior, and still
be sure that the resulting test will be deterministic.

noInline(): If testRunner is present, disable inlining of the relevant function.

dfgIncrement({f:function, i:index, n:limit}): Returns index either if index < limit, or if the function is

DFG compiled. Otherwise, if index >= limit and the function isn't DFG compiled, return 0. This means
that the 'i++' in the fast/js/dfg-* warm-up loops can be replaced with:

i = dfgIncrement({f:<function you're interested in>, i:i + 1, n:<some number smaller than the loop condition>)

This has the effect of having the loop repeat the first 'n' iterations until the function is DFG
compiled. See the modified test, where we do n:100 and the loop condition is i < 200. So the loop will
repeat the first 100 iterations until the function is DFG compiled and will only do the last 100
iterations once DFG compilation kicks in.

  • fast/js/dfg-arguments-osr-exit-multiple-blocks-expected.txt:
  • fast/js/resources/js-test-pre.js:

(testPassed):
(dfgIncrement):
(noInline):
(isSuccessfullyParsed):

  • fast/js/script-tests/dfg-arguments-osr-exit-multiple-blocks.js:
9:01 PM Changeset in webkit [153191] by oliver@apple.com
  • 10 edits in trunk

fourthTier: testRunner should have a way of disabling inlining of functions
https://bugs.webkit.org/show_bug.cgi?id=116875

Reviewed by Mark Hahnenberg.

Source/JavaScriptCore:

  • API/JSCTestRunnerUtils.cpp:

(JSC::getExecutable):
(JSC):
(JSC::numberOfDFGCompiles):
(JSC::setNeverInline):

  • API/JSCTestRunnerUtils.h:

(JSC):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpAssumingJITType):

  • dfg/DFGCapabilities.cpp:

(JSC::DFG::mightInlineFunctionForCall):
(JSC::DFG::mightInlineFunctionForClosureCall):
(JSC::DFG::mightInlineFunctionForConstruct):

  • runtime/Executable.h:

(JSC::ScriptExecutable::ScriptExecutable):
(ScriptExecutable):
(JSC::ScriptExecutable::setNeverInline):
(JSC::ScriptExecutable::neverInline):
(JSC::ScriptExecutable::isInliningCandidate):

Tools:

  • DumpRenderTree/TestRunner.cpp:

(neverInlineFunction):
(TestRunner::staticFunctions):

LayoutTests:

  • fast/js/script-tests/dfg-min-max.js:
9:01 PM Changeset in webkit [153190] by oliver@apple.com
  • 5 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should support ArithMod
https://bugs.webkit.org/show_bug.cgi?id=116792

Reviewed by Oliver Hunt.

  • ftl/FTLAbbreviations.h:

(JSC::FTL::buildFRem):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileArithMod):
(LowerDFGToLLVM):

  • ftl/FTLOutput.h:

(JSC::FTL::Output::doubleRem):

9:01 PM Changeset in webkit [153189] by oliver@apple.com
  • 24 edits in trunk/Source

fourthTier: It should be possible to record heap operations (both FastMalloc and JSC GC)
https://bugs.webkit.org/show_bug.cgi?id=116848

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

Record GC heap operations if ENABLE(ALLOCATION_LOGGING).

  • API/JSManagedValue.mm:
  • dfg/DFGOperations.cpp:
  • heap/Heap.cpp:

(JSC::Heap::collect):

  • heap/Heap.h:

(Heap):
(JSC::Heap::allocateWithNormalDestructor):
(JSC::Heap::allocateWithImmortalStructureDestructor):
(JSC::Heap::allocateWithoutDestructor):
(JSC::Heap::tryAllocateStorage):
(JSC::Heap::tryReallocateStorage):
(JSC):
(JSC::Heap::ascribeOwner):

  • heap/SlotVisitor.cpp:

(JSC::SlotVisitor::append):
(JSC::SlotVisitor::internalAppend):

  • heap/SlotVisitor.h:

(SlotVisitor):

  • heap/SlotVisitorInlines.h:

(JSC::SlotVisitor::append):
(JSC::SlotVisitor::appendUnbarrieredPointer):
(JSC::SlotVisitor::appendUnbarrieredValue):
(JSC::SlotVisitor::appendUnbarrieredWeak):
(JSC::SlotVisitor::internalAppend):
(JSC):
(JSC::SlotVisitor::appendValues):

  • jit/JITWriteBarrier.h:

(JSC::SlotVisitor::append):

  • llint/LLIntCommon.h:
  • runtime/Butterfly.h:

(Butterfly):

  • runtime/ButterflyInlines.h:

(JSC::Butterfly::createUninitialized):
(JSC::Butterfly::create):
(JSC::Butterfly::growPropertyStorage):
(JSC::Butterfly::createOrGrowArrayRight):
(JSC):
(JSC::Butterfly::growArrayRight):
(JSC::Butterfly::resizeArray):

  • runtime/JSArray.cpp:

(JSC::createArrayButterflyInDictionaryIndexingMode):
(JSC::JSArray::unshiftCountSlowCase):

  • runtime/JSArray.h:

(JSC::createContiguousArrayButterfly):
(JSC::createArrayButterfly):
(JSC):
(JSC::JSArray::create):
(JSC::JSArray::tryCreateUninitialized):

  • runtime/JSObject.cpp:

(JSC::JSObject::enterDictionaryIndexingModeWhenArrayStorageAlreadyExists):
(JSC::JSObject::createInitialIndexedStorage):
(JSC::JSObject::createArrayStorage):
(JSC::JSObject::constructConvertedArrayStorageWithoutCopyingElements):
(JSC::JSObject::increaseVectorLength):
(JSC::JSObject::ensureLengthSlow):
(JSC::JSObject::growOutOfLineStorage):

  • runtime/JSObject.h:

(JSC::JSObject::JSObject):

  • runtime/Operations.h:
  • runtime/RegExpMatchesArray.cpp:

(JSC::RegExpMatchesArray::create):

  • runtime/StructureInlines.h:

(JSC):

  • runtime/WriteBarrier.h:

(JSC):

Source/WTF:

Reviewed by Mark Hahnenberg.

  • WTF.xcodeproj/project.pbxproj:
  • wtf/DataLog.cpp:

(WTF):
(WTF::initializeLogFileOnce):

  • wtf/FastMalloc.cpp:

(WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):

  • wtf/Platform.h:
9:01 PM Changeset in webkit [153188] by oliver@apple.com
  • 13 edits
    3 adds in trunk

fourthTier: testRunner should be able to tell you if a function is DFG compiled
https://bugs.webkit.org/show_bug.cgi?id=116847

Reviewed by Mark Hahnenberg.

Source/JavaScriptCore:

  • API/JSCTestRunnerUtils.cpp: Added.

(JSC):
(JSC::numberOfDFGCompiles):

  • API/JSCTestRunnerUtils.h: Added.

(JSC):

(JSC::CodeBlock::numberOfDFGCompiles):
(JSC):

  • bytecode/CodeBlock.h:

(CodeBlock):

  • dfg/DFGWorklist.cpp:

(JSC::DFG::Worklist::runThread):

  • runtime/Executable.h:

(JSC):

  • runtime/JSFunctionInlines.h: Added.

(JSC):
(JSC::JSFunction::JSFunction):
(JSC::JSFunction::jsExecutable):
(JSC::JSFunction::isHostFunction):
(JSC::JSFunction::nativeFunction):
(JSC::JSFunction::nativeConstructor):

  • runtime/Operations.h:

Source/WebCore:

Bail early if we're in the compilation thread. This is only relevant for
debug dumps.

No new tests becase no new behavior.

  • loader/cache/CachedScript.cpp:

(WebCore::CachedScript::script):

Tools:

  • DumpRenderTree/TestRunner.cpp:

(numberOfDFGCompiles):
(TestRunner::staticFunctions):

LayoutTests:

  • fast/js/script-tests/dfg-min-max.js:
9:01 PM Changeset in webkit [153187] by oliver@apple.com
  • 4 edits
    9 adds in trunk

fourthTier: DFG ArithMod should have the !nodeUsedAsNumber optimizations that ArithDiv has
https://bugs.webkit.org/show_bug.cgi?id=116841

Reviewed by Mark Hahnenberg.

Source/JavaScriptCore:

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileArithMod):

LayoutTests:

  • fast/js/dfg-mod-by-neg1-and-then-or-zero-interesting-reg-alloc-expected.txt: Added.
  • fast/js/dfg-mod-by-neg1-and-then-or-zero-interesting-reg-alloc.html: Added.
  • fast/js/dfg-mod-by-zero-and-then-or-zero-interesting-reg-alloc-expected.txt: Added.
  • fast/js/dfg-mod-by-zero-and-then-or-zero-interesting-reg-alloc.html: Added.
  • fast/js/dfg-mod-neg2tothe31-by-one-and-then-or-zero-with-interesting-reg-alloc-expected.txt: Added.
  • fast/js/dfg-mod-neg2tothe31-by-one-and-then-or-zero-with-interesting-reg-alloc.html: Added.
  • fast/js/jsc-test-list:
  • fast/js/script-tests/dfg-mod-by-neg1-and-then-or-zero-interesting-reg-alloc.js: Added.

(foo):

  • fast/js/script-tests/dfg-mod-by-zero-and-then-or-zero-interesting-reg-alloc.js: Added.

(foo):

  • fast/js/script-tests/dfg-mod-neg2tothe31-by-one-and-then-or-zero-with-interesting-reg-alloc.js: Added.

(foo):

9:01 PM Changeset in webkit [153186] by oliver@apple.com
  • 10 edits in trunk

fourthTier: clean up ArithDiv/ArithMod in the DFG
https://bugs.webkit.org/show_bug.cgi?id=116793

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

This makes ArithDiv and ArithMod behave similarly, and moves both of their
implementations entirely into DFGSpeculativeJIT.cpp into methods named like
the ones for ArithSub/ArithMul.

Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that
ArithDiv used for platforms that don't support integer division. Previously
ArithMod had its own int-to-double and double-to-int conversions for this
purpose.

As well, this gets rid of confusing methods like compileSoftModulo() (which
did no such thing, there wasn't anything "soft" about it) and
compileIntegerArithDivForX86() (which is accurately named but we don't use
the platform-specific method convention anywhere else).

Finally, this takes the optimized power-of-two modulo operation that was
previously only for ARMv7s, and makes it available for all platforms. Well,
sort of: I actually rewrote it to do what latest LLVM appears to do, which
is a crazy straight-line power-of-2 modulo based on a combination of shifts,
ands, additions, and subtractions. I can kind of understand it well enough
to see that it complies with both C and JS power-of-2 modulo semantics. I've
also confirmed that it does by testing (hence the corresponding improvements
to one of the division tests). But, I don't claim to know exactly how this
code works other than to observe that it is super leet.

Overall, this patch has the effect of killing some code (no more hackish
int-to-double conversions in ArithMod), making some optimization work on
more platforms, and making the compiler less confusing by doing more things
with the same idiom.

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::executeEffects):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGSpeculativeJIT.cpp:

(DFG):
(JSC::DFG::SpeculativeJIT::compileArithDiv):
(JSC::DFG::SpeculativeJIT::compileArithMod):

  • dfg/DFGSpeculativeJIT.h:

(SpeculativeJIT):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

LayoutTests:

Reviewed by Mark Hahnenberg.

  • fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js:

(myModBy2):
(myModBy1073741824):

9:01 PM Changeset in webkit [153185] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: cti_optimize shouldn't allow GCs to get in the way of it seeing the state of its CodeBlock
https://bugs.webkit.org/show_bug.cgi?id=116748

Reviewed by Geoffrey Garen.

This fixes the following race: an optimized version of our code block could be installed
by the GC just as we return from completeAllReadyPlansForVM(), leading us to believe
that the code block isn't ready yet even though it is. Currently this triggers a
RELEASE_ASSERT. We could remove that assertion, but then this case would lead to the
code in question entering into optimizeAfterWarmUp mode. That seems pretty wasteful.

Fix the bug, and hopefully close the door on these bugs for a while, by wrapping
cti_optimize in a DeferGC. There is little downside to doing so since the only
"allocations" in cti_optimize are the ones where we inform the GC about extra memory
usage.

I had a more comprehensive solution (see the bug, "work in progress" patch) but that
one involved adding *more* raciness to cti_optimize. I decided that was a less good
approach once I came to appreciate the simplicity of just using DeferGC.

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

9:01 PM Changeset in webkit [153184] by oliver@apple.com
  • 7 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should support ArithDiv
https://bugs.webkit.org/show_bug.cgi?id=116771

Reviewed by Oliver Hunt.

  • ftl/FTLAbbreviations.h:

(JSC::FTL::buildDiv):
(JSC::FTL::buildRem):
(JSC::FTL::buildFDiv):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLCommonValues.cpp:

(JSC::FTL::CommonValues::CommonValues):

  • ftl/FTLCommonValues.h:

(CommonValues):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileArithMul):
(JSC::FTL::LowerDFGToLLVM::compileArithDiv):
(LowerDFGToLLVM):

  • ftl/FTLOutput.h:

(JSC::FTL::Output::div):
(JSC::FTL::Output::rem):
(JSC::FTL::Output::doubleDiv):

9:01 PM Changeset in webkit [153183] by oliver@apple.com
  • 8 edits in trunk/Source

fourthTier: Remove Interpreter::retrieveLastCaller().

This merge is complicated by the trunk js stack reporting logic.

Remove Interpreter::retrieveLastCaller().
https://bugs.webkit.org/show_bug.cgi?id=116753.

Reviewed by Geoffrey Garen.

This is part of the refactoring effort to get rid of functions walking
the JS stack in their own way.

../JavaScriptCore:

  • API/JSContextRef.cpp:

(JSContextCreateBacktrace):

  • interpreter/CallFrame.cpp:
  • interpreter/Interpreter.cpp:

(JSC::Interpreter::Interpreter):
(JSC::Interpreter::getStackTrace):
(JSC::Interpreter::addStackTraceIfNecessary):

  • interpreter/Interpreter.h:

(StackFrame):
(JSC::StackFrame::StackFrame):
(Interpreter):

  • jsc.cpp:

(functionJSCStack):

  • profiler/ProfileGenerator.cpp:

(JSC::ProfileGenerator::addParentForConsoleStart):

../WebCore:

No new tests.

  • bindings/js/JSXMLHttpRequestCustom.cpp:

(WebCore::JSXMLHttpRequest::send):

  • bindings/js/ScriptCallStackFactory.cpp:

(WebCore::createScriptCallStack):

9:01 PM Changeset in webkit [153182] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: FTL boolify should support ObjectOrOtherUse
https://bugs.webkit.org/show_bug.cgi?id=116741

Reviewed by Geoffrey Garen.

Just reusing what was already there in equalNullOrUndefined(). Note that we will
sometimes generate some redundant IR - like having some spurious bitNot's in
places - but it's safe to assume that LLVM will simplify those, and that it won't
be the longest pole in the tent for compile times.

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant):
(JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant):
(JSC::FTL::LowerDFGToLLVM::boolify):
(JSC::FTL::LowerDFGToLLVM::equalNullOrUndefined):

9:01 PM Changeset in webkit [153181] by oliver@apple.com
  • 4 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should support LogicalNot and Branch on Int32 and Number
https://bugs.webkit.org/show_bug.cgi?id=116739

Reviewed by Gavin Barraclough.

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileLogicalNot):
(JSC::FTL::LowerDFGToLLVM::compileBranch):
(JSC::FTL::LowerDFGToLLVM::boolify):
(LowerDFGToLLVM):

  • ftl/FTLOutput.h:

(JSC::FTL::Output::isZero32):
(JSC::FTL::Output::notZero32):

9:01 PM Changeset in webkit [153180] by oliver@apple.com
  • 11 edits in trunk/Source/JavaScriptCore

fourthTier: add heuristics to reduce the likelihood of a trivially inlineable function being independently compiled by the concurrent JIT
https://bugs.webkit.org/show_bug.cgi?id=116557

Reviewed by Geoffrey Garen.

This introduces a fairly comprehensive mechanism for preventing trivially inlineable
functions from being compiled independently of all of the things into which they end
up being inlined.

The trick is CodeBlock::m_shouldAlwaysBeInlined, or SABI for short (that's what the
debug logging calls it). A SABI function is one that we currently believe should
never be DFG optimized because it should always be inlined into the functions that
call it. SABI follows "innocent until proven guilty": all functions start out SABI
and have SABI set to false if we see proof that that function may be called in some
possibly non-inlineable way. So long as a function is SABI, it will not tier up to
the DFG: cti_optimize will perpetually postpone its optimization. Because SABI has
such a severe effect, we make the burden of proof of guilt quite low. SABI gets
cleared if any of the following happen:

  • You get called from native code (either through CallData or CachedCall).
  • You get called from an eval, since eval code takes a long time to get DFG optimized.
  • You get called from global code, since often global code doesn't tier-up since it's run-once.
  • You get called recursively, where recursion is detected by a stack walk of depth Options::maximumInliningDepth().
  • You get called through an unlinked virtual call.
  • You get called from DFG code, since if the caller was already DFG optimized and didn't inline you then obviously, you might not get inlined.
  • You've tiered up to the baseline JIT and you get called from the interpreter. The idea here is that this kind of ensures that you stay SABI only if you're called no more frequently than any of your callers.
  • You get called from a code block that isn't a DFG candidate.
  • You aren't an inlining candidate.

Most of the heuristics for SABI are in CodeBlock::noticeIncomingCall().

This is neutral on SunSpider and V8Spider, and appears to be a slight speed-up on
V8v7, which was previously adversely affected by concurrent compilation. I also
confirmed that for example on V8/richards, it dramatically reduces the number of
code blocks that get DFG compiled. It is a speed-up on those V8v7 benchmarks that
saw regressions from concurrent compilation.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpAssumingJITType):
(JSC::CodeBlock::CodeBlock):
(JSC::CodeBlock::linkIncomingCall):
(JSC):
(JSC::CodeBlock::noticeIncomingCall):

  • bytecode/CodeBlock.h:

(CodeBlock):

  • dfg/DFGCapabilities.h:

(JSC::DFG::mightInlineFunction):
(DFG):

  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::compileInThread):

  • dfg/DFGRepatch.cpp:

(JSC::DFG::dfgLinkFor):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::prepareForRepeatCall):

  • jit/JIT.cpp:

(JSC::JIT::privateCompile):
(JSC::JIT::linkFor):

  • jit/JIT.h:

(JIT):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):
(JSC::lazyLinkFor):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::setUpCall):

9:00 PM Changeset in webkit [153179] by oliver@apple.com
  • 11 edits in trunk/Source/JavaScriptCore

fourthTier: rationalize DFG::CapabilityLevel and DFGCapabilities.[h|cpp]
https://bugs.webkit.org/show_bug.cgi?id=116696

Reviewed by Sam Weinig.

Make it so that all capability calculation is funneled through one function, which tells
you everything you wanted to know: can it be inlined, and can it be compiled.

This work will help with https://bugs.webkit.org/show_bug.cgi?id=116557, since now the
JIT has a fairly authoritative answer to the "can it be inlined" question.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::CodeBlock):
(JSC::ProgramCodeBlock::capabilityLevelInternal):
(JSC::EvalCodeBlock::capabilityLevelInternal):
(JSC::FunctionCodeBlock::capabilityLevelInternal):

  • bytecode/CodeBlock.h:

(CodeBlock):
(JSC::CodeBlock::capabilityLevel):
(JSC::CodeBlock::capabilityLevelState):
(ProgramCodeBlock):
(EvalCodeBlock):
(FunctionCodeBlock):

  • dfg/DFGCapabilities.cpp:

(JSC::DFG::debugFail):
(DFG):
(JSC::DFG::canInlineResolveOperations):
(JSC::DFG::capabilityLevel):

  • dfg/DFGCapabilities.h:

(DFG):
(JSC::DFG::capabilityLevel):
(JSC::DFG::evalCapabilityLevel):
(JSC::DFG::programCapabilityLevel):
(JSC::DFG::functionForCallCapabilityLevel):
(JSC::DFG::functionForConstructCapabilityLevel):
(JSC::DFG::canInlineFunctionForCall):
(JSC::DFG::canInlineFunctionForClosureCall):
(JSC::DFG::canInlineFunctionForConstruct):

  • dfg/DFGCommon.h:

(JSC::DFG::canCompile):
(DFG):
(JSC::DFG::canInline):
(JSC::DFG::leastUpperBound):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):

  • jit/JIT.cpp:

(JSC::JIT::privateCompile):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::privateCompilePutByIdTransition):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::privateCompilePutByIdTransition):

  • tools/CodeProfile.cpp:

(JSC::CodeProfile::sample):

9:00 PM Changeset in webkit [153178] by oliver@apple.com
  • 1 edit in trunk/Source/JavaScriptCore/bytecode/CodeBlock.h

fourthTier: Reindent CodeBlock.h to aid merging

9:00 PM Changeset in webkit [153177] by oliver@apple.com
  • 22 edits in trunk/Source/JavaScriptCore

fourthTier: Rename getJITCode and getJITType to jitCode and jitType.

Rubber stampted by Mark Hahnenberg.

  • assembler/RepatchBuffer.h:

(JSC::RepatchBuffer::RepatchBuffer):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dump):
(JSC::CodeBlock::visitAggregate):
(JSC::CodeBlock::finalizeUnconditionally):
(JSC::CodeBlock::resetStubInternal):
(JSC::CodeBlock::stronglyVisitWeakReferences):
(JSC::CodeBlock::baselineVersion):
(JSC::CodeBlock::hasOptimizedReplacement):
(JSC::CodeBlock::bytecodeOffset):
(JSC::CodeBlock::codeOriginForReturn):
(JSC::ProgramCodeBlock::compileOptimized):
(JSC::EvalCodeBlock::compileOptimized):
(JSC::FunctionCodeBlock::compileOptimized):
(JSC::ProgramCodeBlock::jettison):
(JSC::EvalCodeBlock::jettison):
(JSC::FunctionCodeBlock::jettison):
(JSC::ProgramCodeBlock::jitCompileImpl):
(JSC::EvalCodeBlock::jitCompileImpl):
(JSC::FunctionCodeBlock::jitCompileImpl):
(JSC::CodeBlock::setOptimizationThresholdBasedOnCompilationResult):
(JSC::CodeBlock::adjustedExitCountThreshold):
(JSC::CodeBlock::tallyFrequentExitSites):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::getCallLinkInfo):
(JSC::CodeBlock::jitCode):
(JSC::CodeBlock::jitCodeWithArityCheck):
(JSC::CodeBlock::jitType):
(JSC::CodeBlock::hasBaselineJITProfiling):
(JSC::CodeBlock::jitCompile):
(JSC::CodeBlock::addFrequentExitSite):
(JSC::CodeBlock::shouldImmediatelyAssumeLivenessDuringScan):
(JSC::ExecState::isInlineCallFrame):

  • dfg/DFGAssemblyHelpers.cpp:

(JSC::DFG::AssemblyHelpers::decodedCodeMapFor):

  • dfg/DFGAssemblyHelpers.h:

(JSC::DFG::AssemblyHelpers::AssemblyHelpers):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):

  • dfg/DFGOSREntry.cpp:

(JSC::DFG::prepareOSREntry):

  • dfg/DFGOSRExit.cpp:

(JSC::DFG::OSRExit::codeLocationForRepatch):

  • dfg/DFGOSRExitCompiler.cpp:
  • dfg/DFGOSRExitCompilerCommon.cpp:

(JSC::DFG::reifyInlinedCallFrames):
(JSC::DFG::adjustAndJumpToTarget):

  • dfg/DFGOperations.cpp:
  • dfg/DFGVariableEventStream.cpp:

(JSC::DFG::VariableEventStream::reconstruct):

  • ftl/FTLOSRExit.cpp:

(JSC::FTL::OSRExit::codeLocationForRepatch):

  • ftl/FTLOSRExitCompiler.cpp:

(JSC::FTL::compileFTLOSRExit):

  • heap/DFGCodeBlocks.cpp:

(JSC::DFGCodeBlocks::~DFGCodeBlocks):
(JSC::DFGCodeBlocks::jettison):
(JSC::DFGCodeBlocks::clearMarks):
(JSC::DFGCodeBlocks::deleteUnmarkedJettisonedCodeBlocks):
(JSC::DFGCodeBlocks::traceMarkedCodeBlocks):

  • interpreter/Interpreter.cpp:

(JSC::getLineNumberForCallFrame):
(JSC::getCallerInfo):

  • jit/JITDriver.h:

(JSC::jitCompileIfAppropriateImpl):
(JSC::jitCompileFunctionIfAppropriateImpl):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::entryOSR):
(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • runtime/Executable.cpp:

(JSC::jettisonCodeBlock):
(JSC::EvalExecutable::compileOptimized):
(JSC::EvalExecutable::jettisonOptimizedCode):
(JSC::ProgramExecutable::compileOptimized):
(JSC::ProgramExecutable::jettisonOptimizedCode):
(JSC::FunctionExecutable::baselineCodeBlockFor):
(JSC::FunctionExecutable::compileOptimizedForCall):
(JSC::FunctionExecutable::compileOptimizedForConstruct):
(JSC::FunctionExecutable::jettisonOptimizedCodeForCall):
(JSC::FunctionExecutable::jettisonOptimizedCodeForConstruct):

  • tools/CodeProfile.cpp:

(JSC::CodeProfile::sample):

9:00 PM Changeset in webkit [153176] by oliver@apple.com
  • 5 edits in trunk/Source/JavaScriptCore

fourthTier: Race between LLInt->Baseline tier-up and DFG reading Baseline profiling data
https://bugs.webkit.org/show_bug.cgi?id=116633

Reviewed by Mark Hahnenberg.

Previously we would check if we had Baseline JIT profiling data by seeing if the
appropriate vector was non-empty. This is horrible if we're doing LLInt->Baseline
tier-up at the same time. This will happen for code we are inlining, if we're
deciding to inline it before the LLInt->Baseline tier-up happened for that code.

This changes things to take advantage of the fact that the very last thing that
LLInt->Baseline tier-up will do (in JITDriver.h) is setJITCode(). We now precede
the actual work in setJITCode() with a store-store fence to ensure that all
stores to modify the CodeBlock happen before setting the JITCode, and we modify
CodeBlock::getJITType() to use load-load fences to ensure that if you see
JITCode::BaselineJIT then you will also see all of those vectors. Then this
changes all of the code that scrapes Baseline JIT profiles to check if
getJITType() returns JITCode::BaselineJIT instead of checking vector sizes.

The outcome is that for the non-racy cases we behave as we did before (we fall
back on LLInt profiling if the tier-up hasn't happened) and for racy cases we
use LLInt profiling conservatively.

Note that for some (but not all!) of the cases where we scrape Baseline JIT
profiling, we would have anyway been holding the CodeBlock::m_lock so we can also
fix those cases by just having setJITCode graph that lock. This patch does that
also, mainly because although we only call setJITCode() from the main thread, in
general it's dangerous to have a pointer to a ref-counted object being modified
in a racy way. So, this patch just does the most conservative thing possible that
does we can afford to do.

  • bytecode/CallLinkStatus.cpp:

(JSC::CallLinkStatus::computeFor):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::setJITCode):
(JSC::CodeBlock::getJITType):
(JSC::CodeBlock::hasBaselineJITProfiling):
(JSC::CodeBlock::likelyToTakeSlowCase):
(JSC::CodeBlock::couldTakeSlowCase):
(JSC::CodeBlock::likelyToTakeSpecialFastCase):
(JSC::CodeBlock::couldTakeSpecialFastCase):
(JSC::CodeBlock::likelyToTakeDeepestSlowCase):
(JSC::CodeBlock::likelyToTakeAnySlowCase):

  • bytecode/GetByIdStatus.cpp:

(JSC::GetByIdStatus::computeFor):

  • bytecode/PutByIdStatus.cpp:

(JSC::PutByIdStatus::computeFor):

9:00 PM Changeset in webkit [153175] by oliver@apple.com
  • 7 edits in trunk/Source/JavaScriptCore

fourthTier: It should be possible to use more than one compiler thread
https://bugs.webkit.org/show_bug.cgi?id=116630

Reviewed by Mark Hahnenberg.

This gives us the ability to use more compiler threads, but doesn't actually
enable the functionality because it isn't a speed-up on any benchmark. It can
even be a slow-down. This also adds the ability to disable concurrent
compilation if we're on a uniprocessor machine, and adds more logging to the
worklist code to allow us to investigate how many threads are active. It
appears that even on the most compiler-heavy benchmarks, we never have enough
work for more than 4 threads, and even then the 4 threads are all active for
a short time.

Something that having more threads does accomplish is that it shakes out bugs.
This patch fixes a bug with Watchpoint not being thread-safe ref-counted,
which enabling 7 compilation threads did catch.

As it stands, this patch is performance-neutral and just fixes bugs and adds
some options.

  • bytecode/Watchpoint.h:
  • dfg/DFGCommon.h:

(JSC::DFG::enableConcurrentJIT):

  • dfg/DFGWorklist.cpp:

(JSC::DFG::Worklist::Worklist):
(JSC::DFG::Worklist::~Worklist):
(JSC::DFG::Worklist::finishCreation):
(JSC::DFG::Worklist::create):
(JSC::DFG::Worklist::enqueue):
(JSC::DFG::Worklist::waitUntilAllPlansForVMAreReady):
(JSC::DFG::Worklist::dump):
(JSC::DFG::Worklist::runThread):
(JSC::DFG::initializeGlobalWorklistOnce):

  • dfg/DFGWorklist.h:
  • runtime/Options.cpp:

(JSC::computeNumberOfWorkerThreads):
(JSC):
(JSC::computeNumberOfGCMarkers):

  • runtime/Options.h:

(JSC):

9:00 PM Changeset in webkit [153174] by oliver@apple.com
  • 20 edits in trunk/Source/JavaScriptCore

fourthTier: FTL shouldn't use the LLVM global context, and should instead create its own context for each compilation
https://bugs.webkit.org/show_bug.cgi?id=116631

Reviewed by Mark Hahnenberg.

In the future we might want to share contexts for multiple compilations, but for
now using one context per compilation is a progression over just constantly using
the global context.

  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::compileInThread):
(DFG):
(JSC::DFG::Plan::compileInThreadImpl):

  • dfg/DFGPlan.h:
  • ftl/FTLAbbreviatedTypes.h:

(FTL):

  • ftl/FTLAbbreviations.h:

(JSC::FTL::voidType):
(JSC::FTL::int1Type):
(JSC::FTL::int8Type):
(JSC::FTL::int32Type):
(JSC::FTL::int64Type):
(JSC::FTL::intPtrType):
(JSC::FTL::doubleType):
(JSC::FTL::structType):
(JSC::FTL::mdKindID):
(JSC::FTL::mdString):
(JSC::FTL::mdNode):
(JSC::FTL::appendBasicBlock):
(JSC::FTL::insertBasicBlock):

  • ftl/FTLAbstractHeap.cpp:

(JSC::FTL::AbstractHeap::tbaaMetadataSlow):
(JSC::FTL::IndexedAbstractHeap::IndexedAbstractHeap):
(JSC::FTL::NumberedAbstractHeap::NumberedAbstractHeap):
(JSC::FTL::AbsoluteAbstractHeap::AbsoluteAbstractHeap):

  • ftl/FTLAbstractHeap.h:

(IndexedAbstractHeap):
(NumberedAbstractHeap):
(AbsoluteAbstractHeap):

  • ftl/FTLAbstractHeapRepository.cpp:

(JSC::FTL::AbstractHeapRepository::AbstractHeapRepository):

  • ftl/FTLAbstractHeapRepository.h:

(AbstractHeapRepository):

  • ftl/FTLCommonValues.cpp:

(JSC::FTL::CommonValues::CommonValues):

  • ftl/FTLCommonValues.h:

(CommonValues):

  • ftl/FTLCompile.cpp:

(JSC::FTL::mmAllocateCodeSection):

  • ftl/FTLIntrinsicRepository.cpp:

(JSC::FTL::IntrinsicRepository::IntrinsicRepository):

  • ftl/FTLIntrinsicRepository.h:

(FTL):
(IntrinsicRepository):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::lower):

  • ftl/FTLOutput.cpp:

(JSC::FTL::Output::Output):

  • ftl/FTLOutput.h:

(Output):
(JSC::FTL::Output::newBlock):

  • ftl/FTLState.cpp:

(JSC::FTL::State::State):
(JSC::FTL::State::~State):
(FTL):

  • ftl/FTLState.h:

(State):

  • runtime/Options.h:

(JSC):

9:00 PM Changeset in webkit [153173] by oliver@apple.com
  • 3 edits in trunk/WebKitLibraries

fourthTier: Updated LLVM drops to include MCJIT memory management APIs.

Rubber stamped by Mark Hahnenberg.

  • LLVMIncludesMountainLion.tar.bz2:
  • LLVMLibrariesMountainLion.tar.bz2:
9:00 PM Changeset in webkit [153172] by oliver@apple.com
  • 9 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should force LLVM to use our own JIT memory allocator, and we shouldn't have to keep around an LLVMExecutionEngineRef to keep code alive
https://bugs.webkit.org/show_bug.cgi?id=113619

Reviewed by Geoffrey Garen.

This uses new API that I've exposed, which allows for memory manager callbacks
from within LLVM. LLVM may allocate multiple independent chunks of memory for
a module, and we track all of those in a Vector in FTL::JITCode.

  • ftl/FTLCompile.cpp:

(JSC::FTL::mmAllocateCodeSection):
(FTL):
(JSC::FTL::mmAllocateDataSection):
(JSC::FTL::mmApplyPermissions):
(JSC::FTL::mmDestroy):
(JSC::FTL::compile):

  • ftl/FTLJITCode.cpp:

(JSC::FTL::JITCode::JITCode):
(JSC::FTL::JITCode::~JITCode):
(JSC::FTL::JITCode::addHandle):
(FTL):
(JSC::FTL::JITCode::initializeCode):

  • ftl/FTLJITCode.h:

(JITCode):
(JSC::FTL::JITCode::handles):

  • ftl/FTLJITFinalizer.cpp:

(JSC::FTL::JITFinalizer::~JITFinalizer):
(JSC::FTL::JITFinalizer::finalizeFunction):

  • ftl/FTLJITFinalizer.h:

(JSC::FTL::JITFinalizer::initializeEntrypointLinkBuffer):
(JITFinalizer):

  • ftl/FTLLink.cpp:

(JSC::FTL::link):

  • ftl/FTLState.cpp:

(JSC::FTL::State::State):

  • ftl/FTLState.h:

(State):

9:00 PM Changeset in webkit [153171] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: FTL shouldn't use FastISel and Small code model should be turned off for now
https://bugs.webkit.org/show_bug.cgi?id=115998

Reviewed by Oliver Hunt.

This switches off FastISel and makes it possible to turn off Small code model.

  • ftl/FTLCompile.cpp:

(JSC::FTL::compile):

  • runtime/Options.h:

(JSC):

9:00 PM Changeset in webkit [153170] by oliver@apple.com
  • 34 edits
    1 delete in trunk/Source/JavaScriptCore

fourthTier: should use ConcurrentJITLock[er] directly and not through typedef
https://bugs.webkit.org/show_bug.cgi?id=116561

Rubber stamped by Geoffrey Garen.

(JSC::ArrayProfile::computeUpdatedPrediction):
(JSC::ArrayProfile::briefDescription):

  • bytecode/ArrayProfile.h:

(ArrayProfile):
(JSC::ArrayProfile::expectedStructure):
(JSC::ArrayProfile::structureIsPolymorphic):
(JSC::ArrayProfile::hasDefiniteStructure):
(JSC::ArrayProfile::observedArrayModes):
(JSC::ArrayProfile::mayInterceptIndexedAccesses):
(JSC::ArrayProfile::mayStoreToHole):
(JSC::ArrayProfile::outOfBounds):
(JSC::ArrayProfile::usesOriginalArrayStructures):

  • bytecode/CallLinkStatus.cpp:

(JSC::CallLinkStatus::computeFor):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpValueProfiling):
(JSC::CodeBlock::dumpArrayProfiling):
(JSC::CodeBlock::updateAllPredictionsAndCountLiveness):
(JSC::CodeBlock::updateAllArrayPredictions):
(JSC::CodeBlock::nameForRegister):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::valueProfilePredictionForBytecodeOffset):
(CodeBlock):

  • bytecode/CodeBlockLock.h: Removed.
  • bytecode/GetByIdStatus.cpp:

(JSC::GetByIdStatus::computeFor):

  • bytecode/LazyOperandValueProfile.cpp:

(JSC::CompressedLazyOperandValueProfileHolder::computeUpdatedPredictions):
(JSC::CompressedLazyOperandValueProfileHolder::add):
(JSC::LazyOperandValueProfileParser::initialize):
(JSC::LazyOperandValueProfileParser::prediction):

  • bytecode/LazyOperandValueProfile.h:

(CompressedLazyOperandValueProfileHolder):
(LazyOperandValueProfileParser):

  • bytecode/MethodOfGettingAValueProfile.cpp:

(JSC::MethodOfGettingAValueProfile::getSpecFailBucket):

  • bytecode/PutByIdStatus.cpp:

(JSC::PutByIdStatus::computeFor):

  • bytecode/ResolveGlobalStatus.cpp:

(JSC::ResolveGlobalStatus::computeFor):

  • bytecode/ValueProfile.h:

(JSC::ValueProfileBase::briefDescription):
(JSC::ValueProfileBase::computeUpdatedPrediction):

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::addVar):

  • dfg/DFGArrayMode.cpp:

(JSC::DFG::ArrayMode::fromObserved):

  • dfg/DFGArrayMode.h:

(ArrayMode):
(JSC::DFG::ArrayMode::withProfile):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::injectLazyOperandSpeculation):
(JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):
(JSC::DFG::ByteCodeParser::getArrayMode):
(JSC::DFG::ByteCodeParser::getArrayModeAndEmitChecks):
(JSC::DFG::ByteCodeParser::parseResolveOperations):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGPredictionInjectionPhase.cpp:

(JSC::DFG::PredictionInjectionPhase::run):

  • jit/JITInlines.h:

(JSC::JIT::chooseArrayMode):

  • jit/JITStubs.cpp:

(JSC::tryCachePutByID):
(JSC::tryCacheGetByID):
(JSC::DEFINE_STUB_FUNCTION):
(JSC::lazyLinkFor):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):
(JSC::LLInt::setUpCall):

  • profiler/ProfilerBytecodeSequence.cpp:

(JSC::Profiler::BytecodeSequence::BytecodeSequence):

  • runtime/Executable.cpp:

(JSC::ProgramExecutable::addGlobalVar):

  • runtime/JSActivation.cpp:

(JSC::JSActivation::getOwnNonIndexPropertyNames):
(JSC::JSActivation::symbolTablePutWithAttributes):

  • runtime/JSScope.cpp:

(JSC::JSScope::resolveContainingScopeInternal):
(JSC::JSScope::resolvePut):

  • runtime/JSSegmentedVariableObject.cpp:

(JSC::JSSegmentedVariableObject::findRegisterIndex):
(JSC::JSSegmentedVariableObject::addRegisters):

  • runtime/JSSegmentedVariableObject.h:

(JSSegmentedVariableObject):

  • runtime/JSSymbolTableObject.cpp:

(JSC::JSSymbolTableObject::getOwnNonIndexPropertyNames):

  • runtime/JSSymbolTableObject.h:

(JSC::symbolTableGet):
(JSC::symbolTablePut):
(JSC::symbolTablePutWithAttributes):

  • runtime/Structure.cpp:

(JSC::Structure::materializePropertyMap):
(JSC::Structure::addPropertyTransitionToExistingStructureConcurrently):
(JSC::Structure::addPropertyTransition):
(JSC::Structure::takePropertyTableOrCloneIfPinned):
(JSC::Structure::nonPropertyTransition):
(JSC::Structure::putSpecificValue):
(JSC::Structure::remove):
(JSC::Structure::createPropertyMap):

  • runtime/Structure.h:

(Structure):

  • runtime/SymbolTable.h:

(SymbolTable):
(JSC::SymbolTable::find):
(JSC::SymbolTable::get):
(JSC::SymbolTable::inlineGet):
(JSC::SymbolTable::begin):
(JSC::SymbolTable::end):
(JSC::SymbolTable::size):
(JSC::SymbolTable::add):
(JSC::SymbolTable::set):
(JSC::SymbolTable::contains):

9:00 PM Changeset in webkit [153169] by oliver@apple.com
  • 39 edits
    2 copies
    2 adds in trunk/Source

fourthTier: DFG should be able to run on a separate thread
https://bugs.webkit.org/show_bug.cgi?id=112839

Source/JavaScriptCore:

Reviewed by Geoffrey Garen.

This is the final bit of concurrent JITing. The idea is that there is a
single global worklist, and a single global thread, that does all
optimizing compilation. This is the DFG::Worklist. It contains a queue of
DFG::Plans, and a map from CodeBlock* (the baseline code block we're
trying to optimize) to DFG::Plan. If the DFGDriver tries to concurrently
compile something, it puts the Plan on the Worklist. The Worklist's
thread will compile that Plan eventually, and when it's done, it will
signal its completion by (1) notifying anyone waiting for the Worklist to
be done, and (2) forcing the CodeBlock::m_jitExecuteCounter to take slow
path. The next Baseline JIT cti_optimize call will then install all ready
(i.e. compiled) Plans for that VM. Note that (1) is only for the GC and
VM shutdown, which will want to ensure that there aren't any outstanding
async compilations before proceeding. They do so by simply waiting for
all of the plans for the current VM to complete. (2) is the actual way
that code typically gets installed.

This is all very racy by design. For example, just as we try to force the
execute counter to take slow path, the main thread may be setting the
execute counter to some other value. The main thread must set it to
another value because (a) JIT code is constantly incrementing the counter
in a racy way, (b) the cti_optimize slow path will set it to some
large-ish negative value to ensure that cti_optimize isn't called
repeatedly, and (c) OSR exits from previously jettisoned code blocks may
still want to reset the counter values. This "race" is made benign, by
ensuring that while there is an asynchronous compilation, we at worse set
the counter to optimizeAfterWarmUp and never to deferIndefinitely. Hence
if the race happens then the worst case is that we wait another ~1000
counts before installing the optimized code. Another defense is that if
any CodeBlock calls into cti_optimize, then it will check for all ready
plans for the VM - so even if a code block has to wait another ~1000
executions before it calls cti_optimize to do the installation, it may
actually end up being installed sooner because a different code block had
called cti_optimize, potentially for an unrelated reason.

Special care is taken to ensure that installing plans informs the GC
about the increased memory usage, but also ensures that we don't recurse
infinitely - since at start of GC we try to install outstanding plans.
This is done by introducing a new GC deferral mechanism (the DeferGC
block-scoped thingy), which will ensure that GCs don't happen in the
scope but are allowed to happen after. This still leaves the strange
corner case that cti_optimize may install outstanding plans, then GC, and
that GC may jettison the code block that was installed. This, and the
fact that the plan that we took slow path to install could have been a
failed or invalid compile, mean that we have to take special precautions
in cti_optimize.

This patch also fixes a number of small concurrency bugs that I found
when things started running. There are probably more of those bugs still
left to fix. This patch just fixes the ones I know about.

Concurrent compilation is right now only enabled on X86_64 Mac. We need
platforms that are sufficiently CAStastic so that we can do the various
memory fence and CAS tricks that make this safe. We also need a platform
that uses JSVALUE64. And we need pthread_once. So, that pretty much means
just X64_64 for now. Enabling Linux-64_64 should be a breeze, but I'll
leave that up to the Qt and GTK+ ports to do at their discretion.

This is a solid speed-up on SunSpider (8-9%) and V8Spider (16%), our two
main compile-time benchmarks. Most peculiarly, this also appears to
reduce measurement noise, rather than increasing it as you would have
expected. I don't understand that result but I like it anyway. On the
other hand, this is a slight (1%) slow-down on V8v7. I will continue to
investigate this but I think that the results are already good enough
that we should land this as-is. So far, it appears that the slow-down is
due to this breaking the don't-compile-inlineables heuristics. See
investigation in https://bugs.webkit.org/show_bug.cgi?id=116556 and the
bug https://bugs.webkit.org/show_bug.cgi?id=116557.

(JSC):
(JSC::CodeBlock::finalizeUnconditionally):
(JSC::CodeBlock::resetStubInternal):
(JSC::CodeBlock::baselineVersion):
(JSC::CodeBlock::hasOptimizedReplacement):
(JSC::CodeBlock::optimizationThresholdScalingFactor):
(JSC::CodeBlock::checkIfOptimizationThresholdReached):
(JSC::CodeBlock::optimizeNextInvocation):
(JSC::CodeBlock::dontOptimizeAnytimeSoon):
(JSC::CodeBlock::optimizeAfterWarmUp):
(JSC::CodeBlock::optimizeAfterLongWarmUp):
(JSC::CodeBlock::optimizeSoon):
(JSC::CodeBlock::forceOptimizationSlowPathConcurrently):
(JSC::CodeBlock::setOptimizationThresholdBasedOnCompilationResult):
(JSC::CodeBlock::updateAllPredictionsAndCountLiveness):
(JSC::CodeBlock::updateAllArrayPredictions):
(JSC::CodeBlock::shouldOptimizeNow):

  • bytecode/CodeBlock.h:

(CodeBlock):
(JSC::CodeBlock::jitCompile):

  • bytecode/CodeBlockLock.h:

(JSC):

  • bytecode/ExecutionCounter.cpp:

(JSC::ExecutionCounter::forceSlowPathConcurrently):
(JSC):
(JSC::ExecutionCounter::setThreshold):

  • bytecode/ExecutionCounter.h:

(ExecutionCounter):

  • debugger/Debugger.cpp:

(JSC::Debugger::recompileAllJSFunctions):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::injectLazyOperandSpeculation):
(JSC::DFG::ByteCodeParser::getArrayMode):
(JSC::DFG::ByteCodeParser::getArrayModeAndEmitChecks):

  • dfg/DFGCommon.h:

(JSC::DFG::enableConcurrentJIT):
(DFG):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::Graph):

  • dfg/DFGGraph.h:

(Graph):

  • dfg/DFGOSREntry.cpp:

(JSC::DFG::prepareOSREntry):

  • dfg/DFGOperations.cpp:
  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::Plan):
(JSC::DFG::Plan::compileInThread):
(JSC::DFG::Plan::key):
(DFG):

  • dfg/DFGPlan.h:

(DFG):
(Plan):

  • dfg/DFGWorklist.cpp: Added.

(DFG):
(JSC::DFG::Worklist::Worklist):
(JSC::DFG::Worklist::~Worklist):
(JSC::DFG::Worklist::finishCreation):
(JSC::DFG::Worklist::create):
(JSC::DFG::Worklist::enqueue):
(JSC::DFG::Worklist::compilationState):
(JSC::DFG::Worklist::waitUntilAllPlansForVMAreReady):
(JSC::DFG::Worklist::removeAllReadyPlansForVM):
(JSC::DFG::Worklist::completeAllReadyPlansForVM):
(JSC::DFG::Worklist::completeAllPlansForVM):
(JSC::DFG::Worklist::queueLength):
(JSC::DFG::Worklist::dump):
(JSC::DFG::Worklist::runThread):
(JSC::DFG::Worklist::threadFunction):
(JSC::DFG::initializeGlobalWorklistOnce):
(JSC::DFG::globalWorklist):

  • dfg/DFGWorklist.h: Added.

(DFG):
(Worklist):

  • heap/CopiedSpaceInlines.h:

(JSC::CopiedSpace::allocateBlock):

  • heap/DeferGC.h: Added.

(JSC):
(DeferGC):
(JSC::DeferGC::DeferGC):
(JSC::DeferGC::~DeferGC):

  • heap/Heap.cpp:

(JSC::Heap::Heap):
(JSC::Heap::reportExtraMemoryCostSlowCase):
(JSC::Heap::collectAllGarbage):
(JSC::Heap::collect):
(JSC::Heap::collectIfNecessaryOrDefer):
(JSC):
(JSC::Heap::incrementDeferralDepth):
(JSC::Heap::decrementDeferralDepthAndGCIfNeeded):

  • heap/Heap.h:

(Heap):
(JSC::Heap::isCollecting):
(JSC):

  • heap/MarkedAllocator.cpp:

(JSC::MarkedAllocator::allocateSlowCase):

  • jit/JIT.cpp:

(JSC::JIT::privateCompile):

  • jit/JIT.h:
  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::jitCompileAndSetHeuristics):
(JSC::LLInt::entryOSR):
(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • profiler/ProfilerBytecodes.h:
  • runtime/ConcurrentJITLock.h: Added.

(JSC):

  • runtime/ExecutionHarness.h:

(JSC::replaceWithDeferredOptimizedCode):

  • runtime/JSSegmentedVariableObject.cpp:

(JSC::JSSegmentedVariableObject::findRegisterIndex):
(JSC::JSSegmentedVariableObject::addRegisters):

  • runtime/JSSegmentedVariableObject.h:

(JSSegmentedVariableObject):

  • runtime/Options.h:

(JSC):

  • runtime/Structure.h:

(Structure):

  • runtime/StructureInlines.h:

(JSC::Structure::propertyTable):

  • runtime/SymbolTable.h:

(SymbolTable):

  • runtime/VM.cpp:

(JSC::VM::VM):
(JSC::VM::~VM):
(JSC::VM::prepareToDiscardCode):
(JSC):
(JSC::VM::discardAllCode):
(JSC::VM::releaseExecutableMemory):

  • runtime/VM.h:

(DFG):
(VM):

Source/WTF:

Reviewed by Geoffrey Garen.

  • wtf/ByteSpinLock.h:

Make it non-copyable. We previously had bugs where we used ByteSpinLock as a locker.
Clearly that's bad.

  • wtf/MetaAllocatorHandle.h:

Make it thread-safe ref-counted, since we may now be passing them between the
concurrent JIT thread and the main thread.

  • wtf/Vector.h:

(WTF::Vector::takeLast):
I've wanted this method for ages, and now I finally added.

9:00 PM Changeset in webkit [153168] by oliver@apple.com
  • 2 edits in trunk/Tools

fourthTier: display-profiler-output should make it even easier to diff the compilation story between two different runs
https://bugs.webkit.org/show_bug.cgi?id=116556

Reviewed by Oliver Hunt.

This adds three new capabilities:

  • 'display' now accepts negative compilation indices, and allows specifying wildcard hashes combined with combination indices. Previously you could say 'display <hash>', 'display <hash>-<index>-<engine>', or 'display *'. The latter would display every compilation. This improves this so that you can say 'display *-<index>-<engine>'. It also makes it so that you can give a negative index, which allows you to say things like 'display blah--1-dfg', which displays just the last DFG compilation. Also you can say 'display *--1-dfg', which displays the last DFG compilation for each code block. I realize that this is kind of ugly, but gosh is it practical.
  • You can now say 'sort hash', which will henceforth sort all of the output by code hash rather than by the time when it was compiled. This means that if you're doing 'dispay *--1-dfg' and then want to diff the results against something else, you can ensure that this doesn't get confused just by changes in compilation order.
  • You can now say 'counts off', which will henceforth disable the display of execution counts from 'bytecode' and 'display'. This is also useful for diffs, since if you're trying to figure out why two compilations are different, they probably have radically different counts. 'counts off' gets this out of the output so that it doesn't confuse your diff.

Note that to use this effectively you should also have a script that scrubs
pointers from text so that the diff doesn't get confused by pointers. I'll
post my elimptr script to the bug. Maybe at some point I'll integrate that
into display-profiler-output.

Put together this is pretty awesome. I was able to do the following:

(echo "counts off" && echo "sort hash" && echo "d *--1-dfg") | Tools/Scripts/display-profiler-output richards-serial.profile | elimptr > richards-serial.asm
(echo "counts off" && echo "sort hash" && echo "d *--1-dfg") | Tools/Scripts/display-profiler-output richards-concurrent.profile | elimptr > richards-concurrent.asm
diff -u richards-serial.asm richards-concurrent.asm

And this immediately told me that the reason why richards is slower in the
concurrent compilation case is just that we end up compiling *tons* more
functions, most of which are trivially inlineable. Basically, concurrent
compilation breaks our previous heuristics for delaying compilation of
inlineables just enough that they never trigger compilation. We should fix
that in a separate bug.

  • Scripts/display-profiler-output:
9:00 PM Changeset in webkit [153167] by oliver@apple.com
  • 18 edits in trunk

fourthTier: CheckArrays should be hoisted
https://bugs.webkit.org/show_bug.cgi?id=116353

Source/JavaScriptCore:

Performance neutral. This will be more important when we start depending on CheckArray for flat arrays.

Reviewed by Filip Pizlo.

  • dfg/DFGAbstractState.cpp: Add ForwardCheckArray to wherever we had a CheckArray before.

(JSC::DFG::AbstractState::executeEffects):

  • dfg/DFGArgumentsSimplificationPhase.cpp:

(JSC::DFG::ArgumentsSimplificationPhase::run):

  • dfg/DFGArrayMode.h:

(JSC::DFG::ArrayMode::isContravenedByStructure): Checks if the ArrayMode derived from a specific Structure
would contradict the ArrayModes that would be filtered by the current ArrayMode. This is used to detect
if any specific CheckStructures would contradict our CheckArray so that we can defer to the CheckStructure's
judgment.

  • dfg/DFGByteCodeParser.cpp: Fill in checkArrayHoistingFailed where we previously exited due to a BadIndexingType.

(JSC::DFG::ByteCodeParser::setLocal):
(JSC::DFG::ByteCodeParser::setArgument):
(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGCSEPhase.cpp:

(JSC::DFG::CSEPhase::checkArrayElimination):
(JSC::DFG::CSEPhase::performNodeCSE):

  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::foldConstants):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGNode.h:

(JSC::DFG::Node::hasArrayMode):

  • dfg/DFGNodeType.h: New ForwardCheckArray node type.
  • dfg/DFGPredictionPropagationPhase.cpp:

(JSC::DFG::PredictionPropagationPhase::propagate):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGTypeCheckHoistingPhase.cpp: Refactored most of TypeCheckHoistingPhase into separate functions, some

of which are now generic to both CheckStructure and CheckArray hoisting while others are specific to one or the
other. Both of the non-zero CheckBallot values must be 1 because we use them as an index into an array of
length 2 inside the VariableAccessData.
(CheckData): Moved structure outside of TypeCheckHoistingPhase so that ArrayTypeCheck and StructureTypeCheck
can access it. Also added new fields for tracking ArrayModes. We need the m_arrayModeIsValid because there
isn't a good sentinel value for "this ArrayMode is invalid and meaningless" like there is for m_structure.
We need m_arrayModeHoistingOkay for when we want to permanently disable hoisting for that particular variable.
(JSC::DFG::CheckData::CheckData):
(JSC::DFG::CheckData::disableCheckArrayHoisting): Helper function for disabling CheckArray hoisting for a
specific CheckData.
(JSC::DFG::TypeCheckHoistingPhase::run): We now do both CheckStructure and CheckArray hoisting, although we prefer
CheckStructure hoisting when given the possibility to do both.
(TypeCheckHoistingPhase):
(JSC::DFG::TypeCheckHoistingPhase::clearVariableVotes): Clears all of the VariableAccessData votes since they
can only have two types of votes at any particular time.
(JSC::DFG::TypeCheckHoistingPhase::identifyRedundantStructureChecks):
(JSC::DFG::TypeCheckHoistingPhase::identifyRedundantArrayChecks): Very similar to identifyRedundantStructureChecks,
but with a few different nodes that are important, namely CheckArray (instead of CheckStructure) and the Arrayify-like
nodes always disable hoisting since they always change the IndexingType.
(JSC::DFG::TypeCheckHoistingPhase::disableHoistingForVariablesWithInsufficientVotes):
(JSC::DFG::TypeCheckHoistingPhase::disableHoistingAcrossOSREntries):
(JSC::DFG::TypeCheckHoistingPhase::disableCheckArrayHoisting): Helper that looks up the CheckData for the
specified variable and disables CheckArray hoisting on it.
(JSC::DFG::TypeCheckHoistingPhase::shouldConsiderForHoisting):
(JSC::DFG::TypeCheckHoistingPhase::noticeStructureCheck):
(JSC::DFG::TypeCheckHoistingPhase::noticeCheckArray):
(JSC::DFG::TypeCheckHoistingPhase::noticeStructureCheckAccountingForArrayMode): We want to take CheckStructure nodes
into account when hoisting CheckArrays, so we make sure that if we contradict what a CheckStructure says then we
give up on hoisting the CheckArray.
(JSC::DFG::ArrayTypeCheck::isValidToHoist):
(ArrayTypeCheck): Structure that houses some of the specifics on how to hoist CheckArrays. This structure
is used a template argument to allow some of the very similar code to statically parameterized and reused
for both CheckStructure and CheckArray hoisting.
(JSC::DFG::ArrayTypeCheck::disableHoisting):
(JSC::DFG::ArrayTypeCheck::isContravenedByValue):
(JSC::DFG::ArrayTypeCheck::hasEnoughVotesToHoist):
(JSC::DFG::ArrayTypeCheck::hoistingPreviouslyFailed):
(JSC::DFG::StructureTypeCheck::isValidToHoist):
(StructureTypeCheck): Same as ArrayTypeCheck, but specific to CheckStructure hoisting.
(JSC::DFG::StructureTypeCheck::disableHoisting):
(JSC::DFG::StructureTypeCheck::isContravenedByValue):
(JSC::DFG::StructureTypeCheck::hasEnoughVotesToHoist):
(JSC::DFG::StructureTypeCheck::hoistingPreviouslyFailed):

  • dfg/DFGUnificationPhase.cpp: Added merging of whether or not CheckArray hoisting failed.

(JSC::DFG::UnificationPhase::run):

  • dfg/DFGVariableAccessData.h:

(JSC::DFG::VariableAccessData::VariableAccessData):
(JSC::DFG::VariableAccessData::mergeCheckArrayHoistingFailed):
(VariableAccessData):
(JSC::DFG::VariableAccessData::checkArrayHoistingFailed):

  • runtime/Options.h:

LayoutTests:

Added a microbenchmark to JSRegress that specifically targets CheckArray hoisting.
We get a 25% improvement on it.

Reviewed by Filip Pizlo.

  • fast/js/regress/check-array-hoisting-expected.txt: Added.
  • fast/js/regress/check-array-hoisting.html: Added.
  • fast/js/regress/script-tests/check-array-hoisting.js: Added.

(f):

9:00 PM Changeset in webkit [153166] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: getCTIStub should be thread-safe
https://bugs.webkit.org/show_bug.cgi?id=116126

Reviewed by Dan Bernstein.

It's called from the compilation thread. Give it locks.

  • jit/JITThunks.cpp:

(JSC::JITThunks::ctiStub):
(JSC::JITThunks::hostFunctionStub):

  • jit/JITThunks.h:

(JITThunks):

9:00 PM Changeset in webkit [153165] by oliver@apple.com
  • 19 edits
    2 copies in trunk/Source/JavaScriptCore

fourthTier: Executable and CodeBlock should be aware of DFG::Plans that complete asynchronously
https://bugs.webkit.org/show_bug.cgi?id=116350

Reviewed by Oliver Hunt.

This refactors compilation so that:

  • JITStubs knows exactly what the result of compilation was. For example, if compilation was deferred, it will now know this.
  • The set of things that has to happen to install compiled code is now factored out into JSC::installOptimizedCode().
  • A bunch of the code in Executable.cpp is now made more common to reduce code duplication. For example, the heap heuristics stuff is now in one place.

(JSC::ProgramCodeBlock::compileOptimized):
(JSC::ProgramCodeBlock::replaceWithDeferredOptimizedCode):
(JSC):
(JSC::EvalCodeBlock::compileOptimized):
(JSC::EvalCodeBlock::replaceWithDeferredOptimizedCode):
(JSC::FunctionCodeBlock::compileOptimized):
(JSC::FunctionCodeBlock::replaceWithDeferredOptimizedCode):
(JSC::ProgramCodeBlock::jitCompileImpl):
(JSC::EvalCodeBlock::jitCompileImpl):
(JSC::FunctionCodeBlock::jitCompileImpl):

  • bytecode/CodeBlock.h:

(CodeBlock):
(JSC::CodeBlock::jitCompile):
(ProgramCodeBlock):
(EvalCodeBlock):
(FunctionCodeBlock):

  • dfg/DFGDesiredIdentifiers.cpp:

(JSC::DFG::DesiredIdentifiers::numberOfIdentifiers):
(DFG):
(JSC::DFG::DesiredIdentifiers::at):

  • dfg/DFGDesiredIdentifiers.h:

(JSC):
(DesiredIdentifiers):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):
(JSC::DFG::tryCompile):
(JSC::DFG::tryCompileFunction):
(JSC::DFG::tryFinalizePlan):
(DFG):

  • dfg/DFGDriver.h:

(DFG):
(JSC::DFG::tryCompile):
(JSC::DFG::tryCompileFunction):
(JSC::DFG::tryFinalizePlan):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::Graph):

  • dfg/DFGJITFinalizer.cpp:

(JSC::DFG::JITFinalizer::finalizeCommon):

  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::Plan):
(JSC::DFG::Plan::compileInThread):
(JSC::DFG::Plan::reallyAdd):

  • dfg/DFGPlan.h:

(JSC):
(Plan):
(DFG):

  • ftl/FTLJITFinalizer.cpp:

(JSC::FTL::JITFinalizer::finalizeFunction):

  • jit/JITDriver.h:

(JSC::jitCompileIfAppropriateImpl):
(JSC::jitCompileFunctionIfAppropriateImpl):
(JSC):
(JSC::jitCompileIfAppropriate):
(JSC::jitCompileFunctionIfAppropriate):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::jitCompileAndSetHeuristics):

  • runtime/CompilationResult.cpp: Added.

(WTF):
(WTF::printInternal):

  • runtime/CompilationResult.h: Added.

(JSC):
(WTF):

  • runtime/Executable.cpp:

(JSC::EvalExecutable::compileOptimized):
(JSC::EvalExecutable::jitCompile):
(JSC::EvalExecutable::compileInternal):
(JSC::EvalExecutable::replaceWithDeferredOptimizedCode):
(JSC):
(JSC::ProgramExecutable::compileOptimized):
(JSC::ProgramExecutable::jitCompile):
(JSC::ProgramExecutable::compileInternal):
(JSC::ProgramExecutable::replaceWithDeferredOptimizedCode):
(JSC::FunctionExecutable::compileOptimizedForCall):
(JSC::FunctionExecutable::compileOptimizedForConstruct):
(JSC::FunctionExecutable::jitCompileForCall):
(JSC::FunctionExecutable::jitCompileForConstruct):
(JSC::FunctionExecutable::compileForCallInternal):
(JSC::FunctionExecutable::replaceWithDeferredOptimizedCodeForCall):
(JSC::FunctionExecutable::compileForConstructInternal):
(JSC::FunctionExecutable::replaceWithDeferredOptimizedCodeForConstruct):

  • runtime/Executable.h:

(ScriptExecutable):
(EvalExecutable):
(ProgramExecutable):
(FunctionExecutable):
(JSC::FunctionExecutable::compileOptimizedFor):
(JSC::FunctionExecutable::replaceWithDeferredOptimizedCodeFor):
(JSC::FunctionExecutable::jitCompileFor):

  • runtime/ExecutionHarness.h:

(JSC::prepareForExecutionImpl):
(JSC::prepareFunctionForExecutionImpl):
(JSC):
(JSC::installOptimizedCode):
(JSC::prepareForExecution):
(JSC::prepareFunctionForExecution):
(JSC::replaceWithDeferredOptimizedCode):

9:00 PM Changeset in webkit [153164] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: observeUseKindOnNode doesn't contain a case for KnownCellUse

https://bugs.webkit.org/show_bug.cgi?id=116130

This would just lead to us being overly conservative when deciding
whether we should unbox GetLocals with KnownCellUse UseKinds.

Reviewed by Filip Pizlo.

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::observeUseKindOnNode):

9:00 PM Changeset in webkit [153163] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: infrequent segfault in DFGCodeBlocks::deleteUnmarkedJettisonedCodeBlocks()
https://bugs.webkit.org/show_bug.cgi?id=116134

CodeBlock and JITCode should be ThreadSafeRefCounted. We're going to
start using them on more threads very soon (with concurrent
compilation). This patch also fixes the specific place where we were
superfluously creating a RefPtr.

Reviewed by Oliver Hunt.

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::getJITType):

  • jit/JITCode.h:
9:00 PM Changeset in webkit [153162] by oliver@apple.com
  • 17 edits
    2 adds in trunk/Source/JavaScriptCore

fourthTier: Implement a probe mechanism for JIT generated code.
https://bugs.webkit.org/show_bug.cgi?id=115705.

Reviewed by Geoffrey Garen.

The probe is in the form of a MacroAssembler pseudo instruction.
It takes 3 arguments: a ProbeFunction, and 2 void* args.

When inserted into the JIT at some code generation site, the probe
pseudo "instruction" will emit a minimal amount of code to save the
stack pointer, 1 (or more) scratch register(s), and the probe
arguments into a ProbeContext record on the stack. The emitted code
will then call a probe trampoline to do the rest of the work, which
consists of:

  1. saving the remaining registers into the ProbeContext.
  2. calling the ProbeFunction, and passing it the ProbeContext pointer.
  3. restoring the registers from the ProbeContext after the ProbeFunction returns, and then returning to the JIT generated code.

The ProbeContext is stack allocated and is only valid for the duration
that the ProbeFunction is executing.

If the user supplied ProbeFunction alters the register values in the
ProbeContext, the new values will be installed into the registers upon
returning from the probe. This can be useful for some debugging or
testing purposes.

The probe mechanism is built conditional on USE(MASM_PROBE) which is
defined in config.h. USE(MASM_PROBE) will off by default.

This changeset only implements the probe mechanism for X86 and X86_64.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
  • JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
  • JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • Target.pri:
  • assembler/MacroAssembler.h:

(MacroAssembler):
(JSC::MacroAssembler::shouldBlind):
(JSC::MacroAssembler::store32):

  • assembler/MacroAssemblerX86.h:

(MacroAssemblerX86):
(JSC::MacroAssemblerX86::trustedImm32FromPtr):
(JSC::MacroAssemblerX86::probe):

  • assembler/MacroAssemblerX86Common.cpp: Added.

(JSC::MacroAssemblerX86Common::ProbeContext::dumpCPURegisters):

  • CPU specific register dumper called by ProbeContext::dump().

(JSC::MacroAssemblerX86Common::ProbeContext::dump):

  • Prints the ProbeContext to the DataLog.
  • assembler/MacroAssemblerX86Common.h:

(MacroAssemblerX86Common):
(CPUState): Added.
(ProbeContext): Added.

  • assembler/MacroAssemblerX86_64.h:

(MacroAssemblerX86_64):
(JSC::MacroAssemblerX86_64::trustedImm64FromPtr):
(JSC::MacroAssemblerX86_64::probe):

  • assembler/X86Assembler.h:
  • config.h: Added WTF_USE_MASM_PROBE flag.
  • jit/JITStubs.cpp:
  • jit/JITStubs.h:
  • jit/JITStubsX86.h:
  • jit/JITStubsX86Common.h: Added.
  • jit/JITStubsX86_64.h:
9:00 PM Changeset in webkit [153161] by oliver@apple.com
  • 23 edits
    11 copies in trunk/Source/JavaScriptCore

fourthTier: DFG should separate link phase into things that must be done concurrently and things that must be done synchronously, and have a way of passing data from one to the other
https://bugs.webkit.org/show_bug.cgi?id=116060

Reviewed by Gavin Barraclough.

This introduces the concept of a DFG::Plan, which corresponds to:

  • The data that the concurrent DFG or FTL need to start compiling a CodeBlock. This mostly includes basic things like CodeBlock*, but also a list of must-handle values for OSR entry.
  • The data that the synchronous linker need to link in code compiled by a concurrent compilation thread. This is further encapsulated by DFG::Finalizer, since the data, and the actions that need to be taken, are different in DFG versus FTL. This patch also institutes the policy that the concurrent compilation thread shall not use LinkBuffer::performFinalization(), since that code assumes that it's running on the same thread that will actually run the code.
  • The actions that need to be taken to compile code. In other words, most of the code that previously lived in DFGDriver.cpp now lives in DFG::Plan::compileInThread().
  • The actions that need to be taken when synchronously linking the code. This includes "really" adding watchpoints and identifiers, checking watchpoint and chain validity, and running the DFG::Finalizer.

Currently, DFGDriver just creates a Plan and runs it synchronously. But in the
future, we will be able to malloc some Plans and enqueue them, and have the
concurrent thread dequeue them and call Plan::compileInThread().

For now, this has no behavior or performance change.

(JSC::LinkBuffer::performFinalization):

  • assembler/LinkBuffer.h:

(LinkBuffer):
(JSC::LinkBuffer::LinkBuffer):
(JSC::LinkBuffer::~LinkBuffer):

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::initialize):
(JSC::DFG::AbstractState::executeEffects):

  • dfg/DFGAbstractValue.cpp:

(JSC::DFG::AbstractValue::setFuturePossibleStructure):
(JSC::DFG::AbstractValue::filterFuturePossibleStructure):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::addStructureTransitionCheck):
(JSC::DFG::ByteCodeParser::handleGetById):
(JSC::DFG::ByteCodeParser::parseResolveOperations):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
(JSC::DFG::ByteCodeParser::parseCodeBlock):

  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::foldConstants):
(JSC::DFG::ConstantFoldingPhase::addStructureTransitionCheck):

  • dfg/DFGDriver.cpp:

(DFG):
(JSC::DFG::compile):

  • dfg/DFGFailedFinalizer.cpp: Added.

(DFG):
(JSC::DFG::FailedFinalizer::FailedFinalizer):
(JSC::DFG::FailedFinalizer::~FailedFinalizer):
(JSC::DFG::FailedFinalizer::finalize):
(JSC::DFG::FailedFinalizer::finalizeFunction):

  • dfg/DFGFailedFinalizer.h: Added.

(DFG):
(FailedFinalizer):

  • dfg/DFGFinalizer.cpp: Added.

(DFG):
(JSC::DFG::Finalizer::Finalizer):
(JSC::DFG::Finalizer::~Finalizer):

  • dfg/DFGFinalizer.h: Added.

(DFG):
(Finalizer):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::FixupPhase::canOptimizeStringObjectAccess):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::Graph):
(JSC::DFG::Graph::dump):
(DFG):

  • dfg/DFGGraph.h:

(Graph):
(JSC::DFG::Graph::masqueradesAsUndefinedWatchpointIsStillValid):
(JSC::DFG::Graph::compilation):
(JSC::DFG::Graph::identifiers):
(JSC::DFG::Graph::watchpoints):
(JSC::DFG::Graph::chains):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::linkOSRExits):
(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::compileFunction):
(JSC::DFG::JITCompiler::linkFunction):
(DFG):
(JSC::DFG::JITCompiler::disassemble):

  • dfg/DFGJITCompiler.h:

(JITCompiler):
(JSC::DFG::JITCompiler::addLazily):

  • dfg/DFGJITFinalizer.cpp: Added.

(DFG):
(JSC::DFG::JITFinalizer::JITFinalizer):
(JSC::DFG::JITFinalizer::~JITFinalizer):
(JSC::DFG::JITFinalizer::finalize):
(JSC::DFG::JITFinalizer::finalizeFunction):
(JSC::DFG::JITFinalizer::finalizeCommon):

  • dfg/DFGJITFinalizer.h: Added.

(DFG):
(JITFinalizer):

  • dfg/DFGPlan.cpp: Added.

(DFG):
(JSC::DFG::dumpAndVerifyGraph):
(JSC::DFG::Plan::Plan):
(JSC::DFG::Plan::~Plan):
(JSC::DFG::Plan::compileInThread):
(JSC::DFG::Plan::isStillValid):
(JSC::DFG::Plan::reallyAdd):
(JSC::DFG::Plan::finalize):

  • dfg/DFGPlan.h: Added.

(DFG):
(Plan):
(JSC::DFG::Plan::vm):

  • dfg/DFGPredictionInjectionPhase.cpp:

(JSC::DFG::PredictionInjectionPhase::run):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::identifierUID):
(JSC::DFG::SpeculativeJIT::speculateStringObjectForStructure):

  • dfg/DFGTypeCheckHoistingPhase.cpp:

(JSC::DFG::TypeCheckHoistingPhase::run):

  • ftl/FTLGeneratedFunction.h: Added.

(FTL):

  • ftl/FTLJITFinalizer.cpp: Added.

(FTL):
(JSC::FTL::JITFinalizer::JITFinalizer):
(JSC::FTL::JITFinalizer::~JITFinalizer):
(JSC::FTL::JITFinalizer::finalize):
(JSC::FTL::JITFinalizer::finalizeFunction):

  • ftl/FTLJITFinalizer.h: Added.

(FTL):
(JITFinalizer):
(JSC::FTL::JITFinalizer::initializeExitThunksLinkBuffer):
(JSC::FTL::JITFinalizer::initializeEntrypointLinkBuffer):
(JSC::FTL::JITFinalizer::initializeCode):
(JSC::FTL::JITFinalizer::initializeFunction):
(JSC::FTL::JITFinalizer::initializeArityCheck):
(JSC::FTL::JITFinalizer::initializeJITCode):

  • ftl/FTLLink.cpp:

(JSC::FTL::link):

  • ftl/FTLLink.h:

(FTL):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::linkOSRExitsAndCompleteInitializationBlocks):

  • ftl/FTLState.cpp:

(JSC::FTL::State::State):

  • ftl/FTLState.h:

(FTL):
(State):

9:00 PM Changeset in webkit [153160] by oliver@apple.com
  • 5 edits
    6 adds in trunk/Source/JavaScriptCore

fourthTier: Refactor JITStubs.cpp to move CPU specific parts out into their own files.
https://bugs.webkit.org/show_bug.cgi?id=116135.

Reviewed by Michael Saboff.

This mod only moves the CPU specific parts out. There is no code change.
Tested on debug builds of X86, X86_64, ARM and ARMv7. The SH4 and MIPS
ports are untested. Windows port also not tested.

(JSC::performPlatformSpecificJITAssertions):

  • jit/JITStubsARM.h: Added.

(JSC::ctiTrampoline):
(JSC::ctiTrampolineEnd):
(JSC::ctiVMThrowTrampoline):
(JSC::ctiOpThrowNotCaught):
(JSC::performARMJITAssertions):

  • jit/JITStubsARMv7.h: Added.

(JSC::ctiTrampoline):
(JSC::ctiVMThrowTrampoline):
(JSC::ctiOpThrowNotCaught):
(JSC::performARMv7JITAssertions):

  • jit/JITStubsMIPS.h: Added.

(JSC::performMIPSJITAssertions):

  • jit/JITStubsSH4.h: Added.
  • jit/JITStubsX86.h: Added.
  • jit/JITStubsX86_64.h: Added.
9:00 PM Changeset in webkit [153159] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: Segfault in jsc with simple test program when running with profile dumping enabled
https://bugs.webkit.org/show_bug.cgi?id=116082

It's crashing because CodeBlock::baselineVersion() doesn't know how to handle the case where 'this' is the
baseline version but it hasn't been assigned to the m_blahCodeBlock field in BlahExecutable. The fix is to
check if we're the baseline version in baselineVersion() and return this if so.

Reviewed by Filip Pizlo.

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::baselineVersion):

9:00 PM Changeset in webkit [153158] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: Rename StructureCheckHoistingPhase to TypeCheckHoistingPhase
https://bugs.webkit.org/show_bug.cgi?id=115938

We're going to add some more types of check hoisting soon, so let's have
the right name here.

Rubber stamped by Filip Pizlo.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • Target.pri:
  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):

  • dfg/DFGStructureCheckHoistingPhase.cpp: Removed.
  • dfg/DFGStructureCheckHoistingPhase.h: Removed.
  • dfg/DFGTypeCheckHoistingPhase.cpp: Added.

(DFG):
(TypeCheckHoistingPhase):
(JSC::DFG::TypeCheckHoistingPhase::TypeCheckHoistingPhase):
(JSC::DFG::TypeCheckHoistingPhase::run):
(JSC::DFG::TypeCheckHoistingPhase::shouldConsiderForHoisting):
(JSC::DFG::TypeCheckHoistingPhase::noticeStructureCheck):
(CheckData):
(JSC::DFG::TypeCheckHoistingPhase::CheckData::CheckData):
(JSC::DFG::performTypeCheckHoisting):

  • dfg/DFGTypeCheckHoistingPhase.h: Added.
9:00 PM Changeset in webkit [153157] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: SpeculativeJIT::checkArray should use the correct ExitKind
https://bugs.webkit.org/show_bug.cgi?id=115943

Currently it uses Uncountable, which gives us no information if we end up exiting due to a
mismatched ClassInfo pointer. It should instead use BadType and should pass the correct
JSValueSource and Node instead of passing empty values.

Reviewed by Filip Pizlo.

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::checkArray):

9:00 PM Changeset in webkit [153156] by oliver@apple.com
  • 6 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should support Jump and ForceOSRExit
https://bugs.webkit.org/show_bug.cgi?id=115942

Reviewed by Oliver Hunt.

Added two obvious nodes: Jump and ForceOSRExit. We already had everything we needed
to support them.

Adding these increases our coverage a fair bit, and revealed a bug: LLVM's full
instruction selector currently appears to mishandle doubles in constant pools (or
just constant pools in general) with the small code model in the MCJIT. But switching
to FastISel "fixes" it. That's what this patch does, for now. This will probably
actually be permanent; the FastISel does pretty much everything we would ever want,
at least in the foreseeable future.

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):
(FTL):

  • ftl/FTLCompile.cpp:

(JSC::FTL::compile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileBlock):
(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileJSConstant):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::compileJump):
(JSC::FTL::LowerDFGToLLVM::compileReturn):
(JSC::FTL::LowerDFGToLLVM::compileForceOSRExit):

  • runtime/Options.h:

(JSC):

9:00 PM Changeset in webkit [153155] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should support CompareStrictEqConstant
https://bugs.webkit.org/show_bug.cgi?id=115941

Reviewed by Mark Hahnenberg.

Pretty simple, but factors out the craziness of comparing against null or undefined
in a way that is reusable for both == and ===.

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant):
(JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::equalNullOrUndefined):

8:59 PM Changeset in webkit [153154] by oliver@apple.com
  • 7 edits
    2 adds in trunk/Source/JavaScriptCore

fourthTier: FTL should support CompareEqConstant
https://bugs.webkit.org/show_bug.cgi?id=115939

Reviewed by Oliver Hunt and Mark Hahnenberg.

The most interesting part of this patch is the way I make it easier to deal with
the inputs to Phi functions. This adds the notion of ValueFromBlock, which you
can get by doing m_out.anchor(value). You can build up a vector of these, and then
pass them to m_out.phi(type, vector) in one go.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • ftl/FTLAbbreviatedTypes.h: Added.

(FTL):

  • ftl/FTLAbbreviations.h:

(FTL):
(JSC::FTL::addIncoming):
(JSC::FTL::buildPhi):

  • ftl/FTLAbstractHeapRepository.h:

(FTL):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::lowDouble):
(JSC::FTL::LowerDFGToLLVM::masqueradesAsUndefinedWatchpointIfIsStillValid):

  • ftl/FTLOutput.h:

(JSC::FTL::Output::phi):
(Output):
(JSC::FTL::Output::anchor):

  • ftl/FTLValueFromBlock.h: Added.

(FTL):
(ValueFromBlock):
(JSC::FTL::ValueFromBlock::ValueFromBlock):
(JSC::FTL::ValueFromBlock::value):
(JSC::FTL::ValueFromBlock::block):

8:59 PM Changeset in webkit [153153] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should support CompareStrictEq
https://bugs.webkit.org/show_bug.cgi?id=115927

Reviewed by Mark Hahnenberg.

Do the sensible thing, and make it so that for common cases, CompareEq is
implemented in terms of CompareStrictEq in the FTL backend. All of the cases
we currently support can be done this way.

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileCompareEq):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::compileCompareStrictEq):

8:59 PM Changeset in webkit [153152] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should support Int32ToDouble
https://bugs.webkit.org/show_bug.cgi?id=115926

Reviewed by Mark Hahnenberg.

This node exists mainly to help the DFG see that a node may have both an int
and a double representation. But in the FTL, nodes already have multiple
representations. So this is just a no-op for the FTL.

I considered making it so that the node isn't even inserted if we're doing
FTL compilation, but that would have required a bunch of conditionalizing in
the DFG's optimization phases, which sort of expect this node to be present
and necessary.

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileInt32ToDouble):
(LowerDFGToLLVM):

8:59 PM Changeset in webkit [153151] by oliver@apple.com
  • 5 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should support LogicalNot
https://bugs.webkit.org/show_bug.cgi?id=115924

Reviewed by Mark Hahnenberg.

  • ftl/FTLAbbreviations.h:

(JSC::FTL::buildNot):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileLogicalNot):
(LowerDFGToLLVM):

  • ftl/FTLOutput.h:

(JSC::FTL::Output::bitNot):

8:59 PM Changeset in webkit [153150] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should support CompareGreater, CompareLessEq, and CompareGreaterEq
https://bugs.webkit.org/show_bug.cgi?id=115923

Reviewed by Mark Hahnenberg.

Also fixed a bug where double CompareLess would assert.

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileCompareLess):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::compileCompareLessEq):
(JSC::FTL::LowerDFGToLLVM::compileCompareGreater):
(JSC::FTL::LowerDFGToLLVM::compileCompareGreaterEq):

8:59 PM Changeset in webkit [153149] by oliver@apple.com
  • 1 edit in trunk/Source/JavaScriptCore/ChangeLog

fourthTier: FTL CompareEq ObjectUse should handle masquerading
https://bugs.webkit.org/show_bug.cgi?id=115920

Reviewed by Mark Hahnenberg.

We don't yet support watchpoints, but this does all the wiring right up to the
part where we would have emitted watchpoints. I've also written this in a way that
makes it easy to use the case where you would have anyway speculated non-masquerading
even if the watchpoint was invalidated.

This is inherently racy, of course: but the only race here is that you might first
set the watchpoint, and then the watchpoint is invalidated, and then you compile rest
of the code in a way that doesn't need the watchpoint. That's fine, since the FTL
will remember that it had set the watchpoint and then cancel the compilation.

  • ftl/FTLAbbreviations.h:

(JSC::FTL::int8Type):

  • ftl/FTLAbstractHeapRepository.h:

(FTL):

  • ftl/FTLCommonValues.cpp:

(JSC::FTL::CommonValues::CommonValues):

  • ftl/FTLCommonValues.h:

(CommonValues):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileCompareEq):
(JSC::FTL::LowerDFGToLLVM::lowNonNullObject):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::speculateNonNullObject):
(JSC::FTL::LowerDFGToLLVM::masqueradesAsUndefinedWatchpointIsStillValid):
(JSC::FTL::LowerDFGToLLVM::masqueradesAsUndefinedWatchpointIfIsStillValid):

  • ftl/FTLOutput.h:

(JSC::FTL::Output::constInt8):
(JSC::FTL::Output::load8):
(JSC::FTL::Output::isZero8):
(JSC::FTL::Output::notZero8):
(JSC::FTL::Output::testIsZero8):
(JSC::FTL::Output::testNonZero8):

8:59 PM Changeset in webkit [153148] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: DFG shouldn't allocate in the GC heap
https://bugs.webkit.org/show_bug.cgi?id=115598

Reviewed by Geoffrey Garen.

I believe that we've now fixed this, and this patch just adds the relevant assertion.

  • runtime/JSCellInlines.h:

(JSC::JSCell::JSCell):

8:59 PM Changeset in webkit [153147] by oliver@apple.com
  • 19 edits in trunk/Source/JavaScriptCore

fourthTier: CodeBlock should be RefCounted
https://bugs.webkit.org/show_bug.cgi?id=115594

Reviewed by Geoffrey Garen.

This makes it possible to have the currently-being-compiled CodeBlock not be
installed in Executable, while also allowing it to point to its intended
alternative(). So long as we were using ownership and not reference counting, it
would have been difficult to have both CodeBlock::m_alternative and
Executable::m_codeBlockForBlah point to the previous CodeBlock.

I also took the opportunity to clean up a bunch of code that appears to have
rotted.

  • assembler/MacroAssemblerCodeRef.h:

(MacroAssemblerCodePtr):
(JSC::MacroAssemblerCodePtr::operator==):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::CodeBlock):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::releaseAlternative):
(JSC::CodeBlock::setAlternative):
(CodeBlock):
(JSC::GlobalCodeBlock::GlobalCodeBlock):
(JSC::ProgramCodeBlock::ProgramCodeBlock):
(JSC::EvalCodeBlock::EvalCodeBlock):
(JSC::FunctionCodeBlock::FunctionCodeBlock):

  • heap/DFGCodeBlocks.cpp:

(JSC::DFGCodeBlocks::~DFGCodeBlocks):
(JSC::DFGCodeBlocks::jettison):
(JSC::DFGCodeBlocks::deleteUnmarkedJettisonedCodeBlocks):

  • heap/DFGCodeBlocks.h:

(DFGCodeBlocks):

  • heap/Heap.cpp:

(JSC::Heap::jettisonDFGCodeBlock):

  • heap/Heap.h:
  • jit/JITDriver.h:

(JSC::jitCompileIfAppropriate):
(JSC::jitCompileFunctionIfAppropriate):

  • runtime/Executable.cpp:

(JSC::jettisonCodeBlock):
(JSC::EvalExecutable::jitCompile):
(JSC::EvalExecutable::compileInternal):
(JSC::ProgramExecutable::jitCompile):
(JSC::ProgramExecutable::compileInternal):
(JSC::FunctionExecutable::jitCompileForCall):
(JSC::FunctionExecutable::jitCompileForConstruct):
(JSC::FunctionExecutable::produceCodeBlockFor):
(JSC::FunctionExecutable::compileForCallInternal):
(JSC::FunctionExecutable::compileForConstructInternal):

  • runtime/Executable.h:

(EvalExecutable):
(FunctionExecutable):
(JSC::FunctionExecutable::codeBlockFor):

  • runtime/ExecutionHarness.h:

(JSC::prepareForExecution):
(JSC::prepareFunctionForExecution):

8:59 PM Changeset in webkit [153146] by oliver@apple.com
  • 16 edits
    4 adds
    2 deletes in trunk/Source/JavaScriptCore

fourthTier: DFG should have its own notion of StructureChain, and it should be possible to validate it after compilation finishes
https://bugs.webkit.org/show_bug.cgi?id=115841

Reviewed by Oliver Hunt.

This adds IntendedStructureChain, which is like StructureChain, except that it holds a bit
more information and can be validated independantly of its owning Structure and lexical
GlobalObject, since it remembers both of those things. It's also malloc'd and RefCounted
rather than GC'd, so it can be allocated in a concurrent compilation thread.

Gave this class a bunch of methods to allow the following idiom:

  • Snapshot a structure chain concurrently. This structure chain may end up being wrong in case of races, but in that case we will find out when we try to validate it.
  • Perform validation on the structure chain itself, without recomputing the chain. Previously, many chain validation methods (prototypeChainMayInterceptStoreTo() for example) recomputed the chain, and hence, were inherently racy: you could build one chain and then validate against a different chain, and hence not realize that the chain you did build was actually broken for your purposes, because the chain you checked was a different one.
  • Validate that the chain is still the right one at any time, allowing the cancellation of compilation if there was a race.

Also added DFG::DesiredStructureChains, which tracks those intended structure chains that
the compiler had already chosen to use. If any of those are invalid at link time, throw
out the compilation.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • bytecode/GetByIdStatus.cpp:

(JSC::GetByIdStatus::computeForChain):
(JSC::GetByIdStatus::computeFor):

  • bytecode/GetByIdStatus.h:

(JSC::GetByIdStatus::GetByIdStatus):
(JSC::GetByIdStatus::chain):
(GetByIdStatus):

  • bytecode/PutByIdStatus.cpp:

(JSC::PutByIdStatus::computeFromLLInt):
(JSC::PutByIdStatus::computeFor):

  • bytecode/PutByIdStatus.h:

(JSC::PutByIdStatus::PutByIdStatus):
(JSC::PutByIdStatus::structureChain):
(PutByIdStatus):

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::executeEffects):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleGetById):
(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::foldConstants):

  • dfg/DFGDesiredStructureChains.cpp: Added.

(DFG):
(JSC::DFG::DesiredStructureChains::DesiredStructureChains):
(JSC::DFG::DesiredStructureChains::~DesiredStructureChains):
(JSC::DFG::DesiredStructureChains::areStillValid):

  • dfg/DFGDesiredStructureChains.h: Added.

(DFG):
(DesiredStructureChains):
(JSC::DFG::DesiredStructureChains::addLazily):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::isStillValid):
(DFG):

  • dfg/DFGGraph.h:

(Graph):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::linkFunction):

  • ftl/FTLLink.cpp:

(JSC::FTL::link):

  • runtime/IntendedStructureChain.cpp: Added.

(JSC):
(JSC::IntendedStructureChain::IntendedStructureChain):
(JSC::IntendedStructureChain::~IntendedStructureChain):
(JSC::IntendedStructureChain::isStillValid):
(JSC::IntendedStructureChain::matches):
(JSC::IntendedStructureChain::chain):
(JSC::IntendedStructureChain::mayInterceptStoreTo):
(JSC::IntendedStructureChain::isNormalized):
(JSC::IntendedStructureChain::terminalPrototype):

  • runtime/IntendedStructureChain.h: Added.

(JSC):
(IntendedStructureChain):
(JSC::IntendedStructureChain::head):
(JSC::IntendedStructureChain::size):
(JSC::IntendedStructureChain::at):
(JSC::IntendedStructureChain::operator[]):
(JSC::IntendedStructureChain::last):

  • runtime/Structure.cpp:

(JSC::Structure::prototypeChainMayInterceptStoreTo):

  • runtime/Structure.h:

(Structure):

  • runtime/StructureInlines.h:

(JSC::Structure::storedPrototypeObject):
(JSC):
(JSC::Structure::storedPrototypeStructure):

8:59 PM Changeset in webkit [153145] by oliver@apple.com
  • 88 edits in trunk

fourthTier: Rationalized 'this' conversion, includes subsequent FTL branch fixes

Reviewed by Oliver Hunt.

Source/JavaScriptCore:

Rationalized 'this' value conversion
https://bugs.webkit.org/show_bug.cgi?id=115542

This fixes a bunch of Sputnik tests, and some bad pointer access.

The new model is that the callee always performs 'this' value conversion.

My ultimate goal is to break up resolve_with_this into single-result
opcodes. This step avoids having to add a special form of convert_this
that distinguishes callers vs callees.

Only the callee knows whether it uses 'this' and/or whether 'this'
conversion should use StrictMode, so it's most natural to perform
convert_this in the callee.

  • API/JSCallbackFunction.cpp: (JSC::JSCallbackFunction::call): Perform 'this' value conversion for our callee, since it may observe 'this'.
  • API/JSCallbackObjectFunctions.h: (JSC::::call): Ditto.
  • API/JSContextRef.cpp: (JSGlobalContextCreateInGroup): Use a proxy 'this' object in global scope even when we're not in the browser. This eliminates some odd cases where API clients used to be able to get a direct reference to an environment record. Now, any reference to an environment record unambiguously means that the VM resolved that record in the scope chain.

(JSContextGetGlobalObject): Removed an incorrect comment. Now that JSC
participates in the proxy 'this' object scheme, the behavior is not
WebCore-only.

  • API/JSObjectRef.cpp: (JSObjectSetPrototype): (JSObjectCallAsFunction): Don't perform 'this' value conversion in the caller; the callee will do it if needed.
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreExports.def:
  • JavaScriptCore.vcxproj/JavaScriptCoreExportGenerator/JavaScriptCoreExports.def.in: What are the chances that this will work?
  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): (JSC::CodeBlock::CodeBlock): Renamed convert_this to to_this, to match our other conversion opcodes.
  • bytecode/CodeOrigin.h: (CodeOrigin): (InlineCallFrame): (JSC::CodeOrigin::codeOriginOwner): Use the more precise type for our executable, so compilation can discover where we're in strict mode.
  • bytecode/Opcode.h: (JSC::padOpcodeName): Updated for rename.
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): Always emit to_this when 'this' is in use -- strict mode still needs to convert environment records to 'undefined'.
  • dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects):
  • dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock):
  • dfg/DFGCapabilities.h: (JSC::DFG::canCompileOpcode): Updated for renames.
  • dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): Tightened up this code to consider strict mode (a new requirement) and to consider the global object (which was always a requirement).
  • dfg/DFGGraph.h: (JSC::DFG::Graph::globalThisObjectFor): (JSC::DFG::Graph::executableFor):
  • dfg/DFGNodeType.h:
  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate):
  • dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile):
  • dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): Ditto.
  • interpreter/Interpreter.cpp: (JSC::eval): (JSC::Interpreter::execute): (JSC::Interpreter::executeCall):
  • interpreter/Interpreter.h: Don't ASSERT about 'this' -- it's our job to fix it up if needed.
  • jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases):
  • jit/JIT.h: (JIT):
  • jit/JITOpcodes.cpp: (JSC::JIT::emit_op_to_this): (JSC::JIT::emitSlow_op_to_this):
  • jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_to_this): (JSC::JIT::emitSlow_op_to_this):
  • jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION):
  • jit/JITStubs.h: Removed special-case code for various kinds of conversions. The baseline fast path is now final objects only. It hurt my brain to think through how to keep the other fast paths working, and our benchmarks do not object.
  • llint/LLIntData.cpp: (JSC::LLInt::Data::performAssertions):
  • llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL):
  • llint/LLIntSlowPaths.h: (LLInt):
  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm: Updated for renames. Removed some special case code, as in the JIT above.
  • profiler/ProfileGenerator.cpp: (JSC::ProfileGenerator::addParentForConsoleStart):
  • runtime/CallData.cpp: (JSC::call):
  • runtime/ClassInfo.h: (MethodTable):
  • runtime/Completion.cpp: (JSC::evaluate):
  • runtime/DatePrototype.cpp: (JSC::dateProtoFuncToJSON): The callee performs 'this' conversion, not the caller.
  • runtime/GetterSetter.cpp: (JSC::callGetter): (JSC::callSetter):
  • runtime/GetterSetter.h: Added helper functions for invoking getters and setters from C++ code, since this was duplicated in a bunch of places.
  • runtime/JSActivation.cpp: (JSC::JSActivation::toThis):
  • runtime/JSActivation.h: (JSActivation):
  • runtime/JSCJSValue.cpp: (JSC::JSValue::toThisSlowCase): (JSC::JSValue::putToPrimitive):
  • runtime/JSCJSValue.h: (JSValue):
  • runtime/JSCJSValueInlines.h: (JSC::JSValue::toThis):
  • runtime/JSCell.cpp: (JSC::JSCell::toThis):
  • runtime/JSCell.h: (JSCell):
  • runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::toThis):
  • runtime/JSGlobalObject.h: (JSGlobalObject): Filled out runtime support for converting 'this' values as needed, according to the appropriate strictness, using helper functions where getter/setter code was duplicated.
  • runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncProtoGetter): (JSC::globalFuncProtoSetter): Perform 'this' value conversion, since we observe 'this'.
  • runtime/JSNameScope.cpp: (JSC::JSNameScope::toThis):
  • runtime/JSNameScope.h: (JSNameScope): Same as JSActivation.
  • runtime/JSObject.cpp: (JSC::JSObject::put): (JSC::JSObject::setPrototypeWithCycleCheck): Bug fix. Don't peform 'this' value conversion in this helper function. The proto setter does this for us, since it's the function that logically observes 'this' -- and we can ASSERT so. Also, the previous code used "globalExec()->thisValue()", which is a read past the beginning of a buffer! I don't think this ever worked on purpose.

(JSC::JSObject::toThis):
(JSC::JSObject::fillGetterPropertySlot):

  • runtime/JSObject.h: (JSC::JSObject::inlineGetOwnPropertySlot):
  • runtime/JSScope.cpp: (JSC::JSScope::resolveWithThis):
  • runtime/JSString.cpp: (JSC::JSString::toThis):
  • runtime/JSString.h: (JSString):
  • runtime/PropertySlot.cpp: (JSC::PropertySlot::functionGetter):
  • runtime/PropertySlot.h: (JSC): (JSC::PropertySlot::setGetterSlot): (JSC::PropertySlot::setCacheableGetterSlot):
  • runtime/SparseArrayValueMap.cpp: (JSC::SparseArrayEntry::get): (JSC::SparseArrayEntry::put):
  • runtime/StrictEvalActivation.cpp: (JSC::StrictEvalActivation::toThis):
  • runtime/StrictEvalActivation.h: (StrictEvalActivation): Ditto.

Source/WebCore:

Rationalized 'this' value conversion
https://bugs.webkit.org/show_bug.cgi?id=115542

Source/WebKit/mac:

Rationalized 'this' value conversion
https://bugs.webkit.org/show_bug.cgi?id=115542

Source/WebKit2:

Rationalized 'this' value conversion
https://bugs.webkit.org/show_bug.cgi?id=115542

LayoutTests:

Rationalized 'this' value conversion
https://bugs.webkit.org/show_bug.cgi?id=115542

8:59 PM Changeset in webkit [153144] by oliver@apple.com
  • 4 edits in trunk/Source/JavaScriptCore

fourthTier: DFG::ByteCodeParser doesn't need ExecState*
https://bugs.webkit.org/show_bug.cgi?id=115582

Reviewed by Geoffrey Garen.

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::ByteCodeParser):
(ByteCodeParser):
(JSC::DFG::parse):

  • dfg/DFGByteCodeParser.h:

(DFG):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):

8:59 PM Changeset in webkit [153143] by oliver@apple.com
  • 7 edits in trunk/Source/JavaScriptCore

fourthTier: Profiler should be thread-safe
https://bugs.webkit.org/show_bug.cgi?id=115445

Reviewed by Geoffrey Garen.

Change the Profiler::Database API for Compilation creation so that we don't add
it to the Database until it's completely constructed. This prevents the Database
from seeing Compilations that are being concurrently constructed.

Change the Profiler::Database itself to do locking for creation of Bytecodes and
for modifying the map. This map may be consulted by both the main thread and the
concurrent thread.

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::Graph):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::linkFunction):

  • jit/JIT.cpp:

(JSC::JIT::privateCompile):

  • profiler/ProfilerBytecodes.h:
  • profiler/ProfilerDatabase.cpp:

(JSC::Profiler::Database::ensureBytecodesFor):
(JSC::Profiler::Database::notifyDestruction):
(JSC::Profiler::Database::addCompilation):

  • profiler/ProfilerDatabase.h:

(Database):

8:59 PM Changeset in webkit [153142] by oliver@apple.com
  • 41 edits
    3 copies in trunk/Source

fourthTier: DFG tries to ref/deref StringImpls in a ton of places
https://bugs.webkit.org/show_bug.cgi?id=115300

Source/JavaScriptCore:

Reviewed by Geoffrey Garen.

Change any code transitively called from DFG compilation to use StringImpl*
directly instead of String, Identifier, or PropertyName. I use the convention
of passing "StringImpl* uid" instead of an Identifier or PropertyName.

Switch over any code transitively called from DFG compilation to use CStrings
whenever possible for all of its debug dumping.

This makes it possible to compile things without hitting the ref/deref
assertion in StringImpl.

(JSC::CodeBlock::inferredName):
(JSC::CodeBlock::sourceCodeForTools):
(JSC::CodeBlock::sourceCodeOnOneLine):
(JSC::constantName):
(JSC::idName):
(JSC::CodeBlock::registerName):
(JSC::regexpToSourceString):
(JSC::regexpName):
(JSC::pointerToSourceString):
(JSC::CodeBlock::printUnaryOp):
(JSC::CodeBlock::printBinaryOp):
(JSC::CodeBlock::printConditionalJump):
(JSC::CodeBlock::printGetByIdOp):
(JSC::dumpStructure):
(JSC::CodeBlock::printCallOp):
(JSC::CodeBlock::printPutByIdOp):
(JSC::CodeBlock::printStructure):
(JSC::CodeBlock::printStructures):
(JSC::CodeBlock::dumpBytecode):

  • bytecode/CodeBlock.h:

(CodeBlock):

  • bytecode/CodeBlockHash.cpp:

(JSC::CodeBlockHash::CodeBlockHash):

  • bytecode/CodeOrigin.cpp:

(JSC::InlineCallFrame::inferredName):

  • bytecode/CodeOrigin.h:

(InlineCallFrame):

  • bytecode/GetByIdStatus.cpp:

(JSC::GetByIdStatus::computeFromLLInt):
(JSC::GetByIdStatus::computeForChain):
(JSC::GetByIdStatus::computeFor):

  • bytecode/GetByIdStatus.h:

(JSC):
(GetByIdStatus):

  • bytecode/PutByIdStatus.cpp:

(JSC::PutByIdStatus::computeFromLLInt):
(JSC::PutByIdStatus::computeFor):

  • bytecode/PutByIdStatus.h:

(JSC):
(PutByIdStatus):

  • bytecode/ReduceWhitespace.cpp:

(JSC::reduceWhitespace):

  • bytecode/ReduceWhitespace.h:

(JSC):

  • bytecode/ResolveGlobalStatus.cpp:

(JSC::computeForStructure):
(JSC::ResolveGlobalStatus::computeFor):

  • bytecode/ResolveGlobalStatus.h:

(JSC):
(ResolveGlobalStatus):

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::executeEffects):

  • dfg/DFGByteCodeParser.cpp:

(ByteCodeParser):
(JSC::DFG::ByteCodeParser::parseResolveOperations):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):

  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::foldConstants):

  • dfg/DFGDesiredIdentifiers.cpp: Added.

(DFG):
(JSC::DFG::DesiredIdentifiers::DesiredIdentifiers):
(JSC::DFG::DesiredIdentifiers::~DesiredIdentifiers):
(JSC::DFG::DesiredIdentifiers::addLazily):
(JSC::DFG::DesiredIdentifiers::reallyAdd):

  • dfg/DFGDesiredIdentifiers.h: Added.

(DFG):
(DesiredIdentifiers):
(JSC::DFG::DesiredIdentifiers::numberOfIdentifiers):
(JSC::DFG::DesiredIdentifiers::at):
(JSC::DFG::DesiredIdentifiers::operator[]):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::FixupPhase::isStringPrototypeMethodSane):
(JSC::DFG::FixupPhase::canOptimizeStringObjectAccess):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::Graph):
(JSC::DFG::Graph::dump):

  • dfg/DFGGraph.h:

(Graph):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::link):

  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGRepatch.cpp:

(JSC::DFG::tryBuildGetByIDList):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::identifierUID):
(JSC::DFG::SpeculativeJIT::callOperation):

  • 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):

  • parser/SourceCode.cpp: Added.

(JSC):
(JSC::SourceCode::toUTF8):

  • parser/SourceCode.h:

(SourceCode):

  • profiler/ProfilerBytecodes.cpp:

(JSC::Profiler::Bytecodes::toJS):

  • profiler/ProfilerBytecodes.h:

(JSC::Profiler::Bytecodes::inferredName):
(JSC::Profiler::Bytecodes::sourceCode):
(Bytecodes):

  • runtime/Identifier.h:

(JSC::Identifier::utf8):
(JSC):

  • runtime/Structure.cpp:

(JSC::Structure::addPropertyTransitionToExistingStructureImpl):
(JSC::Structure::addPropertyTransitionToExistingStructure):
(JSC::Structure::addPropertyTransitionToExistingStructureConcurrently):
(JSC::Structure::getConcurrently):
(JSC::Structure::prototypeChainMayInterceptStoreTo):
(JSC):

  • runtime/Structure.h:

(Structure):

  • runtime/StructureInlines.h:

(JSC::Structure::getConcurrently):

Source/WTF:

Reviewed by Geoffrey Garen.

Make it possible to do more things directly to StringImpl*'s, including being
able to directly do utf8 conversion on a substring without creating the
substring first.

Add assertions to StringImpl that it isn't being ref/deref'd from the
compilation thread.

  • wtf/PrintStream.cpp:

(WTF::printInternal):
(WTF):

  • wtf/PrintStream.h:

(WTF):
(WTF::printInternal):

  • wtf/StringPrintStream.h:

(WTF):
(WTF::toCString):

  • wtf/text/StringImpl.cpp:

(WTF::StringImpl::utf8ForRange):
(WTF::StringImpl::utf8):
(WTF):

  • wtf/text/StringImpl.h:

(StringImpl):
(WTF::StringImpl::hasAtLeastOneRef):
(WTF::StringImpl::ref):
(WTF::StringImpl::deref):

8:59 PM Changeset in webkit [153141] by oliver@apple.com
  • 3 edits in trunk/Source/JavaScriptCore

fourthTier: Structure transition table keys don't have to ref their StringImpl's
https://bugs.webkit.org/show_bug.cgi?id=115525

Reviewed by Geoffrey Garen.

The structure transition table basically maps string to structure. The string is
always also stored, and ref'd, in the structure in Structure::m_nameInPrevious.
m_nameInPrevious is never mutated, and never cleared. The string cannot die unless
the structure dies. If the structure dies, then that entry in the transition map
becomes a zombie anyway and we will detect this separately.

So, we don't need to use RefPtr<StringImpl>. We can just use StringImpl*.

This also fixes a goof where we were getting the StringImpl's hash rather than
using a pointer hash. Not only is the latter faster, but it prevents my change
from leading to crashes: with my change we can have zombie keys, not just zombie
values. They will exist only until the next map mutation, which will clear them.
Lookups will work fine because the lookup routine will reject zombies. But it
does mean that the HashMap will have to deal with dangling StringImpl*'s; all it
takes to make this work is to ensure that the HashMap itself never dereferences
them. Using a pointer hash rather than StringImpl::existingHash() accomplishes
this.

This also ensures that we don't accidentally call ref() or deref() from the
compilation thread, if the compilation thread inspects the transition table.

And no, we wouldn't have been able to use the HashMap<RefPtr<...>, ...>
specialization, because the transition table is actually
HashMap<pair<RefPtr<StringImpl>, unsigned>, ...>: hence that specialization
doesn't kick in. We could have written a new specialization or something, but
that seemed like a lot of work given that we don't need the table to be ref'ing
the strings anyways.

  • runtime/Structure.cpp:

(JSC::StructureTransitionTable::add):

  • runtime/StructureTransitionTable.h:

(StructureTransitionTable):
(Hash):
(JSC::StructureTransitionTable::Hash::hash):

8:59 PM Changeset in webkit [153140] by oliver@apple.com
  • 5 edits in trunk/Source/JavaScriptCore

fourthTier: Structure::addPropertyTransitionToExistingStructure should be thread-safe
https://bugs.webkit.org/show_bug.cgi?id=115468

Reviewed by Geoffrey Garen.

This makes the main thread modify the transition table while holding a lock. Note
that the GC might modify its weak pointers without locking, but the GC will lock out
the compilation thread anyway. The map will then only reshape in response to add()
and set(), which happen while holding a lock.

This allows the compilation thread to now query transition tables safely, provided it
holds a lock when doing so.

Also changed LLVM asm printer initialization to just initialize the X86 one. It makes
sense for us to just initialize the asm printer(s) that we actually use; you could
imagine us being linked to a system LLVM that has cross-compilation support; there is
no point in the WebKit or JSC process doing work to initialize all of those targets.
That part was rubber stamped by Mark Hahnenberg.

  • bytecode/PutByIdStatus.cpp:

(JSC::PutByIdStatus::computeFor):

  • runtime/InitializeThreading.cpp:

(JSC::initializeThreadingOnce):

  • runtime/Structure.cpp:

(JSC::Structure::addPropertyTransitionToExistingStructureImpl):
(JSC::Structure::addPropertyTransitionToExistingStructure):
(JSC):
(JSC::Structure::addPropertyTransitionToExistingStructureConcurrently):
(JSC::Structure::addPropertyTransition):
(JSC::Structure::nonPropertyTransition):

  • runtime/Structure.h:

(Structure):

8:59 PM Changeset in webkit [153139] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: Structure::getConcurrently() may be called from for uncacheable dictionaries, and this is safe
https://bugs.webkit.org/show_bug.cgi?id=115464

Reviewed by Oliver Hunt and Geoffrey Garen.

This can happen for example transitively from JSObject::put(). getCurrently() does
work for uncacheable dictionaries; it just has the obvious race that right after it
returns, the result it returned may no longer be right. This isn't an issue if it was
called on the main thread, and may not be an issue in some other situations.

So, we should just remove the assertion, since the only thing it buys us is crashes.

  • runtime/Structure.cpp:

(JSC::Structure::getConcurrently):

8:59 PM Changeset in webkit [153138] by oliver@apple.com
  • 2 edits in trunk/Tools

fourthTier: Use hw.availcpu instead of hw.ncpu, and configure LLVM with --enable-zlib=no

Rubber stamped by Mark Rowe.

  • Scripts/copy-webkitlibraries-to-product-directory:
8:59 PM Changeset in webkit [153137] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: Don't link gtest into JavaScriptCore

Rubber stamped by Mark Rowe.

  • Configurations/JavaScriptCore.xcconfig:
8:59 PM Changeset in webkit [153136] by oliver@apple.com
  • 3 edits in trunk/WebKitLibraries

fourthTier: Updated LLVM drops to include MCJIT fixes and newly exposed API.

Rubber stamped by Mark Hahnenberg.

  • LLVMIncludesMountainLion.tar.bz2:
  • LLVMLibrariesMountainLion.tar.bz2:
8:59 PM Changeset in webkit [153135] by oliver@apple.com
  • 12 edits
    1 add in trunk/Source

fourthTier: String::utf8() should also be available as StringImpl::utf8() so that you don't have to ref() a StringImpl just to get its utf8()
https://bugs.webkit.org/show_bug.cgi?id=115393

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::encode):

Source/WebCore:

No new tests because no new behavior.

  • Modules/websockets/WebSocket.cpp:

(WebCore::WebSocket::close):

  • Modules/websockets/WebSocketChannel.cpp:

(WebCore::WebSocketChannel::send):

  • html/MediaFragmentURIParser.cpp:

(WebCore::MediaFragmentURIParser::parseFragments):

Source/WTF:

  • WTF.xcodeproj/project.pbxproj:
  • wtf/text/ConversionMode.h: Added.

(WTF):

  • wtf/text/StringImpl.cpp:

(WTF):
(WTF::putUTF8Triple):
(WTF::StringImpl::utf8):

  • wtf/text/StringImpl.h:

(StringImpl):

  • wtf/text/WTFString.cpp:

(WTF):
(WTF::String::utf8):

  • wtf/text/WTFString.h:

(String):

8:59 PM Changeset in webkit [153134] by oliver@apple.com
  • 16 edits
    4 copies in trunk/Source

fourthTier: ASSERT that commonly used not-thread-safe methods in the runtime are not being called during compilation
https://bugs.webkit.org/show_bug.cgi?id=115297

Source/JavaScriptCore:

Reviewed by Geoffrey Garen.

Put in assertions that we're not doing bad things in compilation threads. Also
factored compilation into compile+link so that even though we don't yet have
concurrent compilation, we can be explicit about which parts of DFG work are
meant to be concurrent, and which aren't.

Also fix a handful of bugs found by these assertions.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • bytecode/ResolveGlobalStatus.cpp:

(JSC::computeForStructure):

  • bytecode/Watchpoint.cpp:

(JSC::WatchpointSet::add):
(JSC::InlineWatchpointSet::inflateSlow):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::~JITCompiler):
(DFG):
(JSC::DFG::JITCompiler::compileBody):
(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::compileFunction):
(JSC::DFG::JITCompiler::linkFunction):

  • dfg/DFGJITCompiler.h:

(JITCompiler):

  • ftl/FTLCompile.cpp:

(JSC::FTL::compile):

  • ftl/FTLCompile.h:

(FTL):

  • ftl/FTLLink.cpp: Added.

(FTL):
(JSC::FTL::compileEntry):
(JSC::FTL::link):

  • ftl/FTLLink.h: Added.

(FTL):

  • ftl/FTLState.cpp:

(JSC::FTL::State::State):

  • ftl/FTLState.h:

(FTL):
(State):

  • runtime/Structure.cpp:

(JSC::Structure::get):
(JSC::Structure::prototypeChainMayInterceptStoreTo):

  • runtime/Structure.h:

(JSC::Structure::materializePropertyMapIfNecessary):

  • runtime/StructureInlines.h:

(JSC::Structure::get):

Source/WTF:

Reviewed by Geoffrey Garen.

Taught WTF the notion of compilation threads. This allows all parts of our stack
to assert that we're not being called from a JSC compilation thread. This is in
WTF because it will probably end up being used in StringImpl and WTFString.

  • WTF.xcodeproj/project.pbxproj:
  • wtf/CompilationThread.cpp: Added.

(WTF):
(WTF::initializeCompilationThreadsOnce):
(WTF::initializeCompilationThreads):
(WTF::isCompilationThread):
(WTF::exchangeIsCompilationThread):

  • wtf/CompilationThread.h: Added.

(WTF):
(CompilationScope):
(WTF::CompilationScope::CompilationScope):
(WTF::CompilationScope::~CompilationScope):
(WTF::CompilationScope::leaveEarly):

8:59 PM Changeset in webkit [153133] by oliver@apple.com
  • 8 edits in trunk/Source/JavaScriptCore

fourthTier: FTL should support double variables
https://bugs.webkit.org/show_bug.cgi?id=113624

Reviewed by Geoffrey Garen.

Made all of the operations that the FTL already supports, also support doubles.
OSR exit already basically had everything it needed, so no changes there. This
mostly just glues together bits of DFG IR to LLVM IR, in a straight-forward way.

  • ftl/FTLAbbreviations.h:

(FTL):
(JSC::FTL::doubleType):
(JSC::FTL::constReal):
(JSC::FTL::buildPhi):
(JSC::FTL::addIncoming):
(JSC::FTL::buildFAdd):
(JSC::FTL::buildFSub):
(JSC::FTL::buildFMul):
(JSC::FTL::buildFNeg):
(JSC::FTL::buildSIToFP):
(JSC::FTL::buildUIToFP):
(JSC::FTL::buildBitCast):
(JSC::FTL::buildFCmp):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLCommonValues.cpp:

(JSC::FTL::CommonValues::CommonValues):

  • ftl/FTLCommonValues.h:

(CommonValues):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::lower):
(JSC::FTL::LowerDFGToLLVM::compileGetLocal):
(JSC::FTL::LowerDFGToLLVM::compileSetLocal):
(JSC::FTL::LowerDFGToLLVM::compileAdd):
(JSC::FTL::LowerDFGToLLVM::compileArithSub):
(JSC::FTL::LowerDFGToLLVM::compileArithMul):
(JSC::FTL::LowerDFGToLLVM::compileArithNegate):
(JSC::FTL::LowerDFGToLLVM::compileUInt32ToNumber):
(JSC::FTL::LowerDFGToLLVM::compileGetByVal):
(JSC::FTL::LowerDFGToLLVM::compileCompareEq):
(JSC::FTL::LowerDFGToLLVM::compileCompareLess):
(JSC::FTL::LowerDFGToLLVM::lowDouble):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::lowJSValue):
(JSC::FTL::LowerDFGToLLVM::isCellOrMisc):
(JSC::FTL::LowerDFGToLLVM::unboxDouble):
(JSC::FTL::LowerDFGToLLVM::boxDouble):
(JSC::FTL::LowerDFGToLLVM::speculate):
(JSC::FTL::LowerDFGToLLVM::speculateNumber):
(JSC::FTL::LowerDFGToLLVM::speculateRealNumber):
(JSC::FTL::LowerDFGToLLVM::appendOSRExit):
(JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode):

  • ftl/FTLOutput.h:

(JSC::FTL::Output::constDouble):
(Output):
(JSC::FTL::Output::phi):
(JSC::FTL::Output::doubleAdd):
(JSC::FTL::Output::doubleSub):
(JSC::FTL::Output::doubleMul):
(JSC::FTL::Output::doubleNeg):
(JSC::FTL::Output::intToFP):
(JSC::FTL::Output::intToDouble):
(JSC::FTL::Output::unsignedToFP):
(JSC::FTL::Output::unsignedToDouble):
(JSC::FTL::Output::bitCast):
(JSC::FTL::Output::loadDouble):
(JSC::FTL::Output::storeDouble):
(JSC::FTL::Output::doubleEqual):
(JSC::FTL::Output::doubleNotEqualOrUnordered):
(JSC::FTL::Output::doubleLessThan):
(JSC::FTL::Output::doubleLessThanOrEqual):
(JSC::FTL::Output::doubleGreaterThan):
(JSC::FTL::Output::doubleGreaterThanOrEqual):
(JSC::FTL::Output::doubleEqualOrUnordered):
(JSC::FTL::Output::doubleNotEqual):
(JSC::FTL::Output::doubleLessThanOrUnordered):
(JSC::FTL::Output::doubleLessThanOrEqualOrUnordered):
(JSC::FTL::Output::doubleGreaterThanOrUnordered):
(JSC::FTL::Output::doubleGreaterThanOrEqualOrUnordered):
(JSC::FTL::Output::testIsZero64):

8:59 PM Changeset in webkit [153132] by oliver@apple.com
  • 9 edits in trunk/Source/JavaScriptCore

fourthTier: SymbolTable should be thread-safe
https://bugs.webkit.org/show_bug.cgi?id=115301

Reviewed by Geoffrey Garen.

Makes SymbolTable thread-safe. Relies on SymbolTableEntry already being immutable,
other than the WatchpointSet; but the WatchpointSet already has a righteous
concurrency protocol. So, this patch just protects the SymbolTable's HashMap.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::nameForRegister):

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::addVar):

  • runtime/Executable.cpp:

(JSC::ProgramExecutable::addGlobalVar):

  • runtime/JSActivation.cpp:

(JSC::JSActivation::getOwnNonIndexPropertyNames):
(JSC::JSActivation::symbolTablePutWithAttributes):

  • runtime/JSSymbolTableObject.cpp:

(JSC::JSSymbolTableObject::getOwnNonIndexPropertyNames):

  • runtime/JSSymbolTableObject.h:

(JSC::symbolTableGet):
(JSC::symbolTablePut):
(JSC::symbolTablePutWithAttributes):

  • runtime/SymbolTable.cpp:

(JSC::SymbolTable::SymbolTable):
(JSC::SymbolTable::~SymbolTable):

  • runtime/SymbolTable.h:

(JSC::SymbolTable::find):
(JSC::SymbolTable::get):
(JSC::SymbolTable::inlineGet):
(JSC::SymbolTable::begin):
(JSC::SymbolTable::end):
(JSC::SymbolTable::size):
(JSC::SymbolTable::add):
(JSC::SymbolTable::set):
(JSC::SymbolTable::contains):

8:59 PM Changeset in webkit [153131] by oliver@apple.com
  • 5 edits in trunk/Source/JavaScriptCore

fourthTier: WatchpointSet should make racy uses easier to reason about
https://bugs.webkit.org/show_bug.cgi?id=115299

Reviewed by Anders Carlsson.

The compiler often does things like:

1c) Observe something that would imply that a WatchpointSet ought to be invalid

2c) Check that it is invalid

The main thread often does things like:

1m) Fire the watchpoint set

2m) Do some other thing that would cause the compiler to assume that the WatchpointSet
ought to be invalid

An example is structure transitions, where (1c) is the compiler noticing that a
put_by_id inline cache is in a transition state, with the source structure being S;
(2c) is the compiler asserting that S's watchpoint set is invalid; (1m) is the main
thread firing S's watchpoint set before it does the first transition away from S; and
(2m) is the main thread caching the put_by_id transition away from S.

This is totally fine, except that (1c) and (2c), and (1m) and (2m) could be reordered.
Probably, in most cases, this ought to do enough things that the main thread probably
already has some fencing. But the compiler thread definitely doesn't have fencing. In
any case, we should play it safe and just have additional fencing in all of the
relevant places.

We already have some idioms to put load-load and store-store fences in the right
places. But this change just makes WatchpointSet take care of this for us, thus
reducing the chances of us getting this wrong.

  • bytecode/Watchpoint.cpp:

(JSC::WatchpointSet::notifyWriteSlow):

  • bytecode/Watchpoint.h:

(WatchpointSet):
(JSC::WatchpointSet::isStillValid):
(JSC::WatchpointSet::hasBeenInvalidated):
(JSC::InlineWatchpointSet::hasBeenInvalidated):
(JSC::InlineWatchpointSet::notifyWrite):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGDesiredWatchpoints.h:

(JSC::DFG::GenericDesiredWatchpoints::shouldAssumeMixedState):

8:59 PM Changeset in webkit [153130] by oliver@apple.com
  • 16 edits in trunk/Source/JavaScriptCore

fourthTier: CFA should defend against results seeming inconsistent due to a watchpoint firing during compilation
https://bugs.webkit.org/show_bug.cgi?id=115083

Reviewed by Geoffrey Garen.

This ruggedizes our racyness with respect to watchpoints. We want to be able to assert,
in some places, that a watchpoint-based optimization has only occurred if the
watchpoint set was still valid. But currently we *can* soundly do watchpoint-based
optimizations even for invalid watchpoints, so long as we recorded in the IR that we
had done so; this will then lead to the code being insta-jettisoned after compilation
completes. Obviously, we don't want this to happen often - but we do want to allow it
precisely in the case of watchpoint races.

This adds the ability to assert that we hadn't over-watchpointed ourselves, with and
exemption for races.

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::executeEffects):

  • dfg/DFGAbstractValue.cpp:

(JSC::DFG::AbstractValue::setFuturePossibleStructure):
(JSC::DFG::AbstractValue::filterFuturePossibleStructure):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::addStructureTransitionCheck):
(JSC::DFG::ByteCodeParser::parseResolveOperations):
(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::addStructureTransitionCheck):

  • dfg/DFGDesiredWatchpoints.h:

(GenericDesiredWatchpoints):
(JSC::DFG::GenericDesiredWatchpoints::isStillValid):
(JSC::DFG::GenericDesiredWatchpoints::shouldAssumeMixedState):
(JSC::DFG::GenericDesiredWatchpoints::isValidOrMixed):
(JSC::DFG::DesiredWatchpoints::isStillValid):
(JSC::DFG::DesiredWatchpoints::shouldAssumeMixedState):
(JSC::DFG::DesiredWatchpoints::isValidOrMixed):
(DesiredWatchpoints):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::canOptimizeStringObjectAccess):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::masqueradesAsUndefinedWatchpointIsStillValid):
(Graph):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::compileFunction):

  • dfg/DFGJITCompiler.h:

(JSC::DFG::JITCompiler::addLazily):
(JITCompiler):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compilePeepHoleObjectEquality):

  • dfg/DFGSpeculativeJIT.h:

(SpeculativeJIT):
(JSC::DFG::SpeculativeJIT::masqueradesAsUndefinedWatchpointIsStillValid):
(JSC::DFG::SpeculativeJIT::speculationWatchpointForMasqueradesAsUndefined):
(JSC::DFG::SpeculativeJIT::speculateStringObjectForStructure):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull):
(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNull):
(JSC::DFG::SpeculativeJIT::compileObjectEquality):
(JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
(JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
(JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot):
(JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch):
(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull):
(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNull):
(JSC::DFG::SpeculativeJIT::compileObjectEquality):
(JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
(JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
(JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot):
(JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch):
(JSC::DFG::SpeculativeJIT::compile):

  • ftl/FTLCompile.cpp:

(JSC::FTL::compile):

  • ftl/FTLState.h:

(State):

8:58 PM Changeset in webkit [153129] by oliver@apple.com
  • 5 edits
    1 add in trunk/Source/JavaScriptCore

fourthTier: AbstractValue methods that deal with watchpoints should have access to Graph, so that in debug mode, Graph can track the history of watchpoint states and detect races
https://bugs.webkit.org/show_bug.cgi?id=115084

Reviewed by Geoffrey Garen.

The idea is that as part of https://bugs.webkit.org/show_bug.cgi?id=115083, I'll have
Graph record the initial state of a watchpoint at the time that we decide to take
advantage of it; then I will use this to disable any watchpoint-related assertions
in debug mode. Note that this "watchpoint cache" will only be maintained in debug
mode, so there will be no release performance implications. But to do this, I need to
ensure that all of the places that reason about watchpoints have access to Graph.
For example, I'll want AbstractValue::setFuturePossibleStructure to record the state
of the watchpoint in Graph so that subsequent assertions can check if the watchpoint's
state had changed since that decision was made.

(JSC::DFG::AbstractState::initialize):
(JSC::DFG::AbstractState::executeEffects):
(JSC::DFG::AbstractState::mergeStateAtTail):

  • dfg/DFGAbstractState.h:

(JSC::DFG::AbstractState::trySetConstant):

  • dfg/DFGAbstractValue.cpp: Added.

(DFG):
(JSC::DFG::AbstractValue::setMostSpecific):
(JSC::DFG::AbstractValue::set):
(JSC::DFG::AbstractValue::filter):
(JSC::DFG::AbstractValue::setFuturePossibleStructure):
(JSC::DFG::AbstractValue::filterFuturePossibleStructure):
(JSC::DFG::AbstractValue::dump):

  • dfg/DFGAbstractValue.h:

(DFG):
(AbstractValue):
(JSC::DFG::AbstractValue::setType):
(JSC::DFG::AbstractValue::filterByValue):

8:58 PM Changeset in webkit [153128] by oliver@apple.com
  • 7 edits in trunk/Source/JavaScriptCore

fourthTier: Create an equivalent of Structure::get() that can work from a compilation thread
https://bugs.webkit.org/show_bug.cgi?id=114987

Reviewed by Geoffrey Garen.

This completes the work started by r148570. That patch made it possible to do
Structure::get() without modifying Structure. This patch takes this further, and
makes this thread-safe (for non-uncacheable-dictionaries) via
Structure::getConcurrently(). This method not only doesn't modify Structure, but
also ensures that any concurrent attempts to add to, remove from, or steal the
table from that structure doesn't mess up the result of the call. The call may
return invalidOffset even if a property is *just* about to be added, but it will
never do the reverse: if it returns a property then you can be sure that the
structure really does have that property and always will have it.

  • bytecode/GetByIdStatus.cpp:

(JSC::GetByIdStatus::computeFromLLInt):
(JSC::GetByIdStatus::computeForChain):
(JSC::GetByIdStatus::computeFor):

  • bytecode/PutByIdStatus.cpp:

(JSC::PutByIdStatus::computeFromLLInt):
(JSC::PutByIdStatus::computeFor):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::isStringPrototypeMethodSane):

  • runtime/PropertyMapHashTable.h:

(PropertyTable):
(JSC::PropertyTable::findConcurrently):
(JSC):
(JSC::PropertyTable::add):
(JSC::PropertyTable::remove):
(JSC::PropertyTable::reinsert):
(JSC::PropertyTable::rehash):

  • runtime/PropertyTable.cpp:

(JSC::PropertyTable::PropertyTable):

  • runtime/Structure.cpp:

(JSC::Structure::findStructuresAndMapForMaterialization):
(JSC::Structure::getConcurrently):

  • runtime/Structure.h:

(Structure):

  • runtime/StructureInlines.h:

(JSC::Structure::getConcurrently):

8:58 PM Changeset in webkit [153127] by oliver@apple.com
  • 2 edits in trunk/Tools

fourthTier: tandem WebKit and LLVM builds should ./configure LLVM if needed
https://bugs.webkit.org/show_bug.cgi?id=114933

Reviewed by Andy Estes.

This makes it easy to get set up for tandem LLVM builds.

  • Scripts/copy-webkitlibraries-to-product-directory:
8:58 PM Changeset in webkit [153126] by oliver@apple.com
  • 4 edits
    1 add in trunk

fourthTier: WebKit's build system should relink JavaScriptCore if LLVM's libraries changed but its headers didn't
https://bugs.webkit.org/show_bug.cgi?id=114926

Source/JavaScriptCore:

Reviewed by Geoffrey Garen.

Use a phony file that includes a phony header to force JavaScriptCore to be relinked
if necessary. The external LLVM-importing scripts will touch the header if the libraries
are known to have changed.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • ftl/WebKitLLVMLibraryAnchor.cpp: Added.

Tools:

Reviewed by Geoffrey Garen.

If the LLVM libraries change, then touch a phony header, which will force relink
of JavaScriptCore.

  • Scripts/copy-webkitlibraries-to-product-directory:

(unpackIfNecessary):

8:58 PM Changeset in webkit [153125] by oliver@apple.com
  • 3 edits in trunk/Tools

fourthTier: developing LLVM in tandem with WebKit should be fun and easy
https://bugs.webkit.org/show_bug.cgi?id=114925

Reviewed by Geoffrey Garen.

This enables building LLVM along with WebKit, so that build-jsc and build-webkit
will also optionally build LLVM and quickly symlink LLVM's built products into
the right places.

Most WebKit and JSC hackers will want to rely on the checked-in already-built
versions of LLVM in WebKitLibraries. But developing both systems in tandem is an
increasingly common use-case for me, and it may become a common use case for a
handful of others. Currently, this is really painful: you first have to build
LLVM, then you have to export-llvm-build (which takes a while), and then you
have to make sure that your LLVM_LIBRARY_PACKAGE and LLVM_INCLUDE_PACKAGE
variables are set to point to the thing you exported. The whole process loses
track of dependencies very quickly: making a tiny change in LLVM requires
packaging, and then unpackaging, a large number of potentially large headers and
static libraries. Not only is this slow but it then causes the WebKit build
system to rebuild anything that transitively includes any LLVM header, which is
now quite a few files. While this sort of use pattern is still worthwhile if
you're trying to package a binary drop and test it, it's not great if you're
just trying to do experimental development that involves making small changes
in both trees.

This change fixes this use case while keeping the old use cases intact. You can
do tandem development using one of two modes:

Your own LLVM directory: just set LLVM_SOURCE_PATH to the *absolute* path of
the LLVM directory you're using. Once this is done, any invocation of a WebKit
build via build-jsc or build-webkit will also build LLVM, and then quickly
symlink things into place without perturbing dependency tracking.

Internal LLVM directory: if you check out llvm into a directory called 'llvm'
right off of the WebKit source tree, then the build system will automatically
use this.

Here's how this takes care of dependencies:

Headers: the include/llvm and include/llvm-c directories are symlinked into
$productsDir/usr/local/include. And then everything just works.

Libraries: the build system detects, by reading LLVM's Makefile.config, which
mode LLVM is built in (like Release+Asserts or Debug+Asserts) and symlinks
the .a files into $productsDir/<thingy>. It will ranlib those libraries only
if they have changed, by checking both the modification time and also whether
the last time we had a symlink, that symlink was from the same directory.
This helps if you switch to an *older* LLVM build (using LLVM_SOURCE_PATH)
but that build wasn't yet ranlib'd.

One problem that this does not yet solve is that xcodebuild will not relink
JavaScriptCore if the only thing that changed was the libraries. I will work
on this problem separately: https://bugs.webkit.org/show_bug.cgi?id=114926.

  • Scripts/copy-webkitlibraries-to-product-directory:

(unpackIfNecessary):
(fileContains):
(fileContentsEquals):

8:58 PM Changeset in webkit [153124] by oliver@apple.com
  • 16 edits
    1 copy
    1 add in trunk/Source

fourthTier: It should be possible to query WatchpointSets, and add Watchpoints, even if the compiler is running in another thread
https://bugs.webkit.org/show_bug.cgi?id=114909

Source/JavaScriptCore:

Reviewed by Oliver Hunt.

The idea here is that a concurrent compiler will use watchpoint sets as follows:

During concurrent compilation: It will create Watchpoints, and query WatchpointSets only
for the purpose of profiling. That is, it will use decide whether it is profitable to
compile the code "as if" the watchpoint sets are valid.

During synchronous linking: By "linking" I don't necessarily mean the LinkBuffer stuff,
but just the very bitter end of compilation where we make the JIT code callable. This
can happen after LinkBuffer stuff. Anyway, this will have to happen synchronously, and
at that point we can (a) check that all WatchpointSets that we assumed were valid are
still valid and (b) if they are then we add the watchpoints to those sets. If any of the
sets are invalid, we give up on this compilation and try again later.

The querying of WatchpointSets is engineered to say that the set is still valid if it
is so *right now*, but this is done in a racy way and so it may say so spuriously: we
may, with hopefully low probability, have a set that says it is valid even though it was
just invalidated. The goal is only to ensure that (i) a set never claims to be invalid
if it is actually valid, (ii) a set doesn't claim to be valid if it was invalidated
before compilation even began, and (iii) querying the validity of a set doesn't cause us
to crash.

(JSC::InlineWatchpointSet::inflateSlow):

  • bytecode/Watchpoint.h:

(WatchpointSet):
(InlineWatchpointSet):
(JSC::InlineWatchpointSet::hasBeenInvalidated):
(JSC::InlineWatchpointSet::isThin):
(JSC::InlineWatchpointSet::isFat):
(JSC::InlineWatchpointSet::fat):

  • dfg/DFGDesiredWatchpoints.cpp: Added.

(DFG):
(JSC::DFG::DesiredWatchpoints::DesiredWatchpoints):
(JSC::DFG::DesiredWatchpoints::~DesiredWatchpoints):
(JSC::DFG::DesiredWatchpoints::addLazily):
(JSC::DFG::DesiredWatchpoints::reallyAdd):
(JSC::DFG::DesiredWatchpoints::areStillValid):

  • dfg/DFGDesiredWatchpoints.h: Added.

(DFG):
(JSC::DFG::WatchpointForGenericWatchpointSet::WatchpointForGenericWatchpointSet):
(WatchpointForGenericWatchpointSet):
(GenericDesiredWatchpoints):
(JSC::DFG::GenericDesiredWatchpoints::GenericDesiredWatchpoints):
(JSC::DFG::GenericDesiredWatchpoints::addLazily):
(JSC::DFG::GenericDesiredWatchpoints::reallyAdd):
(JSC::DFG::GenericDesiredWatchpoints::areStillValid):
(DesiredWatchpoints):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::compileFunction):

  • dfg/DFGJITCompiler.h:

(JSC::DFG::JITCompiler::addLazily):
(JITCompiler):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compilePeepHoleObjectEquality):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull):
(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNull):
(JSC::DFG::SpeculativeJIT::compileObjectEquality):
(JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
(JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
(JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot):
(JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch):
(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull):
(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNull):
(JSC::DFG::SpeculativeJIT::compileObjectEquality):
(JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
(JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
(JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot):
(JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch):
(JSC::DFG::SpeculativeJIT::compile):

  • ftl/FTLCompile.cpp:

(JSC::FTL::compile):

  • ftl/FTLCompile.h:

(FTL):

  • ftl/FTLState.h:

(State):

  • runtime/JSFunction.h:

(JSFunction):
(JSC::JSFunction::allocationProfileWatchpointSet):

  • runtime/Structure.h:

(Structure):
(JSC::Structure::transitionWatchpointSet):

Source/WTF:

Reviewed by Oliver Hunt.

Harden our notions of memory fences, now that we're doing racy algorithms.

  • wtf/Atomics.h:

(WTF):
(WTF::compilerFence):
(WTF::armV7_dmb):
(WTF::armV7_dmb_st):
(WTF::loadLoadFence):
(WTF::loadStoreFence):
(WTF::storeLoadFence):
(WTF::storeStoreFence):
(WTF::memoryBarrierAfterLock):
(WTF::memoryBarrierBeforeUnlock):
(WTF::x86_mfence):

Conflicts:

Source/WTF/wtf/Atomics.h

8:58 PM Changeset in webkit [153123] by oliver@apple.com
  • 31 edits
    2 copies in trunk/Source

fourthTier: value profiles and array profiles should be thread-safe enough to be accessible in a concurrent compilation thread
https://bugs.webkit.org/show_bug.cgi?id=114906

Source/JavaScriptCore:

Reviewed by Oliver Hunt.

This introduces thread safety to value profiles, array profiles, and
array allocation profiles.

We already have three separate operations that happen on profiles:
(1) writing, which the JIT, LLInt, and OSR exit do; (2) updating,
which happens during GC, from OSR entry slow-paths, and in the DFG;
and (3) reading, which happens in the DFG. For example, the JIT/LLInt
and OSR exit write to ValueProfile::m_buckets, which gets synthesized
into ValueProfile::m_prediction (and other fields) during update, and
the latter gets read by the DFG. Note that (2) must also happen in
the DFG since only the DFG knows which code blocks it will inline,
and those blocks' profiles may not have otherwise been updated via
any other mechanism.

I refer to these three operations as writing, updating, and reading.

Consequently, both profile updating and profile reading may happen
asynchronously, if the JIT is asynchronous.

The locking protocol for profiles works as follows:

  • Writing does not require locking, but is only allowed on the main thread. We require that these fields can be stored atomically by the profiling code, even without locks. For value profiles, this only works on 64-bit platforms, currently. For array profiles, which consist of multiple separate fields, this means that an asynchronous update of the profile may see slight inconsistencies (like a structure that doesn't quite match the array modes bits), but these should be harmless: at worst, the DFG will specialize too much and we'll have OSR exits.
  • Updating a value profile requires holding a lock, but must assume that the fields written by the profiling code in JIT/LLInt may be written to without locking.
  • Reading a value profile requires holding a lock.

The one major exception to these rules is the ArrayAllocationProfile,
which requires no locking. We do this because it's used so often and
in places where we don't necessarily have access to the owning
CodeBlock, so if we did want it to be locked it would have to have
its own lock. Also, I believe that it is sound to just make this
profile racy and not worry about locking at all. All that was needed
were some changes to ensure that we explicitly read some raced-over
fields only once.

Two additional interesting things in this change:

  • To make it easy to see which profile methods require locking, they take a const CodeBlockLocker& as an argument. I saw this idiom for identifying which methods require which locks to be held being used in LLVM, and I quite like it.
  • Lazy operand value profiles, which are created lazily and at any time, require the CodeBlockLock to be held when they are being created. Writes to them are lockless and main-thread-only, but as with other profiles, updates and reads require locking.
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • bytecode/ArrayAllocationProfile.cpp:

(JSC::ArrayAllocationProfile::updateIndexingType):

  • bytecode/ArrayAllocationProfile.h:

(JSC::ArrayAllocationProfile::selectIndexingType):

  • bytecode/ArrayProfile.cpp:

(JSC::ArrayProfile::computeUpdatedPrediction):
(JSC::ArrayProfile::briefDescription):

  • bytecode/ArrayProfile.h:

(ArrayProfile):
(JSC::ArrayProfile::expectedStructure):
(JSC::ArrayProfile::structureIsPolymorphic):
(JSC::ArrayProfile::hasDefiniteStructure):
(JSC::ArrayProfile::observedArrayModes):
(JSC::ArrayProfile::mayInterceptIndexedAccesses):
(JSC::ArrayProfile::mayStoreToHole):
(JSC::ArrayProfile::outOfBounds):
(JSC::ArrayProfile::usesOriginalArrayStructures):

  • bytecode/CallLinkStatus.cpp:

(JSC::CallLinkStatus::computeFor):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpValueProfiling):
(JSC::CodeBlock::dumpArrayProfiling):
(JSC::CodeBlock::updateAllPredictionsAndCountLiveness):
(JSC::CodeBlock::updateAllArrayPredictions):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::valueProfilePredictionForBytecodeOffset):
(JSC::CodeBlock::updateAllPredictionsAndCheckIfShouldOptimizeNow):
(CodeBlock):

  • bytecode/CodeBlockLock.h: Added.

(JSC):

  • bytecode/GetByIdStatus.cpp:

(JSC::GetByIdStatus::computeFor):

  • bytecode/LazyOperandValueProfile.cpp:

(JSC::CompressedLazyOperandValueProfileHolder::computeUpdatedPredictions):
(JSC::CompressedLazyOperandValueProfileHolder::add):
(JSC::LazyOperandValueProfileParser::LazyOperandValueProfileParser):
(JSC::LazyOperandValueProfileParser::~LazyOperandValueProfileParser):
(JSC):
(JSC::LazyOperandValueProfileParser::initialize):
(JSC::LazyOperandValueProfileParser::prediction):

  • bytecode/LazyOperandValueProfile.h:

(CompressedLazyOperandValueProfileHolder):
(LazyOperandValueProfileParser):

  • bytecode/MethodOfGettingAValueProfile.cpp:

(JSC::MethodOfGettingAValueProfile::getSpecFailBucket):

  • bytecode/PutByIdStatus.cpp:

(JSC::PutByIdStatus::computeFor):

  • bytecode/ResolveGlobalStatus.cpp:

(JSC::ResolveGlobalStatus::computeFor):

  • bytecode/ValueProfile.h:

(JSC::ValueProfileBase::briefDescription):
(ValueProfileBase):
(JSC::ValueProfileBase::computeUpdatedPrediction):

  • dfg/DFGArrayMode.cpp:

(JSC::DFG::ArrayMode::fromObserved):

  • dfg/DFGArrayMode.h:

(ArrayMode):
(JSC::DFG::ArrayMode::withProfile):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::injectLazyOperandSpeculation):
(JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):
(JSC::DFG::ByteCodeParser::getArrayMode):
(JSC::DFG::ByteCodeParser::getArrayModeAndEmitChecks):
(JSC::DFG::ByteCodeParser::parseResolveOperations):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGOSRExitPreparation.cpp:

(JSC::DFG::prepareCodeOriginForOSRExit):

  • dfg/DFGPredictionInjectionPhase.cpp:

(JSC::DFG::PredictionInjectionPhase::run):

  • jit/JITInlines.h:

(JSC::JIT::chooseArrayMode):

  • jit/JITStubs.cpp:

(JSC::tryCachePutByID):
(JSC::tryCacheGetByID):
(JSC::DEFINE_STUB_FUNCTION):
(JSC::lazyLinkFor):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):
(JSC::LLInt::setUpCall):

  • profiler/ProfilerBytecodeSequence.cpp:

(JSC::Profiler::BytecodeSequence::BytecodeSequence):

  • runtime/JSScope.cpp:

(JSC::JSScope::resolveContainingScopeInternal):
(JSC::JSScope::resolvePut):

Source/WTF:

Reviewed by Oliver Hunt.

Add ability to abstract whether or not the CodeBlock requires locking at all,
since some platforms may not support the byte spin-locking and/or may not want
to, if they turn off concurrent JIT.

  • WTF.xcodeproj/project.pbxproj:
  • wtf/ByteSpinLock.h:
  • wtf/NoLock.h: Added.

(WTF):
(NoLock):
(WTF::NoLock::lock):
(WTF::NoLock::unlock):
(WTF::NoLock::isHeld):

  • wtf/Platform.h:
8:58 PM Changeset in webkit [153122] by oliver@apple.com
  • 16 edits
    1 copy in trunk/Source

fourthTier: all inline caches should thread-safe enough to allow a concurrent compilation thread to read them safely
https://bugs.webkit.org/show_bug.cgi?id=114762

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

For most inline caches this is easy: the inline cache has a clean temporal
separation between doing the requested action (which may take an unbounded
amount of time, may recurse, and may do arbitrary things) and recording the
relevant information in the cache. So, we just put locks around the
recording bit. That part is always O(1) and does not recurse. The lock we
use is per-CodeBlock to achieve a good balance between locking granularity
and low space overhead. So a concurrent compilation thread will only block
if an inline cache ping-pongs in the code block being compiled (or inlined)
and never when other inline caches do things.

For resolve operations, it's a bit tricky. The global resolve bit works
like any other IC in that it has the clean temporal separation. But the
operations vector itself doesn't have this separation, since we will be
filling it in tandem with actions that may take a long time. This patch
gets around this by having a m_ready bit in the ResolveOperations and
PutToBaseOperation. This is set while holding the CodeBlock's lock. If the
DFG observes the m_ready bit not set (while holding the lock) then it
conservatively assumes that the resolve hasn't happened yet and just
plants a ForceOSRExit.

  • bytecode/CallLinkStatus.cpp:

(JSC::CallLinkStatus::computeFor):

  • bytecode/CodeBlock.h:

(CodeBlock):

  • bytecode/GetByIdStatus.cpp:

(JSC::GetByIdStatus::computeFor):

  • bytecode/PutByIdStatus.cpp:

(JSC::PutByIdStatus::computeFor):

  • bytecode/ResolveGlobalStatus.cpp:

(JSC::ResolveGlobalStatus::computeFor):

  • bytecode/ResolveOperation.h:

(JSC::ResolveOperations::ResolveOperations):
(ResolveOperations):
(JSC::PutToBaseOperation::PutToBaseOperation):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::parseResolveOperations):
(JSC::DFG::ByteCodeParser::parseBlock):

  • jit/JITStubs.cpp:

(JSC::tryCachePutByID):
(JSC::tryCacheGetByID):
(JSC::DEFINE_STUB_FUNCTION):
(JSC::lazyLinkFor):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):
(JSC::LLInt::setUpCall):

  • runtime/JSScope.cpp:

(JSC::JSScope::resolveContainingScopeInternal):
(JSC::JSScope::resolveContainingScope):
(JSC::JSScope::resolvePut):

Source/WTF:

Reviewed by Mark Hahnenberg.

Implemented a new spinlock that is optimized for compactness, by using just a byte.
This will be useful as we start using fine-grained locking on a bunch of places.

At some point I'll make these byte-sized spinlocks into adaptive mutexes, but for
now I think it's fine to do the evil thing and use spinning particularly since we
only use them for short critical sections.

  • WTF.xcodeproj/project.pbxproj:
  • wtf/Atomics.h:

(WTF):
(WTF::weakCompareAndSwap):

  • wtf/ByteSpinLock.h: Added.

(WTF):
(ByteSpinLock):
(WTF::ByteSpinLock::ByteSpinLock):
(WTF::ByteSpinLock::lock):
(WTF::ByteSpinLock::unlock):
(WTF::ByteSpinLock::isHeld):

  • wtf/ThreadingPrimitives.h:

(WTF::pauseBriefly):
(WTF):

8:58 PM Changeset in webkit [153121] by oliver@apple.com
  • 51 edits
    32 copies
    25 adds in trunk

fourthTier: Landing the initial FTL logic in a single commit to avoid spurious
broken builds.

8:58 PM Changeset in webkit [153120] by oliver@apple.com
  • 6 edits in trunk/Source/JavaScriptCore

fourthTier: DFG should be able to query Structure without modifying it
https://bugs.webkit.org/show_bug.cgi?id=114708

Reviewed by Oliver Hunt.

This is work towards allowing the DFG, and FTL, to run on a separate thread.
The idea is that the most evil thing that the DFG does that has thread-safety
issues is fiddling with Structures by calling Structure::get(). This can lead
to rematerialization of property tables, which is definitely not thread-safe
due to how StringImpl works. So, this patch completely side-steps the problem
by creating a new version of Structure::get, called
Structure::getWithoutMaterializing, which may choose to do an O(n) search if
necessary to avoid materialization. I believe this should be fine - the DFG
does't call into these code path often enough for this to matter, and most of
the time, the Structure that we call this on will already have a property
table because some inline cache would have already called ::get() on that
Structure.

Also cleaned up the materialization logic: we can stop the search as soon as
we find any Structure with a property table rather than searching all the way
for a pinned one.

  • bytecode/GetByIdStatus.cpp:

(JSC::GetByIdStatus::computeFor):

  • bytecode/PutByIdStatus.cpp:

(JSC::PutByIdStatus::computeFromLLInt):
(JSC::PutByIdStatus::computeFor):

  • runtime/Structure.cpp:

(JSC::Structure::findStructuresAndMapForMaterialization):
(JSC::Structure::materializePropertyMap):
(JSC::Structure::getWithoutMaterializing):
(JSC):

  • runtime/Structure.h:

(Structure):

  • runtime/StructureInlines.h:

(JSC::Structure::getWithoutMaterializing):
(JSC):

8:58 PM Changeset in webkit [153119] by oliver@apple.com
  • 9 edits
    1 copy
    1 add in trunk/Source/JavaScriptCore

fourthTier: DFG should provide utilities for common OSR exit tasks
https://bugs.webkit.org/show_bug.cgi?id=114306

Reviewed by Mark Hahnenberg.

Just abstract out some things that the FTL will want to use as well.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • Target.pri:
  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):

  • dfg/DFGOSRExitCompiler.cpp:
  • dfg/DFGOSRExitCompiler.h:

(OSRExitCompiler):

  • dfg/DFGOSRExitCompiler32_64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGOSRExitCompiler64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGOSRExitCompilerCommon.cpp: Added.

(DFG):
(JSC::DFG::handleExitCounts):
(JSC::DFG::reifyInlinedCallFrames):
(JSC::DFG::adjustAndJumpToTarget):

  • dfg/DFGOSRExitCompilerCommon.h: Added.

(DFG):

8:58 PM Changeset in webkit [153118] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: DFG should better abstract floating point arguments
https://bugs.webkit.org/show_bug.cgi?id=114300

Reviewed by Mark Hahnenberg.

  • dfg/DFGFPRInfo.h:

(FPRInfo):
(JSC::DFG::FPRInfo::toArgumentRegister):

8:58 PM Changeset in webkit [153117] by oliver@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

fourthTier: DFG should better abstract arguments
https://bugs.webkit.org/show_bug.cgi?id=114073

Reviewed by Mark Hahnenberg.

  • dfg/DFGGPRInfo.h:

(GPRInfo):
(JSC::DFG::GPRInfo::toArgumentRegister):

8:58 PM Changeset in webkit [153116] by oliver@apple.com
  • 22 edits
    2 copies
    2 adds in trunk/Source/JavaScriptCore

fourthTier: put DFG data into a DFG::JITCode, and put common DFG and FTL data into something accessible from both DFG::JITCode and FTL::JITCode
https://bugs.webkit.org/show_bug.cgi?id=113905

Reviewed by Geoffrey Garen.

This removes one pointer from CodeBlock.

It also gives us a framework for having JITType-specific data in CodeBlock, by
putting it into the appropriate JITCode class (either DFG::JITCode or
FTL::JITCode). And it allows us to have DFG and FTL share some common data,
via DFG::CommonData, which is stored in both DFG::JITCode and FTL::JITCode and
always accessible via JITCode::dfgCommon().

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • Target.pri:
  • bytecode/CodeBlock.cpp:

(JSC):
(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::visitAggregate):
(JSC::CodeBlock::performTracingFixpointIteration):
(JSC::CodeBlock::finalizeUnconditionally):
(JSC::CodeBlock::stronglyVisitWeakReferences):
(JSC::CodeBlock::shrinkToFit):
(JSC::CodeBlock::tallyFrequentExitSites):

  • bytecode/CodeBlock.h:

(CodeBlock):
(JSC::CodeBlock::setJITCode):
(JSC::CodeBlock::shouldImmediatelyAssumeLivenessDuringScan):
(JSC::DFGCodeBlocks::mark):

  • dfg/DFGAssemblyHelpers.h:
  • dfg/DFGCommonData.cpp: Added.

(DFG):
(JSC::DFG::CommonData::notifyCompilingStructureTransition):
(JSC::DFG::CommonData::shrinkToFit):

  • dfg/DFGCommonData.h: Added.

(JSC):
(DFG):
(JSC::DFG::WeakReferenceTransition::WeakReferenceTransition):
(WeakReferenceTransition):
(CommonData):
(JSC::DFG::CommonData::CommonData):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):
(JSC::DFG::tryCompile):
(JSC::DFG::tryCompileFunction):

  • dfg/DFGDriver.h:

(DFG):
(JSC::DFG::tryCompile):
(JSC::DFG::tryCompileFunction):

  • dfg/DFGGraph.h:

(Graph):

  • dfg/DFGJITCode.cpp: Added.

(DFG):
(JSC::DFG::JITCode::JITCode):
(JSC::DFG::JITCode::~JITCode):
(JSC::DFG::JITCode::dfgCommon):
(JSC::DFG::JITCode::dfg):
(JSC::DFG::JITCode::shrinkToFit):

  • dfg/DFGJITCode.h: Added.

(DFG):
(JITCode):
(JSC::DFG::JITCode::appendOSREntryData):
(JSC::DFG::JITCode::osrEntryDataForBytecodeIndex):
(JSC::DFG::JITCode::appendOSRExit):
(JSC::DFG::JITCode::lastOSRExit):
(JSC::DFG::JITCode::appendSpeculationRecovery):
(JSC::DFG::JITCode::appendWatchpoint):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::JITCompiler):
(JSC::DFG::JITCompiler::linkOSRExits):
(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::compileFunction):

  • dfg/DFGJITCompiler.h:

(JITCompiler):
(JSC::DFG::JITCompiler::addWeakReference):
(JSC::DFG::JITCompiler::noticeOSREntry):
(JSC::DFG::JITCompiler::jitCode):

  • dfg/DFGOSREntry.cpp:

(JSC::DFG::prepareOSREntry):

  • dfg/DFGOSRExit.h:

(OSRExit):

  • dfg/DFGOSRExitCompiler.cpp:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::SpeculativeJIT):
(JSC::DFG::SpeculativeJIT::backwardSpeculationCheck):
(JSC::DFG::SpeculativeJIT::speculationWatchpoint):
(JSC::DFG::SpeculativeJIT::convertLastOSRExitToForward):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGVariableEventStream.cpp:
  • ftl/FTLCompile.cpp:

(JSC::FTL::compile):

  • ftl/FTLJITCode.cpp:

(JSC::FTL::JITCode::JITCode):
(JSC::FTL::JITCode::~JITCode):
(FTL):
(JSC::FTL::JITCode::initializeCode):
(JSC::FTL::JITCode::addressForCall):
(JSC::FTL::JITCode::executableAddressAtOffset):
(JSC::FTL::JITCode::dataAddressAtOffset):
(JSC::FTL::JITCode::offsetOf):
(JSC::FTL::JITCode::size):
(JSC::FTL::JITCode::contains):
(JSC::FTL::JITCode::ftl):
(JSC::FTL::JITCode::dfgCommon):

  • ftl/FTLJITCode.h:

(JITCode):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileStructureTransitionWatchpoint):
(JSC::FTL::LowerDFGToLLVM::compilePutStructure):
(JSC::FTL::LowerDFGToLLVM::compilePhantomPutStructure):
(JSC::FTL::LowerDFGToLLVM::addWeakReference):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::weakPointer):

  • ftl/FTLState.cpp:

(FTL):
(JSC::FTL::State::State):
(JSC::FTL::State::dumpState):

  • ftl/FTLState.h:

(State):

  • heap/DFGCodeBlocks.cpp:

(JSC::DFGCodeBlocks::~DFGCodeBlocks):
(JSC::DFGCodeBlocks::jettison):
(JSC::DFGCodeBlocks::clearMarks):
(JSC::DFGCodeBlocks::deleteUnmarkedJettisonedCodeBlocks):
(JSC::DFGCodeBlocks::traceMarkedCodeBlocks):

  • jit/JITCode.cpp:

(JSC::JITCode::dfgCommon):
(JSC):
(JSC::JITCode::dfg):
(JSC::JITCode::ftl):
(JSC::DirectJITCode::DirectJITCode):
(JSC::DirectJITCode::initializeCodeRef):
(JSC::DirectJITCode::addressForCall):
(JSC::DirectJITCode::executableAddressAtOffset):
(JSC::DirectJITCode::dataAddressAtOffset):
(JSC::DirectJITCode::offsetOf):
(JSC::DirectJITCode::size):
(JSC::DirectJITCode::contains):

  • jit/JITCode.h:

(DFG):
(FTL):
(JSC):
(JITCode):
(DirectJITCode):

8:58 PM Changeset in webkit [153115] by oliver@apple.com
  • 10 edits in trunk/Source/JavaScriptCore

fourthTier: Everyone should know about the FTL
https://bugs.webkit.org/show_bug.cgi?id=113897

Reviewed by Mark Hahnenberg.

In order to get OSR exit to work right, we need the distinction between DFG and
FTL to be clear even after compilation finishes, since they will have subtly
different OSR stories and likely use different data structures.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::resetStubInternal):
(JSC::ProgramCodeBlock::compileOptimized):
(JSC::EvalCodeBlock::compileOptimized):
(JSC::FunctionCodeBlock::compileOptimized):
(JSC::CodeBlock::adjustedExitCountThreshold):
(JSC::CodeBlock::tallyFrequentExitSites):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::setJITCode):
(JSC::CodeBlock::hasOptimizedReplacement):
(JSC::ExecState::isInlineCallFrame):

  • ftl/FTLCompile.cpp:

(JSC::FTL::compile):

  • ftl/FTLJITCode.cpp:

(JSC::FTL::JITCode::JITCode):

  • ftl/FTLState.cpp:

(JSC::FTL::State::dumpState):

  • heap/DFGCodeBlocks.cpp:

(JSC::DFGCodeBlocks::jettison):

  • interpreter/Interpreter.cpp:

(JSC::getLineNumberForCallFrame):
(JSC::getCallerInfo):

  • jit/JITCode.cpp:

(WTF::printInternal):

  • jit/JITCode.h:

(JSC::JITCode::topTierJIT):
(JSC::JITCode::nextTierJIT):
(JITCode):
(JSC::JITCode::isJIT):
(JSC::JITCode::isLowerTier):
(JSC::JITCode::isHigherTier):
(JSC::JITCode::isLowerOrSameTier):
(JSC::JITCode::isHigherOrSameTier):
(JSC::JITCode::isOptimizingJIT):

  • jit/JITDriver.h:

(JSC::jitCompileIfAppropriate):
(JSC::jitCompileFunctionIfAppropriate):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/Executable.cpp:

(JSC::EvalExecutable::compileOptimized):
(JSC::samplingDescription):
(JSC::ProgramExecutable::compileOptimized):
(JSC::FunctionExecutable::compileOptimizedForCall):
(JSC::FunctionExecutable::compileOptimizedForConstruct):

8:58 PM Changeset in webkit [153114] by oliver@apple.com
  • 4 edits in trunk/Source/JavaScriptCore

fourthTier: DFG should abstract out how it does forward exits, and that code should be simplified
https://bugs.webkit.org/show_bug.cgi?id=113894

Reviewed by Mark Hahnenberg.

1) We previously had two different ways of convertingToForward, one path for

where we had a ValueRecovery for the current node and one where we didn't.
But the paths were doing exactly the same thing except that if you have a
ValueRecovery, you also find the last applicable mov hint and do some
extra things. This patch combines the two paths and bases both of them on
the previous no-ValueRecovery path, which was simpler to begin with.

2) This moves the logic into DFG::OSRExit, which further simplifies the code

and makes the logic available to the FTL.

  • dfg/DFGOSRExit.cpp:

(JSC::DFG::OSRExit::convertToForward):
(DFG):

  • dfg/DFGOSRExit.h:

(DFG):
(OSRExit):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::convertLastOSRExitToForward):

8:58 PM Changeset in webkit [153113] by oliver@apple.com
  • 28 edits in trunk/Source/JavaScriptCore

fourthTier: JITCode should abstract exactly how the JIT code is structured and where it was allocated
https://bugs.webkit.org/show_bug.cgi?id=113437

Reviewed by Mark Hahnenberg.

JITCode is now a virtual base class, which will allow different JITs to have radically
different memory allocation and management conventions in the future. It will also
make it easier to store JIT-specific meta-data in CodeBlock just by putting it into
an appropriate JITCode subclass.

For now there is one subclass, DirectJITCode, which just behaves like JITCode used to
behave.

  • assembler/RepatchBuffer.h:

(JSC::RepatchBuffer::RepatchBuffer):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::resetStubInternal):
(JSC::CodeBlock::bytecodeOffset):
(JSC::CodeBlock::codeOriginForReturn):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::setJITCode):
(JSC::CodeBlock::getJITCode):
(JSC::CodeBlock::getJITType):
(CodeBlock):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):
(JSC::DFG::tryCompile):
(JSC::DFG::tryCompileFunction):

  • dfg/DFGDriver.h:

(DFG):
(JSC::DFG::tryCompile):
(JSC::DFG::tryCompileFunction):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::compileFunction):

  • dfg/DFGJITCompiler.h:

(JITCompiler):

  • dfg/DFGOSREntry.cpp:

(JSC::DFG::prepareOSREntry):

  • dfg/DFGOSRExit.cpp:

(JSC::DFG::OSRExit::codeLocationForRepatch):

  • dfg/DFGOSRExitCompiler32_64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGOSRExitCompiler64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGOperations.cpp:
  • interpreter/Interpreter.cpp:

(JSC::Interpreter::execute):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):

  • jit/JIT.cpp:

(JSC::JIT::privateCompile):

  • jit/JIT.h:

(JSC::JIT::compile):
(JIT):

  • jit/JITCode.cpp:

(JSC):
(JSC::JITCode::JITCode):
(JSC::JITCode::~JITCode):
(JSC::JITCode::execute):
(JSC::JITCode::hostFunction):
(JSC::DirectJITCode::DirectJITCode):
(JSC::DirectJITCode::~DirectJITCode):
(JSC::DirectJITCode::addressForCall):
(JSC::DirectJITCode::executableAddressAtOffset):
(JSC::DirectJITCode::dataAddressAtOffset):
(JSC::DirectJITCode::offsetOf):
(JSC::DirectJITCode::size):
(JSC::DirectJITCode::contains):

  • jit/JITCode.h:

(JSC):
(JITCode):
(JSC::JITCode::bottomTierJIT):
(JSC::JITCode::topTierJIT):
(JSC::JITCode::nextTierJIT):
(JSC::JITCode::isOptimizingJIT):
(JSC::JITCode::isBaselineCode):
(JSC::JITCode::jitType):
(JSC::JITCode::jitTypeFor):
(JSC::JITCode::executableAddress):
(JSC::JITCode::start):
(JSC::JITCode::end):
(DirectJITCode):

  • jit/JITDriver.h:

(JSC::jitCompileIfAppropriate):
(JSC::jitCompileFunctionIfAppropriate):

  • jit/JITStubs.cpp:

(JSC::lazyLinkFor):
(JSC::DEFINE_STUB_FUNCTION):

  • jit/ThunkGenerators.cpp:

(JSC::virtualForGenerator):

  • llint/LLIntEntrypoints.cpp:

(JSC::LLInt::getFunctionEntrypoint):
(JSC::LLInt::getEvalEntrypoint):
(JSC::LLInt::getProgramEntrypoint):

  • llint/LLIntEntrypoints.h:

(JSC):
(LLInt):
(JSC::LLInt::getEntrypoint):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::jitCompileAndSetHeuristics):
(JSC::LLInt::entryOSR):
(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • runtime/Executable.cpp:

(JSC::EvalExecutable::compileInternal):
(JSC::ProgramExecutable::compileInternal):
(JSC::FunctionExecutable::compileForCallInternal):
(JSC::FunctionExecutable::compileForConstructInternal):

  • runtime/Executable.h:

(JSC::ExecutableBase::generatedJITCodeForCall):
(JSC::ExecutableBase::generatedJITCodeForConstruct):
(JSC::ExecutableBase::generatedJITCodeFor):
(ExecutableBase):
(JSC::ExecutableBase::hostCodeEntryFor):
(JSC::ExecutableBase::jsCodeEntryFor):
(JSC::ExecutableBase::jsCodeWithArityCheckEntryFor):
(JSC::NativeExecutable::create):
(JSC::NativeExecutable::finishCreation):
(JSC::EvalExecutable::generatedJITCode):
(JSC::ProgramExecutable::generatedJITCode):

  • runtime/ExecutionHarness.h:

(JSC::prepareForExecution):
(JSC::prepareFunctionForExecution):

8:16 PM Changeset in webkit [153112] by Simon Fraser
  • 2 edits in trunk/Source/WebCore

[iOS] Captions are clipped in documents using pagination
https://bugs.webkit.org/show_bug.cgi?id=119072

Reviewed by Beth Dakin.

MediaControlTextTrackContainerElement::createTextTrackRepresentationImage() is called
to paint captions into a layer used for fullscreen video. It did the painting using
a subtree paint, but starting at the root RenderView's layer. This is problematic,
because the caption painting is subject to clipping for columns, and any enclosing
overflow:hidden container.

Fix this by starting the paint at the MediaControlTextTrackContainerElement's
renderer's layer. By doing this we don't have to worry about an offset, so no
translation is required.

Also make sure we update layer before grabbing the renderer (in case layout
destroys it).

  • html/shadow/MediaControlElements.cpp:

(WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):

7:32 PM Changeset in webkit [153111] by dbates@webkit.org
  • 1 edit
    2 adds in trunk/LayoutTests

Add DRT test to ensure don't override z-index for overflow: scroll, -webkit-overflow-scrolling: touch
https://bugs.webkit.org/show_bug.cgi?id=119071

Reviewed by Simon Fraser.

Add a DRT test to ensure we don't regress the fix for <https://bugs.webkit.org/show_bug.cgi?id=119066>.

  • compositing/overflow/should-not-override-z-index-for-element-with-non-auto-z-index-and-overflow-scroll-and-touch-expected.txt: Added.
  • compositing/overflow/should-not-override-z-index-for-element-with-non-auto-z-index-and-overflow-scroll-and-touch.html: Added.
7:02 PM Changeset in webkit [153110] by Lucas Forschler
  • 5 edits in branches/safari-537-branch/Source

Versioning.

7:00 PM Changeset in webkit [153109] by Lucas Forschler
  • 1 copy in tags/Safari-537.52

New Tag.

6:08 PM Changeset in webkit [153108] by ruth_fong@apple.com
  • 18 edits
    4 moves in trunk/Source/WebKit2

Rename WebColorChooserProxy
<rdar://problem/14528039> and https://bugs.webkit.org/show_bug.cgi?id=119025

Reviewed by Brady Eidson.

Renamed WebColorChooserProxy to WebColorPicker since the name WebColorChoooserProxy
implies that it represents the same object as WebColorChooser, which is not true.
Also, renamed createColorChooserProxy to createColorPicker in WebPageProxy and
platform-equivalent versions of it.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • Target.pri:
  • UIProcess/API/gtk/PageClientImpl.cpp:

(WebKit::PageClientImpl::createColorPicker):

  • UIProcess/API/gtk/PageClientImpl.h:
  • UIProcess/API/mac/PageClientImpl.h:
  • UIProcess/API/mac/PageClientImpl.mm:

(WebKit::PageClientImpl::createColorPicker):

  • UIProcess/API/qt/raw/qrawwebview.cpp:

(QRawWebViewPrivate::createColorPicker):

  • UIProcess/API/qt/raw/qrawwebview_p_p.h:
  • UIProcess/CoordinatedGraphics/WebView.cpp:

(WebKit::WebView::createColorPicker):

  • UIProcess/CoordinatedGraphics/WebView.h:
  • UIProcess/PageClient.h:
  • UIProcess/WebColorChooserProxy.cpp: Removed.
  • UIProcess/WebColorChooserProxy.h: Removed.
  • UIProcess/WebColorPicker.cpp: Copied from Source/WebKit2/UIProcess/WebColorChooserProxy.cpp.

(WebKit::WebColorPicker::WebColorPicker):
(WebKit::WebColorPicker::~WebColorPicker):
(WebKit::WebColorPicker::endChooser):
(WebKit::WebColorPicker::setSelectedColor):

  • UIProcess/WebColorPicker.h: Copied from Source/WebKit2/UIProcess/WebColorChooserProxy.h.

(WebKit::WebColorPicker::create):

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::close):
(WebKit::WebPageProxy::showColorChooser):
(WebKit::WebPageProxy::setColorChooserColor):
(WebKit::WebPageProxy::endColorChooser):
(WebKit::WebPageProxy::didEndColorChooser):
(WebKit::WebPageProxy::resetStateAfterProcessExited):

  • UIProcess/WebPageProxy.h: Renamed m_colorChooser to m_colorPicker.
  • UIProcess/qt/QtPageClient.cpp:

(WebKit::QtPageClient::createColorPicker):

  • UIProcess/qt/QtPageClient.h:
  • UIProcess/qt/WebColorChooserProxyQt.cpp: Removed.
  • UIProcess/qt/WebColorChooserProxyQt.h: Removed.
  • UIProcess/qt/WebColorPickerQt.cpp: Added.

(WebKit::ColorChooserContextObject::ColorChooserContextObject):
(WebKit::ColorChooserContextObject::currentColor):
(WebKit::ColorChooserContextObject::elementRect):
(WebKit::ColorChooserContextObject::accept):
(WebKit::ColorChooserContextObject::reject):
(WebKit::WebColorPickerQt::WebColorPickerQt):
(WebKit::WebColorPickerQt::~WebColorPickerQt):
(WebKit::WebColorPickerQt::createItem):
(WebKit::WebColorPickerQt::createContext):
(WebKit::WebColorPickerQt::setSelectedColor):
(WebKit::WebColorPickerQt::notifyColorSelected):
(WebKit::WebColorPickerQt::endChooser):

  • UIProcess/qt/WebColorPickerQt.h: Added.

(WebKit::WebColorPickerQt::create):

  • WebKit2.xcodeproj/project.pbxproj:
5:57 PM Changeset in webkit [153107] by andersca@apple.com
  • 5 edits
    1 add in trunk

Crash when calling WKPageGetProcessIdentifier after aborted process launch
https://bugs.webkit.org/show_bug.cgi?id=119069
<rdar://problem/14494064>

Reviewed by Andreas Kling.

Source/WebKit2:

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::processIdentifier):
Check if the page is closed instead of checking whether we have a process - We'll always have a process.

(WebKit::WebPageProxy::isValid):
Make this const.

  • UIProcess/WebPageProxy.h:

Tools:

Add a test.

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKit2/mac/GetPIDAfterAbortedProcessLaunch.cpp: Added.

(TestWebKitAPI::didFinishLoadForFrame):
(TestWebKitAPI::TEST):

3:46 PM Changeset in webkit [153106] by kseo@webkit.org
  • 1 edit
    4 adds in trunk/Source/WebKit2

[WK2][Soup] Add entry point for network process
https://bugs.webkit.org/show_bug.cgi?id=110136

Reviewed by Gustavo Noronha Silva.

Original patch by Balazs Kelemen <kbalazs@webkit.org>.

Added a common entry point for non-Mac Unix ports.

  • NetworkProcess/unix/NetworkProcessMainUnix.cpp: Added.

(WebKit::NetworkProcessMain):

  • NetworkProcess/unix/NetworkProcessMainUnix.h: Added.
  • unix/NetworkMainUnix.cpp: Added.

(main):

3:45 PM Changeset in webkit [153105] by Simon Fraser
  • 2 edits in trunk/Source/WebCore

REGRESSION (r152335): Mac Pro title occluded in MobileSafari; can't scroll page
https://bugs.webkit.org/show_bug.cgi?id=119066
<rdar://problem/14499184>

Reviewed by Daniel Bates.

Following <http://trac.webkit.org/changeset/152335> (bug #118337) we set
the z-index to 0 on every element with CSS "overflow: scroll" and
"-webkit-overflow-scrolling: touch" regardless of whether the element has
non-auto z-index. Instead we should only set the z-index to 0 for such elements
that have an auto z-index.

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::adjustRenderStyle):

2:58 PM Changeset in webkit [153104] by fpizlo@apple.com
  • 5 edits in trunk/Source/JavaScriptCore

It should be possible to hijack IndexingHeader for things other than lengths
https://bugs.webkit.org/show_bug.cgi?id=119065

Reviewed by Mark Hahnenberg.

Made the body of IndexingHeader be a union.

Modified the offlineasm so that you can say IndexingHeader::u.lengths.publicLength.
Previously those dots would cause parse errors. Now an identifier in offlineasm can
have a dot anywhere except the first character.

  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
  • offlineasm/parser.rb:
  • runtime/IndexingHeader.h:

(JSC::IndexingHeader::offsetOfPublicLength):
(JSC::IndexingHeader::offsetOfVectorLength):
(JSC::IndexingHeader::IndexingHeader):
(JSC::IndexingHeader::vectorLength):
(JSC::IndexingHeader::setVectorLength):
(JSC::IndexingHeader::publicLength):
(JSC::IndexingHeader::setPublicLength):

2:47 PM Changeset in webkit [153103] by fpizlo@apple.com
  • 39 edits
    6 adds in branches/dfgFourthTier/Source

fourthTier: DFG IR dumps should be easier to read
https://bugs.webkit.org/show_bug.cgi?id=119050

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

Added a DumpContext that includes support for printing an endnote
that describes all structures in full, while the main flow of the
dump just uses made-up names for the structures. This is helpful
since Structure::dump() may print a lot. The stuff it prints is
useful, but if it's all inline with the surrounding thing you're
dumping (often, a node in the DFG), then you get a ridiculously
long print-out. All classes that dump structures (including
Structure itself) now have dumpInContext() methods that use
inContext() for dumping anything that might transitively print a
structure. If Structure::dumpInContext() is called with a NULL
context, it just uses dump() like before. Hence you don't have to
know anything about DumpContext unless you want to.

inContext(*structure, context) dumps something like %B4:Array,
and the endnote will have something like:

%B4:Array = 0x10e91a180:[Array, {Edge:100, Normal:101, Line:102, NumPx:103, LastPx:104}, ArrayWithContiguous, Proto:0x10e99ffe0]


where B4 is the inferred name that StringHashDumpContext came up
with.

Also shortened a bunch of other dumps, removing information that
isn't so important.

(JSC::dumpArrayModes):

  • bytecode/CodeBlockHash.cpp:

(JSC):
(JSC::CodeBlockHash::CodeBlockHash):
(JSC::CodeBlockHash::dump):

  • bytecode/CodeOrigin.cpp:

(JSC::CodeOrigin::dumpInContext):
(JSC):
(JSC::InlineCallFrame::dumpInContext):
(JSC::InlineCallFrame::dump):

  • bytecode/CodeOrigin.h:

(CodeOrigin):
(InlineCallFrame):

  • bytecode/Operands.h:

(JSC::OperandValueTraits::isEmptyForDump):
(Operands):
(JSC::Operands::dump):
(JSC):

  • bytecode/OperandsInlines.h: Added.

(JSC):
(JSC::::dumpInContext):

  • bytecode/StructureSet.h:

(JSC::StructureSet::dumpInContext):
(JSC::StructureSet::dump):
(StructureSet):

  • dfg/DFGAbstractValue.cpp:

(JSC::DFG::AbstractValue::dump):
(DFG):
(JSC::DFG::AbstractValue::dumpInContext):

  • dfg/DFGAbstractValue.h:

(JSC::DFG::AbstractValue::operator!):
(AbstractValue):

  • dfg/DFGCFAPhase.cpp:

(JSC::DFG::CFAPhase::performBlockCFA):

  • dfg/DFGCommon.cpp:
  • dfg/DFGCommon.h:

(JSC::DFG::NodePointerTraits::isEmptyForDump):

  • dfg/DFGDisassembler.cpp:

(JSC::DFG::Disassembler::createDumpList):

  • dfg/DFGDisassembler.h:

(Disassembler):

  • dfg/DFGFlushFormat.h:

(WTF::inContext):
(WTF):

  • dfg/DFGFlushLivenessAnalysisPhase.cpp:
  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dumpCodeOrigin):
(JSC::DFG::Graph::dump):
(JSC::DFG::Graph::dumpBlockHeader):

  • dfg/DFGGraph.h:

(Graph):

  • dfg/DFGLazyJSValue.cpp:

(JSC::DFG::LazyJSValue::dumpInContext):
(JSC::DFG::LazyJSValue::dump):
(DFG):

  • dfg/DFGLazyJSValue.h:

(LazyJSValue):

  • dfg/DFGNode.h:

(JSC::DFG::nodeMapDump):
(WTF::inContext):
(WTF):

  • dfg/DFGOSRExitCompiler32_64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGOSRExitCompiler64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGStructureAbstractValue.h:

(JSC::DFG::StructureAbstractValue::dumpInContext):
(JSC::DFG::StructureAbstractValue::dump):
(StructureAbstractValue):

  • ftl/FTLExitValue.cpp:

(JSC::FTL::ExitValue::dumpInContext):
(JSC::FTL::ExitValue::dump):
(FTL):

  • ftl/FTLExitValue.h:

(ExitValue):

  • ftl/FTLLowerDFGToLLVM.cpp:
  • ftl/FTLValueSource.cpp:

(JSC::FTL::ValueSource::dumpInContext):
(FTL):

  • ftl/FTLValueSource.h:

(ValueSource):

  • runtime/DumpContext.cpp: Added.

(JSC):
(JSC::DumpContext::DumpContext):
(JSC::DumpContext::~DumpContext):
(JSC::DumpContext::isEmpty):
(JSC::DumpContext::dump):

  • runtime/DumpContext.h: Added.

(JSC):
(DumpContext):

  • runtime/JSCJSValue.cpp:

(JSC::JSValue::dump):
(JSC):
(JSC::JSValue::dumpInContext):

  • runtime/JSCJSValue.h:

(JSC):
(JSValue):

  • runtime/Structure.cpp:

(JSC::Structure::dumpInContext):
(JSC):
(JSC::Structure::dumpBrief):
(JSC::Structure::dumpContextHeader):

  • runtime/Structure.h:

(JSC):
(Structure):

Source/WTF:

Reviewed by Mark Hahnenberg.

Added support for dumping values within a context. By default, if you say
print(inContext(value, context)) it calls value.dumpInContext(out, context)
instead of value.dump(out).

Hoisted the support for six-character hashes out of JSC::CodeBlockHash into
WTF, in the form of SixCharacterHash.h.

Added a helper for creating dump contexts where the inContext() dump will
just use a short string hash to "name" the object being dumped, and then
will print out the full dumps in an endnote to your dump.

Added support for using CString as a hashtable key.

  • WTF.xcodeproj/project.pbxproj:
  • wtf/PrintStream.h:

(WTF):
(ValueInContext):
(WTF::ValueInContext::ValueInContext):
(WTF::ValueInContext::dump):
(WTF::inContext):

  • wtf/SixCharacterHash.cpp: Added.

(WTF):
(WTF::sixCharacterHashStringToInteger):
(WTF::integerToSixCharacterHashString):

  • wtf/SixCharacterHash.h: Added.

(WTF):

  • wtf/StringHashDumpContext.h: Added.

(WTF):
(StringHashDumpContext):
(WTF::StringHashDumpContext::StringHashDumpContext):
(WTF::StringHashDumpContext::getID):
(WTF::StringHashDumpContext::dumpBrief):
(WTF::StringHashDumpContext::brief):
(WTF::StringHashDumpContext::isEmpty):
(WTF::StringHashDumpContext::dump):

  • wtf/text/CString.cpp:

(WTF::CString::hash):
(WTF):
(WTF::operator<):
(WTF::CStringHash::equal):

  • wtf/text/CString.h:

(WTF::CString::CString):
(CString):
(WTF::CString::isHashTableDeletedValue):
(WTF):
(WTF::CStringHash::hash):
(CStringHash):

2:24 PM Changeset in webkit [153102] by rniwa@webkit.org
  • 2 edits in trunk/Source/WebCore

Use-after-free in ApplyStyleCommand::removeInlineStyle
https://bugs.webkit.org/show_bug.cgi?id=118627

Reviewed by Oliver Hunt.

Merge https://chromium.googlesource.com/chromium/blink/+/b6471d077e012b05ccba14d0ce8e6d616106c8e6

Unfortunately, there is no test case for this bug.

  • editing/ApplyStyleCommand.cpp:

(WebCore::ApplyStyleCommand::removeInlineStyle):

2:21 PM Changeset in webkit [153101] by achristensen@apple.com
  • 2 edits
    1 add in trunk/Source/ThirdParty/ANGLE

Generate derived files in ANGLE at build time rather than when updating from upstream.
https://bugs.webkit.org/show_bug.cgi?id=118872

Reviewed by Mark Rowe.

  • ANGLE.xcodeproj/project.pbxproj: Made Derived Sources target which calls DerivedSources.make,

moved generated files into Derived Sources group.

  • DerivedSources.make: Added.
1:28 PM Changeset in webkit [153100] by Lucas Forschler
  • 17 edits in branches/safari-537-branch/Source/WebKit2

Merged r153096. <rdar://problem/14421763>

1:25 PM Changeset in webkit [153099] by Lucas Forschler
  • 11 edits in branches/safari-537-branch/Source

Merged r153092. <rdar://problem/14421763>

1:22 PM Changeset in webkit [153098] by Lucas Forschler
  • 3 edits
    2 copies in branches/safari-537-branch

Merged r153002. <rdar://problem/14348927>

12:56 PM Changeset in webkit [153097] by mhahnenberg@apple.com
  • 2 edits in trunk/Source/JavaScriptCore

JIT::updateTopCallFrame doesn't update the CallFrame's bytecodeOffset if bytecodeOffset == 0
https://bugs.webkit.org/show_bug.cgi?id=118923

Reviewed by Filip Pizlo.

This bug causes the CallFrame's bytecodeOffset to not be properly set when we
enter, e.g., cti_optimize from an op_enter.

  • jit/JITInlines.h:

(JSC::JIT::updateTopCallFrame):

12:31 PM Changeset in webkit [153096] by jberlin@webkit.org
  • 17 edits in trunk/Source/WebKit2

Remove WKPageGetPlugInInformation - it is not used anymore
https://bugs.webkit.org/show_bug.cgi?id=119047

Reviewed by Alexey Proskuryakov.

Revert r151172, which fixed a crash introduced in r151043, r151054, which fixed some naming
and ref-churn issues introduced in r151043, and r151043, which added
WKPageGetPlugInInformation.

  • UIProcess/API/C/mac/WKPagePrivateMac.cpp:

(WKPageIsURLKnownHSTSHost):

  • UIProcess/API/C/mac/WKPagePrivateMac.h:
  • UIProcess/Plugins/PluginProcessManager.h:
  • UIProcess/Plugins/mac/PluginProcessManagerMac.mm:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::close):

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:
  • UIProcess/mac/WebPageProxyMac.mm:
  • WebProcess/Plugins/Netscape/NetscapePlugin.h:
  • WebProcess/Plugins/PDF/SimplePDFPlugin.h:
  • WebProcess/Plugins/Plugin.h:
  • WebProcess/Plugins/PluginProxy.h:
  • WebProcess/Plugins/PluginView.h:
  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:
  • WebProcess/WebPage/mac/WebPageMac.mm:
12:23 PM Changeset in webkit [153095] by zandobersek@gmail.com
  • 6 edits
    1 delete in trunk/Source/WebCore

Remove CheckedInt, use Checked<T, RecordOverflow> instead
https://bugs.webkit.org/show_bug.cgi?id=119022

Reviewed by Oliver Hunt.

Following the cleanup in r153062, the CheckedInt uses are replaced with
using the Checked<T, RecordOverflow> class. The CheckedInt header is not
used anywhere anymore and is thus removed.

  • GNUmakefile.list.am:
  • WebCore.xcodeproj/project.pbxproj:
  • html/canvas/CheckedInt.h: Removed.
  • html/canvas/DataView.cpp:

(WebCore::DataView::create):

  • html/canvas/WebGLBuffer.cpp:

(WebCore::WebGLBuffer::associateBufferSubDataImpl):

  • html/canvas/WebGLRenderingContext.cpp:

(WebCore::WebGLRenderingContext::drawArrays):

12:11 PM Changeset in webkit [153094] by akling@apple.com
  • 3 edits in trunk/Source/WebCore

RenderMenuList computes the width of its longest option twice.
<http://webkit.org/b/119046>
<rdar://problem/14534679>

Reviewed by Darin Adler.

Rename the RenderMenuList::m_optionsChanged flag to m_needsOptionsWidthUpdate,
and make sure it gets cleared after we do a width computation in response to font changes.

  • rendering/RenderMenuList.cpp:

(WebCore::RenderMenuList::styleDidChange):

12:03 PM Changeset in webkit [153093] by zandobersek@gmail.com
  • 4 edits in trunk

Make KURL::hasPath private
https://bugs.webkit.org/show_bug.cgi?id=118279

Reviewed by Darin Adler.

Source/WebCore:

  • platform/KURL.h: The KURL::hasPath method is not used outside of the KURL class, so it is made private.

Tools:

  • TestWebKitAPI/Tests/WebCore/KURL.cpp:

(TestWebKitAPI::TEST_F): Remove references to KURL::hasPath the method is now private and thus not accessible for testing.

11:33 AM Changeset in webkit [153092] by jberlin@webkit.org
  • 11 edits in trunk/Source

Remove WKPageGetPlugInInformation - it is not used anymore
https://bugs.webkit.org/show_bug.cgi?id=119047

Rubber-stamped by Alexey Proskuryakov.

Revert r152328, which added a key used only in the callback info for
WKPageGetPlugInInformation.

Source/WebCore:

  • WebCore.exp.in:

Source/WebKit2:

  • Shared/API/c/WKPluginInformation.cpp:
  • Shared/API/c/WKPluginInformation.h:
  • Shared/Plugins/Netscape/PluginInformation.cpp:
  • Shared/Plugins/Netscape/PluginInformation.h:
  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:
  • UIProcess/mac/WebPageProxyMac.mm:

(WebKit::WebPageProxy::containsPlugInCallback):

  • WebProcess/WebPage/mac/WebPageMac.mm:

(WebKit::WebPage::containsPluginViewsWithPluginProcessToken):

11:28 AM Changeset in webkit [153091] by Antoine Quint
  • 2 edits in trunk/Source/WebInspectorUI

Web Inspector: control+clicking on a numeric token should not show the context menu
https://bugs.webkit.org/show_bug.cgi?id=119048

Reviewed by Timothy Hatcher.

Track "contextmenu" events when we're hovering a token containing a numeric value
and call preventDefault() in the event handler to ensure that the context menu does
not appear.

  • UserInterface/CodeMirrorDragToAlterNumberController.js:

(WebInspector.CodeMirrorDragToAlterNumberController.prototype.handleEvent):
(WebInspector.CodeMirrorDragToAlterNumberController.prototype._setTracksMouseClickAndDrag):

11:11 AM Changeset in webkit [153090] by Lucas Forschler
  • 3 edits
    3 copies in branches/safari-537-branch

Merged r153075. <rdar://problem/14530072>

11:02 AM Changeset in webkit [153089] by robert@webkit.org
  • 7 edits
    20 adds in trunk

Border drawing incorrect when using both border-collapse: collapse and overflow: hidden on a table
https://bugs.webkit.org/show_bug.cgi?id=18305

Reviewed by David Hyatt.

Source/WebCore:

overflowClipRect() clips out the table's half of a collapsed border when there is an overflow clip
on the table. This prevents the table's half of the border ever getting painted.

To fix this, clip to the border box of tables when we're in the paint phase that gets the sections to draw the collapsed borders
or when we're self painting. This will allow the table's half of the border to get painted. In the case where the table is self
painting we ensure that content gets clipped to cell's side of the collapsed border by ensuring the clip passed to child layers
from the table clips to the inside of the collapsed border.

It's worth noting that a table's collapsed borders are painted by the table's layer using functions in
RenderTableSection and RenderTableCell. So if a table section has a self-painting layer this patch still works, because
the borders aren't painted by the section's layer.

Tests: fast/table/overflow-table-collapsed-borders-cell-painting-table-self-painting-layer.html

fast/table/overflow-table-collapsed-borders-cell-painting.html
fast/table/overflow-table-collapsed-borders-section-layer-painting.html
fast/table/overflow-table-collapsed-borders-section-layer-table-self-painting-layer.html
fast/table/overflow-table-collapsed-borders-section-self-painting-layer-painting.html
fast/table/overflow-table-collapsed-borders-section-self-painting-layer-table-self-painting-layer.html
fast/table/table-overflow.html

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::pushContentsClip):
(WebCore::RenderBox::overflowClipRect):

  • rendering/RenderBox.h:

(WebCore::RenderBox::overflowClipRectForChildLayers):

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::calculateClipRects):

  • rendering/RenderTable.cpp:

(WebCore::RenderTable::overflowClipRect):

  • rendering/RenderTable.h:

(WebCore::RenderTable::overflowClipRectForChildLayers):

LayoutTests:

  • fast/table/overflow-table-collapsed-borders-cell-painting-expected.png: Added.
  • fast/table/overflow-table-collapsed-borders-cell-painting-expected.txt: Added.
  • fast/table/overflow-table-collapsed-borders-cell-painting-table-self-painting-layer-expected.png: Added.
  • fast/table/overflow-table-collapsed-borders-cell-painting-table-self-painting-layer-expected.txt: Added.
  • fast/table/overflow-table-collapsed-borders-cell-painting-table-self-painting-layer.html: Added.
  • fast/table/overflow-table-collapsed-borders-cell-painting.html: Added.
  • fast/table/overflow-table-collapsed-borders-section-layer-painting-expected.png: Added.
  • fast/table/overflow-table-collapsed-borders-section-layer-painting-expected.txt: Added.
  • fast/table/overflow-table-collapsed-borders-section-layer-painting.html: Added.
  • fast/table/overflow-table-collapsed-borders-section-layer-table-self-painting-layer-expected.png: Added.
  • fast/table/overflow-table-collapsed-borders-section-layer-table-self-painting-layer-expected.txt: Added.
  • fast/table/overflow-table-collapsed-borders-section-layer-table-self-painting-layer.html: Added.
  • fast/table/overflow-table-collapsed-borders-section-self-painting-layer-painting-expected.png: Added.
  • fast/table/overflow-table-collapsed-borders-section-self-painting-layer-painting-expected.txt: Added.
  • fast/table/overflow-table-collapsed-borders-section-self-painting-layer-painting.html: Added.
  • fast/table/overflow-table-collapsed-borders-section-self-painting-layer-table-self-painting-layer-expected.png: Added.
  • fast/table/overflow-table-collapsed-borders-section-self-painting-layer-table-self-painting-layer-expected.txt: Added.
  • fast/table/overflow-table-collapsed-borders-section-self-painting-layer-table-self-painting-layer.html: Added.
  • fast/table/table-overflow-expected.html: Added.
  • fast/table/table-overflow.html: Added.
  • platform/qt/fast/table/overflowHidden-expected.txt:
10:12 AM Changeset in webkit [153088] by commit-queue@webkit.org
  • 4 edits
    2 adds in trunk

Graphical elements inside mphantom should not be visible.
https://bugs.webkit.org/show_bug.cgi?id=116600.

Patch by Frédéric Wang <fred.wang@free.fr> on 2013-07-24
Reviewed by Chris Fleizach.

Source/WebCore:

Test: mathml/presentation/phantom.html

  • rendering/mathml/RenderMathMLFraction.cpp:

(WebCore::RenderMathMLFraction::paint): don't paint the fraction bar when the visibility is not "visible"

  • rendering/mathml/RenderMathMLRoot.cpp:

(WebCore::RenderMathMLRoot::paint): don't paint the radical symbol when the visibility is not "visible"

LayoutTests:

  • mathml/presentation/phantom-expected.html: Added.
  • mathml/presentation/phantom.html: Added.
9:07 AM Changeset in webkit [153087] by Antoine Quint
  • 4 edits
    2 adds in trunk/Source/WebInspectorUI

Web Inspector: support click-and-drag editing of CSS numeric values
https://bugs.webkit.org/show_bug.cgi?id=118896

Reviewed by Timothy Hatcher.

Add support for adjustment of numeric values in the various CodeMirror editors
by holding the option key and dragging the mouse. By default, dragging one pixel
changes the value by 1, but key modifiers allow to customize that behavior by using
the control key to change the value to 0.1 and the shift key to change the value to 10.

  • UserInterface/CodeMirrorAdditions.js:

Split adjustNumber() into two methods such that we may use its logic from the
CodeMirrorDragToAlterNumberController. The new method, CodeMirror.prototype.alterNumberInRange()
allow to set begin and end CodeMirror positions such that the existing alterNumber()
can use information based on the current cursor position, and CodeMirrorDragToAlterNumberController
can use information based on the hovered token.

  • UserInterface/CodeMirrorDragToAlterNumberController.css: Added.

(.CodeMirror.drag-to-adjust .CodeMirror-lines):
Set the cursor to "col-resize" when a number token is hovered and the option key
modifier is pressed.

  • UserInterface/CodeMirrorDragToAlterNumberController.js: Added.

(WebInspector.CodeMirrorDragToAlterNumberController):
We define the new "dragToAdjustNumbers" CodeMirror option.

(WebInspector.CodeMirrorDragToAlterNumberController.prototype.set enabled):
The "enabled" property controls whether the associated CodeMirror instance
may act upon hovering numeric values to adjust them via a drag interaction.

(WebInspector.CodeMirrorDragToAlterNumberController.prototype.handleEvent):
Proxy for various event-specific methods to deal with mouse events. We also bind
the value of the "active" property to the "mouseenter" and "mouseleave" events
if we're not currently dragging-to-adjust.

(WebInspector.CodeMirrorDragToAlterNumberController.prototype._setActive):
The "active" property is set when the mouse is over the associated CodeMirror
editor and when it's on we track all "mousemove" events such that we may
identify tokens containing numeric values. We also start tracking changes to the
option modifier key press state such that we may change the cursor accordingly.
We ensure that the CodeMirror instance is not read-only such that we don't
allow adjustment of numeric values in places where they couldn't be committed.

(WebInspector.CodeMirrorDragToAlterNumberController.prototype._setDragging):
The "dragging" property reflects whether a dragging-to-adjust interaction
is underway. We call into WebInspector.elementDragStart() and WebInspector.elementDragEnd()
to set the cursor to "col-resize" for the whole document while tracking mousemove
and mouseup events at the window level such that we can drag-to-adjust even outside
of the inspector window.

(WebInspector.CodeMirrorDragToAlterNumberController.prototype._setTracksMouseClickAndDrag):
The "tracksMouseClickAndDrag" property is set to true whenever the controller
has detected that a token containing a numeric value is being hovered and the
option modifier key is pressed. This property controls the cursor value for the
hovered token to reflect that a drag-to-adjust interaction is allowed and tracks
"mousedown" events for when a dragging interaction may be initiated.

(WebInspector.CodeMirrorDragToAlterNumberController.prototype._modifiersDidChange):
Sets the "tracksMouseClickAndDrag" property depending on the availability of a hovered
token containing a numeric value and the pressed state of the option modified key.

(WebInspector.CodeMirrorDragToAlterNumberController.prototype._mouseMoved):
Handles "mousemove" events when we're not in the "dragging" state such that we
check the currently hovered token, if any, to see if it contains a number that
we may drag-to-adjust. Subsequently, we may enter the "tracksMouseClickAndDrag"
state.

(WebInspector.CodeMirrorDragToAlterNumberController.prototype._mouseWasPressed):
Handles "mousedown" events during a drag-to-adjust interaction. We simply track
the current mouse position in the x-axis and enter the "dragging" state.

(WebInspector.CodeMirrorDragToAlterNumberController.prototype._mouseWasDragged):
Handles "mousemove" events when we are in the "dragging" state. We compare the
current mouse position in the x-axis with the last recoreded value and determine
the amount by which we should adjust the value, taking into account the shift and
control modifier keys. We then call into WebInspector.alterNumberInRange() to
apply the change amount to the associated CodeMirror editor.

(WebInspector.CodeMirrorDragToAlterNumberController.prototype._mouseWasReleased):
Handles "mouseup" events, simply exiting the "dragging" state and resetting other
parameters we would have customized as a result of the drag-to-adjust interaction.

(WebInspector.CodeMirrorDragToAlterNumberController.prototype._reset):
Resetting some parameters we would have customized as a result of the drag-to-adjust
interaction.

  • UserInterface/Main.html:

Include the new CodeMirrorDragToAlterNumberController.{js|css} files.

  • UserInterface/Main.js:

(WebInspector.elementDragStart):
(WebInspector.elementDragEnd):
Add an extra parameter to elementDragStart() such that the caller may specify the event
target for the "mousemove" and "mouseup" events.

8:44 AM Changeset in webkit [153086] by commit-queue@webkit.org
  • 2 edits in trunk/Source/WebCore

WebVTTParser's identifier buffering can ignore subsequent lines
https://bugs.webkit.org/show_bug.cgi?id=118483

Patch by Brendan Long <b.long@cablelabs.com> on 2013-07-24
Reviewed by Eric Carlson.

No new tests since this bug can't be reproduced in layout tests.

  • html/track/WebVTTParser.cpp:

(WebCore::WebVTTParser::parseBytes): Only buffer the identifier if we haven't read an entire line.

8:27 AM Changeset in webkit [153085] by commit-queue@webkit.org
  • 7 edits in trunk

[GTK] TestInspectorServer unit test is timing out
https://bugs.webkit.org/show_bug.cgi?id=105866

Patch by Anton Obzhirov <Anton Obzhirov> on 2013-07-24
Reviewed by Gustavo Noronha Silva.

Source/WebKit2:

The test failed because it couldn't find inspector resources in default folder
(make install step was missing). It uses now resources available in
WebKitBuild folder. WebInspectorServerGtk was refactored as well to make
easier to use WEBKIT_INSPECTOR_SERVER_PATH variable.

  • UIProcess/API/gtk/tests/GNUmakefile.am:
  • UIProcess/API/gtk/tests/InspectorTestServer.cpp:

(main):

  • UIProcess/API/gtk/tests/TestInspectorServer.cpp:

(testInspectorServerPageList):

  • UIProcess/InspectorServer/gtk/WebInspectorServerGtk.cpp:

(WebKit::WebInspectorServer::platformResourceForPath):
(WebKit::WebInspectorServer::buildPageList):
(WebKit::WebInspectorServer::inspectorServerFilesPath):

Tools:

  • Scripts/run-gtk-tests:

(TestRunner):

7:53 AM Changeset in webkit [153084] by commit-queue@webkit.org
  • 2 edits in trunk/Tools

[GTK] [WK2] Handle wheel event with delta zero
https://bugs.webkit.org/show_bug.cgi?id=118973

Patch by Anton Obzhirov <Anton Obzhirov> on 2013-07-24
Reviewed by Gustavo Noronha Silva.

Added handling of zero mouse scroll deltas in EventSenderProxy similar
to WK1 and Qt/EFL ports.

fast/events/platform-wheelevent-with-delta-zero-crash.html is no longer
failing on WK2.

  • WebKitTestRunner/gtk/EventSenderProxyGtk.cpp:

(WTR::EventSenderProxy::mouseScrollBy):

5:52 AM Changeset in webkit [153083] by simon.pena@samsung.com
  • 2 edits in trunk/LayoutTests

[GTK] Unreviewed gardening. Add expectations for flaky test.

  • platform/gtk/TestExpectations: Mark svg/stroke/non-scaling-stroke-pattern.svg

as flaky.

4:34 AM Changeset in webkit [153082] by zandobersek@gmail.com
  • 2 edits in trunk/Source/ThirdParty/ANGLE

Unreviewed. Setting the svn:eol-style=native property on the ANGLE.sln file.

  • src/ANGLE.sln: Added property svn:eol-style.
3:35 AM Changeset in webkit [153081] by Csaba Osztrogonác
  • 2 edits in trunk/Source/ThirdParty/ANGLE

[Qt] Buildfix after r153064. Add Uniform files to the Target.pri.

Patch by Gabor Abraham <abrhm@inf.u-szeged.hu> on 2013-07-24
Reviewed by Csaba Osztrogonác.

  • Target.pri:
2:57 AM Changeset in webkit [153080] by ryuan.choi@samsung.com
  • 2 edits in trunk

[EFL][CMAKE] Fix wrong syntax about option commands
https://bugs.webkit.org/show_bug.cgi?id=119035

Reviewed by Christophe Dumez.

second argument of cmake option command should be description.

  • Source/cmake/OptionsEfl.cmake: Added description instead of wrong initial value.
2:36 AM Changeset in webkit [153079] by commit-queue@webkit.org
  • 2 edits in trunk/LayoutTests

[EFL] Unreviewed gardening
https://bugs.webkit.org/show_bug.cgi?id=118826

Unreviewed EFL gardening.

Patch by Seokju Kwon <Seokju Kwon> on 2013-07-24

  • platform/efl-wk2/TestExpectations: Update test expectations after r134890 and r139491.
1:58 AM Changeset in webkit [153078] by simon.pena@samsung.com
  • 2 edits in trunk/LayoutTests

[GTK] Unreviewed gardening. Added expectations for flaky tests.

  • platform/gtk/TestExpectations: Marked animations/resume-after-page-cache.html,

css3/calc/img-size.html and perf/nested-combined-selectors.html as flaky.

Note: See TracTimeline for information about the timeline view.