Changeset 292891 in webkit for trunk/Source/JavaScriptCore/debugger
- Timestamp:
- Apr 14, 2022, 2:56:27 PM (3 years ago)
- Location:
- trunk/Source/JavaScriptCore/debugger
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/debugger/Debugger.cpp
r292830 r292891 608 608 ASSERT(isAttached(globalObject)); 609 609 610 VM& vm = globalObject->vm(); 610 611 const String& condition = breakpoint.condition(); 611 612 if (condition.isEmpty()) … … 615 616 DebuggerCallFrame& debuggerCallFrame = currentDebuggerCallFrame(); 616 617 JSObject* scopeExtensionObject = m_client ? m_client->debuggerScopeExtensionObject(*this, globalObject, debuggerCallFrame) : nullptr; 617 JSValue result = debuggerCallFrame.evaluateWithScopeExtension( condition, scopeExtensionObject, exception);618 JSValue result = debuggerCallFrame.evaluateWithScopeExtension(vm, condition, scopeExtensionObject, exception); 618 619 619 620 // We can lose the debugger while executing JavaScript. … … 634 635 ASSERT(isAttached(globalObject)); 635 636 637 VM& vm = globalObject->vm(); 638 636 639 m_currentProbeBatchId++; 637 640 … … 645 648 case Breakpoint::Action::Type::Log: 646 649 dispatchFunctionToObservers([&] (Observer& observer) { 647 observer.breakpointActionLog(debuggerCallFrame.globalObject( ), action.data);650 observer.breakpointActionLog(debuggerCallFrame.globalObject(vm), action.data); 648 651 }); 649 652 break; … … 652 655 NakedPtr<Exception> exception; 653 656 JSObject* scopeExtensionObject = m_client ? m_client->debuggerScopeExtensionObject(*this, globalObject, debuggerCallFrame) : nullptr; 654 debuggerCallFrame.evaluateWithScopeExtension( action.data, scopeExtensionObject, exception);657 debuggerCallFrame.evaluateWithScopeExtension(vm, action.data, scopeExtensionObject, exception); 655 658 if (exception) 656 reportException(debuggerCallFrame.globalObject( ), exception);659 reportException(debuggerCallFrame.globalObject(vm), exception); 657 660 break; 658 661 } … … 667 670 NakedPtr<Exception> exception; 668 671 JSObject* scopeExtensionObject = m_client ? m_client->debuggerScopeExtensionObject(*this, globalObject, debuggerCallFrame) : nullptr; 669 JSValue result = debuggerCallFrame.evaluateWithScopeExtension( action.data, scopeExtensionObject, exception);670 JSC::JSGlobalObject* debuggerGlobalObject = debuggerCallFrame.globalObject( );672 JSValue result = debuggerCallFrame.evaluateWithScopeExtension(vm, action.data, scopeExtensionObject, exception); 673 JSC::JSGlobalObject* debuggerGlobalObject = debuggerCallFrame.globalObject(vm); 671 674 if (exception) 672 675 reportException(debuggerGlobalObject, exception); … … 1027 1030 return currentException(); 1028 1031 1032 VM& vm = globalObject->vm(); 1029 1033 for (RefPtr<DebuggerCallFrame> frame = ¤tDebuggerCallFrame(); frame; frame = frame->callerFrame()) { 1030 DebuggerScope& scope = *frame->scope( );1034 DebuggerScope& scope = *frame->scope(vm); 1031 1035 if (scope.isCatchScope()) 1032 1036 return scope.caughtValue(globalObject); -
trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
r292830 r292891 112 112 } 113 113 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)); 114 JSGlobalObject* DebuggerCallFrame::globalObject(VM& vm) 115 { 116 return scope(vm)->globalObject(); 126 117 } 127 118 … … 136 127 } 137 128 138 String DebuggerCallFrame::functionName( ) const129 String DebuggerCallFrame::functionName(VM& vm) const 139 130 { 140 131 ASSERT(isValid()); … … 142 133 return String(); 143 134 144 VM& vm = m_validMachineFrame->deprecatedVM();145 135 if (isTailDeleted()) { 146 136 if (JSFunction* func = jsDynamicCast<JSFunction*>(vm, m_shadowChickenFrame.callee)) … … 152 142 } 153 143 154 DebuggerScope* DebuggerCallFrame::scope( )144 DebuggerScope* DebuggerCallFrame::scope(VM& vm) 155 145 { 156 146 ASSERT(isValid()); … … 159 149 160 150 if (!m_scope) { 161 VM& vm = m_validMachineFrame->deprecatedVM();162 151 JSScope* scope; 163 152 CodeBlock* codeBlock = m_validMachineFrame->codeBlock(); … … 176 165 } 177 166 178 DebuggerCallFrame::Type DebuggerCallFrame::type( ) const167 DebuggerCallFrame::Type DebuggerCallFrame::type(VM& vm) const 179 168 { 180 169 ASSERT(isValid()); … … 185 174 return FunctionType; 186 175 187 if (jsDynamicCast<JSFunction*>( m_validMachineFrame->deprecatedVM(), m_validMachineFrame->jsCallee()))176 if (jsDynamicCast<JSFunction*>(vm, m_validMachineFrame->jsCallee())) 188 177 return FunctionType; 189 178 … … 217 206 218 207 // Evaluate some JavaScript code in the scope of this frame. 219 JSValue DebuggerCallFrame::evaluateWithScopeExtension( const String& script, JSObject* scopeExtensionObject, NakedPtr<Exception>& exception)208 JSValue DebuggerCallFrame::evaluateWithScopeExtension(VM& vm, const String& script, JSObject* scopeExtensionObject, NakedPtr<Exception>& exception) 220 209 { 221 210 CallFrame* callFrame = nullptr; … … 243 232 return jsUndefined(); 244 233 245 VM& vm = callFrame->deprecatedVM();246 234 JSLockHolder lock(vm); 247 235 auto catchScope = DECLARE_CATCH_SCOPE(vm); … … 261 249 TDZEnvironment variablesUnderTDZ; 262 250 PrivateNameEnvironment privateNameEnvironment; 263 JSScope::collectClosureVariablesUnderTDZ(scope( )->jsScope(), variablesUnderTDZ, privateNameEnvironment);251 JSScope::collectClosureVariablesUnderTDZ(scope(vm)->jsScope(), variablesUnderTDZ, privateNameEnvironment); 264 252 265 253 ECMAMode ecmaMode = codeBlock->ownerExecutable()->isInStrictContext() ? ECMAMode::strict() : ECMAMode::sloppy(); … … 276 264 } 277 265 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()); 279 267 if (UNLIKELY(catchScope.exception())) { 280 268 exception = catchScope.exception(); -
trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.h
r266534 r292891 49 49 50 50 JS_EXPORT_PRIVATE RefPtr<DebuggerCallFrame> callerFrame(); 51 JSGlobalObject* globalObject( );51 JSGlobalObject* globalObject(VM&); 52 52 JS_EXPORT_PRIVATE SourceID sourceID() const; 53 53 … … 57 57 JS_EXPORT_PRIVATE const TextPosition& position() const { return m_position; } 58 58 59 JS_EXPORT_PRIVATE JSGlobalObject* deprecatedVMEntryGlobalObject() const; 60 JS_EXPORT_PRIVATE DebuggerScope* scope(); 61 JS_EXPORT_PRIVATE String functionName() const; 62 JS_EXPORT_PRIVATE Type type() const; 59 JS_EXPORT_PRIVATE DebuggerScope* scope(VM&); 60 JS_EXPORT_PRIVATE String functionName(VM&) const; 61 JS_EXPORT_PRIVATE Type type(VM&) const; 63 62 JS_EXPORT_PRIVATE JSValue thisValue(VM&) const; 64 63 65 JSValue evaluateWithScopeExtension( const String&, JSObject* scopeExtensionObject, NakedPtr<Exception>&);64 JSValue evaluateWithScopeExtension(VM&, const String&, JSObject* scopeExtensionObject, NakedPtr<Exception>&); 66 65 67 66 bool isValid() const { return !!m_validMachineFrame || isTailDeleted(); }
Note:
See TracChangeset
for help on using the changeset viewer.