Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (290289 => 290290)
--- trunk/Source/_javascript_Core/ChangeLog 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/_javascript_Core/ChangeLog 2022-02-22 06:53:58 UTC (rev 290290)
@@ -1,3 +1,57 @@
+2022-02-21 Robin Morisset <rmoris...@apple.com>
+
+ [JSC] Format the output of --reportTotalPhaseTimes=1 more nicely
+ https://bugs.webkit.org/show_bug.cgi?id=237005
+
+ Reviewed by Saam Barati.
+
+ Before this patch:
+ [B3] moveConstants total ms: 64.307583 max ms: 1.703167
+ [B3] lowerToAir total ms: 151.297782 max ms: 5.426375
+ [B3] generateToAir total ms: 1623.987166 max ms: 92.826750
+ [B3] simplifyCFG total ms: 11.760463 max ms: 1.088083
+ [B3] Air::lowerMacros total ms: 5.975679 max ms: 0.382000
+
+ After this patch:
+ total ms: 66.328 max ms: 2.283 [B3] moveConstants
+ total ms: 148.097 max ms: 5.361 [B3] lowerToAir
+ total ms: 1619.115 max ms: 96.307 [Total B3] generateToAir
+ total ms: 11.959 max ms: 1.185 [Air] simplifyCFG
+ total ms: 6.519 max ms: 0.697 [Air] Air::lowerMacros
+
+ Concretely there are two changes:
+ - use FixedWidthDouble (also introduced to WTF in this patch) to line-up the total times.
+ This makes it possible to see at a glance which phases are worth optimizing and which aren't.
+ - Tag phases more precisely, and in particular replace [B3] by [Air] where relevant,
+ and give different tags to measurements that correspond to groups of phases instead of a single phase (e.g. generateToAir).
+
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ * b3/B3Compile.cpp:
+ (JSC::B3::compile):
+ * b3/B3FixSSA.cpp:
+ * b3/B3Generate.cpp:
+ (JSC::B3::prepareForGeneration):
+ (JSC::B3::generateToAir):
+ * b3/B3PhaseScope.cpp:
+ (JSC::B3::PhaseScope::PhaseScope):
+ * b3/B3PhaseScope.h:
+ * b3/B3TimingScope.h: Removed.
+ (JSC::B3::TimingScope::TimingScope): Deleted.
+ * b3/B3VariableLiveness.cpp:
+ (JSC::B3::VariableLiveness::VariableLiveness):
+ * b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp:
+ (JSC::B3::Air::GenerateAndAllocateRegisters::generate):
+ * b3/air/AirAllocateRegistersAndStackByLinearScan.cpp:
+ * b3/air/AirGenerate.cpp:
+ (JSC::B3::Air::prepareForGeneration):
+ (JSC::B3::Air::generateWithAlreadyAllocatedRegisters):
+ * b3/air/AirLiveness.h:
+ (JSC::B3::Air::Liveness::Liveness):
+ * b3/air/AirPhaseScope.cpp:
+ (JSC::B3::Air::PhaseScope::PhaseScope):
+ * b3/air/AirPhaseScope.h:
+ * tools/CompilerTimingScope.cpp:
+
2022-02-21 Yusuke Suzuki <ysuz...@apple.com>
[JSC] Fix ShadowRealm unwinding
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (290289 => 290290)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2022-02-22 06:53:58 UTC (rev 290290)
@@ -324,7 +324,6 @@
0F44A7B420BF68D90022B171 /* TerminatedCodeOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F44A7A820BF685E0022B171 /* TerminatedCodeOrigin.h */; };
0F4570391BE44C910062A629 /* AirEliminateDeadCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4570371BE44C910062A629 /* AirEliminateDeadCode.h */; };
0F45703D1BE45F0A0062A629 /* AirReportUsedRegisters.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F45703B1BE45F0A0062A629 /* AirReportUsedRegisters.h */; };
- 0F4570411BE584CA0062A629 /* B3TimingScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F45703F1BE584CA0062A629 /* B3TimingScope.h */; };
0F46808214BA572D00BFE272 /* JITExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F46808014BA572700BFE272 /* JITExceptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F4680A314BA7F8D00BFE272 /* LLIntExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F46809E14BA7F8200BFE272 /* LLIntExceptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F4680A514BA7F8D00BFE272 /* LLIntSlowPaths.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4680A014BA7F8200BFE272 /* LLIntSlowPaths.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2766,7 +2765,6 @@
0F4570371BE44C910062A629 /* AirEliminateDeadCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AirEliminateDeadCode.h; path = b3/air/AirEliminateDeadCode.h; sourceTree = "<group>"; };
0F45703A1BE45F0A0062A629 /* AirReportUsedRegisters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AirReportUsedRegisters.cpp; path = b3/air/AirReportUsedRegisters.cpp; sourceTree = "<group>"; };
0F45703B1BE45F0A0062A629 /* AirReportUsedRegisters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AirReportUsedRegisters.h; path = b3/air/AirReportUsedRegisters.h; sourceTree = "<group>"; };
- 0F45703F1BE584CA0062A629 /* B3TimingScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3TimingScope.h; path = b3/B3TimingScope.h; sourceTree = "<group>"; };
0F46807F14BA572700BFE272 /* JITExceptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITExceptions.cpp; sourceTree = "<group>"; };
0F46808014BA572700BFE272 /* JITExceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITExceptions.h; sourceTree = "<group>"; };
0F46809D14BA7F8200BFE272 /* LLIntExceptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LLIntExceptions.cpp; path = llint/LLIntExceptions.cpp; sourceTree = "<group>"; };
@@ -6235,7 +6233,6 @@
0FEC84EE1BDACDAC0080FF74 /* B3SwitchCase.h */,
0FEC84EF1BDACDAC0080FF74 /* B3SwitchValue.cpp */,
0FEC84F01BDACDAC0080FF74 /* B3SwitchValue.h */,
- 0F45703F1BE584CA0062A629 /* B3TimingScope.h */,
0FEC84F11BDACDAC0080FF74 /* B3Type.cpp */,
0FEC84F21BDACDAC0080FF74 /* B3Type.h */,
DCFDFBD81D1F5D9800FE3D72 /* B3TypeMap.h */,
@@ -9826,7 +9823,6 @@
0FEC85361BDACDAC0080FF74 /* B3SuccessorCollection.h in Headers */,
0FEC85381BDACDAC0080FF74 /* B3SwitchCase.h in Headers */,
0FEC853A1BDACDAC0080FF74 /* B3SwitchValue.h in Headers */,
- 0F4570411BE584CA0062A629 /* B3TimingScope.h in Headers */,
0FEC853C1BDACDAC0080FF74 /* B3Type.h in Headers */,
DCFDFBDA1D1F5D9E00FE3D72 /* B3TypeMap.h in Headers */,
0FEC853E1BDACDAC0080FF74 /* B3UpsilonValue.h in Headers */,
Modified: trunk/Source/_javascript_Core/b3/B3Compile.cpp (290289 => 290290)
--- trunk/Source/_javascript_Core/b3/B3Compile.cpp 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/_javascript_Core/b3/B3Compile.cpp 2022-02-22 06:53:58 UTC (rev 290290)
@@ -30,8 +30,8 @@
#include "B3Generate.h"
#include "B3Procedure.h"
-#include "B3TimingScope.h"
#include "CCallHelpers.h"
+#include "CompilerTimingScope.h"
#include "LinkBuffer.h"
namespace JSC { namespace B3 {
@@ -38,7 +38,7 @@
Compilation compile(Procedure& proc)
{
- TimingScope timingScope("Compilation");
+ CompilerTimingScope timingScope("Total B3+Air", "compile");
prepareForGeneration(proc);
Modified: trunk/Source/_javascript_Core/b3/B3FixSSA.cpp (290289 => 290290)
--- trunk/Source/_javascript_Core/b3/B3FixSSA.cpp 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/_javascript_Core/b3/B3FixSSA.cpp 2022-02-22 06:53:58 UTC (rev 290290)
@@ -38,6 +38,7 @@
#include "B3Variable.h"
#include "B3VariableLiveness.h"
#include "B3VariableValue.h"
+#include "CompilerTimingScope.h"
#include <wtf/CommaPrinter.h>
#include <wtf/IndexSet.h>
#include <wtf/IndexSparseSet.h>
@@ -149,7 +150,7 @@
// Decide where Phis are to be inserted. This creates them but does not insert them.
{
- TimingScope timingScope("fixSSA: computePhis");
+ CompilerTimingScope timingScope("B3", "fixSSA: computePhis");
ssa.computePhis(
[&] (SSACalculator::Variable* calcVar, BasicBlock* block) -> Value* {
Variable* variable = calcVarToVariable[calcVar->index()];
@@ -167,7 +168,7 @@
}
// Now perform the conversion.
- TimingScope timingScope("fixSSA: convert");
+ CompilerTimingScope timingScope("B3", "fixSSA: convert");
InsertionSet insertionSet(proc);
IndexSparseSet<KeyValuePair<unsigned, Value*>> mapping(proc.variables().size());
IndexSet<Value*> valuesToDelete;
Modified: trunk/Source/_javascript_Core/b3/B3Generate.cpp (290289 => 290290)
--- trunk/Source/_javascript_Core/b3/B3Generate.cpp 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/_javascript_Core/b3/B3Generate.cpp 2022-02-22 06:53:58 UTC (rev 290290)
@@ -48,14 +48,14 @@
#include "B3ReduceDoubleToFloat.h"
#include "B3ReduceLoopStrength.h"
#include "B3ReduceStrength.h"
-#include "B3TimingScope.h"
#include "B3Validate.h"
+#include "CompilerTimingScope.h"
namespace JSC { namespace B3 {
void prepareForGeneration(Procedure& procedure)
{
- TimingScope timingScope("prepareForGeneration");
+ CompilerTimingScope timingScope("Total B3+Air", "prepareForGeneration");
generateToAir(procedure);
Air::prepareForGeneration(procedure.code());
@@ -68,7 +68,7 @@
void generateToAir(Procedure& procedure)
{
- TimingScope timingScope("generateToAir");
+ CompilerTimingScope timingScope("Total B3", "generateToAir");
if (shouldDumpIR(procedure, B3Mode) && !shouldDumpIRAtEachPhase(B3Mode)) {
dataLog(tierName, "Initial B3:\n");
Modified: trunk/Source/_javascript_Core/b3/B3PhaseScope.cpp (290289 => 290290)
--- trunk/Source/_javascript_Core/b3/B3PhaseScope.cpp 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/_javascript_Core/b3/B3PhaseScope.cpp 2022-02-22 06:53:58 UTC (rev 290290)
@@ -39,7 +39,7 @@
PhaseScope::PhaseScope(Procedure& procedure, const char* name)
: m_procedure(procedure)
, m_name(name)
- , m_timingScope(name)
+ , m_timingScope("B3", name)
{
if (shouldDumpIRAtEachPhase(B3Mode)) {
dataLog("B3 after ", procedure.lastPhaseName(), ", before ", name, ":\n");
Modified: trunk/Source/_javascript_Core/b3/B3PhaseScope.h (290289 => 290290)
--- trunk/Source/_javascript_Core/b3/B3PhaseScope.h 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/_javascript_Core/b3/B3PhaseScope.h 2022-02-22 06:53:58 UTC (rev 290290)
@@ -27,7 +27,7 @@
#if ENABLE(B3_JIT)
-#include "B3TimingScope.h"
+#include "CompilerTimingScope.h"
#include <wtf/Noncopyable.h>
#include <wtf/text/CString.h>
@@ -44,7 +44,7 @@
private:
Procedure& m_procedure;
const char* m_name;
- TimingScope m_timingScope;
+ CompilerTimingScope m_timingScope;
CString m_dumpBefore;
};
Deleted: trunk/Source/_javascript_Core/b3/B3TimingScope.h (290289 => 290290)
--- trunk/Source/_javascript_Core/b3/B3TimingScope.h 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/_javascript_Core/b3/B3TimingScope.h 2022-02-22 06:53:58 UTC (rev 290290)
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
- *
- * 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.
- */
-
-#pragma once
-
-#if ENABLE(B3_JIT)
-
-#include "CompilerTimingScope.h"
-
-namespace JSC { namespace B3 {
-
-class TimingScope : public CompilerTimingScope {
-public:
- TimingScope(const char* name)
- : CompilerTimingScope("B3", name)
- {
- }
-};
-
-} } // namespace JSC::B3
-
-#endif // ENABLE(B3_JIT)
Modified: trunk/Source/_javascript_Core/b3/B3VariableLiveness.cpp (290289 => 290290)
--- trunk/Source/_javascript_Core/b3/B3VariableLiveness.cpp 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/_javascript_Core/b3/B3VariableLiveness.cpp 2022-02-22 06:53:58 UTC (rev 290290)
@@ -28,7 +28,7 @@
#if ENABLE(B3_JIT)
-#include "B3TimingScope.h"
+#include "CompilerTimingScope.h"
namespace JSC { namespace B3 {
@@ -35,7 +35,7 @@
VariableLiveness::VariableLiveness(Procedure& proc)
: WTF::Liveness<VariableLivenessAdapter>(proc.cfg(), proc)
{
- TimingScope timingScope("B3::VariableLiveness");
+ CompilerTimingScope timingScope("B3", "VariableLiveness");
compute();
}
Modified: trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp (290289 => 290290)
--- trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp 2022-02-22 06:53:58 UTC (rev 290290)
@@ -418,7 +418,7 @@
{
m_jit = &jit;
- TimingScope timingScope("Air::generateAndAllocateRegisters");
+ CompilerTimingScope timingScope("Air", "GenerateAndAllocateRegisters::generate");
DisallowMacroScratchRegisterUsage disallowScratch(*m_jit);
Modified: trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersAndStackByLinearScan.cpp (290289 => 290290)
--- trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersAndStackByLinearScan.cpp 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersAndStackByLinearScan.cpp 2022-02-22 06:53:58 UTC (rev 290290)
@@ -228,7 +228,7 @@
void buildIntervals()
{
- TimingScope timingScope("LinearScan::buildIntervals");
+ CompilerTimingScope timingScope("Air", "LinearScan::buildIntervals");
UnifiedTmpLiveness liveness(m_code);
for (BasicBlock* block : m_code) {
Modified: trunk/Source/_javascript_Core/b3/air/AirGenerate.cpp (290289 => 290290)
--- trunk/Source/_javascript_Core/b3/air/AirGenerate.cpp 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/_javascript_Core/b3/air/AirGenerate.cpp 2022-02-22 06:53:58 UTC (rev 290290)
@@ -49,8 +49,8 @@
#include "AirValidate.h"
#include "B3Common.h"
#include "B3Procedure.h"
-#include "B3TimingScope.h"
#include "CCallHelpers.h"
+#include "CompilerTimingScope.h"
#include "DisallowMacroScratchRegisterUsage.h"
#include <wtf/IndexMap.h>
@@ -58,7 +58,7 @@
void prepareForGeneration(Code& code)
{
- TimingScope timingScope("Air::prepareForGeneration");
+ CompilerTimingScope timingScope("Total Air", "prepareForGeneration");
// If we're doing super verbose dumping, the phase scope of any phase will already do a dump.
if (shouldDumpIR(code.proc(), AirMode) && !shouldDumpIRAtEachPhase(AirMode)) {
@@ -191,7 +191,7 @@
static void generateWithAlreadyAllocatedRegisters(Code& code, CCallHelpers& jit)
{
- TimingScope timingScope("Air::generate");
+ CompilerTimingScope timingScope("Air", "generateWithAlreadyAllocatedRegisters");
DisallowMacroScratchRegisterUsage disallowScratch(jit);
Modified: trunk/Source/_javascript_Core/b3/air/AirLiveness.h (290289 => 290290)
--- trunk/Source/_javascript_Core/b3/air/AirLiveness.h 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/_javascript_Core/b3/air/AirLiveness.h 2022-02-22 06:53:58 UTC (rev 290290)
@@ -28,7 +28,7 @@
#if ENABLE(B3_JIT)
#include "AirLivenessAdapter.h"
-#include "B3TimingScope.h"
+#include "CompilerTimingScope.h"
#include "SuperSampler.h"
#include <wtf/Liveness.h>
@@ -42,7 +42,7 @@
: WTF::Liveness<Adapter>(code.cfg(), code)
{
SuperSamplerScope samplingScope(false);
- TimingScope timingScope("Air::Liveness");
+ CompilerTimingScope timingScope("Air", "Liveness");
WTF::Liveness<Adapter>::compute();
}
};
Modified: trunk/Source/_javascript_Core/b3/air/AirPhaseScope.cpp (290289 => 290290)
--- trunk/Source/_javascript_Core/b3/air/AirPhaseScope.cpp 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/_javascript_Core/b3/air/AirPhaseScope.cpp 2022-02-22 06:53:58 UTC (rev 290290)
@@ -38,7 +38,7 @@
PhaseScope::PhaseScope(Code& code, const char* name)
: m_code(code)
, m_name(name)
- , m_timingScope(name)
+ , m_timingScope("Air", name)
{
if (shouldDumpIRAtEachPhase(AirMode)) {
dataLog("Air after ", code.lastPhaseName(), ", before ", name, ":\n");
Modified: trunk/Source/_javascript_Core/b3/air/AirPhaseScope.h (290289 => 290290)
--- trunk/Source/_javascript_Core/b3/air/AirPhaseScope.h 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/_javascript_Core/b3/air/AirPhaseScope.h 2022-02-22 06:53:58 UTC (rev 290290)
@@ -27,7 +27,7 @@
#if ENABLE(B3_JIT)
-#include "B3TimingScope.h"
+#include "CompilerTimingScope.h"
#include <wtf/Noncopyable.h>
#include <wtf/text/CString.h>
@@ -44,7 +44,7 @@
private:
Code& m_code;
const char* m_name;
- TimingScope m_timingScope;
+ CompilerTimingScope m_timingScope;
CString m_dumpBefore;
};
Modified: trunk/Source/_javascript_Core/tools/CompilerTimingScope.cpp (290289 => 290290)
--- trunk/Source/_javascript_Core/tools/CompilerTimingScope.cpp 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/_javascript_Core/tools/CompilerTimingScope.cpp 2022-02-22 06:53:58 UTC (rev 290290)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -62,7 +62,7 @@
{
for (auto& tuple : totals) {
dataLogLn(
- "[", std::get<0>(tuple), "] ", std::get<1>(tuple), " total ms: ", std::get<2>(tuple).milliseconds(), " max ms: ", std::get<3>(tuple).milliseconds());
+ "total ms: ", FixedWidthDouble(std::get<2>(tuple).milliseconds(), 8, 3), " max ms: ", FixedWidthDouble(std::get<3>(tuple).milliseconds(), 7, 3), " [", std::get<0>(tuple), "] ", std::get<1>(tuple));
}
}
Modified: trunk/Source/WTF/ChangeLog (290289 => 290290)
--- trunk/Source/WTF/ChangeLog 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/WTF/ChangeLog 2022-02-22 06:53:58 UTC (rev 290290)
@@ -1,3 +1,24 @@
+2022-02-21 Robin Morisset <rmoris...@apple.com>
+
+ [JSC] Format the output of --reportTotalPhaseTimes=1 more nicely
+ https://bugs.webkit.org/show_bug.cgi?id=237005
+
+ Reviewed by Saam Barati.
+
+ Add FixedWidthDouble, which allows easily printing a double with some whitespace to pad it out if it is smaller than expected.
+ Its design roughly follows RawPointer which similarly allows special formatting of a kind of number.
+
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+ * wtf/FixedWidthDouble.h: Added.
+ (WTF::FixedWidthDouble::FixedWidthDouble):
+ (WTF::FixedWidthDouble::value const):
+ (WTF::FixedWidthDouble::width const):
+ (WTF::FixedWidthDouble::precision const):
+ * wtf/PrintStream.cpp:
+ (WTF::printInternal):
+ * wtf/PrintStream.h:
+
2022-02-21 Wenson Hsieh <wenson_hs...@apple.com>
[iOS] Adjust some behaviors around the "Markup Image" action in the callout bar
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (290289 => 290290)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2022-02-22 06:53:58 UTC (rev 290290)
@@ -57,6 +57,7 @@
2CDED0F318115C85004DBA70 /* RunLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CDED0F118115C85004DBA70 /* RunLoop.cpp */; };
3337DB9CE743410FAF076E17 /* StackTrace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 313EDEC9778E49C9BEA91CFC /* StackTrace.cpp */; };
337B2D6A26546EB300DDFD3D /* LikelyDenseUnsignedIntegerSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 337B2D6826546EAA00DDFD3D /* LikelyDenseUnsignedIntegerSet.cpp */; };
+ 339B7B1127C45EF50072BF9A /* FixedWidthDouble.h in Headers */ = {isa = PBXBuildFile; fileRef = 33479C1C27236F2000B2E1B7 /* FixedWidthDouble.h */; settings = {ATTRIBUTES = (Private, ); }; };
4427C5AA21F6D6C300A612A4 /* ASCIICType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4427C5A921F6D6C300A612A4 /* ASCIICType.cpp */; };
46BEB6EB22FFE24900269867 /* RefCounted.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46BEB6E922FFDDD500269867 /* RefCounted.cpp */; };
46E93049271F1205005BA6E5 /* SafeStrerror.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46E43647271F10AA00C88C90 /* SafeStrerror.cpp */; };
@@ -1391,6 +1392,7 @@
304CA4E41375437EBE931D03 /* Markable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Markable.h; sourceTree = "<group>"; };
3137E1D7DBD84AC38FAE4D34 /* IndexSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexSet.h; sourceTree = "<group>"; };
313EDEC9778E49C9BEA91CFC /* StackTrace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackTrace.cpp; sourceTree = "<group>"; };
+ 33479C1C27236F2000B2E1B7 /* FixedWidthDouble.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FixedWidthDouble.h; sourceTree = "<group>"; };
337B2D6826546EAA00DDFD3D /* LikelyDenseUnsignedIntegerSet.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LikelyDenseUnsignedIntegerSet.cpp; sourceTree = "<group>"; };
337B2D6926546EAA00DDFD3D /* LikelyDenseUnsignedIntegerSet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LikelyDenseUnsignedIntegerSet.h; sourceTree = "<group>"; };
33FD4811265CB38000ABE4F4 /* InterferenceGraph.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InterferenceGraph.h; sourceTree = "<group>"; };
@@ -2278,6 +2280,7 @@
A8A472A1151A825A004123FF /* FastMalloc.cpp */,
A8A472A2151A825A004123FF /* FastMalloc.h */,
0F79C7C31E73511800EB34D1 /* FastTLS.h */,
+ 33479C1C27236F2000B2E1B7 /* FixedWidthDouble.h */,
0F9D335B165DBA73005AD387 /* FilePrintStream.cpp */,
0F9D335C165DBA73005AD387 /* FilePrintStream.h */,
A331D95A21F24992009F02AA /* FileSystem.cpp */,
@@ -3080,6 +3083,7 @@
DD3DC99D27A4BF8E007E5B61 /* ConcurrentPtrHashSet.h in Headers */,
DD3DC88F27A4BF8E007E5B61 /* ConcurrentVector.h in Headers */,
DD3DC8D027A4BF8E007E5B61 /* Condition.h in Headers */,
+ 339B7B1127C45EF50072BF9A /* FixedWidthDouble.h in Headers */,
DD3DC8D127A4BF8E007E5B61 /* CountingLock.h in Headers */,
DD3DC92627A4BF8E007E5B61 /* CPUTime.h in Headers */,
DD3DC96D27A4BF8E007E5B61 /* CrossThreadCopier.h in Headers */,
Modified: trunk/Source/WTF/wtf/CMakeLists.txt (290289 => 290290)
--- trunk/Source/WTF/wtf/CMakeLists.txt 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/WTF/wtf/CMakeLists.txt 2022-02-22 06:53:58 UTC (rev 290290)
@@ -75,6 +75,7 @@
FilePrintStream.h
FileSystem.h
FixedVector.h
+ FixedWidthDouble.h
FlipBytes.h
ForbidHeapAllocation.h
Forward.h
Added: trunk/Source/WTF/wtf/FixedWidthDouble.h (0 => 290290)
--- trunk/Source/WTF/wtf/FixedWidthDouble.h (rev 0)
+++ trunk/Source/WTF/wtf/FixedWidthDouble.h 2022-02-22 06:53:58 UTC (rev 290290)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#pragma once
+
+namespace WTF {
+
+class FixedWidthDouble {
+public:
+ FixedWidthDouble() = delete;
+
+ explicit FixedWidthDouble(double value, unsigned width = 8, unsigned precision = 6)
+ : m_value(value)
+ , m_width(width)
+ , m_precision(precision)
+ {
+ }
+
+ double value() const { return m_value; }
+ unsigned width() const { return m_width; }
+ unsigned precision() const { return m_precision; }
+
+private:
+ double m_value;
+ unsigned m_width;
+ unsigned m_precision;
+};
+
+} // namespace WTF
+
+using WTF::FixedWidthDouble;
Modified: trunk/Source/WTF/wtf/PrintStream.cpp (290289 => 290290)
--- trunk/Source/WTF/wtf/PrintStream.cpp 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/WTF/wtf/PrintStream.cpp 2022-02-22 06:53:58 UTC (rev 290290)
@@ -183,6 +183,11 @@
out.printf("%p", value.value());
}
+void printInternal(PrintStream& out, FixedWidthDouble value)
+{
+ out.printf("%*.*lf", value.width(), value.precision(), value.value());
+}
+
void dumpCharacter(PrintStream& out, char value)
{
out.printf("%c", value);
Modified: trunk/Source/WTF/wtf/PrintStream.h (290289 => 290290)
--- trunk/Source/WTF/wtf/PrintStream.h 2022-02-22 06:43:37 UTC (rev 290289)
+++ trunk/Source/WTF/wtf/PrintStream.h 2022-02-22 06:53:58 UTC (rev 290290)
@@ -31,6 +31,7 @@
#include <tuple>
#include <wtf/Forward.h>
#include <wtf/FastMalloc.h>
+#include <wtf/FixedWidthDouble.h>
#include <wtf/Noncopyable.h>
#include <wtf/RawPointer.h>
#include <wtf/RefPtr.h>
@@ -122,6 +123,7 @@
WTF_EXPORT_PRIVATE void printInternal(PrintStream&, float);
WTF_EXPORT_PRIVATE void printInternal(PrintStream&, double);
WTF_EXPORT_PRIVATE void printInternal(PrintStream&, RawPointer);
+WTF_EXPORT_PRIVATE void printInternal(PrintStream&, FixedWidthDouble);
template<typename T>
void printInternal(PrintStream& out, const T& value)