+void ProgramExecutable::visitChildren(JSCell* cell, SlotVisitor& visitor)
+{
+ ProgramExecutable* thisObject = jsCast<ProgramExecutable*>(cell);
+ ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
+ COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
+ ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
+ ScriptExecutable::visitChildren(thisObject, visitor);
+ visitor.append(&thisObject->m_unlinkedProgramCodeBlock);
+ if (thisObject->m_programCodeBlock)
+ thisObject->m_programCodeBlock->visitAggregate(visitor);
+}
+
+void ProgramExecutable::clearCode()
+{
+ m_programCodeBlock.clear();
+ m_unlinkedProgramCodeBlock.clear();
+ Base::clearCode();
+}
+
+FunctionCodeBlock* FunctionExecutable::baselineCodeBlockFor(CodeSpecializationKind kind)
+{
+ FunctionCodeBlock* result;
+ if (kind == CodeForCall)
+ result = m_codeBlockForCall.get();
+ else {
+ RELEASE_ASSERT(kind == CodeForConstruct);
+ result = m_codeBlockForConstruct.get();
+ }
+ if (!result)
+ return 0;
+ while (result->alternative())
+ result = static_cast<FunctionCodeBlock*>(result->alternative());
+ RELEASE_ASSERT(result);
+ ASSERT(JITCode::isBaselineCode(result->getJITType()));
+ return result;
+}
+
+JSObject* FunctionExecutable::compileOptimizedForCall(ExecState* exec, JSScope* scope, unsigned bytecodeIndex)
+{
+ RELEASE_ASSERT(exec->vm().dynamicGlobalObject);
+ ASSERT(!!m_codeBlockForCall);
+ JSObject* error = 0;
+ if (m_codeBlockForCall->getJITType() != JITCode::topTierJIT())
+ error = compileForCallInternal(exec, scope, JITCode::nextTierJIT(m_codeBlockForCall->getJITType()), bytecodeIndex);
+ ASSERT(!!m_codeBlockForCall);
+ return error;
+}
+
+JSObject* FunctionExecutable::compileOptimizedForConstruct(ExecState* exec, JSScope* scope, unsigned bytecodeIndex)
+{
+ RELEASE_ASSERT(exec->vm().dynamicGlobalObject);
+ ASSERT(!!m_codeBlockForConstruct);
+ JSObject* error = 0;
+ if (m_codeBlockForConstruct->getJITType() != JITCode::topTierJIT())
+ error = compileForConstructInternal(exec, scope, JITCode::nextTierJIT(m_codeBlockForConstruct->getJITType()), bytecodeIndex);
+ ASSERT(!!m_codeBlockForConstruct);
+ return error;
+}