aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-11-13 12:14:09 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-11-21 16:36:24 +0100
commitb943d80dd90dec1a8b7802b826ad89e924cead05 (patch)
treea7edf71a76757a6dcb623e4929419a57a58a5523 /src/qml/jsruntime
parentcf7bd35a93f220cb1348f7654df9c6f27b590790 (diff)
Remove the executioncontext in a few more places where it's not needed
Change-Id: I4c92c7bc9d94d8265e306f45d863fdc080a5e2a6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp13
-rw-r--r--src/qml/jsruntime/qv4regexpobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4script_p.h2
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp14
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4value.cpp9
6 files changed, 19 insertions, 25 deletions
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index ce9970459c..c327437bdf 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -178,10 +178,9 @@ void RegExpObject::markObjects(Heap::Base *that, ExecutionEngine *e)
Object::markObjects(that, e);
}
-Property *RegExpObject::lastIndexProperty(ExecutionContext *ctx)
+Property *RegExpObject::lastIndexProperty()
{
- Q_UNUSED(ctx);
- Q_ASSERT(0 == internalClass()->find(ctx->d()->engine->id_lastIndex));
+ Q_ASSERT(0 == internalClass()->find(engine()->id_lastIndex));
return propertyAt(0);
}
@@ -362,9 +361,9 @@ ReturnedValue RegExpPrototype::method_exec(CallContext *ctx)
return Encode::undefined();
QString s = arg->stringValue()->toQString();
- int offset = r->global() ? r->lastIndexProperty(ctx)->value.toInt32() : 0;
+ int offset = r->global() ? r->lastIndexProperty()->value.toInt32() : 0;
if (offset < 0 || offset > s.length()) {
- r->lastIndexProperty(ctx)->value = Primitive::fromInt32(0);
+ r->lastIndexProperty()->value = Primitive::fromInt32(0);
return Encode::null();
}
@@ -375,7 +374,7 @@ ReturnedValue RegExpPrototype::method_exec(CallContext *ctx)
regExpCtor->d()->clearLastMatch();
if (result == -1) {
- r->lastIndexProperty(ctx)->value = Primitive::fromInt32(0);
+ r->lastIndexProperty()->value = Primitive::fromInt32(0);
return Encode::null();
}
@@ -401,7 +400,7 @@ ReturnedValue RegExpPrototype::method_exec(CallContext *ctx)
dd->lastMatchEnd = matchOffsets[1];
if (r->global())
- r->lastIndexProperty(ctx)->value = Primitive::fromInt32(matchOffsets[1]);
+ r->lastIndexProperty()->value = Primitive::fromInt32(matchOffsets[1]);
return array.asReturnedValue();
}
diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h
index a6a5587ca5..cd1cf4f578 100644
--- a/src/qml/jsruntime/qv4regexpobject_p.h
+++ b/src/qml/jsruntime/qv4regexpobject_p.h
@@ -103,7 +103,7 @@ struct RegExpObject: Object {
void init(ExecutionEngine *engine);
- Property *lastIndexProperty(ExecutionContext *ctx);
+ Property *lastIndexProperty();
QRegExp toQRegExp() const;
QString toString() const;
QString source() const;
diff --git a/src/qml/jsruntime/qv4script_p.h b/src/qml/jsruntime/qv4script_p.h
index 0c54c24f8e..14c617b554 100644
--- a/src/qml/jsruntime/qv4script_p.h
+++ b/src/qml/jsruntime/qv4script_p.h
@@ -45,8 +45,6 @@ class QQmlContextData;
namespace QV4 {
-struct ExecutionContext;
-
struct ContextStateSaver {
ExecutionContext *savedContext;
bool strictMode;
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index dd1f7033de..a2de296e88 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -49,15 +49,15 @@ QT_BEGIN_NAMESPACE
using namespace QV4;
// helper function to generate valid warnings if errors occur during sequence operations.
-static void generateWarning(QV4::ExecutionContext *ctx, const QString& description)
+static void generateWarning(QV4::ExecutionEngine *v4, const QString& description)
{
- QQmlEngine *engine = ctx->d()->engine->v8Engine->engine();
+ QQmlEngine *engine = v4->v8Engine->engine();
if (!engine)
return;
QQmlError retn;
retn.setDescription(description);
- QV4::StackFrame frame = ctx->d()->engine->currentStackFrame();
+ QV4::StackFrame frame = v4->currentStackFrame();
retn.setLine(frame.line);
retn.setUrl(QUrl(frame.source));
@@ -190,7 +190,7 @@ public:
{
/* Qt containers have int (rather than uint) allowable indexes. */
if (index > INT_MAX) {
- generateWarning(engine()->currentContext(), QLatin1String("Index out of range during indexed get"));
+ generateWarning(engine(), QLatin1String("Index out of range during indexed get"));
if (hasProperty)
*hasProperty = false;
return Encode::undefined();
@@ -221,7 +221,7 @@ public:
/* Qt containers have int (rather than uint) allowable indexes. */
if (index > INT_MAX) {
- generateWarning(engine()->currentContext(), QLatin1String("Index out of range during indexed set"));
+ generateWarning(engine(), QLatin1String("Index out of range during indexed set"));
return;
}
@@ -259,7 +259,7 @@ public:
{
/* Qt containers have int (rather than uint) allowable indexes. */
if (index > INT_MAX) {
- generateWarning(engine()->currentContext(), QLatin1String("Index out of range during indexed query"));
+ generateWarning(engine(), QLatin1String("Index out of range during indexed query"));
return QV4::Attr_Invalid;
}
if (d()->isReference) {
@@ -411,7 +411,7 @@ public:
quint32 newLength = ctx->d()->callData->args[0].toUInt32();
/* Qt containers have int (rather than uint) allowable indexes. */
if (newLength > INT_MAX) {
- generateWarning(ctx, QLatin1String("Index out of range during length set"));
+ generateWarning(scope.engine, QLatin1String("Index out of range during length set"));
return QV4::Encode::undefined();
}
/* Read the sequence from the QObject property if we're a reference */
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index d571584310..e15ab50e80 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -230,7 +230,7 @@ static QString getThisString(ExecutionContext *ctx)
if (StringObject *thisString = t->asStringObject())
return thisString->d()->value.stringValue()->toQString();
if (t->isUndefined() || t->isNull()) {
- ctx->engine()->throwTypeError();
+ scope.engine->throwTypeError();
return QString();
}
return t->toQString();
@@ -517,7 +517,7 @@ ReturnedValue StringPrototype::method_replace(CallContext *ctx)
offset = qMax(offset + 1, matchOffsets[oldSize + 1]);
}
if (regExp->global())
- regExp->lastIndexProperty(ctx)->value = Primitive::fromUInt32(0);
+ regExp->lastIndexProperty()->value = Primitive::fromUInt32(0);
numStringMatches = nMatchOffsets / (regExp->value()->captureCount() * 2);
numCaptures = regExp->value()->captureCount();
} else {
diff --git a/src/qml/jsruntime/qv4value.cpp b/src/qml/jsruntime/qv4value.cpp
index cd44d93f42..d1289bba7f 100644
--- a/src/qml/jsruntime/qv4value.cpp
+++ b/src/qml/jsruntime/qv4value.cpp
@@ -88,8 +88,7 @@ double Value::toNumberImpl() const
if (isString())
return RuntimeHelpers::stringToNumber(stringValue()->toQString());
{
- ExecutionContext *ctx = objectValue()->internalClass()->engine->currentContext();
- Scope scope(ctx);
+ Scope scope(managed()->engine());
ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), NUMBER_HINT));
if (scope.engine->hasException)
return 0;
@@ -124,8 +123,7 @@ QString Value::toQStringNoThrow() const
if (isString())
return stringValue()->toQString();
{
- ExecutionContext *ctx = objectValue()->internalClass()->engine->currentContext();
- Scope scope(ctx);
+ Scope scope(managed()->engine());
ScopedValue ex(scope);
bool caughtException = false;
ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), STRING_HINT));
@@ -177,8 +175,7 @@ QString Value::toQString() const
if (isString())
return stringValue()->toQString();
{
- ExecutionContext *ctx = objectValue()->internalClass()->engine->currentContext();
- Scope scope(ctx);
+ Scope scope(managed()->engine());
ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), STRING_HINT));
return prim->toQString();
}