summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2009-09-30 06:37:33 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2009-09-30 06:37:33 (GMT)
commit828b776f0a9ff84288e6be1bbbdb91448ca1bd4d (patch)
treece4419b9c72a9a53c3ad3de9568b9cc89f9cf0bf /src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h
parent3c3745c29d9fbae98b55a88b5ebccb0b29b4eed5 (diff)
parentb83ea4276a242893c01586a5f1a2d62d54369cfa (diff)
downloadQt-828b776f0a9ff84288e6be1bbbdb91448ca1bd4d.zip
Qt-828b776f0a9ff84288e6be1bbbdb91448ca1bd4d.tar.gz
Qt-828b776f0a9ff84288e6be1bbbdb91448ca1bd4d.tar.bz2
Merge branch '4.6' of git@scm.dev.troll.no:qt/qt into 4.6
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h')
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h36
1 files changed, 13 insertions, 23 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h
index f0ce73e..05834fc 100644
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h
+++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h
@@ -29,6 +29,7 @@
#ifndef EvalCodeCache_h
#define EvalCodeCache_h
+#include "Executable.h"
#include "JSGlobalObject.h"
#include "Nodes.h"
#include "Parser.h"
@@ -41,44 +42,33 @@ namespace JSC {
class EvalCodeCache {
public:
- PassRefPtr<EvalNode> get(ExecState* exec, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue)
+ PassRefPtr<EvalExecutable> get(ExecState* exec, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue)
{
- RefPtr<EvalNode> evalNode;
+ RefPtr<EvalExecutable> evalExecutable;
if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject())
- evalNode = m_cacheMap.get(evalSource.rep());
+ evalExecutable = m_cacheMap.get(evalSource.rep());
- if (!evalNode) {
- int errorLine;
- UString errorMessage;
-
- SourceCode source = makeSource(evalSource);
- evalNode = exec->globalData().parser->parse<EvalNode>(exec, exec->dynamicGlobalObject()->debugger(), source, &errorLine, &errorMessage);
- if (evalNode) {
- if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject() && m_cacheMap.size() < maxCacheEntries)
- m_cacheMap.set(evalSource.rep(), evalNode);
- } else {
- exceptionValue = Error::create(exec, SyntaxError, errorMessage, errorLine, source.provider()->asID(), 0);
+ if (!evalExecutable) {
+ evalExecutable = EvalExecutable::create(exec, makeSource(evalSource));
+ exceptionValue = evalExecutable->compile(exec, scopeChain);
+ if (exceptionValue)
return 0;
- }
+
+ if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject() && m_cacheMap.size() < maxCacheEntries)
+ m_cacheMap.set(evalSource.rep(), evalExecutable);
}
- return evalNode.release();
+ return evalExecutable.release();
}
bool isEmpty() const { return m_cacheMap.isEmpty(); }
- void mark()
- {
- EvalCacheMap::iterator end = m_cacheMap.end();
- for (EvalCacheMap::iterator ptr = m_cacheMap.begin(); ptr != end; ++ptr)
- ptr->second->mark();
- }
private:
static const int maxCacheableSourceLength = 256;
static const int maxCacheEntries = 64;
- typedef HashMap<RefPtr<UString::Rep>, RefPtr<EvalNode> > EvalCacheMap;
+ typedef HashMap<RefPtr<UString::Rep>, RefPtr<EvalExecutable> > EvalCacheMap;
EvalCacheMap m_cacheMap;
};