Ignore:
Timestamp:
Mar 5, 2022, 10:55:21 AM (3 years ago)
Author:
[email protected]
Message:

Fix broken SuspendExceptionScope and remove redundant VM::DeferExceptionScope.
https://bugs.webkit.org/show_bug.cgi?id=237441
<rdar://problem/89769627>

Reviewed by Yusuke Suzuki.

Source/JavaScriptCore:

SuspendExceptionScope was meant to do exactly the same thing that VM::DeferExceptionScope
does, except that SuspendExceptionScope hasn't been updated to handle exception
handling via VMTraps bits.

This patch will fix SuspendExceptionScope to work like VM::DeferExceptionScope,
and remove the now redundant VM::DeferExceptionScope. SuspendExceptionScope is
the better name here because the scope actually suspends any pending exception.
This is different from other Defer scopes where we prevent some new event from
arising and defer the event to a later time.

  • interpreter/FrameTracers.h:

(JSC::SuspendExceptionScope::SuspendExceptionScope):
(JSC::SuspendExceptionScope::~SuspendExceptionScope):

  • interpreter/Interpreter.cpp:

(JSC::UnwindFunctor::notifyDebuggerOfUnwinding):

  • runtime/TypeProfilerLog.cpp:

(JSC::TypeProfilerLog::processLogEntries):

  • runtime/VM.h:

(JSC::VM::restorePreviousException): Deleted.
(JSC::VM::DeferExceptionScope::DeferExceptionScope): Deleted.
(JSC::VM::DeferExceptionScope::~DeferExceptionScope): Deleted.

Source/WebCore:

  • inspector/InspectorFrontendAPIDispatcher.cpp:

(WebCore::InspectorFrontendAPIDispatcher::evaluateExpression):

  • inspector/InspectorFrontendHost.cpp:

(WebCore::InspectorFrontendHost::evaluateScriptInExtensionTab):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/FrameTracers.h

    r254087 r290869  
    11/*
    2  * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2022 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3636class SuspendExceptionScope {
    3737public:
    38     SuspendExceptionScope(VM* vm)
     38    SuspendExceptionScope(VM& vm)
    3939        : m_vm(vm)
     40        , m_exceptionWasSet(vm.m_exception)
     41        , m_savedException(vm.m_exception, nullptr)
     42        , m_savedLastException(vm.m_lastException, nullptr)
    4043    {
    41         auto scope = DECLARE_CATCH_SCOPE(*vm);
    42         oldException = scope.exception();
    43         scope.clearException();
     44        if (m_exceptionWasSet)
     45            m_vm.traps().clearTrapBit(VMTraps::NeedExceptionHandling);
    4446    }
    4547    ~SuspendExceptionScope()
    4648    {
    47         m_vm->restorePreviousException(oldException);
     49        if (m_exceptionWasSet)
     50            m_vm.traps().setTrapBit(VMTraps::NeedExceptionHandling);
    4851    }
    4952private:
    50     Exception* oldException;
    51     VM* m_vm;
     53    VM& m_vm;
     54    bool m_exceptionWasSet;
     55    SetForScope<Exception*> m_savedException;
     56    SetForScope<Exception*> m_savedLastException;
    5257};
    5358
Note: See TracChangeset for help on using the changeset viewer.