haikuwebkit/Source/WTF/wtf/DataLog.cpp

192 lines
6.5 KiB
C++
Raw Permalink Normal View History

It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +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) 2012-2019 Apple Inc. All rights reserved.
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +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.
*/
#include "config.h"
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
#include <wtf/DataLog.h>
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +00:00
#include <stdarg.h>
#include <string.h>
Any function that can log things should be able to easily log them to a memory buffer as well https://bugs.webkit.org/show_bug.cgi?id=103000 Reviewed by Sam Weinig. Source/JavaScriptCore: Change all users of WTF::dataFile() to expect a PrintStream& rather than a FILE*. * bytecode/Operands.h: (JSC::OperandValueTraits::dump): (JSC::dumpOperands): (JSC): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::dump): * dfg/DFGAbstractState.h: (AbstractState): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::dump): * dfg/DFGCommon.h: (JSC::DFG::NodeIndexTraits::dump): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::dump): * dfg/DFGVariableEvent.cpp: (JSC::DFG::VariableEvent::dump): (JSC::DFG::VariableEvent::dumpFillInfo): (JSC::DFG::VariableEvent::dumpSpillInfo): * dfg/DFGVariableEvent.h: (VariableEvent): * disassembler/Disassembler.h: (JSC): (JSC::tryToDisassemble): * disassembler/UDis86Disassembler.cpp: (JSC::tryToDisassemble): Source/WTF: We have a number of places where we pass around a FILE* as a target to which to print some logging information. But the purpose of passing FILE* instead of always assuming that we should dump to stderr is that it may be sometimes useful to send the logging information elsewhere. Unfortunately, FILE* isn't quite powerful enough: it's combersome to use it to send logging to a string, for example. We could get around this by using <iostream> and <sstream>, but so far this aspect of C++ has not been part of the WebKit coding conventions. Personally I find <iostream> awkward due to its abuse of operator overloading. So this patch introduces the PrintStream abstract class, which offers printf-like functionality while completely abstracting the destination and mechanism of the printing output. It would be trivial to implement a StringPrintStream, for example. This will feed into work on https://bugs.webkit.org/show_bug.cgi?id=102999. This also sets us up for creating templatized print() and println() methods that will allow us to say things like out.print("count = ", count, "\n"), but that is the topic of https://bugs.webkit.org/show_bug.cgi?id=103009. This patch also changes dataLog() to use FilePrintStream internally, and WTF::dataFile() now returns a FilePrintStream&. Any previous users of WTF::dataFile() have been changed to expect a PrintStream&. * GNUmakefile.list.am: * WTF.pro: * WTF.vcproj/WTF.vcproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/DataLog.cpp: (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLogString): * wtf/DataLog.h: (WTF): * wtf/FilePrintStream.cpp: Added. (WTF): (WTF::FilePrintStream::FilePrintStream): (WTF::FilePrintStream::~FilePrintStream): (WTF::FilePrintStream::vprintf): (WTF::FilePrintStream::flush): * wtf/FilePrintStream.h: Added. (WTF): (FilePrintStream): (WTF::FilePrintStream::file): * wtf/PrintStream.cpp: Added. (WTF): (WTF::PrintStream::PrintStream): (WTF::PrintStream::~PrintStream): (WTF::PrintStream::printf): (WTF::PrintStream::print): (WTF::PrintStream::println): (WTF::PrintStream::flush): (WTF::print): * wtf/PrintStream.h: Added. (WTF): (PrintStream): (WTF::print): (WTF::println): Canonical link: https://commits.webkit.org/121301@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135640 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-11-24 03:16:47 +00:00
#include <wtf/FilePrintStream.h>
#include <wtf/LockedPrintStream.h>
#include <wtf/ProcessID.h>
#include <mutex>
#define DATA_LOG_TO_FILE 0
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +00:00
// Set to 1 to use the temp directory from confstr instead of hardcoded directory.
// The last component of DATA_LOG_FILENAME will still be used.
#define DATA_LOG_TO_DARWIN_TEMP_DIR 0
// Uncomment to force logging to the given file regardless of what the environment variable says.
// Note that we will append ".<pid>.txt" where <pid> is the PID.
// This path won't work on Windows, make sure to change to something like C:\\Users\\<more path>\\log.txt.
#define DATA_LOG_FILENAME "/tmp/WTFLog"
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +00:00
namespace WTF {
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 size_t maxPathLength = 1024;
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +00:00
Add ability to configure JSC options from a file https://bugs.webkit.org/show_bug.cgi?id=168914 Reviewed by Filip Pizlo. Added the ability to set options and DataLog file location via a configuration file. Source/JavaScriptCore: The configuration file is specified with the --configFile option to JSC or the JSC_configFile environment variable. The file format allows for options conditionally dependent on various attributes. Currently those attributes are the process name, parent process name and build type (Release or Debug). In this patch, the parent process type is not set. That will be set up in WebKit code with a follow up patch. Here is an example config file: logFile = "/tmp/jscLog.%pid.txt" jscOptions { dumpOptions = 2 } build == "Debug" { jscOptions { useConcurrentJIT = false dumpDisassembly = true } } build == "Release" && processName == "jsc" { jscOptions { asyncDisassembly = true } } Eliminated the prior options file code. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * jsc.cpp: (jscmain): * runtime/ConfigFile.cpp: Added. (JSC::ConfigFileScanner::ConfigFileScanner): (JSC::ConfigFileScanner::start): (JSC::ConfigFileScanner::lineNumber): (JSC::ConfigFileScanner::currentBuffer): (JSC::ConfigFileScanner::atFileEnd): (JSC::ConfigFileScanner::tryConsume): (JSC::ConfigFileScanner::tryConsumeString): (JSC::ConfigFileScanner::tryConsumeUpto): (JSC::ConfigFileScanner::fillBufferIfNeeded): (JSC::ConfigFileScanner::fillBuffer): (JSC::ConfigFile::ConfigFile): (JSC::ConfigFile::setProcessName): (JSC::ConfigFile::setParentProcessName): (JSC::ConfigFile::parse): * runtime/ConfigFile.h: Added. * runtime/Options.cpp: (JSC::Options::initialize): (JSC::Options::setOptions): * runtime/Options.h: Source/WTF: The pathname can include the printf style "%pid", which will be replaced with the current process id. * wtf/DataLog.cpp: (WTF::initializeLogFileOnce): (WTF::setDataFile): * wtf/DataLog.h: Canonical link: https://commits.webkit.org/185961@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213151 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 18:50:00 +00:00
static PrintStream* s_file;
static uint64_t s_fileData[(sizeof(FilePrintStream) + 7) / 8];
The mutator should be able to perform increments of GC work https://bugs.webkit.org/show_bug.cgi?id=167528 Reviewed by Keith Miller and Geoffrey Garen. Source/JavaScriptCore: The cool thing about having a concurrent and parallel collector is that it's easy to also make it incremental, because the load balancer can also hand over work to anyone (including the mutator) and since the collector is running concurrently anyway, the mutator can usually rely on the balancer having some spare work. This change adds a classic work-based incremental mode to the GC. When you allocate K bytes, you have to do Options::gcIncrementScale() * K "bytes" of draining. This is ammortized so that it only happens in allocation slow paths. On computers that have a lot of CPUs, this mode is not profitable and we set gcIncrementScale to zero. On such computers, Riptide was already performing great because there was no way that one mutator thread could outpace many GC threads. But on computers with fewer CPUs, there were problems having to do with making the collector progress quickly enough so that the heap doesn't grow too much. The stochastic scheduler actually made things worse, because it relies a lot on the fact that the GC will simply be faster than the mutator anyway. The old scheduler claimed to address the problem of GC pace, but it used a time-based scheduler, which is not as precise at keeping pase as the new work-based incremental mode. In theory, the work-based mode guarantees a bound on how much the heap can grow during a collection just because each byte allocated means some number of bytes visited. We don't try to create such a theoretical bound. We're just trying to give the collector an unfair advantage in any race with the mutator. Turning on incremental mode, the stochastic scheduler, and passive draining in combination with each other is a huge splay-latency speed-up on my iPad. It's also a CDjs progression. It does regress splay-throughput, but I think that's fine (the regression is 11%, the progression is 3x). * heap/Heap.cpp: (JSC::Heap::Heap): (JSC::Heap::~Heap): (JSC::Heap::markToFixpoint): (JSC::Heap::updateObjectCounts): (JSC::Heap::endMarking): (JSC::Heap::finalize): (JSC::Heap::didAllocate): (JSC::Heap::visitCount): (JSC::Heap::bytesVisited): (JSC::Heap::forEachSlotVisitor): (JSC::Heap::performIncrement): (JSC::Heap::threadVisitCount): Deleted. (JSC::Heap::threadBytesVisited): Deleted. * heap/Heap.h: * heap/MarkStack.cpp: (JSC::MarkStackArray::transferTo): * heap/MarkStack.h: * heap/SlotVisitor.cpp: (JSC::SlotVisitor::didStartMarking): (JSC::SlotVisitor::clearMarkStacks): (JSC::SlotVisitor::appendToMarkStack): (JSC::SlotVisitor::noteLiveAuxiliaryCell): (JSC::SlotVisitor::donateKnownParallel): (JSC::SlotVisitor::drain): (JSC::SlotVisitor::performIncrementOfDraining): (JSC::SlotVisitor::didReachTermination): (JSC::SlotVisitor::hasWork): (JSC::SlotVisitor::drainFromShared): (JSC::SlotVisitor::drainInParallelPassively): (JSC::SlotVisitor::donateAll): (JSC::SlotVisitor::correspondingGlobalStack): * heap/SlotVisitor.h: * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::reportExtraMemoryVisited): (JSC::SlotVisitor::forEachMarkStack): * heap/SpaceTimeMutatorScheduler.cpp: (JSC::SpaceTimeMutatorScheduler::log): * heap/StochasticSpaceTimeMutatorScheduler.cpp: (JSC::StochasticSpaceTimeMutatorScheduler::log): * jsc.cpp: (GlobalObject::finishCreation): (functionHeapCapacity): * runtime/Options.cpp: (JSC::overrideDefaults): * runtime/Options.h: Source/WTF: We want dataLog to be locked even if you're not logging to a file! * wtf/DataLog.cpp: (WTF::initializeLogFileOnce): Canonical link: https://commits.webkit.org/184687@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211448 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-31 22:31:24 +00:00
static uint64_t s_lockedFileData[(sizeof(LockedPrintStream) + 7) / 8];
fourthTier: It should be possible to record heap operations (both FastMalloc and JSC GC) https://bugs.webkit.org/show_bug.cgi?id=116848 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. Record GC heap operations if ENABLE(ALLOCATION_LOGGING). * API/JSManagedValue.mm: * dfg/DFGOperations.cpp: * heap/Heap.cpp: (JSC::Heap::collect): * heap/Heap.h: (Heap): (JSC::Heap::allocateWithNormalDestructor): (JSC::Heap::allocateWithImmortalStructureDestructor): (JSC::Heap::allocateWithoutDestructor): (JSC::Heap::tryAllocateStorage): (JSC::Heap::tryReallocateStorage): (JSC): (JSC::Heap::ascribeOwner): * heap/SlotVisitor.cpp: (JSC::SlotVisitor::append): (JSC::SlotVisitor::internalAppend): * heap/SlotVisitor.h: (SlotVisitor): * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::append): (JSC::SlotVisitor::appendUnbarrieredPointer): (JSC::SlotVisitor::appendUnbarrieredValue): (JSC::SlotVisitor::appendUnbarrieredWeak): (JSC::SlotVisitor::internalAppend): (JSC): (JSC::SlotVisitor::appendValues): * jit/JITWriteBarrier.h: (JSC::SlotVisitor::append): * llint/LLIntCommon.h: * runtime/Butterfly.h: (Butterfly): * runtime/ButterflyInlines.h: (JSC::Butterfly::createUninitialized): (JSC::Butterfly::create): (JSC::Butterfly::growPropertyStorage): (JSC::Butterfly::createOrGrowArrayRight): (JSC): (JSC::Butterfly::growArrayRight): (JSC::Butterfly::resizeArray): * runtime/JSArray.cpp: (JSC::createArrayButterflyInDictionaryIndexingMode): (JSC::JSArray::unshiftCountSlowCase): * runtime/JSArray.h: (JSC::createContiguousArrayButterfly): (JSC::createArrayButterfly): (JSC): (JSC::JSArray::create): (JSC::JSArray::tryCreateUninitialized): * runtime/JSObject.cpp: (JSC::JSObject::enterDictionaryIndexingModeWhenArrayStorageAlreadyExists): (JSC::JSObject::createInitialIndexedStorage): (JSC::JSObject::createArrayStorage): (JSC::JSObject::constructConvertedArrayStorageWithoutCopyingElements): (JSC::JSObject::increaseVectorLength): (JSC::JSObject::ensureLengthSlow): (JSC::JSObject::growOutOfLineStorage): * runtime/JSObject.h: (JSC::JSObject::JSObject): * runtime/Operations.h: * runtime/RegExpMatchesArray.cpp: (JSC::RegExpMatchesArray::create): * runtime/StructureInlines.h: (JSC): * runtime/WriteBarrier.h: (JSC): Source/WTF: Reviewed by Mark Hahnenberg. * WTF.xcodeproj/project.pbxproj: * wtf/DataLog.cpp: (WTF): (WTF::initializeLogFileOnce): * wtf/FastMalloc.cpp: (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): * wtf/Platform.h: Canonical link: https://commits.webkit.org/136973@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153189 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:20 +00:00
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +00:00
static void initializeLogFileOnce()
{
Add ability to configure JSC options from a file https://bugs.webkit.org/show_bug.cgi?id=168914 Reviewed by Filip Pizlo. Added the ability to set options and DataLog file location via a configuration file. Source/JavaScriptCore: The configuration file is specified with the --configFile option to JSC or the JSC_configFile environment variable. The file format allows for options conditionally dependent on various attributes. Currently those attributes are the process name, parent process name and build type (Release or Debug). In this patch, the parent process type is not set. That will be set up in WebKit code with a follow up patch. Here is an example config file: logFile = "/tmp/jscLog.%pid.txt" jscOptions { dumpOptions = 2 } build == "Debug" { jscOptions { useConcurrentJIT = false dumpDisassembly = true } } build == "Release" && processName == "jsc" { jscOptions { asyncDisassembly = true } } Eliminated the prior options file code. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * jsc.cpp: (jscmain): * runtime/ConfigFile.cpp: Added. (JSC::ConfigFileScanner::ConfigFileScanner): (JSC::ConfigFileScanner::start): (JSC::ConfigFileScanner::lineNumber): (JSC::ConfigFileScanner::currentBuffer): (JSC::ConfigFileScanner::atFileEnd): (JSC::ConfigFileScanner::tryConsume): (JSC::ConfigFileScanner::tryConsumeString): (JSC::ConfigFileScanner::tryConsumeUpto): (JSC::ConfigFileScanner::fillBufferIfNeeded): (JSC::ConfigFileScanner::fillBuffer): (JSC::ConfigFile::ConfigFile): (JSC::ConfigFile::setProcessName): (JSC::ConfigFile::setParentProcessName): (JSC::ConfigFile::parse): * runtime/ConfigFile.h: Added. * runtime/Options.cpp: (JSC::Options::initialize): (JSC::Options::setOptions): * runtime/Options.h: Source/WTF: The pathname can include the printf style "%pid", which will be replaced with the current process id. * wtf/DataLog.cpp: (WTF::initializeLogFileOnce): (WTF::setDataFile): * wtf/DataLog.h: Canonical link: https://commits.webkit.org/185961@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213151 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 18:50:00 +00:00
const char* filename = nullptr;
Add ability to configure JSC options from a file https://bugs.webkit.org/show_bug.cgi?id=168914 Reviewed by Filip Pizlo. Added the ability to set options and DataLog file location via a configuration file. Source/JavaScriptCore: The configuration file is specified with the --configFile option to JSC or the JSC_configFile environment variable. The file format allows for options conditionally dependent on various attributes. Currently those attributes are the process name, parent process name and build type (Release or Debug). In this patch, the parent process type is not set. That will be set up in WebKit code with a follow up patch. Here is an example config file: logFile = "/tmp/jscLog.%pid.txt" jscOptions { dumpOptions = 2 } build == "Debug" { jscOptions { useConcurrentJIT = false dumpDisassembly = true } } build == "Release" && processName == "jsc" { jscOptions { asyncDisassembly = true } } Eliminated the prior options file code. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * jsc.cpp: (jscmain): * runtime/ConfigFile.cpp: Added. (JSC::ConfigFileScanner::ConfigFileScanner): (JSC::ConfigFileScanner::start): (JSC::ConfigFileScanner::lineNumber): (JSC::ConfigFileScanner::currentBuffer): (JSC::ConfigFileScanner::atFileEnd): (JSC::ConfigFileScanner::tryConsume): (JSC::ConfigFileScanner::tryConsumeString): (JSC::ConfigFileScanner::tryConsumeUpto): (JSC::ConfigFileScanner::fillBufferIfNeeded): (JSC::ConfigFileScanner::fillBuffer): (JSC::ConfigFile::ConfigFile): (JSC::ConfigFile::setProcessName): (JSC::ConfigFile::setParentProcessName): (JSC::ConfigFile::parse): * runtime/ConfigFile.h: Added. * runtime/Options.cpp: (JSC::Options::initialize): (JSC::Options::setOptions): * runtime/Options.h: Source/WTF: The pathname can include the printf style "%pid", which will be replaced with the current process id. * wtf/DataLog.cpp: (WTF::initializeLogFileOnce): (WTF::setDataFile): * wtf/DataLog.h: Canonical link: https://commits.webkit.org/185961@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213151 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 18:50:00 +00:00
if (s_file)
return;
Add ability to configure JSC options from a file https://bugs.webkit.org/show_bug.cgi?id=168914 Reviewed by Filip Pizlo. Added the ability to set options and DataLog file location via a configuration file. Source/JavaScriptCore: The configuration file is specified with the --configFile option to JSC or the JSC_configFile environment variable. The file format allows for options conditionally dependent on various attributes. Currently those attributes are the process name, parent process name and build type (Release or Debug). In this patch, the parent process type is not set. That will be set up in WebKit code with a follow up patch. Here is an example config file: logFile = "/tmp/jscLog.%pid.txt" jscOptions { dumpOptions = 2 } build == "Debug" { jscOptions { useConcurrentJIT = false dumpDisassembly = true } } build == "Release" && processName == "jsc" { jscOptions { asyncDisassembly = true } } Eliminated the prior options file code. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * jsc.cpp: (jscmain): * runtime/ConfigFile.cpp: Added. (JSC::ConfigFileScanner::ConfigFileScanner): (JSC::ConfigFileScanner::start): (JSC::ConfigFileScanner::lineNumber): (JSC::ConfigFileScanner::currentBuffer): (JSC::ConfigFileScanner::atFileEnd): (JSC::ConfigFileScanner::tryConsume): (JSC::ConfigFileScanner::tryConsumeString): (JSC::ConfigFileScanner::tryConsumeUpto): (JSC::ConfigFileScanner::fillBufferIfNeeded): (JSC::ConfigFileScanner::fillBuffer): (JSC::ConfigFile::ConfigFile): (JSC::ConfigFile::setProcessName): (JSC::ConfigFile::setParentProcessName): (JSC::ConfigFile::parse): * runtime/ConfigFile.h: Added. * runtime/Options.cpp: (JSC::Options::initialize): (JSC::Options::setOptions): * runtime/Options.h: Source/WTF: The pathname can include the printf style "%pid", which will be replaced with the current process id. * wtf/DataLog.cpp: (WTF::initializeLogFileOnce): (WTF::setDataFile): * wtf/DataLog.h: Canonical link: https://commits.webkit.org/185961@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213151 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 18:50:00 +00:00
#if DATA_LOG_TO_FILE
#if DATA_LOG_TO_DARWIN_TEMP_DIR
char filenameBuffer[maxPathLength + 1];
#if defined(DATA_LOG_FILENAME)
const char* logBasename = strrchr(DATA_LOG_FILENAME, '/');
if (!logBasename)
logBasename = (char*)DATA_LOG_FILENAME;
#else
const char* logBasename = "WTFLog";
#endif
bool success = confstr(_CS_DARWIN_USER_TEMP_DIR, filenameBuffer, sizeof(filenameBuffer));
if (success) {
// FIXME: Assert that the path ends with a slash instead of adding a slash if it does not exist
// once <rdar://problem/23579077> is fixed in all iOS Simulator versions that we use.
Add ability to configure JSC options from a file https://bugs.webkit.org/show_bug.cgi?id=168914 Reviewed by Filip Pizlo. Added the ability to set options and DataLog file location via a configuration file. Source/JavaScriptCore: The configuration file is specified with the --configFile option to JSC or the JSC_configFile environment variable. The file format allows for options conditionally dependent on various attributes. Currently those attributes are the process name, parent process name and build type (Release or Debug). In this patch, the parent process type is not set. That will be set up in WebKit code with a follow up patch. Here is an example config file: logFile = "/tmp/jscLog.%pid.txt" jscOptions { dumpOptions = 2 } build == "Debug" { jscOptions { useConcurrentJIT = false dumpDisassembly = true } } build == "Release" && processName == "jsc" { jscOptions { asyncDisassembly = true } } Eliminated the prior options file code. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * jsc.cpp: (jscmain): * runtime/ConfigFile.cpp: Added. (JSC::ConfigFileScanner::ConfigFileScanner): (JSC::ConfigFileScanner::start): (JSC::ConfigFileScanner::lineNumber): (JSC::ConfigFileScanner::currentBuffer): (JSC::ConfigFileScanner::atFileEnd): (JSC::ConfigFileScanner::tryConsume): (JSC::ConfigFileScanner::tryConsumeString): (JSC::ConfigFileScanner::tryConsumeUpto): (JSC::ConfigFileScanner::fillBufferIfNeeded): (JSC::ConfigFileScanner::fillBuffer): (JSC::ConfigFile::ConfigFile): (JSC::ConfigFile::setProcessName): (JSC::ConfigFile::setParentProcessName): (JSC::ConfigFile::parse): * runtime/ConfigFile.h: Added. * runtime/Options.cpp: (JSC::Options::initialize): (JSC::Options::setOptions): * runtime/Options.h: Source/WTF: The pathname can include the printf style "%pid", which will be replaced with the current process id. * wtf/DataLog.cpp: (WTF::initializeLogFileOnce): (WTF::setDataFile): * wtf/DataLog.h: Canonical link: https://commits.webkit.org/185961@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213151 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 18:50:00 +00:00
size_t lastComponentLength = strlen(logBasename) + 20; // More than enough for ".<pid>.txt"
size_t dirnameLength = strlen(filenameBuffer);
bool shouldAddPathSeparator = filenameBuffer[dirnameLength - 1] != '/' && logBasename[0] != '/';
if (lastComponentLength + shouldAddPathSeparator <= sizeof(filenameBuffer) - dirnameLength - 1) {
if (shouldAddPathSeparator)
strncat(filenameBuffer, "/", 1);
strncat(filenameBuffer, logBasename, sizeof(filenameBuffer) - strlen(filenameBuffer) - 1);
filename = filenameBuffer;
}
}
#elif defined(DATA_LOG_FILENAME)
Add ability to configure JSC options from a file https://bugs.webkit.org/show_bug.cgi?id=168914 Reviewed by Filip Pizlo. Added the ability to set options and DataLog file location via a configuration file. Source/JavaScriptCore: The configuration file is specified with the --configFile option to JSC or the JSC_configFile environment variable. The file format allows for options conditionally dependent on various attributes. Currently those attributes are the process name, parent process name and build type (Release or Debug). In this patch, the parent process type is not set. That will be set up in WebKit code with a follow up patch. Here is an example config file: logFile = "/tmp/jscLog.%pid.txt" jscOptions { dumpOptions = 2 } build == "Debug" { jscOptions { useConcurrentJIT = false dumpDisassembly = true } } build == "Release" && processName == "jsc" { jscOptions { asyncDisassembly = true } } Eliminated the prior options file code. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * jsc.cpp: (jscmain): * runtime/ConfigFile.cpp: Added. (JSC::ConfigFileScanner::ConfigFileScanner): (JSC::ConfigFileScanner::start): (JSC::ConfigFileScanner::lineNumber): (JSC::ConfigFileScanner::currentBuffer): (JSC::ConfigFileScanner::atFileEnd): (JSC::ConfigFileScanner::tryConsume): (JSC::ConfigFileScanner::tryConsumeString): (JSC::ConfigFileScanner::tryConsumeUpto): (JSC::ConfigFileScanner::fillBufferIfNeeded): (JSC::ConfigFileScanner::fillBuffer): (JSC::ConfigFile::ConfigFile): (JSC::ConfigFile::setProcessName): (JSC::ConfigFile::setParentProcessName): (JSC::ConfigFile::parse): * runtime/ConfigFile.h: Added. * runtime/Options.cpp: (JSC::Options::initialize): (JSC::Options::setOptions): * runtime/Options.h: Source/WTF: The pathname can include the printf style "%pid", which will be replaced with the current process id. * wtf/DataLog.cpp: (WTF::initializeLogFileOnce): (WTF::setDataFile): * wtf/DataLog.h: Canonical link: https://commits.webkit.org/185961@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213151 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 18:50:00 +00:00
filename = DATA_LOG_FILENAME;
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +00:00
#else
filename = getenv("WTF_DATA_LOG_FILENAME");
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +00:00
#endif
char actualFilename[maxPathLength + 1];
Add ability to configure JSC options from a file https://bugs.webkit.org/show_bug.cgi?id=168914 Reviewed by Filip Pizlo. Added the ability to set options and DataLog file location via a configuration file. Source/JavaScriptCore: The configuration file is specified with the --configFile option to JSC or the JSC_configFile environment variable. The file format allows for options conditionally dependent on various attributes. Currently those attributes are the process name, parent process name and build type (Release or Debug). In this patch, the parent process type is not set. That will be set up in WebKit code with a follow up patch. Here is an example config file: logFile = "/tmp/jscLog.%pid.txt" jscOptions { dumpOptions = 2 } build == "Debug" { jscOptions { useConcurrentJIT = false dumpDisassembly = true } } build == "Release" && processName == "jsc" { jscOptions { asyncDisassembly = true } } Eliminated the prior options file code. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * jsc.cpp: (jscmain): * runtime/ConfigFile.cpp: Added. (JSC::ConfigFileScanner::ConfigFileScanner): (JSC::ConfigFileScanner::start): (JSC::ConfigFileScanner::lineNumber): (JSC::ConfigFileScanner::currentBuffer): (JSC::ConfigFileScanner::atFileEnd): (JSC::ConfigFileScanner::tryConsume): (JSC::ConfigFileScanner::tryConsumeString): (JSC::ConfigFileScanner::tryConsumeUpto): (JSC::ConfigFileScanner::fillBufferIfNeeded): (JSC::ConfigFileScanner::fillBuffer): (JSC::ConfigFile::ConfigFile): (JSC::ConfigFile::setProcessName): (JSC::ConfigFile::setParentProcessName): (JSC::ConfigFile::parse): * runtime/ConfigFile.h: Added. * runtime/Options.cpp: (JSC::Options::initialize): (JSC::Options::setOptions): * runtime/Options.h: Source/WTF: The pathname can include the printf style "%pid", which will be replaced with the current process id. * wtf/DataLog.cpp: (WTF::initializeLogFileOnce): (WTF::setDataFile): * wtf/DataLog.h: Canonical link: https://commits.webkit.org/185961@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213151 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 18:50:00 +00:00
if (filename && !strstr(filename, "%pid")) {
snprintf(actualFilename, sizeof(actualFilename), "%s.%%pid.txt", filename);
filename = actualFilename;
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +00:00
}
Any function that can log things should be able to easily log them to a memory buffer as well https://bugs.webkit.org/show_bug.cgi?id=103000 Reviewed by Sam Weinig. Source/JavaScriptCore: Change all users of WTF::dataFile() to expect a PrintStream& rather than a FILE*. * bytecode/Operands.h: (JSC::OperandValueTraits::dump): (JSC::dumpOperands): (JSC): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::dump): * dfg/DFGAbstractState.h: (AbstractState): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::dump): * dfg/DFGCommon.h: (JSC::DFG::NodeIndexTraits::dump): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::dump): * dfg/DFGVariableEvent.cpp: (JSC::DFG::VariableEvent::dump): (JSC::DFG::VariableEvent::dumpFillInfo): (JSC::DFG::VariableEvent::dumpSpillInfo): * dfg/DFGVariableEvent.h: (VariableEvent): * disassembler/Disassembler.h: (JSC): (JSC::tryToDisassemble): * disassembler/UDis86Disassembler.cpp: (JSC::tryToDisassemble): Source/WTF: We have a number of places where we pass around a FILE* as a target to which to print some logging information. But the purpose of passing FILE* instead of always assuming that we should dump to stderr is that it may be sometimes useful to send the logging information elsewhere. Unfortunately, FILE* isn't quite powerful enough: it's combersome to use it to send logging to a string, for example. We could get around this by using <iostream> and <sstream>, but so far this aspect of C++ has not been part of the WebKit coding conventions. Personally I find <iostream> awkward due to its abuse of operator overloading. So this patch introduces the PrintStream abstract class, which offers printf-like functionality while completely abstracting the destination and mechanism of the printing output. It would be trivial to implement a StringPrintStream, for example. This will feed into work on https://bugs.webkit.org/show_bug.cgi?id=102999. This also sets us up for creating templatized print() and println() methods that will allow us to say things like out.print("count = ", count, "\n"), but that is the topic of https://bugs.webkit.org/show_bug.cgi?id=103009. This patch also changes dataLog() to use FilePrintStream internally, and WTF::dataFile() now returns a FilePrintStream&. Any previous users of WTF::dataFile() have been changed to expect a PrintStream&. * GNUmakefile.list.am: * WTF.pro: * WTF.vcproj/WTF.vcproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/DataLog.cpp: (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLogString): * wtf/DataLog.h: (WTF): * wtf/FilePrintStream.cpp: Added. (WTF): (WTF::FilePrintStream::FilePrintStream): (WTF::FilePrintStream::~FilePrintStream): (WTF::FilePrintStream::vprintf): (WTF::FilePrintStream::flush): * wtf/FilePrintStream.h: Added. (WTF): (FilePrintStream): (WTF::FilePrintStream::file): * wtf/PrintStream.cpp: Added. (WTF): (WTF::PrintStream::PrintStream): (WTF::PrintStream::~PrintStream): (WTF::PrintStream::printf): (WTF::PrintStream::print): (WTF::PrintStream::println): (WTF::PrintStream::flush): (WTF::print): * wtf/PrintStream.h: Added. (WTF): (PrintStream): (WTF::print): (WTF::println): Canonical link: https://commits.webkit.org/121301@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135640 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-11-24 03:16:47 +00:00
#endif // DATA_LOG_TO_FILE
Add ability to configure JSC options from a file https://bugs.webkit.org/show_bug.cgi?id=168914 Reviewed by Filip Pizlo. Added the ability to set options and DataLog file location via a configuration file. Source/JavaScriptCore: The configuration file is specified with the --configFile option to JSC or the JSC_configFile environment variable. The file format allows for options conditionally dependent on various attributes. Currently those attributes are the process name, parent process name and build type (Release or Debug). In this patch, the parent process type is not set. That will be set up in WebKit code with a follow up patch. Here is an example config file: logFile = "/tmp/jscLog.%pid.txt" jscOptions { dumpOptions = 2 } build == "Debug" { jscOptions { useConcurrentJIT = false dumpDisassembly = true } } build == "Release" && processName == "jsc" { jscOptions { asyncDisassembly = true } } Eliminated the prior options file code. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * jsc.cpp: (jscmain): * runtime/ConfigFile.cpp: Added. (JSC::ConfigFileScanner::ConfigFileScanner): (JSC::ConfigFileScanner::start): (JSC::ConfigFileScanner::lineNumber): (JSC::ConfigFileScanner::currentBuffer): (JSC::ConfigFileScanner::atFileEnd): (JSC::ConfigFileScanner::tryConsume): (JSC::ConfigFileScanner::tryConsumeString): (JSC::ConfigFileScanner::tryConsumeUpto): (JSC::ConfigFileScanner::fillBufferIfNeeded): (JSC::ConfigFileScanner::fillBuffer): (JSC::ConfigFile::ConfigFile): (JSC::ConfigFile::setProcessName): (JSC::ConfigFile::setParentProcessName): (JSC::ConfigFile::parse): * runtime/ConfigFile.h: Added. * runtime/Options.cpp: (JSC::Options::initialize): (JSC::Options::setOptions): * runtime/Options.h: Source/WTF: The pathname can include the printf style "%pid", which will be replaced with the current process id. * wtf/DataLog.cpp: (WTF::initializeLogFileOnce): (WTF::setDataFile): * wtf/DataLog.h: Canonical link: https://commits.webkit.org/185961@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213151 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 18:50:00 +00:00
setDataFile(filename);
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +00:00
}
static void initializeLogFile()
{
static std::once_flag once;
std::call_once(
once,
[] {
initializeLogFileOnce();
});
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +00:00
}
Add ability to configure JSC options from a file https://bugs.webkit.org/show_bug.cgi?id=168914 Reviewed by Filip Pizlo. Added the ability to set options and DataLog file location via a configuration file. Source/JavaScriptCore: The configuration file is specified with the --configFile option to JSC or the JSC_configFile environment variable. The file format allows for options conditionally dependent on various attributes. Currently those attributes are the process name, parent process name and build type (Release or Debug). In this patch, the parent process type is not set. That will be set up in WebKit code with a follow up patch. Here is an example config file: logFile = "/tmp/jscLog.%pid.txt" jscOptions { dumpOptions = 2 } build == "Debug" { jscOptions { useConcurrentJIT = false dumpDisassembly = true } } build == "Release" && processName == "jsc" { jscOptions { asyncDisassembly = true } } Eliminated the prior options file code. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * jsc.cpp: (jscmain): * runtime/ConfigFile.cpp: Added. (JSC::ConfigFileScanner::ConfigFileScanner): (JSC::ConfigFileScanner::start): (JSC::ConfigFileScanner::lineNumber): (JSC::ConfigFileScanner::currentBuffer): (JSC::ConfigFileScanner::atFileEnd): (JSC::ConfigFileScanner::tryConsume): (JSC::ConfigFileScanner::tryConsumeString): (JSC::ConfigFileScanner::tryConsumeUpto): (JSC::ConfigFileScanner::fillBufferIfNeeded): (JSC::ConfigFileScanner::fillBuffer): (JSC::ConfigFile::ConfigFile): (JSC::ConfigFile::setProcessName): (JSC::ConfigFile::setParentProcessName): (JSC::ConfigFile::parse): * runtime/ConfigFile.h: Added. * runtime/Options.cpp: (JSC::Options::initialize): (JSC::Options::setOptions): * runtime/Options.h: Source/WTF: The pathname can include the printf style "%pid", which will be replaced with the current process id. * wtf/DataLog.cpp: (WTF::initializeLogFileOnce): (WTF::setDataFile): * wtf/DataLog.h: Canonical link: https://commits.webkit.org/185961@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213151 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 18:50:00 +00:00
void setDataFile(const char* path)
{
FilePrintStream* file = nullptr;
char formattedPath[maxPathLength + 1];
const char* pathToOpen = path;
if (path) {
const char* pidFormat = strstr(path, "%pid");
if (pidFormat) {
size_t leadingPathLength = pidFormat - path;
size_t pathCharactersAvailable = std::min(maxPathLength, leadingPathLength);
strncpy(formattedPath, path, pathCharactersAvailable);
char* nextDest = formattedPath + pathCharactersAvailable;
pathCharactersAvailable = maxPathLength - pathCharactersAvailable;
if (pathCharactersAvailable) {
int pidTextLength = snprintf(nextDest, pathCharactersAvailable, "%d", getCurrentProcessID());
if (pidTextLength >= 0 && static_cast<size_t>(pidTextLength) < pathCharactersAvailable) {
Add ability to configure JSC options from a file https://bugs.webkit.org/show_bug.cgi?id=168914 Reviewed by Filip Pizlo. Added the ability to set options and DataLog file location via a configuration file. Source/JavaScriptCore: The configuration file is specified with the --configFile option to JSC or the JSC_configFile environment variable. The file format allows for options conditionally dependent on various attributes. Currently those attributes are the process name, parent process name and build type (Release or Debug). In this patch, the parent process type is not set. That will be set up in WebKit code with a follow up patch. Here is an example config file: logFile = "/tmp/jscLog.%pid.txt" jscOptions { dumpOptions = 2 } build == "Debug" { jscOptions { useConcurrentJIT = false dumpDisassembly = true } } build == "Release" && processName == "jsc" { jscOptions { asyncDisassembly = true } } Eliminated the prior options file code. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * jsc.cpp: (jscmain): * runtime/ConfigFile.cpp: Added. (JSC::ConfigFileScanner::ConfigFileScanner): (JSC::ConfigFileScanner::start): (JSC::ConfigFileScanner::lineNumber): (JSC::ConfigFileScanner::currentBuffer): (JSC::ConfigFileScanner::atFileEnd): (JSC::ConfigFileScanner::tryConsume): (JSC::ConfigFileScanner::tryConsumeString): (JSC::ConfigFileScanner::tryConsumeUpto): (JSC::ConfigFileScanner::fillBufferIfNeeded): (JSC::ConfigFileScanner::fillBuffer): (JSC::ConfigFile::ConfigFile): (JSC::ConfigFile::setProcessName): (JSC::ConfigFile::setParentProcessName): (JSC::ConfigFile::parse): * runtime/ConfigFile.h: Added. * runtime/Options.cpp: (JSC::Options::initialize): (JSC::Options::setOptions): * runtime/Options.h: Source/WTF: The pathname can include the printf style "%pid", which will be replaced with the current process id. * wtf/DataLog.cpp: (WTF::initializeLogFileOnce): (WTF::setDataFile): * wtf/DataLog.h: Canonical link: https://commits.webkit.org/185961@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213151 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 18:50:00 +00:00
pathCharactersAvailable -= static_cast<size_t>(pidTextLength);
nextDest += pidTextLength;
strncpy(nextDest, pidFormat + 4, pathCharactersAvailable);
}
}
formattedPath[maxPathLength] = '\0';
pathToOpen = formattedPath;
}
file = FilePrintStream::open(pathToOpen, "w").release();
if (file)
WTFLogAlways("*** DataLog output to \"%s\" ***\n", pathToOpen);
else
WTFLogAlways("Warning: Could not open DataLog file %s for writing.\n", pathToOpen);
}
if (!file) {
// Use placement new; this makes it easier to use dataLog() to debug
// fastMalloc.
file = new (s_fileData) FilePrintStream(stderr, FilePrintStream::Borrow);
}
[clang-tidy] Run modernize-use-nullptr over WTF https://bugs.webkit.org/show_bug.cgi?id=211628 Reviewed by Yusuke Suzuki. Use the fix option in clang-tidy to ensure nullptr is being used across WTF. * wtf/Assertions.cpp: * wtf/BumpPointerAllocator.h: (WTF::BumpPointerPool::BumpPointerPool): (WTF::BumpPointerPool::create): (WTF::BumpPointerAllocator::BumpPointerAllocator): * wtf/DataLog.cpp: (WTF::setDataFile): * wtf/DateMath.cpp: (WTF::parseES5DatePortion): (WTF::parseES5TimePortion): * wtf/FastMalloc.cpp: (WTF::fastZeroedMalloc): (WTF::fastStrDup): (WTF::tryFastZeroedMalloc): (WTF::isFastMallocEnabled): (WTF::fastMallocGoodSize): (WTF::fastAlignedMalloc): (WTF::tryFastAlignedMalloc): (WTF::fastAlignedFree): (WTF::tryFastMalloc): (WTF::fastMalloc): (WTF::tryFastCalloc): (WTF::fastCalloc): (WTF::fastFree): (WTF::fastRealloc): (WTF::tryFastRealloc): (WTF::releaseFastMallocFreeMemory): (WTF::releaseFastMallocFreeMemoryForThisThread): (WTF::fastMallocStatistics): (WTF::fastMallocSize): (WTF::fastCommitAlignedMemory): (WTF::fastDecommitAlignedMemory): (WTF::fastEnableMiniMode): (WTF::fastDisableScavenger): (WTF::fastMallocDumpMallocStats): (WTF::AvoidRecordingScope::avoidRecordingCount): (WTF::AvoidRecordingScope::AvoidRecordingScope): (WTF::AvoidRecordingScope::~AvoidRecordingScope): (WTF::MallocCallTracker::MallocSiteData::MallocSiteData): (WTF::MallocCallTracker::singleton): (WTF::MallocCallTracker::MallocCallTracker): (WTF::MallocCallTracker::recordMalloc): (WTF::MallocCallTracker::recordRealloc): (WTF::MallocCallTracker::recordFree): (WTF::MallocCallTracker::dumpStats): * wtf/HashTable.h: (WTF::KeyTraits>::inlineLookup): (WTF::KeyTraits>::lookupForWriting): (WTF::KeyTraits>::fullLookupForWriting): (WTF::KeyTraits>::add): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::findAndRemoveFreeSpace): * wtf/ParallelJobsGeneric.cpp: * wtf/RandomDevice.cpp: (WTF::RandomDevice::cryptographicallyRandomValues): * wtf/RawPointer.h: (WTF::RawPointer::RawPointer): * wtf/RedBlackTree.h: * wtf/SHA1.cpp: (WTF::SHA1::hexDigest): * wtf/SchedulePair.h: (WTF::SchedulePair::SchedulePair): * wtf/StackTrace.cpp: (WTFGetBacktrace): (WTF::StackTrace::dump const): * wtf/StringExtras.h: (strnstr): * wtf/Variant.h: * wtf/Vector.h: (WTF::VectorBufferBase::deallocateBuffer): (WTF::VectorBufferBase::releaseBuffer): (WTF::VectorBufferBase::VectorBufferBase): * wtf/cf/CFURLExtras.cpp: (WTF::createCFURLFromBuffer): (WTF::getURLBytes): * wtf/cf/CFURLExtras.h: * wtf/cf/FileSystemCF.cpp: (WTF::FileSystem::pathAsURL): * wtf/dtoa/double-conversion.cc: * wtf/dtoa/utils.h: (WTF::double_conversion::BufferReference::BufferReference): * wtf/text/CString.cpp: (WTF::CString::mutableData): * wtf/text/CString.h: * wtf/text/StringBuffer.h: (WTF::StringBuffer::release): * wtf/text/StringImpl.cpp: (WTF::StringImpl::createUninitializedInternal): (WTF::StringImpl::reallocateInternal): * wtf/text/StringImpl.h: (WTF::StringImpl::constructInternal<LChar>): (WTF::StringImpl::constructInternal<UChar>): (WTF::StringImpl::characters<LChar> const): (WTF::StringImpl::characters<UChar> const): (WTF::find): (WTF::reverseFindLineTerminator): (WTF::reverseFind): (WTF::equalIgnoringNullity): (WTF::codePointCompare): (WTF::isSpaceOrNewline): (WTF::lengthOfNullTerminatedString): (WTF::StringImplShape::StringImplShape): (WTF::StringImpl::isolatedCopy const): (WTF::StringImpl::isAllASCII const): (WTF::StringImpl::isAllLatin1 const): (WTF::isAllSpecialCharacters): (WTF::isSpecialCharacter const): (WTF::StringImpl::StringImpl): (WTF::StringImpl::create8BitIfPossible): (WTF::StringImpl::createSubstringSharingImpl): (WTF::StringImpl::createFromLiteral): (WTF::StringImpl::tryCreateUninitialized): (WTF::StringImpl::adopt): (WTF::StringImpl::cost const): (WTF::StringImpl::costDuringGC): (WTF::StringImpl::setIsAtom): (WTF::StringImpl::setHash const): (WTF::StringImpl::ref): (WTF::StringImpl::deref): (WTF::StringImpl::copyCharacters): (WTF::StringImpl::at const): (WTF::StringImpl::allocationSize): (WTF::StringImpl::maxInternalLength): (WTF::StringImpl::tailOffset): (WTF::StringImpl::requiresCopy const): (WTF::StringImpl::tailPointer const): (WTF::StringImpl::tailPointer): (WTF::StringImpl::substringBuffer const): (WTF::StringImpl::substringBuffer): (WTF::StringImpl::assertHashIsCorrect const): (WTF::StringImpl::StaticStringImpl::StaticStringImpl): (WTF::StringImpl::StaticStringImpl::operator StringImpl&): (WTF::equalIgnoringASCIICase): (WTF::startsWithLettersIgnoringASCIICase): (WTF::equalLettersIgnoringASCIICase): * wtf/text/TextBreakIterator.cpp: (WTF::initializeIterator): (WTF::setContextAwareTextForIterator): (WTF::openLineBreakIterator): * wtf/text/TextBreakIterator.h: (WTF::LazyLineBreakIterator::get): * wtf/text/WTFString.cpp: (WTF::charactersToFloat): * wtf/text/cf/StringImplCF.cpp: (WTF::StringWrapperCFAllocator::allocate): (WTF::StringWrapperCFAllocator::create): (WTF::StringImpl::createCFString): * wtf/text/icu/UTextProviderLatin1.cpp: (WTF::uTextLatin1Clone): (WTF::openLatin1ContextAwareUTextProvider): * wtf/text/icu/UTextProviderUTF16.cpp: (WTF::openUTF16ContextAwareUTextProvider): * wtf/win/FileSystemWin.cpp: (WTF::FileSystemImpl::makeAllDirectories): (WTF::FileSystemImpl::storageDirectory): (WTF::FileSystemImpl::openTemporaryFile): (WTF::FileSystemImpl::openFile): (WTF::FileSystemImpl::writeToFile): (WTF::FileSystemImpl::readFromFile): (WTF::FileSystemImpl::deleteNonEmptyDirectory): * wtf/win/LanguageWin.cpp: (WTF::localeInfo): * wtf/win/MainThreadWin.cpp: (WTF::initializeMainThreadPlatform): * wtf/win/OSAllocatorWin.cpp: (WTF::OSAllocator::reserveUncommitted): (WTF::OSAllocator::reserveAndCommit): * wtf/win/RunLoopWin.cpp: (WTF::RunLoop::run): (WTF::RunLoop::iterate): (WTF::RunLoop::RunLoop): (WTF::RunLoop::cycle): (WTF::RunLoop::TimerBase::start): * wtf/win/ThreadingWin.cpp: (WTF::Thread::establishHandle): Canonical link: https://commits.webkit.org/224543@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261393 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-08 17:31:54 +00:00
setvbuf(file->file(), nullptr, _IONBF, 0); // Prefer unbuffered output, so that we get a full log upon crash or deadlock.
Add ability to configure JSC options from a file https://bugs.webkit.org/show_bug.cgi?id=168914 Reviewed by Filip Pizlo. Added the ability to set options and DataLog file location via a configuration file. Source/JavaScriptCore: The configuration file is specified with the --configFile option to JSC or the JSC_configFile environment variable. The file format allows for options conditionally dependent on various attributes. Currently those attributes are the process name, parent process name and build type (Release or Debug). In this patch, the parent process type is not set. That will be set up in WebKit code with a follow up patch. Here is an example config file: logFile = "/tmp/jscLog.%pid.txt" jscOptions { dumpOptions = 2 } build == "Debug" { jscOptions { useConcurrentJIT = false dumpDisassembly = true } } build == "Release" && processName == "jsc" { jscOptions { asyncDisassembly = true } } Eliminated the prior options file code. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * jsc.cpp: (jscmain): * runtime/ConfigFile.cpp: Added. (JSC::ConfigFileScanner::ConfigFileScanner): (JSC::ConfigFileScanner::start): (JSC::ConfigFileScanner::lineNumber): (JSC::ConfigFileScanner::currentBuffer): (JSC::ConfigFileScanner::atFileEnd): (JSC::ConfigFileScanner::tryConsume): (JSC::ConfigFileScanner::tryConsumeString): (JSC::ConfigFileScanner::tryConsumeUpto): (JSC::ConfigFileScanner::fillBufferIfNeeded): (JSC::ConfigFileScanner::fillBuffer): (JSC::ConfigFile::ConfigFile): (JSC::ConfigFile::setProcessName): (JSC::ConfigFile::setParentProcessName): (JSC::ConfigFile::parse): * runtime/ConfigFile.h: Added. * runtime/Options.cpp: (JSC::Options::initialize): (JSC::Options::setOptions): * runtime/Options.h: Source/WTF: The pathname can include the printf style "%pid", which will be replaced with the current process id. * wtf/DataLog.cpp: (WTF::initializeLogFileOnce): (WTF::setDataFile): * wtf/DataLog.h: Canonical link: https://commits.webkit.org/185961@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213151 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 18:50:00 +00:00
if (s_file)
s_file->flush();
s_file = new (s_lockedFileData) LockedPrintStream(std::unique_ptr<FilePrintStream>(file));
}
void setDataFile(std::unique_ptr<PrintStream>&& file)
{
s_file = file.release();
}
PrintStream& dataFile()
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +00:00
{
initializeLogFile();
return *s_file;
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +00:00
}
Rename dataLog() and dataLogV() to dataLogF() and dataLogFV() https://bugs.webkit.org/show_bug.cgi?id=103001 Rubber stamped by Dan Bernstein. Source/JavaScriptCore: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * assembler/LinkBuffer.cpp: (JSC::LinkBuffer::finalizeCodeWithDisassembly): (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/LinkBuffer.h: (JSC): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecodeCommentAndNewLine): (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::dumpStructure): (JSC::dumpChain): (JSC::CodeBlock::printGetByIdCacheStatus): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::resetStubInternal): (JSC::CodeBlock::reoptimize): (JSC::ProgramCodeBlock::jettison): (JSC::EvalCodeBlock::jettison): (JSC::FunctionCodeBlock::jettison): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::initialize): (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): (JSC::DFG::AbstractState::mergeToSuccessors): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::dump): * dfg/DFGArgumentsSimplificationPhase.cpp: (JSC::DFG::ArgumentsSimplificationPhase::run): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::injectLazyOperandSpeculation): (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::getArrayModeAndEmitChecks): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::performBlockCFA): (JSC::DFG::CFAPhase::performForwardCFA): * dfg/DFGCFGSimplificationPhase.cpp: (JSC::DFG::CFGSimplificationPhase::run): (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal): (JSC::DFG::CFGSimplificationPhase::fixPhis): (JSC::DFG::CFGSimplificationPhase::fixJettisonedPredecessors): (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference): (JSC::DFG::CFGSimplificationPhase::mergeBlocks): * dfg/DFGCSEPhase.cpp: (JSC::DFG::CSEPhase::endIndexForPureCSE): (JSC::DFG::CSEPhase::setReplacement): (JSC::DFG::CSEPhase::eliminate): (JSC::DFG::CSEPhase::performNodeCSE): * dfg/DFGCapabilities.cpp: (JSC::DFG::debugFail): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::paintUnreachableCode): * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::dump): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): (JSC::DFG::FixupPhase::fixDoubleEdge): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPhase.cpp: (JSC::DFG::Phase::beginPhase): * dfg/DFGPhase.h: (JSC::DFG::runAndLog): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): (JSC::DFG::PredictionPropagationPhase::propagateForward): (JSC::DFG::PredictionPropagationPhase::propagateBackward): (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::use): (JSC::DFG::ScoreBoard::dump): * dfg/DFGSlowPathGenerator.h: (JSC::DFG::SlowPathGenerator::generate): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution): (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecutionWithConditionalDirection): (JSC::DFG::SpeculativeJIT::runSlowPathGenerators): (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): (JSC::DFG::SpeculativeJIT::checkGeneratedTypeForToInt32): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGStructureCheckHoistingPhase.cpp: (JSC::DFG::StructureCheckHoistingPhase::run): * dfg/DFGValidate.cpp: (Validate): (JSC::DFG::Validate::reportValidationContext): (JSC::DFG::Validate::dumpData): (JSC::DFG::Validate::dumpGraphIfAppropriate): * dfg/DFGVariableEventStream.cpp: (JSC::DFG::VariableEventStream::logEvent): (JSC::DFG::VariableEventStream::reconstruct): * dfg/DFGVirtualRegisterAllocationPhase.cpp: (JSC::DFG::VirtualRegisterAllocationPhase::run): * heap/Heap.cpp: * heap/HeapStatistics.cpp: (JSC::HeapStatistics::logStatistics): (JSC::HeapStatistics::showObjectStatistics): * heap/MarkStack.h: * heap/MarkedBlock.h: * heap/SlotVisitor.cpp: (JSC::SlotVisitor::validate): * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITDisassembler.cpp: (JSC::JITDisassembler::dump): (JSC::JITDisassembler::dumpForInstructions): * jit/JITStubRoutine.h: (JSC): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * jit/JumpReplacementWatchpoint.cpp: (JSC::JumpReplacementWatchpoint::fireInternal): * llint/LLIntExceptions.cpp: (JSC::LLInt::interpreterThrowInCaller): (JSC::LLInt::returnToThrow): (JSC::LLInt::callToThrow): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::llint_trace_operand): (JSC::LLInt::llint_trace_value): (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::traceFunctionPrologue): (JSC::LLInt::jitCompileAndSetHeuristics): (JSC::LLInt::entryOSR): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No change in behavior, so no new tests. * platform/KURLWTFURL.cpp: (WebCore::KURL::print): Source/WTF: * wtf/DataLog.cpp: (WTF::dataLogFV): (WTF::dataLogF): (WTF::dataLogFString): * wtf/DataLog.h: (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::dumpStats): * wtf/HashTable.h: (WTF::HashTable::Stats::dumpStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/StackStats.cpp: (WTF::StackStats::initialize): (WTF::StackStats::PerThreadStats::PerThreadStats): (WTF::StackStats::CheckPoint::CheckPoint): (WTF::StackStats::CheckPoint::~CheckPoint): (WTF::StackStats::probe): (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint): * wtf/text/WTFString.cpp: (String::show): Canonical link: https://commits.webkit.org/121130@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135469 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-11-22 04:23:36 +00:00
void dataLogFV(const char* format, va_list argList)
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +00:00
{
Any function that can log things should be able to easily log them to a memory buffer as well https://bugs.webkit.org/show_bug.cgi?id=103000 Reviewed by Sam Weinig. Source/JavaScriptCore: Change all users of WTF::dataFile() to expect a PrintStream& rather than a FILE*. * bytecode/Operands.h: (JSC::OperandValueTraits::dump): (JSC::dumpOperands): (JSC): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::dump): * dfg/DFGAbstractState.h: (AbstractState): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::dump): * dfg/DFGCommon.h: (JSC::DFG::NodeIndexTraits::dump): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::dump): * dfg/DFGVariableEvent.cpp: (JSC::DFG::VariableEvent::dump): (JSC::DFG::VariableEvent::dumpFillInfo): (JSC::DFG::VariableEvent::dumpSpillInfo): * dfg/DFGVariableEvent.h: (VariableEvent): * disassembler/Disassembler.h: (JSC): (JSC::tryToDisassemble): * disassembler/UDis86Disassembler.cpp: (JSC::tryToDisassemble): Source/WTF: We have a number of places where we pass around a FILE* as a target to which to print some logging information. But the purpose of passing FILE* instead of always assuming that we should dump to stderr is that it may be sometimes useful to send the logging information elsewhere. Unfortunately, FILE* isn't quite powerful enough: it's combersome to use it to send logging to a string, for example. We could get around this by using <iostream> and <sstream>, but so far this aspect of C++ has not been part of the WebKit coding conventions. Personally I find <iostream> awkward due to its abuse of operator overloading. So this patch introduces the PrintStream abstract class, which offers printf-like functionality while completely abstracting the destination and mechanism of the printing output. It would be trivial to implement a StringPrintStream, for example. This will feed into work on https://bugs.webkit.org/show_bug.cgi?id=102999. This also sets us up for creating templatized print() and println() methods that will allow us to say things like out.print("count = ", count, "\n"), but that is the topic of https://bugs.webkit.org/show_bug.cgi?id=103009. This patch also changes dataLog() to use FilePrintStream internally, and WTF::dataFile() now returns a FilePrintStream&. Any previous users of WTF::dataFile() have been changed to expect a PrintStream&. * GNUmakefile.list.am: * WTF.pro: * WTF.vcproj/WTF.vcproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/DataLog.cpp: (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLogString): * wtf/DataLog.h: (WTF): * wtf/FilePrintStream.cpp: Added. (WTF): (WTF::FilePrintStream::FilePrintStream): (WTF::FilePrintStream::~FilePrintStream): (WTF::FilePrintStream::vprintf): (WTF::FilePrintStream::flush): * wtf/FilePrintStream.h: Added. (WTF): (FilePrintStream): (WTF::FilePrintStream::file): * wtf/PrintStream.cpp: Added. (WTF): (WTF::PrintStream::PrintStream): (WTF::PrintStream::~PrintStream): (WTF::PrintStream::printf): (WTF::PrintStream::print): (WTF::PrintStream::println): (WTF::PrintStream::flush): (WTF::print): * wtf/PrintStream.h: Added. (WTF): (PrintStream): (WTF::print): (WTF::println): Canonical link: https://commits.webkit.org/121301@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135640 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-11-24 03:16:47 +00:00
dataFile().vprintf(format, argList);
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +00:00
}
Rename dataLog() and dataLogV() to dataLogF() and dataLogFV() https://bugs.webkit.org/show_bug.cgi?id=103001 Rubber stamped by Dan Bernstein. Source/JavaScriptCore: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * assembler/LinkBuffer.cpp: (JSC::LinkBuffer::finalizeCodeWithDisassembly): (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/LinkBuffer.h: (JSC): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecodeCommentAndNewLine): (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::dumpStructure): (JSC::dumpChain): (JSC::CodeBlock::printGetByIdCacheStatus): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::resetStubInternal): (JSC::CodeBlock::reoptimize): (JSC::ProgramCodeBlock::jettison): (JSC::EvalCodeBlock::jettison): (JSC::FunctionCodeBlock::jettison): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::initialize): (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): (JSC::DFG::AbstractState::mergeToSuccessors): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::dump): * dfg/DFGArgumentsSimplificationPhase.cpp: (JSC::DFG::ArgumentsSimplificationPhase::run): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::injectLazyOperandSpeculation): (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::getArrayModeAndEmitChecks): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::performBlockCFA): (JSC::DFG::CFAPhase::performForwardCFA): * dfg/DFGCFGSimplificationPhase.cpp: (JSC::DFG::CFGSimplificationPhase::run): (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal): (JSC::DFG::CFGSimplificationPhase::fixPhis): (JSC::DFG::CFGSimplificationPhase::fixJettisonedPredecessors): (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference): (JSC::DFG::CFGSimplificationPhase::mergeBlocks): * dfg/DFGCSEPhase.cpp: (JSC::DFG::CSEPhase::endIndexForPureCSE): (JSC::DFG::CSEPhase::setReplacement): (JSC::DFG::CSEPhase::eliminate): (JSC::DFG::CSEPhase::performNodeCSE): * dfg/DFGCapabilities.cpp: (JSC::DFG::debugFail): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::paintUnreachableCode): * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::dump): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): (JSC::DFG::FixupPhase::fixDoubleEdge): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPhase.cpp: (JSC::DFG::Phase::beginPhase): * dfg/DFGPhase.h: (JSC::DFG::runAndLog): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): (JSC::DFG::PredictionPropagationPhase::propagateForward): (JSC::DFG::PredictionPropagationPhase::propagateBackward): (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::use): (JSC::DFG::ScoreBoard::dump): * dfg/DFGSlowPathGenerator.h: (JSC::DFG::SlowPathGenerator::generate): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution): (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecutionWithConditionalDirection): (JSC::DFG::SpeculativeJIT::runSlowPathGenerators): (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): (JSC::DFG::SpeculativeJIT::checkGeneratedTypeForToInt32): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGStructureCheckHoistingPhase.cpp: (JSC::DFG::StructureCheckHoistingPhase::run): * dfg/DFGValidate.cpp: (Validate): (JSC::DFG::Validate::reportValidationContext): (JSC::DFG::Validate::dumpData): (JSC::DFG::Validate::dumpGraphIfAppropriate): * dfg/DFGVariableEventStream.cpp: (JSC::DFG::VariableEventStream::logEvent): (JSC::DFG::VariableEventStream::reconstruct): * dfg/DFGVirtualRegisterAllocationPhase.cpp: (JSC::DFG::VirtualRegisterAllocationPhase::run): * heap/Heap.cpp: * heap/HeapStatistics.cpp: (JSC::HeapStatistics::logStatistics): (JSC::HeapStatistics::showObjectStatistics): * heap/MarkStack.h: * heap/MarkedBlock.h: * heap/SlotVisitor.cpp: (JSC::SlotVisitor::validate): * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITDisassembler.cpp: (JSC::JITDisassembler::dump): (JSC::JITDisassembler::dumpForInstructions): * jit/JITStubRoutine.h: (JSC): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * jit/JumpReplacementWatchpoint.cpp: (JSC::JumpReplacementWatchpoint::fireInternal): * llint/LLIntExceptions.cpp: (JSC::LLInt::interpreterThrowInCaller): (JSC::LLInt::returnToThrow): (JSC::LLInt::callToThrow): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::llint_trace_operand): (JSC::LLInt::llint_trace_value): (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::traceFunctionPrologue): (JSC::LLInt::jitCompileAndSetHeuristics): (JSC::LLInt::entryOSR): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No change in behavior, so no new tests. * platform/KURLWTFURL.cpp: (WebCore::KURL::print): Source/WTF: * wtf/DataLog.cpp: (WTF::dataLogFV): (WTF::dataLogF): (WTF::dataLogFString): * wtf/DataLog.h: (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::dumpStats): * wtf/HashTable.h: (WTF::HashTable::Stats::dumpStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/StackStats.cpp: (WTF::StackStats::initialize): (WTF::StackStats::PerThreadStats::PerThreadStats): (WTF::StackStats::CheckPoint::CheckPoint): (WTF::StackStats::CheckPoint::~CheckPoint): (WTF::StackStats::probe): (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint): * wtf/text/WTFString.cpp: (String::show): Canonical link: https://commits.webkit.org/121130@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135469 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-11-22 04:23:36 +00:00
void dataLogF(const char* format, ...)
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +00:00
{
va_list argList;
va_start(argList, format);
Rename dataLog() and dataLogV() to dataLogF() and dataLogFV() https://bugs.webkit.org/show_bug.cgi?id=103001 Rubber stamped by Dan Bernstein. Source/JavaScriptCore: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * assembler/LinkBuffer.cpp: (JSC::LinkBuffer::finalizeCodeWithDisassembly): (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/LinkBuffer.h: (JSC): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecodeCommentAndNewLine): (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::dumpStructure): (JSC::dumpChain): (JSC::CodeBlock::printGetByIdCacheStatus): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::resetStubInternal): (JSC::CodeBlock::reoptimize): (JSC::ProgramCodeBlock::jettison): (JSC::EvalCodeBlock::jettison): (JSC::FunctionCodeBlock::jettison): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::initialize): (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): (JSC::DFG::AbstractState::mergeToSuccessors): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::dump): * dfg/DFGArgumentsSimplificationPhase.cpp: (JSC::DFG::ArgumentsSimplificationPhase::run): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::injectLazyOperandSpeculation): (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::getArrayModeAndEmitChecks): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::performBlockCFA): (JSC::DFG::CFAPhase::performForwardCFA): * dfg/DFGCFGSimplificationPhase.cpp: (JSC::DFG::CFGSimplificationPhase::run): (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal): (JSC::DFG::CFGSimplificationPhase::fixPhis): (JSC::DFG::CFGSimplificationPhase::fixJettisonedPredecessors): (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference): (JSC::DFG::CFGSimplificationPhase::mergeBlocks): * dfg/DFGCSEPhase.cpp: (JSC::DFG::CSEPhase::endIndexForPureCSE): (JSC::DFG::CSEPhase::setReplacement): (JSC::DFG::CSEPhase::eliminate): (JSC::DFG::CSEPhase::performNodeCSE): * dfg/DFGCapabilities.cpp: (JSC::DFG::debugFail): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::paintUnreachableCode): * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::dump): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): (JSC::DFG::FixupPhase::fixDoubleEdge): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPhase.cpp: (JSC::DFG::Phase::beginPhase): * dfg/DFGPhase.h: (JSC::DFG::runAndLog): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): (JSC::DFG::PredictionPropagationPhase::propagateForward): (JSC::DFG::PredictionPropagationPhase::propagateBackward): (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::use): (JSC::DFG::ScoreBoard::dump): * dfg/DFGSlowPathGenerator.h: (JSC::DFG::SlowPathGenerator::generate): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution): (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecutionWithConditionalDirection): (JSC::DFG::SpeculativeJIT::runSlowPathGenerators): (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): (JSC::DFG::SpeculativeJIT::checkGeneratedTypeForToInt32): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGStructureCheckHoistingPhase.cpp: (JSC::DFG::StructureCheckHoistingPhase::run): * dfg/DFGValidate.cpp: (Validate): (JSC::DFG::Validate::reportValidationContext): (JSC::DFG::Validate::dumpData): (JSC::DFG::Validate::dumpGraphIfAppropriate): * dfg/DFGVariableEventStream.cpp: (JSC::DFG::VariableEventStream::logEvent): (JSC::DFG::VariableEventStream::reconstruct): * dfg/DFGVirtualRegisterAllocationPhase.cpp: (JSC::DFG::VirtualRegisterAllocationPhase::run): * heap/Heap.cpp: * heap/HeapStatistics.cpp: (JSC::HeapStatistics::logStatistics): (JSC::HeapStatistics::showObjectStatistics): * heap/MarkStack.h: * heap/MarkedBlock.h: * heap/SlotVisitor.cpp: (JSC::SlotVisitor::validate): * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITDisassembler.cpp: (JSC::JITDisassembler::dump): (JSC::JITDisassembler::dumpForInstructions): * jit/JITStubRoutine.h: (JSC): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * jit/JumpReplacementWatchpoint.cpp: (JSC::JumpReplacementWatchpoint::fireInternal): * llint/LLIntExceptions.cpp: (JSC::LLInt::interpreterThrowInCaller): (JSC::LLInt::returnToThrow): (JSC::LLInt::callToThrow): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::llint_trace_operand): (JSC::LLInt::llint_trace_value): (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::traceFunctionPrologue): (JSC::LLInt::jitCompileAndSetHeuristics): (JSC::LLInt::entryOSR): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No change in behavior, so no new tests. * platform/KURLWTFURL.cpp: (WebCore::KURL::print): Source/WTF: * wtf/DataLog.cpp: (WTF::dataLogFV): (WTF::dataLogF): (WTF::dataLogFString): * wtf/DataLog.h: (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::dumpStats): * wtf/HashTable.h: (WTF::HashTable::Stats::dumpStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/StackStats.cpp: (WTF::StackStats::initialize): (WTF::StackStats::PerThreadStats::PerThreadStats): (WTF::StackStats::CheckPoint::CheckPoint): (WTF::StackStats::CheckPoint::~CheckPoint): (WTF::StackStats::probe): (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint): * wtf/text/WTFString.cpp: (String::show): Canonical link: https://commits.webkit.org/121130@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135469 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-11-22 04:23:36 +00:00
dataLogFV(format, argList);
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +00:00
va_end(argList);
}
Rename dataLog() and dataLogV() to dataLogF() and dataLogFV() https://bugs.webkit.org/show_bug.cgi?id=103001 Rubber stamped by Dan Bernstein. Source/JavaScriptCore: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * assembler/LinkBuffer.cpp: (JSC::LinkBuffer::finalizeCodeWithDisassembly): (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/LinkBuffer.h: (JSC): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecodeCommentAndNewLine): (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::dumpStructure): (JSC::dumpChain): (JSC::CodeBlock::printGetByIdCacheStatus): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::resetStubInternal): (JSC::CodeBlock::reoptimize): (JSC::ProgramCodeBlock::jettison): (JSC::EvalCodeBlock::jettison): (JSC::FunctionCodeBlock::jettison): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::initialize): (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): (JSC::DFG::AbstractState::mergeToSuccessors): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::dump): * dfg/DFGArgumentsSimplificationPhase.cpp: (JSC::DFG::ArgumentsSimplificationPhase::run): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::injectLazyOperandSpeculation): (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::getArrayModeAndEmitChecks): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::performBlockCFA): (JSC::DFG::CFAPhase::performForwardCFA): * dfg/DFGCFGSimplificationPhase.cpp: (JSC::DFG::CFGSimplificationPhase::run): (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal): (JSC::DFG::CFGSimplificationPhase::fixPhis): (JSC::DFG::CFGSimplificationPhase::fixJettisonedPredecessors): (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference): (JSC::DFG::CFGSimplificationPhase::mergeBlocks): * dfg/DFGCSEPhase.cpp: (JSC::DFG::CSEPhase::endIndexForPureCSE): (JSC::DFG::CSEPhase::setReplacement): (JSC::DFG::CSEPhase::eliminate): (JSC::DFG::CSEPhase::performNodeCSE): * dfg/DFGCapabilities.cpp: (JSC::DFG::debugFail): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::paintUnreachableCode): * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::dump): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): (JSC::DFG::FixupPhase::fixDoubleEdge): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPhase.cpp: (JSC::DFG::Phase::beginPhase): * dfg/DFGPhase.h: (JSC::DFG::runAndLog): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): (JSC::DFG::PredictionPropagationPhase::propagateForward): (JSC::DFG::PredictionPropagationPhase::propagateBackward): (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::use): (JSC::DFG::ScoreBoard::dump): * dfg/DFGSlowPathGenerator.h: (JSC::DFG::SlowPathGenerator::generate): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution): (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecutionWithConditionalDirection): (JSC::DFG::SpeculativeJIT::runSlowPathGenerators): (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): (JSC::DFG::SpeculativeJIT::checkGeneratedTypeForToInt32): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGStructureCheckHoistingPhase.cpp: (JSC::DFG::StructureCheckHoistingPhase::run): * dfg/DFGValidate.cpp: (Validate): (JSC::DFG::Validate::reportValidationContext): (JSC::DFG::Validate::dumpData): (JSC::DFG::Validate::dumpGraphIfAppropriate): * dfg/DFGVariableEventStream.cpp: (JSC::DFG::VariableEventStream::logEvent): (JSC::DFG::VariableEventStream::reconstruct): * dfg/DFGVirtualRegisterAllocationPhase.cpp: (JSC::DFG::VirtualRegisterAllocationPhase::run): * heap/Heap.cpp: * heap/HeapStatistics.cpp: (JSC::HeapStatistics::logStatistics): (JSC::HeapStatistics::showObjectStatistics): * heap/MarkStack.h: * heap/MarkedBlock.h: * heap/SlotVisitor.cpp: (JSC::SlotVisitor::validate): * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITDisassembler.cpp: (JSC::JITDisassembler::dump): (JSC::JITDisassembler::dumpForInstructions): * jit/JITStubRoutine.h: (JSC): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * jit/JumpReplacementWatchpoint.cpp: (JSC::JumpReplacementWatchpoint::fireInternal): * llint/LLIntExceptions.cpp: (JSC::LLInt::interpreterThrowInCaller): (JSC::LLInt::returnToThrow): (JSC::LLInt::callToThrow): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::llint_trace_operand): (JSC::LLInt::llint_trace_value): (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::traceFunctionPrologue): (JSC::LLInt::jitCompileAndSetHeuristics): (JSC::LLInt::entryOSR): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No change in behavior, so no new tests. * platform/KURLWTFURL.cpp: (WebCore::KURL::print): Source/WTF: * wtf/DataLog.cpp: (WTF::dataLogFV): (WTF::dataLogF): (WTF::dataLogFString): * wtf/DataLog.h: (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::dumpStats): * wtf/HashTable.h: (WTF::HashTable::Stats::dumpStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/StackStats.cpp: (WTF::StackStats::initialize): (WTF::StackStats::PerThreadStats::PerThreadStats): (WTF::StackStats::CheckPoint::CheckPoint): (WTF::StackStats::CheckPoint::~CheckPoint): (WTF::StackStats::probe): (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint): * wtf/text/WTFString.cpp: (String::show): Canonical link: https://commits.webkit.org/121130@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135469 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-11-22 04:23:36 +00:00
void dataLogFString(const char* str)
ENH: Add Logging to GC Marking Phase https://bugs.webkit.org/show_bug.cgi?id=88364 Reviewed by Filip Pizlo. Source/JavaScriptCore: Log GC marking to stderr or a file. The logging in controlled with the define ENABLE_OBJECT_MARK_LOGGING in wtf/Platform.h. If DATA_LOG_TO_FILE in wtf/DataLog.cpp is set to 1, output is logged to a file otherwise it is logged to stderr. When logging is enabled, the GC is built single threaded since the log output from the various threads isn't buffered and output in a thread safe manner. * heap/Heap.cpp: (JSC::Heap::markRoots): * heap/MarkStack.cpp: (JSC::MarkStackThreadSharedData::resetChildren): (JSC::MarkStackThreadSharedData::childVisitCount): (JSC::MarkStackThreadSharedData::markingThreadMain): (JSC::MarkStackThreadSharedData::markingThreadStartFunc): (JSC::MarkStackThreadSharedData::MarkStackThreadSharedData): (JSC::MarkStackThreadSharedData::reset): * heap/MarkStack.h: (MarkStackThreadSharedData): (MarkStack): (JSC::MarkStack::sharedData): (JSC::MarkStack::resetChildCount): (JSC::MarkStack::childCount): (JSC::MarkStack::incrementChildCount): * runtime/JSArray.cpp: (JSC::JSArray::visitChildren): * runtime/JSCell.cpp: (JSC::JSCell::className): * runtime/JSCell.h: (JSCell): (JSC::JSCell::visitChildren): * runtime/JSString.cpp: (JSC::JSString::visitChildren): * runtime/JSString.h: (JSString): * runtime/Structure.h: (JSC::MarkStack::internalAppend): Source/WTF: * wtf/DataLog.cpp: (WTF::dataLogString): Additional method to support GC Mark logging. * wtf/DataLog.h: * wtf/Platform.h: New ENABLE_OBJECT_MARK_LOGGING flag macro. Canonical link: https://commits.webkit.org/106281@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119633 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-06-06 23:11:09 +00:00
{
Any function that can log things should be able to easily log them to a memory buffer as well https://bugs.webkit.org/show_bug.cgi?id=103000 Reviewed by Sam Weinig. Source/JavaScriptCore: Change all users of WTF::dataFile() to expect a PrintStream& rather than a FILE*. * bytecode/Operands.h: (JSC::OperandValueTraits::dump): (JSC::dumpOperands): (JSC): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::dump): * dfg/DFGAbstractState.h: (AbstractState): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::dump): * dfg/DFGCommon.h: (JSC::DFG::NodeIndexTraits::dump): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::dump): * dfg/DFGVariableEvent.cpp: (JSC::DFG::VariableEvent::dump): (JSC::DFG::VariableEvent::dumpFillInfo): (JSC::DFG::VariableEvent::dumpSpillInfo): * dfg/DFGVariableEvent.h: (VariableEvent): * disassembler/Disassembler.h: (JSC): (JSC::tryToDisassemble): * disassembler/UDis86Disassembler.cpp: (JSC::tryToDisassemble): Source/WTF: We have a number of places where we pass around a FILE* as a target to which to print some logging information. But the purpose of passing FILE* instead of always assuming that we should dump to stderr is that it may be sometimes useful to send the logging information elsewhere. Unfortunately, FILE* isn't quite powerful enough: it's combersome to use it to send logging to a string, for example. We could get around this by using <iostream> and <sstream>, but so far this aspect of C++ has not been part of the WebKit coding conventions. Personally I find <iostream> awkward due to its abuse of operator overloading. So this patch introduces the PrintStream abstract class, which offers printf-like functionality while completely abstracting the destination and mechanism of the printing output. It would be trivial to implement a StringPrintStream, for example. This will feed into work on https://bugs.webkit.org/show_bug.cgi?id=102999. This also sets us up for creating templatized print() and println() methods that will allow us to say things like out.print("count = ", count, "\n"), but that is the topic of https://bugs.webkit.org/show_bug.cgi?id=103009. This patch also changes dataLog() to use FilePrintStream internally, and WTF::dataFile() now returns a FilePrintStream&. Any previous users of WTF::dataFile() have been changed to expect a PrintStream&. * GNUmakefile.list.am: * WTF.pro: * WTF.vcproj/WTF.vcproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/DataLog.cpp: (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLogString): * wtf/DataLog.h: (WTF): * wtf/FilePrintStream.cpp: Added. (WTF): (WTF::FilePrintStream::FilePrintStream): (WTF::FilePrintStream::~FilePrintStream): (WTF::FilePrintStream::vprintf): (WTF::FilePrintStream::flush): * wtf/FilePrintStream.h: Added. (WTF): (FilePrintStream): (WTF::FilePrintStream::file): * wtf/PrintStream.cpp: Added. (WTF): (WTF::PrintStream::PrintStream): (WTF::PrintStream::~PrintStream): (WTF::PrintStream::printf): (WTF::PrintStream::print): (WTF::PrintStream::println): (WTF::PrintStream::flush): (WTF::print): * wtf/PrintStream.h: Added. (WTF): (PrintStream): (WTF::print): (WTF::println): Canonical link: https://commits.webkit.org/121301@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135640 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-11-24 03:16:47 +00:00
dataFile().printf("%s", str);
ENH: Add Logging to GC Marking Phase https://bugs.webkit.org/show_bug.cgi?id=88364 Reviewed by Filip Pizlo. Source/JavaScriptCore: Log GC marking to stderr or a file. The logging in controlled with the define ENABLE_OBJECT_MARK_LOGGING in wtf/Platform.h. If DATA_LOG_TO_FILE in wtf/DataLog.cpp is set to 1, output is logged to a file otherwise it is logged to stderr. When logging is enabled, the GC is built single threaded since the log output from the various threads isn't buffered and output in a thread safe manner. * heap/Heap.cpp: (JSC::Heap::markRoots): * heap/MarkStack.cpp: (JSC::MarkStackThreadSharedData::resetChildren): (JSC::MarkStackThreadSharedData::childVisitCount): (JSC::MarkStackThreadSharedData::markingThreadMain): (JSC::MarkStackThreadSharedData::markingThreadStartFunc): (JSC::MarkStackThreadSharedData::MarkStackThreadSharedData): (JSC::MarkStackThreadSharedData::reset): * heap/MarkStack.h: (MarkStackThreadSharedData): (MarkStack): (JSC::MarkStack::sharedData): (JSC::MarkStack::resetChildCount): (JSC::MarkStack::childCount): (JSC::MarkStack::incrementChildCount): * runtime/JSArray.cpp: (JSC::JSArray::visitChildren): * runtime/JSCell.cpp: (JSC::JSCell::className): * runtime/JSCell.h: (JSCell): (JSC::JSCell::visitChildren): * runtime/JSString.cpp: (JSC::JSString::visitChildren): * runtime/JSString.h: (JSString): * runtime/Structure.h: (JSC::MarkStack::internalAppend): Source/WTF: * wtf/DataLog.cpp: (WTF::dataLogString): Additional method to support GC Mark logging. * wtf/DataLog.h: * wtf/Platform.h: New ENABLE_OBJECT_MARK_LOGGING flag macro. Canonical link: https://commits.webkit.org/106281@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119633 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-06-06 23:11:09 +00:00
}
It should be possible to send all JSC debug logging to a file https://bugs.webkit.org/show_bug.cgi?id=78418 Reviewed by Sam Weinig. Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog, and WTF::dataLogV. Changed all debugging- and profiling-related printfs to use WTF::dataLog() or one of its friends. By default, debug logging goes to stderr, unless you change the setting in wtf/DataLog.cpp. Source/JavaScriptCore: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/LinkBuffer.h: (JSC::LinkBuffer::dumpLinkStatistics): (JSC::LinkBuffer::dumpCode): * assembler/SH4Assembler.h: (JSC::SH4Assembler::vprintfStdoutInstr): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::printUnaryOp): (JSC::CodeBlock::printBinaryOp): (JSC::CodeBlock::printConditionalJump): (JSC::CodeBlock::printGetByIdOp): (JSC::CodeBlock::printCallOp): (JSC::CodeBlock::printPutByIdOp): (JSC::printGlobalResolveInfo): (JSC::printStructureStubInfo): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::dumpStatistics): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::shouldOptimizeNow): (JSC::CodeBlock::tallyFrequentExitSites): (JSC::CodeBlock::dumpValueProfiles): * bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats): * bytecode/SamplingTool.cpp: (JSC::SamplingFlags::stop): (JSC::SamplingRegion::dumpInternal): (JSC::SamplingTool::dump): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::processPhiStack): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommon.h: * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::printWhiteSpace): (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::predictArgumentTypes): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPropagator.cpp: (JSC::DFG::Propagator::fixpoint): (JSC::DFG::Propagator::propagateArithNodeFlags): (JSC::DFG::Propagator::propagateArithNodeFlagsForward): (JSC::DFG::Propagator::propagateArithNodeFlagsBackward): (JSC::DFG::Propagator::propagateNodePredictions): (JSC::DFG::Propagator::propagatePredictionsForward): (JSC::DFG::Propagator::propagatePredictionsBackward): (JSC::DFG::Propagator::doRoundOfDoubleVoting): (JSC::DFG::Propagator::fixupNode): (JSC::DFG::Propagator::fixup): (JSC::DFG::Propagator::startIndexForChildren): (JSC::DFG::Propagator::endIndexForPureCSE): (JSC::DFG::Propagator::setReplacement): (JSC::DFG::Propagator::eliminate): (JSC::DFG::Propagator::performNodeCSE): (JSC::DFG::Propagator::localCSE): (JSC::DFG::Propagator::allocateVirtualRegisters): (JSC::DFG::Propagator::performBlockCFA): (JSC::DFG::Propagator::performForwardCFA): * dfg/DFGRegisterBank.h: (JSC::DFG::RegisterBank::dump): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::dump): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::dump): (JSC::DFG::SpeculativeJIT::checkConsistency): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): * heap/Heap.cpp: (JSC::Heap::destroy): * heap/MarkedBlock.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::dumpCaller): * interpreter/Interpreter.cpp: (JSC::Interpreter::dumpRegisters): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): * profiler/Profile.cpp: (JSC::Profile::debugPrintData): (JSC::Profile::debugPrintDataSampleStyle): * profiler/ProfileNode.cpp: (JSC::ProfileNode::debugPrintData): (JSC::ProfileNode::debugPrintDataSampleStyle): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::dumpRegExpTrace): * runtime/RegExp.cpp: (JSC::RegExp::matchCompareWithInterpreter): * runtime/SamplingCounter.cpp: (JSC::AbstractSamplingCounter::dump): * runtime/SamplingCounter.h: (JSC::DeletableSamplingCounter::~DeletableSamplingCounter): * runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger): * tools/CodeProfile.cpp: (JSC::CodeProfile::report): * tools/ProfileTreeNode.h: (JSC::ProfileTreeNode::dumpInternal): * wtf/CMakeLists.txt: * wtf/DataLog.cpp: Added. (WTF): (WTF::initializeLogFileOnce): (WTF::initializeLogFile): (WTF::dataFile): (WTF::dataLogV): (WTF::dataLog): * wtf/DataLog.h: Added. (WTF): * wtf/HashTable.cpp: (WTF::HashTableStats::~HashTableStats): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::dumpProfile): * wtf/text/WTFString.cpp: (String::show): * yarr/YarrInterpreter.cpp: (JSC::Yarr::ByteCompiler::dumpDisjunction): Source/WebCore: No new tests because behavior is unchanged. * ForwardingHeaders/wtf/DataLog.h: Added. Source/WTF: * WTF.pro: Canonical link: https://commits.webkit.org/95361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-02-12 03:21:32 +00:00
} // namespace WTF