Bug 1542736 - Part 7: Replace std::tolower with js::unicode::ToLowerCase. r=jwalden
authorAndré Bargull <andre.bargull@gmail.com>
Thu, 11 Apr 2019 11:37:18 +0000
changeset 469058 ed1ef97375801e123d5edf8bbe569f8411852004
parent 469057 e130d82fa361173eb53c78c030e705170c6a8e0d
child 469059 ad9ff91000a99f6f12ea5338776aa883659c2986
push id35856
push usercsabou@mozilla.com
push dateFri, 12 Apr 2019 03:19:48 +0000
treeherdermozilla-central@940684cd1065 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs1542736
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1542736 - Part 7: Replace std::tolower with js::unicode::ToLowerCase. r=jwalden std::tolower can be safely replaced with js::unicode::ToLowerCase in both contexts. Differential Revision: https://phabricator.services.mozilla.com/D26510
js/src/jit/LIR.cpp
js/src/jit/MIR.cpp
--- a/js/src/jit/LIR.cpp
+++ b/js/src/jit/LIR.cpp
@@ -3,23 +3,23 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "jit/LIR.h"
 
 #include "mozilla/ScopeExit.h"
 
-#include <ctype.h>
 #include <type_traits>
 
 #include "jit/JitSpewer.h"
 #include "jit/MIR.h"
 #include "jit/MIRGenerator.h"
 #include "js/Printf.h"
+#include "util/Unicode.h"
 
 using namespace js;
 using namespace js::jit;
 
 LIRGraph::LIRGraph(MIRGraph* mir)
     : blocks_(),
       constantPool_(mir->alloc()),
       constantPoolMap_(mir->alloc()),
@@ -329,17 +329,17 @@ void LNode::printName(GenericPrinter& ou
   static const char* const names[] = {
 #  define LIROP(x) #  x,
       LIR_OPCODE_LIST(LIROP)
 #  undef LIROP
   };
   const char* name = names[uint32_t(op)];
   size_t len = strlen(name);
   for (size_t i = 0; i < len; i++) {
-    out.printf("%c", tolower(name[i]));
+    out.printf("%c", unicode::ToLowerCase(name[i]));
   }
 }
 
 void LNode::printName(GenericPrinter& out) { printName(out, op()); }
 #endif
 
 bool LAllocation::aliases(const LAllocation& other) const {
   if (isFloatReg() && other.isFloatReg()) {
--- a/js/src/jit/MIR.cpp
+++ b/js/src/jit/MIR.cpp
@@ -7,30 +7,29 @@
 #include "jit/MIR.h"
 
 #include "mozilla/CheckedInt.h"
 #include "mozilla/EndianUtils.h"
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/IntegerPrintfMacros.h"
 #include "mozilla/MathAlgorithms.h"
 
-#include <ctype.h>
-
 #include "jslibmath.h"
 
 #include "builtin/RegExp.h"
 #include "builtin/String.h"
 #include "jit/AtomicOperations.h"
 #include "jit/BaselineInspector.h"
 #include "jit/IonBuilder.h"
 #include "jit/JitSpewer.h"
 #include "jit/MIRGraph.h"
 #include "jit/RangeAnalysis.h"
 #include "js/Conversions.h"
 #include "util/Text.h"
+#include "util/Unicode.h"
 #include "wasm/WasmCode.h"
 
 #include "builtin/Boolean-inl.h"
 
 #include "vm/JSAtom-inl.h"
 #include "vm/JSObject-inl.h"
 #include "vm/JSScript-inl.h"
 
@@ -76,17 +75,17 @@ static const char* OpcodeName(MDefinitio
   };
   return names[unsigned(op)];
 }
 
 void MDefinition::PrintOpcodeName(GenericPrinter& out, Opcode op) {
   const char* name = OpcodeName(op);
   size_t len = strlen(name);
   for (size_t i = 0; i < len; i++) {
-    out.printf("%c", tolower(name[i]));
+    out.printf("%c", unicode::ToLowerCase(name[i]));
   }
 }
 #endif
 
 static MConstant* EvaluateConstantOperands(TempAllocator& alloc,
                                            MBinaryInstruction* ins,
                                            bool* ptypeChange = nullptr) {
   MDefinition* left = ins->getOperand(0);