UnlinkedFunctionCodeBlock* UnlinkedFunctionExecutable::unlinkedCodeBlockFor( VM& vm, const SourceCode& source, CodeSpecializationKind specializationKind, DebuggerMode debuggerMode, ParserError& error, SourceParseMode parseMode) { switch (specializationKind) { case CodeForCall: if (UnlinkedFunctionCodeBlock* codeBlock = m_unlinkedCodeBlockForCall.get()) return codeBlock; break; case CodeForConstruct: if (UnlinkedFunctionCodeBlock* codeBlock = m_unlinkedCodeBlockForConstruct.get()) return codeBlock; break; } UnlinkedFunctionCodeBlock* result = generateUnlinkedFunctionCodeBlock( vm, this, source, specializationKind, debuggerMode, isBuiltinFunction() ? UnlinkedBuiltinFunction : UnlinkedNormalFunction, error, parseMode); if (error.isValid()) return nullptr; switch (specializationKind) { case CodeForCall: m_unlinkedCodeBlockForCall.set(vm, this, result); break; case CodeForConstruct: m_unlinkedCodeBlockForConstruct.set(vm, this, result); break; } return result; }
UnlinkedFunctionCodeBlock* UnlinkedFunctionExecutable::codeBlockFor(VM& vm, const SourceCode& source, CodeSpecializationKind specializationKind, DebuggerMode debuggerMode, ProfilerMode profilerMode, bool bodyIncludesBraces, ParserError& error) { switch (specializationKind) { case CodeForCall: if (UnlinkedFunctionCodeBlock* codeBlock = m_codeBlockForCall.get()) return codeBlock; break; case CodeForConstruct: if (UnlinkedFunctionCodeBlock* codeBlock = m_codeBlockForConstruct.get()) return codeBlock; break; } UnlinkedFunctionCodeBlock* result = generateFunctionCodeBlock(vm, this, source, specializationKind, debuggerMode, profilerMode, isBuiltinFunction() ? UnlinkedBuiltinFunction : UnlinkedNormalFunction, bodyIncludesBraces, error); if (error.m_type != ParserError::ErrorNone) return 0; switch (specializationKind) { case CodeForCall: m_codeBlockForCall.set(vm, this, result); m_symbolTableForCall.set(vm, this, result->symbolTable()); break; case CodeForConstruct: m_codeBlockForConstruct.set(vm, this, result); m_symbolTableForConstruct.set(vm, this, result->symbolTable()); break; } return result; }
bool JSFunction::isHostOrBuiltinFunction() const { return isHostFunction() || isBuiltinFunction(); }