summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.cpp20
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.h1
-rw-r--r--src/script/api/qscriptengine.cpp26
-rw-r--r--src/script/bridge/qscriptdeclarativeclass.cpp4
-rw-r--r--src/script/bridge/qscriptdeclarativeobject.cpp8
-rw-r--r--src/script/bridge/qscriptdeclarativeobject_p.h7
6 files changed, 42 insertions, 24 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.cpp
index 5e79794..3df5a84 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.cpp
@@ -59,13 +59,8 @@ FunctionExecutable::~FunctionExecutable()
delete m_codeBlock;
}
-JSObject* EvalExecutable::compile(ExecState* exec, ScopeChainNode* scopeChainNode)
+void EvalExecutable::compile(ExecState*exec, RefPtr<EvalNode> &evalNode, ScopeChainNode* scopeChainNode)
{
- int errLine;
- UString errMsg;
- RefPtr<EvalNode> evalNode = exec->globalData().parser->parse<EvalNode>(&exec->globalData(), exec->lexicalGlobalObject()->debugger(), exec, m_source, &errLine, &errMsg);
- if (!evalNode)
- return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url());
recordParse(evalNode->features(), evalNode->lineNo(), evalNode->lastLine());
ScopeChain scopeChain(scopeChainNode);
@@ -75,7 +70,18 @@ JSObject* EvalExecutable::compile(ExecState* exec, ScopeChainNode* scopeChainNod
m_evalCodeBlock = new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth());
OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(evalNode.get(), globalObject->debugger(), scopeChain, m_evalCodeBlock->symbolTable(), m_evalCodeBlock));
generator->generate();
-
+}
+
+JSObject* EvalExecutable::compile(ExecState* exec, ScopeChainNode* scopeChainNode)
+{
+ int errLine;
+ UString errMsg;
+ RefPtr<EvalNode> evalNode = exec->globalData().parser->parse<EvalNode>(&exec->globalData(), exec->lexicalGlobalObject()->debugger(), exec, m_source, &errLine, &errMsg);
+ if (!evalNode)
+ return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url());
+
+ compile(exec, evalNode, scopeChainNode);
+
evalNode->destroyData();
return 0;
}
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.h
index f3003dd..8d6a668 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.h
@@ -155,6 +155,7 @@ namespace JSC {
}
JSObject* compile(ExecState*, ScopeChainNode*);
+ void compile(ExecState*, RefPtr<EvalNode> &, ScopeChainNode*);
ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*);
static PassRefPtr<EvalExecutable> create(const SourceCode& source) { return adoptRef(new EvalExecutable(source)); }
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 7256f27..2bb6eae 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -344,6 +344,7 @@ class QScriptProgramPrivate
{
public:
QScriptProgramPrivate() : refcount(1), hasException(false) { }
+ ~QScriptProgramPrivate() { if (evalNode) evalNode->destroyData(); }
void addref() { ++refcount; }
void release() { if (--refcount) delete this; }
@@ -2143,15 +2144,17 @@ QScriptProgram QScriptEngine::compile(const QString &program, const QString &fil
QBoolBlocker inEval(d->inEval, true);
currentContext()->activationObject(); //force the creation of a context for native function;
+ JSC::Debugger* debugger = d->originalGlobalObject()->debugger();
+
JSC::UString jscProgram = program;
JSC::UString jscFileName = fileName;
JSC::ExecState* exec = d->currentFrame;
-
+ WTF::PassRefPtr<QScript::UStringSourceProviderWithFeedback> provider
+ = QScript::UStringSourceProviderWithFeedback::create(jscProgram, jscFileName, lineNumber, d);
+ intptr_t sourceId = provider->asID();
JSC::SourceCode &source = rv.d->source;
- source = JSC::makeSource(jscProgram, jscFileName, lineNumber);
+ source = JSC::SourceCode(provider, lineNumber); //after construction of SourceCode provider variable will be null.
- intptr_t sourceId = source.provider()->asID();
- JSC::Debugger* debugger = d->originalGlobalObject()->debugger();
if (debugger)
debugger->evaluateStart(sourceId);
@@ -2161,9 +2164,9 @@ QScriptProgram QScriptEngine::compile(const QString &program, const QString &fil
int errorLine;
JSC::UString errorMessage;
WTF::RefPtr<JSC::EvalNode> &evalNode = rv.d->evalNode;
- evalNode = exec->globalData().parser->parse<JSC::EvalNode>(exec, exec->dynamicGlobalObject()->debugger(), source, &errorLine, &errorMessage);
+ evalNode = exec->globalData().parser->parse<JSC::EvalNode>(&exec->globalData(), exec->lexicalGlobalObject()->debugger(), exec, source, &errorLine, &errorMessage);
if (!evalNode) {
- JSC::JSValue exceptionValue = JSC::Error::create(exec, JSC::SyntaxError, errorMessage, errorLine, source.provider()->asID(), 0);
+ JSC::JSValue exceptionValue = JSC::Error::create(exec, JSC::SyntaxError, errorMessage, errorLine, source.provider()->asID(), source.provider()->url());
exec->setException(exceptionValue);
if (debugger) {
@@ -2195,10 +2198,12 @@ QScriptValue QScriptEngine::evaluate(const QScriptProgram &program)
QBoolBlocker inEval(d->inEval, true);
currentContext()->activationObject(); //force the creation of a context for native function;
+ JSC::Debugger* debugger = d->originalGlobalObject()->debugger();
+
JSC::ExecState* exec = d->currentFrame;
intptr_t sourceId = program.d->source.provider()->asID();
- JSC::Debugger* debugger = d->originalGlobalObject()->debugger();
+
if (debugger)
debugger->evaluateStart(sourceId);
@@ -2207,11 +2212,16 @@ QScriptValue QScriptEngine::evaluate(const QScriptProgram &program)
WTF::RefPtr<JSC::EvalNode> &evalNode = program.d->evalNode;
+ JSC::EvalExecutable executable(program.d->source);
+ executable.compile(exec, evalNode, exec->scopeChain());
+
JSC::JSValue thisValue = d->thisForContext(exec);
JSC::JSObject* thisObject = (!thisValue || thisValue.isUndefinedOrNull()) ? exec->dynamicGlobalObject() : thisValue.toObject(exec);
JSC::JSValue exceptionValue;
d->timeoutChecker()->setShouldAbort(false);
- JSC::JSValue result = exec->interpreter()->execute(evalNode.get(), exec, thisObject, exec->scopeChain(), &exceptionValue);
+ if (d->processEventsInterval > 0)
+ d->timeoutChecker()->reset();
+ JSC::JSValue result = exec->interpreter()->execute(&executable, exec, thisObject, exec->scopeChain(), &exceptionValue);
if (d->timeoutChecker()->shouldAbort()) {
if (d->abortResult.isError())
diff --git a/src/script/bridge/qscriptdeclarativeclass.cpp b/src/script/bridge/qscriptdeclarativeclass.cpp
index 62c1afc..b990e33 100644
--- a/src/script/bridge/qscriptdeclarativeclass.cpp
+++ b/src/script/bridge/qscriptdeclarativeclass.cpp
@@ -110,7 +110,7 @@ QScriptValue QScriptDeclarativeClass::newObject(QScriptEngine *engine,
QScriptDeclarativeClass *QScriptDeclarativeClass::scriptClass(const QScriptValue &v)
{
QScriptValuePrivate *d = QScriptValuePrivate::get(v);
- if (!d || !d->isJSC() || !d->jscValue.isObject(&QScriptObject::info))
+ if (!d || !d->isJSC() || !d->jscValue.inherits(&QScriptObject::info))
return 0;
QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(d->jscValue));
QScriptObjectDelegate *delegate = scriptObject->delegate();
@@ -122,7 +122,7 @@ QScriptDeclarativeClass *QScriptDeclarativeClass::scriptClass(const QScriptValue
QScriptDeclarativeClass::Object *QScriptDeclarativeClass::object(const QScriptValue &v)
{
QScriptValuePrivate *d = QScriptValuePrivate::get(v);
- if (!d || !d->isJSC() || !d->jscValue.isObject(&QScriptObject::info))
+ if (!d || !d->isJSC() || !d->jscValue.inherits(&QScriptObject::info))
return 0;
QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(d->jscValue));
QScriptObjectDelegate *delegate = scriptObject->delegate();
diff --git a/src/script/bridge/qscriptdeclarativeobject.cpp b/src/script/bridge/qscriptdeclarativeobject.cpp
index aa811d1..ef77de0 100644
--- a/src/script/bridge/qscriptdeclarativeobject.cpp
+++ b/src/script/bridge/qscriptdeclarativeobject.cpp
@@ -149,9 +149,9 @@ bool DeclarativeObjectDelegate::getPropertyAttributes(const QScriptObject* objec
return QScriptObjectDelegate::getPropertyAttributes(object, exec, propertyName, attribs);
}
-void DeclarativeObjectDelegate::getPropertyNames(QScriptObject* object, JSC::ExecState *exec,
- JSC::PropertyNameArray &propertyNames,
- unsigned listedAttributes)
+void DeclarativeObjectDelegate::getOwnPropertyNames(QScriptObject* object, JSC::ExecState *exec,
+ JSC::PropertyNameArray &propertyNames,
+ bool includeNonEnumerable)
{
QStringList properties = m_class->propertyNames(m_object);
for (int ii = 0; ii < properties.count(); ++ii) {
@@ -159,7 +159,7 @@ void DeclarativeObjectDelegate::getPropertyNames(QScriptObject* object, JSC::Exe
propertyNames.add(JSC::Identifier(exec, name));
}
- QScriptObjectDelegate::getPropertyNames(object, exec, propertyNames, listedAttributes);
+ QScriptObjectDelegate::getOwnPropertyNames(object, exec, propertyNames, includeNonEnumerable);
}
JSC::CallType DeclarativeObjectDelegate::getCallData(QScriptObject *object, JSC::CallData &callData)
diff --git a/src/script/bridge/qscriptdeclarativeobject_p.h b/src/script/bridge/qscriptdeclarativeobject_p.h
index ccb07bc..9c14774 100644
--- a/src/script/bridge/qscriptdeclarativeobject_p.h
+++ b/src/script/bridge/qscriptdeclarativeobject_p.h
@@ -55,6 +55,7 @@
#include <QtCore/qobjectdefs.h>
+#include "config.h"
#include "qscriptobject_p.h"
#include "qscriptdeclarativeclass_p.h"
@@ -88,9 +89,9 @@ public:
virtual bool getPropertyAttributes(const QScriptObject*, JSC::ExecState*,
const JSC::Identifier&,
unsigned&) const;
- virtual void getPropertyNames(QScriptObject*, JSC::ExecState*,
- JSC::PropertyNameArray&,
- unsigned listedAttributes = JSC::Structure::Prototype);
+ virtual void getOwnPropertyNames(QScriptObject*, JSC::ExecState*,
+ JSC::PropertyNameArray&,
+ bool includeNonEnumerable = false);
virtual JSC::CallType getCallData(QScriptObject*, JSC::CallData&);
virtual JSC::ConstructType getConstructData(QScriptObject*, JSC::ConstructData&);