From bead103138c0d9dff3c9f927c9c4e2f44ee7db4c Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 21 Aug 2018 16:51:17 +0200 Subject: Implement the dead temporal zone With const and let it is possible to access the declared member before initialization. This is expected to throw a type reference error at run-time. We initialize such variables with the empty value when entering their scope and check upon access for that. For locals we place the lexically scoped variables at the end. For register allocated lexical variables we group them into one batch and remember the index/size. Change-Id: Icb493ee0de0525bb682e1bc58981a4dfd33f750e Reviewed-by: Lars Knoll --- src/qml/compiler/qv4bytecodehandler.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/qml/compiler/qv4bytecodehandler.cpp') diff --git a/src/qml/compiler/qv4bytecodehandler.cpp b/src/qml/compiler/qv4bytecodehandler.cpp index e2533a0505..181594010d 100644 --- a/src/qml/compiler/qv4bytecodehandler.cpp +++ b/src/qml/compiler/qv4bytecodehandler.cpp @@ -290,6 +290,9 @@ std::vector ByteCodeHandler::collectLabelsInBytecode(const char *code, uint addLabel(code - start + offset); COLLECTOR_END_INSTR(UnwindToLabel) + COLLECTOR_BEGIN_INSTR(DeadTemporalZoneCheck) + COLLECTOR_END_INSTR(DeadTemporalZoneCheck) + COLLECTOR_BEGIN_INSTR(ThrowException) COLLECTOR_END_INSTR(ThrowException) @@ -519,6 +522,9 @@ std::vector ByteCodeHandler::collectLabelsInBytecode(const char *code, uint COLLECTOR_END_INSTR(Debug) #endif // QT_NO_QML_DEBUGGER + COLLECTOR_BEGIN_INSTR(InitializeBlockDeadTemporalZone) + COLLECTOR_END_INSTR(InitializeBlockDeadTemporalZone) + COLLECTOR_BEGIN_INSTR(LoadQmlContext) COLLECTOR_END_INSTR(LoadQmlContext) -- cgit v1.2.3