src/script/api/qscriptengine_p.h
branchRCL_3
changeset 7 3f74d0d4af4c
parent 4 3b1da2848fc7
equal deleted inserted replaced
6:dee5afe5301f 7:3f74d0d4af4c
   253     QList<QScriptEngineAgent*> ownedAgents;
   253     QList<QScriptEngineAgent*> ownedAgents;
   254     QScriptEngineAgent *activeAgent;
   254     QScriptEngineAgent *activeAgent;
   255     int agentLineNumber;
   255     int agentLineNumber;
   256     QScriptValuePrivate *registeredScriptValues;
   256     QScriptValuePrivate *registeredScriptValues;
   257     QScriptValuePrivate *freeScriptValues;
   257     QScriptValuePrivate *freeScriptValues;
       
   258     static const int maxFreeScriptValues = 256;
       
   259     int freeScriptValuesCount;
   258     QScriptStringPrivate *registeredScriptStrings;
   260     QScriptStringPrivate *registeredScriptStrings;
   259     QHash<int, QScriptTypeInfo*> m_typeInfos;
   261     QHash<int, QScriptTypeInfo*> m_typeInfos;
   260     int processEventsInterval;
   262     int processEventsInterval;
   261     QScriptValue abortResult;
   263     QScriptValue abortResult;
   262     bool inEval;
   264     bool inEval;
   375 inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(size_t size)
   377 inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(size_t size)
   376 {
   378 {
   377     if (freeScriptValues) {
   379     if (freeScriptValues) {
   378         QScriptValuePrivate *p = freeScriptValues;
   380         QScriptValuePrivate *p = freeScriptValues;
   379         freeScriptValues = p->next;
   381         freeScriptValues = p->next;
       
   382         --freeScriptValuesCount;
   380         return p;
   383         return p;
   381     }
   384     }
   382     return reinterpret_cast<QScriptValuePrivate*>(qMalloc(size));
   385     return reinterpret_cast<QScriptValuePrivate*>(qMalloc(size));
   383 }
   386 }
   384 
   387 
   385 inline void QScriptEnginePrivate::freeScriptValuePrivate(QScriptValuePrivate *p)
   388 inline void QScriptEnginePrivate::freeScriptValuePrivate(QScriptValuePrivate *p)
   386 {
   389 {
   387     p->next = freeScriptValues;
   390     if (freeScriptValuesCount < maxFreeScriptValues) {
   388     freeScriptValues = p;
   391         p->next = freeScriptValues;
       
   392         freeScriptValues = p;
       
   393         ++freeScriptValuesCount;
       
   394     } else {
       
   395         qFree(p);
       
   396     }
   389 }
   397 }
   390 
   398 
   391 inline void QScriptEnginePrivate::registerScriptValue(QScriptValuePrivate *value)
   399 inline void QScriptEnginePrivate::registerScriptValue(QScriptValuePrivate *value)
   392 {
   400 {
   393     value->prev = 0;
   401     value->prev = 0;