[WK2] Add support for image document viewport configuration
https://bugs.webkit.org/show_bug.cgi?id=128565

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-02-10
Reviewed by Simon Fraser.

Source/WebCore: 

Add proper default settings for displaying images.

* WebCore.exp.in:
* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::imageDocumentParameters):
(WebCore::ViewportConfiguration::textDocumentParameters):
* page/ViewportConfiguration.h:

Source/WebKit2: 

* UIProcess/API/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::screenToWindow):
(WebKit::PageClientImpl::windowToScreen):
Add the implementation for ImageDocument.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad):
Use the right default settings when dealing with image documents.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163839 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Update aspect-ratio property to have constraining keywords
https://bugs.webkit.org/show_bug.cgi?id=128262

Reviewed by Simon Fraser.

Source/WebCore:

Add support for "from-dimensions" and "from-intrinsic"
property values to "-webkit-aspect-ratio". I also changed
the default value from "none" to "auto", because "none" doesn't
make sense any more.

Covered by enhancing existing tests.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue): New keywords.
* css/CSSParser.cpp:
(WebCore::CSSParser::parseAspectRatio): Support new keywords.
* css/CSSValueKeywords.in: Add from-dimensions and from-intrinsic.
* css/DeprecatedStyleBuilder.cpp: This now has to handle the new
values. I also changed "none" to "auto".
(WebCore::ApplyPropertyAspectRatio::applyInheritValue):
(WebCore::ApplyPropertyAspectRatio::applyInitialValue):
(WebCore::ApplyPropertyAspectRatio::applyValue):
* rendering/style/RenderStyle.h: hasAspectRatio is now aspectRatioType
and indicates one of the three keywords, or a specified number.
* rendering/style/RenderStyleConstants.h: New enum.
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):
* rendering/style/StyleRareNonInheritedData.h:

LayoutTests:

Add tests for new from-intrinsic and from-dimensions
property values.

* fast/css/aspect-ratio-inheritance-expected.txt:
* fast/css/aspect-ratio-inheritance.html:
* fast/css/aspect-ratio-parsing-tests-expected.txt:
* fast/css/aspect-ratio-parsing-tests.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163840 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ReallocatePropertyStorage in FTL
https://bugs.webkit.org/show_bug.cgi?id=128352

Patch by Matthew Mirman <mmirman@apple.com> on 2014-02-10
Reviewed by Filip Pizlo.

* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLIntrinsicRepository.h:
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileReallocatePropertyStorage):
* tests/stress/ftl-reallocatepropertystorage.js: Added.
(foo):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163841 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Rename getRecordMap to computeRecordMap.

Rubber stamped by Michael Saboff.
        
"get" is such a weird prefix. It implies a getter. We don't prefix our getters with
anything in WebKit. Also, this isn't a getter. It actually does work to transform
the stackmaps into a hashmap. So, computeRecordMap is a much better name.

* ftl/FTLCompile.cpp:
(JSC::FTL::compile):
* ftl/FTLJITFinalizer.cpp:
(JSC::FTL::JITFinalizer::finalizeFunction):
* ftl/FTLStackMaps.cpp:
(JSC::FTL::StackMaps::computeRecordMap):
* ftl/FTLStackMaps.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163842 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Removes the inline assert from SpeculativeJIT's ReallocatePropertyStorage
https://bugs.webkit.org/show_bug.cgi?id=128566

Patch by Matthew Mirman <mmirman@apple.com> on 2014-02-10
Reviewed by Filip Pizlo.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163843 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Rename Operations.h to JSCInlines.h
https://bugs.webkit.org/show_bug.cgi?id=128543

Source/JavaScriptCore: 

Rubber stamped by Geoffrey Garen.
        
Well, what this actually does is it splits Operations.h into a real Operations.h that
actually contains "operations", and JSCInlines.h, which serves the role of being an
inlines umbrella.
        
* API/JSBase.cpp:
* API/JSCTestRunnerUtils.cpp:
* API/JSCallbackConstructor.cpp:
* API/JSCallbackFunction.cpp:
* API/JSCallbackObject.cpp:
* API/JSClassRef.cpp:
* API/JSContext.mm:
* API/JSContextRef.cpp:
* API/JSManagedValue.mm:
* API/JSObjectRef.cpp:
* API/JSScriptRef.cpp:
* API/JSValue.mm:
* API/JSValueRef.cpp:
* API/JSWeakObjectMapRefPrivate.cpp:
* API/JSWrapperMap.mm:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* assembler/LinkBuffer.cpp:
* bindings/ScriptFunctionCall.cpp:
* bindings/ScriptObject.cpp:
* bytecode/ArrayAllocationProfile.cpp:
* bytecode/ArrayProfile.cpp:
* bytecode/BytecodeBasicBlock.cpp:
* bytecode/CallLinkInfo.cpp:
* bytecode/CallLinkStatus.cpp:
* bytecode/CodeBlock.cpp:
* bytecode/CodeBlockJettisoningWatchpoint.cpp:
* bytecode/CodeOrigin.cpp:
* bytecode/ExecutionCounter.cpp:
* bytecode/GetByIdStatus.cpp:
* bytecode/LazyOperandValueProfile.cpp:
* bytecode/MethodOfGettingAValueProfile.cpp:
* bytecode/PreciseJumpTargets.cpp:
* bytecode/ProfiledCodeBlockJettisoningWatchpoint.cpp:
* bytecode/PutByIdStatus.cpp:
* bytecode/SamplingTool.cpp:
* bytecode/SpecialPointer.cpp:
* bytecode/SpeculatedType.cpp:
* bytecode/StructureStubClearingWatchpoint.cpp:
* bytecode/UnlinkedCodeBlock.cpp:
* bytecode/ValueRecovery.cpp:
* bytecompiler/BytecodeGenerator.cpp:
* bytecompiler/NodesCodegen.cpp:
* debugger/Debugger.cpp:
* debugger/DebuggerActivation.cpp:
* debugger/DebuggerCallFrame.cpp:
* dfg/DFGAbstractHeap.cpp:
* dfg/DFGAbstractValue.cpp:
* dfg/DFGArgumentsSimplificationPhase.cpp:
* dfg/DFGArithMode.cpp:
* dfg/DFGArrayMode.cpp:
* dfg/DFGAtTailAbstractState.cpp:
* dfg/DFGAvailability.cpp:
* dfg/DFGBackwardsPropagationPhase.cpp:
* dfg/DFGBasicBlock.cpp:
* dfg/DFGBinarySwitch.cpp:
* dfg/DFGBlockInsertionSet.cpp:
* dfg/DFGByteCodeParser.cpp:
* dfg/DFGCFAPhase.cpp:
* dfg/DFGCFGSimplificationPhase.cpp:
* dfg/DFGCPSRethreadingPhase.cpp:
* dfg/DFGCSEPhase.cpp:
* dfg/DFGCapabilities.cpp:
* dfg/DFGClobberSet.cpp:
* dfg/DFGClobberize.cpp:
* dfg/DFGCommon.cpp:
* dfg/DFGCommonData.cpp:
* dfg/DFGCompilationKey.cpp:
* dfg/DFGCompilationMode.cpp:
* dfg/DFGConstantFoldingPhase.cpp:
* dfg/DFGCriticalEdgeBreakingPhase.cpp:
* dfg/DFGDCEPhase.cpp:
* dfg/DFGDesiredIdentifiers.cpp:
* dfg/DFGDesiredStructureChains.cpp:
* dfg/DFGDesiredTransitions.cpp:
* dfg/DFGDesiredWatchpoints.cpp:
* dfg/DFGDesiredWeakReferences.cpp:
* dfg/DFGDesiredWriteBarriers.cpp:
* dfg/DFGDisassembler.cpp:
* dfg/DFGDominators.cpp:
* dfg/DFGDriver.cpp:
* dfg/DFGEdge.cpp:
* dfg/DFGFailedFinalizer.cpp:
* dfg/DFGFinalizer.cpp:
* dfg/DFGFixupPhase.cpp:
* dfg/DFGFlushFormat.cpp:
* dfg/DFGFlushLivenessAnalysisPhase.cpp:
* dfg/DFGFlushedAt.cpp:
* dfg/DFGGraph.cpp:
* dfg/DFGGraphSafepoint.cpp:
* dfg/DFGInPlaceAbstractState.cpp:
* dfg/DFGInvalidationPointInjectionPhase.cpp:
* dfg/DFGJITCode.cpp:
* dfg/DFGJITCompiler.cpp:
* dfg/DFGJITFinalizer.cpp:
* dfg/DFGJumpReplacement.cpp:
* dfg/DFGLICMPhase.cpp:
* dfg/DFGLazyJSValue.cpp:
* dfg/DFGLivenessAnalysisPhase.cpp:
* dfg/DFGLongLivedState.cpp:
* dfg/DFGLoopPreHeaderCreationPhase.cpp:
* dfg/DFGMinifiedNode.cpp:
* dfg/DFGNaturalLoops.cpp:
* dfg/DFGNode.cpp:
* dfg/DFGNodeFlags.cpp:
* dfg/DFGOSRAvailabilityAnalysisPhase.cpp:
* dfg/DFGOSREntry.cpp:
* dfg/DFGOSREntrypointCreationPhase.cpp:
* dfg/DFGOSRExit.cpp:
* dfg/DFGOSRExitBase.cpp:
* dfg/DFGOSRExitCompiler.cpp:
* dfg/DFGOSRExitCompiler32_64.cpp:
* dfg/DFGOSRExitCompiler64.cpp:
* dfg/DFGOSRExitCompilerCommon.cpp:
* dfg/DFGOSRExitJumpPlaceholder.cpp:
* dfg/DFGOSRExitPreparation.cpp:
* dfg/DFGOperations.cpp:
* dfg/DFGPhase.cpp:
* dfg/DFGPlan.cpp:
* dfg/DFGPredictionInjectionPhase.cpp:
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGResurrectionForValidationPhase.cpp:
* dfg/DFGSSAConversionPhase.cpp:
* dfg/DFGSSALoweringPhase.cpp:
* dfg/DFGSafepoint.cpp:
* dfg/DFGSpeculativeJIT.cpp:
* dfg/DFGSpeculativeJIT32_64.cpp:
* dfg/DFGSpeculativeJIT64.cpp:
* dfg/DFGStackLayoutPhase.cpp:
* dfg/DFGStoreBarrierElisionPhase.cpp:
* dfg/DFGStrengthReductionPhase.cpp:
* dfg/DFGThreadData.cpp:
* dfg/DFGThunks.cpp:
* dfg/DFGTierUpCheckInjectionPhase.cpp:
* dfg/DFGToFTLDeferredCompilationCallback.cpp:
* dfg/DFGToFTLForOSREntryDeferredCompilationCallback.cpp:
* dfg/DFGTypeCheckHoistingPhase.cpp:
* dfg/DFGUnificationPhase.cpp:
* dfg/DFGUseKind.cpp:
* dfg/DFGValidate.cpp:
* dfg/DFGValueSource.cpp:
* dfg/DFGVariableAccessDataDump.cpp:
* dfg/DFGVariableEvent.cpp:
* dfg/DFGVariableEventStream.cpp:
* dfg/DFGVirtualRegisterAllocationPhase.cpp:
* dfg/DFGWatchpointCollectionPhase.cpp:
* dfg/DFGWorklist.cpp:
* ftl/FTLAbstractHeap.cpp:
* ftl/FTLAbstractHeapRepository.cpp:
* ftl/FTLExitValue.cpp:
* ftl/FTLLink.cpp:
* ftl/FTLLowerDFGToLLVM.cpp:
* ftl/FTLOSREntry.cpp:
* ftl/FTLOSRExit.cpp:
* ftl/FTLOSRExitCompiler.cpp:
* ftl/FTLSlowPathCall.cpp:
* heap/BlockAllocator.cpp:
* heap/CodeBlockSet.cpp:
* heap/ConservativeRoots.cpp:
* heap/CopiedSpace.cpp:
* heap/CopyVisitor.cpp:
* heap/DeferGC.cpp:
* heap/GCThread.cpp:
* heap/GCThreadSharedData.cpp:
* heap/HandleSet.cpp:
* heap/HandleStack.cpp:
* heap/Heap.cpp:
* heap/HeapStatistics.cpp:
* heap/HeapTimer.cpp:
* heap/IncrementalSweeper.cpp:
* heap/JITStubRoutineSet.cpp:
* heap/MachineStackMarker.cpp:
* heap/MarkStack.cpp:
* heap/MarkedAllocator.cpp:
* heap/MarkedBlock.cpp:
* heap/MarkedSpace.cpp:
* heap/SlotVisitor.cpp:
* heap/SuperRegion.cpp:
* heap/Weak.cpp:
* heap/WeakBlock.cpp:
* heap/WeakHandleOwner.cpp:
* heap/WeakSet.cpp:
* heap/WriteBarrierBuffer.cpp:
* heap/WriteBarrierSupport.cpp:
* inspector/InjectedScript.cpp:
* inspector/InjectedScriptBase.cpp:
* inspector/JSGlobalObjectScriptDebugServer.cpp:
* inspector/JSInjectedScriptHost.cpp:
* inspector/ScriptArguments.cpp:
* inspector/ScriptCallStackFactory.cpp:
* interpreter/AbstractPC.cpp:
* interpreter/CallFrame.cpp:
* interpreter/Interpreter.cpp:
* interpreter/JSStack.cpp:
* interpreter/ProtoCallFrame.cpp:
* interpreter/StackVisitor.cpp:
* interpreter/VMInspector.cpp:
* jit/ArityCheckFailReturnThunks.cpp:
* jit/AssemblyHelpers.cpp:
* jit/ClosureCallStubRoutine.cpp:
* jit/ExecutableAllocator.cpp:
* jit/ExecutableAllocatorFixedVMPool.cpp:
* jit/GCAwareJITStubRoutine.cpp:
* jit/HostCallReturnValue.cpp:
* jit/JIT.cpp:
* jit/JITArithmetic.cpp:
* jit/JITArithmetic32_64.cpp:
* jit/JITCall.cpp:
* jit/JITCall32_64.cpp:
* jit/JITCode.cpp:
* jit/JITDisassembler.cpp:
* jit/JITExceptions.cpp:
* jit/JITInlineCacheGenerator.cpp:
* jit/JITInlines.h:
* jit/JITOperations.cpp:
* jit/JITOperationsMSVC64.cpp:
* jit/JITStubRoutine.cpp:
* jit/JITStubs.cpp:
* jit/JITThunks.cpp:
* jit/JITToDFGDeferredCompilationCallback.cpp:
* jit/RegisterPreservationWrapperGenerator.cpp:
* jit/RegisterSet.cpp:
* jit/Repatch.cpp:
* jit/TempRegisterSet.cpp:
* jit/ThunkGenerators.cpp:
* jsc.cpp:
* llint/LLIntExceptions.cpp:
* llint/LLIntSlowPaths.cpp:
* llint/LowLevelInterpreter.cpp:
* parser/Lexer.cpp:
* parser/Nodes.cpp:
* parser/Parser.cpp:
* parser/ParserArena.cpp:
* parser/SourceCode.cpp:
* parser/SourceProvider.cpp:
* parser/SourceProviderCache.cpp:
* profiler/LegacyProfiler.cpp:
* profiler/ProfileGenerator.cpp:
* profiler/ProfilerBytecode.cpp:
* profiler/ProfilerBytecodeSequence.cpp:
* profiler/ProfilerBytecodes.cpp:
* profiler/ProfilerCompilation.cpp:
* profiler/ProfilerCompiledBytecode.cpp:
* profiler/ProfilerDatabase.cpp:
* profiler/ProfilerOSRExit.cpp:
* profiler/ProfilerOSRExitSite.cpp:
* profiler/ProfilerOrigin.cpp:
* profiler/ProfilerOriginStack.cpp:
* profiler/ProfilerProfiledBytecodes.cpp:
* runtime/ArgList.cpp:
* runtime/Arguments.cpp:
* runtime/ArgumentsIteratorPrototype.cpp:
* runtime/ArrayBuffer.cpp:
* runtime/ArrayBufferNeuteringWatchpoint.cpp:
* runtime/ArrayConstructor.cpp:
* runtime/ArrayPrototype.cpp:
* runtime/BooleanConstructor.cpp:
* runtime/BooleanObject.cpp:
* runtime/BooleanPrototype.cpp:
* runtime/CallData.cpp:
* runtime/CodeCache.cpp:
* runtime/CommonSlowPaths.cpp:
* runtime/CommonSlowPathsExceptions.cpp:
* runtime/Completion.cpp:
* runtime/ConstructData.cpp:
* runtime/DateConstructor.cpp:
* runtime/DateInstance.cpp:
* runtime/DatePrototype.cpp:
* runtime/Error.cpp:
* runtime/ErrorConstructor.cpp:
* runtime/ErrorInstance.cpp:
* runtime/ErrorPrototype.cpp:
* runtime/ExceptionHelpers.cpp:
* runtime/Executable.cpp:
* runtime/FunctionConstructor.cpp:
* runtime/FunctionPrototype.cpp:
* runtime/GetterSetter.cpp:
* runtime/Identifier.cpp:
* runtime/IntendedStructureChain.cpp:
* runtime/InternalFunction.cpp:
* runtime/JSActivation.cpp:
* runtime/JSArgumentsIterator.cpp:
* runtime/JSArray.cpp:
* runtime/JSArrayBuffer.cpp:
* runtime/JSArrayBufferConstructor.cpp:
* runtime/JSArrayBufferPrototype.cpp:
* runtime/JSArrayBufferView.cpp:
* runtime/JSBoundFunction.cpp:
* runtime/JSCInlines.h: Copied from Source/JavaScriptCore/runtime/Operations.h.
* runtime/JSCell.cpp:
* runtime/JSDataView.cpp:
* runtime/JSDataViewPrototype.cpp:
* runtime/JSDateMath.cpp:
* runtime/JSFunction.cpp:
* runtime/JSGlobalObject.cpp:
* runtime/JSGlobalObjectFunctions.cpp:
* runtime/JSLock.cpp:
* runtime/JSNameScope.cpp:
* runtime/JSNotAnObject.cpp:
* runtime/JSONObject.cpp:
* runtime/JSObject.cpp:
* runtime/JSPropertyNameIterator.cpp:
* runtime/JSPropertyNameIterator.h:
* runtime/JSProxy.cpp:
* runtime/JSScope.cpp:
* runtime/JSSegmentedVariableObject.cpp:
* runtime/JSString.cpp:
* runtime/JSStringJoiner.cpp:
* runtime/JSSymbolTableObject.cpp:
* runtime/JSTypedArrayConstructors.cpp:
* runtime/JSTypedArrayPrototypes.cpp:
* runtime/JSTypedArrays.cpp:
* runtime/JSVariableObject.cpp:
* runtime/JSWithScope.cpp:
* runtime/JSWrapperObject.cpp:
* runtime/LiteralParser.cpp:
* runtime/Lookup.cpp:
* runtime/MathObject.cpp:
* runtime/NameConstructor.cpp:
* runtime/NameInstance.cpp:
* runtime/NamePrototype.cpp:
* runtime/NativeErrorConstructor.cpp:
* runtime/NativeErrorPrototype.cpp:
* runtime/NumberConstructor.cpp:
* runtime/NumberObject.cpp:
* runtime/NumberPrototype.cpp:
* runtime/ObjectConstructor.cpp:
* runtime/ObjectPrototype.cpp:
* runtime/Operations.cpp:
* runtime/Operations.h:
* runtime/PropertyDescriptor.cpp:
* runtime/PrototypeMap.cpp:
* runtime/RegExp.cpp:
* runtime/RegExpCache.cpp:
* runtime/RegExpCachedResult.cpp:
* runtime/RegExpConstructor.cpp:
* runtime/RegExpMatchesArray.cpp:
* runtime/RegExpObject.cpp:
* runtime/RegExpPrototype.cpp:
* runtime/SimpleTypedArrayController.cpp:
* runtime/SmallStrings.cpp:
* runtime/SparseArrayValueMap.cpp:
* runtime/StrictEvalActivation.cpp:
* runtime/StringConstructor.cpp:
* runtime/StringObject.cpp:
* runtime/StringPrototype.cpp:
* runtime/StringRecursionChecker.cpp:
* runtime/Structure.cpp:
* runtime/StructureChain.cpp:
* runtime/StructureRareData.cpp:
* runtime/SymbolTable.cpp:
* runtime/TestRunnerUtils.cpp:
* runtime/VM.cpp:
* testRegExp.cpp:

Source/WebCore: 

Rubber stamped by Geoffrey Garen.

No new tests because no change in behavior.

* ForwardingHeaders/runtime/JSCInlines.h: Added.
* bindings/js/JSCryptoAlgorithmBuilder.cpp:
* bindings/js/JSCryptoKeySerializationJWK.cpp:
* bindings/js/JSCustomXPathNSResolver.h:
* bindings/js/JSDOMBinding.h:
* bindings/js/JSDOMGlobalObject.h:
* bindings/js/JSDictionary.h:
* bindings/js/JSMessagePortCustom.cpp:
* bindings/js/JSMessagePortCustom.h:
* bindings/js/JSNodeFilterCondition.h:
* bindings/js/SerializedScriptValue.cpp:
* bindings/js/WebCoreTypedArrayController.cpp:
* bridge/c/c_utility.h:
* bridge/jsc/BridgeJSC.h:
* dom/CustomEvent.cpp:
* dom/Node.cpp:
* html/HTMLCanvasElement.cpp:
* html/HTMLImageLoader.cpp:
* html/canvas/WebGLRenderingContext.cpp:
* inspector/InspectorDOMAgent.cpp:
* inspector/WebConsoleAgent.cpp:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
* platform/graphics/filters/FEGaussianBlur.cpp:
* platform/graphics/filters/FilterEffect.cpp:
* testing/MockCDM.cpp:
* xml/XMLHttpRequest.cpp:

Source/WebKit2: 

Rubber stamped by Geoffrey Garen.

* Shared/linux/WebMemorySamplerLinux.cpp:
* UIProcess/WebContext.cpp:
* WebProcess/WebPage/WebPage.cpp:
* WebProcess/efl/WebProcessMainEfl.cpp:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Try to fix the 32-bit build.

* WebCore.exp.in:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163845 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Address the review comments for r163825.

* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::indexForVisiblePosition):
(WebCore::positionForIndex):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163846 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Speed up DatasetDOMStringMap::item() when the element has multiple attributes
https://bugs.webkit.org/show_bug.cgi?id=128058

Reviewed by Darin Adler.

Accessing data attributes by name through DatasetDOMStringMap involes the conversion
from JavaScript property name to attribute name (done with propertyNameMatchesAttributeName()).

When there is a single data attribute, that method is efficient. When there are several attributes,
comparing names character by character becomes a bottleneck.

This patch add an efficent path for this case: instead of converting the attribute name on the fly,
the JavaScript property name is converted to an attribute name so that it can compared by its
AtomicStringImpl pointer.

This method puts a lot more pressure on convertPropertyNameToAttributeName()'s speed. The method was
improved accordingly to compensate for its new caller.

When enumerating multiple attributes by name, this patch provides about 80% speedup.
I could not measure any slow down on the simple cases.

* dom/DatasetDOMStringMap.cpp:
(WebCore::convertPropertyNameToAttributeName):
(WebCore::DatasetDOMStringMap::item):
* dom/ElementData.h:
(WebCore::AttributeIteratorAccessor::attributeCount):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove a couple of deprecatedCharacters() from WebKit2
https://bugs.webkit.org/show_bug.cgi?id=128569

Reviewed by Andreas Kling.

* Shared/APIString.h:
* UIProcess/TextChecker.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::checkTextOfParagraph):
(WebKit::WebPageProxy::checkSpellingOfString):
(WebKit::WebPageProxy::checkGrammarOfString):
* UIProcess/mac/TextCheckerMac.mm:
(WebKit::TextChecker::checkTextOfParagraph):
(WebKit::TextChecker::checkSpellingOfString):
(WebKit::TextChecker::checkGrammarOfString):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163848 268f45cc-cd09-0410-ab3c-d52691b4dbfc
IDB: storage/indexeddb/mozilla/indexes.html fails
<rdar://problem/16031590> and https://bugs.webkit.org/show_bug.cgi?id=128563

Reviewed by Tim Horton.

Source/WebCore:

Tested by storage/indexeddb/mozilla/indexes.html (and probably others)

* Modules/indexeddb/IDBGetResult.h:
(WebCore::IDBGetResult::IDBGetResult): Add a constructor that takes an IDBKeyData argument.

* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::onSuccess): If there’s no keyPath then skip the injection step.

Source/WebKit2:

* DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:
(WebKit::UniqueIDBDatabase::getRecordFromBackingStore): Pass the cursor type to the backing store.

* DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h:
* DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::getIndexRecord): If it’s a key-only cursor,
  return only the key result.
* DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h:

* DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp:
(WebKit::getIndexStatement): Fix index statement selection so ascending, unique cursors sort correctly.

LayoutTests:

* platform/mac-wk2/TestExpectations: Add the test (still skipped for now due to unrelated reasons).


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163849 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add the basic infrastructure to compile attributes matching in selectors
https://bugs.webkit.org/show_bug.cgi?id=128484

Reviewed by Gavin Barraclough.

Source/WebCore: 

Tests: fast/selectors/querySelector-attribute-match-with-child-backtracking.html
       fast/selectors/querySelector-long-attribute-match-with-child-backtracking.html
       fast/selectors/querySelector-long-multiple-attribute-match-with-child-backtracking.html
       fast/selectors/querySelector-multiple-attribute-match-with-child-backtracking.html

Add the infrastructure to match attributes. This only add basic support for the 'Set' match
type, the other match types will have to be built on top.

* cssjit/RegisterAllocator.h:
(WebCore::RegisterAllocator::availableRegisterCount):
(WebCore::RegisterAllocator::allocateRegister):
(WebCore::RegisterAllocator::deallocateRegister):
(WebCore::RegisterAllocator::reserveCalleeSavedRegisters):
(WebCore::RegisterAllocator::restoreCalleeSavedRegisters):
(WebCore::RegisterAllocator::allocatedRegisters):
(WebCore::RegisterAllocator::RegisterAllocator):
(WebCore::RegisterAllocator::~RegisterAllocator):
In the worst case, matching attributes can take up to 10 registers. On x86_64, we have
8 caller-saved registers. The extra 2 registers are simply added by taking callee-saved registers.

RegisterAllocator is modified to know support saving and restoring callee saved registers.
The list of available registers is changed from a vector to a HashSet because the registers
are removed from arbitrary locations in restoreCalleeSavedRegisters(). The m_allocatedRegisters
remain a vector since the allocation/release pattern remain ordered.

* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::SelectorCodeGenerator::SelectorCodeGenerator):

(WebCore::SelectorCompiler::minimumRegisterRequirements):
This new utility finds the minimum number of registers needed to compile the input. In most
cases we have plenty enough. In rare cases we need to saved a few registers to the stack.

(WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementDataMatching):
(WebCore::SelectorCompiler::testIsHTMLFlagOnNode):
(WebCore::SelectorCompiler::canMatchStyleAttribute):

(WebCore::SelectorCompiler::SelectorCodeGenerator::generateSynchronizeStyleAttribute):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateSynchronizeAllAnimatedSVGAttribute):
The style attribute and certain SVG attributes can be modified lazily. In those cases,
the element needs to be updated before querying the attributes.

(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributesMatching):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeMatching):
Generate the attribute matching. For each CSSSelector matching an attribute, we generate
a loop over all the attributes of the element, maching the particular CSSSelector.
This makes no attempt at grouping related queries since those do not seem to happen a lot
in practice.

* dom/Attribute.h:
(WebCore::Attribute::nameMemoryOffset):
(WebCore::Attribute::nameMatchesFilter):
(WebCore::Attribute::matches):
* dom/ElementData.h:
(WebCore::ElementData::isUniqueFlag):
(WebCore::ElementData::arraySizeAndFlagsMemoryOffset):
(WebCore::ElementData::styleAttributeIsDirtyFlag):
(WebCore::ElementData::animatedSVGAttributesAreDirtyFlag):
(WebCore::ElementData::arraySizeOffset):
(WebCore::ShareableElementData::attributeArrayMemoryOffset):
(WebCore::UniqueElementData::attributeVectorMemoryOffset):
* dom/Node.h:
(WebCore::Node::flagIsHTML):
* dom/StyledElement.cpp:
(WebCore::StyledElement::synchronizeStyleAttributeInternal):
* dom/StyledElement.h:
(WebCore::StyledElement::synchronizeStyleAttributeInternal):
* svg/SVGElement.cpp:
(WebCore::SVGElement::synchronizeAllAnimatedSVGAttribute):
(WebCore::SVGElement::synchronizeAnimatedSVGAttribute):
* svg/SVGElement.h:

Source/WTF: 

* wtf/Vector.h:
(WTF::VectorBufferBase::bufferMemoryOffset):
(WTF::Vector::sizeMemoryOffset):
(WTF::Vector::dataMemoryOffset):
Expose the memory offsets of Vector::size() and the memory buffer pointer for the JIT.

LayoutTests: 

Tests the various cases requiring more register than what is available from the caller-saved pool.

* fast/selectors/querySelector-attribute-match-with-child-backtracking-expected.txt: Added.
* fast/selectors/querySelector-attribute-match-with-child-backtracking.html: Added.
* fast/selectors/querySelector-long-attribute-match-with-child-backtracking-expected.txt: Added.
* fast/selectors/querySelector-long-attribute-match-with-child-backtracking.html: Added.
* fast/selectors/querySelector-long-multiple-attribute-match-with-child-backtracking-expected.txt: Added.
* fast/selectors/querySelector-long-multiple-attribute-match-with-child-backtracking.html: Added.
* fast/selectors/querySelector-multiple-attribute-match-with-child-backtracking-expected.txt: Added.
* fast/selectors/querySelector-multiple-attribute-match-with-child-backtracking.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163850 268f45cc-cd09-0410-ab3c-d52691b4dbfc
FTL should support ToThis
https://bugs.webkit.org/show_bug.cgi?id=127751

Reviewed by Oliver Hunt.

* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLIntrinsicRepository.h:
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileToThis):
* tests/stress/to-this-polymorphic.js: Added.
(foo):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163851 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make it possible to run tests with --llvmSimpleOpt=false
https://bugs.webkit.org/show_bug.cgi?id=128571

Reviewed by Mark Lam.
        
This also makes it so all run functions for the FTL are safe to call with FTL disabled,
because they do their own $enableFTL check.

* Scripts/run-jsc-stress-tests:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163852 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add a few pseudo type to the selector compiler through function calls
https://bugs.webkit.org/show_bug.cgi?id=128514

Reviewed by Dean Jackson.

Certain pseudo type checkers rely on virtual function calls. Since those types
are uncommon, and this code generator cannot currently make virtual function calls,
the checker are added by generating a function call to a wrapper function.

To avoid code duplication between SelectorChecker and the compiler, all the relevant checking
code has been moved to a common header, SelectorCheckerTestFunctions.h.
SelectorChecker still inline the functions, while the SelectorCompiler generate local static functions
and generate calls to them as needed.

* GNUmakefile.list.am:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne):
* css/SelectorCheckerTestFunctions.h: Added.
(WebCore::isAutofilled):
(WebCore::isDefaultButtonForForm):
(WebCore::isDisabled):
(WebCore::isEnabled):
(WebCore::isChecked):
(WebCore::isInvalid):
(WebCore::isOptionalFormControl):
(WebCore::isRequiredFormControl):
(WebCore::isValid):
(WebCore::matchesReadOnlyPseudoClass):
(WebCore::matchesReadWritePseudoClass):
(WebCore::shouldAppearIndeterminate):
(WebCore::matchesFullScreenPseudoClass):
(WebCore::matchesFutureCuePseudoClass):
(WebCore::matchesPastCuePseudoClass):
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoType):
(WebCore::SelectorCompiler::nonConstTestFunctionWrapper):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatching):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementFunctionCallTest):
* dom/Element.h:
(WebCore::Element::isValidFormControlElement):
* dom/Node.h:
(WebCore::Node::toInputElement):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::isValidFormControlElement):
* html/HTMLFormControlElement.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Clean up MarkupAccumulator::appendCharactersReplacingEntities
https://bugs.webkit.org/show_bug.cgi?id=128440

Reviewed by Ryosuke Niwa.

Some cleanup:
-Remove the copied code for the loops. Instead, use a template with the loop
 parametrized by the characters type.
-Move EntityDescription from the header to the implementation.
-Make the 5 substitution strings compile-time literals. Replacement is not hot enough
 to justify the static here.

* editing/MarkupAccumulator.cpp:
(WebCore::appendCharactersReplacingEntitiesInternal):
(WebCore::MarkupAccumulator::appendCharactersReplacingEntities):
* editing/MarkupAccumulator.h:


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