- class FunctionExecutable : public ScriptExecutable {
- friend class JIT;
- friend class LLIntOffsetsExtractor;
- public:
- typedef ScriptExecutable Base;
-
- static FunctionExecutable* create(VM& vm, const SourceCode& source, UnlinkedFunctionExecutable* unlinkedExecutable, unsigned firstLine, unsigned lastLine, unsigned startColumn)
- {
- FunctionExecutable* executable = new (NotNull, allocateCell<FunctionExecutable>(vm.heap)) FunctionExecutable(vm, source, unlinkedExecutable, firstLine, lastLine, startColumn);
- executable->finishCreation(vm);
- return executable;
- }
- static FunctionExecutable* fromGlobalCode(const Identifier& name, ExecState*, Debugger*, const SourceCode&, JSObject** exception);
-
- static void destroy(JSCell*);
-
- UnlinkedFunctionExecutable* unlinkedExecutable()
- {
- return m_unlinkedExecutable.get();
- }
-
- // Returns either call or construct bytecode. This can be appropriate
- // for answering questions that that don't vary between call and construct --
- // for example, argumentsRegister().
- FunctionCodeBlock& generatedBytecode()
- {
- if (m_codeBlockForCall)
- return *m_codeBlockForCall;
- ASSERT(m_codeBlockForConstruct);
- return *m_codeBlockForConstruct;
- }
-
- PassOwnPtr<FunctionCodeBlock> produceCodeBlockFor(JSScope*, CodeSpecializationKind, JSObject*& exception);
-
- JSObject* compileForCall(ExecState* exec, JSScope* scope)
- {
- RELEASE_ASSERT(exec->vm().dynamicGlobalObject);
- JSObject* error = 0;
- if (!m_codeBlockForCall)
- error = compileForCallInternal(exec, scope, JITCode::bottomTierJIT());
- ASSERT(!error == !!m_codeBlockForCall);
- return error;
- }
-
- JSObject* compileOptimizedForCall(ExecState*, JSScope*, unsigned bytecodeIndex);
-
-#if ENABLE(JIT)
- void jettisonOptimizedCodeForCall(VM&);
- bool jitCompileForCall(ExecState*);
-#endif
-
- bool isGeneratedForCall() const
- {
- return m_codeBlockForCall;
- }
-
- FunctionCodeBlock& generatedBytecodeForCall()
- {
- ASSERT(m_codeBlockForCall);
- return *m_codeBlockForCall;
- }
-
- JSObject* compileForConstruct(ExecState* exec, JSScope* scope)
- {
- RELEASE_ASSERT(exec->vm().dynamicGlobalObject);
- JSObject* error = 0;
- if (!m_codeBlockForConstruct)
- error = compileForConstructInternal(exec, scope, JITCode::bottomTierJIT());
- ASSERT(!error == !!m_codeBlockForConstruct);
- return error;
- }
-
- JSObject* compileOptimizedForConstruct(ExecState*, JSScope*, unsigned bytecodeIndex);
-
-#if ENABLE(JIT)
- void jettisonOptimizedCodeForConstruct(VM&);
- bool jitCompileForConstruct(ExecState*);
-#endif
-
- bool isGeneratedForConstruct() const
- {
- return m_codeBlockForConstruct;
- }