diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-10-24 12:39:17 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-11-13 08:56:07 +0000 |
commit | d9b0878595e7ee2698ddc8c724657574d5fe4d4c (patch) | |
tree | a47a1d22de72f94a0447b4edf9cff785e5060b0e | |
parent | a2142203ad6cdb54ec063e259b40171e13c5d4bd (diff) |
Inline callValue and callPropertyLookup
Change-Id: I782fe0ca325dd5b0e35d9a980f531cf12bce6269
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/qml/jsruntime/qv4vme_moth.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index 282f71fb2e..5b01e5a26b 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -745,7 +745,12 @@ QV4::ReturnedValue VME::exec(CallData *callData, QV4::Function *function) MOTH_BEGIN_INSTR(CallValue) STORE_IP(); STORE_ACC(); - acc = Runtime::method_callValue(engine, accumulator, stack + argv, argc); + Value func = Value::fromReturnedValue(acc); + if (Q_UNLIKELY(!func.isFunctionObject())) { + acc = engine->throwTypeError(QStringLiteral("%1 is not a function").arg(func.toQStringNoThrow())); + goto catchException; + } + acc = static_cast<const FunctionObject &>(func).call(nullptr, stack + argv, argc); CHECK_EXCEPTION; MOTH_END_INSTR(CallValue) @@ -757,7 +762,16 @@ QV4::ReturnedValue VME::exec(CallData *callData, QV4::Function *function) MOTH_BEGIN_INSTR(CallPropertyLookup) STORE_IP(); - acc = Runtime::method_callPropertyLookup(engine, stack + base, lookupIndex, stack + argv, argc); + Lookup *l = function->compilationUnit->runtimeLookups + lookupIndex; + // ok to have the value on the stack here + Value f = Value::fromReturnedValue(l->getter(l, engine, stack[base])); + + if (Q_UNLIKELY(!f.isFunctionObject())) { + acc = engine->throwTypeError(); + goto catchException; + } + + acc = static_cast<FunctionObject &>(f).call(stack + base, stack + argv, argc); CHECK_EXCEPTION; MOTH_END_INSTR(CallPropertyLookup) |