Skip to content

Commit adcd97e

Browse files
committed
Further remove MSVC code
https://bugs.webkit.org/show_bug.cgi?id=274450 rdar://128448731 Reviewed by Ross Kirsling. Further remove MSVC hacks. And we use `OS(WINDOWS)` for code which needs to be used on Windows (even without MSVC). * Source/JavaScriptCore/API/tests/testapi.c: * Source/JavaScriptCore/API/tests/testapi.cpp: * Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp: (JSC::MacroAssembler::probe): (JSC::MacroAssemblerX86Common::getCPUIDEx): * Source/JavaScriptCore/assembler/X86Assembler.h: * Source/JavaScriptCore/builtins/BuiltinNames.cpp: * Source/JavaScriptCore/config.h: * Source/JavaScriptCore/jit/PCToCodeOriginMap.cpp: * Source/JavaScriptCore/jit/RegisterAtOffset.cpp: * Source/JavaScriptCore/jsc.cpp: (JSC_DEFINE_HOST_FUNCTION): (jscmain): * Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb: * Source/JavaScriptCore/parser/SourceProviderCacheItem.h: * Source/JavaScriptCore/runtime/JSCPtrTag.h: * Source/JavaScriptCore/runtime/VM.h: * Source/JavaScriptCore/testRegExp.cpp: * Source/WTF/wtf/Assertions.cpp: (WTF::createWithFormatAndArguments): * Source/WTF/wtf/Assertions.h: * Source/WTF/wtf/MathExtras.h: * Source/WTF/wtf/PtrTag.h: * Source/WTF/wtf/SegmentedVector.h: * Source/WTF/wtf/posix/ThreadingPOSIX.cpp: Canonical link: https://commits.webkit.org/279108@main
1 parent a3161bf commit adcd97e

20 files changed

Lines changed: 15 additions & 145 deletions

Source/JavaScriptCore/API/tests/testapi.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@
7171
#include "PingPongStackOverflowTest.h"
7272
#include "TypedArrayCTest.h"
7373

74-
#if COMPILER(MSVC)
75-
#pragma warning(disable:4204)
76-
#endif
77-
7874
#if JSC_OBJC_API_ENABLED
7975
void testObjectiveCAPI(const char*);
8076
#endif

Source/JavaScriptCore/API/tests/testapi.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -227,30 +227,6 @@ TestAPI::ScriptResult TestAPI::callFunction(const char* functionSource, Argument
227227
return Unexpected<JSValueRef>(exception);
228228
}
229229

230-
#if COMPILER(MSVC)
231-
template<>
232-
TestAPI::ScriptResult TestAPI::callFunction(const char* functionSource)
233-
{
234-
JSValueRef function;
235-
{
236-
ScriptResult functionResult = evaluateScript(functionSource);
237-
if (!functionResult)
238-
return functionResult;
239-
function = functionResult.value();
240-
}
241-
242-
JSValueRef exception = nullptr;
243-
if (JSObjectRef functionObject = JSValueToObject(context, function, &exception)) {
244-
JSValueRef result = JSObjectCallAsFunction(context, functionObject, functionObject, 0, nullptr, &exception);
245-
if (!exception)
246-
return ScriptResult(result);
247-
}
248-
249-
RELEASE_ASSERT(exception);
250-
return Unexpected<JSValueRef>(exception);
251-
}
252-
#endif
253-
254230
template<typename... ArgumentTypes>
255231
bool TestAPI::functionReturnsTrue(const char* functionSource, ArgumentTypes... arguments)
256232
{

Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ void MacroAssembler::probe(Probe::Function function, void* arg, SavedFPWidth sav
10021002
#endif
10031003
move(TrustedImmPtr(reinterpret_cast<void*>(ctiMasmProbeTrampoline)), RegisterID::eax);
10041004

1005-
#if COMPILER(MSVC) || CPU(X86)
1005+
#if CPU(X86)
10061006
push(RegisterID::ecx);
10071007
move(TrustedImmPtr(reinterpret_cast<void*>(Probe::executeJSCJITProbe)), RegisterID::ecx);
10081008
#endif
@@ -1021,15 +1021,11 @@ MacroAssemblerX86Common::CPUID MacroAssemblerX86Common::getCPUID(unsigned level)
10211021
MacroAssemblerX86Common::CPUID MacroAssemblerX86Common::getCPUIDEx(unsigned level, unsigned count)
10221022
{
10231023
CPUID result { };
1024-
#if COMPILER(MSVC)
1025-
__cpuidex(bitwise_cast<int*>(result.data()), level, count);
1026-
#else
10271024
__asm__ (
10281025
"cpuid\n"
10291026
: "=a"(result[0]), "=b"(result[1]), "=c"(result[2]), "=d"(result[3])
10301027
: "0"(level), "2"(count)
10311028
);
1032-
#endif
10331029
return result;
10341030
}
10351031

Source/JavaScriptCore/assembler/X86Assembler.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,18 @@ inline bool CAN_SIGN_EXTEND_8_32(int32_t value) { return value == (int32_t)(sign
4343

4444
namespace RegisterNames {
4545

46-
#if COMPILER(MSVC)
47-
#define JSC_X86_ASM_REGISTER_ID_ENUM_BASE_TYPE
48-
#else
49-
#define JSC_X86_ASM_REGISTER_ID_ENUM_BASE_TYPE : int8_t
50-
#endif
51-
5246
#define REGISTER_ID(id, name, res, cs) id,
5347

54-
typedef enum JSC_X86_ASM_REGISTER_ID_ENUM_BASE_TYPE {
48+
typedef enum : int8_t {
5549
FOR_EACH_GP_REGISTER(REGISTER_ID)
5650
InvalidGPRReg = -1,
5751
} RegisterID;
5852

59-
typedef enum JSC_X86_ASM_REGISTER_ID_ENUM_BASE_TYPE {
53+
typedef enum : int8_t {
6054
FOR_EACH_SP_REGISTER(REGISTER_ID)
6155
} SPRegisterID;
6256

63-
typedef enum JSC_X86_ASM_REGISTER_ID_ENUM_BASE_TYPE {
57+
typedef enum : int8_t {
6458
FOR_EACH_FP_REGISTER(REGISTER_ID)
6559
InvalidFPRReg = -1,
6660
} XMMRegisterID;

Source/JavaScriptCore/builtins/BuiltinNames.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030
#include "IdentifierInlines.h"
3131
#include <wtf/TZoneMallocInlines.h>
3232

33-
#if COMPILER(MSVC)
34-
#pragma warning(push)
35-
#pragma warning(disable:4307)
36-
#endif
37-
3833
namespace JSC {
3934
namespace Symbols {
4035

@@ -182,7 +177,3 @@ SymbolImpl* BuiltinNames::lookUpWellKnownSymbol(const String& string) const
182177
}
183178

184179
} // namespace JSC
185-
186-
#if COMPILER(MSVC)
187-
#pragma warning(pop)
188-
#endif

Source/JavaScriptCore/config.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,3 @@
4141
#endif
4242

4343
#include <wtf/DisallowCType.h>
44-
45-
/* Disabling warning C4206: nonstandard extension used: translation unit is empty.
46-
By design, we rely on #define flags to make some translation units empty.
47-
Make sure this warning does not turn into an error.
48-
*/
49-
#if COMPILER(MSVC)
50-
#pragma warning(disable:4206)
51-
#endif

Source/JavaScriptCore/jit/PCToCodeOriginMap.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@
3434
#include "WasmOpcodeOrigin.h"
3535
#include <wtf/TZoneMallocInlines.h>
3636

37-
#if COMPILER(MSVC)
38-
// See https://msdn.microsoft.com/en-us/library/4wz07268.aspx
39-
#pragma warning(disable: 4333)
40-
#endif
41-
4237
namespace JSC {
4338

4439
namespace {

Source/JavaScriptCore/jit/RegisterAtOffset.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ class RegisterAtOffset {
7777
void dump(PrintStream& out) const;
7878

7979
private:
80-
unsigned m_regIndex : 7 = Reg().index();
81-
bool m_width : 1 = false;
82-
ptrdiff_t m_offsetBits : (sizeof(ptrdiff_t) * CHAR_BIT - 7 - 1) = 0;
80+
unsigned m_regIndex : 7 { Reg().index() };
81+
unsigned m_width : 1 { false };
82+
ptrdiff_t m_offsetBits : (sizeof(ptrdiff_t) * CHAR_BIT - 7 - 1) { 0 };
8383
};
8484

8585
} // namespace JSC

Source/JavaScriptCore/jsc.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
#undef Function
141141
#endif
142142

143-
#if COMPILER(MSVC)
143+
#if OS(WINDOWS)
144144
#include <crtdbg.h>
145145
#include <mmsystem.h>
146146
#include <windows.h>
@@ -2813,11 +2813,6 @@ JSC_DEFINE_HOST_FUNCTION(functionQuit, (JSGlobalObject* globalObject, CallFrame*
28132813
vm.codeCache()->write();
28142814

28152815
jscExit(EXIT_SUCCESS);
2816-
2817-
#if COMPILER(MSVC) && !COMPILER(CLANG)
2818-
// Without this, Visual Studio will complain that this method does not return a value.
2819-
return JSValue::encode(jsUndefined());
2820-
#endif
28212816
}
28222817

28232818
JSC_DEFINE_HOST_FUNCTION(functionFalse, (JSGlobalObject*, CallFrame*))
@@ -4366,7 +4361,7 @@ int jscmain(int argc, char** argv)
43664361
enableSuperSampler();
43674362

43684363
bool gigacageDisableRequested = false;
4369-
#if GIGACAGE_ENABLED && !COMPILER(MSVC)
4364+
#if GIGACAGE_ENABLED && !OS(WINDOWS)
43704365
if (char* gigacageEnabled = getenv("GIGACAGE_ENABLED")) {
43714366
if (!strcasecmp(gigacageEnabled, "no") || !strcasecmp(gigacageEnabled, "false") || !strcasecmp(gigacageEnabled, "0"))
43724367
gigacageDisableRequested = true;

Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,7 @@ def emitMagicNumber
116116
constsList = constsList(lowLevelAST)
117117

118118
emitCodeInConfiguration(concreteSettings, lowLevelAST, backend) {
119-
120119
# Windows complains about signed integers being cast to unsigned but we just want the bits.
121-
outp.puts "\#if COMPILER(MSVC)"
122-
outp.puts "\#pragma warning(disable:4308)"
123-
outp.puts "\#endif"
124120
constsList.each_with_index {
125121
| const, index |
126122
outp.puts "constexpr int64_t constValue#{index} = static_cast<int64_t>(#{const.value});"

0 commit comments

Comments
 (0)