haikuwebkit/Source/WTF/wtf/TinyPtrSet.h

529 lines
14 KiB
C
Raw Permalink Normal View History

The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
/*
Use constexpr instead of const in symbol definitions that are obviously constexpr. https://bugs.webkit.org/show_bug.cgi?id=201879 Rubber-stamped by Joseph Pecoraro. Source/bmalloc: * bmalloc/AvailableMemory.cpp: * bmalloc/IsoTLS.h: * bmalloc/Map.h: * bmalloc/Mutex.cpp: (bmalloc::Mutex::lockSlowCase): * bmalloc/PerThread.h: * bmalloc/Vector.h: * bmalloc/Zone.h: Source/JavaScriptCore: const may require external storage (at the compiler's whim) though these currently do not. constexpr makes it clear that the value is a literal constant that can be inlined. In most cases in the code, when we say static const, we actually mean static constexpr. I'm changing the code to reflect this. * API/JSAPIValueWrapper.h: * API/JSCallbackConstructor.h: * API/JSCallbackObject.h: * API/JSContextRef.cpp: * API/JSWrapperMap.mm: * API/tests/CompareAndSwapTest.cpp: * API/tests/TypedArrayCTest.cpp: * API/tests/testapi.mm: (testObjectiveCAPIMain): * KeywordLookupGenerator.py: (Trie.printAsC): * assembler/ARMv7Assembler.h: * assembler/AssemblerBuffer.h: * assembler/AssemblerCommon.h: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.h: * assembler/MacroAssemblerARM64E.h: * assembler/MacroAssemblerARMv7.h: * assembler/MacroAssemblerCodeRef.h: * assembler/MacroAssemblerMIPS.h: * assembler/MacroAssemblerX86.h: * assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::absDouble): (JSC::MacroAssemblerX86Common::negateDouble): * assembler/MacroAssemblerX86_64.h: * assembler/X86Assembler.h: * b3/B3Bank.h: * b3/B3CheckSpecial.h: * b3/B3DuplicateTails.cpp: * b3/B3EliminateCommonSubexpressions.cpp: * b3/B3FixSSA.cpp: * b3/B3FoldPathConstants.cpp: * b3/B3InferSwitches.cpp: * b3/B3Kind.h: * b3/B3LowerToAir.cpp: * b3/B3NativeTraits.h: * b3/B3ReduceDoubleToFloat.cpp: * b3/B3ReduceLoopStrength.cpp: * b3/B3ReduceStrength.cpp: * b3/B3ValueKey.h: * b3/air/AirAllocateRegistersByGraphColoring.cpp: * b3/air/AirAllocateStackByGraphColoring.cpp: * b3/air/AirArg.h: * b3/air/AirCCallSpecial.h: * b3/air/AirEmitShuffle.cpp: * b3/air/AirFixObviousSpills.cpp: * b3/air/AirFormTable.h: * b3/air/AirLowerAfterRegAlloc.cpp: * b3/air/AirPrintSpecial.h: * b3/air/AirStackAllocation.cpp: * b3/air/AirTmp.h: * b3/testb3_6.cpp: (testInterpreter): * bytecode/AccessCase.cpp: * bytecode/CallLinkStatus.cpp: * bytecode/CallVariant.h: * bytecode/CodeBlock.h: * bytecode/CodeOrigin.h: * bytecode/DFGExitProfile.h: * bytecode/DirectEvalCodeCache.h: * bytecode/ExecutableToCodeBlockEdge.h: * bytecode/GetterSetterAccessCase.cpp: * bytecode/LazyOperandValueProfile.h: * bytecode/ObjectPropertyCondition.h: * bytecode/ObjectPropertyConditionSet.cpp: * bytecode/PolymorphicAccess.cpp: * bytecode/PropertyCondition.h: * bytecode/SpeculatedType.h: * bytecode/StructureStubInfo.cpp: * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::typeProfilerExpressionInfoForBytecodeOffset): * bytecode/UnlinkedCodeBlock.h: * bytecode/UnlinkedEvalCodeBlock.h: * bytecode/UnlinkedFunctionCodeBlock.h: * bytecode/UnlinkedFunctionExecutable.h: * bytecode/UnlinkedModuleProgramCodeBlock.h: * bytecode/UnlinkedProgramCodeBlock.h: * bytecode/ValueProfile.h: * bytecode/VirtualRegister.h: * bytecode/Watchpoint.h: * bytecompiler/BytecodeGenerator.h: * bytecompiler/Label.h: * bytecompiler/NodesCodegen.cpp: (JSC::ThisNode::emitBytecode): * bytecompiler/RegisterID.h: * debugger/Breakpoint.h: * debugger/DebuggerParseData.cpp: * debugger/DebuggerPrimitives.h: * debugger/DebuggerScope.h: * dfg/DFGAbstractHeap.h: * dfg/DFGAbstractValue.h: * dfg/DFGArgumentsEliminationPhase.cpp: * dfg/DFGByteCodeParser.cpp: * dfg/DFGCSEPhase.cpp: * dfg/DFGCommon.h: * dfg/DFGCompilationKey.h: * dfg/DFGDesiredGlobalProperty.h: * dfg/DFGEdgeDominates.h: * dfg/DFGEpoch.h: * dfg/DFGForAllKills.h: (JSC::DFG::forAllKilledNodesAtNodeIndex): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::isLiveInBytecode): * dfg/DFGHeapLocation.h: * dfg/DFGInPlaceAbstractState.cpp: * dfg/DFGIntegerCheckCombiningPhase.cpp: * dfg/DFGIntegerRangeOptimizationPhase.cpp: * dfg/DFGInvalidationPointInjectionPhase.cpp: * dfg/DFGLICMPhase.cpp: * dfg/DFGLazyNode.h: * dfg/DFGMinifiedID.h: * dfg/DFGMovHintRemovalPhase.cpp: * dfg/DFGNodeFlowProjection.h: * dfg/DFGNodeType.h: * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPhantomInsertionPhase.cpp: * dfg/DFGPromotedHeapLocation.h: * dfg/DFGPropertyTypeKey.h: * dfg/DFGPureValue.h: * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGRegisterBank.h: * dfg/DFGSSAConversionPhase.cpp: * dfg/DFGSSALoweringPhase.cpp: * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileDoubleRep): (JSC::DFG::compileClampDoubleToByte): (JSC::DFG::SpeculativeJIT::compileArithRounding): (JSC::DFG::compileArithPowIntegerFastPath): (JSC::DFG::SpeculativeJIT::compileArithPow): (JSC::DFG::SpeculativeJIT::emitBinarySwitchStringRecurse): * dfg/DFGStackLayoutPhase.cpp: * dfg/DFGStoreBarrierInsertionPhase.cpp: * dfg/DFGStrengthReductionPhase.cpp: * dfg/DFGStructureAbstractValue.h: * dfg/DFGVarargsForwardingPhase.cpp: * dfg/DFGVariableEventStream.cpp: (JSC::DFG::VariableEventStream::reconstruct const): * dfg/DFGWatchpointCollectionPhase.cpp: * disassembler/ARM64/A64DOpcode.h: * ftl/FTLLocation.h: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileArithRandom): * ftl/FTLSlowPathCall.cpp: * ftl/FTLSlowPathCallKey.h: * heap/CellContainer.h: * heap/CellState.h: * heap/ConservativeRoots.h: * heap/GCSegmentedArray.h: * heap/HandleBlock.h: * heap/Heap.cpp: (JSC::Heap::updateAllocationLimits): * heap/Heap.h: * heap/HeapSnapshot.h: * heap/HeapUtil.h: (JSC::HeapUtil::findGCObjectPointersForMarking): * heap/IncrementalSweeper.cpp: * heap/LargeAllocation.h: * heap/MarkedBlock.cpp: * heap/Strong.h: * heap/VisitRaceKey.h: * heap/Weak.h: * heap/WeakBlock.h: * inspector/JSInjectedScriptHost.h: * inspector/JSInjectedScriptHostPrototype.h: * inspector/JSJavaScriptCallFrame.h: * inspector/JSJavaScriptCallFramePrototype.h: * inspector/agents/InspectorConsoleAgent.cpp: * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets): * inspector/scripts/codegen/generate_cpp_protocol_types_header.py: (CppProtocolTypesHeaderGenerator._generate_versions): * inspector/scripts/tests/generic/expected/version.json-result: * interpreter/Interpreter.h: * interpreter/ShadowChicken.cpp: * jit/BinarySwitch.cpp: * jit/CallFrameShuffler.h: * jit/ExecutableAllocator.h: * jit/FPRInfo.h: * jit/GPRInfo.h: * jit/ICStats.h: * jit/JITThunks.h: * jit/Reg.h: * jit/RegisterSet.h: * jit/TempRegisterSet.h: * jsc.cpp: * parser/ASTBuilder.h: * parser/Nodes.h: * parser/SourceCodeKey.h: * parser/SyntaxChecker.h: * parser/VariableEnvironment.h: * profiler/ProfilerOrigin.h: * profiler/ProfilerOriginStack.h: * profiler/ProfilerUID.h: * runtime/AbstractModuleRecord.cpp: * runtime/ArrayBufferNeuteringWatchpointSet.h: * runtime/ArrayConstructor.h: * runtime/ArrayConventions.h: * runtime/ArrayIteratorPrototype.h: * runtime/ArrayPrototype.cpp: (JSC::setLength): * runtime/AsyncFromSyncIteratorPrototype.h: * runtime/AsyncGeneratorFunctionPrototype.h: * runtime/AsyncGeneratorPrototype.h: * runtime/AsyncIteratorPrototype.h: * runtime/AtomicsObject.cpp: * runtime/BigIntConstructor.h: * runtime/BigIntPrototype.h: * runtime/BooleanPrototype.h: * runtime/ClonedArguments.h: * runtime/CodeCache.h: * runtime/ControlFlowProfiler.h: * runtime/CustomGetterSetter.h: * runtime/DateConstructor.h: * runtime/DatePrototype.h: * runtime/DefinePropertyAttributes.h: * runtime/ErrorPrototype.h: * runtime/EvalExecutable.h: * runtime/Exception.h: * runtime/ExceptionHelpers.cpp: (JSC::invalidParameterInSourceAppender): (JSC::invalidParameterInstanceofSourceAppender): * runtime/ExceptionHelpers.h: * runtime/ExecutableBase.h: * runtime/FunctionExecutable.h: * runtime/FunctionRareData.h: * runtime/GeneratorPrototype.h: * runtime/GenericArguments.h: * runtime/GenericOffset.h: * runtime/GetPutInfo.h: * runtime/GetterSetter.h: * runtime/GlobalExecutable.h: * runtime/Identifier.h: * runtime/InspectorInstrumentationObject.h: * runtime/InternalFunction.h: * runtime/IntlCollatorConstructor.h: * runtime/IntlCollatorPrototype.h: * runtime/IntlDateTimeFormatConstructor.h: * runtime/IntlDateTimeFormatPrototype.h: * runtime/IntlNumberFormatConstructor.h: * runtime/IntlNumberFormatPrototype.h: * runtime/IntlObject.h: * runtime/IntlPluralRulesConstructor.h: * runtime/IntlPluralRulesPrototype.h: * runtime/IteratorPrototype.h: * runtime/JSArray.cpp: (JSC::JSArray::tryCreateUninitializedRestricted): * runtime/JSArray.h: * runtime/JSArrayBuffer.h: * runtime/JSArrayBufferView.h: * runtime/JSBigInt.h: * runtime/JSCJSValue.h: * runtime/JSCell.h: * runtime/JSCustomGetterSetterFunction.h: * runtime/JSDataView.h: * runtime/JSDataViewPrototype.h: * runtime/JSDestructibleObject.h: * runtime/JSFixedArray.h: * runtime/JSGenericTypedArrayView.h: * runtime/JSGlobalLexicalEnvironment.h: * runtime/JSGlobalObject.h: * runtime/JSImmutableButterfly.h: * runtime/JSInternalPromiseConstructor.h: * runtime/JSInternalPromiseDeferred.h: * runtime/JSInternalPromisePrototype.h: * runtime/JSLexicalEnvironment.h: * runtime/JSModuleEnvironment.h: * runtime/JSModuleLoader.h: * runtime/JSModuleNamespaceObject.h: * runtime/JSNonDestructibleProxy.h: * runtime/JSONObject.cpp: * runtime/JSONObject.h: * runtime/JSObject.h: * runtime/JSPromiseConstructor.h: * runtime/JSPromiseDeferred.h: * runtime/JSPromisePrototype.h: * runtime/JSPropertyNameEnumerator.h: * runtime/JSProxy.h: * runtime/JSScope.h: * runtime/JSScriptFetchParameters.h: * runtime/JSScriptFetcher.h: * runtime/JSSegmentedVariableObject.h: * runtime/JSSourceCode.h: * runtime/JSString.cpp: * runtime/JSString.h: * runtime/JSSymbolTableObject.h: * runtime/JSTemplateObjectDescriptor.h: * runtime/JSTypeInfo.h: * runtime/MapPrototype.h: * runtime/MinimumReservedZoneSize.h: * runtime/ModuleProgramExecutable.h: * runtime/NativeExecutable.h: * runtime/NativeFunction.h: * runtime/NativeStdFunctionCell.h: * runtime/NumberConstructor.h: * runtime/NumberPrototype.h: * runtime/ObjectConstructor.h: * runtime/ObjectPrototype.h: * runtime/ProgramExecutable.h: * runtime/PromiseDeferredTimer.cpp: * runtime/PropertyMapHashTable.h: * runtime/PropertyNameArray.h: (JSC::PropertyNameArray::add): * runtime/PrototypeKey.h: * runtime/ProxyConstructor.h: * runtime/ProxyObject.cpp: (JSC::ProxyObject::performGetOwnPropertyNames): * runtime/ProxyRevoke.h: * runtime/ReflectObject.h: * runtime/RegExp.h: * runtime/RegExpCache.h: * runtime/RegExpConstructor.h: * runtime/RegExpKey.h: * runtime/RegExpObject.h: * runtime/RegExpPrototype.h: * runtime/RegExpStringIteratorPrototype.h: * runtime/SamplingProfiler.cpp: * runtime/ScopedArgumentsTable.h: * runtime/ScriptExecutable.h: * runtime/SetPrototype.h: * runtime/SmallStrings.h: * runtime/SparseArrayValueMap.h: * runtime/StringConstructor.h: * runtime/StringIteratorPrototype.h: * runtime/StringObject.h: * runtime/StringPrototype.h: * runtime/Structure.h: * runtime/StructureChain.h: * runtime/StructureRareData.h: * runtime/StructureTransitionTable.h: * runtime/Symbol.h: * runtime/SymbolConstructor.h: * runtime/SymbolPrototype.h: * runtime/SymbolTable.h: * runtime/TemplateObjectDescriptor.h: * runtime/TypeProfiler.cpp: * runtime/TypeProfiler.h: * runtime/TypeProfilerLog.cpp: * runtime/VarOffset.h: * testRegExp.cpp: * tools/HeapVerifier.cpp: (JSC::HeapVerifier::checkIfRecorded): * tools/JSDollarVM.cpp: * wasm/WasmB3IRGenerator.cpp: * wasm/WasmBBQPlan.cpp: * wasm/WasmFaultSignalHandler.cpp: * wasm/WasmFunctionParser.h: * wasm/WasmOMGForOSREntryPlan.cpp: * wasm/WasmOMGPlan.cpp: * wasm/WasmPlan.cpp: * wasm/WasmSignature.cpp: * wasm/WasmSignature.h: * wasm/WasmWorklist.cpp: * wasm/js/JSWebAssembly.h: * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/WebAssemblyCompileErrorConstructor.h: * wasm/js/WebAssemblyCompileErrorPrototype.h: * wasm/js/WebAssemblyFunction.h: * wasm/js/WebAssemblyInstanceConstructor.h: * wasm/js/WebAssemblyInstancePrototype.h: * wasm/js/WebAssemblyLinkErrorConstructor.h: * wasm/js/WebAssemblyLinkErrorPrototype.h: * wasm/js/WebAssemblyMemoryConstructor.h: * wasm/js/WebAssemblyMemoryPrototype.h: * wasm/js/WebAssemblyModuleConstructor.h: * wasm/js/WebAssemblyModulePrototype.h: * wasm/js/WebAssemblyRuntimeErrorConstructor.h: * wasm/js/WebAssemblyRuntimeErrorPrototype.h: * wasm/js/WebAssemblyTableConstructor.h: * wasm/js/WebAssemblyTablePrototype.h: * wasm/js/WebAssemblyToJSCallee.h: * yarr/Yarr.h: * yarr/YarrParser.h: * yarr/generateYarrCanonicalizeUnicode: Source/WebCore: No new tests. Covered by existing tests. * bindings/js/JSDOMConstructorBase.h: * bindings/js/JSDOMWindowProperties.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GeneratePrototypeDeclaration): * bindings/scripts/test/JS/JSTestActiveDOMObject.h: * bindings/scripts/test/JS/JSTestEnabledBySetting.h: * bindings/scripts/test/JS/JSTestEnabledForContext.h: * bindings/scripts/test/JS/JSTestEventTarget.h: * bindings/scripts/test/JS/JSTestGlobalObject.h: * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h: * bindings/scripts/test/JS/JSTestNamedGetterCallWith.h: * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.h: * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.h: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestPluginInterface.h: * bindings/scripts/test/JS/JSTestTypedefs.h: * bridge/objc/objc_runtime.h: * bridge/runtime_array.h: * bridge/runtime_method.h: * bridge/runtime_object.h: Source/WebKit: * WebProcess/Plugins/Netscape/JSNPObject.h: Source/WTF: * wtf/Assertions.cpp: * wtf/AutomaticThread.cpp: * wtf/BitVector.h: * wtf/Bitmap.h: * wtf/BloomFilter.h: * wtf/Brigand.h: * wtf/CheckedArithmetic.h: * wtf/CrossThreadCopier.h: * wtf/CurrentTime.cpp: * wtf/DataLog.cpp: * wtf/DateMath.cpp: (WTF::daysFrom1970ToYear): * wtf/DeferrableRefCounted.h: * wtf/GetPtr.h: * wtf/HashFunctions.h: * wtf/HashMap.h: * wtf/HashTable.h: * wtf/HashTraits.h: * wtf/JSONValues.cpp: * wtf/JSONValues.h: * wtf/ListHashSet.h: * wtf/Lock.h: * wtf/LockAlgorithm.h: * wtf/LockAlgorithmInlines.h: (WTF::Hooks>::lockSlow): * wtf/Logger.h: * wtf/LoggerHelper.h: (WTF::LoggerHelper::childLogIdentifier const): * wtf/MainThread.cpp: * wtf/MetaAllocatorPtr.h: * wtf/MonotonicTime.h: * wtf/NaturalLoops.h: (WTF::NaturalLoops::NaturalLoops): * wtf/ObjectIdentifier.h: * wtf/RAMSize.cpp: * wtf/Ref.h: * wtf/RefPtr.h: * wtf/RetainPtr.h: * wtf/SchedulePair.h: * wtf/StackShot.h: * wtf/StdLibExtras.h: * wtf/TinyPtrSet.h: * wtf/URL.cpp: * wtf/URLHash.h: * wtf/URLParser.cpp: (WTF::URLParser::defaultPortForProtocol): * wtf/Vector.h: * wtf/VectorTraits.h: * wtf/WallTime.h: * wtf/WeakHashSet.h: * wtf/WordLock.h: * wtf/cocoa/CPUTimeCocoa.cpp: * wtf/cocoa/MemoryPressureHandlerCocoa.mm: * wtf/persistence/PersistentDecoder.h: * wtf/persistence/PersistentEncoder.h: * wtf/text/AtomStringHash.h: * wtf/text/CString.h: * wtf/text/StringBuilder.cpp: (WTF::expandedCapacity): * wtf/text/StringHash.h: * wtf/text/StringImpl.h: * wtf/text/StringToIntegerConversion.h: (WTF::toIntegralType): * wtf/text/SymbolRegistry.h: * wtf/text/TextStream.cpp: (WTF::hasFractions): * wtf/text/WTFString.h: * wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp: Canonical link: https://commits.webkit.org/215538@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250005 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-18 00:36:19 +00:00
* Copyright (C) 2015-2019 Apple Inc. All rights reserved.
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
Use pragma once in WTF https://bugs.webkit.org/show_bug.cgi?id=190527 Reviewed by Chris Dumez. Source/WTF: We also need to consistently include wtf headers from within wtf so we can build wtf without symbol redefinition errors from including the copy in Source and the copy in the build directory. * wtf/ASCIICType.h: * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Atomics.h: * wtf/AutomaticThread.cpp: * wtf/AutomaticThread.h: * wtf/BackwardsGraph.h: * wtf/Bag.h: * wtf/BagToHashMap.h: * wtf/BitVector.cpp: * wtf/BitVector.h: * wtf/Bitmap.h: * wtf/BloomFilter.h: * wtf/Box.h: * wtf/BubbleSort.h: * wtf/BumpPointerAllocator.h: * wtf/ByteOrder.h: * wtf/CPUTime.cpp: * wtf/CallbackAggregator.h: * wtf/CheckedArithmetic.h: * wtf/CheckedBoolean.h: * wtf/ClockType.cpp: * wtf/ClockType.h: * wtf/CommaPrinter.h: * wtf/CompilationThread.cpp: * wtf/CompilationThread.h: * wtf/Compiler.h: * wtf/ConcurrentPtrHashSet.cpp: * wtf/ConcurrentVector.h: * wtf/Condition.h: * wtf/CountingLock.cpp: * wtf/CrossThreadTaskHandler.cpp: * wtf/CryptographicUtilities.cpp: * wtf/CryptographicUtilities.h: * wtf/CryptographicallyRandomNumber.cpp: * wtf/CryptographicallyRandomNumber.h: * wtf/CurrentTime.cpp: * wtf/DataLog.cpp: * wtf/DataLog.h: * wtf/DateMath.cpp: * wtf/DateMath.h: * wtf/DecimalNumber.cpp: * wtf/DecimalNumber.h: * wtf/Deque.h: * wtf/DisallowCType.h: * wtf/Dominators.h: * wtf/DoublyLinkedList.h: * wtf/FastBitVector.cpp: * wtf/FastMalloc.cpp: * wtf/FastMalloc.h: * wtf/FeatureDefines.h: * wtf/FilePrintStream.cpp: * wtf/FilePrintStream.h: * wtf/FlipBytes.h: * wtf/FunctionDispatcher.cpp: * wtf/FunctionDispatcher.h: * wtf/GetPtr.h: * wtf/Gigacage.cpp: * wtf/GlobalVersion.cpp: * wtf/GraphNodeWorklist.h: * wtf/GregorianDateTime.cpp: * wtf/GregorianDateTime.h: * wtf/HashFunctions.h: * wtf/HashMap.h: * wtf/HashMethod.h: * wtf/HashSet.h: * wtf/HashTable.cpp: * wtf/HashTraits.h: * wtf/Indenter.h: * wtf/IndexSparseSet.h: * wtf/InlineASM.h: * wtf/Insertion.h: * wtf/IteratorAdaptors.h: * wtf/IteratorRange.h: * wtf/JSONValues.cpp: * wtf/JSValueMalloc.cpp: * wtf/LEBDecoder.h: * wtf/Language.cpp: * wtf/ListDump.h: * wtf/Lock.cpp: * wtf/Lock.h: * wtf/LockAlgorithm.h: * wtf/LockedPrintStream.cpp: * wtf/Locker.h: * wtf/MD5.cpp: * wtf/MD5.h: * wtf/MainThread.cpp: * wtf/MainThread.h: * wtf/MallocPtr.h: * wtf/MathExtras.h: * wtf/MediaTime.cpp: * wtf/MediaTime.h: * wtf/MemoryPressureHandler.cpp: * wtf/MessageQueue.h: * wtf/MetaAllocator.cpp: * wtf/MetaAllocator.h: * wtf/MetaAllocatorHandle.h: * wtf/MonotonicTime.cpp: * wtf/MonotonicTime.h: * wtf/NakedPtr.h: * wtf/NoLock.h: * wtf/NoTailCalls.h: * wtf/Noncopyable.h: * wtf/NumberOfCores.cpp: * wtf/NumberOfCores.h: * wtf/OSAllocator.h: * wtf/OSAllocatorPosix.cpp: * wtf/OSRandomSource.cpp: * wtf/OSRandomSource.h: * wtf/ObjcRuntimeExtras.h: * wtf/OrderMaker.h: * wtf/PackedIntVector.h: * wtf/PageAllocation.h: * wtf/PageBlock.cpp: * wtf/PageBlock.h: * wtf/PageReservation.h: * wtf/ParallelHelperPool.cpp: * wtf/ParallelHelperPool.h: * wtf/ParallelJobs.h: * wtf/ParallelJobsLibdispatch.h: * wtf/ParallelVectorIterator.h: * wtf/ParkingLot.cpp: * wtf/ParkingLot.h: * wtf/Platform.h: * wtf/PointerComparison.h: * wtf/Poisoned.cpp: * wtf/PrintStream.cpp: * wtf/PrintStream.h: * wtf/ProcessID.h: * wtf/ProcessPrivilege.cpp: * wtf/RAMSize.cpp: * wtf/RAMSize.h: * wtf/RandomDevice.cpp: * wtf/RandomNumber.cpp: * wtf/RandomNumber.h: * wtf/RandomNumberSeed.h: * wtf/RangeSet.h: * wtf/RawPointer.h: * wtf/ReadWriteLock.cpp: * wtf/RedBlackTree.h: * wtf/Ref.h: * wtf/RefCountedArray.h: * wtf/RefCountedLeakCounter.cpp: * wtf/RefCountedLeakCounter.h: * wtf/RefCounter.h: * wtf/RefPtr.h: * wtf/RetainPtr.h: * wtf/RunLoop.cpp: * wtf/RunLoop.h: * wtf/RunLoopTimer.h: * wtf/RunLoopTimerCF.cpp: * wtf/SHA1.cpp: * wtf/SHA1.h: * wtf/SaturatedArithmetic.h: (saturatedSubtraction): * wtf/SchedulePair.h: * wtf/SchedulePairCF.cpp: * wtf/SchedulePairMac.mm: * wtf/ScopedLambda.h: * wtf/Seconds.cpp: * wtf/Seconds.h: * wtf/SegmentedVector.h: * wtf/SentinelLinkedList.h: * wtf/SharedTask.h: * wtf/SimpleStats.h: * wtf/SingleRootGraph.h: * wtf/SinglyLinkedList.h: * wtf/SixCharacterHash.cpp: * wtf/SixCharacterHash.h: * wtf/SmallPtrSet.h: * wtf/Spectrum.h: * wtf/StackBounds.cpp: * wtf/StackBounds.h: * wtf/StackStats.cpp: * wtf/StackStats.h: * wtf/StackTrace.cpp: * wtf/StdLibExtras.h: * wtf/StreamBuffer.h: * wtf/StringHashDumpContext.h: * wtf/StringPrintStream.cpp: * wtf/StringPrintStream.h: * wtf/ThreadGroup.cpp: * wtf/ThreadMessage.cpp: * wtf/ThreadSpecific.h: * wtf/Threading.cpp: * wtf/Threading.h: * wtf/ThreadingPrimitives.h: * wtf/ThreadingPthreads.cpp: * wtf/TimeWithDynamicClockType.cpp: * wtf/TimeWithDynamicClockType.h: * wtf/TimingScope.cpp: * wtf/TinyLRUCache.h: * wtf/TinyPtrSet.h: * wtf/TriState.h: * wtf/TypeCasts.h: * wtf/UUID.cpp: * wtf/UnionFind.h: * wtf/VMTags.h: * wtf/ValueCheck.h: * wtf/Vector.h: * wtf/VectorTraits.h: * wtf/WallTime.cpp: * wtf/WallTime.h: * wtf/WeakPtr.h: * wtf/WeakRandom.h: * wtf/WordLock.cpp: * wtf/WordLock.h: * wtf/WorkQueue.cpp: * wtf/WorkQueue.h: * wtf/WorkerPool.cpp: * wtf/cf/LanguageCF.cpp: * wtf/cf/RunLoopCF.cpp: * wtf/cocoa/Entitlements.mm: * wtf/cocoa/MachSendRight.cpp: * wtf/cocoa/MainThreadCocoa.mm: * wtf/cocoa/MemoryFootprintCocoa.cpp: * wtf/cocoa/WorkQueueCocoa.cpp: * wtf/dtoa.cpp: * wtf/dtoa.h: * wtf/ios/WebCoreThread.cpp: * wtf/ios/WebCoreThread.h: * wtf/mac/AppKitCompatibilityDeclarations.h: * wtf/mac/DeprecatedSymbolsUsedBySafari.mm: * wtf/mbmalloc.cpp: * wtf/persistence/PersistentCoders.cpp: * wtf/persistence/PersistentDecoder.cpp: * wtf/persistence/PersistentEncoder.cpp: * wtf/spi/cf/CFBundleSPI.h: * wtf/spi/darwin/CommonCryptoSPI.h: * wtf/text/ASCIIFastPath.h: * wtf/text/ASCIILiteral.cpp: * wtf/text/AtomicString.cpp: * wtf/text/AtomicString.h: * wtf/text/AtomicStringHash.h: * wtf/text/AtomicStringImpl.cpp: * wtf/text/AtomicStringImpl.h: * wtf/text/AtomicStringTable.cpp: * wtf/text/AtomicStringTable.h: * wtf/text/Base64.cpp: * wtf/text/CString.cpp: * wtf/text/CString.h: * wtf/text/ConversionMode.h: * wtf/text/ExternalStringImpl.cpp: * wtf/text/IntegerToStringConversion.h: * wtf/text/LChar.h: * wtf/text/LineEnding.cpp: * wtf/text/StringBuffer.h: * wtf/text/StringBuilder.cpp: * wtf/text/StringBuilder.h: * wtf/text/StringBuilderJSON.cpp: * wtf/text/StringCommon.h: * wtf/text/StringConcatenate.h: * wtf/text/StringHash.h: * wtf/text/StringImpl.cpp: * wtf/text/StringImpl.h: * wtf/text/StringOperators.h: * wtf/text/StringView.cpp: * wtf/text/StringView.h: * wtf/text/SymbolImpl.cpp: * wtf/text/SymbolRegistry.cpp: * wtf/text/SymbolRegistry.h: * wtf/text/TextBreakIterator.cpp: * wtf/text/TextBreakIterator.h: * wtf/text/TextBreakIteratorInternalICU.h: * wtf/text/TextPosition.h: * wtf/text/TextStream.cpp: * wtf/text/UniquedStringImpl.h: * wtf/text/WTFString.cpp: * wtf/text/WTFString.h: * wtf/text/cocoa/StringCocoa.mm: * wtf/text/cocoa/StringViewCocoa.mm: * wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp: * wtf/text/icu/UTextProvider.cpp: * wtf/text/icu/UTextProvider.h: * wtf/text/icu/UTextProviderLatin1.cpp: * wtf/text/icu/UTextProviderLatin1.h: * wtf/text/icu/UTextProviderUTF16.cpp: * wtf/text/icu/UTextProviderUTF16.h: * wtf/threads/BinarySemaphore.cpp: * wtf/threads/BinarySemaphore.h: * wtf/threads/Signals.cpp: * wtf/unicode/CharacterNames.h: * wtf/unicode/Collator.h: * wtf/unicode/CollatorDefault.cpp: * wtf/unicode/UTF8.cpp: * wtf/unicode/UTF8.h: Tools: Put WorkQueue in namespace DRT so it does not conflict with WTF::WorkQueue. * DumpRenderTree/TestRunner.cpp: (TestRunner::queueLoadHTMLString): (TestRunner::queueLoadAlternateHTMLString): (TestRunner::queueBackNavigation): (TestRunner::queueForwardNavigation): (TestRunner::queueLoadingScript): (TestRunner::queueNonLoadingScript): (TestRunner::queueReload): * DumpRenderTree/WorkQueue.cpp: (WorkQueue::singleton): Deleted. (WorkQueue::WorkQueue): Deleted. (WorkQueue::queue): Deleted. (WorkQueue::dequeue): Deleted. (WorkQueue::count): Deleted. (WorkQueue::clear): Deleted. (WorkQueue::processWork): Deleted. * DumpRenderTree/WorkQueue.h: (WorkQueue::setFrozen): Deleted. * DumpRenderTree/WorkQueueItem.h: * DumpRenderTree/mac/DumpRenderTree.mm: (runTest): * DumpRenderTree/mac/FrameLoadDelegate.mm: (-[FrameLoadDelegate processWork:]): (-[FrameLoadDelegate webView:locationChangeDone:forDataSource:]): * DumpRenderTree/mac/TestRunnerMac.mm: (TestRunner::notifyDone): (TestRunner::forceImmediateCompletion): (TestRunner::queueLoad): * DumpRenderTree/win/DumpRenderTree.cpp: (runTest): * DumpRenderTree/win/FrameLoadDelegate.cpp: (FrameLoadDelegate::processWork): (FrameLoadDelegate::locationChangeDone): * DumpRenderTree/win/TestRunnerWin.cpp: (TestRunner::notifyDone): (TestRunner::forceImmediateCompletion): (TestRunner::queueLoad): Canonical link: https://commits.webkit.org/205473@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237099 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-15 14:24:49 +00:00
#pragma once
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
#include <wtf/Assertions.h>
#include <wtf/FastMalloc.h>
namespace JSC { namespace DFG {
class StructureAbstractValue;
} } // namespace JSC::DFG
namespace WTF {
// FIXME: This currently only works for types that are pointer-like: they should have the size
// of a pointer and like a pointer they should not have assignment operators, copy constructors,
// non-trivial default constructors, and non-trivial destructors. It may be possible to lift all
// of these restrictions. If we succeeded then this should be renamed to just TinySet.
// https://bugs.webkit.org/show_bug.cgi?id=145741
template<typename T>
class TinyPtrSet {
[WTF][JSC] Make JSC and WTF aggressively-fast-malloced https://bugs.webkit.org/show_bug.cgi?id=200611 Reviewed by Saam Barati. Source/JavaScriptCore: This patch aggressively puts many classes into FastMalloc. In JSC side, we grep `std::make_unique` etc. to find potentially system-malloc-allocated classes. After this patch, all the JSC related allocations in JetStream2 cli is done from bmalloc. In the future, it would be nice that we add `WTF::makeUnique<T>` helper function and throw a compile error if `T` is not FastMalloc annotated[1]. Putting WebKit classes in FastMalloc has many benefits. 1. Simply, it is fast. 2. vmmap can tell the amount of memory used for WebKit. 3. bmalloc can isolate WebKit memory allocation from the rest of the world. This is useful since we can know more about what component is corrupting the memory from the memory corruption crash. [1]: https://bugs.webkit.org/show_bug.cgi?id=200620 * API/ObjCCallbackFunction.mm: * assembler/AbstractMacroAssembler.h: * b3/B3PhiChildren.h: * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h: * b3/air/AirDisassembler.h: * bytecode/AccessCaseSnippetParams.h: * bytecode/CallVariant.h: * bytecode/DeferredSourceDump.h: * bytecode/ExecutionCounter.h: * bytecode/GetByIdStatus.h: * bytecode/GetByIdVariant.h: * bytecode/InByIdStatus.h: * bytecode/InByIdVariant.h: * bytecode/InstanceOfStatus.h: * bytecode/InstanceOfVariant.h: * bytecode/PutByIdStatus.h: * bytecode/PutByIdVariant.h: * bytecode/ValueProfile.h: * dfg/DFGAbstractInterpreter.h: * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::newVariableAccessData): * dfg/DFGFlowIndexing.h: * dfg/DFGFlowMap.h: * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData): * dfg/DFGMaximalFlushInsertionPhase.cpp: (JSC::DFG::MaximalFlushInsertionPhase::newVariableAccessData): * dfg/DFGOSRExit.h: * dfg/DFGSpeculativeJIT.h: * dfg/DFGVariableAccessData.h: * disassembler/ARM64/A64DOpcode.h: * inspector/remote/socket/RemoteInspectorMessageParser.h: * inspector/remote/socket/RemoteInspectorSocket.h: * inspector/remote/socket/RemoteInspectorSocketEndpoint.h: * jit/PCToCodeOriginMap.h: * runtime/BasicBlockLocation.h: * runtime/DoublePredictionFuzzerAgent.h: * runtime/JSRunLoopTimer.h: * runtime/PromiseDeferredTimer.h: (JSC::PromiseDeferredTimer::create): PromiseDeferredTimer should be allocated as `Ref<>` instead of `std::unique_ptr` since it is inheriting ThreadSafeRefCounted<>. Holding such a class with std::unique_ptr could lead to potentially dangerous operations (like, someone holds it with Ref<> while it is deleted by std::unique_ptr<>). * runtime/RandomizingFuzzerAgent.h: * runtime/SymbolTable.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: * tools/JSDollarVM.cpp: * tools/SigillCrashAnalyzer.cpp: * wasm/WasmFormat.h: * wasm/WasmMemory.cpp: * wasm/WasmSignature.h: * yarr/YarrJIT.h: Source/WebCore: Changed the accessor since we changed std::unique_ptr to Ref for this field. No behavior change. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::addTimerSetNotification): (WebCore::WorkerScriptController::removeTimerSetNotification): Source/WTF: WTF has many data structures, in particular, containers. And these containers can be allocated like `std::make_unique<Container>()`. Without WTF_MAKE_FAST_ALLOCATED, this container itself is allocated from the system malloc. This patch attaches WTF_MAKE_FAST_ALLOCATED more aggressively not to allocate them from the system malloc. And we add some `final` to containers and classes that would be never inherited. * wtf/Assertions.cpp: * wtf/Atomics.h: * wtf/AutodrainedPool.h: * wtf/Bag.h: (WTF::Bag::Bag): Deleted. (WTF::Bag::~Bag): Deleted. (WTF::Bag::clear): Deleted. (WTF::Bag::add): Deleted. (WTF::Bag::iterator::iterator): Deleted. (WTF::Bag::iterator::operator! const): Deleted. (WTF::Bag::iterator::operator* const): Deleted. (WTF::Bag::iterator::operator++): Deleted. (WTF::Bag::iterator::operator== const): Deleted. (WTF::Bag::iterator::operator!= const): Deleted. (WTF::Bag::begin): Deleted. (WTF::Bag::begin const): Deleted. (WTF::Bag::end const): Deleted. (WTF::Bag::isEmpty const): Deleted. (WTF::Bag::unwrappedHead const): Deleted. * wtf/BitVector.h: (WTF::BitVector::BitVector): Deleted. (WTF::BitVector::~BitVector): Deleted. (WTF::BitVector::operator=): Deleted. (WTF::BitVector::size const): Deleted. (WTF::BitVector::ensureSize): Deleted. (WTF::BitVector::quickGet const): Deleted. (WTF::BitVector::quickSet): Deleted. (WTF::BitVector::quickClear): Deleted. (WTF::BitVector::get const): Deleted. (WTF::BitVector::contains const): Deleted. (WTF::BitVector::set): Deleted. (WTF::BitVector::add): Deleted. (WTF::BitVector::ensureSizeAndSet): Deleted. (WTF::BitVector::clear): Deleted. (WTF::BitVector::remove): Deleted. (WTF::BitVector::merge): Deleted. (WTF::BitVector::filter): Deleted. (WTF::BitVector::exclude): Deleted. (WTF::BitVector::bitCount const): Deleted. (WTF::BitVector::isEmpty const): Deleted. (WTF::BitVector::findBit const): Deleted. (WTF::BitVector::isEmptyValue const): Deleted. (WTF::BitVector::isDeletedValue const): Deleted. (WTF::BitVector::isEmptyOrDeletedValue const): Deleted. (WTF::BitVector::operator== const): Deleted. (WTF::BitVector::hash const): Deleted. (WTF::BitVector::iterator::iterator): Deleted. (WTF::BitVector::iterator::operator* const): Deleted. (WTF::BitVector::iterator::operator++): Deleted. (WTF::BitVector::iterator::isAtEnd const): Deleted. (WTF::BitVector::iterator::operator== const): Deleted. (WTF::BitVector::iterator::operator!= const): Deleted. (WTF::BitVector::begin const): Deleted. (WTF::BitVector::end const): Deleted. (WTF::BitVector::bitsInPointer): Deleted. (WTF::BitVector::maxInlineBits): Deleted. (WTF::BitVector::byteCount): Deleted. (WTF::BitVector::makeInlineBits): Deleted. (WTF::BitVector::cleanseInlineBits): Deleted. (WTF::BitVector::bitCount): Deleted. (WTF::BitVector::findBitFast const): Deleted. (WTF::BitVector::findBitSimple const): Deleted. (WTF::BitVector::OutOfLineBits::numBits const): Deleted. (WTF::BitVector::OutOfLineBits::numWords const): Deleted. (WTF::BitVector::OutOfLineBits::bits): Deleted. (WTF::BitVector::OutOfLineBits::bits const): Deleted. (WTF::BitVector::OutOfLineBits::OutOfLineBits): Deleted. (WTF::BitVector::isInline const): Deleted. (WTF::BitVector::outOfLineBits const): Deleted. (WTF::BitVector::outOfLineBits): Deleted. (WTF::BitVector::bits): Deleted. (WTF::BitVector::bits const): Deleted. * wtf/Bitmap.h: (WTF::Bitmap::size): Deleted. (WTF::Bitmap::iterator::iterator): Deleted. (WTF::Bitmap::iterator::operator* const): Deleted. (WTF::Bitmap::iterator::operator++): Deleted. (WTF::Bitmap::iterator::operator== const): Deleted. (WTF::Bitmap::iterator::operator!= const): Deleted. (WTF::Bitmap::begin const): Deleted. (WTF::Bitmap::end const): Deleted. * wtf/Box.h: * wtf/BumpPointerAllocator.h: * wtf/CPUTime.h: * wtf/CheckedBoolean.h: * wtf/CommaPrinter.h: (WTF::CommaPrinter::CommaPrinter): Deleted. (WTF::CommaPrinter::dump const): Deleted. (WTF::CommaPrinter::didPrint const): Deleted. * wtf/CompactPointerTuple.h: (WTF::CompactPointerTuple::encodeType): Deleted. (WTF::CompactPointerTuple::decodeType): Deleted. (WTF::CompactPointerTuple::CompactPointerTuple): Deleted. (WTF::CompactPointerTuple::pointer const): Deleted. (WTF::CompactPointerTuple::setPointer): Deleted. (WTF::CompactPointerTuple::type const): Deleted. (WTF::CompactPointerTuple::setType): Deleted. * wtf/CompilationThread.h: (WTF::CompilationScope::CompilationScope): Deleted. (WTF::CompilationScope::~CompilationScope): Deleted. (WTF::CompilationScope::leaveEarly): Deleted. * wtf/CompletionHandler.h: (WTF::CompletionHandler<Out): (WTF::Detail::CallableWrapper<CompletionHandler<Out): (WTF::CompletionHandlerCallingScope::CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::~CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::CompletionHandler<void): Deleted. * wtf/ConcurrentBuffer.h: (WTF::ConcurrentBuffer::ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::~ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::growExact): Deleted. (WTF::ConcurrentBuffer::grow): Deleted. (WTF::ConcurrentBuffer::array const): Deleted. (WTF::ConcurrentBuffer::operator[]): Deleted. (WTF::ConcurrentBuffer::operator[] const): Deleted. (WTF::ConcurrentBuffer::createArray): Deleted. * wtf/ConcurrentPtrHashSet.h: (WTF::ConcurrentPtrHashSet::contains): Deleted. (WTF::ConcurrentPtrHashSet::add): Deleted. (WTF::ConcurrentPtrHashSet::size const): Deleted. (WTF::ConcurrentPtrHashSet::Table::maxLoad const): Deleted. (WTF::ConcurrentPtrHashSet::hash): Deleted. (WTF::ConcurrentPtrHashSet::cast): Deleted. (WTF::ConcurrentPtrHashSet::containsImpl const): Deleted. (WTF::ConcurrentPtrHashSet::addImpl): Deleted. * wtf/ConcurrentVector.h: (WTF::ConcurrentVector::~ConcurrentVector): Deleted. (WTF::ConcurrentVector::size const): Deleted. (WTF::ConcurrentVector::isEmpty const): Deleted. (WTF::ConcurrentVector::at): Deleted. (WTF::ConcurrentVector::at const): Deleted. (WTF::ConcurrentVector::operator[]): Deleted. (WTF::ConcurrentVector::operator[] const): Deleted. (WTF::ConcurrentVector::first): Deleted. (WTF::ConcurrentVector::first const): Deleted. (WTF::ConcurrentVector::last): Deleted. (WTF::ConcurrentVector::last const): Deleted. (WTF::ConcurrentVector::takeLast): Deleted. (WTF::ConcurrentVector::append): Deleted. (WTF::ConcurrentVector::alloc): Deleted. (WTF::ConcurrentVector::removeLast): Deleted. (WTF::ConcurrentVector::grow): Deleted. (WTF::ConcurrentVector::begin): Deleted. (WTF::ConcurrentVector::end): Deleted. (WTF::ConcurrentVector::segmentExistsFor): Deleted. (WTF::ConcurrentVector::segmentFor): Deleted. (WTF::ConcurrentVector::subscriptFor): Deleted. (WTF::ConcurrentVector::ensureSegmentsFor): Deleted. (WTF::ConcurrentVector::ensureSegment): Deleted. (WTF::ConcurrentVector::allocateSegment): Deleted. * wtf/Condition.h: (WTF::Condition::waitUntil): Deleted. (WTF::Condition::waitFor): Deleted. (WTF::Condition::wait): Deleted. (WTF::Condition::notifyOne): Deleted. (WTF::Condition::notifyAll): Deleted. * wtf/CountingLock.h: (WTF::CountingLock::LockHooks::lockHook): Deleted. (WTF::CountingLock::LockHooks::unlockHook): Deleted. (WTF::CountingLock::LockHooks::parkHook): Deleted. (WTF::CountingLock::LockHooks::handoffHook): Deleted. (WTF::CountingLock::tryLock): Deleted. (WTF::CountingLock::lock): Deleted. (WTF::CountingLock::unlock): Deleted. (WTF::CountingLock::isHeld const): Deleted. (WTF::CountingLock::isLocked const): Deleted. (WTF::CountingLock::Count::operator bool const): Deleted. (WTF::CountingLock::Count::operator== const): Deleted. (WTF::CountingLock::Count::operator!= const): Deleted. (WTF::CountingLock::tryOptimisticRead): Deleted. (WTF::CountingLock::validate): Deleted. (WTF::CountingLock::doOptimizedRead): Deleted. (WTF::CountingLock::tryOptimisticFencelessRead): Deleted. (WTF::CountingLock::fencelessValidate): Deleted. (WTF::CountingLock::doOptimizedFencelessRead): Deleted. (WTF::CountingLock::getCount): Deleted. * wtf/CrossThreadQueue.h: * wtf/CrossThreadTask.h: * wtf/CryptographicallyRandomNumber.cpp: * wtf/DataMutex.h: * wtf/DateMath.h: * wtf/Deque.h: (WTF::Deque::size const): Deleted. (WTF::Deque::isEmpty const): Deleted. (WTF::Deque::begin): Deleted. (WTF::Deque::end): Deleted. (WTF::Deque::begin const): Deleted. (WTF::Deque::end const): Deleted. (WTF::Deque::rbegin): Deleted. (WTF::Deque::rend): Deleted. (WTF::Deque::rbegin const): Deleted. (WTF::Deque::rend const): Deleted. (WTF::Deque::first): Deleted. (WTF::Deque::first const): Deleted. (WTF::Deque::last): Deleted. (WTF::Deque::last const): Deleted. (WTF::Deque::append): Deleted. * wtf/Dominators.h: * wtf/DoublyLinkedList.h: * wtf/Expected.h: * wtf/FastBitVector.h: * wtf/FileMetadata.h: * wtf/FileSystem.h: * wtf/GraphNodeWorklist.h: * wtf/GregorianDateTime.h: (WTF::GregorianDateTime::GregorianDateTime): Deleted. (WTF::GregorianDateTime::year const): Deleted. (WTF::GregorianDateTime::month const): Deleted. (WTF::GregorianDateTime::yearDay const): Deleted. (WTF::GregorianDateTime::monthDay const): Deleted. (WTF::GregorianDateTime::weekDay const): Deleted. (WTF::GregorianDateTime::hour const): Deleted. (WTF::GregorianDateTime::minute const): Deleted. (WTF::GregorianDateTime::second const): Deleted. (WTF::GregorianDateTime::utcOffset const): Deleted. (WTF::GregorianDateTime::isDST const): Deleted. (WTF::GregorianDateTime::setYear): Deleted. (WTF::GregorianDateTime::setMonth): Deleted. (WTF::GregorianDateTime::setYearDay): Deleted. (WTF::GregorianDateTime::setMonthDay): Deleted. (WTF::GregorianDateTime::setWeekDay): Deleted. (WTF::GregorianDateTime::setHour): Deleted. (WTF::GregorianDateTime::setMinute): Deleted. (WTF::GregorianDateTime::setSecond): Deleted. (WTF::GregorianDateTime::setUtcOffset): Deleted. (WTF::GregorianDateTime::setIsDST): Deleted. (WTF::GregorianDateTime::operator tm const): Deleted. (WTF::GregorianDateTime::copyFrom): Deleted. * wtf/HashTable.h: * wtf/Hasher.h: * wtf/HexNumber.h: * wtf/Indenter.h: * wtf/IndexMap.h: * wtf/IndexSet.h: * wtf/IndexSparseSet.h: * wtf/IndexedContainerIterator.h: * wtf/Insertion.h: * wtf/IteratorAdaptors.h: * wtf/IteratorRange.h: * wtf/KeyValuePair.h: * wtf/ListHashSet.h: (WTF::ListHashSet::begin): Deleted. (WTF::ListHashSet::end): Deleted. (WTF::ListHashSet::begin const): Deleted. (WTF::ListHashSet::end const): Deleted. (WTF::ListHashSet::random): Deleted. (WTF::ListHashSet::random const): Deleted. (WTF::ListHashSet::rbegin): Deleted. (WTF::ListHashSet::rend): Deleted. (WTF::ListHashSet::rbegin const): Deleted. (WTF::ListHashSet::rend const): Deleted. * wtf/Liveness.h: * wtf/LocklessBag.h: (WTF::LocklessBag::LocklessBag): Deleted. (WTF::LocklessBag::add): Deleted. (WTF::LocklessBag::iterate): Deleted. (WTF::LocklessBag::consumeAll): Deleted. (WTF::LocklessBag::consumeAllWithNode): Deleted. (WTF::LocklessBag::~LocklessBag): Deleted. * wtf/LoggingHashID.h: * wtf/MD5.h: * wtf/MachSendRight.h: * wtf/MainThreadData.h: * wtf/Markable.h: * wtf/MediaTime.h: * wtf/MemoryPressureHandler.h: * wtf/MessageQueue.h: (WTF::MessageQueue::MessageQueue): Deleted. * wtf/MetaAllocator.h: * wtf/MonotonicTime.h: (WTF::MonotonicTime::MonotonicTime): Deleted. (WTF::MonotonicTime::fromRawSeconds): Deleted. (WTF::MonotonicTime::infinity): Deleted. (WTF::MonotonicTime::nan): Deleted. (WTF::MonotonicTime::secondsSinceEpoch const): Deleted. (WTF::MonotonicTime::approximateMonotonicTime const): Deleted. (WTF::MonotonicTime::operator bool const): Deleted. (WTF::MonotonicTime::operator+ const): Deleted. (WTF::MonotonicTime::operator- const): Deleted. (WTF::MonotonicTime::operator% const): Deleted. (WTF::MonotonicTime::operator+=): Deleted. (WTF::MonotonicTime::operator-=): Deleted. (WTF::MonotonicTime::operator== const): Deleted. (WTF::MonotonicTime::operator!= const): Deleted. (WTF::MonotonicTime::operator< const): Deleted. (WTF::MonotonicTime::operator> const): Deleted. (WTF::MonotonicTime::operator<= const): Deleted. (WTF::MonotonicTime::operator>= const): Deleted. (WTF::MonotonicTime::isolatedCopy const): Deleted. (WTF::MonotonicTime::encode const): Deleted. (WTF::MonotonicTime::decode): Deleted. * wtf/NaturalLoops.h: * wtf/NoLock.h: * wtf/OSAllocator.h: * wtf/OptionSet.h: * wtf/Optional.h: * wtf/OrderMaker.h: * wtf/Packed.h: (WTF::alignof): * wtf/PackedIntVector.h: (WTF::PackedIntVector::PackedIntVector): Deleted. (WTF::PackedIntVector::operator=): Deleted. (WTF::PackedIntVector::size const): Deleted. (WTF::PackedIntVector::ensureSize): Deleted. (WTF::PackedIntVector::resize): Deleted. (WTF::PackedIntVector::clearAll): Deleted. (WTF::PackedIntVector::get const): Deleted. (WTF::PackedIntVector::set): Deleted. (WTF::PackedIntVector::mask): Deleted. * wtf/PageBlock.h: * wtf/ParallelJobsOpenMP.h: * wtf/ParkingLot.h: * wtf/PriorityQueue.h: (WTF::PriorityQueue::size const): Deleted. (WTF::PriorityQueue::isEmpty const): Deleted. (WTF::PriorityQueue::enqueue): Deleted. (WTF::PriorityQueue::peek const): Deleted. (WTF::PriorityQueue::dequeue): Deleted. (WTF::PriorityQueue::decreaseKey): Deleted. (WTF::PriorityQueue::increaseKey): Deleted. (WTF::PriorityQueue::begin const): Deleted. (WTF::PriorityQueue::end const): Deleted. (WTF::PriorityQueue::isValidHeap const): Deleted. (WTF::PriorityQueue::parentOf): Deleted. (WTF::PriorityQueue::leftChildOf): Deleted. (WTF::PriorityQueue::rightChildOf): Deleted. (WTF::PriorityQueue::siftUp): Deleted. (WTF::PriorityQueue::siftDown): Deleted. * wtf/RandomDevice.h: * wtf/Range.h: * wtf/RangeSet.h: (WTF::RangeSet::RangeSet): Deleted. (WTF::RangeSet::~RangeSet): Deleted. (WTF::RangeSet::add): Deleted. (WTF::RangeSet::contains const): Deleted. (WTF::RangeSet::overlaps const): Deleted. (WTF::RangeSet::clear): Deleted. (WTF::RangeSet::dump const): Deleted. (WTF::RangeSet::dumpRaw const): Deleted. (WTF::RangeSet::begin const): Deleted. (WTF::RangeSet::end const): Deleted. (WTF::RangeSet::addAll): Deleted. (WTF::RangeSet::compact): Deleted. (WTF::RangeSet::overlapsNonEmpty): Deleted. (WTF::RangeSet::subsumesNonEmpty): Deleted. (WTF::RangeSet::findRange const): Deleted. * wtf/RecursableLambda.h: * wtf/RedBlackTree.h: (WTF::RedBlackTree::Node::successor const): Deleted. (WTF::RedBlackTree::Node::predecessor const): Deleted. (WTF::RedBlackTree::Node::successor): Deleted. (WTF::RedBlackTree::Node::predecessor): Deleted. (WTF::RedBlackTree::Node::reset): Deleted. (WTF::RedBlackTree::Node::parent const): Deleted. (WTF::RedBlackTree::Node::setParent): Deleted. (WTF::RedBlackTree::Node::left const): Deleted. (WTF::RedBlackTree::Node::setLeft): Deleted. (WTF::RedBlackTree::Node::right const): Deleted. (WTF::RedBlackTree::Node::setRight): Deleted. (WTF::RedBlackTree::Node::color const): Deleted. (WTF::RedBlackTree::Node::setColor): Deleted. (WTF::RedBlackTree::RedBlackTree): Deleted. (WTF::RedBlackTree::insert): Deleted. (WTF::RedBlackTree::remove): Deleted. (WTF::RedBlackTree::findExact const): Deleted. (WTF::RedBlackTree::findLeastGreaterThanOrEqual const): Deleted. (WTF::RedBlackTree::findGreatestLessThanOrEqual const): Deleted. (WTF::RedBlackTree::first const): Deleted. (WTF::RedBlackTree::last const): Deleted. (WTF::RedBlackTree::size): Deleted. (WTF::RedBlackTree::isEmpty): Deleted. (WTF::RedBlackTree::treeMinimum): Deleted. (WTF::RedBlackTree::treeMaximum): Deleted. (WTF::RedBlackTree::treeInsert): Deleted. (WTF::RedBlackTree::leftRotate): Deleted. (WTF::RedBlackTree::rightRotate): Deleted. (WTF::RedBlackTree::removeFixup): Deleted. * wtf/ResourceUsage.h: * wtf/RunLoop.cpp: * wtf/RunLoopTimer.h: * wtf/SHA1.h: * wtf/Seconds.h: (WTF::Seconds::Seconds): Deleted. (WTF::Seconds::value const): Deleted. (WTF::Seconds::minutes const): Deleted. (WTF::Seconds::seconds const): Deleted. (WTF::Seconds::milliseconds const): Deleted. (WTF::Seconds::microseconds const): Deleted. (WTF::Seconds::nanoseconds const): Deleted. (WTF::Seconds::minutesAs const): Deleted. (WTF::Seconds::secondsAs const): Deleted. (WTF::Seconds::millisecondsAs const): Deleted. (WTF::Seconds::microsecondsAs const): Deleted. (WTF::Seconds::nanosecondsAs const): Deleted. (WTF::Seconds::fromMinutes): Deleted. (WTF::Seconds::fromHours): Deleted. (WTF::Seconds::fromMilliseconds): Deleted. (WTF::Seconds::fromMicroseconds): Deleted. (WTF::Seconds::fromNanoseconds): Deleted. (WTF::Seconds::infinity): Deleted. (WTF::Seconds::nan): Deleted. (WTF::Seconds::operator bool const): Deleted. (WTF::Seconds::operator+ const): Deleted. (WTF::Seconds::operator- const): Deleted. (WTF::Seconds::operator* const): Deleted. (WTF::Seconds::operator/ const): Deleted. (WTF::Seconds::operator% const): Deleted. (WTF::Seconds::operator+=): Deleted. (WTF::Seconds::operator-=): Deleted. (WTF::Seconds::operator*=): Deleted. (WTF::Seconds::operator/=): Deleted. (WTF::Seconds::operator%=): Deleted. (WTF::Seconds::operator== const): Deleted. (WTF::Seconds::operator!= const): Deleted. (WTF::Seconds::operator< const): Deleted. (WTF::Seconds::operator> const): Deleted. (WTF::Seconds::operator<= const): Deleted. (WTF::Seconds::operator>= const): Deleted. (WTF::Seconds::isolatedCopy const): Deleted. (WTF::Seconds::encode const): Deleted. (WTF::Seconds::decode): Deleted. * wtf/SegmentedVector.h: (WTF::SegmentedVector::~SegmentedVector): Deleted. (WTF::SegmentedVector::size const): Deleted. (WTF::SegmentedVector::isEmpty const): Deleted. (WTF::SegmentedVector::at): Deleted. (WTF::SegmentedVector::at const): Deleted. (WTF::SegmentedVector::operator[]): Deleted. (WTF::SegmentedVector::operator[] const): Deleted. (WTF::SegmentedVector::first): Deleted. (WTF::SegmentedVector::first const): Deleted. (WTF::SegmentedVector::last): Deleted. (WTF::SegmentedVector::last const): Deleted. (WTF::SegmentedVector::takeLast): Deleted. (WTF::SegmentedVector::append): Deleted. (WTF::SegmentedVector::alloc): Deleted. (WTF::SegmentedVector::removeLast): Deleted. (WTF::SegmentedVector::grow): Deleted. (WTF::SegmentedVector::clear): Deleted. (WTF::SegmentedVector::begin): Deleted. (WTF::SegmentedVector::end): Deleted. (WTF::SegmentedVector::shrinkToFit): Deleted. (WTF::SegmentedVector::deleteAllSegments): Deleted. (WTF::SegmentedVector::segmentExistsFor): Deleted. (WTF::SegmentedVector::segmentFor): Deleted. (WTF::SegmentedVector::subscriptFor): Deleted. (WTF::SegmentedVector::ensureSegmentsFor): Deleted. (WTF::SegmentedVector::ensureSegment): Deleted. (WTF::SegmentedVector::allocateSegment): Deleted. * wtf/SetForScope.h: * wtf/SingleRootGraph.h: * wtf/SinglyLinkedList.h: * wtf/SmallPtrSet.h: * wtf/SpanningTree.h: * wtf/Spectrum.h: * wtf/StackBounds.h: * wtf/StackShot.h: * wtf/StackShotProfiler.h: * wtf/StackStats.h: * wtf/StackTrace.h: * wtf/StreamBuffer.h: * wtf/SynchronizedFixedQueue.h: (WTF::SynchronizedFixedQueue::create): Deleted. (WTF::SynchronizedFixedQueue::open): Deleted. (WTF::SynchronizedFixedQueue::close): Deleted. (WTF::SynchronizedFixedQueue::isOpen): Deleted. (WTF::SynchronizedFixedQueue::enqueue): Deleted. (WTF::SynchronizedFixedQueue::dequeue): Deleted. (WTF::SynchronizedFixedQueue::SynchronizedFixedQueue): Deleted. * wtf/SystemTracing.h: * wtf/ThreadGroup.h: (WTF::ThreadGroup::create): Deleted. (WTF::ThreadGroup::threads const): Deleted. (WTF::ThreadGroup::getLock): Deleted. (WTF::ThreadGroup::weakFromThis): Deleted. * wtf/ThreadSpecific.h: * wtf/ThreadingPrimitives.h: (WTF::Mutex::impl): Deleted. * wtf/TimeWithDynamicClockType.h: (WTF::TimeWithDynamicClockType::TimeWithDynamicClockType): Deleted. (WTF::TimeWithDynamicClockType::fromRawSeconds): Deleted. (WTF::TimeWithDynamicClockType::secondsSinceEpoch const): Deleted. (WTF::TimeWithDynamicClockType::clockType const): Deleted. (WTF::TimeWithDynamicClockType::withSameClockAndRawSeconds const): Deleted. (WTF::TimeWithDynamicClockType::operator bool const): Deleted. (WTF::TimeWithDynamicClockType::operator+ const): Deleted. (WTF::TimeWithDynamicClockType::operator- const): Deleted. (WTF::TimeWithDynamicClockType::operator+=): Deleted. (WTF::TimeWithDynamicClockType::operator-=): Deleted. (WTF::TimeWithDynamicClockType::operator== const): Deleted. (WTF::TimeWithDynamicClockType::operator!= const): Deleted. * wtf/TimingScope.h: * wtf/TinyLRUCache.h: * wtf/TinyPtrSet.h: * wtf/URLParser.cpp: * wtf/URLParser.h: * wtf/Unexpected.h: * wtf/Variant.h: * wtf/WTFSemaphore.h: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::signal): Deleted. (WTF::Semaphore::waitUntil): Deleted. (WTF::Semaphore::waitFor): Deleted. (WTF::Semaphore::wait): Deleted. * wtf/WallTime.h: (WTF::WallTime::WallTime): Deleted. (WTF::WallTime::fromRawSeconds): Deleted. (WTF::WallTime::infinity): Deleted. (WTF::WallTime::nan): Deleted. (WTF::WallTime::secondsSinceEpoch const): Deleted. (WTF::WallTime::approximateWallTime const): Deleted. (WTF::WallTime::operator bool const): Deleted. (WTF::WallTime::operator+ const): Deleted. (WTF::WallTime::operator- const): Deleted. (WTF::WallTime::operator+=): Deleted. (WTF::WallTime::operator-=): Deleted. (WTF::WallTime::operator== const): Deleted. (WTF::WallTime::operator!= const): Deleted. (WTF::WallTime::operator< const): Deleted. (WTF::WallTime::operator> const): Deleted. (WTF::WallTime::operator<= const): Deleted. (WTF::WallTime::operator>= const): Deleted. (WTF::WallTime::isolatedCopy const): Deleted. * wtf/WeakHashSet.h: (WTF::WeakHashSet::WeakHashSetConstIterator::WeakHashSetConstIterator): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::get const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator* const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator-> const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator++): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::skipEmptyBuckets): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator== const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator!= const): Deleted. (WTF::WeakHashSet::WeakHashSet): Deleted. (WTF::WeakHashSet::begin const): Deleted. (WTF::WeakHashSet::end const): Deleted. (WTF::WeakHashSet::add): Deleted. (WTF::WeakHashSet::remove): Deleted. (WTF::WeakHashSet::contains const): Deleted. (WTF::WeakHashSet::capacity const): Deleted. (WTF::WeakHashSet::computesEmpty const): Deleted. (WTF::WeakHashSet::hasNullReferences const): Deleted. (WTF::WeakHashSet::computeSize const): Deleted. (WTF::WeakHashSet::checkConsistency const): Deleted. * wtf/WeakRandom.h: (WTF::WeakRandom::WeakRandom): Deleted. (WTF::WeakRandom::setSeed): Deleted. (WTF::WeakRandom::seed const): Deleted. (WTF::WeakRandom::get): Deleted. (WTF::WeakRandom::getUint32): Deleted. (WTF::WeakRandom::lowOffset): Deleted. (WTF::WeakRandom::highOffset): Deleted. (WTF::WeakRandom::nextState): Deleted. (WTF::WeakRandom::generate): Deleted. (WTF::WeakRandom::advance): Deleted. * wtf/WordLock.h: (WTF::WordLock::lock): Deleted. (WTF::WordLock::unlock): Deleted. (WTF::WordLock::isHeld const): Deleted. (WTF::WordLock::isLocked const): Deleted. (WTF::WordLock::isFullyReset const): Deleted. * wtf/generic/MainThreadGeneric.cpp: * wtf/glib/GMutexLocker.h: * wtf/linux/CurrentProcessMemoryStatus.h: * wtf/posix/ThreadingPOSIX.cpp: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::~Semaphore): Deleted. (WTF::Semaphore::wait): Deleted. (WTF::Semaphore::post): Deleted. * wtf/text/ASCIILiteral.h: (WTF::ASCIILiteral::operator const char* const): Deleted. (WTF::ASCIILiteral::fromLiteralUnsafe): Deleted. (WTF::ASCIILiteral::null): Deleted. (WTF::ASCIILiteral::characters const): Deleted. (WTF::ASCIILiteral::ASCIILiteral): Deleted. * wtf/text/AtomString.h: (WTF::AtomString::operator=): Deleted. (WTF::AtomString::isHashTableDeletedValue const): Deleted. (WTF::AtomString::existingHash const): Deleted. (WTF::AtomString::operator const String& const): Deleted. (WTF::AtomString::string const): Deleted. (WTF::AtomString::impl const): Deleted. (WTF::AtomString::is8Bit const): Deleted. (WTF::AtomString::characters8 const): Deleted. (WTF::AtomString::characters16 const): Deleted. (WTF::AtomString::length const): Deleted. (WTF::AtomString::operator[] const): Deleted. (WTF::AtomString::contains const): Deleted. (WTF::AtomString::containsIgnoringASCIICase const): Deleted. (WTF::AtomString::find const): Deleted. (WTF::AtomString::findIgnoringASCIICase const): Deleted. (WTF::AtomString::startsWith const): Deleted. (WTF::AtomString::startsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::endsWith const): Deleted. (WTF::AtomString::endsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::toInt const): Deleted. (WTF::AtomString::toDouble const): Deleted. (WTF::AtomString::toFloat const): Deleted. (WTF::AtomString::percentage const): Deleted. (WTF::AtomString::isNull const): Deleted. (WTF::AtomString::isEmpty const): Deleted. (WTF::AtomString::operator NSString * const): Deleted. * wtf/text/AtomStringImpl.h: (WTF::AtomStringImpl::lookUp): Deleted. (WTF::AtomStringImpl::add): Deleted. (WTF::AtomStringImpl::addWithStringTableProvider): Deleted. * wtf/text/CString.h: (WTF::CStringBuffer::data): Deleted. (WTF::CStringBuffer::length const): Deleted. (WTF::CStringBuffer::CStringBuffer): Deleted. (WTF::CStringBuffer::mutableData): Deleted. (WTF::CString::CString): Deleted. (WTF::CString::data const): Deleted. (WTF::CString::length const): Deleted. (WTF::CString::isNull const): Deleted. (WTF::CString::buffer const): Deleted. (WTF::CString::isHashTableDeletedValue const): Deleted. * wtf/text/ExternalStringImpl.h: (WTF::ExternalStringImpl::freeExternalBuffer): Deleted. * wtf/text/LineBreakIteratorPoolICU.h: * wtf/text/NullTextBreakIterator.h: * wtf/text/OrdinalNumber.h: * wtf/text/StringBuffer.h: * wtf/text/StringBuilder.h: * wtf/text/StringConcatenateNumbers.h: * wtf/text/StringHasher.h: * wtf/text/StringImpl.h: * wtf/text/StringView.cpp: * wtf/text/StringView.h: (WTF::StringView::left const): Deleted. (WTF::StringView::right const): Deleted. (WTF::StringView::underlyingStringIsValid const): Deleted. (WTF::StringView::setUnderlyingString): Deleted. * wtf/text/SymbolImpl.h: (WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl): Deleted. (WTF::SymbolImpl::StaticSymbolImpl::operator SymbolImpl&): Deleted. (WTF::PrivateSymbolImpl::PrivateSymbolImpl): Deleted. (WTF::RegisteredSymbolImpl::symbolRegistry const): Deleted. (WTF::RegisteredSymbolImpl::clearSymbolRegistry): Deleted. (WTF::RegisteredSymbolImpl::RegisteredSymbolImpl): Deleted. * wtf/text/SymbolRegistry.h: * wtf/text/TextBreakIterator.h: * wtf/text/TextPosition.h: * wtf/text/TextStream.h: * wtf/text/WTFString.h: (WTF::String::swap): Deleted. (WTF::String::adopt): Deleted. (WTF::String::isNull const): Deleted. (WTF::String::isEmpty const): Deleted. (WTF::String::impl const): Deleted. (WTF::String::releaseImpl): Deleted. (WTF::String::length const): Deleted. (WTF::String::characters8 const): Deleted. (WTF::String::characters16 const): Deleted. (WTF::String::is8Bit const): Deleted. (WTF::String::sizeInBytes const): Deleted. (WTF::String::operator[] const): Deleted. (WTF::String::find const): Deleted. (WTF::String::findIgnoringASCIICase const): Deleted. (WTF::String::reverseFind const): Deleted. (WTF::String::contains const): Deleted. (WTF::String::containsIgnoringASCIICase const): Deleted. (WTF::String::startsWith const): Deleted. (WTF::String::startsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixStartingAt const): Deleted. (WTF::String::endsWith const): Deleted. (WTF::String::endsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixEndingAt const): Deleted. (WTF::String::append): Deleted. (WTF::String::left const): Deleted. (WTF::String::right const): Deleted. (WTF::String::createUninitialized): Deleted. (WTF::String::fromUTF8WithLatin1Fallback): Deleted. (WTF::String::isAllASCII const): Deleted. (WTF::String::isAllLatin1 const): Deleted. (WTF::String::isSpecialCharacter const): Deleted. (WTF::String::isHashTableDeletedValue const): Deleted. (WTF::String::hash const): Deleted. (WTF::String::existingHash const): Deleted. * wtf/text/cf/TextBreakIteratorCF.h: * wtf/text/icu/TextBreakIteratorICU.h: * wtf/text/icu/UTextProviderLatin1.h: * wtf/threads/BinarySemaphore.h: (WTF::BinarySemaphore::waitFor): Deleted. (WTF::BinarySemaphore::wait): Deleted. * wtf/unicode/Collator.h: * wtf/win/GDIObject.h: * wtf/win/PathWalker.h: * wtf/win/Win32Handle.h: Canonical link: https://commits.webkit.org/214396@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-12 20:57:15 +00:00
WTF_MAKE_FAST_ALLOCATED;
Harden how the compiler references GC objects https://bugs.webkit.org/show_bug.cgi?id=167277 <rdar://problem/30179506> Reviewed by Filip Pizlo. Source/JavaScriptCore: Since r210971, the DFG/FTL will flash safepoints before each phase. This means that there are more opportunities for a GC to happen while the compiler is running. Because of this, the compiler must keep track of all the heap pointers that are part of the Graph data structure. To accomplish this, I've designed a new type called RegisteredStructure that can only be constructed after the Graph becomes aware of its underlying Structure*. I designed this new type to have the type system in C++ help us catch errors where we're not informing the graph/plan of a heap pointer. I've made it a compile error to create an OpInfo with a pointer T* where T inherits from HeapCell. This encourages an OpInfo to be created with either a FrozenValue* or a RegisteredStructure. I've added similar compile time assertions for TrustedImmPtr in DFG::SpeculativeJIT and FTL::Output::constIntPtr. These static asserts don't save us from all bad programs because there are ways to write code that's incorrect that compiles, but the new types do help us ensure that the most obvious way of writing the code is correct. The reason this patch is so big is that I've strung RegisteredStructure and RegisteredStructureSet through the entire DFG/FTL. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::determineLiveness): * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): Deleted. (JSC::StructureSet::filterArrayModes): Deleted. (JSC::StructureSet::speculationFromStructures): Deleted. (JSC::StructureSet::arrayModesFromStructures): Deleted. (JSC::StructureSet::validateReferences): Deleted. * bytecode/StructureSet.h: * dfg/DFGAbstractInterpreter.h: (JSC::DFG::AbstractInterpreter::filter): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::booleanResult): (JSC::DFG::isToThisAnIdentity): (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::observeTransition): (JSC::DFG::AbstractInterpreter<AbstractStateType>::filter): * dfg/DFGAbstractValue.cpp: (JSC::DFG::AbstractValue::set): (JSC::DFG::AbstractValue::setType): (JSC::DFG::AbstractValue::mergeOSREntryValue): (JSC::DFG::AbstractValue::filter): (JSC::DFG::AbstractValue::changeStructure): (JSC::DFG::AbstractValue::contains): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::observeTransition): (JSC::DFG::AbstractValue::TransitionObserver::TransitionObserver): * dfg/DFGArgumentsEliminationPhase.cpp: * dfg/DFGArrayMode.cpp: (JSC::DFG::ArrayMode::alreadyChecked): * dfg/DFGArrayifySlowPathGenerator.h: (JSC::DFG::ArrayifySlowPathGenerator::ArrayifySlowPathGenerator): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleConstantInternalFunction): (JSC::DFG::ByteCodeParser::load): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handlePutById): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry): * dfg/DFGCallArrayAllocatorSlowPathGenerator.h: (JSC::DFG::CallArrayAllocatorSlowPathGenerator::CallArrayAllocatorSlowPathGenerator): (JSC::DFG::CallArrayAllocatorWithVariableSizeSlowPathGenerator::CallArrayAllocatorWithVariableSizeSlowPathGenerator): * dfg/DFGCallCreateDirectArgumentsSlowPathGenerator.h: (JSC::DFG::CallCreateDirectArgumentsSlowPathGenerator::CallCreateDirectArgumentsSlowPathGenerator): * dfg/DFGCommonData.cpp: (JSC::DFG::CommonData::notifyCompilingStructureTransition): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::emitGetByOffset): (JSC::DFG::ConstantFoldingPhase::emitPutByOffset): (JSC::DFG::ConstantFoldingPhase::addBaseCheck): (JSC::DFG::ConstantFoldingPhase::addStructureTransitionCheck): * dfg/DFGDesiredWeakReferences.cpp: (JSC::DFG::DesiredWeakReferences::reallyAdd): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::checkArray): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::tryGetConstantProperty): (JSC::DFG::Graph::inferredValueForProperty): (JSC::DFG::Graph::visitChildren): (JSC::DFG::Graph::freeze): (JSC::DFG::Graph::registerStructure): (JSC::DFG::Graph::assertIsRegistered): * dfg/DFGGraph.h: (JSC::DFG::Graph::registerStructure): (JSC::DFG::Graph::addStructureSet): * dfg/DFGJITCompiler.h: (JSC::DFG::JITCompiler::branchWeakStructure): * dfg/DFGMultiGetByOffsetData.cpp: (JSC::DFG::MultiGetByOffsetCase::dumpInContext): * dfg/DFGMultiGetByOffsetData.h: (JSC::DFG::MultiGetByOffsetCase::MultiGetByOffsetCase): (JSC::DFG::MultiGetByOffsetCase::set): * dfg/DFGNode.cpp: (JSC::DFG::Node::convertToPutStructureHint): * dfg/DFGNode.h: (JSC::DFG::Node::convertToCheckStructure): (JSC::DFG::Node::structureSet): (JSC::DFG::Node::structure): (JSC::DFG::Node::OpInfoWrapper::OpInfoWrapper): (JSC::DFG::Node::OpInfoWrapper::operator=): (JSC::DFG::Node::OpInfoWrapper::asRegisteredStructure): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGOpInfo.h: (JSC::DFG::OpInfo::OpInfo): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalizeWithoutNotifyingCallback): * dfg/DFGRegisteredStructure.h: Added. (JSC::DFG::RegisteredStructure::get): (JSC::DFG::RegisteredStructure::operator->): (JSC::DFG::RegisteredStructure::operator==): (JSC::DFG::RegisteredStructure::operator!=): (JSC::DFG::RegisteredStructure::operator bool): (JSC::DFG::RegisteredStructure::RegisteredStructure): (JSC::DFG::RegisteredStructure::createPrivate): * dfg/DFGRegisteredStructureSet.cpp: Added. (JSC::DFG::RegisteredStructureSet::filter): (JSC::DFG::RegisteredStructureSet::filterArrayModes): (JSC::DFG::RegisteredStructureSet::speculationFromStructures): (JSC::DFG::RegisteredStructureSet::arrayModesFromStructures): (JSC::DFG::RegisteredStructureSet::validateReferences): * dfg/DFGRegisteredStructureSet.h: Added. (JSC::DFG::RegisteredStructureSet::RegisteredStructureSet): (JSC::DFG::RegisteredStructureSet::onlyStructure): (JSC::DFG::RegisteredStructureSet::toStructureSet): * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::emitAllocateRawObject): (JSC::DFG::SpeculativeJIT::emitGetCallee): (JSC::DFG::SpeculativeJIT::silentFill): (JSC::DFG::SpeculativeJIT::checkArray): (JSC::DFG::SpeculativeJIT::compileGetByValOnString): (JSC::DFG::SpeculativeJIT::compileFromCharCode): (JSC::DFG::SpeculativeJIT::compileDoubleRep): (JSC::DFG::compileClampDoubleToByte): (JSC::DFG::SpeculativeJIT::compileMakeRope): (JSC::DFG::SpeculativeJIT::compileArithRounding): (JSC::DFG::SpeculativeJIT::compileNewFunctionCommon): (JSC::DFG::SpeculativeJIT::compileNewFunction): (JSC::DFG::SpeculativeJIT::compileCreateActivation): (JSC::DFG::SpeculativeJIT::compileCreateDirectArguments): (JSC::DFG::SpeculativeJIT::compileCreateScopedArguments): (JSC::DFG::SpeculativeJIT::compileCreateClonedArguments): (JSC::DFG::SpeculativeJIT::compileSpread): (JSC::DFG::SpeculativeJIT::compileArraySlice): (JSC::DFG::SpeculativeJIT::compileTypeOf): (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileToStringOrCallStringConstructorOnCell): (JSC::DFG::SpeculativeJIT::compileNewTypedArray): (JSC::DFG::SpeculativeJIT::speculateStringOrStringObject): (JSC::DFG::SpeculativeJIT::compileMaterializeNewObject): * dfg/DFGSpeculativeJIT.h: (JSC::DFG::SpeculativeJIT::TrustedImmPtr::TrustedImmPtr): (JSC::DFG::SpeculativeJIT::TrustedImmPtr::weakPointer): (JSC::DFG::SpeculativeJIT::TrustedImmPtr::operator MacroAssembler::TrustedImmPtr): (JSC::DFG::SpeculativeJIT::TrustedImmPtr::asIntptr): (JSC::DFG::SpeculativeJIT::callOperation): (JSC::DFG::SpeculativeJIT::emitAllocateDestructibleObject): (JSC::DFG::SpeculativeJIT::speculateStringObjectForStructure): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNullOrUndefined): (JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNullOrUndefined): (JSC::DFG::SpeculativeJIT::emitCall): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot): (JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch): (JSC::DFG::SpeculativeJIT::compile): (JSC::DFG::SpeculativeJIT::compileAllocateNewArrayWithSize): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNullOrUndefined): (JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNullOrUndefined): (JSC::DFG::SpeculativeJIT::emitCall): (JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot): (JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch): (JSC::DFG::SpeculativeJIT::compile): (JSC::DFG::SpeculativeJIT::compileAllocateNewArrayWithSize): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::assertIsRegistered): (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::observeTransition): (JSC::DFG::StructureAbstractValue::observeTransitions): (JSC::DFG::StructureAbstractValue::add): (JSC::DFG::StructureAbstractValue::merge): (JSC::DFG::StructureAbstractValue::mergeNotTop): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::filterClassInfoSlow): (JSC::DFG::StructureAbstractValue::contains): (JSC::DFG::StructureAbstractValue::isSubsetOf): (JSC::DFG::StructureAbstractValue::isSupersetOf): (JSC::DFG::StructureAbstractValue::overlaps): (JSC::DFG::StructureAbstractValue::isSubClassOf): (JSC::DFG::StructureAbstractValue::dumpInContext): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::StructureAbstractValue): (JSC::DFG::StructureAbstractValue::operator=): (JSC::DFG::StructureAbstractValue::set): (JSC::DFG::StructureAbstractValue::toStructureSet): (JSC::DFG::StructureAbstractValue::at): (JSC::DFG::StructureAbstractValue::operator[]): (JSC::DFG::StructureAbstractValue::onlyStructure): * dfg/DFGStructureRegistrationPhase.cpp: (JSC::DFG::StructureRegistrationPhase::StructureRegistrationPhase): Deleted. (JSC::DFG::StructureRegistrationPhase::run): Deleted. (JSC::DFG::StructureRegistrationPhase::registerStructures): Deleted. (JSC::DFG::StructureRegistrationPhase::registerStructure): Deleted. (JSC::DFG::StructureRegistrationPhase::assertAreRegistered): Deleted. (JSC::DFG::StructureRegistrationPhase::assertIsRegistered): Deleted. (JSC::DFG::performStructureRegistration): Deleted. * dfg/DFGStructureRegistrationPhase.h: * dfg/DFGTransition.cpp: (JSC::DFG::Transition::dumpInContext): * dfg/DFGTransition.h: (JSC::DFG::Transition::Transition): * dfg/DFGTypeCheckHoistingPhase.cpp: (JSC::DFG::TypeCheckHoistingPhase::noticeStructureCheck): (JSC::DFG::TypeCheckHoistingPhase::noticeStructureCheckAccountingForArrayMode): * dfg/DFGValidate.cpp: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::compileCallObjectConstructor): (JSC::FTL::DFG::LowerDFGToB3::compileCheckStructure): (JSC::FTL::DFG::LowerDFGToB3::compilePutStructure): (JSC::FTL::DFG::LowerDFGToB3::compileArraySlice): (JSC::FTL::DFG::LowerDFGToB3::compileCreateActivation): (JSC::FTL::DFG::LowerDFGToB3::compileNewFunction): (JSC::FTL::DFG::LowerDFGToB3::compileCreateDirectArguments): (JSC::FTL::DFG::LowerDFGToB3::compileCreateRest): (JSC::FTL::DFG::LowerDFGToB3::compileNewArray): (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSpread): (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayBuffer): (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSize): (JSC::FTL::DFG::LowerDFGToB3::compileNewTypedArray): (JSC::FTL::DFG::LowerDFGToB3::compileAllocatePropertyStorage): (JSC::FTL::DFG::LowerDFGToB3::compileReallocatePropertyStorage): (JSC::FTL::DFG::LowerDFGToB3::compileMultiGetByOffset): (JSC::FTL::DFG::LowerDFGToB3::compileMultiPutByOffset): (JSC::FTL::DFG::LowerDFGToB3::compileGetMapBucket): (JSC::FTL::DFG::LowerDFGToB3::compileOverridesHasInstance): (JSC::FTL::DFG::LowerDFGToB3::compileCheckStructureImmediate): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeCreateActivation): (JSC::FTL::DFG::LowerDFGToB3::compileNewRegexp): (JSC::FTL::DFG::LowerDFGToB3::compileLogShadowChickenTail): (JSC::FTL::DFG::LowerDFGToB3::checkStructure): (JSC::FTL::DFG::LowerDFGToB3::checkInferredType): (JSC::FTL::DFG::LowerDFGToB3::allocateObject): (JSC::FTL::DFG::LowerDFGToB3::allocateVariableSizedObject): (JSC::FTL::DFG::LowerDFGToB3::allocateJSArray): (JSC::FTL::DFG::LowerDFGToB3::allocateUninitializedContiguousJSArray): (JSC::FTL::DFG::LowerDFGToB3::boolify): (JSC::FTL::DFG::LowerDFGToB3::equalNullOrUndefined): (JSC::FTL::DFG::LowerDFGToB3::lowCell): (JSC::FTL::DFG::LowerDFGToB3::speculateStringObjectForStructureID): (JSC::FTL::DFG::LowerDFGToB3::weakPointer): (JSC::FTL::DFG::LowerDFGToB3::frozenPointer): (JSC::FTL::DFG::LowerDFGToB3::weakStructureID): (JSC::FTL::DFG::LowerDFGToB3::weakStructure): (JSC::FTL::DFG::LowerDFGToB3::crash): * ftl/FTLOutput.h: (JSC::FTL::Output::weakPointer): (JSC::FTL::Output::constIntPtr): Source/WTF: I made TinyPtrSet use bitwise_cast instead of static_cast for its singleEntry() function so that it can work on pointer-like types just as it can on actual pointer types. An example of where this matters is when you have TinyPtrSet<T> where T is defined to be a struct which wraps a pointer, e.g: struct T { void* m_pointer; } * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::singleEntry): Canonical link: https://commits.webkit.org/184513@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211237 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-26 23:50:58 +00:00
static_assert(sizeof(T) == sizeof(void*), "It's in the title of the class.");
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
public:
TinyPtrSet()
: m_pointer(0)
{
setEmpty();
}
TinyPtrSet(T element)
: m_pointer(0)
{
set(element);
}
ALWAYS_INLINE TinyPtrSet(const TinyPtrSet& other)
: m_pointer(0)
{
copyFrom(other);
}
ALWAYS_INLINE TinyPtrSet& operator=(const TinyPtrSet& other)
{
if (this == &other)
return *this;
deleteListIfNecessary();
copyFrom(other);
return *this;
}
~TinyPtrSet()
{
deleteListIfNecessary();
}
void clear()
{
deleteListIfNecessary();
setEmpty();
}
// Returns the only entry if the array has exactly one entry.
T onlyEntry() const
{
if (isThin())
return singleEntry();
OutOfLineList* list = this->list();
if (list->m_length != 1)
return T();
return list->list()[0];
}
bool isEmpty() const
{
bool result = isThin() && !singleEntry();
if (result)
ASSERT(m_pointer != reservedValue);
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
return result;
}
PolymorphicAccess should buffer AccessCases before regenerating https://bugs.webkit.org/show_bug.cgi?id=156457 Reviewed by Benjamin Poulain. Source/JavaScriptCore: Prior to this change, whenever we added an AccessCase to a PolymorphicAccess, we would regenerate the whole stub. That meant that we'd do O(N^2) work for N access cases. One way to fix this is to have each AccessCase generate a stub just for itself, which cascades down to the already-generated cases. But that removes the binary switch optimization, which makes the IC perform great even when there are many cases. This change fixes the issue by buffering access cases. When we take slow path and try to add a new case, the StructureStubInfo will usually just buffer the new case without generating new code. We simply guarantee that after we buffer a case, we will take at most Options::repatchBufferingCountdown() slow path calls before generating code for it. That option is currently 7. Taking 7 more slow paths means that we have 7 more opportunities to gather more access cases, or to realize that this IC is too crazy to bother with. This change ensures that the DFG still gets the same kind of profiling. This is because the buffered AccessCases are still part of PolymorphicAccess and so are still scanned by GetByIdStatus and PutByIdStatus. The fact that the AccessCases hadn't been generated and so hadn't executed doesn't change much. Mainly, it increases the likelihood that the DFG will see an access case that !couldStillSucceed(). The DFG's existing profile parsing logic can handle this just fine. There are a bunch of algorithmic changes here. StructureStubInfo now caches the set of structures that it has seen as a guard to prevent adding lots of redundant cases, in case we see the same 7 cases after buffering the first one. This cache means we won't wastefully allocate 7 identical AccessCase instances. PolymorphicAccess is now restructured around having separate addCase() and regenerate() calls. That means a bit more moving data around. So far that seems OK for performance, probably since it's O(N) work rather than O(N^2) work. There is room for improvement for future patches, to be sure. This is benchmarking as slightly positive or neutral on JS benchmarks. It's meant to reduce pathologies I saw in page loads. * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeForStubInfoWithoutExitSiteFeedback): * bytecode/PolymorphicAccess.cpp: (JSC::PolymorphicAccess::PolymorphicAccess): (JSC::PolymorphicAccess::~PolymorphicAccess): (JSC::PolymorphicAccess::addCases): (JSC::PolymorphicAccess::addCase): (JSC::PolymorphicAccess::visitWeak): (JSC::PolymorphicAccess::dump): (JSC::PolymorphicAccess::commit): (JSC::PolymorphicAccess::regenerate): (JSC::PolymorphicAccess::aboutToDie): (WTF::printInternal): (JSC::PolymorphicAccess::regenerateWithCases): Deleted. (JSC::PolymorphicAccess::regenerateWithCase): Deleted. * bytecode/PolymorphicAccess.h: (JSC::AccessCase::isGetter): (JSC::AccessCase::callLinkInfo): (JSC::AccessGenerationResult::AccessGenerationResult): (JSC::AccessGenerationResult::madeNoChanges): (JSC::AccessGenerationResult::gaveUp): (JSC::AccessGenerationResult::buffered): (JSC::AccessGenerationResult::generatedNewCode): (JSC::AccessGenerationResult::generatedFinalCode): (JSC::AccessGenerationResult::shouldGiveUpNow): (JSC::AccessGenerationResult::generatedSomeCode): (JSC::PolymorphicAccess::isEmpty): (JSC::PolymorphicAccess::size): (JSC::PolymorphicAccess::at): * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::computeForStubInfo): * bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::StructureStubInfo): (JSC::StructureStubInfo::addAccessCase): (JSC::StructureStubInfo::reset): (JSC::StructureStubInfo::visitWeakReferences): * bytecode/StructureStubInfo.h: (JSC::StructureStubInfo::considerCaching): (JSC::StructureStubInfo::willRepatch): Deleted. (JSC::StructureStubInfo::willCoolDown): Deleted. * jit/JITOperations.cpp: * jit/Repatch.cpp: (JSC::tryCacheGetByID): (JSC::repatchGetByID): (JSC::tryCachePutByID): (JSC::repatchPutByID): (JSC::tryRepatchIn): (JSC::repatchIn): * runtime/JSCJSValue.h: * runtime/JSCJSValueInlines.h: (JSC::JSValue::putByIndex): (JSC::JSValue::structureOrNull): (JSC::JSValue::structureOrUndefined): * runtime/Options.h: Source/WTF: * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::add): Add a helpful comment because I had forgotten what the bool return meant. Canonical link: https://commits.webkit.org/174616@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199382 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-04-12 20:06:26 +00:00
// Returns true if the value was added, or false if the value was already there.
InPlaceAbstractState::beginBasicBlock shouldn't have to clear any abstract values https://bugs.webkit.org/show_bug.cgi?id=185365 Reviewed by Saam Barati. Source/JavaScriptCore: This patch does three things to improve compile times: - Fixes some inlining goofs. - Adds the ability to measure compile times with run-jsc-benchmarks. - Dramatically improves the performance of InPlaceAbstractState::beginBasicBlock by removing the code that clears abstract values. It turns out that on constant folding "needed" this, in the sense that this was the only thing protecting it from loading the abstract value of a no-result node and then concluding that because it had a non-empty m_value, it could be constant-folded. Any node that produces a result will explicitly set its abstract value, so this problem can also be guarded by just having constant folding check if the node it wants to fold returns any result. Solid 0.96% compile time speed-up across SunSpider-CompileTime and V8Spider-CompileTime. Rolling back in after fixing cloop build. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGAbstractValue.cpp: (JSC::DFG::AbstractValue::set): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::merge): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGGraph.h: (JSC::DFG::Graph::doToChildrenWithNode): (JSC::DFG::Graph::doToChildren): * dfg/DFGInPlaceAbstractState.cpp: (JSC::DFG::InPlaceAbstractState::beginBasicBlock): * jit/JIT.cpp: (JSC::JIT::totalCompileTime): * jit/JIT.h: * jsc.cpp: (GlobalObject::finishCreation): (functionTotalCompileTime): Source/WTF: Fix some inlining goof-ups. Rolling back in after fixing cloop build. * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::mergeOtherOutOfLine): Tools: Make it possible to measure compile times. Rolling back in after fixing cloop builds. * Scripts/run-jsc-benchmarks: Canonical link: https://commits.webkit.org/200910@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-08 21:49:09 +00:00
ALWAYS_INLINE bool add(T value)
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
{
ASSERT(value);
if (isThin()) {
if (singleEntry() == value)
return false;
if (!singleEntry()) {
set(value);
return true;
}
OutOfLineList* list = OutOfLineList::create(defaultStartingSize);
list->m_length = 2;
list->list()[0] = singleEntry();
list->list()[1] = value;
set(list);
return true;
}
return addOutOfLine(value);
}
bool remove(T value)
{
if (isThin()) {
if (singleEntry() == value) {
setEmpty();
return true;
}
return false;
}
OutOfLineList* list = this->list();
for (unsigned i = 0; i < list->m_length; ++i) {
if (list->list()[i] != value)
continue;
list->list()[i] = list->list()[--list->m_length];
if (!list->m_length) {
OutOfLineList::destroy(list);
setEmpty();
}
return true;
}
return false;
}
bool contains(T value) const
{
if (isThin())
return singleEntry() == value;
return containsOutOfLine(value);
}
InPlaceAbstractState::beginBasicBlock shouldn't have to clear any abstract values https://bugs.webkit.org/show_bug.cgi?id=185365 Reviewed by Saam Barati. Source/JavaScriptCore: This patch does three things to improve compile times: - Fixes some inlining goofs. - Adds the ability to measure compile times with run-jsc-benchmarks. - Dramatically improves the performance of InPlaceAbstractState::beginBasicBlock by removing the code that clears abstract values. It turns out that on constant folding "needed" this, in the sense that this was the only thing protecting it from loading the abstract value of a no-result node and then concluding that because it had a non-empty m_value, it could be constant-folded. Any node that produces a result will explicitly set its abstract value, so this problem can also be guarded by just having constant folding check if the node it wants to fold returns any result. Solid 0.96% compile time speed-up across SunSpider-CompileTime and V8Spider-CompileTime. Rolling back in after fixing cloop build. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGAbstractValue.cpp: (JSC::DFG::AbstractValue::set): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::merge): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGGraph.h: (JSC::DFG::Graph::doToChildrenWithNode): (JSC::DFG::Graph::doToChildren): * dfg/DFGInPlaceAbstractState.cpp: (JSC::DFG::InPlaceAbstractState::beginBasicBlock): * jit/JIT.cpp: (JSC::JIT::totalCompileTime): * jit/JIT.h: * jsc.cpp: (GlobalObject::finishCreation): (functionTotalCompileTime): Source/WTF: Fix some inlining goof-ups. Rolling back in after fixing cloop build. * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::mergeOtherOutOfLine): Tools: Make it possible to measure compile times. Rolling back in after fixing cloop builds. * Scripts/run-jsc-benchmarks: Canonical link: https://commits.webkit.org/200910@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-08 21:49:09 +00:00
ALWAYS_INLINE bool merge(const TinyPtrSet& other)
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
{
if (other.isThin()) {
if (other.singleEntry())
return add(other.singleEntry());
return false;
}
InPlaceAbstractState::beginBasicBlock shouldn't have to clear any abstract values https://bugs.webkit.org/show_bug.cgi?id=185365 Reviewed by Saam Barati. Source/JavaScriptCore: This patch does three things to improve compile times: - Fixes some inlining goofs. - Adds the ability to measure compile times with run-jsc-benchmarks. - Dramatically improves the performance of InPlaceAbstractState::beginBasicBlock by removing the code that clears abstract values. It turns out that on constant folding "needed" this, in the sense that this was the only thing protecting it from loading the abstract value of a no-result node and then concluding that because it had a non-empty m_value, it could be constant-folded. Any node that produces a result will explicitly set its abstract value, so this problem can also be guarded by just having constant folding check if the node it wants to fold returns any result. Solid 0.96% compile time speed-up across SunSpider-CompileTime and V8Spider-CompileTime. Rolling back in after fixing cloop build. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGAbstractValue.cpp: (JSC::DFG::AbstractValue::set): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::merge): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGGraph.h: (JSC::DFG::Graph::doToChildrenWithNode): (JSC::DFG::Graph::doToChildren): * dfg/DFGInPlaceAbstractState.cpp: (JSC::DFG::InPlaceAbstractState::beginBasicBlock): * jit/JIT.cpp: (JSC::JIT::totalCompileTime): * jit/JIT.h: * jsc.cpp: (GlobalObject::finishCreation): (functionTotalCompileTime): Source/WTF: Fix some inlining goof-ups. Rolling back in after fixing cloop build. * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::mergeOtherOutOfLine): Tools: Make it possible to measure compile times. Rolling back in after fixing cloop builds. * Scripts/run-jsc-benchmarks: Canonical link: https://commits.webkit.org/200910@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-08 21:49:09 +00:00
return mergeOtherOutOfLine(other);
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
}
template<typename Functor>
void forEach(const Functor& functor) const
{
if (isThin()) {
if (!singleEntry())
return;
functor(singleEntry());
return;
}
OutOfLineList* list = this->list();
for (unsigned i = 0; i < list->m_length; ++i)
functor(list->list()[i]);
}
template<typename Functor>
void genericFilter(const Functor& functor)
{
if (isThin()) {
if (!singleEntry())
return;
if (functor(singleEntry()))
return;
clear();
return;
}
OutOfLineList* list = this->list();
for (unsigned i = 0; i < list->m_length; ++i) {
if (functor(list->list()[i]))
continue;
list->list()[i--] = list->list()[--list->m_length];
}
if (!list->m_length)
clear();
}
void filter(const TinyPtrSet& other)
{
if (other.isThin()) {
if (!other.singleEntry() || !contains(other.singleEntry()))
clear();
else {
clear();
set(other.singleEntry());
}
return;
}
genericFilter([&] (T value) { return other.containsOutOfLine(value); });
}
void exclude(const TinyPtrSet& other)
{
if (other.isThin()) {
if (other.singleEntry())
remove(other.singleEntry());
return;
}
genericFilter([&] (T value) { return !other.containsOutOfLine(value); });
}
bool isSubsetOf(const TinyPtrSet& other) const
{
if (isThin()) {
if (!singleEntry())
return true;
return other.contains(singleEntry());
}
if (other.isThin()) {
if (!other.singleEntry())
return false;
OutOfLineList* list = this->list();
if (list->m_length >= 2)
return false;
if (list->list()[0] == other.singleEntry())
return true;
return false;
}
OutOfLineList* list = this->list();
for (unsigned i = 0; i < list->m_length; ++i) {
if (!other.containsOutOfLine(list->list()[i]))
return false;
}
return true;
}
bool isSupersetOf(const TinyPtrSet& other) const
{
return other.isSubsetOf(*this);
}
bool overlaps(const TinyPtrSet& other) const
{
if (isThin()) {
if (!singleEntry())
return false;
return other.contains(singleEntry());
}
if (other.isThin()) {
if (!other.singleEntry())
return false;
return containsOutOfLine(other.singleEntry());
}
OutOfLineList* list = this->list();
for (unsigned i = 0; i < list->m_length; ++i) {
if (other.containsOutOfLine(list->list()[i]))
return true;
}
return false;
}
size_t size() const
{
if (isThin())
return !!singleEntry();
return list()->m_length;
}
T at(size_t i) const
{
if (isThin()) {
ASSERT(!i);
ASSERT(singleEntry());
return singleEntry();
}
ASSERT(i < list()->m_length);
return list()->list()[i];
}
T operator[](size_t i) const { return at(i); }
T last() const
{
if (isThin()) {
ASSERT(singleEntry());
return singleEntry();
}
return list()->list()[list()->m_length - 1];
}
class iterator {
public:
iterator()
: m_set(nullptr)
, m_index(0)
{
}
iterator(const TinyPtrSet* set, size_t index)
: m_set(set)
, m_index(index)
{
}
T operator*() const { return m_set->at(m_index); }
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
iterator& operator++()
{
m_index++;
return *this;
}
bool operator==(const iterator& other) const { return m_index == other.m_index; }
bool operator!=(const iterator& other) const { return !(*this == other); }
private:
const TinyPtrSet* m_set;
size_t m_index;
};
iterator begin() const { return iterator(this, 0); }
iterator end() const { return iterator(this, size()); }
bool operator==(const TinyPtrSet& other) const
{
if (size() != other.size())
return false;
return isSubsetOf(other);
}
We should support CreateThis in the FTL https://bugs.webkit.org/show_bug.cgi?id=164904 Reviewed by Yusuke Suzuki. JSTests: * microbenchmarks/polyvariant-get-by-id-shorter-tower.js: Added. (polyvariant): (Foo.prototype.func): (Foo): (foo): (Bar.prototype.func): (Bar): (bar): * microbenchmarks/polyvariant-get-by-id-tower.js: Added. (polyvariant): (Foo.prototype.func): (Foo): (foo): (Bar.prototype.func): (Bar): (bar): (Baz.prototype.func): (Baz): (baz): Source/JavaScriptCore: This started with Saam's patch to implement CreateThis in the FTL, but turned into a type inference adventure. CreateThis in the FTL was a massive regression in raytrace because it disturbed that benchmark's extremely perverse way of winning at type inference: - The benchmark wanted polyvariant devirtualization of an object construction helper. But, the polyvariant profiler wasn't powerful enough to reliably devirtualize that code. So, the benchmark was falling back to other mechanisms... - The construction helper could not tier up into the FTL. When the DFG compiled it, it would see that the IC had 4 cases. That's too polymorphic for the DFG. So, the DFG would emit a GetById. Shortly after the DFG compile, that get_by_id would see many more cases, but now that the helper was compiled by the DFG, the baseline get_by_id would not see those cases. The DFG's GetById would "hide" those cases. The number of cases the DFG's GetById would see is larger than our polymorphic list limit (limit = 8, case count = 13, I think). Note that if the FTL compiles that construction helper, it sees the 4 cases, turns them into a MultiGetByOffset, then suffers from exits when the new cases hit, and then exits to baseline, which then sees those cases. Luckily, the FTL was not compiling the construction helper because it had a CreateThis. - Compilations that inlined the construction helper would have gotten super lucky with parse-time constant folding, so they knew what structure the input to the get_by_id would have at parse time. This is only profitable if the get_by_id parsing computed a GetByIdStatus that had a finite number of cases. Because the 13 cases were being hidden by the DFG GetById and GetByIdStatus would only look at the baseline get_by_id, which had 4 cases, we would indeed get a finite number of cases. The parser would then prune those cases to just one - based on its knowledge of the structure - and that would result in that get_by_id being folded at parse time to a constant. - The subsequent op_call would inline based on parse-time knowledge of that constant. This patch comprehensively fixes these issues, as well as other issues that come up along the way. The short version is that raytrace was revealing sloppiness in our use of profiling for type inference. This patch fixes the sloppiness by vastly expanding *polyvariant* profiling, i.e. the profiling that considers call context. I was encouraged to do this by the fact that even the old version of polyvariant profiling was a speed-up on JetStream, ARES-6, and Speedometer 2 (it's easy to measure since it's a runtime flag). So, it seemed worthwhile to attack raytrace's problem as a shortcoming of polyvariant profiling. - Polyvariant profiling now consults every DFG or FTL code block that participated in any subset of the inline stack that includes the IC we're profiling. For example, if we have an inline stack like foo->bar->baz, with baz on top, then we will consult DFG or FTL compilations for foo, bar, and baz. In foo, we'll look up foo->bar->baz; in bar we'll look up bar->baz; etc. This fixes two problems encountered in raytrace. First, it ensures that a DFG GetById cannot hide anything from the profiling of that get_by_id, since the polyvariant profiling code will always consult it. Second, it enables raytrace to benefit from polyvariant profling. Previously, the polyvariant profiler would only look at the previous DFG compilation of foo and look up foo->bar->baz. But that only works if DFG-foo had inlined bar and then baz. It may not have done that, because those calls could have required polyvariant profiling that was only available in the FTL. - A particularly interesting case is when some IC in foo-baseline is also available in foo-DFG. This case is encountered by the polyvariant profiler as it walks the inline stack. In the case of gathering profiling for foo-FTL, the polyvariant profiler finds foo-DFG via the trivial case of no inline stack. This also means that if foo ever gets inlined, we will find foo-DFG or foo-FTL in the final case of polyvariant profiling. In those cases, we now merge the IC of foo-baseline and foo-DFG. This avoids lots of unnecessary recompilations, because it warns us of historical polymorphism. Historical polymorphism usually means future polymorphism. IC status code already had some merging functionality, but I needed to beef it up a lot to make this work right. - Inlining an inline cache now preserves as much information as profiling. One challenge of polyvariant profiling is that the FTL compile for bar (that includes bar->baz) could have inlined an inline cache based on polyvariant profiling. So, when the FTL compile for foo (that includes foo->bar->baz) asks bar what it knows about that IC inside bar->baz, it will say "I don't have such an IC". At this point the DFG compilation that included that IC that gave us the information that we used to inline the IC is no longer alive. To keep us from losing the information we learned about the IC, there is now a RecordedStatuses data structure that preserves the statuses we use for inlining ICs. We also filter those statuses according to things we learn from AI. This further reduces the risk of information about an IC being forgotten. - Exit profiling now considers whether or not an exit happened from inline code. This protects us in the case where the not-inlined version of an IC exited a lot because of polymorphism that doesn't exist in the inlined version. So, when using polyvariant profiling data, we consider only inlined exits. - CallLinkInfo now records when it's repatched to the virtual call thunk. Previously, this would clear the CallLinkInfo, so CallLinkStatus would fall back to the lastSeenCallee. It's surprising that we've had this bug. Altogether this patch is performance-neutral in run-jsc-benchmarks, except for speed-ups in microbenchmarks and a compile time regression. Octane/deltablue speeds up by ~5%. Octane/raytrace is regressed by a minuscule amount, which we could make up by implementing prototype access folding in the bytecode parser and constant folder. That would require some significant new logic in GetByIdStatus. That would also require a new benchmark - we want to have a test that captures raytrace's behavior in the case that the parser cannot fold the get_by_id. This change is a 1.2% regression on V8Spider-CompileTime. That's a smaller regression than recent compile time progressions, so I think that's an OK trade-off. Also, I would expect a compile time regression anytime we fill in FTL coverage. This is neutral on JetStream, ARES-6, and Speedometer2. JetStream agrees that deltablue speeds up and that raytrace slows down, but these changes balance out and don't affect the overall score. In ARES-6, it looks like individual tests have some significant 1-2% speed-ups or slow-downs. Air-steady is definitely ~1.5% faster. Basic-worst is probably 2% slower (p ~ 0.1, so it's not very certain). The JetStream, ARES-6, and Speedometer2 overall scores don't see a significant difference. In all three cases the difference is <0.5% with a high p value, with JetStream and Speedometer2 being insignificant infinitesimal speed-ups and ARES-6 being an insignificant infinitesimal slow-down. Oh, and this change means that the FTL now has 100% coverage of JavaScript. You could do an eval in a for-in loop in a for-of loop inside a with block that uses try/catch for control flow in a polymorphic constructor while having a bad time, and we'll still compile it. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/ByValInfo.h: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::printGetByIdCacheStatus): (JSC::BytecodeDumper<Block>::printPutByIdCacheStatus): (JSC::BytecodeDumper<Block>::printInByIdCacheStatus): (JSC::BytecodeDumper<Block>::dumpCallLinkStatus): (JSC::BytecodeDumper<CodeBlock>::dumpCallLinkStatus): (JSC::BytecodeDumper<Block>::printCallOp): (JSC::BytecodeDumper<Block>::dumpBytecode): (JSC::BytecodeDumper<Block>::dumpBlock): * bytecode/BytecodeDumper.h: * bytecode/CallLinkInfo.h: * bytecode/CallLinkStatus.cpp: (JSC::CallLinkStatus::computeFor): (JSC::CallLinkStatus::computeExitSiteData): (JSC::CallLinkStatus::computeFromCallLinkInfo): (JSC::CallLinkStatus::accountForExits): (JSC::CallLinkStatus::finalize): (JSC::CallLinkStatus::filter): (JSC::CallLinkStatus::computeDFGStatuses): Deleted. * bytecode/CallLinkStatus.h: (JSC::CallLinkStatus::operator bool const): (JSC::CallLinkStatus::operator! const): Deleted. * bytecode/CallVariant.cpp: (JSC::CallVariant::finalize): (JSC::CallVariant::filter): * bytecode/CallVariant.h: (JSC::CallVariant::operator bool const): (JSC::CallVariant::operator! const): Deleted. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::getICStatusMap): (JSC::CodeBlock::resetJITData): (JSC::CodeBlock::getStubInfoMap): Deleted. (JSC::CodeBlock::getCallLinkInfoMap): Deleted. (JSC::CodeBlock::getByValInfoMap): Deleted. * bytecode/CodeBlock.h: * bytecode/CodeOrigin.cpp: (JSC::CodeOrigin::isApproximatelyEqualTo const): (JSC::CodeOrigin::approximateHash const): * bytecode/CodeOrigin.h: (JSC::CodeOrigin::exitingInlineKind const): * bytecode/DFGExitProfile.cpp: (JSC::DFG::FrequentExitSite::dump const): (JSC::DFG::ExitProfile::add): * bytecode/DFGExitProfile.h: (JSC::DFG::FrequentExitSite::FrequentExitSite): (JSC::DFG::FrequentExitSite::operator== const): (JSC::DFG::FrequentExitSite::subsumes const): (JSC::DFG::FrequentExitSite::hash const): (JSC::DFG::FrequentExitSite::inlineKind const): (JSC::DFG::FrequentExitSite::withInlineKind const): (JSC::DFG::QueryableExitProfile::hasExitSite const): (JSC::DFG::QueryableExitProfile::hasExitSiteWithSpecificJITType const): (JSC::DFG::QueryableExitProfile::hasExitSiteWithSpecificInlineKind const): * bytecode/ExitFlag.cpp: Added. (JSC::ExitFlag::dump const): * bytecode/ExitFlag.h: Added. (JSC::ExitFlag::ExitFlag): (JSC::ExitFlag::operator| const): (JSC::ExitFlag::operator|=): (JSC::ExitFlag::operator& const): (JSC::ExitFlag::operator&=): (JSC::ExitFlag::operator bool const): (JSC::ExitFlag::isSet const): * bytecode/ExitingInlineKind.cpp: Added. (WTF::printInternal): * bytecode/ExitingInlineKind.h: Added. * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeFor): (JSC::GetByIdStatus::computeForStubInfo): (JSC::GetByIdStatus::slowVersion const): (JSC::GetByIdStatus::markIfCheap): (JSC::GetByIdStatus::finalize): (JSC::GetByIdStatus::hasExitSite): Deleted. * bytecode/GetByIdStatus.h: * bytecode/GetByIdVariant.cpp: (JSC::GetByIdVariant::markIfCheap): (JSC::GetByIdVariant::finalize): * bytecode/GetByIdVariant.h: * bytecode/ICStatusMap.cpp: Added. (JSC::ICStatusContext::get const): (JSC::ICStatusContext::isInlined const): (JSC::ICStatusContext::inlineKind const): * bytecode/ICStatusMap.h: Added. * bytecode/ICStatusUtils.cpp: Added. (JSC::hasBadCacheExitSite): * bytecode/ICStatusUtils.h: * bytecode/InstanceOfStatus.cpp: (JSC::InstanceOfStatus::computeFor): * bytecode/InstanceOfStatus.h: * bytecode/PolyProtoAccessChain.h: * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::hasExitSite): (JSC::PutByIdStatus::computeFor): (JSC::PutByIdStatus::slowVersion const): (JSC::PutByIdStatus::markIfCheap): (JSC::PutByIdStatus::finalize): (JSC::PutByIdStatus::filter): * bytecode/PutByIdStatus.h: * bytecode/PutByIdVariant.cpp: (JSC::PutByIdVariant::markIfCheap): (JSC::PutByIdVariant::finalize): * bytecode/PutByIdVariant.h: (JSC::PutByIdVariant::structureSet const): * bytecode/RecordedStatuses.cpp: Added. (JSC::RecordedStatuses::operator=): (JSC::RecordedStatuses::RecordedStatuses): (JSC::RecordedStatuses::addCallLinkStatus): (JSC::RecordedStatuses::addGetByIdStatus): (JSC::RecordedStatuses::addPutByIdStatus): (JSC::RecordedStatuses::markIfCheap): (JSC::RecordedStatuses::finalizeWithoutDeleting): (JSC::RecordedStatuses::finalize): (JSC::RecordedStatuses::shrinkToFit): * bytecode/RecordedStatuses.h: Added. (JSC::RecordedStatuses::RecordedStatuses): (JSC::RecordedStatuses::forEachVector): * bytecode/StructureSet.cpp: (JSC::StructureSet::markIfCheap const): (JSC::StructureSet::isStillAlive const): * bytecode/StructureSet.h: * bytecode/TerminatedCodeOrigin.h: Added. (JSC::TerminatedCodeOrigin::TerminatedCodeOrigin): (JSC::TerminatedCodeOriginHashTranslator::hash): (JSC::TerminatedCodeOriginHashTranslator::equal): * bytecode/Watchpoint.cpp: (WTF::printInternal): * bytecode/Watchpoint.h: * dfg/DFGAbstractInterpreter.h: * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::filterICStatus): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleVarargsCall): (JSC::DFG::ByteCodeParser::handleDOMJITGetter): (JSC::DFG::ByteCodeParser::handleModuleNamespaceLoad): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handlePutById): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry): (JSC::DFG::ByteCodeParser::InlineStackEntry::~InlineStackEntry): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGClobbersExitState.cpp: (JSC::DFG::clobbersExitState): * dfg/DFGCommonData.h: * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGDesiredWatchpoints.h: (JSC::DFG::SetPointerAdaptor::hasBeenInvalidated): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): * dfg/DFGMayExit.cpp: * dfg/DFGNode.h: (JSC::DFG::Node::hasCallLinkStatus): (JSC::DFG::Node::callLinkStatus): (JSC::DFG::Node::hasGetByIdStatus): (JSC::DFG::Node::getByIdStatus): (JSC::DFG::Node::hasPutByIdStatus): (JSC::DFG::Node::putByIdStatus): * dfg/DFGNodeType.h: * dfg/DFGOSRExitBase.cpp: (JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSiteSlow): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::reallyAdd): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::finalizeInGC): * dfg/DFGPlan.h: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::removeDeadPlans): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileCreateThis): (JSC::FTL::DFG::LowerDFGToB3::compileFilterICStatus): * jit/PolymorphicCallStubRoutine.cpp: (JSC::PolymorphicCallStubRoutine::hasEdges const): (JSC::PolymorphicCallStubRoutine::edges const): * jit/PolymorphicCallStubRoutine.h: * profiler/ProfilerBytecodeSequence.cpp: (JSC::Profiler::BytecodeSequence::BytecodeSequence): * runtime/FunctionRareData.cpp: (JSC::FunctionRareData::initializeObjectAllocationProfile): * runtime/Options.h: Source/WTF: * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::operator!= const): Canonical link: https://commits.webkit.org/203069@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234086 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-22 02:48:16 +00:00
bool operator!=(const TinyPtrSet& other) const
{
return !(*this == other);
}
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
private:
friend class JSC::DFG::StructureAbstractValue;
Use constexpr instead of const in symbol definitions that are obviously constexpr. https://bugs.webkit.org/show_bug.cgi?id=201879 Rubber-stamped by Joseph Pecoraro. Source/bmalloc: * bmalloc/AvailableMemory.cpp: * bmalloc/IsoTLS.h: * bmalloc/Map.h: * bmalloc/Mutex.cpp: (bmalloc::Mutex::lockSlowCase): * bmalloc/PerThread.h: * bmalloc/Vector.h: * bmalloc/Zone.h: Source/JavaScriptCore: const may require external storage (at the compiler's whim) though these currently do not. constexpr makes it clear that the value is a literal constant that can be inlined. In most cases in the code, when we say static const, we actually mean static constexpr. I'm changing the code to reflect this. * API/JSAPIValueWrapper.h: * API/JSCallbackConstructor.h: * API/JSCallbackObject.h: * API/JSContextRef.cpp: * API/JSWrapperMap.mm: * API/tests/CompareAndSwapTest.cpp: * API/tests/TypedArrayCTest.cpp: * API/tests/testapi.mm: (testObjectiveCAPIMain): * KeywordLookupGenerator.py: (Trie.printAsC): * assembler/ARMv7Assembler.h: * assembler/AssemblerBuffer.h: * assembler/AssemblerCommon.h: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.h: * assembler/MacroAssemblerARM64E.h: * assembler/MacroAssemblerARMv7.h: * assembler/MacroAssemblerCodeRef.h: * assembler/MacroAssemblerMIPS.h: * assembler/MacroAssemblerX86.h: * assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::absDouble): (JSC::MacroAssemblerX86Common::negateDouble): * assembler/MacroAssemblerX86_64.h: * assembler/X86Assembler.h: * b3/B3Bank.h: * b3/B3CheckSpecial.h: * b3/B3DuplicateTails.cpp: * b3/B3EliminateCommonSubexpressions.cpp: * b3/B3FixSSA.cpp: * b3/B3FoldPathConstants.cpp: * b3/B3InferSwitches.cpp: * b3/B3Kind.h: * b3/B3LowerToAir.cpp: * b3/B3NativeTraits.h: * b3/B3ReduceDoubleToFloat.cpp: * b3/B3ReduceLoopStrength.cpp: * b3/B3ReduceStrength.cpp: * b3/B3ValueKey.h: * b3/air/AirAllocateRegistersByGraphColoring.cpp: * b3/air/AirAllocateStackByGraphColoring.cpp: * b3/air/AirArg.h: * b3/air/AirCCallSpecial.h: * b3/air/AirEmitShuffle.cpp: * b3/air/AirFixObviousSpills.cpp: * b3/air/AirFormTable.h: * b3/air/AirLowerAfterRegAlloc.cpp: * b3/air/AirPrintSpecial.h: * b3/air/AirStackAllocation.cpp: * b3/air/AirTmp.h: * b3/testb3_6.cpp: (testInterpreter): * bytecode/AccessCase.cpp: * bytecode/CallLinkStatus.cpp: * bytecode/CallVariant.h: * bytecode/CodeBlock.h: * bytecode/CodeOrigin.h: * bytecode/DFGExitProfile.h: * bytecode/DirectEvalCodeCache.h: * bytecode/ExecutableToCodeBlockEdge.h: * bytecode/GetterSetterAccessCase.cpp: * bytecode/LazyOperandValueProfile.h: * bytecode/ObjectPropertyCondition.h: * bytecode/ObjectPropertyConditionSet.cpp: * bytecode/PolymorphicAccess.cpp: * bytecode/PropertyCondition.h: * bytecode/SpeculatedType.h: * bytecode/StructureStubInfo.cpp: * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::typeProfilerExpressionInfoForBytecodeOffset): * bytecode/UnlinkedCodeBlock.h: * bytecode/UnlinkedEvalCodeBlock.h: * bytecode/UnlinkedFunctionCodeBlock.h: * bytecode/UnlinkedFunctionExecutable.h: * bytecode/UnlinkedModuleProgramCodeBlock.h: * bytecode/UnlinkedProgramCodeBlock.h: * bytecode/ValueProfile.h: * bytecode/VirtualRegister.h: * bytecode/Watchpoint.h: * bytecompiler/BytecodeGenerator.h: * bytecompiler/Label.h: * bytecompiler/NodesCodegen.cpp: (JSC::ThisNode::emitBytecode): * bytecompiler/RegisterID.h: * debugger/Breakpoint.h: * debugger/DebuggerParseData.cpp: * debugger/DebuggerPrimitives.h: * debugger/DebuggerScope.h: * dfg/DFGAbstractHeap.h: * dfg/DFGAbstractValue.h: * dfg/DFGArgumentsEliminationPhase.cpp: * dfg/DFGByteCodeParser.cpp: * dfg/DFGCSEPhase.cpp: * dfg/DFGCommon.h: * dfg/DFGCompilationKey.h: * dfg/DFGDesiredGlobalProperty.h: * dfg/DFGEdgeDominates.h: * dfg/DFGEpoch.h: * dfg/DFGForAllKills.h: (JSC::DFG::forAllKilledNodesAtNodeIndex): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::isLiveInBytecode): * dfg/DFGHeapLocation.h: * dfg/DFGInPlaceAbstractState.cpp: * dfg/DFGIntegerCheckCombiningPhase.cpp: * dfg/DFGIntegerRangeOptimizationPhase.cpp: * dfg/DFGInvalidationPointInjectionPhase.cpp: * dfg/DFGLICMPhase.cpp: * dfg/DFGLazyNode.h: * dfg/DFGMinifiedID.h: * dfg/DFGMovHintRemovalPhase.cpp: * dfg/DFGNodeFlowProjection.h: * dfg/DFGNodeType.h: * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPhantomInsertionPhase.cpp: * dfg/DFGPromotedHeapLocation.h: * dfg/DFGPropertyTypeKey.h: * dfg/DFGPureValue.h: * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGRegisterBank.h: * dfg/DFGSSAConversionPhase.cpp: * dfg/DFGSSALoweringPhase.cpp: * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileDoubleRep): (JSC::DFG::compileClampDoubleToByte): (JSC::DFG::SpeculativeJIT::compileArithRounding): (JSC::DFG::compileArithPowIntegerFastPath): (JSC::DFG::SpeculativeJIT::compileArithPow): (JSC::DFG::SpeculativeJIT::emitBinarySwitchStringRecurse): * dfg/DFGStackLayoutPhase.cpp: * dfg/DFGStoreBarrierInsertionPhase.cpp: * dfg/DFGStrengthReductionPhase.cpp: * dfg/DFGStructureAbstractValue.h: * dfg/DFGVarargsForwardingPhase.cpp: * dfg/DFGVariableEventStream.cpp: (JSC::DFG::VariableEventStream::reconstruct const): * dfg/DFGWatchpointCollectionPhase.cpp: * disassembler/ARM64/A64DOpcode.h: * ftl/FTLLocation.h: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileArithRandom): * ftl/FTLSlowPathCall.cpp: * ftl/FTLSlowPathCallKey.h: * heap/CellContainer.h: * heap/CellState.h: * heap/ConservativeRoots.h: * heap/GCSegmentedArray.h: * heap/HandleBlock.h: * heap/Heap.cpp: (JSC::Heap::updateAllocationLimits): * heap/Heap.h: * heap/HeapSnapshot.h: * heap/HeapUtil.h: (JSC::HeapUtil::findGCObjectPointersForMarking): * heap/IncrementalSweeper.cpp: * heap/LargeAllocation.h: * heap/MarkedBlock.cpp: * heap/Strong.h: * heap/VisitRaceKey.h: * heap/Weak.h: * heap/WeakBlock.h: * inspector/JSInjectedScriptHost.h: * inspector/JSInjectedScriptHostPrototype.h: * inspector/JSJavaScriptCallFrame.h: * inspector/JSJavaScriptCallFramePrototype.h: * inspector/agents/InspectorConsoleAgent.cpp: * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets): * inspector/scripts/codegen/generate_cpp_protocol_types_header.py: (CppProtocolTypesHeaderGenerator._generate_versions): * inspector/scripts/tests/generic/expected/version.json-result: * interpreter/Interpreter.h: * interpreter/ShadowChicken.cpp: * jit/BinarySwitch.cpp: * jit/CallFrameShuffler.h: * jit/ExecutableAllocator.h: * jit/FPRInfo.h: * jit/GPRInfo.h: * jit/ICStats.h: * jit/JITThunks.h: * jit/Reg.h: * jit/RegisterSet.h: * jit/TempRegisterSet.h: * jsc.cpp: * parser/ASTBuilder.h: * parser/Nodes.h: * parser/SourceCodeKey.h: * parser/SyntaxChecker.h: * parser/VariableEnvironment.h: * profiler/ProfilerOrigin.h: * profiler/ProfilerOriginStack.h: * profiler/ProfilerUID.h: * runtime/AbstractModuleRecord.cpp: * runtime/ArrayBufferNeuteringWatchpointSet.h: * runtime/ArrayConstructor.h: * runtime/ArrayConventions.h: * runtime/ArrayIteratorPrototype.h: * runtime/ArrayPrototype.cpp: (JSC::setLength): * runtime/AsyncFromSyncIteratorPrototype.h: * runtime/AsyncGeneratorFunctionPrototype.h: * runtime/AsyncGeneratorPrototype.h: * runtime/AsyncIteratorPrototype.h: * runtime/AtomicsObject.cpp: * runtime/BigIntConstructor.h: * runtime/BigIntPrototype.h: * runtime/BooleanPrototype.h: * runtime/ClonedArguments.h: * runtime/CodeCache.h: * runtime/ControlFlowProfiler.h: * runtime/CustomGetterSetter.h: * runtime/DateConstructor.h: * runtime/DatePrototype.h: * runtime/DefinePropertyAttributes.h: * runtime/ErrorPrototype.h: * runtime/EvalExecutable.h: * runtime/Exception.h: * runtime/ExceptionHelpers.cpp: (JSC::invalidParameterInSourceAppender): (JSC::invalidParameterInstanceofSourceAppender): * runtime/ExceptionHelpers.h: * runtime/ExecutableBase.h: * runtime/FunctionExecutable.h: * runtime/FunctionRareData.h: * runtime/GeneratorPrototype.h: * runtime/GenericArguments.h: * runtime/GenericOffset.h: * runtime/GetPutInfo.h: * runtime/GetterSetter.h: * runtime/GlobalExecutable.h: * runtime/Identifier.h: * runtime/InspectorInstrumentationObject.h: * runtime/InternalFunction.h: * runtime/IntlCollatorConstructor.h: * runtime/IntlCollatorPrototype.h: * runtime/IntlDateTimeFormatConstructor.h: * runtime/IntlDateTimeFormatPrototype.h: * runtime/IntlNumberFormatConstructor.h: * runtime/IntlNumberFormatPrototype.h: * runtime/IntlObject.h: * runtime/IntlPluralRulesConstructor.h: * runtime/IntlPluralRulesPrototype.h: * runtime/IteratorPrototype.h: * runtime/JSArray.cpp: (JSC::JSArray::tryCreateUninitializedRestricted): * runtime/JSArray.h: * runtime/JSArrayBuffer.h: * runtime/JSArrayBufferView.h: * runtime/JSBigInt.h: * runtime/JSCJSValue.h: * runtime/JSCell.h: * runtime/JSCustomGetterSetterFunction.h: * runtime/JSDataView.h: * runtime/JSDataViewPrototype.h: * runtime/JSDestructibleObject.h: * runtime/JSFixedArray.h: * runtime/JSGenericTypedArrayView.h: * runtime/JSGlobalLexicalEnvironment.h: * runtime/JSGlobalObject.h: * runtime/JSImmutableButterfly.h: * runtime/JSInternalPromiseConstructor.h: * runtime/JSInternalPromiseDeferred.h: * runtime/JSInternalPromisePrototype.h: * runtime/JSLexicalEnvironment.h: * runtime/JSModuleEnvironment.h: * runtime/JSModuleLoader.h: * runtime/JSModuleNamespaceObject.h: * runtime/JSNonDestructibleProxy.h: * runtime/JSONObject.cpp: * runtime/JSONObject.h: * runtime/JSObject.h: * runtime/JSPromiseConstructor.h: * runtime/JSPromiseDeferred.h: * runtime/JSPromisePrototype.h: * runtime/JSPropertyNameEnumerator.h: * runtime/JSProxy.h: * runtime/JSScope.h: * runtime/JSScriptFetchParameters.h: * runtime/JSScriptFetcher.h: * runtime/JSSegmentedVariableObject.h: * runtime/JSSourceCode.h: * runtime/JSString.cpp: * runtime/JSString.h: * runtime/JSSymbolTableObject.h: * runtime/JSTemplateObjectDescriptor.h: * runtime/JSTypeInfo.h: * runtime/MapPrototype.h: * runtime/MinimumReservedZoneSize.h: * runtime/ModuleProgramExecutable.h: * runtime/NativeExecutable.h: * runtime/NativeFunction.h: * runtime/NativeStdFunctionCell.h: * runtime/NumberConstructor.h: * runtime/NumberPrototype.h: * runtime/ObjectConstructor.h: * runtime/ObjectPrototype.h: * runtime/ProgramExecutable.h: * runtime/PromiseDeferredTimer.cpp: * runtime/PropertyMapHashTable.h: * runtime/PropertyNameArray.h: (JSC::PropertyNameArray::add): * runtime/PrototypeKey.h: * runtime/ProxyConstructor.h: * runtime/ProxyObject.cpp: (JSC::ProxyObject::performGetOwnPropertyNames): * runtime/ProxyRevoke.h: * runtime/ReflectObject.h: * runtime/RegExp.h: * runtime/RegExpCache.h: * runtime/RegExpConstructor.h: * runtime/RegExpKey.h: * runtime/RegExpObject.h: * runtime/RegExpPrototype.h: * runtime/RegExpStringIteratorPrototype.h: * runtime/SamplingProfiler.cpp: * runtime/ScopedArgumentsTable.h: * runtime/ScriptExecutable.h: * runtime/SetPrototype.h: * runtime/SmallStrings.h: * runtime/SparseArrayValueMap.h: * runtime/StringConstructor.h: * runtime/StringIteratorPrototype.h: * runtime/StringObject.h: * runtime/StringPrototype.h: * runtime/Structure.h: * runtime/StructureChain.h: * runtime/StructureRareData.h: * runtime/StructureTransitionTable.h: * runtime/Symbol.h: * runtime/SymbolConstructor.h: * runtime/SymbolPrototype.h: * runtime/SymbolTable.h: * runtime/TemplateObjectDescriptor.h: * runtime/TypeProfiler.cpp: * runtime/TypeProfiler.h: * runtime/TypeProfilerLog.cpp: * runtime/VarOffset.h: * testRegExp.cpp: * tools/HeapVerifier.cpp: (JSC::HeapVerifier::checkIfRecorded): * tools/JSDollarVM.cpp: * wasm/WasmB3IRGenerator.cpp: * wasm/WasmBBQPlan.cpp: * wasm/WasmFaultSignalHandler.cpp: * wasm/WasmFunctionParser.h: * wasm/WasmOMGForOSREntryPlan.cpp: * wasm/WasmOMGPlan.cpp: * wasm/WasmPlan.cpp: * wasm/WasmSignature.cpp: * wasm/WasmSignature.h: * wasm/WasmWorklist.cpp: * wasm/js/JSWebAssembly.h: * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/WebAssemblyCompileErrorConstructor.h: * wasm/js/WebAssemblyCompileErrorPrototype.h: * wasm/js/WebAssemblyFunction.h: * wasm/js/WebAssemblyInstanceConstructor.h: * wasm/js/WebAssemblyInstancePrototype.h: * wasm/js/WebAssemblyLinkErrorConstructor.h: * wasm/js/WebAssemblyLinkErrorPrototype.h: * wasm/js/WebAssemblyMemoryConstructor.h: * wasm/js/WebAssemblyMemoryPrototype.h: * wasm/js/WebAssemblyModuleConstructor.h: * wasm/js/WebAssemblyModulePrototype.h: * wasm/js/WebAssemblyRuntimeErrorConstructor.h: * wasm/js/WebAssemblyRuntimeErrorPrototype.h: * wasm/js/WebAssemblyTableConstructor.h: * wasm/js/WebAssemblyTablePrototype.h: * wasm/js/WebAssemblyToJSCallee.h: * yarr/Yarr.h: * yarr/YarrParser.h: * yarr/generateYarrCanonicalizeUnicode: Source/WebCore: No new tests. Covered by existing tests. * bindings/js/JSDOMConstructorBase.h: * bindings/js/JSDOMWindowProperties.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GeneratePrototypeDeclaration): * bindings/scripts/test/JS/JSTestActiveDOMObject.h: * bindings/scripts/test/JS/JSTestEnabledBySetting.h: * bindings/scripts/test/JS/JSTestEnabledForContext.h: * bindings/scripts/test/JS/JSTestEventTarget.h: * bindings/scripts/test/JS/JSTestGlobalObject.h: * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h: * bindings/scripts/test/JS/JSTestNamedGetterCallWith.h: * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.h: * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.h: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestPluginInterface.h: * bindings/scripts/test/JS/JSTestTypedefs.h: * bridge/objc/objc_runtime.h: * bridge/runtime_array.h: * bridge/runtime_method.h: * bridge/runtime_object.h: Source/WebKit: * WebProcess/Plugins/Netscape/JSNPObject.h: Source/WTF: * wtf/Assertions.cpp: * wtf/AutomaticThread.cpp: * wtf/BitVector.h: * wtf/Bitmap.h: * wtf/BloomFilter.h: * wtf/Brigand.h: * wtf/CheckedArithmetic.h: * wtf/CrossThreadCopier.h: * wtf/CurrentTime.cpp: * wtf/DataLog.cpp: * wtf/DateMath.cpp: (WTF::daysFrom1970ToYear): * wtf/DeferrableRefCounted.h: * wtf/GetPtr.h: * wtf/HashFunctions.h: * wtf/HashMap.h: * wtf/HashTable.h: * wtf/HashTraits.h: * wtf/JSONValues.cpp: * wtf/JSONValues.h: * wtf/ListHashSet.h: * wtf/Lock.h: * wtf/LockAlgorithm.h: * wtf/LockAlgorithmInlines.h: (WTF::Hooks>::lockSlow): * wtf/Logger.h: * wtf/LoggerHelper.h: (WTF::LoggerHelper::childLogIdentifier const): * wtf/MainThread.cpp: * wtf/MetaAllocatorPtr.h: * wtf/MonotonicTime.h: * wtf/NaturalLoops.h: (WTF::NaturalLoops::NaturalLoops): * wtf/ObjectIdentifier.h: * wtf/RAMSize.cpp: * wtf/Ref.h: * wtf/RefPtr.h: * wtf/RetainPtr.h: * wtf/SchedulePair.h: * wtf/StackShot.h: * wtf/StdLibExtras.h: * wtf/TinyPtrSet.h: * wtf/URL.cpp: * wtf/URLHash.h: * wtf/URLParser.cpp: (WTF::URLParser::defaultPortForProtocol): * wtf/Vector.h: * wtf/VectorTraits.h: * wtf/WallTime.h: * wtf/WeakHashSet.h: * wtf/WordLock.h: * wtf/cocoa/CPUTimeCocoa.cpp: * wtf/cocoa/MemoryPressureHandlerCocoa.mm: * wtf/persistence/PersistentDecoder.h: * wtf/persistence/PersistentEncoder.h: * wtf/text/AtomStringHash.h: * wtf/text/CString.h: * wtf/text/StringBuilder.cpp: (WTF::expandedCapacity): * wtf/text/StringHash.h: * wtf/text/StringImpl.h: * wtf/text/StringToIntegerConversion.h: (WTF::toIntegralType): * wtf/text/SymbolRegistry.h: * wtf/text/TextStream.cpp: (WTF::hasFractions): * wtf/text/WTFString.h: * wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp: Canonical link: https://commits.webkit.org/215538@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250005 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-18 00:36:19 +00:00
static constexpr uintptr_t fatFlag = 1;
static constexpr uintptr_t reservedFlag = 2;
static constexpr uintptr_t flags = fatFlag | reservedFlag;
static constexpr uintptr_t reservedValue = 4;
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
Use constexpr instead of const in symbol definitions that are obviously constexpr. https://bugs.webkit.org/show_bug.cgi?id=201879 Rubber-stamped by Joseph Pecoraro. Source/bmalloc: * bmalloc/AvailableMemory.cpp: * bmalloc/IsoTLS.h: * bmalloc/Map.h: * bmalloc/Mutex.cpp: (bmalloc::Mutex::lockSlowCase): * bmalloc/PerThread.h: * bmalloc/Vector.h: * bmalloc/Zone.h: Source/JavaScriptCore: const may require external storage (at the compiler's whim) though these currently do not. constexpr makes it clear that the value is a literal constant that can be inlined. In most cases in the code, when we say static const, we actually mean static constexpr. I'm changing the code to reflect this. * API/JSAPIValueWrapper.h: * API/JSCallbackConstructor.h: * API/JSCallbackObject.h: * API/JSContextRef.cpp: * API/JSWrapperMap.mm: * API/tests/CompareAndSwapTest.cpp: * API/tests/TypedArrayCTest.cpp: * API/tests/testapi.mm: (testObjectiveCAPIMain): * KeywordLookupGenerator.py: (Trie.printAsC): * assembler/ARMv7Assembler.h: * assembler/AssemblerBuffer.h: * assembler/AssemblerCommon.h: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.h: * assembler/MacroAssemblerARM64E.h: * assembler/MacroAssemblerARMv7.h: * assembler/MacroAssemblerCodeRef.h: * assembler/MacroAssemblerMIPS.h: * assembler/MacroAssemblerX86.h: * assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::absDouble): (JSC::MacroAssemblerX86Common::negateDouble): * assembler/MacroAssemblerX86_64.h: * assembler/X86Assembler.h: * b3/B3Bank.h: * b3/B3CheckSpecial.h: * b3/B3DuplicateTails.cpp: * b3/B3EliminateCommonSubexpressions.cpp: * b3/B3FixSSA.cpp: * b3/B3FoldPathConstants.cpp: * b3/B3InferSwitches.cpp: * b3/B3Kind.h: * b3/B3LowerToAir.cpp: * b3/B3NativeTraits.h: * b3/B3ReduceDoubleToFloat.cpp: * b3/B3ReduceLoopStrength.cpp: * b3/B3ReduceStrength.cpp: * b3/B3ValueKey.h: * b3/air/AirAllocateRegistersByGraphColoring.cpp: * b3/air/AirAllocateStackByGraphColoring.cpp: * b3/air/AirArg.h: * b3/air/AirCCallSpecial.h: * b3/air/AirEmitShuffle.cpp: * b3/air/AirFixObviousSpills.cpp: * b3/air/AirFormTable.h: * b3/air/AirLowerAfterRegAlloc.cpp: * b3/air/AirPrintSpecial.h: * b3/air/AirStackAllocation.cpp: * b3/air/AirTmp.h: * b3/testb3_6.cpp: (testInterpreter): * bytecode/AccessCase.cpp: * bytecode/CallLinkStatus.cpp: * bytecode/CallVariant.h: * bytecode/CodeBlock.h: * bytecode/CodeOrigin.h: * bytecode/DFGExitProfile.h: * bytecode/DirectEvalCodeCache.h: * bytecode/ExecutableToCodeBlockEdge.h: * bytecode/GetterSetterAccessCase.cpp: * bytecode/LazyOperandValueProfile.h: * bytecode/ObjectPropertyCondition.h: * bytecode/ObjectPropertyConditionSet.cpp: * bytecode/PolymorphicAccess.cpp: * bytecode/PropertyCondition.h: * bytecode/SpeculatedType.h: * bytecode/StructureStubInfo.cpp: * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::typeProfilerExpressionInfoForBytecodeOffset): * bytecode/UnlinkedCodeBlock.h: * bytecode/UnlinkedEvalCodeBlock.h: * bytecode/UnlinkedFunctionCodeBlock.h: * bytecode/UnlinkedFunctionExecutable.h: * bytecode/UnlinkedModuleProgramCodeBlock.h: * bytecode/UnlinkedProgramCodeBlock.h: * bytecode/ValueProfile.h: * bytecode/VirtualRegister.h: * bytecode/Watchpoint.h: * bytecompiler/BytecodeGenerator.h: * bytecompiler/Label.h: * bytecompiler/NodesCodegen.cpp: (JSC::ThisNode::emitBytecode): * bytecompiler/RegisterID.h: * debugger/Breakpoint.h: * debugger/DebuggerParseData.cpp: * debugger/DebuggerPrimitives.h: * debugger/DebuggerScope.h: * dfg/DFGAbstractHeap.h: * dfg/DFGAbstractValue.h: * dfg/DFGArgumentsEliminationPhase.cpp: * dfg/DFGByteCodeParser.cpp: * dfg/DFGCSEPhase.cpp: * dfg/DFGCommon.h: * dfg/DFGCompilationKey.h: * dfg/DFGDesiredGlobalProperty.h: * dfg/DFGEdgeDominates.h: * dfg/DFGEpoch.h: * dfg/DFGForAllKills.h: (JSC::DFG::forAllKilledNodesAtNodeIndex): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::isLiveInBytecode): * dfg/DFGHeapLocation.h: * dfg/DFGInPlaceAbstractState.cpp: * dfg/DFGIntegerCheckCombiningPhase.cpp: * dfg/DFGIntegerRangeOptimizationPhase.cpp: * dfg/DFGInvalidationPointInjectionPhase.cpp: * dfg/DFGLICMPhase.cpp: * dfg/DFGLazyNode.h: * dfg/DFGMinifiedID.h: * dfg/DFGMovHintRemovalPhase.cpp: * dfg/DFGNodeFlowProjection.h: * dfg/DFGNodeType.h: * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPhantomInsertionPhase.cpp: * dfg/DFGPromotedHeapLocation.h: * dfg/DFGPropertyTypeKey.h: * dfg/DFGPureValue.h: * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGRegisterBank.h: * dfg/DFGSSAConversionPhase.cpp: * dfg/DFGSSALoweringPhase.cpp: * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileDoubleRep): (JSC::DFG::compileClampDoubleToByte): (JSC::DFG::SpeculativeJIT::compileArithRounding): (JSC::DFG::compileArithPowIntegerFastPath): (JSC::DFG::SpeculativeJIT::compileArithPow): (JSC::DFG::SpeculativeJIT::emitBinarySwitchStringRecurse): * dfg/DFGStackLayoutPhase.cpp: * dfg/DFGStoreBarrierInsertionPhase.cpp: * dfg/DFGStrengthReductionPhase.cpp: * dfg/DFGStructureAbstractValue.h: * dfg/DFGVarargsForwardingPhase.cpp: * dfg/DFGVariableEventStream.cpp: (JSC::DFG::VariableEventStream::reconstruct const): * dfg/DFGWatchpointCollectionPhase.cpp: * disassembler/ARM64/A64DOpcode.h: * ftl/FTLLocation.h: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileArithRandom): * ftl/FTLSlowPathCall.cpp: * ftl/FTLSlowPathCallKey.h: * heap/CellContainer.h: * heap/CellState.h: * heap/ConservativeRoots.h: * heap/GCSegmentedArray.h: * heap/HandleBlock.h: * heap/Heap.cpp: (JSC::Heap::updateAllocationLimits): * heap/Heap.h: * heap/HeapSnapshot.h: * heap/HeapUtil.h: (JSC::HeapUtil::findGCObjectPointersForMarking): * heap/IncrementalSweeper.cpp: * heap/LargeAllocation.h: * heap/MarkedBlock.cpp: * heap/Strong.h: * heap/VisitRaceKey.h: * heap/Weak.h: * heap/WeakBlock.h: * inspector/JSInjectedScriptHost.h: * inspector/JSInjectedScriptHostPrototype.h: * inspector/JSJavaScriptCallFrame.h: * inspector/JSJavaScriptCallFramePrototype.h: * inspector/agents/InspectorConsoleAgent.cpp: * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets): * inspector/scripts/codegen/generate_cpp_protocol_types_header.py: (CppProtocolTypesHeaderGenerator._generate_versions): * inspector/scripts/tests/generic/expected/version.json-result: * interpreter/Interpreter.h: * interpreter/ShadowChicken.cpp: * jit/BinarySwitch.cpp: * jit/CallFrameShuffler.h: * jit/ExecutableAllocator.h: * jit/FPRInfo.h: * jit/GPRInfo.h: * jit/ICStats.h: * jit/JITThunks.h: * jit/Reg.h: * jit/RegisterSet.h: * jit/TempRegisterSet.h: * jsc.cpp: * parser/ASTBuilder.h: * parser/Nodes.h: * parser/SourceCodeKey.h: * parser/SyntaxChecker.h: * parser/VariableEnvironment.h: * profiler/ProfilerOrigin.h: * profiler/ProfilerOriginStack.h: * profiler/ProfilerUID.h: * runtime/AbstractModuleRecord.cpp: * runtime/ArrayBufferNeuteringWatchpointSet.h: * runtime/ArrayConstructor.h: * runtime/ArrayConventions.h: * runtime/ArrayIteratorPrototype.h: * runtime/ArrayPrototype.cpp: (JSC::setLength): * runtime/AsyncFromSyncIteratorPrototype.h: * runtime/AsyncGeneratorFunctionPrototype.h: * runtime/AsyncGeneratorPrototype.h: * runtime/AsyncIteratorPrototype.h: * runtime/AtomicsObject.cpp: * runtime/BigIntConstructor.h: * runtime/BigIntPrototype.h: * runtime/BooleanPrototype.h: * runtime/ClonedArguments.h: * runtime/CodeCache.h: * runtime/ControlFlowProfiler.h: * runtime/CustomGetterSetter.h: * runtime/DateConstructor.h: * runtime/DatePrototype.h: * runtime/DefinePropertyAttributes.h: * runtime/ErrorPrototype.h: * runtime/EvalExecutable.h: * runtime/Exception.h: * runtime/ExceptionHelpers.cpp: (JSC::invalidParameterInSourceAppender): (JSC::invalidParameterInstanceofSourceAppender): * runtime/ExceptionHelpers.h: * runtime/ExecutableBase.h: * runtime/FunctionExecutable.h: * runtime/FunctionRareData.h: * runtime/GeneratorPrototype.h: * runtime/GenericArguments.h: * runtime/GenericOffset.h: * runtime/GetPutInfo.h: * runtime/GetterSetter.h: * runtime/GlobalExecutable.h: * runtime/Identifier.h: * runtime/InspectorInstrumentationObject.h: * runtime/InternalFunction.h: * runtime/IntlCollatorConstructor.h: * runtime/IntlCollatorPrototype.h: * runtime/IntlDateTimeFormatConstructor.h: * runtime/IntlDateTimeFormatPrototype.h: * runtime/IntlNumberFormatConstructor.h: * runtime/IntlNumberFormatPrototype.h: * runtime/IntlObject.h: * runtime/IntlPluralRulesConstructor.h: * runtime/IntlPluralRulesPrototype.h: * runtime/IteratorPrototype.h: * runtime/JSArray.cpp: (JSC::JSArray::tryCreateUninitializedRestricted): * runtime/JSArray.h: * runtime/JSArrayBuffer.h: * runtime/JSArrayBufferView.h: * runtime/JSBigInt.h: * runtime/JSCJSValue.h: * runtime/JSCell.h: * runtime/JSCustomGetterSetterFunction.h: * runtime/JSDataView.h: * runtime/JSDataViewPrototype.h: * runtime/JSDestructibleObject.h: * runtime/JSFixedArray.h: * runtime/JSGenericTypedArrayView.h: * runtime/JSGlobalLexicalEnvironment.h: * runtime/JSGlobalObject.h: * runtime/JSImmutableButterfly.h: * runtime/JSInternalPromiseConstructor.h: * runtime/JSInternalPromiseDeferred.h: * runtime/JSInternalPromisePrototype.h: * runtime/JSLexicalEnvironment.h: * runtime/JSModuleEnvironment.h: * runtime/JSModuleLoader.h: * runtime/JSModuleNamespaceObject.h: * runtime/JSNonDestructibleProxy.h: * runtime/JSONObject.cpp: * runtime/JSONObject.h: * runtime/JSObject.h: * runtime/JSPromiseConstructor.h: * runtime/JSPromiseDeferred.h: * runtime/JSPromisePrototype.h: * runtime/JSPropertyNameEnumerator.h: * runtime/JSProxy.h: * runtime/JSScope.h: * runtime/JSScriptFetchParameters.h: * runtime/JSScriptFetcher.h: * runtime/JSSegmentedVariableObject.h: * runtime/JSSourceCode.h: * runtime/JSString.cpp: * runtime/JSString.h: * runtime/JSSymbolTableObject.h: * runtime/JSTemplateObjectDescriptor.h: * runtime/JSTypeInfo.h: * runtime/MapPrototype.h: * runtime/MinimumReservedZoneSize.h: * runtime/ModuleProgramExecutable.h: * runtime/NativeExecutable.h: * runtime/NativeFunction.h: * runtime/NativeStdFunctionCell.h: * runtime/NumberConstructor.h: * runtime/NumberPrototype.h: * runtime/ObjectConstructor.h: * runtime/ObjectPrototype.h: * runtime/ProgramExecutable.h: * runtime/PromiseDeferredTimer.cpp: * runtime/PropertyMapHashTable.h: * runtime/PropertyNameArray.h: (JSC::PropertyNameArray::add): * runtime/PrototypeKey.h: * runtime/ProxyConstructor.h: * runtime/ProxyObject.cpp: (JSC::ProxyObject::performGetOwnPropertyNames): * runtime/ProxyRevoke.h: * runtime/ReflectObject.h: * runtime/RegExp.h: * runtime/RegExpCache.h: * runtime/RegExpConstructor.h: * runtime/RegExpKey.h: * runtime/RegExpObject.h: * runtime/RegExpPrototype.h: * runtime/RegExpStringIteratorPrototype.h: * runtime/SamplingProfiler.cpp: * runtime/ScopedArgumentsTable.h: * runtime/ScriptExecutable.h: * runtime/SetPrototype.h: * runtime/SmallStrings.h: * runtime/SparseArrayValueMap.h: * runtime/StringConstructor.h: * runtime/StringIteratorPrototype.h: * runtime/StringObject.h: * runtime/StringPrototype.h: * runtime/Structure.h: * runtime/StructureChain.h: * runtime/StructureRareData.h: * runtime/StructureTransitionTable.h: * runtime/Symbol.h: * runtime/SymbolConstructor.h: * runtime/SymbolPrototype.h: * runtime/SymbolTable.h: * runtime/TemplateObjectDescriptor.h: * runtime/TypeProfiler.cpp: * runtime/TypeProfiler.h: * runtime/TypeProfilerLog.cpp: * runtime/VarOffset.h: * testRegExp.cpp: * tools/HeapVerifier.cpp: (JSC::HeapVerifier::checkIfRecorded): * tools/JSDollarVM.cpp: * wasm/WasmB3IRGenerator.cpp: * wasm/WasmBBQPlan.cpp: * wasm/WasmFaultSignalHandler.cpp: * wasm/WasmFunctionParser.h: * wasm/WasmOMGForOSREntryPlan.cpp: * wasm/WasmOMGPlan.cpp: * wasm/WasmPlan.cpp: * wasm/WasmSignature.cpp: * wasm/WasmSignature.h: * wasm/WasmWorklist.cpp: * wasm/js/JSWebAssembly.h: * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/WebAssemblyCompileErrorConstructor.h: * wasm/js/WebAssemblyCompileErrorPrototype.h: * wasm/js/WebAssemblyFunction.h: * wasm/js/WebAssemblyInstanceConstructor.h: * wasm/js/WebAssemblyInstancePrototype.h: * wasm/js/WebAssemblyLinkErrorConstructor.h: * wasm/js/WebAssemblyLinkErrorPrototype.h: * wasm/js/WebAssemblyMemoryConstructor.h: * wasm/js/WebAssemblyMemoryPrototype.h: * wasm/js/WebAssemblyModuleConstructor.h: * wasm/js/WebAssemblyModulePrototype.h: * wasm/js/WebAssemblyRuntimeErrorConstructor.h: * wasm/js/WebAssemblyRuntimeErrorPrototype.h: * wasm/js/WebAssemblyTableConstructor.h: * wasm/js/WebAssemblyTablePrototype.h: * wasm/js/WebAssemblyToJSCallee.h: * yarr/Yarr.h: * yarr/YarrParser.h: * yarr/generateYarrCanonicalizeUnicode: Source/WebCore: No new tests. Covered by existing tests. * bindings/js/JSDOMConstructorBase.h: * bindings/js/JSDOMWindowProperties.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GeneratePrototypeDeclaration): * bindings/scripts/test/JS/JSTestActiveDOMObject.h: * bindings/scripts/test/JS/JSTestEnabledBySetting.h: * bindings/scripts/test/JS/JSTestEnabledForContext.h: * bindings/scripts/test/JS/JSTestEventTarget.h: * bindings/scripts/test/JS/JSTestGlobalObject.h: * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h: * bindings/scripts/test/JS/JSTestNamedGetterCallWith.h: * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.h: * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.h: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestPluginInterface.h: * bindings/scripts/test/JS/JSTestTypedefs.h: * bridge/objc/objc_runtime.h: * bridge/runtime_array.h: * bridge/runtime_method.h: * bridge/runtime_object.h: Source/WebKit: * WebProcess/Plugins/Netscape/JSNPObject.h: Source/WTF: * wtf/Assertions.cpp: * wtf/AutomaticThread.cpp: * wtf/BitVector.h: * wtf/Bitmap.h: * wtf/BloomFilter.h: * wtf/Brigand.h: * wtf/CheckedArithmetic.h: * wtf/CrossThreadCopier.h: * wtf/CurrentTime.cpp: * wtf/DataLog.cpp: * wtf/DateMath.cpp: (WTF::daysFrom1970ToYear): * wtf/DeferrableRefCounted.h: * wtf/GetPtr.h: * wtf/HashFunctions.h: * wtf/HashMap.h: * wtf/HashTable.h: * wtf/HashTraits.h: * wtf/JSONValues.cpp: * wtf/JSONValues.h: * wtf/ListHashSet.h: * wtf/Lock.h: * wtf/LockAlgorithm.h: * wtf/LockAlgorithmInlines.h: (WTF::Hooks>::lockSlow): * wtf/Logger.h: * wtf/LoggerHelper.h: (WTF::LoggerHelper::childLogIdentifier const): * wtf/MainThread.cpp: * wtf/MetaAllocatorPtr.h: * wtf/MonotonicTime.h: * wtf/NaturalLoops.h: (WTF::NaturalLoops::NaturalLoops): * wtf/ObjectIdentifier.h: * wtf/RAMSize.cpp: * wtf/Ref.h: * wtf/RefPtr.h: * wtf/RetainPtr.h: * wtf/SchedulePair.h: * wtf/StackShot.h: * wtf/StdLibExtras.h: * wtf/TinyPtrSet.h: * wtf/URL.cpp: * wtf/URLHash.h: * wtf/URLParser.cpp: (WTF::URLParser::defaultPortForProtocol): * wtf/Vector.h: * wtf/VectorTraits.h: * wtf/WallTime.h: * wtf/WeakHashSet.h: * wtf/WordLock.h: * wtf/cocoa/CPUTimeCocoa.cpp: * wtf/cocoa/MemoryPressureHandlerCocoa.mm: * wtf/persistence/PersistentDecoder.h: * wtf/persistence/PersistentEncoder.h: * wtf/text/AtomStringHash.h: * wtf/text/CString.h: * wtf/text/StringBuilder.cpp: (WTF::expandedCapacity): * wtf/text/StringHash.h: * wtf/text/StringImpl.h: * wtf/text/StringToIntegerConversion.h: (WTF::toIntegralType): * wtf/text/SymbolRegistry.h: * wtf/text/TextStream.cpp: (WTF::hasFractions): * wtf/text/WTFString.h: * wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp: Canonical link: https://commits.webkit.org/215538@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250005 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-18 00:36:19 +00:00
static constexpr unsigned defaultStartingSize = 4;
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
InPlaceAbstractState::beginBasicBlock shouldn't have to clear any abstract values https://bugs.webkit.org/show_bug.cgi?id=185365 Reviewed by Saam Barati. Source/JavaScriptCore: This patch does three things to improve compile times: - Fixes some inlining goofs. - Adds the ability to measure compile times with run-jsc-benchmarks. - Dramatically improves the performance of InPlaceAbstractState::beginBasicBlock by removing the code that clears abstract values. It turns out that on constant folding "needed" this, in the sense that this was the only thing protecting it from loading the abstract value of a no-result node and then concluding that because it had a non-empty m_value, it could be constant-folded. Any node that produces a result will explicitly set its abstract value, so this problem can also be guarded by just having constant folding check if the node it wants to fold returns any result. Solid 0.96% compile time speed-up across SunSpider-CompileTime and V8Spider-CompileTime. Rolling back in after fixing cloop build. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGAbstractValue.cpp: (JSC::DFG::AbstractValue::set): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::merge): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGGraph.h: (JSC::DFG::Graph::doToChildrenWithNode): (JSC::DFG::Graph::doToChildren): * dfg/DFGInPlaceAbstractState.cpp: (JSC::DFG::InPlaceAbstractState::beginBasicBlock): * jit/JIT.cpp: (JSC::JIT::totalCompileTime): * jit/JIT.h: * jsc.cpp: (GlobalObject::finishCreation): (functionTotalCompileTime): Source/WTF: Fix some inlining goof-ups. Rolling back in after fixing cloop build. * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::mergeOtherOutOfLine): Tools: Make it possible to measure compile times. Rolling back in after fixing cloop builds. * Scripts/run-jsc-benchmarks: Canonical link: https://commits.webkit.org/200910@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-08 21:49:09 +00:00
NEVER_INLINE bool addOutOfLine(T value)
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
{
OutOfLineList* list = this->list();
for (unsigned i = 0; i < list->m_length; ++i) {
if (list->list()[i] == value)
return false;
}
if (list->m_length < list->m_capacity) {
list->list()[list->m_length++] = value;
return true;
}
OutOfLineList* newList = OutOfLineList::create(list->m_capacity * 2);
newList->m_length = list->m_length + 1;
for (unsigned i = list->m_length; i--;)
newList->list()[i] = list->list()[i];
newList->list()[list->m_length] = value;
OutOfLineList::destroy(list);
set(newList);
return true;
}
InPlaceAbstractState::beginBasicBlock shouldn't have to clear any abstract values https://bugs.webkit.org/show_bug.cgi?id=185365 Reviewed by Saam Barati. Source/JavaScriptCore: This patch does three things to improve compile times: - Fixes some inlining goofs. - Adds the ability to measure compile times with run-jsc-benchmarks. - Dramatically improves the performance of InPlaceAbstractState::beginBasicBlock by removing the code that clears abstract values. It turns out that on constant folding "needed" this, in the sense that this was the only thing protecting it from loading the abstract value of a no-result node and then concluding that because it had a non-empty m_value, it could be constant-folded. Any node that produces a result will explicitly set its abstract value, so this problem can also be guarded by just having constant folding check if the node it wants to fold returns any result. Solid 0.96% compile time speed-up across SunSpider-CompileTime and V8Spider-CompileTime. Rolling back in after fixing cloop build. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGAbstractValue.cpp: (JSC::DFG::AbstractValue::set): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::merge): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGGraph.h: (JSC::DFG::Graph::doToChildrenWithNode): (JSC::DFG::Graph::doToChildren): * dfg/DFGInPlaceAbstractState.cpp: (JSC::DFG::InPlaceAbstractState::beginBasicBlock): * jit/JIT.cpp: (JSC::JIT::totalCompileTime): * jit/JIT.h: * jsc.cpp: (GlobalObject::finishCreation): (functionTotalCompileTime): Source/WTF: Fix some inlining goof-ups. Rolling back in after fixing cloop build. * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::mergeOtherOutOfLine): Tools: Make it possible to measure compile times. Rolling back in after fixing cloop builds. * Scripts/run-jsc-benchmarks: Canonical link: https://commits.webkit.org/200910@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-08 21:49:09 +00:00
NEVER_INLINE bool mergeOtherOutOfLine(const TinyPtrSet& other)
{
OutOfLineList* list = other.list();
if (list->m_length >= 2) {
if (isThin()) {
OutOfLineList* myNewList = OutOfLineList::create(
list->m_length + !!singleEntry());
if (singleEntry()) {
myNewList->m_length = 1;
myNewList->list()[0] = singleEntry();
}
set(myNewList);
}
bool changed = false;
for (unsigned i = 0; i < list->m_length; ++i)
changed |= addOutOfLine(list->list()[i]);
return changed;
}
ASSERT(list->m_length);
return add(list->list()[0]);
}
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
bool containsOutOfLine(T value) const
{
OutOfLineList* list = this->list();
for (unsigned i = 0; i < list->m_length; ++i) {
if (list->list()[i] == value)
return true;
}
return false;
}
ALWAYS_INLINE void copyFrom(const TinyPtrSet& other)
{
if (other.isThin() || other.m_pointer == reservedValue) {
bool value = getReservedFlag();
m_pointer = other.m_pointer;
setReservedFlag(value);
return;
}
copyFromOutOfLine(other);
}
NEVER_INLINE void copyFromOutOfLine(const TinyPtrSet& other)
{
ASSERT(!other.isThin() && other.m_pointer != reservedValue);
OutOfLineList* otherList = other.list();
OutOfLineList* myList = OutOfLineList::create(otherList->m_length);
myList->m_length = otherList->m_length;
for (unsigned i = otherList->m_length; i--;)
myList->list()[i] = otherList->list()[i];
set(myList);
}
class OutOfLineList {
public:
static OutOfLineList* create(unsigned capacity)
{
return new (NotNull, fastMalloc(sizeof(OutOfLineList) + capacity * sizeof(T))) OutOfLineList(0, capacity);
}
static void destroy(OutOfLineList* list)
{
fastFree(list);
}
T* list() { return bitwise_cast<T*>(this + 1); }
OutOfLineList(unsigned length, unsigned capacity)
: m_length(length)
, m_capacity(capacity)
{
}
unsigned m_length;
unsigned m_capacity;
};
ALWAYS_INLINE void deleteListIfNecessary()
{
if (!isThin()) {
ASSERT(m_pointer != reservedValue);
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
OutOfLineList::destroy(list());
}
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
}
[JSC] Simplify the initialization of AbstractValue in the AbstractInterpreter https://bugs.webkit.org/show_bug.cgi?id=160370 Reviewed by Saam Barati. Source/JavaScriptCore: We use a ton of AbstractValue to run the Abstract Interpreter. When we set up the initial values, the compiler sets a zero on a first word, a one on a second word, and a zero again on a third word. Since no vector or double-store can deal with 3 words, unrolling is done by repeating those instructions. The reason for the one was TinyPtrSet. It needed a flag for empty value to identify the set as thin. I flipped the flag to "fat" to make sure TinyPtrSet is initialized to zero. With that done, I just had to clean some places to make the initialization shorter. It makes the binary easier to follow but this does not help with the bigger problem: the time spent per block on Abstract Interpreter. * bytecode/Operands.h: The traits were useless, no client code defines it. (JSC::Operands::Operands): (JSC::Operands::ensureLocals): Because of the size of the function, llvm is not inlining it. We were literally loading 3 registers from memory and storing them in the vector. Now that AbstractValue has a VectorTraits, we should just rely on the memset of Vector when possible. (JSC::Operands::getLocal): (JSC::Operands::setArgumentFirstTime): (JSC::Operands::setLocalFirstTime): (JSC::Operands::clear): (JSC::OperandValueTraits::defaultValue): Deleted. (JSC::OperandValueTraits::isEmptyForDump): Deleted. * bytecode/OperandsInlines.h: (JSC::Operands<T>::dumpInContext): (JSC::Operands<T>::dump): (JSC::Traits>::dumpInContext): Deleted. (JSC::Traits>::dump): Deleted. * dfg/DFGAbstractValue.cpp: * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::AbstractValue): Source/WTF: * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::set): Canonical link: https://commits.webkit.org/178626@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204065 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-03 03:45:07 +00:00
bool isThin() const { return !(m_pointer & fatFlag); }
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
void* pointer() const
{
return bitwise_cast<void*>(m_pointer & ~flags);
}
T singleEntry() const
{
ASSERT(isThin());
Harden how the compiler references GC objects https://bugs.webkit.org/show_bug.cgi?id=167277 <rdar://problem/30179506> Reviewed by Filip Pizlo. Source/JavaScriptCore: Since r210971, the DFG/FTL will flash safepoints before each phase. This means that there are more opportunities for a GC to happen while the compiler is running. Because of this, the compiler must keep track of all the heap pointers that are part of the Graph data structure. To accomplish this, I've designed a new type called RegisteredStructure that can only be constructed after the Graph becomes aware of its underlying Structure*. I designed this new type to have the type system in C++ help us catch errors where we're not informing the graph/plan of a heap pointer. I've made it a compile error to create an OpInfo with a pointer T* where T inherits from HeapCell. This encourages an OpInfo to be created with either a FrozenValue* or a RegisteredStructure. I've added similar compile time assertions for TrustedImmPtr in DFG::SpeculativeJIT and FTL::Output::constIntPtr. These static asserts don't save us from all bad programs because there are ways to write code that's incorrect that compiles, but the new types do help us ensure that the most obvious way of writing the code is correct. The reason this patch is so big is that I've strung RegisteredStructure and RegisteredStructureSet through the entire DFG/FTL. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::determineLiveness): * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): Deleted. (JSC::StructureSet::filterArrayModes): Deleted. (JSC::StructureSet::speculationFromStructures): Deleted. (JSC::StructureSet::arrayModesFromStructures): Deleted. (JSC::StructureSet::validateReferences): Deleted. * bytecode/StructureSet.h: * dfg/DFGAbstractInterpreter.h: (JSC::DFG::AbstractInterpreter::filter): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::booleanResult): (JSC::DFG::isToThisAnIdentity): (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::observeTransition): (JSC::DFG::AbstractInterpreter<AbstractStateType>::filter): * dfg/DFGAbstractValue.cpp: (JSC::DFG::AbstractValue::set): (JSC::DFG::AbstractValue::setType): (JSC::DFG::AbstractValue::mergeOSREntryValue): (JSC::DFG::AbstractValue::filter): (JSC::DFG::AbstractValue::changeStructure): (JSC::DFG::AbstractValue::contains): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::observeTransition): (JSC::DFG::AbstractValue::TransitionObserver::TransitionObserver): * dfg/DFGArgumentsEliminationPhase.cpp: * dfg/DFGArrayMode.cpp: (JSC::DFG::ArrayMode::alreadyChecked): * dfg/DFGArrayifySlowPathGenerator.h: (JSC::DFG::ArrayifySlowPathGenerator::ArrayifySlowPathGenerator): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleConstantInternalFunction): (JSC::DFG::ByteCodeParser::load): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handlePutById): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry): * dfg/DFGCallArrayAllocatorSlowPathGenerator.h: (JSC::DFG::CallArrayAllocatorSlowPathGenerator::CallArrayAllocatorSlowPathGenerator): (JSC::DFG::CallArrayAllocatorWithVariableSizeSlowPathGenerator::CallArrayAllocatorWithVariableSizeSlowPathGenerator): * dfg/DFGCallCreateDirectArgumentsSlowPathGenerator.h: (JSC::DFG::CallCreateDirectArgumentsSlowPathGenerator::CallCreateDirectArgumentsSlowPathGenerator): * dfg/DFGCommonData.cpp: (JSC::DFG::CommonData::notifyCompilingStructureTransition): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::emitGetByOffset): (JSC::DFG::ConstantFoldingPhase::emitPutByOffset): (JSC::DFG::ConstantFoldingPhase::addBaseCheck): (JSC::DFG::ConstantFoldingPhase::addStructureTransitionCheck): * dfg/DFGDesiredWeakReferences.cpp: (JSC::DFG::DesiredWeakReferences::reallyAdd): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::checkArray): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::tryGetConstantProperty): (JSC::DFG::Graph::inferredValueForProperty): (JSC::DFG::Graph::visitChildren): (JSC::DFG::Graph::freeze): (JSC::DFG::Graph::registerStructure): (JSC::DFG::Graph::assertIsRegistered): * dfg/DFGGraph.h: (JSC::DFG::Graph::registerStructure): (JSC::DFG::Graph::addStructureSet): * dfg/DFGJITCompiler.h: (JSC::DFG::JITCompiler::branchWeakStructure): * dfg/DFGMultiGetByOffsetData.cpp: (JSC::DFG::MultiGetByOffsetCase::dumpInContext): * dfg/DFGMultiGetByOffsetData.h: (JSC::DFG::MultiGetByOffsetCase::MultiGetByOffsetCase): (JSC::DFG::MultiGetByOffsetCase::set): * dfg/DFGNode.cpp: (JSC::DFG::Node::convertToPutStructureHint): * dfg/DFGNode.h: (JSC::DFG::Node::convertToCheckStructure): (JSC::DFG::Node::structureSet): (JSC::DFG::Node::structure): (JSC::DFG::Node::OpInfoWrapper::OpInfoWrapper): (JSC::DFG::Node::OpInfoWrapper::operator=): (JSC::DFG::Node::OpInfoWrapper::asRegisteredStructure): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGOpInfo.h: (JSC::DFG::OpInfo::OpInfo): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalizeWithoutNotifyingCallback): * dfg/DFGRegisteredStructure.h: Added. (JSC::DFG::RegisteredStructure::get): (JSC::DFG::RegisteredStructure::operator->): (JSC::DFG::RegisteredStructure::operator==): (JSC::DFG::RegisteredStructure::operator!=): (JSC::DFG::RegisteredStructure::operator bool): (JSC::DFG::RegisteredStructure::RegisteredStructure): (JSC::DFG::RegisteredStructure::createPrivate): * dfg/DFGRegisteredStructureSet.cpp: Added. (JSC::DFG::RegisteredStructureSet::filter): (JSC::DFG::RegisteredStructureSet::filterArrayModes): (JSC::DFG::RegisteredStructureSet::speculationFromStructures): (JSC::DFG::RegisteredStructureSet::arrayModesFromStructures): (JSC::DFG::RegisteredStructureSet::validateReferences): * dfg/DFGRegisteredStructureSet.h: Added. (JSC::DFG::RegisteredStructureSet::RegisteredStructureSet): (JSC::DFG::RegisteredStructureSet::onlyStructure): (JSC::DFG::RegisteredStructureSet::toStructureSet): * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::emitAllocateRawObject): (JSC::DFG::SpeculativeJIT::emitGetCallee): (JSC::DFG::SpeculativeJIT::silentFill): (JSC::DFG::SpeculativeJIT::checkArray): (JSC::DFG::SpeculativeJIT::compileGetByValOnString): (JSC::DFG::SpeculativeJIT::compileFromCharCode): (JSC::DFG::SpeculativeJIT::compileDoubleRep): (JSC::DFG::compileClampDoubleToByte): (JSC::DFG::SpeculativeJIT::compileMakeRope): (JSC::DFG::SpeculativeJIT::compileArithRounding): (JSC::DFG::SpeculativeJIT::compileNewFunctionCommon): (JSC::DFG::SpeculativeJIT::compileNewFunction): (JSC::DFG::SpeculativeJIT::compileCreateActivation): (JSC::DFG::SpeculativeJIT::compileCreateDirectArguments): (JSC::DFG::SpeculativeJIT::compileCreateScopedArguments): (JSC::DFG::SpeculativeJIT::compileCreateClonedArguments): (JSC::DFG::SpeculativeJIT::compileSpread): (JSC::DFG::SpeculativeJIT::compileArraySlice): (JSC::DFG::SpeculativeJIT::compileTypeOf): (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileToStringOrCallStringConstructorOnCell): (JSC::DFG::SpeculativeJIT::compileNewTypedArray): (JSC::DFG::SpeculativeJIT::speculateStringOrStringObject): (JSC::DFG::SpeculativeJIT::compileMaterializeNewObject): * dfg/DFGSpeculativeJIT.h: (JSC::DFG::SpeculativeJIT::TrustedImmPtr::TrustedImmPtr): (JSC::DFG::SpeculativeJIT::TrustedImmPtr::weakPointer): (JSC::DFG::SpeculativeJIT::TrustedImmPtr::operator MacroAssembler::TrustedImmPtr): (JSC::DFG::SpeculativeJIT::TrustedImmPtr::asIntptr): (JSC::DFG::SpeculativeJIT::callOperation): (JSC::DFG::SpeculativeJIT::emitAllocateDestructibleObject): (JSC::DFG::SpeculativeJIT::speculateStringObjectForStructure): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNullOrUndefined): (JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNullOrUndefined): (JSC::DFG::SpeculativeJIT::emitCall): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot): (JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch): (JSC::DFG::SpeculativeJIT::compile): (JSC::DFG::SpeculativeJIT::compileAllocateNewArrayWithSize): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNullOrUndefined): (JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNullOrUndefined): (JSC::DFG::SpeculativeJIT::emitCall): (JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot): (JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch): (JSC::DFG::SpeculativeJIT::compile): (JSC::DFG::SpeculativeJIT::compileAllocateNewArrayWithSize): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::assertIsRegistered): (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::observeTransition): (JSC::DFG::StructureAbstractValue::observeTransitions): (JSC::DFG::StructureAbstractValue::add): (JSC::DFG::StructureAbstractValue::merge): (JSC::DFG::StructureAbstractValue::mergeNotTop): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::filterClassInfoSlow): (JSC::DFG::StructureAbstractValue::contains): (JSC::DFG::StructureAbstractValue::isSubsetOf): (JSC::DFG::StructureAbstractValue::isSupersetOf): (JSC::DFG::StructureAbstractValue::overlaps): (JSC::DFG::StructureAbstractValue::isSubClassOf): (JSC::DFG::StructureAbstractValue::dumpInContext): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::StructureAbstractValue): (JSC::DFG::StructureAbstractValue::operator=): (JSC::DFG::StructureAbstractValue::set): (JSC::DFG::StructureAbstractValue::toStructureSet): (JSC::DFG::StructureAbstractValue::at): (JSC::DFG::StructureAbstractValue::operator[]): (JSC::DFG::StructureAbstractValue::onlyStructure): * dfg/DFGStructureRegistrationPhase.cpp: (JSC::DFG::StructureRegistrationPhase::StructureRegistrationPhase): Deleted. (JSC::DFG::StructureRegistrationPhase::run): Deleted. (JSC::DFG::StructureRegistrationPhase::registerStructures): Deleted. (JSC::DFG::StructureRegistrationPhase::registerStructure): Deleted. (JSC::DFG::StructureRegistrationPhase::assertAreRegistered): Deleted. (JSC::DFG::StructureRegistrationPhase::assertIsRegistered): Deleted. (JSC::DFG::performStructureRegistration): Deleted. * dfg/DFGStructureRegistrationPhase.h: * dfg/DFGTransition.cpp: (JSC::DFG::Transition::dumpInContext): * dfg/DFGTransition.h: (JSC::DFG::Transition::Transition): * dfg/DFGTypeCheckHoistingPhase.cpp: (JSC::DFG::TypeCheckHoistingPhase::noticeStructureCheck): (JSC::DFG::TypeCheckHoistingPhase::noticeStructureCheckAccountingForArrayMode): * dfg/DFGValidate.cpp: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::compileCallObjectConstructor): (JSC::FTL::DFG::LowerDFGToB3::compileCheckStructure): (JSC::FTL::DFG::LowerDFGToB3::compilePutStructure): (JSC::FTL::DFG::LowerDFGToB3::compileArraySlice): (JSC::FTL::DFG::LowerDFGToB3::compileCreateActivation): (JSC::FTL::DFG::LowerDFGToB3::compileNewFunction): (JSC::FTL::DFG::LowerDFGToB3::compileCreateDirectArguments): (JSC::FTL::DFG::LowerDFGToB3::compileCreateRest): (JSC::FTL::DFG::LowerDFGToB3::compileNewArray): (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSpread): (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayBuffer): (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSize): (JSC::FTL::DFG::LowerDFGToB3::compileNewTypedArray): (JSC::FTL::DFG::LowerDFGToB3::compileAllocatePropertyStorage): (JSC::FTL::DFG::LowerDFGToB3::compileReallocatePropertyStorage): (JSC::FTL::DFG::LowerDFGToB3::compileMultiGetByOffset): (JSC::FTL::DFG::LowerDFGToB3::compileMultiPutByOffset): (JSC::FTL::DFG::LowerDFGToB3::compileGetMapBucket): (JSC::FTL::DFG::LowerDFGToB3::compileOverridesHasInstance): (JSC::FTL::DFG::LowerDFGToB3::compileCheckStructureImmediate): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeCreateActivation): (JSC::FTL::DFG::LowerDFGToB3::compileNewRegexp): (JSC::FTL::DFG::LowerDFGToB3::compileLogShadowChickenTail): (JSC::FTL::DFG::LowerDFGToB3::checkStructure): (JSC::FTL::DFG::LowerDFGToB3::checkInferredType): (JSC::FTL::DFG::LowerDFGToB3::allocateObject): (JSC::FTL::DFG::LowerDFGToB3::allocateVariableSizedObject): (JSC::FTL::DFG::LowerDFGToB3::allocateJSArray): (JSC::FTL::DFG::LowerDFGToB3::allocateUninitializedContiguousJSArray): (JSC::FTL::DFG::LowerDFGToB3::boolify): (JSC::FTL::DFG::LowerDFGToB3::equalNullOrUndefined): (JSC::FTL::DFG::LowerDFGToB3::lowCell): (JSC::FTL::DFG::LowerDFGToB3::speculateStringObjectForStructureID): (JSC::FTL::DFG::LowerDFGToB3::weakPointer): (JSC::FTL::DFG::LowerDFGToB3::frozenPointer): (JSC::FTL::DFG::LowerDFGToB3::weakStructureID): (JSC::FTL::DFG::LowerDFGToB3::weakStructure): (JSC::FTL::DFG::LowerDFGToB3::crash): * ftl/FTLOutput.h: (JSC::FTL::Output::weakPointer): (JSC::FTL::Output::constIntPtr): Source/WTF: I made TinyPtrSet use bitwise_cast instead of static_cast for its singleEntry() function so that it can work on pointer-like types just as it can on actual pointer types. An example of where this matters is when you have TinyPtrSet<T> where T is defined to be a struct which wraps a pointer, e.g: struct T { void* m_pointer; } * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::singleEntry): Canonical link: https://commits.webkit.org/184513@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211237 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-26 23:50:58 +00:00
return bitwise_cast<T>(pointer());
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
}
OutOfLineList* list() const
{
ASSERT(!isThin());
return static_cast<OutOfLineList*>(pointer());
}
void set(T value)
{
set(bitwise_cast<uintptr_t>(value), true);
}
void set(OutOfLineList* list)
{
set(bitwise_cast<uintptr_t>(list), false);
}
void setEmpty()
{
set(0, true);
}
void set(uintptr_t pointer, bool singleEntry)
{
[JSC] Simplify the initialization of AbstractValue in the AbstractInterpreter https://bugs.webkit.org/show_bug.cgi?id=160370 Reviewed by Saam Barati. Source/JavaScriptCore: We use a ton of AbstractValue to run the Abstract Interpreter. When we set up the initial values, the compiler sets a zero on a first word, a one on a second word, and a zero again on a third word. Since no vector or double-store can deal with 3 words, unrolling is done by repeating those instructions. The reason for the one was TinyPtrSet. It needed a flag for empty value to identify the set as thin. I flipped the flag to "fat" to make sure TinyPtrSet is initialized to zero. With that done, I just had to clean some places to make the initialization shorter. It makes the binary easier to follow but this does not help with the bigger problem: the time spent per block on Abstract Interpreter. * bytecode/Operands.h: The traits were useless, no client code defines it. (JSC::Operands::Operands): (JSC::Operands::ensureLocals): Because of the size of the function, llvm is not inlining it. We were literally loading 3 registers from memory and storing them in the vector. Now that AbstractValue has a VectorTraits, we should just rely on the memset of Vector when possible. (JSC::Operands::getLocal): (JSC::Operands::setArgumentFirstTime): (JSC::Operands::setLocalFirstTime): (JSC::Operands::clear): (JSC::OperandValueTraits::defaultValue): Deleted. (JSC::OperandValueTraits::isEmptyForDump): Deleted. * bytecode/OperandsInlines.h: (JSC::Operands<T>::dumpInContext): (JSC::Operands<T>::dump): (JSC::Traits>::dumpInContext): Deleted. (JSC::Traits>::dump): Deleted. * dfg/DFGAbstractValue.cpp: * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::AbstractValue): Source/WTF: * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::set): Canonical link: https://commits.webkit.org/178626@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204065 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-03 03:45:07 +00:00
m_pointer = pointer | (singleEntry ? 0 : fatFlag) | (m_pointer & reservedFlag);
The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. Source/JavaScriptCore: I moved the generic logic of small sets of pointers and moved it into WTF. Now, StructureSet is a subclass of TinyPtrSet<Structure*>. There shouldn't be any functional change. * bytecode/StructureSet.cpp: (JSC::StructureSet::filter): (JSC::StructureSet::filterArrayModes): (JSC::StructureSet::speculationFromStructures): (JSC::StructureSet::arrayModesFromStructures): (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (JSC::StructureSet::clear): Deleted. (JSC::StructureSet::add): Deleted. (JSC::StructureSet::remove): Deleted. (JSC::StructureSet::contains): Deleted. (JSC::StructureSet::merge): Deleted. (JSC::StructureSet::exclude): Deleted. (JSC::StructureSet::isSubsetOf): Deleted. (JSC::StructureSet::overlaps): Deleted. (JSC::StructureSet::operator==): Deleted. (JSC::StructureSet::addOutOfLine): Deleted. (JSC::StructureSet::containsOutOfLine): Deleted. (JSC::StructureSet::copyFromOutOfLine): Deleted. (JSC::StructureSet::OutOfLineList::create): Deleted. (JSC::StructureSet::OutOfLineList::destroy): Deleted. * bytecode/StructureSet.h: (JSC::StructureSet::onlyStructure): (JSC::StructureSet::StructureSet): Deleted. (JSC::StructureSet::operator=): Deleted. (JSC::StructureSet::~StructureSet): Deleted. (JSC::StructureSet::isEmpty): Deleted. (JSC::StructureSet::genericFilter): Deleted. (JSC::StructureSet::isSupersetOf): Deleted. (JSC::StructureSet::size): Deleted. (JSC::StructureSet::at): Deleted. (JSC::StructureSet::operator[]): Deleted. (JSC::StructureSet::last): Deleted. (JSC::StructureSet::iterator::iterator): Deleted. (JSC::StructureSet::iterator::operator*): Deleted. (JSC::StructureSet::iterator::operator++): Deleted. (JSC::StructureSet::iterator::operator==): Deleted. (JSC::StructureSet::iterator::operator!=): Deleted. (JSC::StructureSet::begin): Deleted. (JSC::StructureSet::end): Deleted. (JSC::StructureSet::ContainsOutOfLine::ContainsOutOfLine): Deleted. (JSC::StructureSet::ContainsOutOfLine::operator()): Deleted. (JSC::StructureSet::copyFrom): Deleted. (JSC::StructureSet::OutOfLineList::list): Deleted. (JSC::StructureSet::OutOfLineList::OutOfLineList): Deleted. (JSC::StructureSet::deleteStructureListIfNecessary): Deleted. (JSC::StructureSet::isThin): Deleted. (JSC::StructureSet::pointer): Deleted. (JSC::StructureSet::singleStructure): Deleted. (JSC::StructureSet::structureList): Deleted. (JSC::StructureSet::set): Deleted. (JSC::StructureSet::setEmpty): Deleted. (JSC::StructureSet::getReservedFlag): Deleted. (JSC::StructureSet::setReservedFlag): Deleted. * dfg/DFGStructureAbstractValue.cpp: (JSC::DFG::StructureAbstractValue::clobber): (JSC::DFG::StructureAbstractValue::filter): (JSC::DFG::StructureAbstractValue::filterSlow): (JSC::DFG::StructureAbstractValue::contains): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::makeTop): Source/WTF: As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): Canonical link: https://commits.webkit.org/163803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-08 19:41:47 +00:00
}
bool getReservedFlag() const { return m_pointer & reservedFlag; }
void setReservedFlag(bool value)
{
if (value)
m_pointer |= reservedFlag;
else
m_pointer &= ~reservedFlag;
}
uintptr_t m_pointer;
};
} // namespace WTF
using WTF::TinyPtrSet;