Fix build after r157457 for architecture with 4 argument registers.
https://bugs.webkit.org/show_bug.cgi?id=122860

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

* jit/CCallHelpers.h:
(JSC::CCallHelpers::setupStubArguments134):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157467 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ObjCCallbackFunctionImpl shouldn't store a JSContext
https://bugs.webkit.org/show_bug.cgi?id=122531

Reviewed by Geoffrey Garen.

The m_context field in ObjCCallbackFunctionImpl is vestigial and is only incidentally correct
in the common case. It's also no longer necessary in that we can look up the current JSContext
by looking using the globalObject of the callee when the function callback is invoked.

Also added a new test that would cause us to crash previously. The test required making
JSContextGetGlobalContext public API so that clients can obtain a JSContext from the JSContextRef
in C API callbacks.

* API/JSContextRef.h:
* API/JSContextRefPrivate.h:
* API/ObjCCallbackFunction.mm:
(JSC::ObjCCallbackFunctionImpl::ObjCCallbackFunctionImpl):
(JSC::objCCallbackFunctionCallAsFunction):
(objCCallbackFunctionForInvocation):
* API/WebKitAvailability.h:
* API/tests/CurrentThisInsideBlockGetterTest.h: Added.
* API/tests/CurrentThisInsideBlockGetterTest.mm: Added.
(CallAsConstructor):
(ConstructorFinalize):
(ConstructorClass):
(+[JSValue valueWithConstructorDescriptor:inContext:]):
(-[JSContext valueWithConstructorDescriptor:]):
(currentThisInsideBlockGetterTest):
* API/tests/testapi.mm:
* JavaScriptCore.xcodeproj/project.pbxproj:
* debugger/Debugger.cpp: Had to add some fully qualified names to avoid conflicts with Mac OS X headers.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157468 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add a skeleton Database process for future usage by Indexed Database.
https://bugs.webkit.org/show_bug.cgi?id=122849

Reviewed by Sam Weinig.

This mostly our typical "Add a new process type" boilerplate.

* Configurations/DatabaseProcess.xcconfig: Added.
* Configurations/DatabaseService.Development.xcconfig: Added.
* Configurations/DatabaseService.xcconfig: Added.
* WebKit2.xcodeproj/project.pbxproj:
* WebKit2Prefix.h:

* DatabaseProcess/DatabaseProcess.cpp: Added.
(WebKit::DatabaseProcess::shared):
(WebKit::DatabaseProcess::DatabaseProcess):
(WebKit::DatabaseProcess::~DatabaseProcess):
(WebKit::DatabaseProcess::initializeConnection):
(WebKit::DatabaseProcess::shouldTerminate):
(WebKit::DatabaseProcess::didReceiveMessage):
(WebKit::DatabaseProcess::didClose):
(WebKit::DatabaseProcess::didReceiveInvalidMessage):
(WebKit::DatabaseProcess::initializeProcess):
(WebKit::DatabaseProcess::initializeProcessName):
(WebKit::DatabaseProcess::initializeSandbox):
* DatabaseProcess/DatabaseProcess.h: Added.

* DatabaseProcess/EntryPoint/mac/LegacyProcess/DatabaseProcessMain.mm: Added.
(DatabaseProcessMain):
* DatabaseProcess/EntryPoint/mac/LegacyProcess/Info.plist: Added.
* DatabaseProcess/EntryPoint/mac/XPCService/DatabaseService.Development/Info.plist: Added.
* DatabaseProcess/EntryPoint/mac/XPCService/DatabaseService/Info.plist: Added.
* DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm: Added.
(DatabaseServiceInitializer):

* DatabaseProcess/mac/DatabaseProcessMac.mm: Added.
(WebKit::DatabaseProcess::initializeProcess):
(WebKit::DatabaseProcess::initializeProcessName):
(WebKit::DatabaseProcess::initializeSandbox):
* UIProcess/Databases/DatabaseProcessProxy.cpp: Added.
(WebKit::DatabaseProcessProxy::create):
(WebKit::DatabaseProcessProxy::DatabaseProcessProxy):
(WebKit::DatabaseProcessProxy::~DatabaseProcessProxy):
(WebKit::DatabaseProcessProxy::getLaunchOptions):
(WebKit::DatabaseProcessProxy::connectionWillOpen):
(WebKit::DatabaseProcessProxy::connectionWillClose):
(WebKit::DatabaseProcessProxy::didReceiveMessage):
(WebKit::DatabaseProcessProxy::didClose):
(WebKit::DatabaseProcessProxy::didReceiveInvalidMessage):
(WebKit::DatabaseProcessProxy::didFinishLaunching):
* UIProcess/Databases/DatabaseProcessProxy.h: Added.
* UIProcess/Databases/mac/DatabaseProcessProxyMac.mm: Added.
(WebKit::shouldUseXPC):
(WebKit::DatabaseProcessProxy::platformGetLaunchOptions):

* UIProcess/Launcher/ProcessLauncher.cpp:
(WebKit::ProcessLauncher::processTypeAsString):
(WebKit::ProcessLauncher::getProcessTypeFromString):
* UIProcess/Launcher/ProcessLauncher.h:
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::serviceName):
(WebKit::createProcess):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157469 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION: Crash in XMLDocumentParser::startElementNs
https://bugs.webkit.org/show_bug.cgi?id=122817

Reviewed by Darin Adler.

Source/WebCore: 

Exit early in startElementNs when listeners and handlers of synchronous events such as load event
removes the inserted node inside parserAppendChild.

Test: fast/parser/xhtml-synchronous-detach-crash.html

* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::startElementNs):

LayoutTests: 

Add a regression test from https://chromium.googlesource.com/chromium/blink/+/57afab5d21cccd89f032b9a3e62f3a61c6a0e9c2

* fast/parser/resources/remove-parent.xhtml: Added.
* fast/parser/xhtml-synchronous-detach-crash-expected.txt: Added.
* fast/parser/xhtml-synchronous-detach-crash.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157470 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix 3 operand sub operation in C loop LLINT.
https://bugs.webkit.org/show_bug.cgi?id=122866.

Reviewed by Geoffrey Garen.

* offlineasm/cloop.rb:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157473 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS] Upstream JavaScriptCore support for ARM64
https://bugs.webkit.org/show_bug.cgi?id=122762

Source/JavaScriptCore:

Reviewed by Oliver Hunt and Filip Pizlo.

* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:
* Configurations/JavaScriptCore.xcconfig:
* Configurations/ToolExecutable.xcconfig:
* JavaScriptCore.xcodeproj/project.pbxproj:
* assembler/ARM64Assembler.h: Added.
* assembler/AbstractMacroAssembler.h:
(JSC::isARM64):
(JSC::AbstractMacroAssembler::Label::Label):
(JSC::AbstractMacroAssembler::Jump::Jump):
(JSC::AbstractMacroAssembler::Jump::link):
(JSC::AbstractMacroAssembler::Jump::linkTo):
(JSC::AbstractMacroAssembler::CachedTempRegister::CachedTempRegister):
(JSC::AbstractMacroAssembler::CachedTempRegister::registerIDInvalidate):
(JSC::AbstractMacroAssembler::CachedTempRegister::registerIDNoInvalidate):
(JSC::AbstractMacroAssembler::CachedTempRegister::value):
(JSC::AbstractMacroAssembler::CachedTempRegister::setValue):
(JSC::AbstractMacroAssembler::CachedTempRegister::invalidate):
(JSC::AbstractMacroAssembler::invalidateAllTempRegisters):
(JSC::AbstractMacroAssembler::isTempRegisterValid):
(JSC::AbstractMacroAssembler::clearTempRegisterValid):
(JSC::AbstractMacroAssembler::setTempRegisterValid):
* assembler/LinkBuffer.cpp:
(JSC::LinkBuffer::copyCompactAndLinkCode):
(JSC::LinkBuffer::linkCode):
* assembler/LinkBuffer.h:
* assembler/MacroAssembler.h:
(JSC::MacroAssembler::isPtrAlignedAddressOffset):
(JSC::MacroAssembler::pushToSave):
(JSC::MacroAssembler::popToRestore):
(JSC::MacroAssembler::patchableBranchTest32):
* assembler/MacroAssemblerARM64.h: Added.
* assembler/MacroAssemblerARMv7.h:
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGOSRExitCompiler32_64.cpp:
(JSC::DFG::OSRExitCompiler::compileExit):
* dfg/DFGOSRExitCompiler64.cpp:
(JSC::DFG::OSRExitCompiler::compileExit):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileArithDiv):
(JSC::DFG::SpeculativeJIT::compileArithMod):
* disassembler/ARM64/A64DOpcode.cpp: Added.
* disassembler/ARM64/A64DOpcode.h: Added.
* disassembler/ARM64Disassembler.cpp: Added.
* heap/MachineStackMarker.cpp:
(JSC::getPlatformThreadRegisters):
(JSC::otherThreadStackPointer):
* heap/Region.h:
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::debugCall):
* jit/CCallHelpers.h:
* jit/ExecutableAllocator.h:
* jit/FPRInfo.h:
(JSC::FPRInfo::toRegister):
(JSC::FPRInfo::toIndex):
(JSC::FPRInfo::debugName):
* jit/GPRInfo.h:
(JSC::GPRInfo::toRegister):
(JSC::GPRInfo::toIndex):
(JSC::GPRInfo::debugName):
* jit/JITInlines.h:
(JSC::JIT::restoreArgumentReferenceForTrampoline):
* jit/JITOperationWrappers.h:
* jit/JITOperations.cpp:
* jit/JITStubs.cpp:
(JSC::performPlatformSpecificJITAssertions):
(JSC::tryCachePutByID):
* jit/JITStubs.h:
(JSC::JITStackFrame::returnAddressSlot):
* jit/JITStubsARM64.h: Added.
* jit/JSInterfaceJIT.h:
* jit/Repatch.cpp:
(JSC::emitRestoreScratch):
(JSC::generateProtoChainAccessStub):
(JSC::tryCacheGetByID):
(JSC::emitPutReplaceStub):
(JSC::tryCachePutByID):
(JSC::tryRepatchIn):
* jit/ScratchRegisterAllocator.h:
(JSC::ScratchRegisterAllocator::preserveReusedRegistersByPushing):
(JSC::ScratchRegisterAllocator::restoreReusedRegistersByPopping):
* jit/ThunkGenerators.cpp:
(JSC::nativeForGenerator):
(JSC::floorThunkGenerator):
(JSC::ceilThunkGenerator):
* jsc.cpp:
(main):
* llint/LLIntOfflineAsmConfig.h:
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::handleHostCall):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter64.asm:
* offlineasm/arm.rb:
* offlineasm/arm64.rb: Added.
* offlineasm/backends.rb:
* offlineasm/instructions.rb:
* offlineasm/risc.rb:
* offlineasm/transform.rb:
* yarr/YarrJIT.cpp:
(JSC::Yarr::YarrGenerator::alignCallFrameSizeInBytes):
(JSC::Yarr::YarrGenerator::initCallFrame):
(JSC::Yarr::YarrGenerator::removeCallFrame):
(JSC::Yarr::YarrGenerator::generateEnter):
* yarr/YarrJIT.h:

Source/WTF:

Reviewed by Oliver Hunt.

* Configurations/Base.xcconfig:
* wtf/Atomics.h:
(WTF::weakCompareAndSwap):
(WTF::armV7_dmb):
* wtf/FastMalloc.cpp:
* wtf/Platform.h:
* wtf/dtoa.cpp:
* wtf/dtoa/utils.h:
* wtf/text/ASCIIFastPath.h:
(WTF::copyLCharsFromUCharSource):
* wtf/text/StringImpl.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157474 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[sh4] Some calls don't match sh4 ABI.
https://bugs.webkit.org/show_bug.cgi?id=122863

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

* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::callOperation):
* jit/CCallHelpers.h:
(JSC::CCallHelpers::setupArgumentsWithExecState):
* jit/JITInlines.h:
(JSC::JIT::callOperation):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157475 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move WebProcess/IndexedDB to WebProcess/Databases/IndexedDB

Rubberstamped by Alexey Proskuryakov.

* CMakeLists.txt:
* GNUmakefile.list.am:
* WebKit2.xcodeproj/project.pbxproj:

* WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp: Renamed from Source/WebKit2/WebProcess/IndexedDB/WebIDBFactoryBackend.cpp.
* WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h: Renamed from Source/WebKit2/WebProcess/IndexedDB/WebIDBFactoryBackend.h.

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