diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2014-11-11 15:08:30 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-11-12 20:44:13 +0100 |
commit | afbf1f74af678af0eda76035133406aa8883408a (patch) | |
tree | 2bc7b93256cad8691baa0079e60ba4cf2d52fa93 /src/qml/jsruntime/qv4globalobject.cpp | |
parent | faf13a3aa0c97b7386e44d02f323a9156a733c9f (diff) |
Ported ExecutionEngine::newString and newIdentifier to Heap::String
Avoid the use of Returned<String> for newString and changed the identifier
table to use Heap::String. This required moving some code back into
Heap::String, but that's code that doesn't call back into the GC, so
allocations and therefore future object moves aren't possible.
Change-Id: I1dca3e9c12a9c56f09419af8cc8cba39fe04f720
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4globalobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4globalobject.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index 5baee5f4aa..f287fc7aec 100644 --- a/src/qml/jsruntime/qv4globalobject.cpp +++ b/src/qml/jsruntime/qv4globalobject.cpp @@ -435,13 +435,12 @@ static inline int toInt(const QChar &qc, int R) ReturnedValue GlobalFunctions::method_parseInt(CallContext *ctx) { Scope scope(ctx); - ScopedValue string(scope, ctx->argument(0)); + ScopedValue inputString(scope, ctx->argument(0)); ScopedValue radix(scope, ctx->argument(1)); int R = radix->isUndefined() ? 0 : radix->toInt32(); // [15.1.2.2] step by step: - String *inputString = string->toString(ctx); // 1 - QString trimmed = inputString->toQString().trimmed(); // 2 + QString trimmed = inputString->toQString().trimmed(); // 1 + 2 if (ctx->d()->engine->hasException) return Encode::undefined(); @@ -578,7 +577,7 @@ ReturnedValue GlobalFunctions::method_decodeURI(CallContext *context) if (context->d()->callData->argc == 0) return Encode::undefined(); - QString uriString = context->d()->callData->args[0].toString(context)->toQString(); + QString uriString = context->d()->callData->args[0].toQString(); bool ok; QString out = decode(uriString, DecodeNonReserved, &ok); if (!ok) { @@ -596,7 +595,7 @@ ReturnedValue GlobalFunctions::method_decodeURIComponent(CallContext *context) if (context->d()->callData->argc == 0) return Encode::undefined(); - QString uriString = context->d()->callData->args[0].toString(context)->toQString(); + QString uriString = context->d()->callData->args[0].toQString(); bool ok; QString out = decode(uriString, DecodeAll, &ok); if (!ok) { @@ -614,7 +613,7 @@ ReturnedValue GlobalFunctions::method_encodeURI(CallContext *context) if (context->d()->callData->argc == 0) return Encode::undefined(); - QString uriString = context->d()->callData->args[0].toString(context)->toQString(); + QString uriString = context->d()->callData->args[0].toQString(); bool ok; QString out = encode(uriString, uriUnescapedReserved, &ok); if (!ok) { @@ -632,7 +631,7 @@ ReturnedValue GlobalFunctions::method_encodeURIComponent(CallContext *context) if (context->d()->callData->argc == 0) return Encode::undefined(); - QString uriString = context->d()->callData->args[0].toString(context)->toQString(); + QString uriString = context->d()->callData->args[0].toQString(); bool ok; QString out = encode(uriString, uriUnescaped, &ok); if (!ok) { @@ -649,7 +648,7 @@ ReturnedValue GlobalFunctions::method_escape(CallContext *context) if (!context->d()->callData->argc) return context->d()->engine->newString(QStringLiteral("undefined"))->asReturnedValue(); - QString str = context->d()->callData->args[0].toString(context)->toQString(); + QString str = context->d()->callData->args[0].toQString(); return context->d()->engine->newString(escape(str))->asReturnedValue(); } @@ -658,6 +657,6 @@ ReturnedValue GlobalFunctions::method_unescape(CallContext *context) if (!context->d()->callData->argc) return context->d()->engine->newString(QStringLiteral("undefined"))->asReturnedValue(); - QString str = context->d()->callData->args[0].toString(context)->toQString(); + QString str = context->d()->callData->args[0].toQString(); return context->d()->engine->newString(unescape(str))->asReturnedValue(); } |