[JSC] Remove non-LargeAllocation restriction for JSCallee
https://bugs.webkit.org/show_bug.cgi?id=203260

Reviewed by Saam Barati.

Source/JavaScriptCore:

We now pass JSGlobalObject* instead of ExecState*. And we are getting VM& from JSGlobalObject*.
Because now accessing ExecState::vm() becomes less frequent, we can remove the restriction that
callee is only allocated in non-LargeAllocation, which restriction made ExecState::vm fast.

This patch renames `CallFrame::vm` to `CallFrame::deprecatedVM`. And we avoid using it as much as possible.
And we also remove the restriction that callee needs to be in non-LargeAllocation.

* API/JSContextRef.cpp:
(JSContextCreateBacktrace):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::noticeIncomingCall):
* debugger/DebuggerCallFrame.cpp:
(JSC::DebuggerCallFrame::deprecatedVMEntryGlobalObject const):
(JSC::DebuggerCallFrame::functionName const):
(JSC::DebuggerCallFrame::scope):
(JSC::DebuggerCallFrame::type const):
(JSC::DebuggerCallFrame::evaluateWithScopeExtension):
(JSC::DebuggerCallFrame::positionForCallFrame):
* dfg/DFGOSRExit.cpp:
(JSC::DFG::OSRExit::executeOSRExit):
(JSC::DFG::OSRExit::compileOSRExit):
(JSC::DFG::OSRExit::debugOperationPrintSpeculationFailure):
* dfg/DFGOperations.cpp:
* ftl/FTLOSRExitCompiler.cpp:
(JSC::FTL::compileFTLOSRExit):
* ftl/FTLOperations.cpp:
(JSC::FTL::compileFTLLazySlowPath):
* inspector/JSInjectedScriptHost.cpp:
(Inspector::JSInjectedScriptHost::evaluateWithScopeExtension):
* inspector/ScriptCallStackFactory.cpp:
(Inspector::createScriptCallStack):
(Inspector::createScriptCallStackForConsole):
* interpreter/CallFrame.cpp:
(JSC::CallFrame::callerSourceOrigin):
(JSC::CallFrame::friendlyFunctionName):
* interpreter/CallFrame.h:
(JSC::CallFrame::iterate):
* interpreter/Interpreter.cpp:
(JSC::sizeOfVarargs):
(JSC::sizeFrameForVarargs):
(JSC::Interpreter::getStackTrace):
(JSC::Interpreter::unwind):
(JSC::Interpreter::notifyDebuggerOfExceptionToBeThrown):
(JSC::Interpreter::debug):
* interpreter/Interpreter.h:
* interpreter/ShadowChicken.cpp:
(JSC::ShadowChicken::update):
* interpreter/StackVisitor.cpp:
(JSC::StackVisitor::StackVisitor):
(JSC::StackVisitor::Frame::functionName const):
* interpreter/StackVisitor.h:
(JSC::StackVisitor::visit):
* jit/HostCallReturnValue.cpp:
(JSC::getHostCallReturnValueWithExecState):
* jit/JITOperations.cpp:
* jit/Repatch.cpp:
(JSC::linkFor):
(JSC::linkPolymorphicCall):
* jit/Repatch.h:
* jsc.cpp:
(functionJSCStack):
(functionRunString):
(functionLoadString):
(functionCallerSourceOrigin):
(functionCallerIsOMGCompiled):
(functionDollarEvalScript):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* runtime/Error.cpp:
(JSC::getBytecodeOffset):
* runtime/FunctionConstructor.cpp:
(JSC::constructFunction):
* runtime/JSCellInlines.h:
(JSC::CallFrame::deprecatedVM const):
(JSC::CallFrame::vm const): Deleted.
* runtime/JSFunction.cpp:
(JSC::retrieveArguments):
(JSC::JSFunction::argumentsGetter):
(JSC::retrieveCallerFunction):
(JSC::JSFunction::callerGetter):
(JSC::JSFunction::defineOwnProperty):
* runtime/JSGlobalObject.cpp:
(JSC::assertCall):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncEval):
(JSC::globalFuncImportModule):
* runtime/NullSetterFunction.cpp:
(JSC::callerIsStrict):
(JSC::NullSetterFunctionInternal::callReturnUndefined):
* tools/JSDollarVM.cpp:
(IGNORE_WARNINGS_BEGIN):
(JSC::functionLLintTrue):
(JSC::functionJITTrue):
(JSC::functionDumpRegisters):
(JSC::functionShadowChickenFunctionsOnStack):
* tools/VMInspector.cpp:
(JSC::VMInspector::codeBlockForFrame):
(JSC::VMInspector::dumpCallFrame):
(JSC::VMInspector::dumpRegisters):
(JSC::VMInspector::dumpStack):
* wasm/js/WasmToJS.cpp:
(JSC::Wasm::wasmToJS):

Source/WebCore:

Passing VM& instead of calling CallFrame::vm.

* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::callerGlobalObject):
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::responsibleDocument):
* bindings/js/JSDOMWindowBase.h:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateCallWith):
* testing/Internals.cpp:
(WebCore::Internals::parserMetaData):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@251457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp b/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
index 00c7554..2ae0b07 100644
--- a/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
+++ b/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
@@ -124,7 +124,7 @@
     ASSERT(isValid());
     if (!isValid())
         return nullptr;
-    VM& vm = m_validMachineFrame->vm();
+    VM& vm = m_validMachineFrame->deprecatedVM();
     return vm.deprecatedVMEntryGlobalObject(m_validMachineFrame->wasmAwareLexicalGlobalObject(vm));
 }
 
@@ -144,7 +144,7 @@
     if (!isValid())
         return String();
 
-    VM& vm = m_validMachineFrame->vm();
+    VM& vm = m_validMachineFrame->deprecatedVM();
     if (isTailDeleted()) {
         if (JSFunction* func = jsDynamicCast<JSFunction*>(vm, m_shadowChickenFrame.callee))
             return func->calculatedDisplayName(vm);
@@ -161,7 +161,7 @@
         return nullptr;
 
     if (!m_scope) {
-        VM& vm = m_validMachineFrame->vm();
+        VM& vm = m_validMachineFrame->deprecatedVM();
         JSScope* scope;
         CodeBlock* codeBlock = m_validMachineFrame->codeBlock();
         if (isTailDeleted())
@@ -187,7 +187,7 @@
     if (isTailDeleted())
         return FunctionType;
 
-    if (jsDynamicCast<JSFunction*>(m_validMachineFrame->vm(), m_validMachineFrame->jsCallee()))
+    if (jsDynamicCast<JSFunction*>(m_validMachineFrame->deprecatedVM(), m_validMachineFrame->jsCallee()))
         return FunctionType;
 
     return ProgramType;
@@ -226,7 +226,7 @@
     if (!callFrame)
         return jsUndefined();
 
-    VM& vm = callFrame->vm();
+    VM& vm = callFrame->deprecatedVM();
     JSLockHolder lock(vm);
     auto catchScope = DECLARE_CATCH_SCOPE(vm);
 
@@ -253,7 +253,7 @@
     VariableEnvironment variablesUnderTDZ;
     JSScope::collectClosureVariablesUnderTDZ(scope()->jsScope(), variablesUnderTDZ);
 
-    auto* eval = DirectEvalExecutable::create(globalObject, makeSource(script, callFrame->callerSourceOrigin()), codeBlock->isStrictMode(), codeBlock->unlinkedCodeBlock()->derivedContextType(), codeBlock->unlinkedCodeBlock()->isArrowFunction(), evalContextType, &variablesUnderTDZ);
+    auto* eval = DirectEvalExecutable::create(globalObject, makeSource(script, callFrame->callerSourceOrigin(vm)), codeBlock->isStrictMode(), codeBlock->unlinkedCodeBlock()->derivedContextType(), codeBlock->unlinkedCodeBlock()->isArrowFunction(), evalContextType, &variablesUnderTDZ);
     if (UNLIKELY(catchScope.exception())) {
         exception = catchScope.exception();
         catchScope.clearException();
@@ -311,7 +311,7 @@
 TextPosition DebuggerCallFrame::positionForCallFrame(VM& vm, CallFrame* callFrame)
 {
     LineAndColumnFunctor functor;
-    StackVisitor::visit(callFrame, &vm, functor);
+    StackVisitor::visit(callFrame, vm, functor);
     return TextPosition(OrdinalNumber::fromOneBasedInt(functor.line()), OrdinalNumber::fromOneBasedInt(functor.column()));
 }