diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-09-11 10:27:32 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-09-11 21:33:16 +0000 |
commit | edb2cdc06ac5ab808429c654c55de87c8c4bf450 (patch) | |
tree | 777af68be9addded29bd911aaba86a9616f83e01 | |
parent | 3b444a07f3d03402a5ec1ac0da6528b1f7f4e95a (diff) |
Micro optimization when initializing the Cpp frame
Change-Id: I07db2df7eec2bdbeb84bd576d9e4f7912f79fc78
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
-rw-r--r-- | src/qml/jsruntime/qv4stackframe_p.h | 5 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4value_p.h | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4stackframe_p.h b/src/qml/jsruntime/qv4stackframe_p.h index 39e7c25a4e..6f21058e91 100644 --- a/src/qml/jsruntime/qv4stackframe_p.h +++ b/src/qml/jsruntime/qv4stackframe_p.h @@ -180,9 +180,8 @@ struct Q_QML_EXPORT CppStackFrame { jsFrame->setArgc(argc); memcpy(jsFrame->args, originalArguments, argc*sizeof(Value)); - const Value *end = jsFrame->args + nRegisters; - for (Value *v = jsFrame->args + argc; v < end; ++v) - *v = Encode::undefined(); + Q_STATIC_ASSERT(Encode::undefined() == 0); + memset(jsFrame->args + argc, 0, (nRegisters - argc)*sizeof(Value)); if (v4Function && v4Function->compiledFunction) { const int firstDeadZoneRegister = v4Function->compiledFunction->firstTemporalDeadZoneRegister; diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index e4be6b99dd..305b8c6bab 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -710,8 +710,8 @@ inline unsigned int Primitive::toUInt32(double d) } struct Encode { - static ReturnedValue undefined() { - return Primitive::undefinedValue().rawValue(); + static constexpr ReturnedValue undefined() { + return 0; } static ReturnedValue null() { return Primitive::nullValue().rawValue(); |