Changeset 293152 in webkit
- Timestamp:
- Apr 21, 2022, 2:51:10 AM (4 years ago)
- Location:
- releases/WebKitGTK/webkit-2.36/Source/JavaScriptCore
- Files:
-
- 13 edited
-
ChangeLog (modified) (1 diff)
-
bytecode/CodeBlock.cpp (modified) (4 diffs)
-
bytecode/CodeBlock.h (modified) (1 diff)
-
bytecode/RepatchInlines.h (modified) (3 diffs)
-
dfg/DFGOperations.cpp (modified) (2 diffs)
-
interpreter/Interpreter.cpp (modified) (6 diffs)
-
interpreter/InterpreterInlines.h (modified) (2 diffs)
-
llint/LLIntSlowPaths.cpp (modified) (3 diffs)
-
runtime/ExceptionScope.h (modified) (1 diff)
-
runtime/ScriptExecutable.cpp (modified) (1 diff)
-
runtime/VMTraps.cpp (modified) (3 diffs)
-
runtime/VMTraps.h (modified) (6 diffs)
-
runtime/VMTrapsInlines.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
releases/WebKitGTK/webkit-2.36/Source/JavaScriptCore/ChangeLog
r291276 r293152 1 2022-03-03 Saam Barati <sbarati@apple.com> 2 3 Add a DeferTraps scope 4 https://bugs.webkit.org/show_bug.cgi?id=237306 5 <rdar://83494949> 6 7 Reviewed by Mark Lam. 8 9 * bytecode/CodeBlock.cpp: 10 (JSC::CodeBlock::CodeBlock): 11 (JSC::CodeBlock::jettison): 12 (JSC::CodeBlock::noticeIncomingCall): 13 * bytecode/CodeBlock.h: 14 * bytecode/RepatchInlines.h: 15 (JSC::linkFor): 16 (JSC::virtualForWithFunction): 17 * dfg/DFGOperations.cpp: 18 (JSC::DFG::JSC_DEFINE_JIT_OPERATION): 19 * interpreter/Interpreter.cpp: 20 (JSC::Interpreter::executeProgram): 21 (JSC::Interpreter::executeCall): 22 (JSC::Interpreter::executeConstruct): 23 (JSC::Interpreter::execute): 24 (JSC::Interpreter::executeModuleProgram): 25 * interpreter/InterpreterInlines.h: 26 (JSC::Interpreter::execute): 27 * llint/LLIntSlowPaths.cpp: 28 (JSC::LLInt::setUpCall): 29 * runtime/ExceptionScope.h: 30 * runtime/ScriptExecutable.cpp: 31 (JSC::ScriptExecutable::installCode): 32 * runtime/VMTraps.cpp: 33 (JSC::VMTraps::handleTraps): 34 (JSC::VMTraps::takeTopPriorityTrap): 35 * runtime/VMTraps.h: 36 (JSC::VMTraps::needHandling const): 37 (JSC::VMTraps::maybeNeedHandling const): 38 (JSC::VMTraps::hasTrapBit): 39 (JSC::VMTraps::setTrapBit): 40 * runtime/VMTrapsInlines.h: 41 (JSC::DeferTraps::DeferTraps): 42 (JSC::DeferTraps::~DeferTraps): 43 1 44 2022-03-01 Michael Catanzaro <mcatanzaro@gnome.org> 2 45 -
releases/WebKitGTK/webkit-2.36/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r290129 r293152 280 280 , m_didFailFTLCompilation(false) 281 281 , m_hasBeenCompiledWithFTL(false) 282 , m_isJettisoned(false) 282 283 , m_numCalleeLocals(other.m_numCalleeLocals) 283 284 , m_numVars(other.m_numVars) … … 331 332 , m_didFailFTLCompilation(false) 332 333 , m_hasBeenCompiledWithFTL(false) 334 , m_isJettisoned(false) 333 335 , m_numCalleeLocals(unlinkedCodeBlock->numCalleeLocals()) 334 336 , m_numVars(unlinkedCodeBlock->numVars()) … … 2191 2193 VM& vm = *m_vm; 2192 2194 2195 m_isJettisoned = true; 2196 2193 2197 CodeBlock* codeBlock = this; // Placate GCC for use in CODEBLOCK_LOG_EVENT (does not like this). 2194 2198 CODEBLOCK_LOG_EVENT(codeBlock, "jettison", ("due to ", reason, ", counting = ", mode == CountReoptimization, ", detail = ", pointerDump(detail))); … … 2357 2361 void CodeBlock::noticeIncomingCall(CallFrame* callerFrame) 2358 2362 { 2363 RELEASE_ASSERT(!m_isJettisoned); 2364 2359 2365 CodeBlock* callerCodeBlock = callerFrame->codeBlock(); 2360 2366 -
releases/WebKitGTK/webkit-2.36/Source/JavaScriptCore/bytecode/CodeBlock.h
r287596 r293152 775 775 bool m_didFailFTLCompilation : 1; 776 776 bool m_hasBeenCompiledWithFTL : 1; 777 bool m_isJettisoned : 1; 777 778 778 779 bool m_visitChildrenSkippedDueToOldAge { false }; -
releases/WebKitGTK/webkit-2.36/Source/JavaScriptCore/bytecode/RepatchInlines.h
r286095 r293152 28 28 #include "Repatch.h" 29 29 30 #include "VMTrapsInlines.h" 31 30 32 namespace JSC { 31 33 … … 125 127 MacroAssemblerCodePtr<JSEntryPtrTag> codePtr; 126 128 CodeBlock* codeBlock = nullptr; 129 130 DeferTraps deferTraps(vm); // We can't jettison any code until after we link the call. 131 127 132 if (executable->isHostFunction()) { 128 133 codePtr = jsToWasmICCodePtr(vm, kind, callee); … … 188 193 JSScope* scope = function->scopeUnchecked(); 189 194 ExecutableBase* executable = function->executable(); 195 196 DeferTraps deferTraps(vm); // We can't jettison if we're going to call this CodeBlock. 197 190 198 if (UNLIKELY(!executable->hasJITCodeFor(kind))) { 191 199 FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable); -
releases/WebKitGTK/webkit-2.36/Source/JavaScriptCore/dfg/DFGOperations.cpp
r286769 r293152 79 79 #include "TypeProfilerLog.h" 80 80 #include "VMInlines.h" 81 #include "VMTrapsInlines.h" 81 82 82 83 #if ENABLE(JIT) … … 3713 3714 MacroAssemblerCodePtr<JSEntryPtrTag> codePtr; 3714 3715 CodeBlock* codeBlock = nullptr; 3716 DeferTraps deferTraps(vm); // We can't jettison this code if we're about to link to it. 3717 3715 3718 if (executable->isHostFunction()) 3716 3719 codePtr = executable->entrypointFor(kind, MustCheckArity); -
releases/WebKitGTK/webkit-2.36/Source/JavaScriptCore/interpreter/Interpreter.cpp
r290283 r293152 924 924 scope->flattenDictionaryObject(vm); 925 925 926 ProgramCodeBlock* codeBlock;927 {928 CodeBlock* tempCodeBlock;929 program->prepareForExecution<ProgramExecutable>(vm, nullptr, scope, CodeForCall, tempCodeBlock);930 RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception()));931 932 codeBlock = jsCast<ProgramCodeBlock*>(tempCodeBlock);933 ASSERT(codeBlock && codeBlock->numParameters() == 1); // 1 parameter for 'this'.934 }935 936 926 RefPtr<JITCode> jitCode; 937 927 ProtoCallFrame protoCallFrame; 938 928 { 939 DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable. 940 jitCode = program->generatedJITCode(); 941 protoCallFrame.init(codeBlock, globalObject, globalCallee, thisObj, 1); 929 DeferTraps deferTraps(vm); // We can't jettison this code if we're about to run it. 930 931 ProgramCodeBlock* codeBlock; 932 { 933 CodeBlock* tempCodeBlock; 934 program->prepareForExecution<ProgramExecutable>(vm, nullptr, scope, CodeForCall, tempCodeBlock); 935 RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception())); 936 937 codeBlock = jsCast<ProgramCodeBlock*>(tempCodeBlock); 938 ASSERT(codeBlock && codeBlock->numParameters() == 1); // 1 parameter for 'this'. 939 } 940 941 { 942 DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable. 943 jitCode = program->generatedJITCode(); 944 protoCallFrame.init(codeBlock, globalObject, globalCallee, thisObj, 1); 945 } 942 946 } 943 947 … … 986 990 } 987 991 988 CodeBlock* newCodeBlock = nullptr;989 if (isJSCall) {990 // Compile the callee:991 callData.js.functionExecutable->prepareForExecution<FunctionExecutable>(vm, jsCast<JSFunction*>(function), scope, CodeForCall, newCodeBlock);992 RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception()));993 994 ASSERT(newCodeBlock);995 newCodeBlock->m_shouldAlwaysBeInlined = false;996 }997 998 992 RefPtr<JITCode> jitCode; 999 993 ProtoCallFrame protoCallFrame; 1000 994 { 1001 DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable. 1002 if (isJSCall) 1003 jitCode = callData.js.functionExecutable->generatedJITCodeForCall(); 1004 protoCallFrame.init(newCodeBlock, globalObject, function, thisValue, argsCount, args.data()); 995 DeferTraps deferTraps(vm); // We can't jettison this code if we're about to run it. 996 997 CodeBlock* newCodeBlock = nullptr; 998 if (isJSCall) { 999 // Compile the callee: 1000 callData.js.functionExecutable->prepareForExecution<FunctionExecutable>(vm, jsCast<JSFunction*>(function), scope, CodeForCall, newCodeBlock); 1001 RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception())); 1002 1003 ASSERT(newCodeBlock); 1004 newCodeBlock->m_shouldAlwaysBeInlined = false; 1005 } 1006 1007 { 1008 DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable. 1009 if (isJSCall) 1010 jitCode = callData.js.functionExecutable->generatedJITCodeForCall(); 1011 protoCallFrame.init(newCodeBlock, globalObject, function, thisValue, argsCount, args.data()); 1012 } 1005 1013 } 1006 1014 … … 1062 1070 } 1063 1071 1064 CodeBlock* newCodeBlock = nullptr;1065 if (isJSConstruct) {1066 // Compile the callee:1067 constructData.js.functionExecutable->prepareForExecution<FunctionExecutable>(vm, jsCast<JSFunction*>(constructor), scope, CodeForConstruct, newCodeBlock);1068 RETURN_IF_EXCEPTION(throwScope, nullptr);1069 1070 ASSERT(newCodeBlock);1071 newCodeBlock->m_shouldAlwaysBeInlined = false;1072 }1073 1074 1072 RefPtr<JITCode> jitCode; 1075 1073 ProtoCallFrame protoCallFrame; 1076 1074 { 1077 DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable. 1078 if (isJSConstruct) 1079 jitCode = constructData.js.functionExecutable->generatedJITCodeForConstruct(); 1080 protoCallFrame.init(newCodeBlock, globalObject, constructor, newTarget, argsCount, args.data()); 1075 DeferTraps deferTraps(vm); // We can't jettison this code if we're about to run it. 1076 1077 CodeBlock* newCodeBlock = nullptr; 1078 if (isJSConstruct) { 1079 // Compile the callee: 1080 constructData.js.functionExecutable->prepareForExecution<FunctionExecutable>(vm, jsCast<JSFunction*>(constructor), scope, CodeForConstruct, newCodeBlock); 1081 RETURN_IF_EXCEPTION(throwScope, nullptr); 1082 1083 ASSERT(newCodeBlock); 1084 newCodeBlock->m_shouldAlwaysBeInlined = false; 1085 } 1086 1087 { 1088 DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable. 1089 if (isJSConstruct) 1090 jitCode = constructData.js.functionExecutable->generatedJITCodeForConstruct(); 1091 protoCallFrame.init(newCodeBlock, globalObject, constructor, newTarget, argsCount, args.data()); 1092 } 1081 1093 } 1082 1094 … … 1270 1282 callee = JSCallee::create(vm, globalObject, scope); 1271 1283 1272 // Reload CodeBlock. It is possible that we replaced CodeBlock while setting up the environment.1273 {1274 CodeBlock* tempCodeBlock;1275 eval->prepareForExecution<EvalExecutable>(vm, nullptr, scope, CodeForCall, tempCodeBlock);1276 RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception()));1277 1278 codeBlock = jsCast<EvalCodeBlock*>(tempCodeBlock);1279 ASSERT(codeBlock && codeBlock->numParameters() == 1); // 1 parameter for 'this'.1280 }1281 1282 1284 RefPtr<JITCode> jitCode; 1283 1285 ProtoCallFrame protoCallFrame; 1284 1286 { 1285 DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable. 1286 jitCode = eval->generatedJITCode(); 1287 protoCallFrame.init(codeBlock, globalObject, callee, thisValue, 1); 1287 DeferTraps deferTraps(vm); // We can't jettison this code if we're about to run it. 1288 1289 // Reload CodeBlock. It is possible that we replaced CodeBlock while setting up the environment. 1290 { 1291 CodeBlock* tempCodeBlock; 1292 eval->prepareForExecution<EvalExecutable>(vm, nullptr, scope, CodeForCall, tempCodeBlock); 1293 RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception())); 1294 1295 codeBlock = jsCast<EvalCodeBlock*>(tempCodeBlock); 1296 ASSERT(codeBlock && codeBlock->numParameters() == 1); // 1 parameter for 'this'. 1297 } 1298 1299 { 1300 DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable. 1301 jitCode = eval->generatedJITCode(); 1302 protoCallFrame.init(codeBlock, globalObject, callee, thisValue, 1); 1303 } 1288 1304 } 1289 1305 … … 1327 1343 const unsigned numberOfArguments = static_cast<unsigned>(AbstractModuleRecord::Argument::NumberOfArguments); 1328 1344 JSCallee* callee = JSCallee::create(vm, globalObject, scope); 1329 ModuleProgramCodeBlock* codeBlock;1330 {1331 CodeBlock* tempCodeBlock;1332 executable->prepareForExecution<ModuleProgramExecutable>(vm, nullptr, scope, CodeForCall, tempCodeBlock);1333 RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception()));1334 1335 codeBlock = jsCast<ModuleProgramCodeBlock*>(tempCodeBlock);1336 ASSERT(codeBlock && codeBlock->numParameters() == numberOfArguments + 1);1337 }1338 1339 1345 RefPtr<JITCode> jitCode; 1346 1340 1347 ProtoCallFrame protoCallFrame; 1341 1348 JSValue args[numberOfArguments] = { … … 1348 1355 1349 1356 { 1350 DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable. 1351 jitCode = executable->generatedJITCode(); 1352 1353 // The |this| of the module is always `undefined`. 1354 // http://www.ecma-international.org/ecma-262/6.0/#sec-module-environment-records-hasthisbinding 1355 // http://www.ecma-international.org/ecma-262/6.0/#sec-module-environment-records-getthisbinding 1356 protoCallFrame.init(codeBlock, globalObject, callee, jsUndefined(), numberOfArguments + 1, args); 1357 } 1358 1359 record->internalField(JSModuleRecord::Field::State).set(vm, record, jsNumber(static_cast<int>(JSModuleRecord::State::Executing))); 1357 DeferTraps deferTraps(vm); // We can't jettison this code if we're about to run it. 1358 1359 ModuleProgramCodeBlock* codeBlock; 1360 { 1361 CodeBlock* tempCodeBlock; 1362 executable->prepareForExecution<ModuleProgramExecutable>(vm, nullptr, scope, CodeForCall, tempCodeBlock); 1363 RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception())); 1364 1365 codeBlock = jsCast<ModuleProgramCodeBlock*>(tempCodeBlock); 1366 ASSERT(codeBlock && codeBlock->numParameters() == numberOfArguments + 1); 1367 } 1368 1369 1370 { 1371 DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable. 1372 jitCode = executable->generatedJITCode(); 1373 1374 // The |this| of the module is always `undefined`. 1375 // http://www.ecma-international.org/ecma-262/6.0/#sec-module-environment-records-hasthisbinding 1376 // http://www.ecma-international.org/ecma-262/6.0/#sec-module-environment-records-getthisbinding 1377 protoCallFrame.init(codeBlock, globalObject, callee, jsUndefined(), numberOfArguments + 1, args); 1378 } 1379 1380 record->internalField(JSModuleRecord::Field::State).set(vm, record, jsNumber(static_cast<int>(JSModuleRecord::State::Executing))); 1381 } 1360 1382 1361 1383 // Execute the code: -
releases/WebKitGTK/webkit-2.36/Source/JavaScriptCore/interpreter/InterpreterInlines.h
r281939 r293152 37 37 #include "ProtoCallFrameInlines.h" 38 38 #include "UnlinkedCodeBlock.h" 39 #include "VMTrapsInlines.h" 39 40 #include <wtf/UnalignedAccess.h> 40 41 … … 87 88 } 88 89 89 // Reload CodeBlock since GC can replace CodeBlock owned by Executable. 90 CodeBlock* codeBlock; 91 closure.functionExecutable->prepareForExecution<FunctionExecutable>(vm, closure.function, closure.scope, CodeForCall, codeBlock); 92 RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception())); 90 { 91 DeferTraps deferTraps(vm); // We can't jettison this code if we're about to run it. 93 92 94 ASSERT(codeBlock); 95 codeBlock->m_shouldAlwaysBeInlined = false; 96 { 97 DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable. 98 closure.protoCallFrame->setCodeBlock(codeBlock); 93 // Reload CodeBlock since GC can replace CodeBlock owned by Executable. 94 CodeBlock* codeBlock; 95 closure.functionExecutable->prepareForExecution<FunctionExecutable>(vm, closure.function, closure.scope, CodeForCall, codeBlock); 96 RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception())); 97 98 ASSERT(codeBlock); 99 codeBlock->m_shouldAlwaysBeInlined = false; 100 { 101 DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable. 102 closure.protoCallFrame->setCodeBlock(codeBlock); 103 } 99 104 } 105 100 106 // Execute the code: 101 107 throwScope.release(); 102 108 JSValue result = closure.functionExecutable->generatedJITCodeForCall()->execute(&vm, closure.protoCallFrame); 103 104 109 return checkedReturn(result); 105 110 } -
releases/WebKitGTK/webkit-2.36/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r288815 r293152 67 67 #include "SuperSampler.h" 68 68 #include "VMInlines.h" 69 #include "VMTrapsInlines.h" 69 70 #include <wtf/NeverDestroyed.h> 70 71 #include <wtf/StringPrintStream.h> … … 1905 1906 ExecutableBase* executable = callee->executable(); 1906 1907 1908 DeferTraps deferTraps(vm); // We can't jettison this code if we're about to run it. 1909 1907 1910 MacroAssemblerCodePtr<JSEntryPtrTag> codePtr; 1908 CodeBlock* codeBlock = nullptr;1909 1911 // FIXME: Support wasm IC. 1910 1912 // https://bugs.webkit.org/show_bug.cgi?id=220339 … … 1920 1922 LLINT_CALL_CHECK_EXCEPTION(globalObject); 1921 1923 1922 codeBlock = *codeBlockSlot;1924 CodeBlock* codeBlock = *codeBlockSlot; 1923 1925 ASSERT(codeBlock); 1924 1926 -
releases/WebKitGTK/webkit-2.36/Source/JavaScriptCore/runtime/ExceptionScope.h
r277068 r293152 111 111 JSC::VM& vm = (scope__).vm(); \ 112 112 ASSERT(!!(scope__).exception() == vm.traps().needHandling(JSC::VMTraps::NeedExceptionHandling)); \ 113 if (UNLIKELY(vm.traps(). needHandling(JSC::VMTraps::NonDebuggerEvents))) { \113 if (UNLIKELY(vm.traps().maybeNeedHandling(JSC::VMTraps::NonDebuggerEvents))) { \ 114 114 if (vm.hasExceptionsAfterHandlingTraps()) \ 115 115 return value__; \ -
releases/WebKitGTK/webkit-2.36/Source/JavaScriptCore/runtime/ScriptExecutable.cpp
r290129 r293152 197 197 RELEASE_ASSERT(genericCodeBlock->ownerExecutable() == this); 198 198 RELEASE_ASSERT(JITCode::isExecutableScript(genericCodeBlock->jitType())); 199 200 genericCodeBlock->m_isJettisoned = false; 199 201 200 202 dataLogLnIf(Options::verboseOSR(), "Installing ", *genericCodeBlock); -
releases/WebKitGTK/webkit-2.36/Source/JavaScriptCore/runtime/VMTraps.cpp
r289159 r293152 350 350 ASSERT(onlyContainsAsyncEvents(mask)); 351 351 ASSERT(needHandling(mask)); 352 ASSERT(!hasTrapBit(DeferTrapHandling)); 352 353 353 354 if (isDeferringTermination()) … … 391 392 392 393 case NeedExceptionHandling: 394 case DeferTrapHandling: 393 395 default: 394 396 RELEASE_ASSERT_NOT_REACHED(); … … 403 405 // Note: the EventBitShift is already sorted in highest to lowest priority 404 406 // i.e. a bit shift of 0 is highest priority, etc. 405 for ( inti = 0; i < NumberOfEvents; ++i) {407 for (unsigned i = 0; i < NumberOfEvents; ++i) { 406 408 Event event = static_cast<Event>(1 << i); 407 409 if (hasTrapBit(event, mask)) { -
releases/WebKitGTK/webkit-2.36/Source/JavaScriptCore/runtime/VMTraps.h
r280761 r293152 150 150 v(NeedWatchdogCheck) \ 151 151 v(NeedDebuggerBreak) \ 152 v(NeedExceptionHandling) 152 v(NeedExceptionHandling) \ 153 v(DeferTrapHandling) // Must come last in the enum. This defers all events except NeedExceptionHandling. 153 154 154 155 #define DECLARE_VMTRAPS_EVENT_BIT_SHIFT(event__) event__##BitShift, 155 156 enum EventBitShift { 156 157 FOR_EACH_VMTRAPS_EVENTS(DECLARE_VMTRAPS_EVENT_BIT_SHIFT) 157 NumberOfEvents, // This entry must be last in this list.158 158 }; 159 159 #undef DECLARE_VMTRAPS_EVENT_BIT_SHIFT 160 161 162 #define COUNT_EVENT(event) + 1 163 static constexpr BitField NumberOfEvents = FOR_EACH_VMTRAPS_EVENTS(COUNT_EVENT) - 1; // Don't count DeferTrapHandling. 164 static constexpr BitField NumberOfEventsIncludingDefer = FOR_EACH_VMTRAPS_EVENTS(COUNT_EVENT); 165 #undef COUNT_EVENT 160 166 161 167 using Event = BitField; … … 171 177 static constexpr Event NoEvent = 0; 172 178 173 static_assert(NumberOfEvents <= bitsInBitField);179 static_assert(NumberOfEventsIncludingDefer <= bitsInBitField); 174 180 static constexpr BitField AllEvents = (1ull << NumberOfEvents) - 1; 181 static constexpr BitField AllEventsIncludingDefer = (1ull << NumberOfEventsIncludingDefer) - 1; 175 182 static constexpr BitField AsyncEvents = AllEvents & ~NeedExceptionHandling; 176 183 static constexpr BitField NonDebuggerEvents = AllEvents & ~NeedDebuggerBreak; … … 189 196 void willDestroyVM(); 190 197 191 bool needHandling(BitField mask) const { return m_trapBits.loadRelaxed() & mask; } 198 ALWAYS_INLINE bool needHandling(BitField mask) const 199 { 200 auto maskedValue = m_trapBits.loadRelaxed() & (mask | DeferTrapHandling); 201 if (UNLIKELY(maskedValue)) 202 return (maskedValue & NeedExceptionHandling) || !(maskedValue & DeferTrapHandling); 203 return false; 204 } 205 // Designed to be a fast check to rule out if we might need handling, and we need to ensure needHandling on the slow path. 206 ALWAYS_INLINE bool maybeNeedHandling(BitField mask) const { return m_trapBits.loadRelaxed() & mask; } 192 207 void* trapBitsAddress() { return &m_trapBits; } 193 208 … … 207 222 } 208 223 224 bool hasTrapBit(Event event) 225 { 226 return m_trapBits.loadRelaxed() & event; 227 } 209 228 bool hasTrapBit(Event event, BitField mask) 210 229 { … … 215 234 void setTrapBit(Event event) 216 235 { 217 ASSERT((event & ~AllEvents ) == 0);236 ASSERT((event & ~AllEventsIncludingDefer) == 0); 218 237 m_trapBits.exchangeOr(event); 219 238 } … … 267 286 }; 268 287 288 class DeferTraps { 289 public: 290 DeferTraps(VM&); 291 ~DeferTraps(); 292 private: 293 VMTraps& m_traps; 294 bool m_isActive; 295 }; 296 269 297 } // namespace JSC -
releases/WebKitGTK/webkit-2.36/Source/JavaScriptCore/runtime/VMTrapsInlines.h
r276069 r293152 51 51 } 52 52 53 ALWAYS_INLINE DeferTraps::DeferTraps(VM& vm) 54 : m_traps(vm.traps()) 55 , m_isActive(!m_traps.hasTrapBit(VMTraps::DeferTrapHandling)) 56 { 57 if (m_isActive) 58 m_traps.setTrapBit(VMTraps::DeferTrapHandling); 59 } 60 61 ALWAYS_INLINE DeferTraps::~DeferTraps() 62 { 63 if (m_isActive) 64 m_traps.clearTrapBit(VMTraps::DeferTrapHandling); 65 } 66 53 67 } // namespace JSC
Note:
See TracChangeset
for help on using the changeset viewer.