aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-10-30 13:03:49 +0100
committerLars Knoll <lars.knoll@qt.io>2017-11-13 08:56:20 +0000
commitadd35f929e28ba00fabaf6d3ae5a24bb0e799477 (patch)
treec9a685ed45128777f31c47351468105c303cb72a
parent1b99f5d820a6c190e6fbe01c0a97052d7e222c85 (diff)
Inline Runtime::method_instanceOf into the VME
Seems to give some slight performance improvements Change-Id: I8740ec25b373caab187d0874f5d4403bcb001d0f Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index 58b54cf86c..42c0abf3cb 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -1115,8 +1115,15 @@ QV4::ReturnedValue VME::exec(const FunctionObject *fo, const Value *thisObject,
MOTH_END_INSTR(CmpIn)
MOTH_BEGIN_INSTR(CmpInstanceOf)
- STORE_ACC();
- acc = Runtime::method_instanceof(engine, STACK_VALUE(lhs), accumulator);
+ // 11.8.6, 5: rval must be an Object
+ const Object *rhs = Primitive::fromReturnedValue(acc).as<Object>();
+ if (Q_UNLIKELY(!rhs)) {
+ acc = engine->throwTypeError();
+ goto catchException;
+ }
+
+ // 11.8.6, 7: call "HasInstance", which we term instanceOf, and return the result.
+ acc = rhs->instanceOf(STACK_VALUE(lhs));
CHECK_EXCEPTION;
MOTH_END_INSTR(CmpInstanceOf)