Let's benchmark malloc
https://bugs.webkit.org/show_bug.cgi?id=131118

Reviewed by Mark Hahnenberg.

I want to replace fastMalloc with something faster (fasterMalloc?).
I wrote these benchmarks to test / drive development.

* MallocBench: Added.
* MallocBench/MallocBench: Added.
* MallocBench/MallocBench.xcodeproj: Added.
* MallocBench/MallocBench.xcodeproj/project.pbxproj: Added.
* MallocBench/MallocBench/Benchmark.cpp: Added.
(allocateHeap):
(deallocateHeap):
(Benchmark::Benchmark):
(Benchmark::printBenchmarks):
(Benchmark::runOnce):
(Benchmark::run):
(Benchmark::printReport):
(Benchmark::currentTimeMS):
(Benchmark::currentMemoryBytes):
* MallocBench/MallocBench/Benchmark.h: Added.
(Benchmark::Memory::Memory):
(Benchmark::Memory::operator-):
(Benchmark::isValid):
* MallocBench/MallocBench/CPUCount.cpp: Added.
(cpuCount):
* MallocBench/MallocBench/CPUCount.h: Added.
* MallocBench/MallocBench/CommandLine.cpp: Added.
(CommandLine::printUsage):
* MallocBench/MallocBench/CommandLine.h: Added.
(CommandLine::isValid):
(CommandLine::benchmarkName):
(CommandLine::isParallel):
(CommandLine::heapSize):
(CommandLine::measureHeap):
* MallocBench/MallocBench/Interpreter.cpp: Added.
(Interpreter::Interpreter):
(Interpreter::~Interpreter):
(Interpreter::run):
* MallocBench/MallocBench/Interpreter.h: Added.
* MallocBench/MallocBench/balloon.cpp: Added.
(benchmark_balloon):
* MallocBench/MallocBench/balloon.h: Added.
* MallocBench/MallocBench/big.cpp: Added.
(benchmark_big):
* MallocBench/MallocBench/big.h: Added.
* MallocBench/MallocBench/churn.cpp: Added.
(HeapDouble::operator new):
(HeapDouble::operator delete):
(HeapDouble::HeapDouble):
(HeapDouble::operator+=):
(benchmark_churn):
* MallocBench/MallocBench/churn.h: Added.
* MallocBench/MallocBench/crash.ops: Added.
* MallocBench/MallocBench/facebook.cpp: Added.
(benchmark_facebook):
* MallocBench/MallocBench/facebook.h: Added.
* MallocBench/MallocBench/facebook.ops: Added.
* MallocBench/MallocBench/fragment.cpp: Added.
(validate):
(benchmark_fragment):
(benchmark_fragment_iterate):
* MallocBench/MallocBench/fragment.h: Added.
* MallocBench/MallocBench/list.cpp: Added.
(benchmark_list_allocate):
(benchmark_list_traverse):
* MallocBench/MallocBench/list.h: Added.
* MallocBench/MallocBench/main.cpp: Added.
(main):
* MallocBench/MallocBench/mbmalloc.cpp: Added.
* MallocBench/MallocBench/mbmalloc.h: Added.
* MallocBench/MallocBench/medium.cpp: Added.
(benchmark_medium):
* MallocBench/MallocBench/medium.h: Added.
* MallocBench/MallocBench/message.cpp: Added.
(benchmark_message_one):
(benchmark_message_many):
* MallocBench/MallocBench/message.h: Added.
* MallocBench/MallocBench/realloc.cpp: Added.
(benchmark_realloc):
* MallocBench/MallocBench/realloc.h: Added.
* MallocBench/MallocBench/tree.cpp: Added.
(benchmark_tree_allocate):
(benchmark_tree_traverse):
(benchmark_tree_churn):
* MallocBench/MallocBench/tree.h: Added.
* MallocBench/run-malloc-benchmarks: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move focus management API from HTMLDocument to Document
https://bugs.webkit.org/show_bug.cgi?id=131079
<rdar://problem/16220103>

Reviewed by Timothy Hatcher.

Source/WebCore:

Merged from Blink (patch by Christophe Dumez):
https://src.chromium.org/viewvc/blink?view=rev&revision=165515

Move hasFocus() and attribute activeElement from interface HTMLDocument
to DOMDocument as per section Focus management APIs of the HTML5 standard:
<http://www.whatwg.org/specs/web-apps/current-work/#focus-management-apis> (1 April 2014).

Test: fast/dom/Document/xml-document-focus.xml

* bindings/objc/PublicDOMInterfaces.h: Moved hasFocus() and property activeElement from
interface DOMHTMLDocument to DOMDocument.
* dom/Document.cpp:
(WebCore::Document::activeElement): Added.
(WebCore::Document::hasFocus): Added.
* dom/Document.h:
* dom/Document.idl:
* html/HTMLDocument.cpp:
(WebCore::HTMLDocument::activeElement): Deleted.
(WebCore::HTMLDocument::hasFocus): Deleted.
* html/HTMLDocument.h:
* html/HTMLDocument.idl:

LayoutTests:

Derived from a Blink patch by Christophe Dumez:
https://src.chromium.org/viewvc/blink?view=rev&revision=165515

Made the test in <https://src.chromium.org/viewvc/blink?view=rev&revision=165515> a valid XHTML
document. Additionally taught LayoutTests/resources/{js-test, js-test-pre}.js to create actual
HTML elements so that these scripts can be used to write DRT tests in XML documents.

* fast/dom/Document/xml-document-focus-expected.txt: Added.
* fast/dom/Document/xml-document-focus.xml: Added.
* resources/js-test-pre.js: Added function createHTMLElement() and modified code to use it
instead of document.createElement() so as to work around <https://bugs.webkit.org/show_bug.cgi?id=131074>.
* resources/js-test.js: Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166668 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Load Media Controls js/css from bundle
https://bugs.webkit.org/show_bug.cgi?id=131086

Reviewed by Eric Carlson.

Source/WebCore:

Rather than embed encoded versions of the JS and CSS files
into C++ source, just load the files directly from the bundle.

* DerivedSources.make: Removed now unnecessary rules.
* WebCore.xcodeproj/project.pbxproj: Copy mediaControls files to the bundle.
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::RenderThemeIOS):
(WebCore::RenderThemeIOS::mediaControlsStyleSheet): Load from the bundle.
(WebCore::RenderThemeIOS::mediaControlsScript): Ditto.
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::RenderThemeMac):
(WebCore::RenderThemeMac::mediaControlsStyleSheet):
(WebCore::RenderThemeMac::mediaControlsScript):

Tools:

We're now putting CSS files into the bundle, so remove the test for them.

* Scripts/check-for-inappropriate-files-in-framework:

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

Try to ignore some Xcode shmutz in MallocBench.

* MallocBench/MallocBench.xcodeproj: Added property svn:ignore.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166670 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: Improve ARIA live region reliability by sending notifications when live regions are created/shown and hidden/destroyed
https://bugs.webkit.org/show_bug.cgi?id=124381

Unreviewed. Forgot to add test expectation.

* platform/mac/accessibility/live-region-creation-notification-expected.txt: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166671 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Document WKBackForwardList, WKBackForwardListItem and WKWebViewConfiguration
https://bugs.webkit.org/show_bug.cgi?id=131131

Reviewed by Dan Bernstein.

* UIProcess/API/Cocoa/WKBackForwardList.h:
* UIProcess/API/Cocoa/WKBackForwardListItem.h:
* UIProcess/API/Cocoa/WKWebViewConfiguration.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166672 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WebInspector] inspector-protocol/model/highlight-shape-outside.html is failing
https://bugs.webkit.org/show_bug.cgi?id=124660

Reviewed by Timothy Hatcher.

I updated the tests syntax to CR, CSS Shapes specification. It's also needed to be updated
to the latest WebInspector testing methods. I added some addidional test cases for the highlighting,
and also fixed some expected test case in the script, and updated the expected file.

* TestExpectations:
* inspector/dom/highlight-shape-outside-expected.txt:
* inspector/dom/highlight-shape-outside.html:
* inspector/dom/shapes-test.js:
(InspectorTestProxy.registerInitializer.):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166673 268f45cc-cd09-0410-ab3c-d52691b4dbfc
filter-build-webkit: Ignore xcodebuild warnings when compiling with newer builds of clang
<http://webkit.org/b/131045>

Reviewed by Daniel Bates.

* Scripts/filter-build-webkit:
(shouldIgnoreLine): Ignore DVTAssertions related to new builds
of clang, plus debug data for all DVTAssertions.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166674 268f45cc-cd09-0410-ab3c-d52691b4dbfc
RemoteLayerBackingStore doesn't need to clear opaque layers
https://bugs.webkit.org/show_bug.cgi?id=131134

Reviewed by Simon Fraser.

* Shared/mac/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::display):
We don't need to clear opaque layers, because we'll paint
over the whole area. In addition, we should fill opaque layers
with a bright color in debug builds to make it very clear
that we've made a mistake (similar to what FrameView does).


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166675 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Load Media Controls js/css from bundle
https://bugs.webkit.org/show_bug.cgi?id=131086

Followup comments from Eric Carlson.

Remove the booleans that were guarding loading the resources.

* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::mediaControlsStyleSheet):
(WebCore::RenderThemeIOS::mediaControlsScript):
(WebCore::RenderThemeIOS::RenderThemeIOS):
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::RenderThemeMac):
(WebCore::RenderThemeMac::mediaControlsStyleSheet):
(WebCore::RenderThemeMac::mediaControlsScript):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166676 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS] Expose geolocation provider on the process pool
https://bugs.webkit.org/show_bug.cgi?id=131125

Reviewed by Dan Bernstein.

Followup comments from Dan Bernstein. Use a class
extension rather than a new category.

* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _geolocationProvider]):
* UIProcess/API/Cocoa/WKProcessPoolInternal.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166677 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CodeBlockSet should be generational
https://bugs.webkit.org/show_bug.cgi?id=127152

Reviewed by Geoffrey Garen.

During EdenCollections we now only visit those CodeBlocks that:
a) Are new since the last collection if they were somehow otherwise reachable.
b) Are reachable from an Executable that is part of the remembered set.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::CodeBlock): Initialize uninitialized variables.
(JSC::CodeBlock::visitAggregate): Move the addition of the weak reference harvester after the
shouldImmediatelyAssumeLivenessDuringScan check since it's redundant if we assume liveness.
* bytecode/CodeBlock.h:
(JSC::CodeBlock::forEachRelatedCodeBlock): Executes a functor for each CodeBlock reachable from the current CodeBlock (including this).
We use this to clear marks for the CodeBlocks of remembered Executables (see: CodeBlockSet::clearMarksForEdenCollection).
(JSC::CodeBlockSet::mark): Also check the set of new CodeBlocks for memebership when doing conservative scanning.
(JSC::ScriptExecutable::forEachCodeBlock): Executes a functor for each of this Executable's CodeBlocks.
* heap/CodeBlockSet.cpp:
(JSC::CodeBlockSet::~CodeBlockSet):
(JSC::CodeBlockSet::add):
(JSC::CodeBlockSet::promoteYoungCodeBlocks): Moves all CodeBlocks currently in the set of new CodeBlocks into
the set of old CodeBlocks.
(JSC::CodeBlockSet::clearMarksForFullCollection): Clears the marks for all CodeBlocks.
(JSC::CodeBlockSet::clearMarksForEdenCollection): Clears the marks for CodeBlocks owned by Executables in the
remembered set. When an Executable is added to the remembered set it's typically because we need to do something
with its CodeBlock.
(JSC::CodeBlockSet::clearMarks):
(JSC::CodeBlockSet::deleteUnmarkedAndUnreferenced): Fixpoints over either just the new CodeBlocks or all CodeBlocks
to determine which CodeBlocks are dead and eagerly finalizes/deletes them.
(JSC::CodeBlockSet::remove):
(JSC::CodeBlockSet::traceMarked): Iterate only the currently executing CodeBlocks instead of all CodeBlocks.
(JSC::CodeBlockSet::rememberCurrentlyExecutingCodeBlocks): Clear m_mayBeExecuting for all currently executing
CodeBlocks because we no longer always do this at the beginning of EdenCollections.
* heap/CodeBlockSet.h:
(JSC::CodeBlockSet::iterate):
* heap/Heap.cpp:
(JSC::Heap::markRoots):
(JSC::Heap::deleteAllCompiledCode):
(JSC::Heap::deleteUnmarkedCompiledCode):
* runtime/Executable.cpp:
(JSC::ScriptExecutable::installCode): Write barrier code on installation. We do this due to the following situation:
a) A CodeBlock is created and is compiled on a DFG worker thread.
b) No GC happens.
c) The CodeBlock has finished being compiled and is installed in the Executable.
d) The function never executes before the next GC.
e) The next GC needs needs to visit the new CodeBlock but the Executable won't be revisited unless
    it's added to the remembered set.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166678 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Page should use std::unique_ptr for PointerLockController
https://bugs.webkit.org/show_bug.cgi?id=131098

Reviewed by Anders Carlsson.

Make Page keep a std::unique_ptr to PointerLockController. Store page
references and return controller references where possible.

* dom/Document.cpp:
(WebCore::Document::prepareForDestruction):
(WebCore::Document::webkitExitPointerLock):
(WebCore::Document::webkitPointerLockElement):
* dom/Element.cpp:
(WebCore::Element::removedFrom):
(WebCore::Element::webkitRequestPointerLock):
* page/Page.cpp:
(WebCore::Page::Page):
* page/Page.h:
(WebCore::Page::pointerLockController):
* page/PointerLockController.cpp:
(WebCore::PointerLockController::PointerLockController):
(WebCore::PointerLockController::requestPointerLock):
(WebCore::PointerLockController::requestPointerUnlock):
(WebCore::PointerLockController::create): Deleted.
* page/PointerLockController.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore: Roll out http://trac.webkit.org/changeset/166144
<rdar://problem/16481284> PLT stops loading on news.google.com

Unreviewed rollout.

Rollout 166144 since it prevents the PLT from completing.

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::suspendPostAttachCallbacks):
(WebCore::ContainerNode::resumePostAttachCallbacks):
(WebCore::ContainerNode::queuePostAttachCallback):
(WebCore::ContainerNode::postAttachCallbacksAreSuspended):
(WebCore::ContainerNode::dispatchPostAttachCallbacks):
* dom/ContainerNode.h:
* dom/Document.cpp:
(WebCore::Document::recalcStyle):
* dom/Element.h:
(WebCore::PostAttachCallbackDisabler::PostAttachCallbackDisabler):
(WebCore::PostAttachCallbackDisabler::~PostAttachCallbackDisabler):
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::parseAttribute):
* html/HTMLFormControlElement.cpp:
(WebCore::focusPostAttach):
(WebCore::HTMLFormControlElement::didAttachRenderers):
(WebCore::updateFromElementCallback):
(WebCore::HTMLFormControlElement::didRecalcStyle):
* html/HTMLFrameOwnerElement.cpp:
(WebCore::needsStyleRecalcCallback):
(WebCore::HTMLFrameOwnerElement::scheduleSetNeedsStyleRecalc):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::parseAttribute):
(WebCore::HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk):
(WebCore::HTMLObjectElement::hasValidClassId):
(WebCore::HTMLObjectElement::renderFallbackContent):
* html/HTMLObjectElement.h:
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement):
(WebCore::HTMLPlugInImageElement::createElementRenderer):
(WebCore::HTMLPlugInImageElement::didAttachRenderers):
(WebCore::HTMLPlugInImageElement::willDetachRenderers):
(WebCore::HTMLPlugInImageElement::updateWidgetIfNecessary):
(WebCore::HTMLPlugInImageElement::didMoveToNewDocument):
(WebCore::HTMLPlugInImageElement::updateWidgetCallback):
(WebCore::HTMLPlugInImageElement::startLoadingImage):
(WebCore::HTMLPlugInImageElement::startLoadingImageCallback):
(WebCore::HTMLPlugInImageElement::createShadowIFrameSubtree):
(WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn):
(WebCore::HTMLPlugInImageElement::didRecalcStyle): Deleted.
(WebCore::HTMLPlugInImageElement::scheduleUpdateForAfterStyleResolution): Deleted.
(WebCore::HTMLPlugInImageElement::updateAfterStyleResolution): Deleted.
(WebCore::HTMLPlugInImageElement::removedFrom): Deleted.
(WebCore::is100Percent): Deleted.
(WebCore::HTMLPlugInImageElement::setNeedsImageReload): Deleted.
* html/HTMLPlugInImageElement.h:
(WebCore::HTMLPlugInImageElement::imageLoader): Deleted.
(WebCore::HTMLPlugInImageElement::updateImageLoaderWithNewURLSoon): Deleted.
* style/StyleResolveTree.cpp:
(WebCore::Style::needsPseudeElement):
(WebCore::Style::attachBeforeOrAfterPseudoElementIfNeeded):
(WebCore::Style::attachRenderTree):
(WebCore::Style::updateBeforeOrAfterPseudoElement):
(WebCore::Style::needsPseudoElement): Deleted.
(WebCore::Style::postResolutionCallbackQueue): Deleted.
(WebCore::Style::queuePostResolutionCallback): Deleted.
(WebCore::Style::suspendMemoryCacheClientCalls): Deleted.
(WebCore::Style::PostResolutionCallbackDisabler::PostResolutionCallbackDisabler): Deleted.
(WebCore::Style::PostResolutionCallbackDisabler::~PostResolutionCallbackDisabler): Deleted.
(WebCore::Style::postResolutionCallbacksAreSuspended): Deleted.
* style/StyleResolveTree.h:

Source/WebKit/mac: Roll out http://trac.webkit.org/changeset/166144
<rdar://problem/16481284> PLT stops loading on news.google.com

Unreviewed rollout.

Rollout 166144 since it prevents the PLT from completing.

* WebCoreSupport/WebFrameLoaderClient.mm:

LayoutTests: Roll out http://trac.webkit.org/changeset/166144
<rdar://problem/16481284> PLT stops loading on news.google.com

Unreviewed rollout.

Rollout 166144 since it prevents the PLT from completing.

* plugins/plugin-remove-readystatechange-expected.txt:
* plugins/plugin-remove-readystatechange.html:
* svg/custom/object-no-size-attributes-expected.txt:
* svg/custom/object-no-size-attributes.xhtml:

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