Changeset 231403 in webkit
- Timestamp:
- May 6, 2018, 7:46:40 PM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 16 edited
-
JavaScriptCore/API/JSClassRef.cpp (modified) (2 diffs)
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/bytecode/Opcode.cpp (modified) (1 diff)
-
JavaScriptCore/bytecompiler/BytecodeGenerator.cpp (modified) (2 diffs)
-
JavaScriptCore/heap/Heap.cpp (modified) (3 diffs)
-
JavaScriptCore/interpreter/Interpreter.cpp (modified) (1 diff)
-
JavaScriptCore/jit/JIT.cpp (modified) (1 diff)
-
JavaScriptCore/parser/Parser.cpp (modified) (1 diff)
-
JavaScriptCore/runtime/JSArray.cpp (modified) (1 diff)
-
JavaScriptCore/runtime/JSLexicalEnvironment.cpp (modified) (1 diff)
-
JavaScriptCore/runtime/JSModuleEnvironment.cpp (modified) (1 diff)
-
JavaScriptCore/runtime/Structure.cpp (modified) (1 diff)
-
JavaScriptCore/shell/DLLLauncherMain.cpp (modified) (8 diffs)
-
bmalloc/ChangeLog (modified) (1 diff)
-
bmalloc/bmalloc/Allocator.cpp (modified) (1 diff)
-
bmalloc/bmalloc/Deallocator.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSClassRef.cpp
r207542 r231403 38 38 #include <wtf/unicode/UTF8.h> 39 39 40 using namespace std;41 40 using namespace JSC; 42 41 using namespace WTF::Unicode; … … 120 119 JSClassDefinition protoDefinition = kJSClassDefinitionEmpty; 121 120 protoDefinition.finalize = 0; 122 s wap(definition.staticFunctions, protoDefinition.staticFunctions); // Move static functions to the prototype.121 std::swap(definition.staticFunctions, protoDefinition.staticFunctions); // Move static functions to the prototype. 123 122 124 123 // We are supposed to use JSClassRetain/Release but since we know that we currently have -
trunk/Source/JavaScriptCore/ChangeLog
r231399 r231403 1 2018-05-06 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 [JSC] Remove "using namespace std;" from JSC, bmalloc, WTF 4 https://bugs.webkit.org/show_bug.cgi?id=185362 5 6 Reviewed by Sam Weinig. 7 8 "namespace std" may include many names. It can conflict with names defined by our code, 9 and the other platform provided headers. For example, std::byte conflicts with Windows' 10 ::byte. 11 This patch removes "using namespace std;" from JSC and bmalloc. 12 13 * API/JSClassRef.cpp: 14 (OpaqueJSClass::create): 15 * bytecode/Opcode.cpp: 16 * bytecompiler/BytecodeGenerator.cpp: 17 (JSC::BytecodeGenerator::newRegister): 18 * heap/Heap.cpp: 19 (JSC::Heap::updateAllocationLimits): 20 * interpreter/Interpreter.cpp: 21 * jit/JIT.cpp: 22 * parser/Parser.cpp: 23 * runtime/JSArray.cpp: 24 * runtime/JSLexicalEnvironment.cpp: 25 * runtime/JSModuleEnvironment.cpp: 26 * runtime/Structure.cpp: 27 * shell/DLLLauncherMain.cpp: 28 (getStringValue): 29 (applePathFromRegistry): 30 (appleApplicationSupportDirectory): 31 (copyEnvironmentVariable): 32 (prependPath): 33 (fatalError): 34 (directoryExists): 35 (modifyPath): 36 (getLastErrorString): 37 (wWinMain): 38 1 39 2018-05-05 Filip Pizlo <fpizlo@apple.com> 2 40 -
trunk/Source/JavaScriptCore/bytecode/Opcode.cpp
r192326 r231403 37 37 #include <wtf/DataLog.h> 38 38 #endif 39 40 using namespace std;41 39 42 40 namespace JSC { -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r231316 r231403 64 64 #include <wtf/StdLibExtras.h> 65 65 #include <wtf/text/WTFString.h> 66 67 using namespace std;68 66 69 67 namespace JSC { … … 1197 1195 { 1198 1196 m_calleeLocals.append(virtualRegisterForLocal(m_calleeLocals.size())); 1199 int numCalleeLocals = max<int>(m_codeBlock->m_numCalleeLocals, m_calleeLocals.size());1197 int numCalleeLocals = std::max<int>(m_codeBlock->m_numCalleeLocals, m_calleeLocals.size()); 1200 1198 numCalleeLocals = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), numCalleeLocals); 1201 1199 m_codeBlock->m_numCalleeLocals = numCalleeLocals; -
trunk/Source/JavaScriptCore/heap/Heap.cpp
r230956 r231403 103 103 #endif 104 104 105 using namespace std;106 107 105 namespace JSC { 108 106 … … 121 119 { 122 120 if (heapType == LargeHeap) { 123 double result = min(121 double result = std::min( 124 122 static_cast<double>(Options::largeHeapSize()), 125 123 ramSize * Options::smallHeapRAMFraction()); … … 2232 2230 // the new allocation limit based on the current size of the heap, with a 2233 2231 // fixed minimum. 2234 m_maxHeapSize = max(minHeapSize(m_heapType, m_ramSize), proportionalHeapSize(currentHeapSize, m_ramSize));2232 m_maxHeapSize = std::max(minHeapSize(m_heapType, m_ramSize), proportionalHeapSize(currentHeapSize, m_ramSize)); 2235 2233 if (verbose) 2236 2234 dataLog("Full: maxHeapSize = ", m_maxHeapSize, "\n"); -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r229547 r231403 91 91 #endif 92 92 93 using namespace std;94 95 93 namespace JSC { 96 94 -
trunk/Source/JavaScriptCore/jit/JIT.cpp
r231343 r231403 55 55 #include <wtf/GraphNodeWorklist.h> 56 56 #include <wtf/SimpleStats.h> 57 58 using namespace std;59 57 60 58 namespace JSC { -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r231142 r231403 86 86 87 87 #define semanticFailureDueToKeyword(...) semanticFailureDueToKeywordCheckingToken(m_token, __VA_ARGS__); 88 89 using namespace std;90 88 91 89 namespace JSC { -
trunk/Source/JavaScriptCore/runtime/JSArray.cpp
r231198 r231403 35 35 #include "TypeError.h" 36 36 #include <wtf/Assertions.h> 37 38 using namespace std;39 using namespace WTF;40 37 41 38 namespace JSC { -
trunk/Source/JavaScriptCore/runtime/JSLexicalEnvironment.cpp
r223746 r231403 34 34 #include "JSFunction.h" 35 35 #include "JSCInlines.h" 36 37 using namespace std;38 36 39 37 namespace JSC { -
trunk/Source/JavaScriptCore/runtime/JSModuleEnvironment.cpp
r230759 r231403 34 34 #include "JSCInlines.h" 35 35 #include "JSFunction.h" 36 37 using namespace std;38 36 39 37 namespace JSC { -
trunk/Source/JavaScriptCore/runtime/Structure.cpp
r231345 r231403 47 47 #define DUMP_STRUCTURE_ID_STATISTICS 0 48 48 49 using namespace std;50 using namespace WTF;51 52 49 namespace JSC { 53 50 -
trunk/Source/JavaScriptCore/shell/DLLLauncherMain.cpp
r225767 r231403 36 36 #include <windows.h> 37 37 38 using namespace std;39 40 38 #if defined _M_IX86 41 39 #define PROCESSORARCHITECTURE "x86" … … 59 57 } 60 58 61 static wstring getStringValue(HKEY key, constwstring& valueName)59 static std::wstring getStringValue(HKEY key, const std::wstring& valueName) 62 60 { 63 61 DWORD type = 0; 64 62 DWORD bufferSize = 0; 65 63 if (::RegQueryValueExW(key, valueName.c_str(), 0, &type, 0, &bufferSize) != ERROR_SUCCESS || type != REG_SZ) 66 return wstring();67 68 vector<wchar_t> buffer(bufferSize / sizeof(wchar_t));64 return std::wstring(); 65 66 std::vector<wchar_t> buffer(bufferSize / sizeof(wchar_t)); 69 67 if (::RegQueryValueExW(key, valueName.c_str(), 0, &type, reinterpret_cast<LPBYTE>(&buffer[0]), &bufferSize) != ERROR_SUCCESS) 70 return wstring();68 return std::wstring(); 71 69 72 70 return &buffer[0]; 73 71 } 74 72 75 static wstring applePathFromRegistry(const wstring& key, constwstring& value)73 static std::wstring applePathFromRegistry(const std::wstring& key, const std::wstring& value) 76 74 { 77 75 HKEY applePathKey = 0; 78 76 if (::RegOpenKeyExW(HKEY_LOCAL_MACHINE, key.c_str(), 0, KEY_READ, &applePathKey) != ERROR_SUCCESS) 79 return wstring();80 wstring path = getStringValue(applePathKey, value);77 return std::wstring(); 78 std::wstring path = getStringValue(applePathKey, value); 81 79 ::RegCloseKey(applePathKey); 82 80 return path; 83 81 } 84 82 85 static wstring appleApplicationSupportDirectory()83 static std::wstring appleApplicationSupportDirectory() 86 84 { 87 85 return applePathFromRegistry(L"SOFTWARE\\Apple Inc.\\Apple Application Support", L"InstallDir"); 88 86 } 89 87 90 static wstring copyEnvironmentVariable(constwstring& variable)88 static std::wstring copyEnvironmentVariable(const std::wstring& variable) 91 89 { 92 90 DWORD length = ::GetEnvironmentVariableW(variable.c_str(), 0, 0); 93 91 if (!length) 94 return wstring();95 vector<wchar_t> buffer(length);92 return std::wstring(); 93 std::vector<wchar_t> buffer(length); 96 94 if (!GetEnvironmentVariable(variable.c_str(), &buffer[0], buffer.size()) || !buffer[0]) 97 return wstring();95 return std::wstring(); 98 96 return &buffer[0]; 99 97 } 100 98 101 static bool prependPath(const wstring& directoryToPrepend)102 { 103 wstring pathVariable = L"PATH";104 wstring oldPath = copyEnvironmentVariable(pathVariable);105 wstring newPath = directoryToPrepend + L';' + oldPath;99 static bool prependPath(const std::wstring& directoryToPrepend) 100 { 101 std::wstring pathVariable = L"PATH"; 102 std::wstring oldPath = copyEnvironmentVariable(pathVariable); 103 std::wstring newPath = directoryToPrepend + L';' + oldPath; 106 104 return ::SetEnvironmentVariableW(pathVariable.c_str(), newPath.c_str()); 107 105 } 108 106 109 static int fatalError(const wstring& programName, constwstring& message)110 { 111 wstring caption = programName + L" can't open.";107 static int fatalError(const std::wstring& programName, const std::wstring& message) 108 { 109 std::wstring caption = programName + L" can't open."; 112 110 ::MessageBoxW(0, message.c_str(), caption.c_str(), MB_ICONERROR); 113 111 return 1; 114 112 } 115 113 116 static bool directoryExists(const wstring& path)114 static bool directoryExists(const std::wstring& path) 117 115 { 118 116 DWORD attrib = ::GetFileAttributes(path.c_str()); … … 121 119 } 122 120 123 static bool modifyPath(const wstring& programName)121 static bool modifyPath(const std::wstring& programName) 124 122 { 125 123 #ifdef WIN_CAIRO 126 124 127 wstring pathWinCairo = copyEnvironmentVariable(L"WEBKIT_LIBRARIES");125 std::wstring pathWinCairo = copyEnvironmentVariable(L"WEBKIT_LIBRARIES"); 128 126 if (!directoryExists(pathWinCairo)) 129 127 return true; … … 141 139 #else 142 140 143 const wstring& pathPrefix = appleApplicationSupportDirectory();141 const std::wstring& pathPrefix = appleApplicationSupportDirectory(); 144 142 145 143 if (!directoryExists(pathPrefix)) { … … 156 154 } 157 155 158 static wstring getLastErrorString(HRESULT hr)156 static std::wstring getLastErrorString(HRESULT hr) 159 157 { 160 158 static const DWORD kFlags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS; … … 186 184 ::PathRemoveExtensionW(exePath); 187 185 188 wstring programName = ::PathFindFileNameW(exePath);186 std::wstring programName = ::PathFindFileNameW(exePath); 189 187 190 188 if (!modifyPath(programName)) … … 192 190 193 191 // Load our corresponding DLL. 194 wstring dllName = programName + L"Lib.dll";192 std::wstring dllName = programName + L"Lib.dll"; 195 193 if (!::PathRemoveFileSpecW(exePath)) 196 194 return fatalError(programName, L"::PathRemoveFileSpecW failed: " + getLastErrorString(::GetLastError())); … … 199 197 HMODULE module = ::LoadLibraryW(exePath); 200 198 if (!module) 201 return fatalError(programName, L"::LoadLibraryW failed: \npath=" + wstring(exePath) + L"\n" + getLastErrorString(::GetLastError()));199 return fatalError(programName, L"::LoadLibraryW failed: \npath=" + std::wstring(exePath) + L"\n" + getLastErrorString(::GetLastError())); 202 200 203 201 #if USE_CONSOLE_ENTRY_POINT -
trunk/Source/bmalloc/ChangeLog
r231337 r231403 1 2018-05-06 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 [JSC] Remove "using namespace std;" from JSC, bmalloc, WTF 4 https://bugs.webkit.org/show_bug.cgi?id=185362 5 6 Reviewed by Sam Weinig. 7 8 * bmalloc/Allocator.cpp: 9 * bmalloc/Deallocator.cpp: 10 1 11 2018-05-03 Filip Pizlo <fpizlo@apple.com> 2 12 -
trunk/Source/bmalloc/bmalloc/Allocator.cpp
r230501 r231403 35 35 #include <cstdlib> 36 36 37 using namespace std;38 39 37 namespace bmalloc { 40 38 -
trunk/Source/bmalloc/bmalloc/Deallocator.cpp
r230501 r231403 35 35 #include <cstdlib> 36 36 #include <sys/mman.h> 37 38 using namespace std;39 37 40 38 namespace bmalloc {
Note:
See TracChangeset
for help on using the changeset viewer.