aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-11-03 15:23:05 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-09 02:01:17 +0100
commit412eb94de4cae754130ae855236420ebd5c42482 (patch)
tree901af6051691c65a96abe3f69fcd3d5fc57ff80a /src/qml/compiler
parente367f75d7285d2bcd10cbb35d088c96f33c02aff (diff)
Simplify & speed up function calling
Get rid of the SimpleCallContext, instead simply use the CallContext data structure, but don't initialize the unused variables. Change-Id: I11b311986da180c62c815b516a2c55844156d0ab Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r--src/qml/compiler/qv4codegen.cpp2
-rw-r--r--src/qml/compiler/qv4compileddata_p.h3
-rw-r--r--src/qml/compiler/qv4compiler.cpp2
-rw-r--r--src/qml/compiler/qv4isel_masm.cpp4
4 files changed, 7 insertions, 4 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 4810e4dace..640dad9c99 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -1957,7 +1957,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
V4IR::BasicBlock *entryBlock = function->newBasicBlock(groupStartBlock(), 0);
V4IR::BasicBlock *exitBlock = function->newBasicBlock(groupStartBlock(), 0, V4IR::Function::DontInsertBlock);
- function->hasDirectEval = _env->hasDirectEval;
+ function->hasDirectEval = _env->hasDirectEval || _env->compilationMode == EvalCode;
function->usesArgumentsObject = _env->parent && (_env->usesArgumentsObject == Environment::ArgumentsObjectUsed);
function->usesThis = _env->usesThis;
function->maxNumberOfArguments = qMax(_env->maxNumberOfArguments, (int)QV4::Global::ReservedArgumentCount);
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h
index bfbb40445a..90f27d5f57 100644
--- a/src/qml/compiler/qv4compileddata_p.h
+++ b/src/qml/compiler/qv4compileddata_p.h
@@ -217,7 +217,8 @@ struct Function
HasDirectEval = 0x1,
UsesArgumentsObject = 0x2,
IsStrict = 0x4,
- IsNamedExpression = 0x8
+ IsNamedExpression = 0x8,
+ HasCatchOrWith = 0x10
};
quint32 index; // in CompilationUnit's function table
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp
index a808e88afa..b38c394bdc 100644
--- a/src/qml/compiler/qv4compiler.cpp
+++ b/src/qml/compiler/qv4compiler.cpp
@@ -331,6 +331,8 @@ int QV4::Compiler::JSUnitGenerator::writeFunction(char *f, int index, QQmlJS::V4
function->flags |= CompiledData::Function::IsStrict;
if (irFunction->isNamedExpression)
function->flags |= CompiledData::Function::IsNamedExpression;
+ if (irFunction->hasTry || irFunction->hasWith)
+ function->flags |= CompiledData::Function::HasCatchOrWith;
function->nFormals = irFunction->formals.size();
function->formalsOffset = currentOffset;
currentOffset += function->nFormals * sizeof(quint32);
diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp
index 58bf102c9d..e49216b103 100644
--- a/src/qml/compiler/qv4isel_masm.cpp
+++ b/src/qml/compiler/qv4isel_masm.cpp
@@ -310,7 +310,7 @@ Assembler::Pointer Assembler::loadTempAddress(RegisterID baseReg, V4IR::Temp *t)
switch (t->kind) {
case V4IR::Temp::Formal:
case V4IR::Temp::ScopedFormal: {
- loadPtr(Address(context, qOffsetOf(CallContext, callData)), baseReg);
+ loadPtr(Address(context, qOffsetOf(ExecutionContext, callData)), baseReg);
offset = sizeof(CallData) + (t->index - 1) * sizeof(SafeValue);
} break;
case V4IR::Temp::Local:
@@ -953,7 +953,7 @@ void InstructionSelection::callValue(V4IR::Temp *value, V4IR::ExprList *args, V4
void InstructionSelection::loadThisObject(V4IR::Temp *temp)
{
- _as->loadPtr(Address(Assembler::ContextRegister, qOffsetOf(CallContext, callData)), Assembler::ScratchRegister);
+ _as->loadPtr(Address(Assembler::ContextRegister, qOffsetOf(ExecutionContext, callData)), Assembler::ScratchRegister);
#if defined(VALUE_FITS_IN_REGISTER)
_as->load64(Pointer(Assembler::ScratchRegister, qOffsetOf(CallData, thisObject)),
Assembler::ReturnValueRegister);