aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-09 16:32:18 +0200
committerLars Knoll <lars.knoll@qt.io>2017-08-10 08:20:08 +0000
commitb459c43c5d119507f888ac9ab1ca96f8e7bb6e34 (patch)
tree9612d3a6bd0644ba53337106b3196d747ad61252
parent6a91dcba2e4fa85dc345c2d403c757ab7676e28c (diff)
Always retrieve the this object from the stack
There is actually no point in even having it in the context, as it's immutable and can't become part of a closure. Change-Id: I375fd07b9c442d667488430ebd246e174fdb243f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--src/qml/compiler/qv4codegen.cpp11
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp12
-rw-r--r--src/qml/jsruntime/qv4runtimeapi_p.h1
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp16
4 files changed, 9 insertions, 31 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index f62e1672da..eee9d05d52 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -3027,14 +3027,9 @@ void Codegen::Reference::loadInAccumulator() const
} return;
case This: {
Context *c = codegen->currentContext();
- if (c->canUseSimpleCall()) {
- Instruction::LoadReg load;
- load.reg = Moth::StackSlot::createArgument(c->arguments.size(), -1);
- codegen->bytecodeGenerator->addInstruction(load);
- } else {
- Instruction::LoadThis load;
- codegen->bytecodeGenerator->addInstruction(load);
- }
+ Instruction::LoadReg load;
+ load.reg = Moth::StackSlot::createArgument(c->arguments.size(), -1);
+ codegen->bytecodeGenerator->addInstruction(load);
} return;
case Invalid:
break;
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index ac1faae6c9..8a630b451c 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -1405,18 +1405,6 @@ QV4::ReturnedValue Runtime::method_loadQmlSingleton(QV4::NoThrowEngine *engine,
return engine->qmlSingletonWrapper(name);
}
-void Runtime::method_convertThisToObject(ExecutionEngine *engine)
-{
- Value *t = &engine->currentContext()->d()->callData->thisObject;
- if (t->isObject())
- return;
- if (t->isNullOrUndefined()) {
- *t = engine->globalObject->asReturnedValue();
- } else {
- *t = t->toObject(engine)->asReturnedValue();
- }
-}
-
ReturnedValue Runtime::method_uMinus(const Value &value)
{
TRACE1(value);
diff --git a/src/qml/jsruntime/qv4runtimeapi_p.h b/src/qml/jsruntime/qv4runtimeapi_p.h
index caaefa2f75..e7f9a04434 100644
--- a/src/qml/jsruntime/qv4runtimeapi_p.h
+++ b/src/qml/jsruntime/qv4runtimeapi_p.h
@@ -139,7 +139,6 @@ struct ExceptionCheck<void (*)(QV4::NoThrowEngine *, A, B, C)> {
F(void, declareVar, (ExecutionEngine *engine, bool deletable, int nameIndex)) \
F(ReturnedValue, createMappedArgumentsObject, (ExecutionEngine *engine)) \
F(ReturnedValue, createUnmappedArgumentsObject, (ExecutionEngine *engine)) \
- F(void, convertThisToObject, (ExecutionEngine *engine)) \
\
/* literals */ \
F(ReturnedValue, arrayLiteral, (ExecutionEngine *engine, Value *values, uint length)) \
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index e98d5a7677..7655f898c3 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -746,17 +746,13 @@ QV4::ReturnedValue VME::exec(const FunctionObject *jsFunction, CallData *callDat
MOTH_END_INSTR(CreateUnmappedArgumentsObject)
MOTH_BEGIN_INSTR(ConvertThisToObject)
- if (function->canUseSimpleFunction()) {
- Value *t = &stack[-(int)function->nFormals - 1];
- if (!t->isObject()) {
- if (t->isNullOrUndefined()) {
- *t = engine->globalObject->asReturnedValue();
- } else {
- *t = t->toObject(engine)->asReturnedValue();
- }
+ Value *t = &stack[-(int)function->nFormals - 1];
+ if (!t->isObject()) {
+ if (t->isNullOrUndefined()) {
+ *t = engine->globalObject->asReturnedValue();
+ } else {
+ *t = t->toObject(engine)->asReturnedValue();
}
- } else {
- Runtime::method_convertThisToObject(engine);
}
CHECK_EXCEPTION;
MOTH_END_INSTR(ConvertThisToObject)