diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-05-24 12:07:54 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-05-24 11:23:52 +0000 |
commit | 1e755ff21469d817481af8feed792569ab2c2bb8 (patch) | |
tree | b05a7d1076bec46e99c9870d0e698be22499f853 /src/qml/jsruntime/qv4persistent.cpp | |
parent | cbbb040da01319bc4706dedb7faf7d883d9b9fab (diff) |
Don't use empty values anymore to store internal freelists
Simply encode them as integers. That works just as well, and
allows removing the indexed empty values.
This is helpful, to swap the internal representations of undefined
and empty values, which in turn will simplify an implementation of
correct handling of uninitialized variables (through let/const).
Change-Id: I299f975d665309611d1b561f6a0c86b5ca15782a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4persistent.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4persistent.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4persistent.cpp b/src/qml/jsruntime/qv4persistent.cpp index 7fc74173e3..f8bc28160e 100644 --- a/src/qml/jsruntime/qv4persistent.cpp +++ b/src/qml/jsruntime/qv4persistent.cpp @@ -98,9 +98,9 @@ Page *allocatePage(PersistentValueStorage *storage) p->header.freeList = 0; insertInFront(storage, p); for (int i = 0; i < kEntriesPerPage - 1; ++i) { - p->values[i].setEmpty(i + 1); + p->values[i] = Encode(i + 1); } - p->values[kEntriesPerPage - 1].setEmpty(-1); + p->values[kEntriesPerPage - 1] = Encode(-1); return p; } @@ -226,7 +226,7 @@ void PersistentValueStorage::free(Value *v) Page *p = getPage(v); - v->setEmpty(p->header.freeList); + *v = Encode(p->header.freeList); p->header.freeList = v - p->values; if (!--p->header.refCount) freePage(p); |