+inline SourceProviderCacheItem::~SourceProviderCacheItem()
+{
+ for (unsigned i = 0; i < usedVariablesCount + writtenVariablesCount; ++i)
+ m_variables[i]->deref();
+}
+
+inline std::unique_ptr<SourceProviderCacheItem> SourceProviderCacheItem::create(const SourceProviderCacheItemCreationParameters& parameters)
+{
+ size_t variableCount = parameters.writtenVariables.size() + parameters.usedVariables.size();
+ size_t objectSize = sizeof(SourceProviderCacheItem) + sizeof(StringImpl*) * variableCount;
+ void* slot = fastMalloc(objectSize);
+ return std::unique_ptr<SourceProviderCacheItem>(new (slot) SourceProviderCacheItem(parameters));
+}
+
+inline SourceProviderCacheItem::SourceProviderCacheItem(const SourceProviderCacheItemCreationParameters& parameters)
+ : functionNameStart(parameters.functionNameStart)
+ , needsFullActivation(parameters.needsFullActivation)
+ , closeBraceLine(parameters.closeBraceLine)
+ , usesEval(parameters.usesEval)
+ , closeBraceOffset(parameters.closeBraceOffset)
+ , strictMode(parameters.strictMode)
+ , closeBraceLineStartOffset(parameters.closeBraceLineStartOffset)
+ , usedVariablesCount(parameters.usedVariables.size())
+ , writtenVariablesCount(parameters.writtenVariables.size())
+{
+ unsigned j = 0;
+ for (unsigned i = 0; i < usedVariablesCount; ++i, ++j) {
+ m_variables[j] = parameters.usedVariables[i].get();
+ m_variables[j]->ref();
+ }
+ for (unsigned i = 0; i < writtenVariablesCount; ++i, ++j) {
+ m_variables[j] = parameters.writtenVariables[i].get();
+ m_variables[j]->ref();
+ }
+}
+
+#if COMPILER(MSVC)
+#pragma warning(pop)
+#endif
+