Changeset 267371 in webkit
- Timestamp:
- Sep 21, 2020 3:01:12 PM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r267370 r267371 1 2020-09-21 Mark Lam <mark.lam@apple.com> 2 3 Move some LLInt globals into JSC::Config. 4 https://bugs.webkit.org/show_bug.cgi?id=216685 5 rdar://68964544 6 7 Reviewed by Keith Miller. 8 9 1. Moved the following into g_jscConfig: 10 11 Data::s_exceptionInstructions ==> g_jscConfig.llint.exceptionInstructions 12 Data::s_wasmExceptionInstructions ==> g_jscConfig.llint.wasmExceptionInstructions 13 g_opcodeMap ==> g_jscConfig.llint.opcodeMap 14 g_opcodeMapWide16 ==> g_jscConfig.llint.opcodeMapWide16 15 g_opcodeMapWide32 ==> g_jscConfig.llint.opcodeMapWide32 16 17 2. Fixed cloop.rb so that it can take an offset for the leap offlineasm instruction. 18 3. Fixed x86.rb so that it can take an offset for the leap offlineasm instruction. 19 4. Fixed arm.rb so that it can take an offset for the leap offlineasm instruction. 20 21 Note: arm64.rb already does this right. 22 23 5. Added JSC::Config::singleton() to return a reference to g_jscConfig. 24 This is useful when debugging with lldb since g_jscConfig is not an actual 25 label, but is a macro that computes the address of the Config record. 26 27 This patch has been smoke tested on arm64e, x86_64, and cloop (on x86_64 and armv7k). 28 29 * llint/LLIntData.cpp: 30 (JSC::LLInt::LLIntInitializeAssertScope::LLIntInitializeAssertScope): 31 (JSC::LLInt::LLIntInitializeAssertScope::~LLIntInitializeAssertScope): 32 (JSC::LLInt::LLIntInitializeAssertScope::assertInitializationIsAllowed): 33 (JSC::LLInt::initialize): 34 * llint/LLIntData.h: 35 (JSC::LLInt::exceptionInstructions): 36 (JSC::LLInt::wasmExceptionInstructions): 37 (JSC::LLInt::opcodeMap): 38 (JSC::LLInt::opcodeMapWide16): 39 (JSC::LLInt::opcodeMapWide32): 40 (JSC::LLInt::getOpcode): 41 (JSC::LLInt::getOpcodeWide16): 42 (JSC::LLInt::getOpcodeWide32): 43 * llint/LowLevelInterpreter.asm: 44 * llint/LowLevelInterpreter.cpp: 45 * llint/LowLevelInterpreter64.asm: 46 * llint/WebAssembly.asm: 47 * offlineasm/arm.rb: 48 * offlineasm/cloop.rb: 49 * offlineasm/x86.rb: 50 * runtime/JSCConfig.cpp: 51 (JSC::Config::singleton): 52 * runtime/JSCConfig.h: 53 1 54 2020-09-21 Basuke Suzuki <basuke.suzuki@sony.com> 2 55 -
trunk/Source/JavaScriptCore/llint/LLIntData.cpp
r262054 r267371 1 1 /* 2 * Copyright (C) 2011-20 18Apple Inc. All rights reserved.2 * Copyright (C) 2011-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 #include "ArithProfile.h" 30 30 #include "CodeBlock.h" 31 #include "JSCConfig.h" 31 32 #include "LLIntCLoop.h" 32 33 #include "Opcode.h" … … 39 40 40 41 namespace LLInt { 41 42 43 uint8_t Data::s_exceptionInstructions[maxOpcodeLength + 1] = { };44 uint8_t Data::s_wasmExceptionInstructions[maxOpcodeLength + 1] = { };45 Opcode g_opcodeMap[numOpcodeIDs + numWasmOpcodeIDs] = { };46 Opcode g_opcodeMapWide16[numOpcodeIDs + numWasmOpcodeIDs] = { };47 Opcode g_opcodeMapWide32[numOpcodeIDs + numWasmOpcodeIDs] = { };48 42 49 43 #if !ENABLE(C_LOOP) … … 62 56 63 57 #else // !ENABLE(C_LOOP) 64 llint_entry(&g_ opcodeMap, &g_opcodeMapWide16, &g_opcodeMapWide32);58 llint_entry(&g_jscConfig.llint.opcodeMap, &g_jscConfig.llint.opcodeMapWide16, &g_jscConfig.llint.opcodeMapWide32); 65 59 66 60 #if ENABLE(WEBASSEMBLY) 67 wasm_entry(&g_ opcodeMap[numOpcodeIDs], &g_opcodeMapWide16[numOpcodeIDs], &g_opcodeMapWide32[numOpcodeIDs]);61 wasm_entry(&g_jscConfig.llint.opcodeMap[numOpcodeIDs], &g_jscConfig.llint.opcodeMapWide16[numOpcodeIDs], &g_jscConfig.llint.opcodeMapWide32[numOpcodeIDs]); 68 62 #endif // ENABLE(WEBASSEMBLY) 69 63 70 64 for (int i = 0; i < numOpcodeIDs + numWasmOpcodeIDs; ++i) { 71 g_ opcodeMap[i] = tagCodePtr(g_opcodeMap[i], BytecodePtrTag);72 g_ opcodeMapWide16[i] = tagCodePtr(g_opcodeMapWide16[i], BytecodePtrTag);73 g_ opcodeMapWide32[i] = tagCodePtr(g_opcodeMapWide32[i], BytecodePtrTag);65 g_jscConfig.llint.opcodeMap[i] = tagCodePtr(g_jscConfig.llint.opcodeMap[i], BytecodePtrTag); 66 g_jscConfig.llint.opcodeMapWide16[i] = tagCodePtr(g_jscConfig.llint.opcodeMapWide16[i], BytecodePtrTag); 67 g_jscConfig.llint.opcodeMapWide32[i] = tagCodePtr(g_jscConfig.llint.opcodeMapWide32[i], BytecodePtrTag); 74 68 } 75 69 76 70 ASSERT(llint_throw_from_slow_path_trampoline < UINT8_MAX); 77 71 for (unsigned i = 0; i < maxOpcodeLength + 1; ++i) { 78 Data::s_exceptionInstructions[i] = llint_throw_from_slow_path_trampoline;79 Data::s_wasmExceptionInstructions[i] = wasm_throw_from_slow_path_trampoline;72 g_jscConfig.llint.exceptionInstructions[i] = llint_throw_from_slow_path_trampoline; 73 g_jscConfig.llint.wasmExceptionInstructions[i] = wasm_throw_from_slow_path_trampoline; 80 74 } 81 75 #endif // ENABLE(C_LOOP) -
trunk/Source/JavaScriptCore/llint/LLIntData.h
r254674 r267371 1 1 /* 2 * Copyright (C) 2011-20 18Apple Inc. All rights reserved.2 * Copyright (C) 2011-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 44 44 namespace LLInt { 45 45 46 extern "C" JS_EXPORT_PRIVATE Opcode g_opcodeMap[numOpcodeIDs + numWasmOpcodeIDs];47 extern "C" JS_EXPORT_PRIVATE Opcode g_opcodeMapWide16[numOpcodeIDs + numWasmOpcodeIDs];48 extern "C" JS_EXPORT_PRIVATE Opcode g_opcodeMapWide32[numOpcodeIDs + numWasmOpcodeIDs];49 50 46 class Data { 51 47 … … 54 50 55 51 private: 56 static uint8_t s_exceptionInstructions[maxOpcodeLength + 1];57 static uint8_t s_wasmExceptionInstructions[maxOpcodeLength + 1];58 59 52 friend void initialize(); 60 53 … … 77 70 inline Instruction* exceptionInstructions() 78 71 { 79 return reinterpret_cast<Instruction*>( Data::s_exceptionInstructions);72 return reinterpret_cast<Instruction*>(g_jscConfig.llint.exceptionInstructions); 80 73 } 81 74 82 75 inline Instruction* wasmExceptionInstructions() 83 76 { 84 return bitwise_cast<Instruction*>( Data::s_wasmExceptionInstructions);77 return bitwise_cast<Instruction*>(g_jscConfig.llint.wasmExceptionInstructions); 85 78 } 86 79 87 80 inline Opcode* opcodeMap() 88 81 { 89 return g_ opcodeMap;82 return g_jscConfig.llint.opcodeMap; 90 83 } 91 84 92 85 inline Opcode* opcodeMapWide16() 93 86 { 94 return g_ opcodeMapWide16;87 return g_jscConfig.llint.opcodeMapWide16; 95 88 } 96 89 97 90 inline Opcode* opcodeMapWide32() 98 91 { 99 return g_ opcodeMapWide32;92 return g_jscConfig.llint.opcodeMapWide32; 100 93 } 101 94 … … 103 96 { 104 97 #if ENABLE(COMPUTED_GOTO_OPCODES) 105 return g_ opcodeMap[id];98 return g_jscConfig.llint.opcodeMap[id]; 106 99 #else 107 100 return static_cast<Opcode>(id); … … 112 105 { 113 106 #if ENABLE(COMPUTED_GOTO_OPCODES) 114 return g_ opcodeMapWide16[id];107 return g_jscConfig.llint.opcodeMapWide16[id]; 115 108 #else 116 109 UNUSED_PARAM(id); … … 122 115 { 123 116 #if ENABLE(COMPUTED_GOTO_OPCODES) 124 return g_ opcodeMapWide32[id];117 return g_jscConfig.llint.opcodeMapWide32[id]; 125 118 #else 126 119 UNUSED_PARAM(id); -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r265907 r267371 1 # Copyright (C) 2011-20 19Apple Inc. All rights reserved.1 # Copyright (C) 2011-2020 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 316 316 const OpcodeIDWide32Size = 2 # Wide32 Prefix + OpcodeID 317 317 318 if X86_64_WIN or C_LOOP_WIN 319 const GigacageConfig = _g_gigacageConfig 320 const JSCConfig = _g_jscConfig 321 else 322 const GigacageConfig = _g_config + constexpr Gigacage::startOffsetOfGigacageConfig 323 const JSCConfig = _g_config + constexpr WTF::offsetOfWTFConfigExtension 324 end 318 325 319 326 macro nextInstruction() 320 327 loadb [PB, PC, 1], t0 321 leap _g_opcodeMap, t1328 leap JSCConfig + constexpr JSC::offsetOfJSCConfigOpcodeMap, t1 322 329 jmp [t1, t0, PtrSize], BytecodePtrTag 323 330 end … … 325 332 macro nextInstructionWide16() 326 333 loadb OpcodeIDNarrowSize[PB, PC, 1], t0 327 leap _g_opcodeMapWide16, t1334 leap JSCConfig + constexpr JSC::offsetOfJSCConfigOpcodeMapWide16, t1 328 335 jmp [t1, t0, PtrSize], BytecodePtrTag 329 336 end … … 331 338 macro nextInstructionWide32() 332 339 loadb OpcodeIDNarrowSize[PB, PC, 1], t0 333 leap _g_opcodeMapWide32, t1340 leap JSCConfig + constexpr JSC::offsetOfJSCConfigOpcodeMapWide32, t1 334 341 jmp [t1, t0, PtrSize], BytecodePtrTag 335 342 end -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp
r259734 r267371 1 1 /* 2 * Copyright (C) 2012-20 17Apple Inc. All rights reserved.2 * Copyright (C) 2012-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 87 87 // Define the opcode dispatch mechanism when using the C loop: 88 88 // 89 90 using WebConfig::g_config; 89 91 90 92 // These are for building a C Loop interpreter: -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
r266770 r267371 441 441 macro cagePrimitive(basePtr, mask, ptr, scratch) 442 442 if GIGACAGE_ENABLED and not (C_LOOP or C_LOOP_WIN) 443 loadb _g_config + (constexpr Gigacage::startOffsetOfGigacageConfig)+ Gigacage::Config::disablingPrimitiveGigacageIsForbidden, scratch443 loadb GigacageConfig + Gigacage::Config::disablingPrimitiveGigacageIsForbidden, scratch 444 444 btbnz scratch, .doCaging 445 445 … … 461 461 end 462 462 if GIGACAGE_ENABLED 463 cagePrimitive( _g_config + (constexpr Gigacage::startOffsetOfGigacageConfig)+ Gigacage::Config::basePtrs + GigacagePrimitiveBasePtrOffset, constexpr Gigacage::primitiveGigacageMask, source, scratch)463 cagePrimitive(GigacageConfig + Gigacage::Config::basePtrs + GigacagePrimitiveBasePtrOffset, constexpr Gigacage::primitiveGigacageMask, source, scratch) 464 464 if ARM64E 465 465 const numberOfPACBits = constexpr MacroAssembler::numberOfPACBits … … 475 475 loadp source, dest 476 476 if GIGACAGE_ENABLED 477 cage( _g_config + (constexpr Gigacage::startOffsetOfGigacageConfig)+ Gigacage::Config::basePtrs + GigacageJSValueBasePtrOffset, constexpr Gigacage::jsValueGigacageMask, dest, scratchOrLength)477 cage(GigacageConfig + Gigacage::Config::basePtrs + GigacageJSValueBasePtrOffset, constexpr Gigacage::jsValueGigacageMask, dest, scratchOrLength) 478 478 end 479 479 end -
trunk/Source/JavaScriptCore/llint/WebAssembly.asm
r264995 r267371 1 # Copyright (C) 2019 Apple Inc. All rights reserved.1 # Copyright (C) 2019-2020 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 96 96 macro wasmNextInstruction() 97 97 loadb [PB, PC, 1], t0 98 leap _g_opcodeMap, t198 leap JSCConfig + constexpr JSC::offsetOfJSCConfigOpcodeMap, t1 99 99 jmp NumberOfJSOpcodeIDs * PtrSize[t1, t0, PtrSize], BytecodePtrTag 100 100 end … … 102 102 macro wasmNextInstructionWide16() 103 103 loadb OpcodeIDNarrowSize[PB, PC, 1], t0 104 leap _g_opcodeMapWide16, t1104 leap JSCConfig + constexpr JSC::offsetOfJSCConfigOpcodeMapWide16, t1 105 105 jmp NumberOfJSOpcodeIDs * PtrSize[t1, t0, PtrSize], BytecodePtrTag 106 106 end … … 108 108 macro wasmNextInstructionWide32() 109 109 loadb OpcodeIDNarrowSize[PB, PC, 1], t0 110 leap _g_opcodeMapWide32, t1110 leap JSCConfig + constexpr JSC::offsetOfJSCConfigOpcodeMapWide32, t1 111 111 jmp NumberOfJSOpcodeIDs * PtrSize[t1, t0, PtrSize], BytecodePtrTag 112 112 end -
trunk/Source/JavaScriptCore/offlineasm/arm.rb
r259996 r267371 263 263 labelRef = node.operands[0] 264 264 if labelRef.is_a? LabelReference 265 raise unless labelRef.offset == 0266 265 tmp = Tmp.new(node.codeOrigin, :gpr) 267 266 newList << Instruction.new(codeOrigin, "globaladdr", [LabelReference.new(node.codeOrigin, labelRef.label), node.operands[1], tmp]) 267 # FIXME: This check against 255 is just the simplest check we can do. ARM is capable of encoding some larger constants using 268 # rotation (subject to some special rules). Perhaps we can add the more comprehensive encoding check here. 269 if labelRef.offset > 255 270 newList << Instruction.new(codeOrigin, "move", [Immediate.new(node.codeOrigin, labelRef.offset), tmp]) 271 newList << Instruction.new(codeOrigin, "addp", [tmp, node.operands[1]]) 272 elsif labelRef.offset > 0 273 newList << Instruction.new(codeOrigin, "addp", [Immediate.new(node.codeOrigin, labelRef.offset), node.operands[1]]) 274 end 268 275 else 269 276 newList << node -
trunk/Source/JavaScriptCore/offlineasm/cloop.rb
r252422 r267371 1 # Copyright (C) 2012-20 19Apple Inc. All rights reserved.1 # Copyright (C) 2012-2020 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 334 334 def cloopEmitLea(destination, type) 335 335 $asm.putc "#{destination.clLValue(:voidPtr)} = CAST<void*>(&#{cLabel});" 336 if offset != 0 337 $asm.putc "#{destination.clLValue(:int8Ptr)} = #{destination.clValue(:int8Ptr)} + #{offset};" 338 end 336 339 end 337 340 end … … 345 348 def cloopEmitLea(destination, type) 346 349 if destination == base 347 $asm.putc "#{destination.clLValue(:int8Ptr)} +=#{offset.clValue(type)};"350 $asm.putc "#{destination.clLValue(:int8Ptr)} = #{destination.clValue(:int8Ptr)} + #{offset.clValue(type)};" 348 351 else 349 352 $asm.putc "#{destination.clLValue(:int8Ptr)} = #{base.clValue(:int8Ptr)} + #{offset.clValue(type)};" -
trunk/Source/JavaScriptCore/offlineasm/x86.rb
r262389 r267371 575 575 else 576 576 $asm.puts "lea #{dst.x86Operand(:ptr)}, #{src.asmLabel}" 577 end 578 if src.offset != 0 579 $asm.puts "add#{x86Suffix(kind)} #{orderOperands(const(src.offset), dst.x86Operand(kind))}" 577 580 end 578 581 else -
trunk/Source/JavaScriptCore/runtime/JSCConfig.cpp
r262356 r267371 29 29 namespace JSC { 30 30 31 #if !ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 32 Config g_jscConfig; 33 #endif 34 35 Config& Config::singleton() 36 { 37 return g_jscConfig; 38 } 39 31 40 void Config::disableFreezingForTesting() 32 41 { -
trunk/Source/JavaScriptCore/runtime/JSCConfig.h
r263635 r267371 26 26 #pragma once 27 27 28 #include "Opcode.h" 28 29 #include "OptionsList.h" 29 30 #include <wtf/WTFConfig.h> … … 35 36 class VM; 36 37 37 constexpr size_t ConfigSizeToProtect = CeilingOnPageSize;38 39 38 #if ENABLE(SEPARATED_WX_HEAP) 40 39 using JITWriteSeparateHeapsFunction = void (*)(off_t, const void*, size_t); … … 42 41 43 42 struct Config { 43 static Config& singleton(); 44 44 45 JS_EXPORT_PRIVATE static void disableFreezingForTesting(); 45 46 JS_EXPORT_PRIVATE static void enableRestrictedOptions(); … … 86 87 void (*shellTimeoutCheckCallback)(VM&); 87 88 89 struct { 90 uint8_t exceptionInstructions[maxOpcodeLength + 1]; 91 uint8_t wasmExceptionInstructions[maxOpcodeLength + 1]; 92 Opcode opcodeMap[numOpcodeIDs + numWasmOpcodeIDs]; 93 Opcode opcodeMapWide16[numOpcodeIDs + numWasmOpcodeIDs]; 94 Opcode opcodeMapWide32[numOpcodeIDs + numWasmOpcodeIDs]; 95 } llint; 96 97 #if CPU(ARM64E) && ENABLE(PTRTAG_DEBUGGING) 88 98 WTF::PtrTagLookup ptrTagLookupRecord; 99 #endif 89 100 }; 101 102 #if ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 90 103 91 104 constexpr size_t alignmentOfJSCConfig = std::alignment_of<JSC::Config>::value; … … 96 109 #define g_jscConfig (*bitwise_cast<JSC::Config*>(&g_wtfConfig.spaceForExtensions)) 97 110 111 #else // not ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 112 113 extern "C" JS_EXPORT_PRIVATE Config g_jscConfig; 114 115 #endif // ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 116 117 constexpr size_t offsetOfJSCConfigOpcodeMap = offsetof(JSC::Config, llint.opcodeMap); 118 constexpr size_t offsetOfJSCConfigOpcodeMapWide16 = offsetof(JSC::Config, llint.opcodeMapWide16); 119 constexpr size_t offsetOfJSCConfigOpcodeMapWide32 = offsetof(JSC::Config, llint.opcodeMapWide32); 120 98 121 } // namespace JSC 122 123 #if !ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 124 using JSC::g_jscConfig; 125 #endif -
trunk/Source/WTF/ChangeLog
r267288 r267371 1 2020-09-21 Mark Lam <mark.lam@apple.com> 2 3 Move some LLInt globals into JSC::Config. 4 https://bugs.webkit.org/show_bug.cgi?id=216685 5 rdar://68964544 6 7 Reviewed by Keith Miller. 8 9 1. Introduce ConfigAlignment as a distinct value from ConfigSizeToProtect. 10 This is because ConfigSizeToProtect is now larger than 1 CeilingOnPageSize on 11 some platforms, but ConfigAlignment only needs to match CeilingOnPageSize. 12 13 2. Introduced ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) to disable using the 14 unified g_config record for Windows ports. 15 16 This is needed because WTF is built as a DLL on Windows. offlineasm does not 17 know how to resolve a DLL exported variable. Additionally, the Windows ports 18 have never supported freezing of the Config record to begin with. So, we're 19 working around this by disabling ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 20 for Windows. This allows JSC to have its own g_jscConfig record, which solves 21 this issue for now. 22 23 * wtf/PlatformEnable.h: 24 * wtf/WTFConfig.cpp: 25 (WTF::Config::permanentlyFreeze): 26 * wtf/WTFConfig.h: 27 1 28 2020-09-18 Don Olmstead <don.olmstead@sony.com> 2 29 -
trunk/Source/WTF/wtf/PlatformEnable.h
r267288 r267371 772 772 #endif 773 773 774 /* The unified Config record feature is not available for Windows because the 775 Windows port puts WTF in a separate DLL, and the offlineasm code accessing 776 the config record expects the config record to be directly accessible like 777 a global variable (and not have to go thru DLL shenanigans). C++ code would 778 resolve these DLL bindings automatically, but offlineasm does not. 779 780 The permanently freezing feature also currently relies on the Config records 781 being unified, and the Windows port also does not currently have an 782 implementation for the freezing mechanism anyway. For simplicity, we just 783 disable both the use of unified Config record and config freezing for the 784 Windows port. 785 */ 786 #if OS(WINDOWS) 787 #define ENABLE_UNIFIED_AND_FREEZABLE_CONFIG_RECORD 0 788 #else 789 #define ENABLE_UNIFIED_AND_FREEZABLE_CONFIG_RECORD 1 790 #endif 791 774 792 /* CSS Selector JIT Compiler */ 775 793 #if !defined(ENABLE_CSS_SELECTOR_JIT) && ((CPU(X86_64) || CPU(ARM64) || (CPU(ARM_THUMB2) && OS(DARWIN))) && ENABLE(JIT) && (OS(DARWIN) || PLATFORM(GTK) || PLATFORM(WPE))) -
trunk/Source/WTF/wtf/WTFConfig.cpp
r262434 r267371 37 37 #endif 38 38 39 #if ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 40 39 41 namespace WebConfig { 40 42 41 alignas(WTF::Config SizeToProtect) Slot g_config[WTF::ConfigSizeToProtect / sizeof(Slot)];43 alignas(WTF::ConfigAlignment) Slot g_config[WTF::ConfigSizeToProtect / sizeof(Slot)]; 42 44 43 45 } // namespace WebConfig 46 47 #else // not ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 48 49 namespace WTF { 50 51 Config g_wtfConfig; 52 53 } // namespace WTF 54 55 #endif // ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 44 56 45 57 namespace WTF { … … 60 72 61 73 int result = 0; 74 75 #if ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 62 76 #if OS(DARWIN) 63 77 enum { … … 73 87 // FIXME: Implement equivalent, maybe with VirtualProtect. 74 88 // Also need to fix WebKitTestRunner. 89 90 // Note: the Windows port also currently does not support a unified Config 91 // record, which is needed for the current form of the freezing feature to 92 // work. See comments in PlatformEnable.h for UNIFIED_AND_FREEZABLE_CONFIG_RECORD. 75 93 #endif 94 #endif // ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 95 76 96 RELEASE_ASSERT(!result); 77 97 RELEASE_ASSERT(g_wtfConfig.isPermanentlyFrozen); -
trunk/Source/WTF/wtf/WTFConfig.h
r263074 r267371 43 43 #endif 44 44 45 #if ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 45 46 namespace WebConfig { 46 47 … … 49 50 50 51 } // namespace WebConfig 52 #endif // ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 51 53 52 54 namespace WTF { 53 55 54 constexpr size_t ConfigSizeToProtect = CeilingOnPageSize; 56 constexpr size_t ConfigAlignment = CeilingOnPageSize; 57 constexpr size_t ConfigSizeToProtect = std::max(CeilingOnPageSize, 16 * KB); 55 58 56 59 struct Config { … … 76 79 }; 77 80 81 #if ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 82 78 83 constexpr size_t startSlotOfWTFConfig = Gigacage::reservedSlotsForGigacageConfig; 79 84 constexpr size_t startOffsetOfWTFConfig = startSlotOfWTFConfig * sizeof(WebConfig::Slot); … … 87 92 88 93 #define g_wtfConfig (*bitwise_cast<WTF::Config*>(&WebConfig::g_config[WTF::startSlotOfWTFConfig])) 94 95 #else // not ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 96 97 extern "C" WTF_EXPORT_PRIVATE Config g_wtfConfig; 98 99 #endif // ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 89 100 90 101 ALWAYS_INLINE Config::AssertNotFrozenScope::AssertNotFrozenScope() … … 101 112 102 113 } // namespace WTF 114 115 #if !ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 116 using WTF::g_wtfConfig; 117 #endif -
trunk/Source/bmalloc/ChangeLog
r265383 r267371 1 2020-09-21 Mark Lam <mark.lam@apple.com> 2 3 Move some LLInt globals into JSC::Config. 4 https://bugs.webkit.org/show_bug.cgi?id=216685 5 rdar://68964544 6 7 Reviewed by Keith Miller. 8 9 Introduce ConfigAlignment to match WTFConfig.h. 10 Added BENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) support to match WTF. 11 12 * bmalloc/BPlatform.h: 13 * bmalloc/Gigacage.cpp: 14 (Gigacage::ensureGigacage): 15 * bmalloc/GigacageConfig.h: 16 * bmalloc/mbmalloc.cpp: 17 1 18 2020-08-07 Saam Barati <sbarati@apple.com> 2 19 -
trunk/Source/bmalloc/bmalloc/BPlatform.h
r261207 r267371 1 1 /* 2 * Copyright (C) 2014-20 18Apple Inc. All rights reserved.2 * Copyright (C) 2014-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 97 97 #endif 98 98 99 /* ==== Feature decision macros: these define feature choices for a particular port. ==== */ 100 101 #define BENABLE(WTF_FEATURE) (defined BENABLE_##WTF_FEATURE && BENABLE_##WTF_FEATURE) 102 99 103 /* ==== Policy decision macros: these define policy choices for a particular port. ==== */ 100 104 … … 319 323 #define BUSE_PRECOMPUTED_CONSTANTS_VMPAGE16K 1 320 324 #endif 325 326 /* The unified Config record feature is not available for Windows because the 327 Windows port puts WTF in a separate DLL, and the offlineasm code accessing 328 the config record expects the config record to be directly accessible like 329 a global variable (and not have to go thru DLL shenanigans). C++ code would 330 resolve these DLL bindings automatically, but offlineasm does not. 331 332 The permanently freezing feature also currently relies on the Config records 333 being unified, and the Windows port also does not currently have an 334 implementation for the freezing mechanism anyway. For simplicity, we just 335 disable both the use of unified Config record and config freezing for the 336 Windows port. 337 */ 338 #if BOS(WINDOWS) 339 #define BENABLE_UNIFIED_AND_FREEZABLE_CONFIG_RECORD 0 340 #else 341 #define BENABLE_UNIFIED_AND_FREEZABLE_CONFIG_RECORD 1 342 #endif -
trunk/Source/bmalloc/bmalloc/Gigacage.cpp
r263316 r267371 44 44 namespace Gigacage { 45 45 46 #if !BENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 47 Config g_gigacageConfig; 48 #endif 49 46 50 struct Callback { 47 51 Callback() { } … … 112 116 if (!shouldBeEnabled()) 113 117 return; 114 118 119 #if BENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 115 120 // We might only get page size alignment, but that's also the minimum 116 121 // alignment we need for freezing the Config. 117 122 RELEASE_BASSERT(!(reinterpret_cast<size_t>(&g_gigacageConfig) & (vmPageSize() - 1))); 123 #endif 118 124 119 125 Kind shuffledKinds[NumberOfKinds]; -
trunk/Source/bmalloc/bmalloc/GigacageConfig.h
r262434 r267371 31 31 #include <inttypes.h> 32 32 33 #if BENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 34 33 35 namespace WebConfig { 34 36 … … 37 39 38 40 } // namespace WebConfig 41 42 #endif // BENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 39 43 40 44 namespace Gigacage { … … 73 77 }; 74 78 79 #if BENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 80 75 81 constexpr size_t startSlotOfGigacageConfig = 0; 76 82 constexpr size_t startOffsetOfGigacageConfig = startSlotOfGigacageConfig * sizeof(WebConfig::Slot); … … 86 92 #define g_gigacageConfig (*bmalloc::bitwise_cast<Gigacage::Config*>(&WebConfig::g_config[Gigacage::startSlotOfGigacageConfig])) 87 93 94 #else // not BENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 95 96 extern "C" BEXPORT Config g_gigacageConfig; 97 98 #endif // BENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 99 88 100 } // namespace Gigacage 101 102 #if !BENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 103 using Gigacage::g_gigacageConfig; 104 #endif -
trunk/Source/bmalloc/bmalloc/mbmalloc.cpp
r262434 r267371 1 1 /* 2 * Copyright (C) 2014 Apple Inc. All rights reserved.2 * Copyright (C) 2014-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 #include "GigacageConfig.h" 30 30 31 #if BENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 32 31 33 namespace WebConfig { 32 34 35 // FIXME: Other than OS(DARWIN) || PLATFORM(PLAYSTATION), CeilingOnPageSize is 36 // not 16K. ConfigAlignment should match that. 37 constexpr size_t ConfigAlignment = 16 * bmalloc::Sizes::kB; 33 38 constexpr size_t ConfigSizeToProtect = 16 * bmalloc::Sizes::kB; 34 39 35 alignas(Config SizeToProtect) BEXPORT Slot g_config[ConfigSizeToProtect / sizeof(Slot)];40 alignas(ConfigAlignment) BEXPORT Slot g_config[ConfigSizeToProtect / sizeof(Slot)]; 36 41 37 42 } // namespace WebConfig 43 44 #else // !BENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 45 46 namespace Gigacage { 47 48 Config g_gigacageConfig; 49 50 } // namespace Gigacage 51 52 #endif // BENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) 38 53 39 54 extern "C" {
Note: See TracChangeset
for help on using the changeset viewer.