aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4isel_moth.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-10-28 22:30:04 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-29 14:06:08 +0100
commitcfe24c1aa0f3ec168437cd22e355c28e5e7a4f09 (patch)
tree7c4f389d7b0a7d5de2074327740aaf0cc0cfadbd /src/qml/compiler/qv4isel_moth.cpp
parent9880e64efa25c1924b95068693ff8664e2f2e121 (diff)
Move constants into the compiled data for the interpreter
This makes it possible to remove the Value stored as part of the instruction stream. Reduces the size of the instruction stream and will allow to optimize Param lookup. Change-Id: I23dab5dbed76bf8d62df7042934064d4676bc43d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4isel_moth.cpp')
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index 835f0a8a23..295227cb97 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -774,7 +774,8 @@ void InstructionSelection::callBuiltinDeleteName(const QString &name, V4IR::Temp
void InstructionSelection::callBuiltinDeleteValue(V4IR::Temp *result)
{
Instruction::LoadValue load;
- load.value = Param::createValue(QV4::Primitive::fromBoolean(false));
+ int idx = jsUnitGenerator()->registerConstant(QV4::Encode(false));
+ load.value = Param::createConstant(idx);
load.result = getResultParam(result);
addInstruction(load);
}
@@ -797,7 +798,8 @@ void InstructionSelection::callBuiltinReThrow()
_patches[_block->catchBlock].append(loc);
} else {
Instruction::Ret ret;
- ret.result = Param::createValue(QV4::Primitive::undefinedValue());
+ int idx = jsUnitGenerator()->registerConstant(QV4::Encode::undefined());
+ ret.result = Param::createConstant(idx);
addInstruction(ret);
}
}
@@ -988,7 +990,8 @@ Param InstructionSelection::getParam(V4IR::Expr *e) {
assert(e);
if (V4IR::Const *c = e->asConst()) {
- return Param::createValue(convertToValue(c));
+ int idx = jsUnitGenerator()->registerConstant(convertToValue(c).asReturnedValue());
+ return Param::createConstant(idx);
} else if (V4IR::Temp *t = e->asTemp()) {
switch (t->kind) {
case V4IR::Temp::Formal: