[Mac] Leak: dispatch_semaphore leak allocated in MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange
https://bugs.webkit.org/show_bug.cgi?id=129792

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2014-03-06
Reviewed by Anders Carlsson.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165195 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Clarify how we deal with "special" registers
https://bugs.webkit.org/show_bug.cgi?id=129806

Reviewed by Michael Saboff.
        
Previously we had two different places that defined what "stack" registers are, a thing
called "specialRegisters" that had unclear meaning, and a really weird "firstRealRegister"/
"secondRealRegister"/"nextRegister" idiom in MacroAssembler that appeared to only be used by
one place and had a baked-in notion of what it meant for a register to be "real" or not.
        
It's not cool to use words like "real" and "special" to describe registers, especially if you
fail to qualify what that means. This originally made sense on X86 - "real" registers were
the ones that weren't "stack related" (so "real" was the opposite of "stack"). But on ARM64,
you also have to worry about the LR register, which we'd want to say is "not real" but it's
also not a "stack" register. This got super confusing.
        
So, this patch removes any mention of "real" registers, consolidates the knowledge of what is
a "stack" register, and uses the word special only in places where it's clearly defined and
where no better word comes to mind.
        
This cleans up the code and fixes what seems like it was probably a harmless ARM64 bug: the
Reg and RegisterSet data structures would sometimes think that FP was Q0. Somehow this
magically didn't break anything because you never need to save/restore either FP or Q0, but
it was still super weird.

* assembler/ARM64Assembler.h:
(JSC::ARM64Assembler::lastRegister):
* assembler/MacroAssembler.h:
(JSC::MacroAssembler::nextRegister):
* ftl/FTLLocation.cpp:
(JSC::FTL::Location::restoreInto):
* ftl/FTLSaveRestore.cpp:
(JSC::FTL::saveAllRegisters):
(JSC::FTL::restoreAllRegisters):
* ftl/FTLSlowPathCall.cpp:
* jit/RegisterSet.cpp:
(JSC::RegisterSet::reservedHardwareRegisters):
(JSC::RegisterSet::runtimeRegisters):
(JSC::RegisterSet::specialRegisters):
(JSC::RegisterSet::calleeSaveRegisters):
* jit/RegisterSet.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Drop unlinked function code on memory pressure.
<https://webkit.org/b/129789>

Make VM::discardAllCode() also drop UnlinkedFunctionCodeBlocks that
are not currently being compiled.

4.5 MB progression on Membuster.

Reviewed by Geoffrey Garen.

* heap/Heap.cpp:
(JSC::Heap::deleteAllUnlinkedFunctionCode):
* heap/Heap.h:
* runtime/VM.cpp:
(JSC::VM::discardAllCode):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165197 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix the !ENABLE(CSS_STICKY_POSITION) build
https://bugs.webkit.org/show_bug.cgi?id=129793

Patch by Zsolt Borbely <borbezs@inf.u-szeged.hu> on 2014-03-06
Reviewed by Simon Fraser.

Add missing ENABLE(CSS_STICKY_POSITION) guard to EditingStyle::convertPositionStyle().

* editing/EditingStyle.cpp:
(WebCore::EditingStyle::convertPositionStyle):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165198 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Expose the console object in JSContexts to interact with Web Inspector
https://bugs.webkit.org/show_bug.cgi?id=127944

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Always expose the Console object in JSContexts, just like we
do for web pages. The default behavior will route to an
attached JSContext inspector. This can be overriden by
setting the ConsoleClient on the JSGlobalObject, which WebCore
does to get slightly different behavior.

* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
Update build systems.

* API/tests/testapi.js:
* API/tests/testapi.mm:
Test that "console" exists in C and ObjC contexts.

* runtime/ConsoleClient.cpp: Added.
(JSC::ConsoleClient::printURLAndPosition):
(JSC::ConsoleClient::printMessagePrefix):
(JSC::ConsoleClient::printConsoleMessage):
(JSC::ConsoleClient::printConsoleMessageWithArguments):
(JSC::ConsoleClient::internalMessageWithTypeAndLevel):
(JSC::ConsoleClient::logWithLevel):
(JSC::ConsoleClient::clear):
(JSC::ConsoleClient::dir):
(JSC::ConsoleClient::dirXML):
(JSC::ConsoleClient::table):
(JSC::ConsoleClient::trace):
(JSC::ConsoleClient::assertCondition):
(JSC::ConsoleClient::group):
(JSC::ConsoleClient::groupCollapsed):
(JSC::ConsoleClient::groupEnd):
* runtime/ConsoleClient.h: Added.
(JSC::ConsoleClient::~ConsoleClient):
New private interface for handling the console object's methods.
A lot of the methods funnel through messageWithTypeAndLevel.

* runtime/ConsoleTypes.h: Renamed from Source/JavaScriptCore/inspector/ConsoleTypes.h.
Moved to JSC namespace.

* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::JSGlobalObject):
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::reset):
(JSC::JSGlobalObject::visitChildren):
Create the "console" object when initializing the environment.
Also set the default console client to be the JS context inspector.

* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::setConsoleClient):
(JSC::JSGlobalObject::consoleClient):
Ability to change the console client, so WebCore can set a custom client.

* runtime/ConsolePrototype.cpp: Added.
(JSC::ConsolePrototype::finishCreation):
(JSC::valueToStringWithUndefinedOrNullCheck):
(JSC::consoleLogWithLevel):
(JSC::consoleProtoFuncDebug):
(JSC::consoleProtoFuncError):
(JSC::consoleProtoFuncLog):
(JSC::consoleProtoFuncWarn):
(JSC::consoleProtoFuncClear):
(JSC::consoleProtoFuncDir):
(JSC::consoleProtoFuncDirXML):
(JSC::consoleProtoFuncTable):
(JSC::consoleProtoFuncTrace):
(JSC::consoleProtoFuncAssert):
(JSC::consoleProtoFuncCount):
(JSC::consoleProtoFuncProfile):
(JSC::consoleProtoFuncProfileEnd):
(JSC::consoleProtoFuncTime):
(JSC::consoleProtoFuncTimeEnd):
(JSC::consoleProtoFuncTimeStamp):
(JSC::consoleProtoFuncGroup):
(JSC::consoleProtoFuncGroupCollapsed):
(JSC::consoleProtoFuncGroupEnd):
* runtime/ConsolePrototype.h: Added.
(JSC::ConsolePrototype::create):
(JSC::ConsolePrototype::createStructure):
(JSC::ConsolePrototype::ConsolePrototype):
Define the console object interface. Parse out required / expected
arguments and throw expcetions when methods are misused.

* runtime/JSConsole.cpp: Added.
* runtime/JSConsole.h: Added.
(JSC::JSConsole::createStructure):
(JSC::JSConsole::create):
(JSC::JSConsole::JSConsole):
Empty "console" object. Everything is in the prototype.

* inspector/JSConsoleClient.cpp: Added.
(Inspector::JSConsoleClient::JSGlobalObjectConsole):
(Inspector::JSConsoleClient::count):
(Inspector::JSConsoleClient::profile):
(Inspector::JSConsoleClient::profileEnd):
(Inspector::JSConsoleClient::time):
(Inspector::JSConsoleClient::timeEnd):
(Inspector::JSConsoleClient::timeStamp):
(Inspector::JSConsoleClient::warnUnimplemented):
(Inspector::JSConsoleClient::internalAddMessage):
* inspector/JSConsoleClient.h: Added.
* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
(Inspector::JSGlobalObjectInspectorController::consoleClient):
* inspector/JSGlobalObjectInspectorController.h:
Default JSContext ConsoleClient implementation. Handle nearly
everything exception profile/profileEnd and timeStamp.

Source/WebCore:

Covered by existing tests.

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* ForwardingHeaders/runtime/ConsoleClient.h: Added.
* ForwardingHeaders/runtime/ConsoleTypes.h: Renamed from Source/WebCore/ForwardingHeaders/inspector/ConsoleTypes.h.
* GNUmakefile.list.am:
* PlatformGTK.cmake:
* WebCore.exp.in:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* bindings/gobject/GNUmakefile.am:
Update build systems.

* page/Console.cpp: Removed.
* page/Console.h: Removed.
* page/Console.idl: Removed.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::~DOMWindow):
(WebCore::DOMWindow::resetDOMWindowProperties):
* page/DOMWindow.h:
(WebCore::DOMWindow::defaultStatus):
* page/DOMWindow.idl:
Removed the old IDL generated Console object on window.

* page/PageConsole.cpp:
(WebCore::PageConsole::shouldPrintExceptions):
(WebCore::PageConsole::setShouldPrintExceptions):
(WebCore::PageConsole::mute):
(WebCore::PageConsole::unmute):
(WebCore::PageConsole::messageWithTypeAndLevel):
(WebCore::PageConsole::count):
(WebCore::PageConsole::profile):
(WebCore::PageConsole::profileEnd):
(WebCore::PageConsole::time):
(WebCore::PageConsole::timeEnd):
(WebCore::PageConsole::timeStamp):
(WebCore::PageConsole::group):
(WebCore::PageConsole::groupCollapsed):
(WebCore::PageConsole::groupEnd):
(WebCore::PageConsole::clearProfiles):
* page/PageConsole.h:
Move the handling of Console object into PageConsole.

* bindings/js/ScriptCachedFrameData.cpp:
(WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
(WebCore::ScriptCachedFrameData::restore):
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::clearWindowShell):
(WebCore::ScriptController::initScript):
Set the PageConsole as the ConsoleClient of the JSGlobalObject
so that WebCore may handle console messages directly. For instance
it may pass messages on to the ChromeClient.

* testing/Internals.cpp:
(WebCore::Internals::consoleProfiles):
To access profiles, go through PageConsole now instead of Console.

* bindings/js/JSDOMWindowBase.cpp:
* bindings/objc/WebScriptObject.mm:
* css/MediaList.cpp:
* dom/ScriptExecutionContext.h:
* dom/UIEvent.cpp:
* dom/ViewportArguments.cpp:
* html/parser/XSSAuditorDelegate.cpp:
* inspector/CommandLineAPIHost.h:
* inspector/InspectorInstrumentation.cpp:
* inspector/InspectorInstrumentation.h:
* inspector/InspectorProfilerAgent.cpp:
* inspector/WebConsoleAgent.cpp:
* loader/FrameLoader.cpp:
* loader/MixedContentChecker.cpp:
* loader/appcache/ApplicationCacheGroup.cpp:
* loader/cache/CachedResourceLoader.cpp:
* page/ChromeClient.h:
* page/ContentSecurityPolicy.cpp:
* page/Page.cpp:
* page/Page.h:
* svg/SVGDocumentExtensions.cpp:
* workers/WorkerMessagingProxy.cpp:
* workers/WorkerReportingProxy.h:
Update includes.

Source/WebKit/gtk:

* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::addMessageToConsole):
Update namespaces.

Source/WebKit/mac:

* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:
Update namespaces.

Source/WebKit/win:

* WebCoreSupport/WebChromeClient.h:
Update namespaces.

Source/WebKit/wince:

* WebCoreSupport/ChromeClientWinCE.h:
Update namespaces.

Source/WebKit2:

* WebProcess/WebCoreSupport/WebChromeClient.h:
Update namespaces.

LayoutTests:

* http/tests/security/cross-frame-access-getOwnPropertyDescriptor-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165199 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed follow-up fix for Windows for r165199.

Reviewed by NOBODY (OOPS!).

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix write barriers in Repatch.cpp for !ENABLE(DFG_JIT) platforms after r165128
https://bugs.webkit.org/show_bug.cgi?id=129760

Reviewed by Geoffrey Garen.

r165128 disabled the write barrier fast path for inline caches on !ENABLE(DFG_JIT) platforms.
The fix is to refactor the write barrier code into AssemblyHelpers and use that everywhere.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::writeBarrier):
* dfg/DFGSpeculativeJIT.h:
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::writeBarrier):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::writeBarrier):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::checkMarkByte):
* jit/JIT.h:
* jit/JITPropertyAccess.cpp:
* jit/Repatch.cpp:
(JSC::writeBarrier):


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