Changeset 263117 in webkit
- Timestamp:
- Jun 16, 2020, 2:30:06 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/tests/ExecutionTimeLimitTest.cpp
r261755 r263117 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 129 129 130 130 JSC::initializeThreading(); 131 Options::initialize(); // Ensure options is initialized first.132 131 133 132 for (auto tierOptions : tierOptionsList) { -
trunk/Source/JavaScriptCore/API/tests/FunctionOverridesTest.cpp
r261755 r263117 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 39 39 40 40 JSC::initializeThreading(); 41 Options::initialize(); // Ensure options is initialized first.42 41 43 42 const char* oldFunctionOverrides = Options::functionOverrides(); -
trunk/Source/JavaScriptCore/API/tests/PingPongStackOverflowTest.cpp
r261755 r263117 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 118 118 119 119 JSC::initializeThreading(); 120 Options::initialize(); // Ensure options is initialized first.121 120 122 121 auto origSoftReservedZoneSize = Options::softReservedZoneSize(); -
trunk/Source/JavaScriptCore/API/tests/testapi.c
r261755 r263117 1 1 /* 2 * Copyright (C) 2006-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2006-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 2102 2102 } 2103 2103 failed |= testTypedArrayCAPI(); 2104 failed |= testExecutionTimeLimit();2105 2104 failed |= testFunctionOverrides(); 2106 2105 failed |= testGlobalContextWithFinalizer(); … … 2157 2156 2158 2157 failed = finalizeMultithreadedMultiVMExecutionTest() || failed; 2158 2159 // Don't run this till after the MultithreadedMultiVMExecutionTest has finished. 2160 // This is because testExecutionTimeLimit() modifies JIT options at runtime 2161 // as part of its testing. This can wreak havoc on the rest of the system that 2162 // expects the options to be frozen. Ideally, we'll find a way for testExecutionTimeLimit() 2163 // to do its work without changing JIT options, but that is not easy to do. 2164 // For now, we'll just run it here at the end as a workaround. 2165 failed |= testExecutionTimeLimit(); 2159 2166 2160 2167 if (failed) { -
trunk/Source/JavaScriptCore/ChangeLog
r263116 r263117 1 2020-06-16 Mark Lam <mark.lam@apple.com> 2 3 Make Options::useJIT() be the canonical source of truth on whether we should use the JIT. 4 https://bugs.webkit.org/show_bug.cgi?id=212556 5 <rdar://problem/63780436> 6 7 Reviewed by Saam Barati. 8 9 After r263055, Options::useJIT() always equals VM::canUseJIT() after canUseJIT() 10 has been computed. This patch removes VM::canUseJIT(), and replaces all calls to 11 it with calls to Options::useJIT(). 12 13 In the old code, VM::canUseJIT() would assert s_canUseJITIsSet to ensure that 14 its clients will not access s_canUseJIT before it is initialized. We not have an 15 equivalent mechanism with Options. This is how it works: 16 17 1. There are 2 new Options flags in the g_jscConfig: 18 g_jscConfig.options.isFinalized 19 g_jscConfig.options.allowUnfinalizedAccess 20 21 g_jscConfig.options.isFinalized means that all Options values are finalized 22 i.e. initialization is complete and ready to be frozen in the Config. 23 24 g_jscConfig.options.isFinalized is set by initializeThreading() by calling 25 Options::finalize() once options initialization is complete. 26 27 g_jscConfig.options.allowUnfinalizedAccess is an allowance for clients to 28 access Options values before they are finalized. This is only needed in 29 options initialization code where Options values are read and written to. 30 31 g_jscConfig.options.allowUnfinalizedAccess is set and cleared using the 32 Options::AllowUnfinalizedAccessScope RAII object. The few pieces of code that 33 do options initialization will instantiate this scope object. 34 35 2. All Options accessors (e.g. Option::useJIT()) will now assert that either 36 g_jscConfig.options.allowUnfinalizedAccess or g_jscConfig.options.isFinalized 37 is set. 38 39 3. Since r263055, Options::recomputeDependentOptions() ensures that if useJIT() is 40 false, all other JIT options (e.g. useBaselineJIT(), useDFTJIT(), useFTLJIT(), 41 etc.) are also false. This patch also adds useBBQJIT() and useOMGJIT() to that 42 list. 43 44 With this, checks for useJIT() are now redundant if there's also another JIT 45 option check, e.g. useRegExpJIT() or useDFGJIT(). When redundant, this patch 46 elides the useJIT() check (which used to be a VM::canUseJIT() check). 47 48 Ideally, we should also introduce a separate abstraction for requested option 49 values before finalization than the finalized option values that will be adopted 50 by the system. We'll do this as a separate exercise in a later patch. 51 52 * API/tests/ExecutionTimeLimitTest.cpp: 53 (testExecutionTimeLimit): 54 * API/tests/FunctionOverridesTest.cpp: 55 (testFunctionOverrides): 56 * API/tests/PingPongStackOverflowTest.cpp: 57 (testPingPongStackOverflow): 58 - Removed redundant calls to Options::initialize(). 59 60 * API/tests/testapi.c: 61 (main): 62 - move the call to testExecutionTimeLimit() to after finalizeMultithreadedMultiVMExecutionTest() 63 returns. This is because testExecutionTimeLimit() modifies JIT options at runtime 64 as part of its testing. This can wreak havoc on the rest of the system that expects 65 the options to be frozen. Ideally, we'll find a way for testExecutionTimeLimit() to 66 do its work without changing JIT options, but that is not easy to do. For now, 67 we'll just run it at the end as a workaround. 68 69 * bytecode/CodeBlock.cpp: 70 (JSC::CodeBlock::setNumParameters): 71 * bytecode/CodeBlock.h: 72 (JSC::CodeBlock::numberOfArgumentValueProfiles): 73 (JSC::CodeBlock::valueProfileForArgument): 74 * dfg/DFGCapabilities.cpp: 75 (JSC::DFG::isSupported): 76 * heap/Heap.cpp: 77 (JSC::Heap::completeAllJITPlans): 78 (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): 79 (JSC::Heap::gatherScratchBufferRoots): 80 (JSC::Heap::removeDeadCompilerWorklistEntries): 81 (JSC::Heap::stopThePeriphery): 82 (JSC::Heap::suspendCompilerThreads): 83 (JSC::Heap::resumeCompilerThreads): 84 (JSC::Heap::addCoreConstraints): 85 * interpreter/AbstractPC.cpp: 86 (JSC::AbstractPC::AbstractPC): 87 * jit/JITThunks.cpp: 88 (JSC::JITThunks::ctiNativeCall): 89 (JSC::JITThunks::ctiNativeConstruct): 90 (JSC::JITThunks::ctiNativeTailCall): 91 (JSC::JITThunks::ctiNativeTailCallWithoutSavedTags): 92 (JSC::JITThunks::ctiInternalFunctionCall): 93 (JSC::JITThunks::ctiInternalFunctionConstruct): 94 (JSC::JITThunks::hostFunctionStub): 95 * jsc.cpp: 96 (CommandLine::parseArguments): 97 (jscmain): 98 * llint/LLIntEntrypoint.cpp: 99 (JSC::LLInt::setFunctionEntrypoint): 100 (JSC::LLInt::setEvalEntrypoint): 101 (JSC::LLInt::setProgramEntrypoint): 102 (JSC::LLInt::setModuleProgramEntrypoint): 103 * llint/LLIntSlowPaths.cpp: 104 (JSC::LLInt::shouldJIT): 105 (JSC::LLInt::jitCompileAndSetHeuristics): 106 * runtime/InitializeThreading.cpp: 107 (JSC::initializeThreading): 108 * runtime/JSCConfig.h: 109 * runtime/JSGlobalObject.cpp: 110 (JSC::JSGlobalObject::init): 111 * runtime/JSGlobalObject.h: 112 (JSC::JSGlobalObject::numberToStringWatchpointSet): 113 * runtime/Options.cpp: 114 (JSC::jitEnabledByDefault): 115 (JSC::disableAllJITOptions): 116 117 (JSC::Options::initialize): 118 - Move the calls to dumpOptionsIfNeeded() and ensureOptionsAreCoherent() to the 119 end after all the options have been initialized because this where they belong. 120 121 (JSC::Options::finalize): 122 (JSC::Options::setOptions): 123 (JSC::Options::setOption): 124 (JSC::Options::dumpAllOptions): 125 (JSC::Options::ensureOptionsAreCoherent): 126 * runtime/Options.h: 127 (JSC::Options::AllowUnfinalizedAccessScope::AllowUnfinalizedAccessScope): 128 (JSC::Options::AllowUnfinalizedAccessScope::~AllowUnfinalizedAccessScope): 129 * runtime/OptionsList.h: 130 * runtime/RegExp.cpp: 131 (JSC::RegExp::compile): 132 (JSC::RegExp::compileMatchOnly): 133 * runtime/SymbolTable.h: 134 (JSC::SymbolTableEntry::isWatchable const): 135 * runtime/VM.cpp: 136 (JSC::VM::computeCanUseJIT): 137 (JSC::VM::VM): 138 (JSC::VM::getHostFunction): 139 (JSC::VM::getCTIInternalFunctionTrampolineFor): 140 * runtime/VM.h: 141 (JSC::VM::isInMiniMode): 142 (JSC::VM::canUseJIT): Deleted. 143 * wasm/WasmCapabilities.h: 144 (JSC::Wasm::isSupported): 145 * wasm/WasmOperations.cpp: 146 (JSC::Wasm::shouldJIT): 147 * wasm/WasmSlowPaths.cpp: 148 (JSC::LLInt::shouldJIT): 149 1 150 2020-06-16 Robin Morisset <rmorisset@apple.com> 2 151 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r263035 r263117 949 949 m_numParameters = newValue; 950 950 951 m_argumentValueProfiles = RefCountedArray<ValueProfile>( vm().canUseJIT() ? newValue : 0);951 m_argumentValueProfiles = RefCountedArray<ValueProfile>(Options::useJIT() ? newValue : 0); 952 952 } 953 953 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r262920 r263117 1 1 /* 2 * Copyright (C) 2008-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2008-2020 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca> 4 4 * … … 497 497 { 498 498 ASSERT(m_numParameters >= 0); 499 ASSERT(m_argumentValueProfiles.size() == static_cast<unsigned>(m_numParameters) || ! vm().canUseJIT());499 ASSERT(m_argumentValueProfiles.size() == static_cast<unsigned>(m_numParameters) || !Options::useJIT()); 500 500 return m_argumentValueProfiles.size(); 501 501 } … … 503 503 ValueProfile& valueProfileForArgument(unsigned argumentIndex) 504 504 { 505 ASSERT( vm().canUseJIT()); // This is only called from the various JIT compilers or places that first check numberOfArgumentValueProfiles before calling this.505 ASSERT(Options::useJIT()); // This is only called from the various JIT compilers or places that first check numberOfArgumentValueProfiles before calling this. 506 506 ValueProfile& result = m_argumentValueProfiles[argumentIndex]; 507 507 return result; -
trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp
r263046 r263117 1 1 /* 2 * Copyright (C) 2011-20 17Apple 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 … … 37 37 bool isSupported() 38 38 { 39 return VM::canUseJIT() &&Options::useDFGJIT() && MacroAssembler::supportsFloatingPoint();39 return Options::useDFGJIT() && MacroAssembler::supportsFloatingPoint(); 40 40 } 41 41 -
trunk/Source/JavaScriptCore/heap/Heap.cpp
r263006 r263117 631 631 void Heap::completeAllJITPlans() 632 632 { 633 if (! VM::canUseJIT())633 if (!Options::useJIT()) 634 634 return; 635 635 #if ENABLE(JIT) … … 643 643 { 644 644 m_codeBlocks->iterateCurrentlyExecuting(func); 645 if ( VM::canUseJIT())645 if (Options::useJIT()) 646 646 DFG::iterateCodeBlocksForGC(m_vm, func); 647 647 } … … 702 702 { 703 703 #if ENABLE(DFG_JIT) 704 if (! VM::canUseJIT())704 if (!Options::useJIT()) 705 705 return; 706 706 m_vm.gatherScratchBufferRoots(roots); … … 722 722 { 723 723 #if ENABLE(DFG_JIT) 724 if (! VM::canUseJIT())724 if (!Options::useJIT()) 725 725 return; 726 726 for (unsigned i = DFG::numberOfWorklists(); i--;) … … 1639 1639 1640 1640 #if ENABLE(JIT) 1641 if ( VM::canUseJIT()) {1641 if (Options::useJIT()) { 1642 1642 DeferGCForAWhile awhile(*this); 1643 1643 if (JITWorklist::ensureGlobalWorklist().completeAllForVM(m_vm) … … 2155 2155 // after we have suspended the ones that he had started before. That's not very expensive since 2156 2156 // the worklists use AutomaticThreads anyway. 2157 if (! VM::canUseJIT())2157 if (!Options::useJIT()) 2158 2158 return; 2159 2159 for (unsigned i = DFG::numberOfWorklists(); i--;) … … 2366 2366 { 2367 2367 #if ENABLE(DFG_JIT) 2368 if (! VM::canUseJIT())2368 if (!Options::useJIT()) 2369 2369 return; 2370 2370 for (unsigned i = DFG::numberOfWorklists(); i--;) … … 2716 2716 slotVisitor.append(conservativeRoots); 2717 2717 } 2718 if ( VM::canUseJIT()) {2718 if (Options::useJIT()) { 2719 2719 // JITStubRoutines must be visited after scanning ConservativeRoots since JITStubRoutines depend on the hook executed during gathering ConservativeRoots. 2720 2720 SetRootMarkReasonScope rootScope(slotVisitor, SlotVisitor::RootMarkReason::JITStubRoutines); … … 2824 2824 2825 2825 #if ENABLE(DFG_JIT) 2826 if ( VM::canUseJIT()) {2826 if (Options::useJIT()) { 2827 2827 m_constraintSet->add( 2828 2828 "Dw", "DFG Worklists", -
trunk/Source/JavaScriptCore/interpreter/AbstractPC.cpp
r261755 r263117 1 1 /* 2 * Copyright (C) 2012 Apple 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 … … 38 38 39 39 #if ENABLE(JIT) 40 if ( VM::canUseJIT()) {40 if (Options::useJIT()) { 41 41 m_pointer = callFrame->returnPC().value(); 42 42 m_mode = JIT; -
trunk/Source/JavaScriptCore/jit/JITThunks.cpp
r261755 r263117 1 1 /* 2 * Copyright (C) 2012-20 19Apple 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 … … 93 93 MacroAssemblerCodePtr<JITThunkPtrTag> JITThunks::ctiNativeCall(VM& vm) 94 94 { 95 ASSERT( VM::canUseJIT());95 ASSERT(Options::useJIT()); 96 96 return ctiStub(vm, nativeCallGenerator).code(); 97 97 } … … 99 99 MacroAssemblerCodePtr<JITThunkPtrTag> JITThunks::ctiNativeConstruct(VM& vm) 100 100 { 101 ASSERT( VM::canUseJIT());101 ASSERT(Options::useJIT()); 102 102 return ctiStub(vm, nativeConstructGenerator).code(); 103 103 } … … 105 105 MacroAssemblerCodePtr<JITThunkPtrTag> JITThunks::ctiNativeTailCall(VM& vm) 106 106 { 107 ASSERT( VM::canUseJIT());107 ASSERT(Options::useJIT()); 108 108 return ctiStub(vm, nativeTailCallGenerator).code(); 109 109 } … … 111 111 MacroAssemblerCodePtr<JITThunkPtrTag> JITThunks::ctiNativeTailCallWithoutSavedTags(VM& vm) 112 112 { 113 ASSERT( VM::canUseJIT());113 ASSERT(Options::useJIT()); 114 114 return ctiStub(vm, nativeTailCallWithoutSavedTagsGenerator).code(); 115 115 } … … 117 117 MacroAssemblerCodePtr<JITThunkPtrTag> JITThunks::ctiInternalFunctionCall(VM& vm) 118 118 { 119 ASSERT( VM::canUseJIT());119 ASSERT(Options::useJIT()); 120 120 return ctiStub(vm, internalFunctionCallGenerator).code(); 121 121 } … … 123 123 MacroAssemblerCodePtr<JITThunkPtrTag> JITThunks::ctiInternalFunctionConstruct(VM& vm) 124 124 { 125 ASSERT( VM::canUseJIT());125 ASSERT(Options::useJIT()); 126 126 return ctiStub(vm, internalFunctionConstructGenerator).code(); 127 127 } … … 184 184 { 185 185 ASSERT(!isCompilationThread()); 186 ASSERT( VM::canUseJIT());186 ASSERT(Options::useJIT()); 187 187 188 188 auto hostFunctionKey = std::make_tuple(function, constructor, name); -
trunk/Source/JavaScriptCore/jsc.cpp
r263082 r263117 2926 2926 void CommandLine::parseArguments(int argc, char** argv) 2927 2927 { 2928 Options::AllowUnfinalizedAccessScope scope; 2928 2929 Options::initialize(); 2929 2930 … … 3242 3243 CommandLine options(argc, argv); 3243 3244 3244 processConfigFile(Options::configFile(), "jsc"); 3245 if (options.m_dump) 3246 JSC::Options::dumpGeneratedBytecodes() = true; 3245 { 3246 Options::AllowUnfinalizedAccessScope scope; 3247 processConfigFile(Options::configFile(), "jsc"); 3248 if (options.m_dump) 3249 Options::dumpGeneratedBytecodes() = true; 3250 } 3247 3251 3248 3252 // Initialize JSC before getting VM. -
trunk/Source/JavaScriptCore/llint/LLIntEntrypoint.cpp
r261895 r263117 1 1 /* 2 * Copyright (C) 2012-20 18Apple 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 … … 41 41 42 42 #if ENABLE(JIT) 43 if ( VM::canUseJIT()) {43 if (Options::useJIT()) { 44 44 if (kind == CodeForCall) { 45 45 static DirectJITCode* jitCode; … … 89 89 { 90 90 #if ENABLE(JIT) 91 if ( VM::canUseJIT()) {91 if (Options::useJIT()) { 92 92 static NativeJITCode* jitCode; 93 93 static std::once_flag onceKey; … … 112 112 { 113 113 #if ENABLE(JIT) 114 if ( VM::canUseJIT()) {114 if (Options::useJIT()) { 115 115 static NativeJITCode* jitCode; 116 116 static std::once_flag onceKey; … … 135 135 { 136 136 #if ENABLE(JIT) 137 if ( VM::canUseJIT()) {137 if (Options::useJIT()) { 138 138 static NativeJITCode* jitCode; 139 139 static std::once_flag onceKey; -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r262928 r263117 1 1 /* 2 * Copyright (C) 2011-20 19Apple 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 … … 358 358 return false; 359 359 360 return VM::canUseJIT() &&Options::useBaselineJIT();360 return Options::useBaselineJIT(); 361 361 } 362 362 … … 365 365 { 366 366 DeferGCForAWhile deferGC(vm.heap); // My callers don't set top callframe, so we don't want to GC here at all. 367 ASSERT( VM::canUseJIT());367 ASSERT(Options::useJIT()); 368 368 369 369 codeBlock->updateAllValueProfilePredictions(); -
trunk/Source/JavaScriptCore/runtime/InitializeThreading.cpp
r263055 r263117 64 64 WriteBarrierCounters::initialize(); 65 65 #endif 66 67 ExecutableAllocator::initialize(); 68 VM::computeCanUseJIT(); 69 if (!VM::canUseJIT()) { 70 Options::useJIT() = false; 71 Options::recomputeDependentOptions(); 66 { 67 Options::AllowUnfinalizedAccessScope scope; 68 ExecutableAllocator::initialize(); 69 VM::computeCanUseJIT(); 70 if (!g_jscConfig.vm.canUseJIT) { 71 Options::useJIT() = false; 72 Options::recomputeDependentOptions(); 73 } 72 74 } 75 Options::finalize(); 73 76 74 77 if (Options::useSigillCrashAnalyzer()) -
trunk/Source/JavaScriptCore/runtime/JSCConfig.h
r262434 r263117 65 65 bool initializeThreadingHasBeenCalled; 66 66 67 struct { 68 #if ASSERT_ENABLED 69 bool canUseJITIsSet; 70 #endif 71 bool canUseJIT; 72 } vm; 73 67 74 ExecutableAllocator* executableAllocator; 68 75 FixedVMPoolExecutableAllocator* fixedVMPoolExecutableAllocator; -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r263006 r263117 1 1 /* 2 * Copyright (C) 2007-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2007-2020 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008 Cameron Zwarich (cwzwarich@uwaterloo.ca) 4 4 * … … 1350 1350 1351 1351 // Unfortunately, the prototype objects of the builtin objects can be touched from concurrent compilers. So eagerly initialize them only if we use JIT. 1352 if ( VM::canUseJIT()) {1352 if (Options::useJIT()) { 1353 1353 this->booleanPrototype(); 1354 1354 this->numberPrototype(); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r262827 r263117 465 465 InlineWatchpointSet& numberToStringWatchpointSet() 466 466 { 467 RELEASE_ASSERT( VM::canUseJIT());467 RELEASE_ASSERT(Options::useJIT()); 468 468 return m_numberToStringWatchpointSet; 469 469 } -
trunk/Source/JavaScriptCore/runtime/Options.cpp
r263055 r263117 220 220 } 221 221 222 static bool jitEnabledByDefault()222 static constexpr bool jitEnabledByDefault() 223 223 { 224 224 return is32Bit() || isAddress64Bit(); … … 383 383 Options::useDFGJIT() = false; 384 384 Options::useFTLJIT() = false; 385 Options::useBBQJIT() = false; 386 Options::useOMGJIT() = false; 385 387 Options::useDOMJIT() = false; 386 388 Options::useRegExpJIT() = false; … … 568 570 initializeOptionsOnceFlag, 569 571 [] { 572 AllowUnfinalizedAccessScope scope; 573 570 574 // Sanity check that options address computation is working. 571 575 RELEASE_ASSERT(Options::addressOfOption(useKernTCSMID) == &Options::useKernTCSM()); … … 632 636 ASSERT(Options::criticalGCMemoryThreshold() > 0.0 && Options::criticalGCMemoryThreshold() < 1.0); 633 637 634 dumpOptionsIfNeeded();635 ensureOptionsAreCoherent();636 637 638 #if HAVE(MACH_EXCEPTIONS) 638 639 if (Options::useMachForExceptions()) … … 664 665 (hwPhysicalCPUMax() >= 4) && (hwL3CacheSize() >= static_cast<int64_t>(6 * MB)); 665 666 #endif 666 }); 667 668 // The following should only be done at the end after all options 669 // have been initialized. 670 dumpOptionsIfNeeded(); 671 ensureOptionsAreCoherent(); 672 }); 667 673 } 668 674 … … 695 701 } 696 702 703 void Options::finalize() 704 { 705 ASSERT(!g_jscConfig.options.allowUnfinalizedAccess); 706 g_jscConfig.options.isFinalized = true; 707 } 708 697 709 static bool isSeparator(char c) 698 710 { … … 702 714 bool Options::setOptions(const char* optionsStr) 703 715 { 716 AllowUnfinalizedAccessScope scope; 704 717 RELEASE_ASSERT(!g_jscConfig.isPermanentlyFrozen()); 705 718 Vector<char*> options; … … 867 880 bool Options::setOption(const char* arg) 868 881 { 882 AllowUnfinalizedAccessScope scope; 869 883 bool success = setOptionWithoutAlias(arg); 870 884 if (success) … … 877 891 const char* separator, const char* optionHeader, const char* optionFooter, DumpDefaultsOption dumpDefaultsOption) 878 892 { 893 AllowUnfinalizedAccessScope scope; 879 894 if (title) { 880 895 builder.append(title); … … 979 994 void Options::ensureOptionsAreCoherent() 980 995 { 996 AllowUnfinalizedAccessScope scope; 981 997 bool coherent = true; 982 998 if (!(useLLInt() || useJIT())) { -
trunk/Source/JavaScriptCore/runtime/Options.h
r263055 r263117 30 30 #include <stdint.h> 31 31 #include <stdio.h> 32 #include <wtf/ForbidHeapAllocation.h> 33 #include <wtf/Noncopyable.h> 32 34 #include <wtf/PrintStream.h> 33 35 #include <wtf/StdLibExtras.h> … … 74 76 }; 75 77 78 class AllowUnfinalizedAccessScope { 79 WTF_MAKE_NONCOPYABLE(AllowUnfinalizedAccessScope); 80 WTF_FORBID_HEAP_ALLOCATION; 81 public: 82 #if ASSERT_ENABLED 83 AllowUnfinalizedAccessScope() 84 { 85 if (!g_jscConfig.options.isFinalized) { 86 m_savedAllowUnfinalizedUse = g_jscConfig.options.allowUnfinalizedAccess; 87 g_jscConfig.options.allowUnfinalizedAccess = true; 88 } 89 } 90 91 ~AllowUnfinalizedAccessScope() 92 { 93 if (!g_jscConfig.options.isFinalized) 94 g_jscConfig.options.allowUnfinalizedAccess = m_savedAllowUnfinalizedUse; 95 } 96 97 private: 98 bool m_savedAllowUnfinalizedUse; 99 #else 100 ALWAYS_INLINE AllowUnfinalizedAccessScope() = default; 101 ALWAYS_INLINE ~AllowUnfinalizedAccessScope() { } 102 #endif 103 }; 104 76 105 JS_EXPORT_PRIVATE static void initialize(); 106 static void finalize(); 77 107 78 108 // Parses a string of options where each option is of the format "--<optionName>=<value>" … … 91 121 92 122 #define DECLARE_OPTION_ACCESSORS(type_, name_, defaultValue_, availability_, description_) \ 93 ALWAYS_INLINE static OptionsStorage::type_& name_() { return g_jscConfig.options.name_; } \ 94 ALWAYS_INLINE static OptionsStorage::type_& name_##Default() { return g_jscConfig.options.name_##Default; } 123 private: \ 124 ALWAYS_INLINE static OptionsStorage::type_& name_##Default() { return g_jscConfig.options.name_##Default; } \ 125 public: \ 126 ALWAYS_INLINE static OptionsStorage::type_& name_() \ 127 { \ 128 ASSERT(g_jscConfig.options.allowUnfinalizedAccess || g_jscConfig.options.isFinalized); \ 129 return g_jscConfig.options.name_; \ 130 } 95 131 96 132 FOR_EACH_JSC_OPTION(DECLARE_OPTION_ACCESSORS) -
trunk/Source/JavaScriptCore/runtime/OptionsList.h
r263046 r263117 619 619 using GCLogLevel = GCLogging::Level; 620 620 621 bool allowUnfinalizedAccess; 622 bool isFinalized; 623 621 624 #define DECLARE_OPTION(type_, name_, defaultValue_, availability_, description_) \ 622 625 type_ name_; \ -
trunk/Source/JavaScriptCore/runtime/RegExp.cpp
r261755 r263117 1 1 /* 2 2 * Copyright (C) 1999-2001, 2004 Harri Porten (porten@kde.org) 3 * Copyright (c) 2007 , 2008, 2016-2017Apple Inc. All rights reserved.3 * Copyright (c) 2007-2020 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2009 Torch Mobile, Inc. 5 5 * Copyright (C) 2010 Peter Varga (pvarga@inf.u-szeged.hu), University of Szeged … … 257 257 258 258 #if ENABLE(YARR_JIT) 259 if (!pattern.containsUnsignedLengthPattern() && VM::canUseJIT() &&Options::useRegExpJIT()259 if (!pattern.containsUnsignedLengthPattern() && Options::useRegExpJIT() 260 260 #if !ENABLE(YARR_JIT_BACKREFERENCES) 261 261 && !pattern.m_containsBackreferences … … 321 321 322 322 #if ENABLE(YARR_JIT) 323 if (!pattern.containsUnsignedLengthPattern() && VM::canUseJIT() &&Options::useRegExpJIT()323 if (!pattern.containsUnsignedLengthPattern() && Options::useRegExpJIT() 324 324 #if !ENABLE(YARR_JIT_BACKREFERENCES) 325 325 && !pattern.m_containsBackreferences -
trunk/Source/JavaScriptCore/runtime/SymbolTable.h
r262613 r263117 232 232 bool isWatchable() const 233 233 { 234 return (m_bits & KindBitsMask) == ScopeKindBits && VM::canUseJIT();234 return (m_bits & KindBitsMask) == ScopeKindBits && Options::useJIT(); 235 235 } 236 236 -
trunk/Source/JavaScriptCore/runtime/VM.cpp
r263006 r263117 197 197 namespace JSC { 198 198 199 #if ENABLE(JIT)200 #if ASSERT_ENABLED201 bool VM::s_canUseJITIsSet = false;202 #endif203 bool VM::s_canUseJIT = false;204 #endif205 206 199 Atomic<unsigned> VM::s_numberOfIDs; 207 200 … … 251 244 #if ENABLE(JIT) 252 245 #if ASSERT_ENABLED 253 RELEASE_ASSERT(! s_canUseJITIsSet);254 s_canUseJITIsSet = true;255 #endif 256 s_canUseJIT = VM::canUseAssembler() && Options::useJIT();246 RELEASE_ASSERT(!g_jscConfig.vm.canUseJITIsSet); 247 g_jscConfig.vm.canUseJITIsSet = true; 248 #endif 249 g_jscConfig.vm.canUseJIT = VM::canUseAssembler() && Options::useJIT(); 257 250 #endif 258 251 } … … 468 461 469 462 // Eagerly initialize constant cells since the concurrent compiler can access them. 470 if ( canUseJIT()) {463 if (Options::useJIT()) { 471 464 sentinelMapBucket(); 472 465 sentinelSetBucket(); … … 548 541 #if ENABLE(JIT) 549 542 // Make sure that any stubs that the JIT is going to use are initialized in non-compilation threads. 550 if ( canUseJIT()) {543 if (Options::useJIT()) { 551 544 jitStubs = makeUnique<JITThunks>(); 552 545 #if ENABLE(FTL_JIT) … … 798 791 { 799 792 #if ENABLE(JIT) 800 if ( canUseJIT()) {793 if (Options::useJIT()) { 801 794 return jitStubs->hostFunctionStub( 802 795 *this, function, constructor, … … 838 831 { 839 832 #if ENABLE(JIT) 840 if ( canUseJIT()) {833 if (Options::useJIT()) { 841 834 if (kind == CodeForCall) 842 835 return jitStubs->ctiInternalFunctionCall(*this).retagged<JSEntryPtrTag>(); -
trunk/Source/JavaScriptCore/runtime/VM.h
r263006 r263117 790 790 static bool isInMiniMode() 791 791 { 792 return ! canUseJIT() || Options::forceMiniVMMode();792 return !Options::useJIT() || Options::forceMiniVMMode(); 793 793 } 794 794 … … 799 799 800 800 static void computeCanUseJIT(); 801 ALWAYS_INLINE static bool canUseJIT()802 {803 #if ENABLE(JIT)804 ASSERT(s_canUseJITIsSet);805 return s_canUseJIT;806 #else807 return false;808 #endif809 }810 801 811 802 SourceProviderCache* addSourceProviderCache(SourceProvider*); … … 1234 1225 uintptr_t m_currentWeakRefVersion { 0 }; 1235 1226 1236 #if ENABLE(JIT)1237 #if ASSERT_ENABLED1238 JS_EXPORT_PRIVATE static bool s_canUseJITIsSet;1239 #endif1240 JS_EXPORT_PRIVATE static bool s_canUseJIT;1241 #endif1242 1243 1227 VM* m_prev; // Required by DoublyLinkedListNode. 1244 1228 VM* m_next; // Required by DoublyLinkedListNode. -
trunk/Source/JavaScriptCore/wasm/WasmCapabilities.h
r243312 r263117 1 1 /* 2 * Copyright (C) 2019 Apple Inc. All rights reserved.2 * Copyright (C) 2019-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 34 34 inline bool isSupported() 35 35 { 36 return VM::canUseJIT() &&Options::useWebAssembly();36 return Options::useWebAssembly(); 37 37 } 38 38 -
trunk/Source/JavaScriptCore/wasm/WasmOperations.cpp
r261930 r263117 233 233 inline bool shouldJIT(unsigned functionIndex) 234 234 { 235 if (!VM::canUseJIT())236 return false;237 235 if (!Options::useOMGJIT()) 238 236 return false; -
trunk/Source/JavaScriptCore/wasm/WasmSlowPaths.cpp
r261755 r263117 80 80 inline bool shouldJIT(Wasm::FunctionCodeBlock* codeBlock, RequiredWasmJIT requiredJIT = RequiredWasmJIT::Any) 81 81 { 82 if (!VM::canUseJIT())83 return false;84 82 if (requiredJIT == RequiredWasmJIT::OMG) { 85 83 if (!Options::useOMGJIT()) -
trunk/Source/WebCore/ChangeLog
r263113 r263117 1 2020-06-16 Mark Lam <mark.lam@apple.com> 2 3 Make Options::useJIT() be the canonical source of truth on whether we should use the JIT. 4 https://bugs.webkit.org/show_bug.cgi?id=212556 5 <rdar://problem/63780436> 6 7 Reviewed by Saam Barati. 8 9 * cssjit/SelectorCompiler.cpp: 10 (WebCore::SelectorCompiler::compileSelector): 11 1 12 2020-06-16 Sam Weinig <weinig@apple.com> 2 13 -
trunk/Source/WebCore/cssjit/SelectorCompiler.cpp
r263049 r263117 1 1 /* 2 * Copyright (C) 2013-20 18Apple Inc. All rights reserved.2 * Copyright (C) 2013-2020 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2014 Yusuke Suzuki <utatane.tea@gmail.com> 4 4 * … … 401 401 ASSERT(compiledSelector.status == SelectorCompilationStatus::NotCompiled); 402 402 403 if (!JSC:: VM::canUseJIT()) {403 if (!JSC::Options::useJIT()) { 404 404 compiledSelector.status = SelectorCompilationStatus::CannotCompile; 405 405 return; -
trunk/Source/WebKit/ChangeLog
r263112 r263117 1 2020-06-16 Mark Lam <mark.lam@apple.com> 2 3 Make Options::useJIT() be the canonical source of truth on whether we should use the JIT. 4 https://bugs.webkit.org/show_bug.cgi?id=212556 5 <rdar://problem/63780436> 6 7 Reviewed by Saam Barati. 8 9 * WebProcess/WebProcess.cpp: 10 (WebKit::WebProcess::isJITEnabled): 11 1 12 2020-06-16 David Kilzer <ddkilzer@apple.com> 2 13 -
trunk/Source/WebKit/WebProcess/WebProcess.cpp
r263094 r263117 1002 1002 void WebProcess::isJITEnabled(CompletionHandler<void(bool)>&& completionHandler) 1003 1003 { 1004 completionHandler(JSC:: VM::canUseJIT());1004 completionHandler(JSC::Options::useJIT()); 1005 1005 } 1006 1006
Note:
See TracChangeset
for help on using the changeset viewer.