JSValue DebuggerCallFrame::evaluateNonBlocking(const String& script, NakedPtr<Exception>& exception) { ASSERT(isValid()); CallFrame* callFrame = m_callFrame; if (!callFrame) return jsNull(); if (!callFrame->codeBlock()) return JSValue(); DebuggerEvalEnabler evalEnabler(callFrame); VM& vm = callFrame->vm(); auto& codeBlock = *callFrame->codeBlock(); ThisTDZMode thisTDZMode = codeBlock.unlinkedCodeBlock()->constructorKind() == ConstructorKind::Derived ? ThisTDZMode::AlwaysCheck : ThisTDZMode::CheckIfNeeded; VariableEnvironment variablesUnderTDZ; JSScope::collectVariablesUnderTDZ(scope()->jsScope(), variablesUnderTDZ); EvalExecutable* eval = EvalExecutable::create(callFrame, makeSource(script), codeBlock.isStrictMode(), thisTDZMode, codeBlock.unlinkedCodeBlock()->isDerivedConstructorContext(), codeBlock.unlinkedCodeBlock()->isArrowFunction(), &variablesUnderTDZ); if (vm.exception()) { exception = vm.exception(); vm.clearException(); return jsUndefined(); } JSValue thisValue = thisValueForCallFrame(callFrame); JSValue result = vm.interpreter->execute(eval, callFrame, thisValue, scope()->jsScope()); if (vm.exception()) { exception = vm.exception(); vm.clearException(); } ASSERT(result); return result; }
JSValue DebuggerCallFrame::evaluateWithCallFrame(CallFrame* callFrame, const String& script, JSValue& exception) { if (!callFrame) return jsNull(); JSLockHolder lock(callFrame); if (!callFrame->codeBlock()) return JSValue(); VM& vm = callFrame->vm(); EvalExecutable* eval = EvalExecutable::create(callFrame, makeSource(script), callFrame->codeBlock()->isStrictMode()); if (vm.exception()) { exception = vm.exception(); vm.clearException(); } JSValue thisValue = thisValueForCallFrame(callFrame); JSValue result = vm.interpreter->execute(eval, callFrame, thisValue, callFrame->scope()); if (vm.exception()) { exception = vm.exception(); vm.clearException(); } ASSERT(result); return result; }
JSValue DebuggerCallFrame::thisValue() const { ASSERT(isValid()); return thisValueForCallFrame(m_callFrame); }