diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-08-04 18:53:51 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-08-08 18:58:14 +0000 |
commit | 50e7badd5f261bd69db9d8f03d5651e346087218 (patch) | |
tree | 73c2771fbc98168280182e77337b06efa39f4a7b /src/qml/jsruntime/qv4booleanobject.cpp | |
parent | 8abb6c41bf055d59c6b57a809e3b027293568848 (diff) |
Remove Scope::result and convert calling convention for builtins
Allow for faster calling of builtins, and completely avoid
scope creation in many cases.
Change-Id: I0f1681e19e9908db10def85a74e134a87fc2e44c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4booleanobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4booleanobject.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/qml/jsruntime/qv4booleanobject.cpp b/src/qml/jsruntime/qv4booleanobject.cpp index 0ed8471753..d74750fa8c 100644 --- a/src/qml/jsruntime/qv4booleanobject.cpp +++ b/src/qml/jsruntime/qv4booleanobject.cpp @@ -73,31 +73,30 @@ void BooleanPrototype::init(ExecutionEngine *engine, Object *ctor) defineDefaultProperty(engine->id_valueOf(), method_valueOf); } -void BooleanPrototype::method_toString(const BuiltinFunction *, Scope &scope, CallData *callData) +ReturnedValue BooleanPrototype::method_toString(const BuiltinFunction *b, CallData *callData) { + ExecutionEngine *v4 = b->engine(); bool result; if (callData->thisObject.isBoolean()) { result = callData->thisObject.booleanValue(); } else { const BooleanObject *thisObject = callData->thisObject.as<BooleanObject>(); if (!thisObject) - THROW_TYPE_ERROR(); + return v4->throwTypeError(); result = thisObject->value(); } - scope.result = result ? scope.engine->id_true() : scope.engine->id_false(); + return Encode(result ? v4->id_true() : v4->id_false()); } -void BooleanPrototype::method_valueOf(const BuiltinFunction *, Scope &scope, CallData *callData) +ReturnedValue BooleanPrototype::method_valueOf(const BuiltinFunction *b, CallData *callData) { - if (callData->thisObject.isBoolean()) { - scope.result = callData->thisObject.asReturnedValue(); - return; - } + if (callData->thisObject.isBoolean()) + return callData->thisObject.asReturnedValue(); const BooleanObject *thisObject = callData->thisObject.as<BooleanObject>(); if (!thisObject) - THROW_TYPE_ERROR(); + return b->engine()->throwTypeError(); - scope.result = Encode(thisObject->value()); + return Encode(thisObject->value()); } |