aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/jsruntime/qv4stackframe_p.h5
-rw-r--r--src/qml/jsruntime/qv4value_p.h4
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();