CodeBlock::prepareForExecution() is silly
https://bugs.webkit.org/show_bug.cgi?id=120453

Reviewed by Oliver Hunt.
        
Instead of saying:
        
    codeBlock->prepareForExecution(stuff, BaselineJIT, more stuff)
        
we should just say:
        
    JIT::compile(stuff, codeBlock, more stuff);
        
And similarly for the LLInt and DFG.
        
This kills a bunch of code, since CodeBlock::prepareForExecution() is just a
wrapper that uses the JITType argument to call into the appropriate execution
engine, which is what the user wanted to do in the first place.

* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* bytecode/CodeBlock.cpp:
* bytecode/CodeBlock.h:
* dfg/DFGDriver.cpp:
(JSC::DFG::compileImpl):
(JSC::DFG::compile):
* dfg/DFGDriver.h:
(JSC::DFG::tryCompile):
* dfg/DFGOSRExitPreparation.cpp:
(JSC::DFG::prepareCodeOriginForOSRExit):
* dfg/DFGWorklist.cpp:
(JSC::DFG::globalWorklist):
* dfg/DFGWorklist.h:
* jit/JIT.cpp:
(JSC::JIT::privateCompile):
* jit/JIT.h:
(JSC::JIT::compile):
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):
* llint/LLIntEntrypoint.cpp: Copied from Source/JavaScriptCore/llint/LLIntEntrypoints.cpp.
(JSC::LLInt::setFunctionEntrypoint):
(JSC::LLInt::setEvalEntrypoint):
(JSC::LLInt::setProgramEntrypoint):
(JSC::LLInt::setEntrypoint):
* llint/LLIntEntrypoint.h: Copied from Source/JavaScriptCore/llint/LLIntEntrypoints.h.
* llint/LLIntEntrypoints.cpp: Removed.
* llint/LLIntEntrypoints.h: Removed.
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::jitCompileAndSetHeuristics):
* runtime/Executable.cpp:
(JSC::ScriptExecutable::prepareForExecutionImpl):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154833 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reverting a change that was made in https://bugs.webkit.org/show_bug.cgi?id=120472.

* media/track/track-cue-rendering-on-resize-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154834 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove code behind ENABLE(DIALOG_ELEMENT)
https://bugs.webkit.org/show_bug.cgi?id=120467

Reviewed by Darin Adler.

It is incomplete and no one is building it.

* CMakeLists.txt:
* Configurations/FeatureDefines.xcconfig:
* DerivedSources.make:
* DerivedSources.pri:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* bindings/generic/RuntimeEnabledFeatures.cpp:
* bindings/generic/RuntimeEnabledFeatures.h:
* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):
* css/html.css:
* dom/ContextFeatures.cpp:
* dom/ContextFeatures.h:
* dom/Document.cpp:
* dom/Document.h:
* dom/Element.cpp:
(WebCore::Element::removedFrom):
(WebCore::Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries):
* dom/Element.h:
(WebCore::Element::isDisabledFormControl):
* dom/ElementRareData.h:
(WebCore::ElementRareData::ElementRareData):
* html/HTMLDialogElement.cpp: Removed.
* html/HTMLDialogElement.h: Removed.
* html/HTMLDialogElement.idl: Removed.
* html/HTMLElementsAllInOne.cpp:
* html/HTMLTagNames.in:
* rendering/RenderDialog.cpp: Removed.
* rendering/RenderDialog.h: Removed.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::rebuildZOrderLists):
(WebCore::RenderLayer::collectLayers):
* rendering/RenderLayer.h:
* rendering/RenderObject.h:
(WebCore::RenderObject::isCounter):
* rendering/RenderingAllInOne.cpp:
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup):
(WebCore::InternalSettings::Backup::restoreTo):
* testing/InternalSettings.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154835 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Pasteboard::writeSelection violates layering (first step, fixes it for Mac platform only)
https://bugs.webkit.org/show_bug.cgi?id=120483

Reviewed by Anders Carlsson.

* editing/Editor.cpp:
(WebCore::Editor::cut): Added some comments. Use the new writeSelectionToPasteboard
function on Mac instead of Pasteboard::writeSelection.
(WebCore::Editor::copy): Ditto.

* editing/Editor.h: Removed an old unused Mac-only writeSelectionToPasteboard function
that was a cover that called through to Pasteboard::writeSelectionForTypes. Added a new
Mac-only writeSelectionToPasteboard function that is destined to become cross-platform soon.

* editing/mac/EditorMac.mm:
(WebCore::Editor::writeSelectionToPasteboard): Added. Uses a new pattern where the Editor
puts all the data into a structure called PasteboardWebContent then calls the Pasteboard to
do the work. The platform-specific aspect of PasteboardWebContent is what formats are needed
for each platform.

* page/DragController.cpp:
(WebCore::DragController::startDrag): Added some comments. Use the new writeSelectionToPasteboard
function on Mac instead of Pasteboard::writeSelection.

* platform/Pasteboard.h: Remove some unneeded forward declarations. Added comments for all functions
that don't belong in this class because they are layering violations; this becomes the to do list for
the project we are beginning here. Added the new PasteboardWebContent structure, empty on all platforms
except for Mac for now. Removed writeSelectionForTypes, a Mac-only function that is no longer used.
Added setTypes and writeAfterSettingTypes, the two halves of the future function named writeWebContent.
Put the writeSelection function inside a "not Mac" if statement. Later to be deleted entirely.

* platform/mac/PasteboardMac.mm: Removed now-unneeded selectionPasteboardTypes,
Pasteboard::writeSelectionForTypes, and writeSelection functions.
(WebCore::Pasteboard::setTypes): Added. First half of writing web content to the pasteboard.
(WebCore::Pasteboard::writeAfterSettingTypes): Added. Second half of writing web content to the pasteboard.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154836 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CodeBlock's magic for scaling tier-up thresholds should be more reusable
https://bugs.webkit.org/show_bug.cgi?id=120486

Reviewed by Oliver Hunt.
        
Removed the counterValueForBlah() methods and exposed the reusable scaling logic
as a adjustedCounterValue() method.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::adjustedCounterValue):
(JSC::CodeBlock::optimizeAfterWarmUp):
(JSC::CodeBlock::optimizeAfterLongWarmUp):
(JSC::CodeBlock::optimizeSoon):
* bytecode/CodeBlock.h:
* dfg/DFGOSRExitCompilerCommon.cpp:
(JSC::DFG::handleExitCounts):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Kill code that became dead after http://trac.webkit.org/changeset/154833

Rubber stamped by Oliver Hunt.

* dfg/DFGDriver.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154838 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r153222, 32-bit): NULL JSValue() seen when running peacekeeper benchmark.
https://bugs.webkit.org/show_bug.cgi?id=120080

Patch by Julien Brianceau <jbriance@cisco.com> on 2013-08-29
Reviewed by Michael Saboff.

* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emitSlow_op_get_argument_by_val): Revert changes introduced by r153222 in this function.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154839 268f45cc-cd09-0410-ab3c-d52691b4dbfc
According to DOM4, all DocType nodes should have a document
https://bugs.webkit.org/show_bug.cgi?id=99244

Reviewed by Darin Adler.

Source/WebCore:

Doctypes now always have a node document and can be moved across document boundaries as per
the latest DOM4 specification:
http://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype
http://dom.spec.whatwg.org/#dom-node-ownerdocument

This means that DOMImplementation.createDocumentType() now sets the ownerDocument of the
new DocumentType Node to the associated document of the current "context" object. In
DOM4, all nodes have a document at all times. DocumentType nodes can now be moved across
document boundaries so that the node can be added to a Document after being created.

This means we will no longer need to special case DocumentType nodes in the code and
Node::document() can no longer return NULL, which means that we'll be able to remove
NULL checks in call sites.

Firefox stable and since recently Blink already follow DOM4 here while IE10 does not (yet).

Test: fast/dom/createDocumentType-ownerDocument.html

* dom/ContainerNode.cpp:
(WebCore::checkAcceptChild):
* dom/DOMImplementation.cpp:
(WebCore::DOMImplementation::createDocumentType):
(WebCore::DOMImplementation::createDocument):
* dom/Node.h:
(WebCore::Node::document):

LayoutTests:

Add layout test to check that DocumentType Nodes have a document after being
created. Also update a few existing test cases to reflect this change.

* fast/dom/DOMImplementation/createDocument-with-used-doctype-expected.txt:
* fast/dom/DOMImplementation/createDocument-with-used-doctype.html:
* fast/dom/DOMImplementation/resources/createDocument-with-used-doctype-frame.html:
* fast/dom/XMLSerializer-doctype2-expected.txt:
* fast/dom/XMLSerializer-doctype2.html:
* fast/dom/createDocumentType-ownerDocument-expected.txt: Added.
* fast/dom/createDocumentType-ownerDocument.html: Added.
* fast/dom/move-nodes-across-documents.html:
* fast/dom/node-iterator-with-doctype-root-expected.txt:
* fast/dom/node-iterator-with-doctype-root.html:
* fast/events/dispatch-event-no-document-expected.txt:
* fast/events/dispatch-event-no-document.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154840 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Should enable WebGL by default on MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=120420

Patch by Andre Moreira Magalhaes <andre.magalhaes@collabora.co.uk> on 2013-08-29
Reviewed by Gustavo Noronha Silva.

Enable WebGL by default on MiniBrowser.

* MiniBrowser/gtk/main.c:
(main):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154841 268f45cc-cd09-0410-ab3c-d52691b4dbfc
XMLSerializer-attribute-namespace-prefix-conflicts can't produce reliable results
https://bugs.webkit.org/show_bug.cgi?id=120490

Marking as [ Pass Failure ] for the moment.

* TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154842 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Inspector: Use a bit of RefPtr::release() in generated code.
<https://webkit.org/b/120485>

Reviewed by Darin Adler.

Just something I spotted while reading InspectorBackendDispatcher.cpp.
Avoid 3 cases of reference count churnery.

* inspector/CodeGeneratorInspectorStrings.py:


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

* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::callCheck):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154845 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r153222, 32-bit): NULL JSValue() seen when running peacekeeper benchmark
https://bugs.webkit.org/show_bug.cgi?id=120080

Rubber stamped by Oliver Hunt.

Added layout test that crashes without the fix in bug 120080.

* fast/js/lazy-create-arguments-from-get-by-val-expected.txt: Added.
* fast/js/lazy-create-arguments-from-get-by-val.html: Added.
* fast/js/script-tests/lazy-create-arguments-from-get-by-val.js: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154846 268f45cc-cd09-0410-ab3c-d52691b4dbfc
.: Add ENABLE guards for Promises
https://bugs.webkit.org/show_bug.cgi?id=120488

Reviewed by Andreas Kling.

* Source/autotools/SetupWebKitFeatures.m4:
* Source/cmake/WebKitFeatures.cmake:
* Source/cmakeconfig.h.cmake:

Source/JavaScriptCore: Add ENABLE guards for Promises
https://bugs.webkit.org/show_bug.cgi?id=120488

Reviewed by Andreas Kling.

* Configurations/FeatureDefines.xcconfig:
* runtime/JSGlobalObject.cpp:
* runtime/JSGlobalObject.h:
* runtime/JSPromise.cpp:
* runtime/JSPromise.h:
* runtime/JSPromiseCallback.cpp:
* runtime/JSPromiseCallback.h:
* runtime/JSPromiseConstructor.cpp:
* runtime/JSPromiseConstructor.h:
* runtime/JSPromisePrototype.cpp:
* runtime/JSPromisePrototype.h:
* runtime/JSPromiseResolver.cpp:
* runtime/JSPromiseResolver.h:
* runtime/JSPromiseResolverConstructor.cpp:
* runtime/JSPromiseResolverConstructor.h:
* runtime/JSPromiseResolverPrototype.cpp:
* runtime/JSPromiseResolverPrototype.h:

Source/WebCore: Add ENABLE guards for Promises
https://bugs.webkit.org/show_bug.cgi?id=120488

Reviewed by Andreas Kling.

* Configurations/FeatureDefines.xcconfig:

Source/WebKit/mac: Add ENABLE gaurds for Promises
https://bugs.webkit.org/show_bug.cgi?id=120488

Reviewed by Andreas Kling.

* Configurations/FeatureDefines.xcconfig:

Source/WebKit2: Add ENABLE gaurds for Promises
https://bugs.webkit.org/show_bug.cgi?id=120488

Reviewed by Andreas Kling.

* Configurations/FeatureDefines.xcconfig:

Source/WTF: Add ENABLE guards for Promises
https://bugs.webkit.org/show_bug.cgi?id=120488

Reviewed by Andreas Kling.

* wtf/FeatureDefines.h:

Tools: Add ENABLE guards for Promises
https://bugs.webkit.org/show_bug.cgi?id=120488

Reviewed by Andreas Kling.

* Scripts/webkitperl/FeatureList.pm:
* qmake/mkspecs/features/features.pri:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Scrolling text with FCC does not work while composing an email
https://bugs.webkit.org/show_bug.cgi?id=120493

Patch by Jacky Jiang <zhajiang@blackberry.com> on 2013-08-29
Reviewed by Rob Buis.
Internally reviewed by Gen Mak and Konrad Piascik.

JIRA 468007
m_cannotScrollIfHasFloatLayoutSizeRoundingError was true which prevented
FCC scrolling.
TransformedActualVisibleSize is quite different in email compose card
than browser. In this case, the issue was caused by transformedActualVisibleSize(768, 750)
which was not the actual visible size of the webkit part of the Cascades
view when keyboard popped up. We usually don't do keyboard adaptation for
windowless page clients; therefore, there will be no viewport change of
WebKit.
To fix the bug, we can ignore the windowless page clients.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::hasFloatLayoutSizeRoundingError):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154849 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Windows] More unreviewed gardening of project file.
Move css files inline with related source code.

* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154850 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make incrementing and decrementing numbers by 0.1 require the control key, and not near zero numbers.

https://bugs.webkit.org/show_bug.cgi?id=120492
<rdar://problem/13738935> Incrementing and decrementing numbers near zero is annoying compared to earlier releases

Reviewed by Joseph Pecoraro.

* UserInterface/CodeMirrorAdditions.js:
(alterNumber): Remove near zero check.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154851 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Windows] Unreviewed build fix after r154847.

* win/tools/vsprops/FeatureDefines.props: Add missing definition for ENABLE_PROMISES
* win/tools/vsprops/FeatureDefinesCairo.props: Ditto



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154852 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Windows] Unreviewed build fix after r154847.
If you are going to exclude promises, actually exclude the build components.

* interpreter/CallFrame.h: Exclude promise declarations
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::reset): Exclude promise code.
(JSC::JSGlobalObject::visitChildren): Ditto.
* runtime/VM.cpp: Ditto.
(JSC::VM::VM):
(JSC::VM::~VM):
* runtime/VM.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Teach DFG::Worklist and its clients that it may be reused for different kinds of compilations
https://bugs.webkit.org/show_bug.cgi?id=120489

Reviewed by Geoffrey Garen.
        
If the baseline JIT hits an OSR entry trigger into the DFG and we already have a
DFG compilation but we've also started one or more FTL compilations, then we
shouldn't get confused. Previously we would have gotten confused because we would
see an in-process deferred compile (the FTL compile) and also an optimized
replacement (the DFG code).
        
If the baseline JIT hits an OSR entry trigger into the DFG and we previously
did two things in this order: triggered a tier-up compilation from the DFG into
the FTL, and then jettisoned the DFG code because it exited a bunch, then we
shouldn't be confused by the presence of an in-process deferred compile (the FTL
compile). Previously we would have waited for that compile to finish; but the more
sensible thing to do is to let it complete and then invalidate it, while at the
same time enqueueing a DFG compile to create a new, more valid, DFG code block.
        
If the DFG JIT hits a loop OSR entry trigger (into the FTL) and it has already
triggered an FTL compile for replacement, then it should fire off a second compile
instead of thinking that it can wait for that one to finish. Or vice-versa. We
need to allow for two FTL compiles to be enqueued at the same time (one for
replacement and one for OSR entry in a loop).
        
Then there's also the problem that DFG::compile() is almost certainly going to be
the hook for triggering both DFG compiles and the two kinds of FTL compiles, but
right now there is no way to tell it which one you want.
        
This fixes these problems and removes a bunch of potential confusion by making the
key for a compile in the DFG::Worklist be a CompilationMode (one of DFGMode,
FTLMode, or FTLForOSREntryMode). That mode is also passed to DFG::compile().
        
Awkwardly, this still leaves us in a no DFG->FTL tier-up situation - so
DFG::compile() is always passed DFGMode and then it might do an FTL compile if
possible. Fixing that is a bigger issue for a later changeset.

* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::checkIfOptimizationThresholdReached):
* dfg/DFGCompilationKey.cpp: Added.
(JSC::DFG::CompilationKey::dump):
* dfg/DFGCompilationKey.h: Added.
(JSC::DFG::CompilationKey::CompilationKey):
(JSC::DFG::CompilationKey::operator!):
(JSC::DFG::CompilationKey::isHashTableDeletedValue):
(JSC::DFG::CompilationKey::profiledBlock):
(JSC::DFG::CompilationKey::mode):
(JSC::DFG::CompilationKey::operator==):
(JSC::DFG::CompilationKey::hash):
(JSC::DFG::CompilationKeyHash::hash):
(JSC::DFG::CompilationKeyHash::equal):
* dfg/DFGCompilationMode.cpp: Added.
(WTF::printInternal):
* dfg/DFGCompilationMode.h: Added.
* dfg/DFGDriver.cpp:
(JSC::DFG::compileImpl):
(JSC::DFG::compile):
* dfg/DFGDriver.h:
* dfg/DFGPlan.cpp:
(JSC::DFG::Plan::Plan):
(JSC::DFG::Plan::key):
* dfg/DFGPlan.h:
* dfg/DFGWorklist.cpp:
(JSC::DFG::Worklist::enqueue):
(JSC::DFG::Worklist::compilationState):
(JSC::DFG::Worklist::completeAllReadyPlansForVM):
(JSC::DFG::Worklist::runThread):
* dfg/DFGWorklist.h:
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):



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