aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-16 16:30:15 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2017-08-25 11:59:18 +0000
commit34280d266fe4bed0274b260c0091d50908acd087 (patch)
treec7a757587a33119c293b1c909d228f38f4179347 /src/qml/jsruntime
parent69a1018c9737751c2cc7daae2c03882dc81bd104 (diff)
Cleanup object construction instructions
Remove the unused Create/Construct instructions, and rename the single remaining one to 'Construct'. Change-Id: I10163a15681156f37e34d21a05d195d3c22adcff Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp59
-rw-r--r--src/qml/jsruntime/qv4runtimeapi_p.h6
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp38
3 files changed, 5 insertions, 98 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 8a630b451c..a1d480160f 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -1126,36 +1126,7 @@ ReturnedValue Runtime::method_callValue(ExecutionEngine *engine, const Value &fu
}
-ReturnedValue Runtime::method_constructGlobalLookup(ExecutionEngine *engine, uint index, CallData *callData)
-{
- Scope scope(engine);
- Q_ASSERT(callData->thisObject.isUndefined());
-
- Lookup *l = engine->currentStackFrame->v4Function->compilationUnit->runtimeLookups + index;
- ScopedObject f(scope, l->globalGetter(l, engine));
- if (f)
- return f->construct(callData);
-
- return engine->throwTypeError();
-}
-
-
-ReturnedValue Runtime::method_constructName(ExecutionEngine *engine, int nameIndex, CallData *callData)
-{
- Scope scope(engine);
- ScopedString name(scope, engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex]);
- ScopedValue func(scope, static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context).getProperty(name));
- if (scope.engine->hasException)
- return Encode::undefined();
-
- Object *f = func->as<Object>();
- if (!f)
- return engine->throwTypeError();
-
- return f->construct(callData);
-}
-
-ReturnedValue Runtime::method_constructValue(ExecutionEngine *engine, const Value &func, CallData *callData)
+ReturnedValue Runtime::method_construct(ExecutionEngine *engine, const Value &func, CallData *callData)
{
const Object *f = func.as<Object>();
if (!f)
@@ -1164,34 +1135,6 @@ ReturnedValue Runtime::method_constructValue(ExecutionEngine *engine, const Valu
return f->construct(callData);
}
-ReturnedValue Runtime::method_constructProperty(ExecutionEngine *engine, int nameIndex, CallData *callData)
-{
- Scope scope(engine);
- ScopedObject thisObject(scope, callData->thisObject.toObject(engine));
- ScopedString name(scope, engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex]);
- if (scope.engine->hasException)
- return Encode::undefined();
-
- ScopedObject f(scope, thisObject->get(name));
- if (f)
- return f->construct(callData);
-
- return engine->throwTypeError();
-}
-
-ReturnedValue Runtime::method_constructPropertyLookup(ExecutionEngine *engine, uint index, CallData *callData)
-{
- Lookup *l = engine->currentStackFrame->v4Function->compilationUnit->runtimeLookups + index;
- Value v;
- v = l->getter(l, engine, callData->thisObject);
- Object *o = v.objectValue();
- if (Q_LIKELY(o))
- return o->construct(callData);
-
- return engine->throwTypeError();
-}
-
-
void Runtime::method_throwException(ExecutionEngine *engine, const Value &value)
{
if (!value.isEmpty())
diff --git a/src/qml/jsruntime/qv4runtimeapi_p.h b/src/qml/jsruntime/qv4runtimeapi_p.h
index e7f9a04434..d8e1b4f443 100644
--- a/src/qml/jsruntime/qv4runtimeapi_p.h
+++ b/src/qml/jsruntime/qv4runtimeapi_p.h
@@ -100,11 +100,7 @@ struct ExceptionCheck<void (*)(QV4::NoThrowEngine *, A, B, C)> {
F(ReturnedValue, callValue, (ExecutionEngine *engine, const Value &func, CallData *callData)) \
\
/* construct */ \
- F(ReturnedValue, constructGlobalLookup, (ExecutionEngine *engine, uint index, CallData *callData)) \
- F(ReturnedValue, constructName, (ExecutionEngine *engine, int nameIndex, CallData *callData)) \
- F(ReturnedValue, constructProperty, (ExecutionEngine *engine, int nameIndex, CallData *callData)) \
- F(ReturnedValue, constructPropertyLookup, (ExecutionEngine *engine, uint index, CallData *callData)) \
- F(ReturnedValue, constructValue, (ExecutionEngine *engine, const Value &func, CallData *callData)) \
+ F(ReturnedValue, construct, (ExecutionEngine *engine, const Value &func, CallData *callData)) \
\
/* load & store */ \
F(void, storeNameStrict, (ExecutionEngine *engine, int nameIndex, const Value &value)) \
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index d8d900f2bd..6d20fcc426 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -874,42 +874,10 @@ QV4::ReturnedValue VME::exec(const FunctionObject *jsFunction, CallData *callDat
CHECK_EXCEPTION;
MOTH_END_INSTR(ConvertThisToObject)
- MOTH_BEGIN_INSTR(CreateValue)
+ MOTH_BEGIN_INSTR(Construct)
QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData.stackSlot());
- STORE_ACCUMULATOR(Runtime::method_constructValue(engine, STACK_VALUE(instr.func), callData));
- MOTH_END_INSTR(CreateValue)
-
- MOTH_BEGIN_INSTR(CreateProperty)
- QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData.stackSlot());
- callData->tag = quint32(Value::ValueTypeInternal::Integer);
- callData->argc = instr.argc;
- callData->thisObject = STACK_VALUE(instr.base);
- STORE_ACCUMULATOR(Runtime::method_constructProperty(engine, instr.name, callData));
- MOTH_END_INSTR(CreateProperty)
-
- MOTH_BEGIN_INSTR(ConstructPropertyLookup)
- QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData.stackSlot());
- callData->tag = quint32(Value::ValueTypeInternal::Integer);
- callData->argc = instr.argc;
- callData->thisObject = STACK_VALUE(instr.base);
- STORE_ACCUMULATOR(Runtime::method_constructPropertyLookup(engine, instr.index, callData));
- MOTH_END_INSTR(ConstructPropertyLookup)
-
- MOTH_BEGIN_INSTR(CreateName)
- QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData.stackSlot());
- callData->tag = quint32(Value::ValueTypeInternal::Integer);
- callData->argc = instr.argc;
- callData->thisObject = QV4::Primitive::undefinedValue();
- STORE_ACCUMULATOR(Runtime::method_constructName(engine, instr.name, callData));
- MOTH_END_INSTR(CreateName)
-
- MOTH_BEGIN_INSTR(ConstructGlobalLookup)
- QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData.stackSlot());
- callData->tag = quint32(Value::ValueTypeInternal::Integer);
- callData->argc = instr.argc;
- callData->thisObject = QV4::Primitive::undefinedValue();
- STORE_ACCUMULATOR(Runtime::method_constructGlobalLookup(engine, instr.index, callData));
- MOTH_END_INSTR(ConstructGlobalLookup)
+ STORE_ACCUMULATOR(Runtime::method_construct(engine, STACK_VALUE(instr.func), callData));
+ MOTH_END_INSTR(Construct)
MOTH_BEGIN_INSTR(Jump)
code = reinterpret_cast<const uchar *>(&instr.offset) + instr.offset;