Title: [290769] trunk/Source/_javascript_Core

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (290768 => 290769)


--- trunk/Source/_javascript_Core/ChangeLog	2022-03-03 06:49:38 UTC (rev 290768)
+++ trunk/Source/_javascript_Core/ChangeLog	2022-03-03 07:08:00 UTC (rev 290769)
@@ -1,3 +1,16 @@
+2022-03-02  Commit Queue  <[email protected]>
+
+        Unreviewed, reverting r290717.
+        https://bugs.webkit.org/show_bug.cgi?id=237409
+
+        Speedometer2
+
+        Reverted changeset:
+
+        "Add a DeferTraps scope"
+        https://bugs.webkit.org/show_bug.cgi?id=237306
+        https://commits.webkit.org/r290717
+
 2022-03-02  Justin Michaud  <[email protected]>
 
         Refactor OpcodeTraits to support the possibility of having 2-byte WASM opcode ids in bytecode streams

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (290768 => 290769)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2022-03-03 06:49:38 UTC (rev 290768)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2022-03-03 07:08:00 UTC (rev 290769)
@@ -279,7 +279,6 @@
     , m_didFailJITCompilation(false)
     , m_didFailFTLCompilation(false)
     , m_hasBeenCompiledWithFTL(false)
-    , m_isJettisoned(false)
     , m_numCalleeLocals(other.m_numCalleeLocals)
     , m_numVars(other.m_numVars)
     , m_numberOfArgumentsToSkip(other.m_numberOfArgumentsToSkip)
@@ -331,7 +330,6 @@
     , m_didFailJITCompilation(false)
     , m_didFailFTLCompilation(false)
     , m_hasBeenCompiledWithFTL(false)
-    , m_isJettisoned(false)
     , m_numCalleeLocals(unlinkedCodeBlock->numCalleeLocals())
     , m_numVars(unlinkedCodeBlock->numVars())
     , m_hasDebuggerStatement(false)
@@ -2193,8 +2191,6 @@
 
     VM& vm = *m_vm;
 
-    m_isJettisoned = true;
-
     CodeBlock* codeBlock = this; // Placate GCC for use in CODEBLOCK_LOG_EVENT  (does not like this).
     CODEBLOCK_LOG_EVENT(codeBlock, "jettison", ("due to ", reason, ", counting = ", mode == CountReoptimization, ", detail = ", pointerDump(detail)));
 
@@ -2361,8 +2357,6 @@
 
 void CodeBlock::noticeIncomingCall(CallFrame* callerFrame)
 {
-    RELEASE_ASSERT(!m_isJettisoned);
-
     CodeBlock* callerCodeBlock = callerFrame->codeBlock();
     
     dataLogLnIf(Options::verboseCallLink(), "Noticing call link from ", pointerDump(callerCodeBlock), " to ", *this);

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (290768 => 290769)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2022-03-03 06:49:38 UTC (rev 290768)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2022-03-03 07:08:00 UTC (rev 290769)
@@ -774,7 +774,6 @@
     bool m_didFailJITCompilation : 1;
     bool m_didFailFTLCompilation : 1;
     bool m_hasBeenCompiledWithFTL : 1;
-    bool m_isJettisoned : 1;
 
     bool m_visitChildrenSkippedDueToOldAge { false };
 

Modified: trunk/Source/_javascript_Core/bytecode/RepatchInlines.h (290768 => 290769)


--- trunk/Source/_javascript_Core/bytecode/RepatchInlines.h	2022-03-03 06:49:38 UTC (rev 290768)
+++ trunk/Source/_javascript_Core/bytecode/RepatchInlines.h	2022-03-03 07:08:00 UTC (rev 290769)
@@ -27,8 +27,6 @@
 
 #include "Repatch.h"
 
-#include "VMTrapsInlines.h"
-
 namespace JSC {
 
 inline SlowPathReturnType handleHostCall(JSGlobalObject* globalObject, CallFrame* calleeFrame, JSValue callee, CallLinkInfo* callLinkInfo)
@@ -126,9 +124,6 @@
 
     MacroAssemblerCodePtr<JSEntryPtrTag> codePtr;
     CodeBlock* codeBlock = nullptr;
-
-    DeferTraps deferTraps(vm); // We can't jettison any code until after we link the call.
-
     if (executable->isHostFunction()) {
         codePtr = jsToWasmICCodePtr(vm, kind, callee);
         if (!codePtr)
@@ -192,9 +187,6 @@
     JSFunction* function = jsCast<JSFunction*>(calleeAsFunctionCell);
     JSScope* scope = function->scopeUnchecked();
     ExecutableBase* executable = function->executable();
-
-    DeferTraps deferTraps(vm); // We can't jettison if we're going to call this CodeBlock.
-
     if (UNLIKELY(!executable->hasJITCodeFor(kind))) {
         FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable);
 

Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.cpp (290768 => 290769)


--- trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2022-03-03 06:49:38 UTC (rev 290768)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2022-03-03 07:08:00 UTC (rev 290769)
@@ -78,7 +78,6 @@
 #include "Symbol.h"
 #include "TypeProfilerLog.h"
 #include "VMInlines.h"
-#include "VMTrapsInlines.h"
 
 #if ENABLE(JIT)
 #if ENABLE(DFG_JIT)
@@ -3713,8 +3712,6 @@
     // https://bugs.webkit.org/show_bug.cgi?id=220339
     MacroAssemblerCodePtr<JSEntryPtrTag> codePtr;
     CodeBlock* codeBlock = nullptr;
-    DeferTraps deferTraps(vm); // We can't jettison this code if we're about to link to it.
-
     if (executable->isHostFunction())
         codePtr = executable->entrypointFor(kind, MustCheckArity);
     else {

Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (290768 => 290769)


--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2022-03-03 06:49:38 UTC (rev 290768)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2022-03-03 07:08:00 UTC (rev 290769)
@@ -949,26 +949,22 @@
     if (scope->structure(vm)->isUncacheableDictionary())
         scope->flattenDictionaryObject(vm);
 
+    ProgramCodeBlock* codeBlock;
+    {
+        CodeBlock* tempCodeBlock;
+        program->prepareForExecution<ProgramExecutable>(vm, nullptr, scope, CodeForCall, tempCodeBlock);
+        RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception()));
+
+        codeBlock = jsCast<ProgramCodeBlock*>(tempCodeBlock);
+        ASSERT(codeBlock && codeBlock->numParameters() == 1); // 1 parameter for 'this'.
+    }
+
     RefPtr<JITCode> jitCode;
     ProtoCallFrame protoCallFrame;
     {
-        DeferTraps deferTraps(vm); // We can't jettison this code if we're about to run it.
-
-        ProgramCodeBlock* codeBlock;
-        {
-            CodeBlock* tempCodeBlock;
-            program->prepareForExecution<ProgramExecutable>(vm, nullptr, scope, CodeForCall, tempCodeBlock);
-            RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception()));
-
-            codeBlock = jsCast<ProgramCodeBlock*>(tempCodeBlock);
-            ASSERT(codeBlock && codeBlock->numParameters() == 1); // 1 parameter for 'this'.
-        }
-
-        {
-            DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable.
-            jitCode = program->generatedJITCode();
-            protoCallFrame.init(codeBlock, globalObject, globalCallee, thisObj, 1);
-        }
+        DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable.
+        jitCode = program->generatedJITCode();
+        protoCallFrame.init(codeBlock, globalObject, globalCallee, thisObj, 1);
     }
 
     // Execute the code:
@@ -1015,27 +1011,23 @@
             return throwScope.exception();
     }
 
+    CodeBlock* newCodeBlock = nullptr;
+    if (isJSCall) {
+        // Compile the callee:
+        callData.js.functionExecutable->prepareForExecution<FunctionExecutable>(vm, jsCast<JSFunction*>(function), scope, CodeForCall, newCodeBlock);
+        RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception()));
+
+        ASSERT(newCodeBlock);
+        newCodeBlock->m_shouldAlwaysBeInlined = false;
+    }
+
     RefPtr<JITCode> jitCode;
     ProtoCallFrame protoCallFrame;
     {
-        DeferTraps deferTraps(vm); // We can't jettison this code if we're about to run it.
-
-        CodeBlock* newCodeBlock = nullptr;
-        if (isJSCall) {
-            // Compile the callee:
-            callData.js.functionExecutable->prepareForExecution<FunctionExecutable>(vm, jsCast<JSFunction*>(function), scope, CodeForCall, newCodeBlock);
-            RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception()));
-
-            ASSERT(newCodeBlock);
-            newCodeBlock->m_shouldAlwaysBeInlined = false;
-        }
-
-        {
-            DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable.
-            if (isJSCall)
-                jitCode = callData.js.functionExecutable->generatedJITCodeForCall();
-            protoCallFrame.init(newCodeBlock, globalObject, function, thisValue, argsCount, args.data());
-        }
+        DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable.
+        if (isJSCall)
+            jitCode = callData.js.functionExecutable->generatedJITCodeForCall();
+        protoCallFrame.init(newCodeBlock, globalObject, function, thisValue, argsCount, args.data());
     }
 
     JSValue result;
@@ -1095,27 +1087,23 @@
             return nullptr;
     }
 
+    CodeBlock* newCodeBlock = nullptr;
+    if (isJSConstruct) {
+        // Compile the callee:
+        constructData.js.functionExecutable->prepareForExecution<FunctionExecutable>(vm, jsCast<JSFunction*>(constructor), scope, CodeForConstruct, newCodeBlock);
+        RETURN_IF_EXCEPTION(throwScope, nullptr);
+
+        ASSERT(newCodeBlock);
+        newCodeBlock->m_shouldAlwaysBeInlined = false;
+    }
+
     RefPtr<JITCode> jitCode;
     ProtoCallFrame protoCallFrame;
     {
-        DeferTraps deferTraps(vm); // We can't jettison this code if we're about to run it.
-
-        CodeBlock* newCodeBlock = nullptr;
-        if (isJSConstruct) {
-            // Compile the callee:
-            constructData.js.functionExecutable->prepareForExecution<FunctionExecutable>(vm, jsCast<JSFunction*>(constructor), scope, CodeForConstruct, newCodeBlock);
-            RETURN_IF_EXCEPTION(throwScope, nullptr);
-
-            ASSERT(newCodeBlock);
-            newCodeBlock->m_shouldAlwaysBeInlined = false;
-        }
-
-        {
-            DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable.
-            if (isJSConstruct)
-                jitCode = constructData.js.functionExecutable->generatedJITCodeForConstruct();
-            protoCallFrame.init(newCodeBlock, globalObject, constructor, newTarget, argsCount, args.data());
-        }
+        DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable.
+        if (isJSConstruct)
+            jitCode = constructData.js.functionExecutable->generatedJITCodeForConstruct();
+        protoCallFrame.init(newCodeBlock, globalObject, constructor, newTarget, argsCount, args.data());
     }
 
     JSValue result;
@@ -1307,26 +1295,22 @@
     else
         callee = JSCallee::create(vm, globalObject, scope);
 
+    // Reload CodeBlock. It is possible that we replaced CodeBlock while setting up the environment.
+    {
+        CodeBlock* tempCodeBlock;
+        eval->prepareForExecution<EvalExecutable>(vm, nullptr, scope, CodeForCall, tempCodeBlock);
+        RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception()));
+
+        codeBlock = jsCast<EvalCodeBlock*>(tempCodeBlock);
+        ASSERT(codeBlock && codeBlock->numParameters() == 1); // 1 parameter for 'this'.
+    }
+
     RefPtr<JITCode> jitCode;
     ProtoCallFrame protoCallFrame;
     {
-        DeferTraps deferTraps(vm); // We can't jettison this code if we're about to run it.
-
-        // Reload CodeBlock. It is possible that we replaced CodeBlock while setting up the environment.
-        {
-            CodeBlock* tempCodeBlock;
-            eval->prepareForExecution<EvalExecutable>(vm, nullptr, scope, CodeForCall, tempCodeBlock);
-            RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception()));
-
-            codeBlock = jsCast<EvalCodeBlock*>(tempCodeBlock);
-            ASSERT(codeBlock && codeBlock->numParameters() == 1); // 1 parameter for 'this'.
-        }
-
-        {
-            DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable.
-            jitCode = eval->generatedJITCode();
-            protoCallFrame.init(codeBlock, globalObject, callee, thisValue, 1);
-        }
+        DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable.
+        jitCode = eval->generatedJITCode();
+        protoCallFrame.init(codeBlock, globalObject, callee, thisValue, 1);
     }
 
     // Execute the code:
@@ -1368,8 +1352,17 @@
 
     const unsigned numberOfArguments = static_cast<unsigned>(AbstractModuleRecord::Argument::NumberOfArguments);
     JSCallee* callee = JSCallee::create(vm, globalObject, scope);
+    ModuleProgramCodeBlock* codeBlock;
+    {
+        CodeBlock* tempCodeBlock;
+        executable->prepareForExecution<ModuleProgramExecutable>(vm, nullptr, scope, CodeForCall, tempCodeBlock);
+        RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception()));
+
+        codeBlock = jsCast<ModuleProgramCodeBlock*>(tempCodeBlock);
+        ASSERT(codeBlock && codeBlock->numParameters() == numberOfArguments + 1);
+    }
+
     RefPtr<JITCode> jitCode;
-
     ProtoCallFrame protoCallFrame;
     JSValue args[numberOfArguments] = {
         record,
@@ -1380,32 +1373,17 @@
     };
 
     {
-        DeferTraps deferTraps(vm); // We can't jettison this code if we're about to run it.
+        DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable.
+        jitCode = executable->generatedJITCode();
 
-        ModuleProgramCodeBlock* codeBlock;
-        {
-            CodeBlock* tempCodeBlock;
-            executable->prepareForExecution<ModuleProgramExecutable>(vm, nullptr, scope, CodeForCall, tempCodeBlock);
-            RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception()));
+        // The |this| of the module is always `undefined`.
+        // http://www.ecma-international.org/ecma-262/6.0/#sec-module-environment-records-hasthisbinding
+        // http://www.ecma-international.org/ecma-262/6.0/#sec-module-environment-records-getthisbinding
+        protoCallFrame.init(codeBlock, globalObject, callee, jsUndefined(), numberOfArguments + 1, args);
+    }
 
-            codeBlock = jsCast<ModuleProgramCodeBlock*>(tempCodeBlock);
-            ASSERT(codeBlock && codeBlock->numParameters() == numberOfArguments + 1);
-        }
+    record->internalField(JSModuleRecord::Field::State).set(vm, record, jsNumber(static_cast<int>(JSModuleRecord::State::Executing)));
 
-
-        {
-            DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable.
-            jitCode = executable->generatedJITCode();
-
-            // The |this| of the module is always `undefined`.
-            // http://www.ecma-international.org/ecma-262/6.0/#sec-module-environment-records-hasthisbinding
-            // http://www.ecma-international.org/ecma-262/6.0/#sec-module-environment-records-getthisbinding
-            protoCallFrame.init(codeBlock, globalObject, callee, jsUndefined(), numberOfArguments + 1, args);
-        }
-
-        record->internalField(JSModuleRecord::Field::State).set(vm, record, jsNumber(static_cast<int>(JSModuleRecord::State::Executing)));
-    }
-
     // Execute the code:
     throwScope.release();
     ASSERT(jitCode == executable->generatedJITCode().ptr());

Modified: trunk/Source/_javascript_Core/interpreter/InterpreterInlines.h (290768 => 290769)


--- trunk/Source/_javascript_Core/interpreter/InterpreterInlines.h	2022-03-03 06:49:38 UTC (rev 290768)
+++ trunk/Source/_javascript_Core/interpreter/InterpreterInlines.h	2022-03-03 07:08:00 UTC (rev 290769)
@@ -36,7 +36,6 @@
 #include "LLIntData.h"
 #include "ProtoCallFrameInlines.h"
 #include "UnlinkedCodeBlock.h"
-#include "VMTrapsInlines.h"
 #include <wtf/UnalignedAccess.h>
 
 namespace JSC {
@@ -87,25 +86,21 @@
             return throwScope.exception();
     }
 
+    // Reload CodeBlock since GC can replace CodeBlock owned by Executable.
+    CodeBlock* codeBlock;
+    closure.functionExecutable->prepareForExecution<FunctionExecutable>(vm, closure.function, closure.scope, CodeForCall, codeBlock);
+    RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception()));
+
+    ASSERT(codeBlock);
+    codeBlock->m_shouldAlwaysBeInlined = false;
     {
-        DeferTraps deferTraps(vm); // We can't jettison this code if we're about to run it.
-
-        // Reload CodeBlock since GC can replace CodeBlock owned by Executable.
-        CodeBlock* codeBlock;
-        closure.functionExecutable->prepareForExecution<FunctionExecutable>(vm, closure.function, closure.scope, CodeForCall, codeBlock);
-        RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception()));
-
-        ASSERT(codeBlock);
-        codeBlock->m_shouldAlwaysBeInlined = false;
-        {
-            DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable.
-            closure.protoCallFrame->setCodeBlock(codeBlock);
-        }
+        DisallowGC disallowGC; // Ensure no GC happens. GC can replace CodeBlock in Executable.
+        closure.protoCallFrame->setCodeBlock(codeBlock);
     }
-
     // Execute the code:
     throwScope.release();
     JSValue result = closure.functionExecutable->generatedJITCodeForCall()->execute(&vm, closure.protoCallFrame);
+
     return checkedReturn(result);
 }
 

Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (290768 => 290769)


--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2022-03-03 06:49:38 UTC (rev 290768)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2022-03-03 07:08:00 UTC (rev 290769)
@@ -66,7 +66,6 @@
 #include "ShadowChicken.h"
 #include "SuperSampler.h"
 #include "VMInlines.h"
-#include "VMTrapsInlines.h"
 #include <wtf/NeverDestroyed.h>
 #include <wtf/StringPrintStream.h>
 
@@ -1905,9 +1904,8 @@
     JSScope* scope = callee->scopeUnchecked();
     ExecutableBase* executable = callee->executable();
 
-    DeferTraps deferTraps(vm); // We can't jettison this code if we're about to run it.
-
     MacroAssemblerCodePtr<JSEntryPtrTag> codePtr;
+    CodeBlock* codeBlock = nullptr;
     // FIXME: Support wasm IC.
     // https://bugs.webkit.org/show_bug.cgi?id=220339
     if (executable->isHostFunction())
@@ -1921,7 +1919,7 @@
         functionExecutable->prepareForExecution<FunctionExecutable>(vm, callee, scope, kind, *codeBlockSlot);
         LLINT_CALL_CHECK_EXCEPTION(globalObject);
 
-        CodeBlock* codeBlock = *codeBlockSlot;
+        codeBlock = *codeBlockSlot;
         ASSERT(codeBlock);
 
         ArityCheckMode arity;

Modified: trunk/Source/_javascript_Core/runtime/ScriptExecutable.cpp (290768 => 290769)


--- trunk/Source/_javascript_Core/runtime/ScriptExecutable.cpp	2022-03-03 06:49:38 UTC (rev 290768)
+++ trunk/Source/_javascript_Core/runtime/ScriptExecutable.cpp	2022-03-03 07:08:00 UTC (rev 290769)
@@ -196,8 +196,6 @@
     if (genericCodeBlock) {
         RELEASE_ASSERT(genericCodeBlock->ownerExecutable() == this);
         RELEASE_ASSERT(JITCode::isExecutableScript(genericCodeBlock->jitType()));
-
-        genericCodeBlock->m_isJettisoned = false;
         
         dataLogLnIf(Options::verboseOSR(), "Installing ", *genericCodeBlock);
         

Modified: trunk/Source/_javascript_Core/runtime/VMTraps.cpp (290768 => 290769)


--- trunk/Source/_javascript_Core/runtime/VMTraps.cpp	2022-03-03 06:49:38 UTC (rev 290768)
+++ trunk/Source/_javascript_Core/runtime/VMTraps.cpp	2022-03-03 07:08:00 UTC (rev 290769)
@@ -349,7 +349,6 @@
     auto scope = DECLARE_THROW_SCOPE(vm);
     ASSERT(onlyContainsAsyncEvents(mask));
     ASSERT(needHandling(mask));
-    ASSERT(!hasTrapBit(DeferTrapHandling));
 
     if (isDeferringTermination())
         mask &= ~NeedTermination;
@@ -391,7 +390,6 @@
             return;
 
         case NeedExceptionHandling:
-        case DeferTrapHandling:
         default:
             RELEASE_ASSERT_NOT_REACHED();
         }
@@ -404,7 +402,7 @@
 
     // Note: the EventBitShift is already sorted in highest to lowest priority
     // i.e. a bit shift of 0 is highest priority, etc.
-    for (unsigned i = 0; i < NumberOfEvents; ++i) {
+    for (int i = 0; i < NumberOfEvents; ++i) {
         Event event = static_cast<Event>(1 << i);
         if (hasTrapBit(event, mask)) {
             clearTrapBit(event);

Modified: trunk/Source/_javascript_Core/runtime/VMTraps.h (290768 => 290769)


--- trunk/Source/_javascript_Core/runtime/VMTraps.h	2022-03-03 06:49:38 UTC (rev 290768)
+++ trunk/Source/_javascript_Core/runtime/VMTraps.h	2022-03-03 07:08:00 UTC (rev 290769)
@@ -149,21 +149,15 @@
     v(NeedTermination) \
     v(NeedWatchdogCheck) \
     v(NeedDebuggerBreak) \
-    v(NeedExceptionHandling) \
-    v(DeferTrapHandling) // Must come last in the enum. This defers all events except NeedExceptionHandling.
+    v(NeedExceptionHandling)
 
 #define DECLARE_VMTRAPS_EVENT_BIT_SHIFT(event__)  event__##BitShift,
     enum EventBitShift {
         FOR_EACH_VMTRAPS_EVENTS(DECLARE_VMTRAPS_EVENT_BIT_SHIFT)
+        NumberOfEvents, // This entry must be last in this list.
     };
 #undef DECLARE_VMTRAPS_EVENT_BIT_SHIFT
 
-
-#define COUNT_EVENT(event) + 1
-    static constexpr BitField NumberOfEvents = FOR_EACH_VMTRAPS_EVENTS(COUNT_EVENT) - 1; // Don't count DeferTrapHandling.
-    static constexpr BitField NumberOfEventsIncludingDefer = FOR_EACH_VMTRAPS_EVENTS(COUNT_EVENT);
-#undef COUNT_EVENT
-
     using Event = BitField;
 
 #define DECLARE_VMTRAPS_EVENT(event__) \
@@ -176,9 +170,8 @@
 
     static constexpr Event NoEvent = 0;
 
-    static_assert(NumberOfEventsIncludingDefer <= bitsInBitField);
+    static_assert(NumberOfEvents <= bitsInBitField);
     static constexpr BitField AllEvents = (1ull << NumberOfEvents) - 1;
-    static constexpr BitField AllEventsIncludingDefer = (1ull << NumberOfEventsIncludingDefer) - 1;
     static constexpr BitField AsyncEvents = AllEvents & ~NeedExceptionHandling;
     static constexpr BitField NonDebuggerEvents = AllEvents & ~NeedDebuggerBreak;
     static constexpr BitField NonDebuggerAsyncEvents = AsyncEvents & ~NeedDebuggerBreak;
@@ -195,13 +188,7 @@
 
     void willDestroyVM();
 
-    ALWAYS_INLINE bool needHandling(BitField mask) const
-    {
-        auto maskedValue = m_trapBits.loadRelaxed() & (mask | DeferTrapHandling);
-        if (UNLIKELY(maskedValue))
-            return (maskedValue & NeedExceptionHandling) || !(maskedValue & DeferTrapHandling);
-        return false;
-    }
+    bool needHandling(BitField mask) const { return m_trapBits.loadRelaxed() & mask; }
     void* trapBitsAddress() { return &m_trapBits; }
 
     enum class DeferAction {
@@ -219,10 +206,6 @@
             invalidateCodeBlocksOnStack();
     }
 
-    bool hasTrapBit(Event event)
-    {
-        return m_trapBits.loadRelaxed() & event;
-    }
     bool hasTrapBit(Event event, BitField mask)
     {
         BitField maskedBits = event & mask;
@@ -231,7 +214,7 @@
     void clearTrapBit(Event event) { m_trapBits.exchangeAnd(~event); }
     void setTrapBit(Event event)
     {
-        ASSERT((event & ~AllEventsIncludingDefer) == 0);
+        ASSERT((event & ~AllEvents) == 0);
         m_trapBits.exchangeOr(event);
     }
 
@@ -283,13 +266,4 @@
     friend class SignalSender;
 };
 
-class DeferTraps {
-public:
-    DeferTraps(VM&);
-    ~DeferTraps();
-private:
-    VMTraps& m_traps;
-    bool m_isActive;
-};
-
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/VMTrapsInlines.h (290768 => 290769)


--- trunk/Source/_javascript_Core/runtime/VMTrapsInlines.h	2022-03-03 06:49:38 UTC (rev 290768)
+++ trunk/Source/_javascript_Core/runtime/VMTrapsInlines.h	2022-03-03 07:08:00 UTC (rev 290769)
@@ -50,18 +50,4 @@
         undoDeferTerminationSlow(deferAction);
 }
 
-ALWAYS_INLINE DeferTraps::DeferTraps(VM& vm)
-    : m_traps(vm.traps())
-    , m_isActive(!m_traps.hasTrapBit(VMTraps::DeferTrapHandling))
-{
-    if (m_isActive)
-        m_traps.setTrapBit(VMTraps::DeferTrapHandling);
-}
-
-ALWAYS_INLINE DeferTraps::~DeferTraps()
-{
-    if (m_isActive)
-        m_traps.clearTrapBit(VMTraps::DeferTrapHandling);
-}
-
 } // namespace JSC
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to