Title: [243633] trunk/Source/_javascript_Core
- Revision
- 243633
- Author
- [email protected]
- Date
- 2019-03-28 18:29:27 -0700 (Thu, 28 Mar 2019)
Log Message
Opcode.h(159,27): warning: adding 'unsigned int' to a string does not append to the string [-Wstring-plus-int]
https://bugs.webkit.org/show_bug.cgi?id=196343
Reviewed by Saam Barati.
Clang reports a compilation warning and recommend '&PADDING_STRING[PADDING_STRING_LENGTH]'
instead of 'PADDING_STRING + PADDING_STRING_LENGTH'.
* bytecode/Opcode.cpp:
(JSC::padOpcodeName): Moved padOpcodeName from Opcode.h because
this function is used only in Opcode.cpp. Changed macros
PADDING_STRING and PADDING_STRING_LENGTH to simple variables.
(JSC::compareOpcodePairIndices): Replaced pair with std::pair.
* bytecode/Opcode.h:
(JSC::padOpcodeName): Moved.
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (243632 => 243633)
--- trunk/Source/_javascript_Core/ChangeLog 2019-03-29 01:15:59 UTC (rev 243632)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-03-29 01:29:27 UTC (rev 243633)
@@ -1,3 +1,21 @@
+2019-03-28 Fujii Hironori <[email protected]>
+
+ Opcode.h(159,27): warning: adding 'unsigned int' to a string does not append to the string [-Wstring-plus-int]
+ https://bugs.webkit.org/show_bug.cgi?id=196343
+
+ Reviewed by Saam Barati.
+
+ Clang reports a compilation warning and recommend '&PADDING_STRING[PADDING_STRING_LENGTH]'
+ instead of 'PADDING_STRING + PADDING_STRING_LENGTH'.
+
+ * bytecode/Opcode.cpp:
+ (JSC::padOpcodeName): Moved padOpcodeName from Opcode.h because
+ this function is used only in Opcode.cpp. Changed macros
+ PADDING_STRING and PADDING_STRING_LENGTH to simple variables.
+ (JSC::compareOpcodePairIndices): Replaced pair with std::pair.
+ * bytecode/Opcode.h:
+ (JSC::padOpcodeName): Moved.
+
2019-03-28 Tadeu Zagallo <[email protected]>
CodeBlock::jettison() should disallow repatching its own calls
Modified: trunk/Source/_javascript_Core/bytecode/Opcode.cpp (243632 => 243633)
--- trunk/Source/_javascript_Core/bytecode/Opcode.cpp 2019-03-29 01:15:59 UTC (rev 243632)
+++ trunk/Source/_javascript_Core/bytecode/Opcode.cpp 2019-03-29 01:29:27 UTC (rev 243633)
@@ -54,6 +54,18 @@
#if ENABLE(OPCODE_STATS)
+inline const char* padOpcodeName(OpcodeID op, unsigned width)
+{
+ auto padding = " ";
+ auto paddingLength = strlen(padding);
+ auto opcodeNameLength = strlen(opcodeNames[op]);
+ if (opcodeNameLength >= width)
+ return "";
+ if (paddingLength + opcodeNameLength < width)
+ return padding;
+ return &padding[paddingLength + opcodeNameLength - width];
+}
+
long long OpcodeStats::opcodeCounts[numOpcodeIDs];
long long OpcodeStats::opcodePairCounts[numOpcodeIDs][numOpcodeIDs];
int OpcodeStats::lastOpcode = -1;
@@ -85,9 +97,9 @@
static int compareOpcodePairIndices(const void* left, const void* right)
{
- std::pair<int, int> leftPair = *(pair<int, int>*) left;
+ std::pair<int, int> leftPair = *(std::pair<int, int>*) left;
long long leftValue = OpcodeStats::opcodePairCounts[leftPair.first][leftPair.second];
- std::pair<int, int> rightPair = *(pair<int, int>*) right;
+ std::pair<int, int> rightPair = *(std::pair<int, int>*) right;
long long rightValue = OpcodeStats::opcodePairCounts[rightPair.first][rightPair.second];
if (leftValue < rightValue)
Modified: trunk/Source/_javascript_Core/bytecode/Opcode.h (243632 => 243633)
--- trunk/Source/_javascript_Core/bytecode/Opcode.h 2019-03-29 01:15:59 UTC (rev 243632)
+++ trunk/Source/_javascript_Core/bytecode/Opcode.h 2019-03-29 01:29:27 UTC (rev 243633)
@@ -147,21 +147,8 @@
typedef OpcodeID Opcode;
#endif
-#define PADDING_STRING " "
-#define PADDING_STRING_LENGTH static_cast<unsigned>(strlen(PADDING_STRING))
-
extern const char* const opcodeNames[];
-inline const char* padOpcodeName(OpcodeID op, unsigned width)
-{
- unsigned pad = width - strlen(opcodeNames[op]);
- pad = std::min(pad, PADDING_STRING_LENGTH);
- return PADDING_STRING + PADDING_STRING_LENGTH - pad;
-}
-
-#undef PADDING_STRING_LENGTH
-#undef PADDING_STRING
-
#if ENABLE(OPCODE_STATS)
struct OpcodeStats {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes