diff options
Diffstat (limited to 'src/qml/compiler/qv4isel_p.cpp')
-rw-r--r-- | src/qml/compiler/qv4isel_p.cpp | 108 |
1 files changed, 55 insertions, 53 deletions
diff --git a/src/qml/compiler/qv4isel_p.cpp b/src/qml/compiler/qv4isel_p.cpp index c055cffd0d..f5cb1905c5 100644 --- a/src/qml/compiler/qv4isel_p.cpp +++ b/src/qml/compiler/qv4isel_p.cpp @@ -93,54 +93,54 @@ QV4::CompiledData::CompilationUnit *EvalInstructionSelection::compile(bool gener void IRDecoder::visitMove(IR::Move *s) { if (IR::Name *n = s->target->asName()) { - if (s->source->asTemp() || s->source->asConst()) { + if (s->source->asTemp() || s->source->asConst() || s->source->asArgLocal()) { setActivationProperty(s->source, *n->id); return; } - } else if (IR::Temp *t = s->target->asTemp()) { + } else if (s->target->asTemp() || s->target->asArgLocal()) { if (IR::Name *n = s->source->asName()) { if (n->id && *n->id == QStringLiteral("this")) // TODO: `this' should be a builtin. - loadThisObject(t); + loadThisObject(s->target); else if (n->builtin == IR::Name::builtin_qml_id_array) - loadQmlIdArray(t); + loadQmlIdArray(s->target); else if (n->builtin == IR::Name::builtin_qml_context_object) - loadQmlContextObject(t); + loadQmlContextObject(s->target); else if (n->builtin == IR::Name::builtin_qml_scope_object) - loadQmlScopeObject(t); + loadQmlScopeObject(s->target); else if (n->builtin == IR::Name::builtin_qml_imported_scripts_object) - loadQmlImportedScripts(t); + loadQmlImportedScripts(s->target); else if (n->qmlSingleton) - loadQmlSingleton(*n->id, t); + loadQmlSingleton(*n->id, s->target); else - getActivationProperty(n, t); + getActivationProperty(n, s->target); return; } else if (IR::Const *c = s->source->asConst()) { - loadConst(c, t); + loadConst(c, s->target); return; - } else if (IR::Temp *t2 = s->source->asTemp()) { + } else if (s->source->asTemp() || s->source->asArgLocal()) { if (s->swap) - swapValues(t2, t); + swapValues(s->source, s->target); else - copyValue(t2, t); + copyValue(s->source, s->target); return; } else if (IR::String *str = s->source->asString()) { - loadString(*str->value, t); + loadString(*str->value, s->target); return; } else if (IR::RegExp *re = s->source->asRegExp()) { - loadRegexp(re, t); + loadRegexp(re, s->target); return; } else if (IR::Closure *clos = s->source->asClosure()) { - initClosure(clos, t); + initClosure(clos, s->target); return; } else if (IR::New *ctor = s->source->asNew()) { if (Name *func = ctor->base->asName()) { - constructActivationProperty(func, ctor->args, t); + constructActivationProperty(func, ctor->args, s->target); return; } else if (IR::Member *member = ctor->base->asMember()) { - constructProperty(member->base->asTemp(), *member->name, ctor->args, t); + constructProperty(member->base, *member->name, ctor->args, s->target); return; - } else if (IR::Temp *value = ctor->base->asTemp()) { - constructValue(value, ctor->args, t); + } else if (ctor->base->asTemp() || ctor->base->asArgLocal()) { + constructValue(ctor->base, ctor->args, s->target); return; } } else if (IR::Member *m = s->source->asMember()) { @@ -162,46 +162,44 @@ void IRDecoder::visitMove(IR::Move *s) captureRequired = false; } } - getQObjectProperty(m->base, m->property->coreIndex, captureRequired, attachedPropertiesId, t); + getQObjectProperty(m->base, m->property->coreIndex, captureRequired, attachedPropertiesId, s->target); #endif // V4_BOOTSTRAP return; - } else if (m->base->asTemp() || m->base->asConst()) { - getProperty(m->base, *m->name, t); + } else if (m->base->asTemp() || m->base->asConst() || m->base->asArgLocal()) { + getProperty(m->base, *m->name, s->target); return; } } else if (IR::Subscript *ss = s->source->asSubscript()) { - getElement(ss->base, ss->index, t); + getElement(ss->base, ss->index, s->target); return; } else if (IR::Unop *u = s->source->asUnop()) { - if (IR::Temp *e = u->expr->asTemp()) { - unop(u->op, e, t); - return; - } + unop(u->op, u->expr, s->target); + return; } else if (IR::Binop *b = s->source->asBinop()) { - binop(b->op, b->left, b->right, t); + binop(b->op, b->left, b->right, s->target); return; } else if (IR::Call *c = s->source->asCall()) { if (c->base->asName()) { - callBuiltin(c, t); + callBuiltin(c, s->target); return; } else if (Member *member = c->base->asMember()) { - callProperty(member->base, *member->name, c->args, t); + callProperty(member->base, *member->name, c->args, s->target); return; } else if (Subscript *ss = c->base->asSubscript()) { - callSubscript(ss->base, ss->index, c->args, t); + callSubscript(ss->base, ss->index, c->args, s->target); return; - } else if (IR::Temp *value = c->base->asTemp()) { - callValue(value, c->args, t); + } else if (c->base->asTemp() || c->base->asArgLocal()) { + callValue(c->base, c->args, s->target); return; } } else if (IR::Convert *c = s->source->asConvert()) { - Q_ASSERT(c->expr->asTemp()); - convertType(c->expr->asTemp(), t); + Q_ASSERT(c->expr->asTemp() || c->expr->asArgLocal()); + convertType(c->expr, s->target); return; } } else if (IR::Member *m = s->target->asMember()) { - if (m->base->asTemp() || m->base->asConst()) { - if (s->source->asTemp() || s->source->asConst()) { + if (m->base->asTemp() || m->base->asConst() || m->base->asArgLocal()) { + if (s->source->asTemp() || s->source->asConst() || s->source->asArgLocal()) { Q_ASSERT(m->kind != IR::Member::MemberOfEnum); const int attachedPropertiesId = m->attachedPropertiesIdOrEnumValue; if (m->property && attachedPropertiesId == 0) { @@ -218,7 +216,7 @@ void IRDecoder::visitMove(IR::Move *s) } } } else if (IR::Subscript *ss = s->target->asSubscript()) { - if (s->source->asTemp() || s->source->asConst()) { + if (s->source->asTemp() || s->source->asConst() || s->source->asArgLocal()) { setElement(s->source, ss->base, ss->index); return; } @@ -241,11 +239,11 @@ void IRDecoder::visitExp(IR::Exp *s) // These are calls where the result is ignored. if (c->base->asName()) { callBuiltin(c, 0); - } else if (Temp *value = c->base->asTemp()) { - callValue(value, c->args, 0); + } else if (c->base->asTemp() || c->base->asArgLocal()) { + callValue(c->base, c->args, 0); } else if (Member *member = c->base->asMember()) { - Q_ASSERT(member->base->asTemp()); - callProperty(member->base->asTemp(), *member->name, c->args, 0); + Q_ASSERT(member->base->asTemp() || member->base->asArgLocal()); + callProperty(member->base, *member->name, c->args, 0); } else if (Subscript *s = c->base->asSubscript()) { callSubscript(s->base, s->index, c->args, 0); } else { @@ -256,7 +254,7 @@ void IRDecoder::visitExp(IR::Exp *s) } } -void IRDecoder::callBuiltin(IR::Call *call, IR::Temp *result) +void IRDecoder::callBuiltin(IR::Call *call, Expr *result) { IR::Name *baseName = call->base->asName(); Q_ASSERT(baseName != 0); @@ -276,7 +274,9 @@ void IRDecoder::callBuiltin(IR::Call *call, IR::Temp *result) } else if (IR::Name *n = call->args->expr->asName()) { callBuiltinTypeofName(*n->id, result); return; - } else if (call->args->expr->asTemp() || call->args->expr->asConst()){ + } else if (call->args->expr->asTemp() || + call->args->expr->asConst() || + call->args->expr->asArgLocal()) { callBuiltinTypeofValue(call->args->expr, result); return; } @@ -284,15 +284,16 @@ void IRDecoder::callBuiltin(IR::Call *call, IR::Temp *result) case IR::Name::builtin_delete: { if (IR::Member *m = call->args->expr->asMember()) { - callBuiltinDeleteMember(m->base->asTemp(), *m->name, result); + callBuiltinDeleteMember(m->base, *m->name, result); return; } else if (IR::Subscript *ss = call->args->expr->asSubscript()) { - callBuiltinDeleteSubscript(ss->base->asTemp(), ss->index, result); + callBuiltinDeleteSubscript(ss->base, ss->index, result); return; } else if (IR::Name *n = call->args->expr->asName()) { callBuiltinDeleteName(*n->id, result); return; - } else if (call->args->expr->asTemp()){ + } else if (call->args->expr->asTemp() || + call->args->expr->asArgLocal()) { // TODO: should throw in strict mode callBuiltinDeleteValue(result); return; @@ -301,7 +302,7 @@ void IRDecoder::callBuiltin(IR::Call *call, IR::Temp *result) case IR::Name::builtin_throw: { IR::Expr *arg = call->args->expr; - Q_ASSERT(arg->asTemp() || arg->asConst()); + Q_ASSERT(arg->asTemp() || arg->asConst() || arg->asArgLocal()); callBuiltinThrow(arg); } return; @@ -326,14 +327,15 @@ void IRDecoder::callBuiltin(IR::Call *call, IR::Temp *result) } return; case IR::Name::builtin_foreach_next_property_name: { - IR::Temp *arg = call->args->expr->asTemp(); + IR::Expr *arg = call->args->expr; Q_ASSERT(arg != 0); callBuiltinForeachNextPropertyname(arg, result); } return; case IR::Name::builtin_push_with_scope: { - IR::Temp *arg = call->args->expr->asTemp(); - Q_ASSERT(arg != 0); - callBuiltinPushWithScope(arg); + if (call->args->expr->asTemp() || call->args->expr->asArgLocal()) + callBuiltinPushWithScope(call->args->expr); + else + Q_UNIMPLEMENTED(); } return; case IR::Name::builtin_pop_scope: |