diff options
author | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-12-01 15:24:18 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-12-01 14:51:51 +0000 |
commit | 789e7b6d864e98fb65731fa5471e587695289e78 (patch) | |
tree | 99c25d49bcd217dc20367109bec8b3b2a067aba7 /src/qml/jsruntime | |
parent | c4e248f101c3989bc06678c6b2089c49d0bf47d9 (diff) |
Hint the compiler that exceptions are exceptional and not the hot path
Change-Id: I981f0cb643a67027a37db38363e26b220d3c216f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 10 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4runtime.cpp | 7 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 848b578dea..ee2fe6bfd7 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -435,7 +435,7 @@ void Heap::ScriptFunction::init(QV4::ExecutionContext *scope, Function *function void ScriptFunction::construct(const Managed *that, Scope &scope, CallData *callData) { ExecutionEngine *v4 = scope.engine; - if (v4->hasException) { + if (Q_UNLIKELY(v4->hasException)) { scope.result = Encode::undefined(); return; } @@ -458,7 +458,7 @@ void ScriptFunction::construct(const Managed *that, Scope &scope, CallData *call if (f->function()->hasQmlDependencies) QQmlPropertyCapture::registerQmlDependencies(f->function()->compiledFunction, scope); - if (v4->hasException) { + if (Q_UNLIKELY(v4->hasException)) { scope.result = Encode::undefined(); } else if (!scope.result.isObject()) { scope.result = obj.asReturnedValue(); @@ -468,7 +468,7 @@ void ScriptFunction::construct(const Managed *that, Scope &scope, CallData *call void ScriptFunction::call(const Managed *that, Scope &scope, CallData *callData) { ExecutionEngine *v4 = scope.engine; - if (v4->hasException) { + if (Q_UNLIKELY(v4->hasException)) { scope.result = Encode::undefined(); return; } @@ -524,7 +524,7 @@ void Heap::SimpleScriptFunction::init(QV4::ExecutionContext *scope, Function *fu void SimpleScriptFunction::construct(const Managed *that, Scope &scope, CallData *callData) { ExecutionEngine *v4 = scope.engine; - if (v4->hasException) { + if (Q_UNLIKELY(v4->hasException)) { scope.result = Encode::undefined(); return; } @@ -559,7 +559,7 @@ void SimpleScriptFunction::construct(const Managed *that, Scope &scope, CallData if (ff->hasQmlDependencies) QQmlPropertyCapture::registerQmlDependencies(f->function()->compiledFunction, scope); - if (v4->hasException) { + if (Q_UNLIKELY(v4->hasException)) { scope.result = Encode::undefined(); } else if (!scope.result.isObject()) { scope.result = callData->thisObject; diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 944588dd28..61ef168447 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -1067,7 +1067,8 @@ ReturnedValue Runtime::method_callPropertyLookup(ExecutionEngine *engine, uint i Lookup *l = engine->current->lookups + index; Value v; v = l->getter(l, engine, callData->thisObject); - if (Object *o = v.objectValue()) { + Object *o = v.objectValue(); + if (Q_LIKELY(o)) { Scope scope(engine); o->call(scope, callData); return scope.result.asReturnedValue(); @@ -1170,9 +1171,9 @@ ReturnedValue Runtime::method_constructPropertyLookup(ExecutionEngine *engine, u Lookup *l = engine->current->lookups + index; Value v; v = l->getter(l, engine, callData->thisObject); - if (Object *o = v.objectValue()) { + Object *o = v.objectValue(); + if (Q_LIKELY(o)) { Scope scope(engine); - ScopedValue result(scope); o->construct(scope, callData); return scope.result.asReturnedValue(); } |