Diff
Modified: trunk/Source/_javascript_Core/API/JSWrapperMap.mm (251262 => 251263)
--- trunk/Source/_javascript_Core/API/JSWrapperMap.mm 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/API/JSWrapperMap.mm 2019-10-17 22:18:57 UTC (rev 251263)
@@ -62,7 +62,7 @@
@end
-static const constexpr unsigned InitialBufferSize { 256 };
+static constexpr unsigned InitialBufferSize { 256 };
// Default conversion of selectors to property names.
// All semicolons are removed, lowercase letters following a semicolon are capitalized.
Modified: trunk/Source/_javascript_Core/ChangeLog (251262 => 251263)
--- trunk/Source/_javascript_Core/ChangeLog 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-10-17 22:18:57 UTC (rev 251263)
@@ -1,3 +1,53 @@
+2019-10-17 Mark Lam <mark....@apple.com>
+
+ Use constexpr in more places and remove some unnecessary external linkage.
+ https://bugs.webkit.org/show_bug.cgi?id=203115
+
+ Reviewed by Yusuke Suzuki.
+
+ * API/JSWrapperMap.mm:
+ * heap/MarkedBlock.cpp:
+ * inspector/JSGlobalObjectInspectorController.cpp:
+ (Inspector::JSGlobalObjectInspectorController::appendAPIBacktrace):
+ * inspector/ScriptCallStack.h:
+ * interpreter/CLoopStack.h:
+ * interpreter/CallFrame.h:
+ * interpreter/ShadowChicken.h:
+ * jit/AssemblyHelpers.cpp:
+ (JSC::emitRandomThunkImpl):
+ * jit/GPRInfo.cpp:
+ * jit/GPRInfo.h:
+ * jit/JIT.h:
+ * jit/PCToCodeOriginMap.cpp:
+ * jit/SpecializedThunkJIT.h:
+ * jit/ThunkGenerators.cpp:
+ (JSC::roundThunkGenerator):
+ * jit/UnusedPointer.h:
+ * llint/LLIntData.h:
+ * llint/LLIntPCRanges.h:
+ * parser/Lexer.h:
+ * parser/Nodes.h:
+ * runtime/CodeCache.cpp:
+ * runtime/CodeCache.h:
+ * runtime/ErrorInstance.h:
+ * runtime/JSAsyncFunction.h:
+ * runtime/JSAsyncGeneratorFunction.h:
+ * runtime/JSBoundFunction.h:
+ * runtime/JSCallee.h:
+ * runtime/JSFunction.h:
+ * runtime/JSGeneratorFunction.h:
+ * runtime/JSNativeStdFunction.h:
+ * runtime/JSRunLoopTimer.cpp:
+ (): Deleted.
+ * runtime/JSRunLoopTimer.h:
+ * runtime/ProxyObject.h:
+ * runtime/Watchdog.cpp:
+ (): Deleted.
+ * runtime/Watchdog.h:
+ * wasm/js/WebAssemblyFunction.h:
+ * wasm/js/WebAssemblyFunctionBase.h:
+ * wasm/js/WebAssemblyWrapperFunction.h:
+
2019-10-17 Brent Fulgham <bfulg...@apple.com>
Build fix for newer versions of MSVC.
Modified: trunk/Source/_javascript_Core/heap/MarkedBlock.cpp (251262 => 251263)
--- trunk/Source/_javascript_Core/heap/MarkedBlock.cpp 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/heap/MarkedBlock.cpp 2019-10-17 22:18:57 UTC (rev 251263)
@@ -42,8 +42,6 @@
static constexpr bool verbose = false;
}
-const size_t MarkedBlock::blockSize;
-
static constexpr bool computeBalance = false;
static size_t balance;
Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp (251262 => 251263)
--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp 2019-10-17 22:18:57 UTC (rev 251263)
@@ -156,8 +156,8 @@
void JSGlobalObjectInspectorController::appendAPIBacktrace(ScriptCallStack& callStack)
{
- static const int framesToShow = 31;
- static const int framesToSkip = 3; // WTFGetBacktrace, appendAPIBacktrace, reportAPIException.
+ static constexpr int framesToShow = 31;
+ static constexpr int framesToSkip = 3; // WTFGetBacktrace, appendAPIBacktrace, reportAPIException.
void* samples[framesToShow + framesToSkip];
int frames = framesToShow + framesToSkip;
Modified: trunk/Source/_javascript_Core/inspector/ScriptCallStack.h (251262 => 251263)
--- trunk/Source/_javascript_Core/inspector/ScriptCallStack.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/inspector/ScriptCallStack.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -40,7 +40,7 @@
class JS_EXPORT_PRIVATE ScriptCallStack : public RefCounted<ScriptCallStack> {
public:
- static const size_t maxCallStackSizeToCapture = 200;
+ static constexpr size_t maxCallStackSizeToCapture = 200;
static Ref<ScriptCallStack> create();
static Ref<ScriptCallStack> create(Vector<ScriptCallFrame>&);
Modified: trunk/Source/_javascript_Core/interpreter/CLoopStack.h (251262 => 251263)
--- trunk/Source/_javascript_Core/interpreter/CLoopStack.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/interpreter/CLoopStack.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -46,7 +46,7 @@
WTF_MAKE_NONCOPYABLE(CLoopStack);
public:
// Allow 8k of excess registers before we start trying to reap the stack
- static const ptrdiff_t maxExcessCapacity = 8 * 1024;
+ static constexpr ptrdiff_t maxExcessCapacity = 8 * 1024;
CLoopStack(VM&);
~CLoopStack();
Modified: trunk/Source/_javascript_Core/interpreter/CallFrame.h (251262 => 251263)
--- trunk/Source/_javascript_Core/interpreter/CallFrame.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/interpreter/CallFrame.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -84,16 +84,16 @@
struct CallerFrameAndPC {
alignas(CPURegister) CallFrame* callerFrame;
alignas(CPURegister) const Instruction* returnPC;
- static const int sizeInRegisters = 2 * sizeof(CPURegister) / sizeof(Register);
+ static constexpr int sizeInRegisters = 2 * sizeof(CPURegister) / sizeof(Register);
};
static_assert(CallerFrameAndPC::sizeInRegisters == sizeof(CallerFrameAndPC) / sizeof(Register), "CallerFrameAndPC::sizeInRegisters is incorrect.");
struct CallFrameSlot {
- static const int codeBlock = CallerFrameAndPC::sizeInRegisters;
- static const int callee = codeBlock + 1;
- static const int argumentCount = callee + 1;
- static const int thisArgument = argumentCount + 1;
- static const int firstArgument = thisArgument + 1;
+ static constexpr int codeBlock = CallerFrameAndPC::sizeInRegisters;
+ static constexpr int callee = codeBlock + 1;
+ static constexpr int argumentCount = callee + 1;
+ static constexpr int thisArgument = argumentCount + 1;
+ static constexpr int firstArgument = thisArgument + 1;
};
// Represents the current state of script execution.
@@ -100,7 +100,7 @@
// Passed as the first argument to most functions.
class CallFrame : private Register {
public:
- static const int headerSizeInRegisters = CallFrameSlot::argumentCount + 1;
+ static constexpr int headerSizeInRegisters = CallFrameSlot::argumentCount + 1;
// This function should only be called in very specific circumstances
// when you've guaranteed the callee can't be a Wasm callee, and can
Modified: trunk/Source/_javascript_Core/interpreter/ShadowChicken.h (251262 => 251263)
--- trunk/Source/_javascript_Core/interpreter/ShadowChicken.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/interpreter/ShadowChicken.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -77,9 +77,9 @@
{
}
- static const constexpr unsigned unlikelyValue = 0x7a11;
+ static constexpr unsigned unlikelyValue = 0x7a11;
- static const constexpr intptr_t tailMarkerValue = static_cast<intptr_t>(unlikelyValue);
+ static constexpr intptr_t tailMarkerValue = static_cast<intptr_t>(unlikelyValue);
static JSObject* tailMarker()
{
return bitwise_cast<JSObject*>(tailMarkerValue);
Modified: trunk/Source/_javascript_Core/jit/AssemblyHelpers.cpp (251262 => 251263)
--- trunk/Source/_javascript_Core/jit/AssemblyHelpers.cpp 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/jit/AssemblyHelpers.cpp 2019-10-17 22:18:57 UTC (rev 251263)
@@ -446,7 +446,7 @@
// Convert `(53bit double integer value) / (1 << 53)` to `(53bit double integer value) * (1.0 / (1 << 53))`.
// In latter case, `1.0 / (1 << 53)` will become a double value represented as (mantissa = 0 & exp = 970, it means 1e-(2**54)).
- static const double scale = 1.0 / (1ULL << 53);
+ static constexpr double scale = 1.0 / (1ULL << 53);
// Multiplying 1e-(2**54) with the double integer does not change anything of the mantissa part of the double integer.
// It just reduces the exp part of the given 53bit double integer.
Modified: trunk/Source/_javascript_Core/jit/GPRInfo.cpp (251262 => 251263)
--- trunk/Source/_javascript_Core/jit/GPRInfo.cpp 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/jit/GPRInfo.cpp 2019-10-17 22:18:57 UTC (rev 251263)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -39,13 +39,6 @@
#endif
}
-// This is in the .cpp file to work around clang issues.
-#if CPU(X86_64)
-const GPRReg GPRInfo::patchpointScratchRegister = MacroAssembler::s_scratchRegister;
-#elif CPU(ARM64)
-const GPRReg GPRInfo::patchpointScratchRegister = ARM64Registers::ip0;
-#endif
-
} // namespace JSC
#endif // ENABLE(ASSEMBLER)
Modified: trunk/Source/_javascript_Core/jit/GPRInfo.h (251262 => 251263)
--- trunk/Source/_javascript_Core/jit/GPRInfo.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/jit/GPRInfo.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -469,7 +469,7 @@
// FIXME: I believe that all uses of this are dead in the sense that it just causes the scratch
// register allocator to select a different register and potentially spill things. It would be better
// if we instead had a more explicit way of saying that we don't have a scratch register.
- static const GPRReg patchpointScratchRegister;
+ static constexpr GPRReg patchpointScratchRegister = MacroAssembler::s_scratchRegister;
static GPRReg toRegister(unsigned index)
{
@@ -655,7 +655,7 @@
static constexpr GPRReg nonPreservedNonReturnGPR = ARM64Registers::x2;
static constexpr GPRReg nonPreservedNonArgumentGPR0 = ARM64Registers::x8;
static constexpr GPRReg nonPreservedNonArgumentGPR1 = ARM64Registers::x9;
- static const GPRReg patchpointScratchRegister;
+ static constexpr GPRReg patchpointScratchRegister = ARM64Registers::ip0;
// GPRReg mapping is direct, the machine register numbers can
// be used directly as indices into the GPR RegisterBank.
Modified: trunk/Source/_javascript_Core/jit/JIT.h (251262 => 251263)
--- trunk/Source/_javascript_Core/jit/JIT.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/jit/JIT.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -185,11 +185,11 @@
using MacroAssembler::JumpList;
using MacroAssembler::Label;
- static const uintptr_t patchGetByIdDefaultStructure = unusedPointer;
- static const int patchGetByIdDefaultOffset = 0;
+ static constexpr uintptr_t patchGetByIdDefaultStructure = unusedPointer;
+ static constexpr int patchGetByIdDefaultOffset = 0;
// Magic number - initial offset cannot be representable as a signed 8bit value, or the X86Assembler
// will compress the displacement, and we may not be able to fit a patched offset.
- static const int patchPutByIdDefaultOffset = 256;
+ static constexpr int patchPutByIdDefaultOffset = 256;
public:
JIT(VM&, CodeBlock* = 0, unsigned loopOSREntryBytecodeOffset = 0);
Modified: trunk/Source/_javascript_Core/jit/PCToCodeOriginMap.cpp (251262 => 251263)
--- trunk/Source/_javascript_Core/jit/PCToCodeOriginMap.cpp 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/jit/PCToCodeOriginMap.cpp 2019-10-17 22:18:57 UTC (rev 251263)
@@ -55,7 +55,7 @@
void write(T item)
{
RELEASE_ASSERT(m_offset + sizeof(T) <= m_maxSize);
- static const uint8_t mask = std::numeric_limits<uint8_t>::max();
+ static constexpr uint8_t mask = std::numeric_limits<uint8_t>::max();
for (unsigned i = 0; i < sizeof(T); i++) {
*(m_buffer + m_offset) = static_cast<uint8_t>(item & mask);
item = item >> (sizeof(uint8_t) * 8);
@@ -145,8 +145,8 @@
}
-static const uint8_t sentinelPCDelta = 0;
-static const int8_t sentinelBytecodeDelta = 0;
+static constexpr uint8_t sentinelPCDelta = 0;
+static constexpr int8_t sentinelBytecodeDelta = 0;
PCToCodeOriginMap::PCToCodeOriginMap(PCToCodeOriginMapBuilder&& builder, LinkBuffer& linkBuffer)
{
Modified: trunk/Source/_javascript_Core/jit/SpecializedThunkJIT.h (251262 => 251263)
--- trunk/Source/_javascript_Core/jit/SpecializedThunkJIT.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/jit/SpecializedThunkJIT.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -36,7 +36,7 @@
class SpecializedThunkJIT : public JSInterfaceJIT {
public:
- static const int ThisArgument = -1;
+ static constexpr int ThisArgument = -1;
SpecializedThunkJIT(VM& vm, int expectedArgCount)
: JSInterfaceJIT(&vm)
{
Modified: trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp (251262 => 251263)
--- trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp 2019-10-17 22:18:57 UTC (rev 251263)
@@ -966,7 +966,7 @@
doubleResult.append(jit.branchDouble(MacroAssembler::DoubleEqual, SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::fpRegT1));
jit.ceilDouble(SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::fpRegT1);
- static const double halfConstant = -0.5;
+ static constexpr double halfConstant = -0.5;
jit.loadDouble(MacroAssembler::TrustedImmPtr(&halfConstant), SpecializedThunkJIT::fpRegT2);
jit.addDouble(SpecializedThunkJIT::fpRegT1, SpecializedThunkJIT::fpRegT2);
MacroAssembler::Jump shouldRoundDown = jit.branchDouble(MacroAssembler::DoubleGreaterThan, SpecializedThunkJIT::fpRegT2, SpecializedThunkJIT::fpRegT0);
@@ -975,7 +975,7 @@
MacroAssembler::Jump continuation = jit.jump();
shouldRoundDown.link(&jit);
- static const double _oneConstant_ = 1.0;
+ static constexpr double _oneConstant_ = 1.0;
jit.loadDouble(MacroAssembler::TrustedImmPtr(&oneConstant), SpecializedThunkJIT::fpRegT2);
jit.subDouble(SpecializedThunkJIT::fpRegT1, SpecializedThunkJIT::fpRegT2, SpecializedThunkJIT::fpRegT0);
Modified: trunk/Source/_javascript_Core/jit/UnusedPointer.h (251262 => 251263)
--- trunk/Source/_javascript_Core/jit/UnusedPointer.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/jit/UnusedPointer.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -27,7 +27,7 @@
namespace JSC {
-static const uintptr_t unusedPointer = 0xd1e7beef;
+static constexpr uintptr_t unusedPointer = 0xd1e7beef;
} // namespace JSC
Modified: trunk/Source/_javascript_Core/llint/LLIntData.h (251262 => 251263)
--- trunk/Source/_javascript_Core/llint/LLIntData.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/llint/LLIntData.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -197,19 +197,19 @@
#if ENABLE(JIT)
struct Registers {
- static const GPRReg pcGPR = GPRInfo::regT4;
+ static constexpr GPRReg pcGPR = GPRInfo::regT4;
#if CPU(X86_64) && !OS(WINDOWS)
- static const GPRReg metadataTableGPR = GPRInfo::regCS1;
- static const GPRReg pbGPR = GPRInfo::regCS2;
+ static constexpr GPRReg metadataTableGPR = GPRInfo::regCS1;
+ static constexpr GPRReg pbGPR = GPRInfo::regCS2;
#elif CPU(X86_64) && OS(WINDOWS)
- static const GPRReg metadataTableGPR = GPRInfo::regCS3;
- static const GPRReg pbGPR = GPRInfo::regCS4;
+ static constexpr GPRReg metadataTableGPR = GPRInfo::regCS3;
+ static constexpr GPRReg pbGPR = GPRInfo::regCS4;
#elif CPU(ARM64)
- static const GPRReg metadataTableGPR = GPRInfo::regCS6;
- static const GPRReg pbGPR = GPRInfo::regCS7;
+ static constexpr GPRReg metadataTableGPR = GPRInfo::regCS6;
+ static constexpr GPRReg pbGPR = GPRInfo::regCS7;
#elif CPU(MIPS) || CPU(ARM_THUMB2)
- static const GPRReg metadataTableGPR = GPRInfo::regCS0;
+ static constexpr GPRReg metadataTableGPR = GPRInfo::regCS0;
#endif
};
#endif
Modified: trunk/Source/_javascript_Core/llint/LLIntPCRanges.h (251262 => 251263)
--- trunk/Source/_javascript_Core/llint/LLIntPCRanges.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/llint/LLIntPCRanges.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -47,7 +47,7 @@
}
#if !ENABLE(C_LOOP)
-static const GPRReg LLIntPC = GPRInfo::regT4;
+static constexpr GPRReg LLIntPC = GPRInfo::regT4;
#endif
} } // namespace JSC::LLInt
Modified: trunk/Source/_javascript_Core/parser/Lexer.h (251262 => 251263)
--- trunk/Source/_javascript_Core/parser/Lexer.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/parser/Lexer.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -195,7 +195,7 @@
void fillTokenInfo(JSToken*, JSTokenType, int lineNumber, int endOffset, int lineStartOffset, JSTextPosition endPosition);
- static const size_t initialReadBufferCapacity = 32;
+ static constexpr size_t initialReadBufferCapacity = 32;
int m_lineNumber;
int m_lastLineNumber;
Modified: trunk/Source/_javascript_Core/parser/Nodes.h (251262 => 251263)
--- trunk/Source/_javascript_Core/parser/Nodes.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/parser/Nodes.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -2492,7 +2492,7 @@
private:
SwitchInfo::SwitchType tryTableSwitch(Vector<ExpressionNode*, 8>& literalVector, int32_t& min_num, int32_t& max_num);
- static const size_t s_tableSwitchMinimum = 3;
+ static constexpr size_t s_tableSwitchMinimum = 3;
ClauseListNode* m_list1;
CaseClauseNode* m_defaultClause;
ClauseListNode* m_list2;
Modified: trunk/Source/_javascript_Core/runtime/CodeCache.cpp (251262 => 251263)
--- trunk/Source/_javascript_Core/runtime/CodeCache.cpp 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/runtime/CodeCache.cpp 2019-10-17 22:18:57 UTC (rev 251263)
@@ -31,8 +31,6 @@
namespace JSC {
-const Seconds CodeCacheMap::workingSetTime = 10_s;
-
void CodeCacheMap::pruneSlowCase()
{
m_minCapacity = std::max(m_size - m_sizeAtLastPrune, static_cast<int64_t>(0));
Modified: trunk/Source/_javascript_Core/runtime/CodeCache.h (251262 => 251263)
--- trunk/Source/_javascript_Core/runtime/CodeCache.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/runtime/CodeCache.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -179,18 +179,18 @@
// This constant factor biases cache capacity toward allowing a minimum
// working set to enter the cache before it starts evicting.
- static const Seconds workingSetTime;
- static const int64_t workingSetMaxBytes = 16000000;
- static const size_t workingSetMaxEntries = 2000;
+ static constexpr Seconds workingSetTime = 10_s;
+ static constexpr int64_t workingSetMaxBytes = 16000000;
+ static constexpr size_t workingSetMaxEntries = 2000;
// This constant factor biases cache capacity toward recent activity. We
// want to adapt to changing workloads.
- static const int64_t recencyBias = 4;
+ static constexpr int64_t recencyBias = 4;
// This constant factor treats a sampled event for one old object as if it
// happened for many old objects. Most old objects are evicted before we can
// sample them, so we need to extrapolate from the ones we do sample.
- static const int64_t oldObjectSamplingMultiplier = 32;
+ static constexpr int64_t oldObjectSamplingMultiplier = 32;
size_t numberOfEntries() const { return static_cast<size_t>(m_map.size()); }
bool canPruneQuickly() const { return numberOfEntries() < workingSetMaxEntries; }
@@ -243,20 +243,20 @@
template <> struct CacheTypes<UnlinkedProgramCodeBlock> {
typedef JSC::ProgramNode RootNode;
- static const SourceCodeType codeType = SourceCodeType::ProgramType;
- static const SourceParseMode parseMode = SourceParseMode::ProgramMode;
+ static constexpr SourceCodeType codeType = SourceCodeType::ProgramType;
+ static constexpr SourceParseMode parseMode = SourceParseMode::ProgramMode;
};
template <> struct CacheTypes<UnlinkedEvalCodeBlock> {
typedef JSC::EvalNode RootNode;
- static const SourceCodeType codeType = SourceCodeType::EvalType;
- static const SourceParseMode parseMode = SourceParseMode::ProgramMode;
+ static constexpr SourceCodeType codeType = SourceCodeType::EvalType;
+ static constexpr SourceParseMode parseMode = SourceParseMode::ProgramMode;
};
template <> struct CacheTypes<UnlinkedModuleProgramCodeBlock> {
typedef JSC::ModuleProgramNode RootNode;
- static const SourceCodeType codeType = SourceCodeType::ModuleType;
- static const SourceParseMode parseMode = SourceParseMode::ModuleEvaluateMode;
+ static constexpr SourceCodeType codeType = SourceCodeType::ModuleType;
+ static constexpr SourceParseMode parseMode = SourceParseMode::ModuleEvaluateMode;
};
template <class UnlinkedCodeBlockType, class ExecutableType = ScriptExecutable>
Modified: trunk/Source/_javascript_Core/runtime/ErrorInstance.h (251262 => 251263)
--- trunk/Source/_javascript_Core/runtime/ErrorInstance.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/runtime/ErrorInstance.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -29,7 +29,7 @@
class ErrorInstance : public JSDestructibleObject {
public:
typedef JSDestructibleObject Base;
- const static unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | OverridesGetPropertyNames;
+ static constexpr unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | OverridesGetPropertyNames;
enum SourceTextWhereErrorOccurred { FoundExactSource, FoundApproximateSource };
typedef String (*SourceAppender) (const String& originalMessage, const String& sourceText, RuntimeType, SourceTextWhereErrorOccurred);
Modified: trunk/Source/_javascript_Core/runtime/JSAsyncFunction.h (251262 => 251263)
--- trunk/Source/_javascript_Core/runtime/JSAsyncFunction.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/runtime/JSAsyncFunction.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -36,7 +36,7 @@
public:
typedef JSFunction Base;
- const static unsigned StructureFlags = Base::StructureFlags;
+ static constexpr unsigned StructureFlags = Base::StructureFlags;
DECLARE_EXPORT_INFO;
Modified: trunk/Source/_javascript_Core/runtime/JSAsyncGeneratorFunction.h (251262 => 251263)
--- trunk/Source/_javascript_Core/runtime/JSAsyncGeneratorFunction.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/runtime/JSAsyncGeneratorFunction.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -36,7 +36,7 @@
public:
using Base = JSFunction;
- const static unsigned StructureFlags = Base::StructureFlags;
+ static constexpr unsigned StructureFlags = Base::StructureFlags;
DECLARE_EXPORT_INFO;
Modified: trunk/Source/_javascript_Core/runtime/JSBoundFunction.h (251262 => 251263)
--- trunk/Source/_javascript_Core/runtime/JSBoundFunction.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/runtime/JSBoundFunction.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -39,7 +39,7 @@
class JSBoundFunction final : public JSFunction {
public:
typedef JSFunction Base;
- const static unsigned StructureFlags = Base::StructureFlags & ~ImplementsDefaultHasInstance;
+ static constexpr unsigned StructureFlags = Base::StructureFlags & ~ImplementsDefaultHasInstance;
static_assert(StructureFlags & ImplementsHasInstance, "");
template<typename CellType, SubspaceAccess mode>
Modified: trunk/Source/_javascript_Core/runtime/JSCallee.h (251262 => 251263)
--- trunk/Source/_javascript_Core/runtime/JSCallee.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/runtime/JSCallee.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -45,7 +45,7 @@
public:
typedef JSNonFinalObject Base;
- const static unsigned StructureFlags = Base::StructureFlags | ImplementsHasInstance | ImplementsDefaultHasInstance;
+ static constexpr unsigned StructureFlags = Base::StructureFlags | ImplementsHasInstance | ImplementsDefaultHasInstance;
static JSCallee* create(VM& vm, JSGlobalObject* globalObject, JSScope* scope)
{
Modified: trunk/Source/_javascript_Core/runtime/JSFunction.h (251262 => 251263)
--- trunk/Source/_javascript_Core/runtime/JSFunction.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/runtime/JSFunction.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -69,7 +69,7 @@
}
typedef JSCallee Base;
- const static unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | OverridesGetPropertyNames | OverridesGetCallData;
+ static constexpr unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | OverridesGetPropertyNames | OverridesGetCallData;
static size_t allocationSize(Checked<size_t> inlineCapacity)
{
Modified: trunk/Source/_javascript_Core/runtime/JSGeneratorFunction.h (251262 => 251263)
--- trunk/Source/_javascript_Core/runtime/JSGeneratorFunction.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/runtime/JSGeneratorFunction.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -43,7 +43,7 @@
public:
using Base = JSFunction;
- const static unsigned StructureFlags = Base::StructureFlags;
+ static constexpr unsigned StructureFlags = Base::StructureFlags;
DECLARE_EXPORT_INFO;
Modified: trunk/Source/_javascript_Core/runtime/JSNativeStdFunction.h (251262 => 251263)
--- trunk/Source/_javascript_Core/runtime/JSNativeStdFunction.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/runtime/JSNativeStdFunction.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -38,7 +38,7 @@
public:
typedef JSFunction Base;
- const static unsigned StructureFlags = Base::StructureFlags;
+ static constexpr unsigned StructureFlags = Base::StructureFlags;
template<typename CellType, SubspaceAccess mode>
static IsoSubspace* subspaceFor(VM& vm)
Modified: trunk/Source/_javascript_Core/runtime/JSRunLoopTimer.cpp (251262 => 251263)
--- trunk/Source/_javascript_Core/runtime/JSRunLoopTimer.cpp 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/runtime/JSRunLoopTimer.cpp 2019-10-17 22:18:57 UTC (rev 251263)
@@ -44,8 +44,6 @@
namespace JSC {
-const Seconds JSRunLoopTimer::s_decade { 60 * 60 * 24 * 365 * 10 };
-
static inline JSRunLoopTimer::Manager::EpochTime epochTime(Seconds delay)
{
#if USE(CF)
Modified: trunk/Source/_javascript_Core/runtime/JSRunLoopTimer.h (251262 => 251263)
--- trunk/Source/_javascript_Core/runtime/JSRunLoopTimer.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/runtime/JSRunLoopTimer.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -121,7 +121,7 @@
JS_EXPORT_PRIVATE Optional<Seconds> timeUntilFire();
protected:
- static const Seconds s_decade;
+ static constexpr Seconds s_decade { 60 * 60 * 24 * 365 * 10 };
Ref<JSLock> m_apiLock;
private:
Modified: trunk/Source/_javascript_Core/runtime/ProxyObject.h (251262 => 251263)
--- trunk/Source/_javascript_Core/runtime/ProxyObject.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/runtime/ProxyObject.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -34,7 +34,7 @@
public:
typedef JSNonFinalObject Base;
- const static unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | OverridesGetCallData | InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | OverridesGetPropertyNames | ProhibitsPropertyCaching;
+ static constexpr unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | OverridesGetCallData | InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | OverridesGetPropertyNames | ProhibitsPropertyCaching;
static ProxyObject* create(ExecState* exec, JSGlobalObject* globalObject, JSValue target, JSValue handler)
{
Modified: trunk/Source/_javascript_Core/runtime/Watchdog.cpp (251262 => 251263)
--- trunk/Source/_javascript_Core/runtime/Watchdog.cpp 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/runtime/Watchdog.cpp 2019-10-17 22:18:57 UTC (rev 251263)
@@ -32,8 +32,6 @@
namespace JSC {
-const Seconds Watchdog::noTimeLimit { Seconds::infinity() };
-
Watchdog::Watchdog(VM* vm)
: m_vm(vm)
, m_timeLimit(noTimeLimit)
Modified: trunk/Source/_javascript_Core/runtime/Watchdog.h (251262 => 251263)
--- trunk/Source/_javascript_Core/runtime/Watchdog.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/runtime/Watchdog.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -54,7 +54,7 @@
void enteredVM();
void exitedVM();
- static const Seconds noTimeLimit;
+ static constexpr Seconds noTimeLimit = Seconds::infinity();
private:
void startTimer(Seconds timeLimit);
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyFunction.h (251262 => 251263)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyFunction.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyFunction.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -49,7 +49,7 @@
public:
using Base = WebAssemblyFunctionBase;
- const static unsigned StructureFlags = Base::StructureFlags;
+ static constexpr unsigned StructureFlags = Base::StructureFlags;
static constexpr bool needsDestruction = true;
static void destroy(JSCell*);
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyFunctionBase.h (251262 => 251263)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyFunctionBase.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyFunctionBase.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -38,7 +38,7 @@
public:
using Base = JSFunction;
- const static unsigned StructureFlags = Base::StructureFlags;
+ static constexpr unsigned StructureFlags = Base::StructureFlags;
DECLARE_INFO;
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyWrapperFunction.h (251262 => 251263)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyWrapperFunction.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyWrapperFunction.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -38,7 +38,7 @@
public:
using Base = WebAssemblyFunctionBase;
- const static unsigned StructureFlags = Base::StructureFlags;
+ static constexpr unsigned StructureFlags = Base::StructureFlags;
template<typename CellType, SubspaceAccess mode>
static IsoSubspace* subspaceFor(VM& vm)
Modified: trunk/Source/WTF/ChangeLog (251262 => 251263)
--- trunk/Source/WTF/ChangeLog 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WTF/ChangeLog 2019-10-17 22:18:57 UTC (rev 251263)
@@ -1,3 +1,17 @@
+2019-10-17 Mark Lam <mark....@apple.com>
+
+ Use constexpr in more places and remove some unnecessary external linkage.
+ https://bugs.webkit.org/show_bug.cgi?id=203115
+
+ Reviewed by Yusuke Suzuki.
+
+ Also removed unused lockSpinLimit in Threading.h.
+
+ * wtf/MD5.h:
+ * wtf/SHA1.h:
+ * wtf/StackBounds.h:
+ * wtf/Threading.h:
+
2019-10-17 Sihui Liu <sihui_...@apple.com>
Using version 1 CFRunloopSource for faster task dispatch
Modified: trunk/Source/WTF/wtf/MD5.h (251262 => 251263)
--- trunk/Source/WTF/wtf/MD5.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WTF/wtf/MD5.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -51,7 +51,7 @@
WTF_EXPORT_PRIVATE void addBytes(const uint8_t* input, size_t length);
// Size of the SHA1 hash
- WTF_EXPORT_PRIVATE static const size_t hashSize = 16;
+ WTF_EXPORT_PRIVATE static constexpr size_t hashSize = 16;
// type for computing MD5 hash
typedef std::array<uint8_t, hashSize> Digest;
Modified: trunk/Source/WTF/wtf/SHA1.h (251262 => 251263)
--- trunk/Source/WTF/wtf/SHA1.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WTF/wtf/SHA1.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -57,7 +57,7 @@
WTF_EXPORT_PRIVATE void addBytes(const uint8_t* input, size_t length);
// Size of the SHA1 hash
- WTF_EXPORT_PRIVATE static const size_t hashSize = 20;
+ WTF_EXPORT_PRIVATE static constexpr size_t hashSize = 20;
// type for computing SHA1 hash
typedef std::array<uint8_t, hashSize> Digest;
Modified: trunk/Source/WTF/wtf/StackBounds.h (251262 => 251263)
--- trunk/Source/WTF/wtf/StackBounds.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WTF/wtf/StackBounds.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -40,7 +40,7 @@
// functions was seen to be as high as 27k. Hence, 64k is chosen as a
// conservative availability value that is not too large but comfortably
// exceeds 27k with some buffer for error.
- const static size_t s_defaultAvailabilityDelta = 64 * 1024;
+ static constexpr size_t s_defaultAvailabilityDelta = 64 * 1024;
public:
enum class StackDirection { Upward, Downward };
Modified: trunk/Source/WTF/wtf/Threading.h (251262 => 251263)
--- trunk/Source/WTF/wtf/Threading.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WTF/wtf/Threading.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -143,7 +143,6 @@
static void initializeCurrentThreadInternal(const char* threadName);
static void initializeCurrentThreadEvenIfNonWTFCreated();
- WTF_EXPORT_PRIVATE static const unsigned lockSpinLimit;
WTF_EXPORT_PRIVATE static void yield();
WTF_EXPORT_PRIVATE static bool exchangeIsCompilationThread(bool newValue);
Modified: trunk/Source/WebCore/ChangeLog (251262 => 251263)
--- trunk/Source/WebCore/ChangeLog 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WebCore/ChangeLog 2019-10-17 22:18:57 UTC (rev 251263)
@@ -1,3 +1,25 @@
+2019-10-17 Mark Lam <mark....@apple.com>
+
+ Use constexpr in more places and remove some unnecessary external linkage.
+ https://bugs.webkit.org/show_bug.cgi?id=203115
+
+ Reviewed by Yusuke Suzuki.
+
+ No new tests because this patch adds no new functionality.
+
+ * html/track/TextTrackCueGeneric.cpp:
+ * html/track/VTTCue.cpp:
+ * page/EventHandler.cpp:
+ (WebCore::SyntheticTouchPoint::SyntheticTouchPoint):
+ * page/FrameTree.h:
+ * page/scrolling/ScrollingMomentumCalculator.cpp:
+ (WebCore::projectedInertialScrollDistance):
+ * platform/graphics/FontTaggedSettings.h:
+ * platform/graphics/Region.cpp:
+ * platform/graphics/filters/FELighting.cpp:
+ * rendering/TableLayout.h:
+ * rendering/svg/SVGRenderingContext.h:
+
2019-10-17 Simon Fraser <simon.fra...@apple.com>
[ Mojave+ ] Layout Test compositing/fixed-with-main-thread-scrolling.html is a flaky timeout
Modified: trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp (251262 => 251263)
--- trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp 2019-10-17 22:18:57 UTC (rev 251263)
@@ -47,7 +47,7 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(TextTrackCueGeneric);
// This default value must be the same as the one specified in mediaControlsApple.css for -webkit-media-controls-closed-captions-container
-const static int DEFAULTCAPTIONFONTSIZE = 10;
+static constexpr int DEFAULTCAPTIONFONTSIZE = 10;
class TextTrackCueGenericBoxElement final : public VTTCueBox {
WTF_MAKE_ISO_ALLOCATED_INLINE(TextTrackCueGenericBoxElement);
Modified: trunk/Source/WebCore/html/track/VTTCue.cpp (251262 => 251263)
--- trunk/Source/WebCore/html/track/VTTCue.cpp 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WebCore/html/track/VTTCue.cpp 2019-10-17 22:18:57 UTC (rev 251263)
@@ -63,9 +63,9 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(VTTCue);
// This constant should correspond with the percentage returned by CaptionUserPreferences::captionFontSizeScaleAndImportance.
-const static double DEFAULTCAPTIONFONTSIZEPERCENTAGE = 5;
+static constexpr double DEFAULTCAPTIONFONTSIZEPERCENTAGE = 5;
-static const int undefinedPosition = -1;
+static constexpr int undefinedPosition = -1;
static const CSSValueID displayWritingModeMap[] = {
CSSValueHorizontalTb, CSSValueVerticalRl, CSSValueVerticalLr
Modified: trunk/Source/WebCore/page/EventHandler.cpp (251262 => 251263)
--- trunk/Source/WebCore/page/EventHandler.cpp 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2019-10-17 22:18:57 UTC (rev 251263)
@@ -216,11 +216,11 @@
// The default values are based on http://dvcs.w3.org/hg/webevents/raw-file/tip/touchevents.html
explicit SyntheticTouchPoint(const PlatformMouseEvent& event)
{
- const static int idDefaultValue = 0;
- const static int radiusYDefaultValue = 1;
- const static int radiusXDefaultValue = 1;
- const static float rotationAngleDefaultValue = 0.0f;
- const static float forceDefaultValue = 1.0f;
+ static constexpr int idDefaultValue = 0;
+ static constexpr int radiusYDefaultValue = 1;
+ static constexpr int radiusXDefaultValue = 1;
+ static constexpr float rotationAngleDefaultValue = 0.0f;
+ static constexpr float forceDefaultValue = 1.0f;
m_id = idDefaultValue; // There is only one active TouchPoint.
m_screenPos = event.globalPosition();
Modified: trunk/Source/WebCore/page/FrameTree.h (251262 => 251263)
--- trunk/Source/WebCore/page/FrameTree.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WebCore/page/FrameTree.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -32,7 +32,7 @@
class FrameTree {
WTF_MAKE_NONCOPYABLE(FrameTree);
public:
- const static unsigned invalidCount = static_cast<unsigned>(-1);
+ static constexpr unsigned invalidCount = static_cast<unsigned>(-1);
FrameTree(Frame& thisFrame, Frame* parentFrame)
: m_thisFrame(thisFrame)
Modified: trunk/Source/WebCore/page/scrolling/ScrollingMomentumCalculator.cpp (251262 => 251263)
--- trunk/Source/WebCore/page/scrolling/ScrollingMomentumCalculator.cpp 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WebCore/page/scrolling/ScrollingMomentumCalculator.cpp 2019-10-17 22:18:57 UTC (rev 251263)
@@ -38,7 +38,7 @@
// by multiplying the initial wheel delta by a constant factor. By running a few experiments (i.e. logging scroll destination and initial
// wheel delta for many scroll gestures) we determined that this is a reasonable way to approximate where scrolling will take us without
// using _NSScrollingMomentumCalculator.
- const static double inertialScrollPredictionFactor = 16.7;
+ static constexpr double inertialScrollPredictionFactor = 16.7;
return inertialScrollPredictionFactor * initialWheelDelta;
}
Modified: trunk/Source/WebCore/platform/graphics/FontTaggedSettings.h (251262 => 251263)
--- trunk/Source/WebCore/platform/graphics/FontTaggedSettings.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WebCore/platform/graphics/FontTaggedSettings.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -52,7 +52,7 @@
static bool isDeletedValue(const FontTag& value) { return value == FontTag({{ ff, ff, ff, ff }}); }
private:
- const static char ff = static_cast<char>(0xFF);
+ static constexpr char ff = static_cast<char>(0xFF);
};
template <typename T>
Modified: trunk/Source/WebCore/platform/graphics/Region.cpp (251262 => 251263)
--- trunk/Source/WebCore/platform/graphics/Region.cpp 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WebCore/platform/graphics/Region.cpp 2019-10-17 22:18:57 UTC (rev 251263)
@@ -249,7 +249,7 @@
}
struct Region::Shape::CompareContainsOperation {
- const static bool defaultResult = true;
+ static constexpr bool defaultResult = true;
inline static bool aOutsideB(bool& /* result */) { return false; }
inline static bool bOutsideA(bool& result) { result = false; return true; }
inline static bool aOverlapsB(bool& /* result */) { return false; }
@@ -256,7 +256,7 @@
};
struct Region::Shape::CompareIntersectsOperation {
- const static bool defaultResult = false;
+ static constexpr bool defaultResult = false;
inline static bool aOutsideB(bool& /* result */) { return false; }
inline static bool bOutsideA(bool& /* result */) { return false; }
inline static bool aOverlapsB(bool& result) { result = true; return true; }
Modified: trunk/Source/WebCore/platform/graphics/filters/FELighting.cpp (251262 => 251263)
--- trunk/Source/WebCore/platform/graphics/filters/FELighting.cpp 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WebCore/platform/graphics/filters/FELighting.cpp 2019-10-17 22:18:57 UTC (rev 251263)
@@ -84,15 +84,15 @@
return true;
}
-const static int cPixelSize = 4;
-const static int cAlphaChannelOffset = 3;
-const static uint8_t cOpaqueAlpha = static_cast<uint8_t>(0xFF);
+static constexpr int cPixelSize = 4;
+static constexpr int cAlphaChannelOffset = 3;
+static constexpr uint8_t cOpaqueAlpha = static_cast<uint8_t>(0xFF);
// These factors and the normal coefficients come from the table under https://www.w3.org/TR/SVG/filters.html#feDiffuseLightingElement.
-const static float cFactor1div2 = -1 / 2.f;
-const static float cFactor1div3 = -1 / 3.f;
-const static float cFactor1div4 = -1 / 4.f;
-const static float cFactor2div3 = -2 / 3.f;
+static constexpr float cFactor1div2 = -1 / 2.f;
+static constexpr float cFactor1div3 = -1 / 3.f;
+static constexpr float cFactor1div4 = -1 / 4.f;
+static constexpr float cFactor2div3 = -2 / 3.f;
inline IntSize FELighting::LightingData::topLeftNormal(int offset) const
{
Modified: trunk/Source/WebCore/rendering/TableLayout.h (251262 => 251263)
--- trunk/Source/WebCore/rendering/TableLayout.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WebCore/rendering/TableLayout.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -46,7 +46,7 @@
protected:
// FIXME: Once we enable SATURATED_LAYOUT_ARITHMETHIC, this should just be LayoutUnit::nearlyMax().
// Until then though, using nearlyMax causes overflow in some tests, so we just pick a large number.
- const static int tableMaxWidth = 1000000;
+ static constexpr int tableMaxWidth = 1000000;
RenderTable* m_table;
};
Modified: trunk/Source/WebCore/rendering/svg/SVGRenderingContext.h (251262 => 251263)
--- trunk/Source/WebCore/rendering/svg/SVGRenderingContext.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderingContext.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -90,7 +90,7 @@
};
// List of those flags which require actions during the destructor.
- const static int ActionsNeeded = RestoreGraphicsContext | EndOpacityLayer | EndShadowLayer | EndFilterLayer;
+ static constexpr int ActionsNeeded = RestoreGraphicsContext | EndOpacityLayer | EndShadowLayer | EndFilterLayer;
RenderElement* m_renderer { nullptr };
PaintInfo* m_paintInfo { nullptr };
Modified: trunk/Source/WebKit/ChangeLog (251262 => 251263)
--- trunk/Source/WebKit/ChangeLog 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WebKit/ChangeLog 2019-10-17 22:18:57 UTC (rev 251263)
@@ -1,3 +1,13 @@
+2019-10-17 Mark Lam <mark....@apple.com>
+
+ Use constexpr in more places and remove some unnecessary external linkage.
+ https://bugs.webkit.org/show_bug.cgi?id=203115
+
+ Reviewed by Yusuke Suzuki.
+
+ * UIProcess/API/APIContentRuleListStore.h:
+ * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm:
+
2019-10-17 Antoine Quint <grao...@apple.com>
[Web Animations] Enable the Web Animations _javascript_ API by default
Modified: trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.h (251262 => 251263)
--- trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.h 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.h 2019-10-17 22:18:57 UTC (rev 251263)
@@ -57,7 +57,7 @@
// Also update ContentRuleListStore::getContentRuleListSource to be able to find the original JSON
// source from old versions.
// Update ContentRuleListStore::getContentRuleListSource with this.
- const static uint32_t CurrentContentRuleListFileVersion = 10;
+ static constexpr uint32_t CurrentContentRuleListFileVersion = 10;
static ContentRuleListStore& defaultStore(bool legacyFilename);
static Ref<ContentRuleListStore> storeWithPath(const WTF::String& storePath, bool legacyFilename);
Modified: trunk/Source/WebKit/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm (251262 => 251263)
--- trunk/Source/WebKit/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Source/WebKit/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm 2019-10-17 22:18:57 UTC (rev 251263)
@@ -34,7 +34,7 @@
#import <QuartzCore/QuartzCore.h>
#import <WebCore/WebCoreCALayerExtras.h>
-const static double fadeInDuration = 0.5;
+static constexpr double fadeInDuration = 0.5;
namespace WebKit {
Modified: trunk/Tools/ChangeLog (251262 => 251263)
--- trunk/Tools/ChangeLog 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Tools/ChangeLog 2019-10-17 22:18:57 UTC (rev 251263)
@@ -1,3 +1,14 @@
+2019-10-17 Mark Lam <mark....@apple.com>
+
+ Use constexpr in more places and remove some unnecessary external linkage.
+ https://bugs.webkit.org/show_bug.cgi?id=203115
+
+ Reviewed by Yusuke Suzuki.
+
+ * TestWebKitAPI/Tests/WTF/WeakPtr.cpp:
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/mac/IsNavigationActionTrusted.mm:
+
2019-10-17 Sihui Liu <sihui_...@apple.com>
Using version 1 CFRunloopSource for faster task dispatch
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp (251262 => 251263)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp 2019-10-17 22:18:57 UTC (rev 251263)
@@ -560,7 +560,7 @@
TEST(WTF_WeakPtr, WeakHashSetExpansion)
{
unsigned initialCapacity;
- const static unsigned maxLoadCap = 3;
+ static constexpr unsigned maxLoadCap = 3;
{
WeakHashSet<Base> weakHashSet;
Base object;
Modified: trunk/Tools/TestWebKitAPI/Tests/mac/IsNavigationActionTrusted.mm (251262 => 251263)
--- trunk/Tools/TestWebKitAPI/Tests/mac/IsNavigationActionTrusted.mm 2019-10-17 22:15:09 UTC (rev 251262)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/IsNavigationActionTrusted.mm 2019-10-17 22:18:57 UTC (rev 251263)
@@ -31,11 +31,11 @@
#import <wtf/RetainPtr.h>
static bool didFinishTest;
-const static NSURL *targetUrl = [[NSURL alloc] initWithString:@"http://www.example.com/"];
-const static unsigned expectedModifierFlags = 0;
-const static int expectedButtonNumber = -2;
+static const NSURL *targetUrl = [[NSURL alloc] initWithString:@"http://www.example.com/"];
+static constexpr unsigned expectedModifierFlags = 0;
+static constexpr int expectedButtonNumber = -2;
-const static int expectedWKButtonNumber = 0; // unlike DOM spec, 0 is the value for no button in Cocoa.
+static constexpr int expectedWKButtonNumber = 0; // unlike DOM spec, 0 is the value for no button in Cocoa.
@interface NavigationActionDelegate : NSObject <WKNavigationDelegate>
@end