From 5229a8b259286c9ea61036fd6b4bd0039104a206 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 18 Oct 2013 15:42:17 +0200 Subject: Rework exception handling Start the work to remove c++ exceptions from our JS exception handling. Rather rely on engine->hasException. Check the flag after we return from any runtime call in the JIT. Implement new try/catch handling code in qv4codegen and for the JIT that doesn't rely on exceptions. As an added bonus, we can remove the Try statement in the IR. Change-Id: Ic95addd6ae03371c43c47e04cac26afdce23a061 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4context.cpp | 63 ---------------------------------------- 1 file changed, 63 deletions(-) (limited to 'src/qml/jsruntime/qv4context.cpp') diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp index f3d2ab66ed..c14d987171 100644 --- a/src/qml/jsruntime/qv4context.cpp +++ b/src/qml/jsruntime/qv4context.cpp @@ -461,69 +461,6 @@ ReturnedValue ExecutionContext::getProperty(const StringRef name) return 0; } -ReturnedValue ExecutionContext::getPropertyNoThrow(const StringRef name) -{ - Scope scope(this); - ScopedValue v(scope); - name->makeIdentifier(); - - if (name->equals(engine->id_this)) - return callData->thisObject.asReturnedValue(); - - bool hasWith = false; - bool hasCatchScope = false; - for (ExecutionContext *ctx = this; ctx; ctx = ctx->outer) { - if (ctx->type == Type_WithContext) { - ScopedObject w(scope, static_cast(ctx)->withObject); - hasWith = true; - bool hasProperty = false; - v = w->get(name, &hasProperty); - if (hasProperty) { - return v.asReturnedValue(); - } - continue; - } - - else if (ctx->type == Type_CatchContext) { - hasCatchScope = true; - CatchContext *c = static_cast(ctx); - if (c->exceptionVarName->isEqualTo(name)) - return c->exceptionValue.asReturnedValue(); - } - - else if (ctx->type >= Type_CallContext) { - QV4::CallContext *c = static_cast(ctx); - ScopedFunctionObject f(scope, c->function); - if (f->needsActivation || hasWith || hasCatchScope) { - for (unsigned int i = 0; i < f->varCount; ++i) - if (f->varList[i]->isEqualTo(name)) - return c->locals[i].asReturnedValue(); - for (int i = (int)f->formalParameterCount - 1; i >= 0; --i) - if (f->formalParameterList[i]->isEqualTo(name)) - return c->callData->args[i].asReturnedValue(); - } - if (c->activation) { - bool hasProperty = false; - v = c->activation->get(name, &hasProperty); - if (hasProperty) - return v.asReturnedValue(); - } - if (f->function && f->function->isNamedExpression() - && name->equals(f->function->name)) - return f.asReturnedValue(); - } - - else if (ctx->type == Type_GlobalContext) { - GlobalContext *g = static_cast(ctx); - bool hasProperty = false; - v = g->global->get(name, &hasProperty); - if (hasProperty) - return v.asReturnedValue(); - } - } - return Encode::undefined(); -} - ReturnedValue ExecutionContext::getPropertyAndBase(const StringRef name, ObjectRef base) { Scope scope(this); -- cgit v1.2.3