Ignore:
Timestamp:
Apr 14, 2022, 2:56:27 PM (3 years ago)
Author:
[email protected]
Message:

[JSC] Reduce use of CallFrame::deprecatedVM
https://bugs.webkit.org/show_bug.cgi?id=239326

Reviewed by Devin Rousso.

Reduce use of CallFrame::deprecatedVM, mainly in inspector related code to eventually remove CallFrame::deprecatedVM.

  • Source/JavaScriptCore/debugger/Debugger.cpp:

(JSC::Debugger::evaluateBreakpointCondition):
(JSC::Debugger::evaluateBreakpointActions):
(JSC::Debugger::exceptionOrCaughtValue):

  • Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp:

(JSC::DebuggerCallFrame::globalObject):
(JSC::DebuggerCallFrame::functionName const):
(JSC::DebuggerCallFrame::scope):
(JSC::DebuggerCallFrame::type const):
(JSC::DebuggerCallFrame::evaluateWithScopeExtension):
(JSC::DebuggerCallFrame::deprecatedVMEntryGlobalObject const): Deleted.

  • Source/JavaScriptCore/debugger/DebuggerCallFrame.h:
  • Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp:

(Inspector::JSJavaScriptCallFrame::evaluateWithScopeExtension):
(Inspector::JSJavaScriptCallFrame::scopeDescriptions):
(Inspector::JSJavaScriptCallFrame::functionName const):
(Inspector::JSJavaScriptCallFrame::scopeChain const):
(Inspector::JSJavaScriptCallFrame::type const):

  • Source/JavaScriptCore/inspector/JavaScriptCallFrame.h:

(Inspector::JavaScriptCallFrame::functionName const):
(Inspector::JavaScriptCallFrame::type const):
(Inspector::JavaScriptCallFrame::scopeChain const):
(Inspector::JavaScriptCallFrame::evaluateWithScopeExtension const):
(Inspector::JavaScriptCallFrame::deprecatedVMEntryGlobalObject const): Deleted.

  • Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp:

(Inspector::InspectorDebuggerAgent::debuggerScopeExtensionObject):
(Inspector::InspectorDebuggerAgent::didPause):

  • Source/JavaScriptCore/interpreter/Interpreter.cpp:

(JSC::Interpreter::debug):

Canonical link: https://commits.webkit.org/249661@main

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp

    r292830 r292891  
    112112}
    113113
    114 JSGlobalObject* DebuggerCallFrame::globalObject()
    115 {
    116     return scope()->globalObject();
    117 }
    118 
    119 JSC::JSGlobalObject* DebuggerCallFrame::deprecatedVMEntryGlobalObject() const
    120 {
    121     ASSERT(isValid());
    122     if (!isValid())
    123         return nullptr;
    124     VM& vm = m_validMachineFrame->deprecatedVM();
    125     return vm.deprecatedVMEntryGlobalObject(m_validMachineFrame->lexicalGlobalObject(vm));
     114JSGlobalObject* DebuggerCallFrame::globalObject(VM& vm)
     115{
     116    return scope(vm)->globalObject();
    126117}
    127118
     
    136127}
    137128
    138 String DebuggerCallFrame::functionName() const
     129String DebuggerCallFrame::functionName(VM& vm) const
    139130{
    140131    ASSERT(isValid());
     
    142133        return String();
    143134
    144     VM& vm = m_validMachineFrame->deprecatedVM();
    145135    if (isTailDeleted()) {
    146136        if (JSFunction* func = jsDynamicCast<JSFunction*>(vm, m_shadowChickenFrame.callee))
     
    152142}
    153143
    154 DebuggerScope* DebuggerCallFrame::scope()
     144DebuggerScope* DebuggerCallFrame::scope(VM& vm)
    155145{
    156146    ASSERT(isValid());
     
    159149
    160150    if (!m_scope) {
    161         VM& vm = m_validMachineFrame->deprecatedVM();
    162151        JSScope* scope;
    163152        CodeBlock* codeBlock = m_validMachineFrame->codeBlock();
     
    176165}
    177166
    178 DebuggerCallFrame::Type DebuggerCallFrame::type() const
     167DebuggerCallFrame::Type DebuggerCallFrame::type(VM& vm) const
    179168{
    180169    ASSERT(isValid());
     
    185174        return FunctionType;
    186175
    187     if (jsDynamicCast<JSFunction*>(m_validMachineFrame->deprecatedVM(), m_validMachineFrame->jsCallee()))
     176    if (jsDynamicCast<JSFunction*>(vm, m_validMachineFrame->jsCallee()))
    188177        return FunctionType;
    189178
     
    217206
    218207// Evaluate some JavaScript code in the scope of this frame.
    219 JSValue DebuggerCallFrame::evaluateWithScopeExtension(const String& script, JSObject* scopeExtensionObject, NakedPtr<Exception>& exception)
     208JSValue DebuggerCallFrame::evaluateWithScopeExtension(VM& vm, const String& script, JSObject* scopeExtensionObject, NakedPtr<Exception>& exception)
    220209{
    221210    CallFrame* callFrame = nullptr;
     
    243232        return jsUndefined();
    244233
    245     VM& vm = callFrame->deprecatedVM();
    246234    JSLockHolder lock(vm);
    247235    auto catchScope = DECLARE_CATCH_SCOPE(vm);
     
    261249    TDZEnvironment variablesUnderTDZ;
    262250    PrivateNameEnvironment privateNameEnvironment;
    263     JSScope::collectClosureVariablesUnderTDZ(scope()->jsScope(), variablesUnderTDZ, privateNameEnvironment);
     251    JSScope::collectClosureVariablesUnderTDZ(scope(vm)->jsScope(), variablesUnderTDZ, privateNameEnvironment);
    264252
    265253    ECMAMode ecmaMode = codeBlock->ownerExecutable()->isInStrictContext() ? ECMAMode::strict() : ECMAMode::sloppy();
     
    276264    }
    277265
    278     JSValue result = vm.interpreter->execute(eval, globalObject, debuggerCallFrame->thisValue(vm), debuggerCallFrame->scope()->jsScope());
     266    JSValue result = vm.interpreter->execute(eval, globalObject, debuggerCallFrame->thisValue(vm), debuggerCallFrame->scope(vm)->jsScope());
    279267    if (UNLIKELY(catchScope.exception())) {
    280268        exception = catchScope.exception();
Note: See TracChangeset for help on using the changeset viewer.